Skip to content

Commit

Permalink
Merge pull request #750 from hhatto/skip-e501-fstring
Browse files Browse the repository at this point in the history
skip e501 fixed method for f-string line(s)
  • Loading branch information
hhatto authored May 29, 2024
2 parents 6878c96 + b4c586d commit dc9656f
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion autopep8.py
Original file line number Diff line number Diff line change
Expand Up @@ -3376,13 +3376,20 @@ def multiline_string_lines(source, include_docstrings=False):
"""
line_numbers = set()
previous_token_type = ''
_check_target_tokens = [tokenize.STRING]
if IS_SUPPORT_TOKEN_FSTRING:
_check_target_tokens.extend([
tokenize.FSTRING_START,
tokenize.FSTRING_MIDDLE,
tokenize.FSTRING_END,
])
try:
for t in generate_tokens(source):
token_type = t[0]
start_row = t[2][0]
end_row = t[3][0]

if token_type == tokenize.STRING and start_row != end_row:
if token_type in _check_target_tokens and start_row != end_row:
if (
include_docstrings or
previous_token_type != tokenize.INDENT
Expand Down

0 comments on commit dc9656f

Please sign in to comment.