summaryrefslogtreecommitdiff
path: root/django/utils/regex_helper.py
diff options
context:
space:
mode:
authorAnton Samarchyan <anton.samarchyan@savoirfairelinux.com>2017-01-24 15:32:33 -0500
committerTim Graham <timograham@gmail.com>2017-02-11 16:11:08 -0500
commit9718fa2e8abe430c3526a9278dd976443d4ae3c6 (patch)
treecc9e2c659759bbfdb4c7785c59a909cb2655af0d /django/utils/regex_helper.py
parent98bcc5d81bca578f3a5b4d47907ba4ac40446887 (diff)
Refs #27656 -- Updated django.utils docstring verbs according to PEP 257.
Diffstat (limited to 'django/utils/regex_helper.py')
-rw-r--r--django/utils/regex_helper.py30
1 files changed, 11 insertions, 19 deletions
diff --git a/django/utils/regex_helper.py b/django/utils/regex_helper.py
index f5cfc57156..9e57ff8f15 100644
--- a/django/utils/regex_helper.py
+++ b/django/utils/regex_helper.py
@@ -27,28 +27,20 @@ ESCAPE_MAPPINGS = {
class Choice(list):
- """
- Used to represent multiple possibilities at this point in a pattern string.
- We use a distinguished type, rather than a list, so that the usage in the
- code is clear.
- """
+ """Represent multiple possibilities at this point in a pattern string."""
class Group(list):
- """
- Used to represent a capturing group in the pattern string.
- """
+ """Represent a capturing group in the pattern string."""
class NonCapture(list):
- """
- Used to represent a non-capturing group in the pattern string.
- """
+ """Represent a non-capturing group in the pattern string."""
def normalize(pattern):
r"""
- Given a reg-exp pattern, normalizes it to an iterable of forms that
+ Given a reg-exp pattern, normalize it to an iterable of forms that
suffice for reverse matching. This does the following:
(1) For any repeating sections, keeps the minimum number of occurrences
@@ -212,7 +204,7 @@ def next_char(input_iter):
its class (e.g. \w -> "x"). If the escaped character is one that is
skipped, it is not returned (the next character is returned instead).
- Yields the next character, along with a boolean indicating whether it is a
+ Yield the next character, along with a boolean indicating whether it is a
raw (unescaped) character or not.
"""
for ch in input_iter:
@@ -228,8 +220,8 @@ def next_char(input_iter):
def walk_to_end(ch, input_iter):
"""
- The iterator is currently inside a capturing group. We want to walk to the
- close of this group, skipping over any nested groups and handling escaped
+ The iterator is currently inside a capturing group. Walk to the close of
+ this group, skipping over any nested groups and handling escaped
parentheses correctly.
"""
if ch == '(':
@@ -252,7 +244,7 @@ def get_quantifier(ch, input_iter):
Parse a quantifier from the input, where "ch" is the first character in the
quantifier.
- Returns the minimum number of occurrences permitted by the quantifier and
+ Return the minimum number of occurrences permitted by the quantifier and
either None or the next character from the input_iter if the next character
is not part of the quantifier.
"""
@@ -286,7 +278,7 @@ def get_quantifier(ch, input_iter):
def contains(source, inst):
"""
- Returns True if the "source" contains an instance of "inst". False,
+ Return True if the "source" contains an instance of "inst". False,
otherwise.
"""
if isinstance(source, inst):
@@ -300,8 +292,8 @@ def contains(source, inst):
def flatten_result(source):
"""
- Turns the given source sequence into a list of reg-exp possibilities and
- their arguments. Returns a list of strings and a list of argument lists.
+ Turn the given source sequence into a list of reg-exp possibilities and
+ their arguments. Return a list of strings and a list of argument lists.
Each of the two lists will be of the same length.
"""
if source is None: