Fix false positive E121 with multiple brackets; issue #203
authorFlorent Xicluna <florent.xicluna@gmail.com>
Sat, 15 Jun 2013 14:57:26 +0000 (16:57 +0200)
committerFlorent Xicluna <florent.xicluna@gmail.com>
Sat, 15 Jun 2013 14:57:26 +0000 (16:57 +0200)
CHANGES.txt
pep8.py
testsuite/E12not.py

index 6e467d3a94af1b3ea955473ab8ea2238d811aa2c..0600040d4d924e503734f15098b715b2585fca21 100644 (file)
@@ -26,6 +26,8 @@ Changelog
 
 * Fix E122 not detected in some cases. (Issue #201)
 
+* Fix false positive E121 with multiple brackets. (Issue #203)
+
 
 1.4.5 (2013-03-06)
 ------------------
diff --git a/pep8.py b/pep8.py
index 56e34a18c675b80aed434380cc0602433513e164..a765562794e85dd8826684d01779c3ccfca0fddd 100755 (executable)
--- a/pep8.py
+++ b/pep8.py
@@ -535,6 +535,7 @@ def continued_indentation(logical_line, tokens, indent_level, noqa, verbose):
                 for idx in range(row, -1, -1):
                     if parens[idx]:
                         parens[idx] -= 1
+                        rel_indent[row] = rel_indent[idx]
                         break
             assert len(indent) == depth + 1
             if start[1] not in indent_chances:
@@ -543,7 +544,7 @@ def continued_indentation(logical_line, tokens, indent_level, noqa, verbose):
 
         last_token_multiline = (start[0] != end[0])
 
-    if indent_next and rel_indent[-1] == 4:
+    if indent_next and expand_indent(line) == indent_level + 4:
         yield (last_indent, "E125 continuation line does not distinguish "
                "itself from next logical line")
 
index 7095744680010f674b464056a4df336920df5e1e..c50f27f20900d242d1af41619721a07226e0a8b5 100644 (file)
@@ -564,4 +564,18 @@ result = some_function_that_takes_arguments('a', 'b', 'c',
                                             'd', 'e', 'f',
                                             )
 
+# issue 203
+dica = {
+    ('abc'
+     'def'): (
+        'abc'),
+}
+
+(abcdef[0]
+       [1]) = (
+    'abc')
+
+('abc'
+ 'def') == (
+    'abc')
 #