Skip to content

--experimental adds spaces inside an f-string, which exceeds the max length #760

Open
@daniel-afana

Description


Python Code

my_variable = None
f"11111111111111111111111111111111111111111111111111111111111111111111111111111111111111{my_variable}{my_variable} "

Command Line

$ autopep8 --in-place --experimental --max-line-length=99 my_file.py

Your Environment

  • Python version: 3.12.3
  • autopep8 version: 2.3.1
  • Platform: linux (Ubuntu 20.04), macOS Sonoma

Actual result

my_variable = None
f"11111111111111111111111111111111111111111111111111111111111111111111111111111111111111{
    my_variable} {my_variable}  "

Desirable result

my_variable = None
f"11111111111111111111111111111111111111111111111111111111111111111111111111111111111111{
    my_variable}{my_variable}"

Description of the issue

The content of the string is modified. Spaces are added. What happens inside a string should not concern the code formatter.

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions