Skip to content

Commit e0d2d95

Browse files
committed
Fix false positive E121 with multiple brackets; issue #203
1 parent 03242a7 commit e0d2d95

3 files changed

Lines changed: 18 additions & 1 deletion

File tree

CHANGES.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ Changelog
2626

2727
* Fix E122 not detected in some cases. (Issue #201)
2828

29+
* Fix false positive E121 with multiple brackets. (Issue #203)
30+
2931

3032
1.4.5 (2013-03-06)
3133
------------------

pep8.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -535,6 +535,7 @@ def continued_indentation(logical_line, tokens, indent_level, noqa, verbose):
535535
for idx in range(row, -1, -1):
536536
if parens[idx]:
537537
parens[idx] -= 1
538+
rel_indent[row] = rel_indent[idx]
538539
break
539540
assert len(indent) == depth + 1
540541
if start[1] not in indent_chances:
@@ -543,7 +544,7 @@ def continued_indentation(logical_line, tokens, indent_level, noqa, verbose):
543544

544545
last_token_multiline = (start[0] != end[0])
545546

546-
if indent_next and rel_indent[-1] == 4:
547+
if indent_next and expand_indent(line) == indent_level + 4:
547548
yield (last_indent, "E125 continuation line does not distinguish "
548549
"itself from next logical line")
549550

testsuite/E12not.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -564,4 +564,18 @@ def f():
564564
'd', 'e', 'f',
565565
)
566566

567+
# issue 203
568+
dica = {
569+
('abc'
570+
'def'): (
571+
'abc'),
572+
}
573+
574+
(abcdef[0]
575+
[1]) = (
576+
'abc')
577+
578+
('abc'
579+
'def') == (
580+
'abc')
567581
#

0 commit comments

Comments
 (0)