diff options
-rwxr-xr-x | pep8.py | 8 | ||||
-rw-r--r-- | testsuite/E12.py | 15 | ||||
-rw-r--r-- | testsuite/E12not.py | 12 |
3 files changed, 21 insertions, 14 deletions
@@ -482,6 +482,7 @@ def continuation_line_indentation(logical_line, tokens, indent_level): rel_indent = [0] * nrows # visual indent columns by indent depth indent = [indent_level] + first_visual = [indent_level] if options.verbose >= 3: print(">>> " + tokens[0][4].rstrip()) @@ -583,9 +584,10 @@ def continuation_line_indentation(logical_line, tokens, indent_level): # look for visual indenting if ((parens[row] and token_type != tokenize.NL and - hasattr(indent[depth], 'add'))): - # text after an open parens starts visual indenting + hasattr(indent[depth], 'add')) and + first_visual[depth] is None): indent[depth].add(start[1]) + first_visual[depth] = start[1] if options.verbose >= 4: print("bracket depth %s indent to %s" % (depth, start[1])) @@ -604,6 +606,7 @@ def continuation_line_indentation(logical_line, tokens, indent_level): if token_type == tokenize.OP: if text in '([{': indent.append(set()) + first_visual.append(None) depth += 1 parens[row] += 1 if options.verbose >= 4: @@ -611,6 +614,7 @@ def continuation_line_indentation(logical_line, tokens, indent_level): (depth, start[1], indent[depth])) elif text in ')]}' and depth > 0: indent.pop() + first_visual.pop() depth -= 1 for idx in range(row, -1, -1): if parens[idx]: diff --git a/testsuite/E12.py b/testsuite/E12.py index f5c7c97..deef54c 100644 --- a/testsuite/E12.py +++ b/testsuite/E12.py @@ -174,12 +174,27 @@ foo(1, 2, 3, 4, 5, 6) #: E127 foo(1, 2, 3, + 4, 5, 6) +#: E127 +foo(1, 2, 3, 4, 5, 6) #: E127 foo(1, 2, 3, + 4, 5, 6) +#: E127 +foo(1, 2, 3, + 4, 5, 6) +#: E127 +foo(1, 2, 3, 4, 5, 6) #: E127 foo(1, 2, 3, + 4, 5, 6) +#: E127 +foo(1, 2, 3, + 4, 5, 6) +#: E127 +foo(1, 2, 3, 4, 5, 6) #: E127 foo(1, 2, 3, diff --git a/testsuite/E12not.py b/testsuite/E12not.py index 4a49375..ea9df1f 100644 --- a/testsuite/E12not.py +++ b/testsuite/E12not.py @@ -424,15 +424,3 @@ troublefree_hash = { foo(1, 2, 3, 4, 5, 6) - -# TODO -foo(1, 2, 3, - 4, 5, 6) -foo(1, 2, 3, - 4, 5, 6) -foo(1, 2, 3, - 4, 5, 6) -foo(1, 2, 3, - 4, 5, 6) -foo(1, 2, 3, - 4, 5, 6) |