diff options
author | Ian Stapleton Cordasco <graffatcolmingov@gmail.com> | 2020-04-29 06:08:45 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-29 06:08:45 -0500 |
commit | a238201edd2883fcc0400df4a11cbb6fd5f6e5d7 (patch) | |
tree | 4ffd6d1320deaba4929c76c9624dd784ff548b9d | |
parent | 99f354dd37c872e457c0da27924c0ec95b8adffb (diff) | |
parent | 0126ce47f640e131a28029e8d75f9768a547f2f4 (diff) | |
download | pep8-a238201edd2883fcc0400df4a11cbb6fd5f6e5d7.tar.gz |
Merge pull request #929 from PyCQA/E306_async_def
E306: fix detection inside `async def`
-rwxr-xr-x | pycodestyle.py | 2 | ||||
-rw-r--r-- | testsuite/E30.py | 5 |
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 |