From 0126ce47f640e131a28029e8d75f9768a547f2f4 Mon Sep 17 00:00:00 2001 From: Anthony Sottile Date: Tue, 28 Apr 2020 16:43:57 -0700 Subject: E306: fix detection inside `async def` --- pycodestyle.py | 2 +- testsuite/E30.py | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) 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 -- cgit v1.2.1