diff options
author | Ian Cordasco <graffatcolmingov@gmail.com> | 2016-05-23 11:58:11 -0500 |
---|---|---|
committer | Ian Cordasco <graffatcolmingov@gmail.com> | 2016-05-23 11:58:11 -0500 |
commit | 2f6c43bcb3a6bac525198646e99f12b013e4e460 (patch) | |
tree | ea64dd767663f703fa365b119e50b556096af2f5 /pep8.py | |
parent | 53a24414787f93ec11beb18e7d60ba773c978eb8 (diff) | |
download | pep8-2f6c43bcb3a6bac525198646e99f12b013e4e460.tar.gz |
Allow spaces around = in async definitionsbug/507
In pull request gh-361, we allowed spaces around = for default
arguments with annotations. Python 3.5 added the async keyword for
a function definition and the allowance we made in gh-361 was failing.
This allows a function definition to start with either 'def' or
'async def' now and accommodates both cases.
Closes gh-507
Diffstat (limited to 'pep8.py')
-rwxr-xr-x | pep8.py | 3 |
1 files changed, 2 insertions, 1 deletions
@@ -776,6 +776,7 @@ def whitespace_around_named_parameter_equals(logical_line, tokens): Okay: boolean(a <= b) Okay: boolean(a >= b) Okay: def foo(arg: int = 42): + Okay: async def foo(arg: int = 42): E251: def complex(real, imag = 0.0): E251: return magic(r = real, i = imag) @@ -784,7 +785,7 @@ def whitespace_around_named_parameter_equals(logical_line, tokens): no_space = False prev_end = None annotated_func_arg = False - in_def = logical_line.startswith('def') + in_def = logical_line.startswith(('def', 'async def')) message = "E251 unexpected spaces around keyword / parameter equals" for token_type, text, start, end, line in tokens: if token_type == tokenize.NL: |