Skip to content

Commit

Permalink
Merge pull request #728 from j-z10/main
Browse files Browse the repository at this point in the history
async def function formatting
  • Loading branch information
hhatto authored Mar 14, 2024
2 parents 37abe3a + 204dc6a commit 30e79c9
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions autopep8.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ def extended_blank_lines(logical_line,
indent_level,
previous_logical):
"""Check for missing blank lines after class declaration."""
if previous_logical.startswith('def '):
if previous_logical.startswith(('def ', 'async def ')):
if blank_lines and pycodestyle.DOCSTRING_REGEX.match(logical_line):
yield (0, 'E303 too many blank lines ({})'.format(blank_lines))
elif pycodestyle.DOCSTRING_REGEX.match(previous_logical):
Expand All @@ -211,7 +211,7 @@ def extended_blank_lines(logical_line,
indent_level and
not blank_lines and
not blank_before and
logical_line.startswith(('def ')) and
logical_line.startswith(('def ', 'async def ')) and
'(self' in logical_line
):
yield (0, 'E301 expected 1 blank line, found 0')
Expand Down Expand Up @@ -2914,7 +2914,7 @@ def normalize_multiline(line):
This is for purposes of checking syntax.
"""
if line.startswith('def ') and line.rstrip().endswith(':'):
if line.startswith(('def ', 'async def ')) and line.rstrip().endswith(':'):
return line + ' pass'
elif line.startswith('return '):
return 'def _(): ' + line
Expand Down

0 comments on commit 30e79c9

Please sign in to comment.