Skip to content

Commit 0126ce4

Browse files
committed
E306: fix detection inside async def
1 parent 99f354d commit 0126ce4

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

pycodestyle.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,7 @@ def blank_lines(logical_line, blank_lines, indent_level, line_number,
383383
for line in lines[line_number - top_level_lines::-1]:
384384
if line.strip() and expand_indent(line) < ancestor_level:
385385
ancestor_level = expand_indent(line)
386-
nested = line.lstrip().startswith('def ')
386+
nested = STARTSWITH_DEF_REGEX.match(line.lstrip())
387387
if nested or ancestor_level == 0:
388388
break
389389
if nested:

testsuite/E30.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,11 @@ def a():
124124
x = 1
125125
def b():
126126
pass
127+
#: E306:3:5
128+
async def a():
129+
x = 1
130+
def b():
131+
pass
127132
#: E306:3:5 E306:5:9
128133
def a():
129134
x = 2

0 commit comments

Comments
 (0)