summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnthony Sottile <asottile@umich.edu>2020-04-28 16:43:57 -0700
committerAnthony Sottile <asottile@umich.edu>2020-04-28 16:43:57 -0700
commit0126ce47f640e131a28029e8d75f9768a547f2f4 (patch)
tree4ffd6d1320deaba4929c76c9624dd784ff548b9d
parent99f354dd37c872e457c0da27924c0ec95b8adffb (diff)
downloadpep8-E306_async_def.tar.gz
E306: fix detection inside `async def`E306_async_def
-rwxr-xr-xpycodestyle.py2
-rw-r--r--testsuite/E30.py5
2 files changed, 6 insertions, 1 deletions
diff --git a/pycodestyle.py b/pycodestyle.py
index 0ad37e2..fe45548 100755
--- a/pycodestyle.py
+++ b/pycodestyle.py
@@ -383,7 +383,7 @@ def blank_lines(logical_line, blank_lines, indent_level, line_number,
for line in lines[line_number - top_level_lines::-1]:
if line.strip() and expand_indent(line) < ancestor_level:
ancestor_level = expand_indent(line)
- nested = line.lstrip().startswith('def ')
+ nested = STARTSWITH_DEF_REGEX.match(line.lstrip())
if nested or ancestor_level == 0:
break
if nested:
diff --git a/testsuite/E30.py b/testsuite/E30.py
index 8d1879b..ebe4e9d 100644
--- a/testsuite/E30.py
+++ b/testsuite/E30.py
@@ -124,6 +124,11 @@ def a():
x = 1
def b():
pass
+#: E306:3:5
+async def a():
+ x = 1
+ def b():
+ pass
#: E306:3:5 E306:5:9
def a():
x = 2