autopep8
autopep8 copied to clipboard
Formatting text with variables using f"" lead to not nice break
Python Code
print(f"{dasdsadasdsadassdsadasdasddasddasd}{dasdsadasdsadasdasddasd}{dasdsadasdsadasdasddasd}")
This lead to
print(f"{dasdsadasdsadassdsadasdasddasddasd}{
dasdsadasdsadasdasddasd}{dasdsadasdsadasdasddasd}")
Better would be
print(f"{dasdsadasdsadassdsadasdasddasddasd}\
{dasdsadasdsadasdasddasd}{dasdsadasdsadasdasddasd}")
or format it as without "f" (like basic string without variables)
Command Line and Configuration
.pep8, setup.cfg, ...
[pep8]
VSCode default
Command Line
$ autopep8
VSCode default
Your Environment
- Python version:
- autopep8 version:
- Platform: windows, linux, macOSX, and other OS...
This produces errors like
SyntaxError: unterminated string literal (detected at line 60)
Your example could also be broken into multiple lines like
print(f"{dasdsadasdsadassdsadasdasddasddasd}"
f"{dasdsadasdsadasdasddasd}"
f"{dasdsadasdsadasdasddasd}")
I have also found this issue. Breaking a formatted string like this also causes issue in the output.
Same issue with python 3.12.3, autopep8==2.3.1