diff options
author | Anthony Sottile <asottile@umich.edu> | 2017-01-24 14:36:04 -0800 |
---|---|---|
committer | Ian Cordasco <sigmavirus24@users.noreply.github.com> | 2017-01-24 16:36:03 -0600 |
commit | e4312f75d8e589836e080aeeae28aae0a5c7b087 (patch) | |
tree | cfe4905faf18cf02c82a3e0c4864fcdddb2c6141 /pycodestyle.py | |
parent | 30c7c4822db6db1a68672b1d6c6d951eacae4ae6 (diff) | |
download | pep8-e4312f75d8e589836e080aeeae28aae0a5c7b087.tar.gz |
Don't report E701 for variable annotations (#612)
Diffstat (limited to 'pycodestyle.py')
-rwxr-xr-x | pycodestyle.py | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/pycodestyle.py b/pycodestyle.py index 0f14209..a5e376c 100755 --- a/pycodestyle.py +++ b/pycodestyle.py @@ -123,6 +123,17 @@ LAMBDA_REGEX = re.compile(r'\blambda\b') HUNK_REGEX = re.compile(r'^@@ -\d+(?:,\d+)? \+(\d+)(?:,(\d+))? @@.*$') STARTSWITH_DEF_REGEX = re.compile(r'^(async\s+def|def)') STARTSWITH_TOP_LEVEL_REGEX = re.compile(r'^(async\s+def|def|class|@)') +STARTSWITH_INDENT_STATEMENT_REGEX = re.compile( + r'^\s*({0})'.format('|'.join(s.replace(' ', '\s+') for s in ( + 'def', 'async def', + 'for', 'async for', + 'if', 'elif', 'else', + 'try', 'except', 'finally', + 'with', 'async with', + 'class', + 'while', + ))) +) # Work around Python < 2.6 behaviour, which does not generate NL after # a comment which is on a line by itself. @@ -1004,7 +1015,7 @@ def compound_statements(logical_line): break if STARTSWITH_DEF_REGEX.match(line): yield 0, "E704 multiple statements on one line (def)" - else: + elif STARTSWITH_INDENT_STATEMENT_REGEX.match(line): yield found, "E701 multiple statements on one line (colon)" prev_found = found found = line.find(':', found + 1) |