summaryrefslogtreecommitdiff
path: root/pep8.py
diff options
context:
space:
mode:
Diffstat (limited to 'pep8.py')
-rwxr-xr-xpep8.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/pep8.py b/pep8.py
index f9a3d5e..8e16faf 100755
--- a/pep8.py
+++ b/pep8.py
@@ -108,7 +108,7 @@ COMPARE_TYPE_REGEX = re.compile(r'(?:[=!]=|is(?:\s+not)?)\s*type(?:s.\w+Type'
KEYWORD_REGEX = re.compile(r'(\s*)\b(?:%s)\b(\s*)' % r'|'.join(KEYWORDS))
OPERATOR_REGEX = re.compile(r'(?:[^,\s])(\s*)(?:[-+*/|!<=>%&^]+)(\s*)')
LAMBDA_REGEX = re.compile(r'\blambda\b')
-FIELD_ASSIGNMENT_REGEX = re.compile('\s*.+\..+\s=')
+IDENTIFIER_REGEX = re.compile('\s*[^.[\]]+\s=')
HUNK_REGEX = re.compile(r'^@@ -\d+(?:,\d+)? \+(\d+)(?:,(\d+))? @@.*$')
# Work around Python < 2.6 behaviour, which does not generate NL after
@@ -873,7 +873,7 @@ def compound_statements(logical_line):
before.count('[') <= before.count(']') and # [1:2] (slice)
before.count('(') <= before.count(')'))): # (annotation)
if LAMBDA_REGEX.search(before):
- if not FIELD_ASSIGNMENT_REGEX.search(before):
+ if IDENTIFIER_REGEX.match(before):
yield 0, ("E731 do not assign a lambda expression, use a"
" def")
break