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

Splitting long f strings containing hash sign (#) into multiple lines breaks code syntax #753

Closed
pkv2a opened this issue Jun 20, 2024 · 1 comment
Assignees

Comments

@pkv2a
Copy link

pkv2a commented Jun 20, 2024


Python Code

foo.py:

def foo:
    logger.info(f"some string padding some string padding some string padd {somedict['key1']}, more padding more paddin #: {somedict['dictkey2']}")

Command Line and Configuration

Not using any config files.

Command Line

$ ~/.local/bin/autopep8 foo.py 
def foo:
    logger.info(f"some string padding some string padding some string padd {
                #: {somedict['dictkey2']}")
                somedict['key1']}, more padding more paddin

Notice the second-to-last line should actually be the last line. The resulting formatted code is not syntactically correct.

Your Environment

  • Python version: Python 3.12.3
  • autopep8 version: autopep8 2.3.0 (pycodestyle: 2.12.0)
  • Platform: Linux (Fedora 40)
@hhatto
Copy link
Owner

hhatto commented Jun 23, 2024

Thanks for reporting 👍

fix and v2.3.1 has been released.
https://pypi.org/project/autopep8/2.3.1/

@hhatto hhatto closed this as completed Jun 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants