Skip to content

Commit 3141151

Browse files
committed
Merge pull request #508 from PyCQA/bug/507
Allow spaces around = in async definitions
2 parents 53a2441 + 2f6c43b commit 3141151

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

pep8.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -776,6 +776,7 @@ def whitespace_around_named_parameter_equals(logical_line, tokens):
776776
Okay: boolean(a <= b)
777777
Okay: boolean(a >= b)
778778
Okay: def foo(arg: int = 42):
779+
Okay: async def foo(arg: int = 42):
779780
780781
E251: def complex(real, imag = 0.0):
781782
E251: return magic(r = real, i = imag)
@@ -784,7 +785,7 @@ def whitespace_around_named_parameter_equals(logical_line, tokens):
784785
no_space = False
785786
prev_end = None
786787
annotated_func_arg = False
787-
in_def = logical_line.startswith('def')
788+
in_def = logical_line.startswith(('def', 'async def'))
788789
message = "E251 unexpected spaces around keyword / parameter equals"
789790
for token_type, text, start, end, line in tokens:
790791
if token_type == tokenize.NL:

testsuite/E25.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,6 @@ def foo(bar = False):
3535
def munge(input: AnyStr, sep: AnyStr = None, limit=1000,
3636
extra: Union[str, dict] = None) -> AnyStr:
3737
pass
38+
#: Okay
39+
async def add(a: int = 0, b: int = 0) -> int:
40+
return a + b

0 commit comments

Comments
 (0)