Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion pycodestyle.py
Original file line number Diff line number Diff line change
Expand Up @@ -250,10 +250,12 @@ def blank_lines(logical_line, blank_lines, indent_level, line_number,
Use blank lines in functions, sparingly, to indicate logical sections.

Okay: def a():\n pass\n\n\ndef b():\n pass
Okay: def a():\n pass\n\n\nasync def b():\n pass
Okay: def a():\n pass\n\n\n# Foo\n# Bar\n\ndef b():\n pass

E301: class Foo:\n b = 0\n def bar():\n pass
E302: def a():\n pass\n\ndef b(n):\n pass
E302: def a():\n pass\n\nasync def b(n):\n pass
E303: def a():\n pass\n\n\n\ndef b(n):\n pass
E303: def a():\n\n\n\n pass
E304: @decorator\n\ndef a():\n pass
Expand All @@ -266,7 +268,7 @@ def blank_lines(logical_line, blank_lines, indent_level, line_number,
yield 0, "E304 blank lines found after function decorator"
elif blank_lines > 2 or (indent_level and blank_lines == 2):
yield 0, "E303 too many blank lines (%d)" % blank_lines
elif logical_line.startswith(('def ', 'class ', '@')):
elif logical_line.startswith(('def ', 'async def', 'class ', '@')):
if indent_level:
if not (blank_before or previous_indent_level < indent_level or
DOCSTRING_REGEX.match(previous_logical)):
Expand Down
6 changes: 6 additions & 0 deletions testsuite/E30.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,13 @@ def a():
def b():
pass
#:
#: E302:4:1
def a():
pass

async def b():
pass
#:

#: E303:5:1
print
Expand Down