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

Combine f-strings which would be placed on the same line #4480

Conversation

kastkeepitjumpinlikekangaroos
Copy link

@kastkeepitjumpinlikekangaroos kastkeepitjumpinlikekangaroos commented Oct 13, 2024

Description

Hey! First time contributing to the project so please let me know if I'm doing anything wrong here :)

I've implemented changes for the issue described here #4389

Esentially if we can combine multiple f-strings into a single f-string without breaking other considerations like the intended line length then I attempt to do so. This is done by breaking apart the AST of multiple f-strings into a single f-string node by only keeping the first FSTRING_START token and the last FSTRING_END token and keeping all tokens inbetween.

Checklist - did you ...

I've added 2 new test cases showing that the examples in the issue are fixed by the change. All other tests are passing which indicates that the change does not affect other cases.

  • Add an entry in CHANGES.md if necessary?
  • Add / update tests if necessary?
  • Add new / update outdated documentation? (let me know if there's some place I should add this!)

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

Successfully merging this pull request may close these issues.

1 participant