diff options
author | Florent Xicluna <florent.xicluna@gmail.com> | 2013-02-04 15:49:49 +0100 |
---|---|---|
committer | Florent Xicluna <florent.xicluna@gmail.com> | 2013-02-04 15:49:49 +0100 |
commit | 30661841467f40d5c66f6413f7b4cc65917ba8d7 (patch) | |
tree | 2a48afd3e081b98773eb9832a27034a65888d2ee | |
parent | b0e8e24d1513f77d353fc7a5e044c550e4e8a5a4 (diff) | |
download | pep8-30661841467f40d5c66f6413f7b4cc65917ba8d7.tar.gz |
Accept visual indentation without parenthesis after the if statement. Issue #151
-rw-r--r-- | CHANGES.txt | 3 | ||||
-rwxr-xr-x | pep8.py | 3 | ||||
-rw-r--r-- | testsuite/E12not.py | 4 |
3 files changed, 10 insertions, 0 deletions
diff --git a/CHANGES.txt b/CHANGES.txt index 496068d..2f2c531 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -11,6 +11,9 @@ Changelog * Allow to construct a ``StyleGuide`` with a custom parser. +* Accept visual indentation without parenthesis after the ``if`` + statement. (Issue #151) + 1.4.1 (2013-01-18) ------------------ @@ -510,6 +510,9 @@ def continuation_line_indentation(logical_line, tokens, indent_level, verbose): elif (token_type in (tokenize.STRING, tokenize.COMMENT) or text in ('u', 'ur', 'b', 'br')): indent_chances[start[1]] = str + # special case for the "if" statement because len("if (") == 4 + elif not indent_chances and not row and not depth and text == 'if': + indent_chances[end[1] + 1] = True # keep track of bracket depth if token_type == tokenize.OP: diff --git a/testsuite/E12not.py b/testsuite/E12not.py index 8802872..9509379 100644 --- a/testsuite/E12not.py +++ b/testsuite/E12not.py @@ -541,4 +541,8 @@ d = { # comment 12, # this is a multi-line inline # comment ] +# issue 151 +if a > b and \ + c > d: + moo_like_a_cow() # |