summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorent Xicluna <florent.xicluna@gmail.com>2012-12-09 22:42:12 +0100
committerFlorent Xicluna <florent.xicluna@gmail.com>2012-12-09 22:42:12 +0100
commit46018e052ee8f2512370dbe22f153c0873a2325e (patch)
tree45767e9f55eb71b738b058aad1f1e630376c2b7a
parentd825250fe45c0d2f48ada14e70b0f838c7b91ee0 (diff)
downloadpep8-46018e052ee8f2512370dbe22f153c0873a2325e.tar.gz
Fix E225 when operator is preceded by a comma; issue #135
-rw-r--r--CHANGES.txt4
-rwxr-xr-xpep8.py2
-rw-r--r--testsuite/E12not.py2
-rw-r--r--testsuite/E24.py5
4 files changed, 10 insertions, 3 deletions
diff --git a/CHANGES.txt b/CHANGES.txt
index ed2af48..7f491c8 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -15,7 +15,9 @@ Changelog
* Catch E271 at the beginning of the line. (Issue #133)
-* Fix false positive E126. (Issue #138)
+* Fix false positive E126 for multi-line comments. (Issue #138)
+
+* Fix false positive E221 when operator is preceded by a comma. (Issue #135)
* Fix ``--diff`` failing on one-line hunk. (Issue #137)
diff --git a/pep8.py b/pep8.py
index 524fed2..1e6e3ba 100755
--- a/pep8.py
+++ b/pep8.py
@@ -150,7 +150,7 @@ COMPARE_TYPE_REGEX = re.compile(r'([=!]=|is|is\s+not)\s*type(?:s\.(\w+)Type'
r'|\(\s*(\(\s*\)|[^)]*[^ )])\s*\))')
KEYWORD_REGEX = re.compile(r'(?:[^\s]|\b)(\s*)\b(?:%s)\b(\s*)' %
r'|'.join(KEYWORDS))
-OPERATOR_REGEX = re.compile(r'(?:[^\s])(\s*)(?:[-+*/|!<=>%&^]+)(\s*)')
+OPERATOR_REGEX = re.compile(r'(?:[^,\s])(\s*)(?:[-+*/|!<=>%&^]+)(\s*)')
LAMBDA_REGEX = re.compile(r'\blambda\b')
HUNK_REGEX = re.compile(r'^@@ -\d+(?:,\d+)? \+(\d+)(?:,(\d+))? @@.*$')
diff --git a/testsuite/E12not.py b/testsuite/E12not.py
index 9f9bef2..8802872 100644
--- a/testsuite/E12not.py
+++ b/testsuite/E12not.py
@@ -536,7 +536,7 @@ d = { # comment
1: 2
}
-# issue #138
+# issue 138
[
12, # this is a multi-line inline
# comment
diff --git a/testsuite/E24.py b/testsuite/E24.py
index a93222c..9ca8e2b 100644
--- a/testsuite/E24.py
+++ b/testsuite/E24.py
@@ -6,3 +6,8 @@ b = (1, 20)
a = (1, 2) # tab before 2
#: Okay
b = (1, 20) # space before 20
+#: E241
+# issue 135
+more_spaces = [a, b,
+ ef, +h,
+ c, -d]