Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

async def function formatting #728

Merged
merged 1 commit into from
Mar 14, 2024
Merged
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
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
Loading