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

Migrate to f-string #579

Merged
merged 1 commit into from
Sep 10, 2023
Merged

Conversation

Rotzbua
Copy link
Contributor

@Rotzbua Rotzbua commented Sep 3, 2023

Change

  • Migrate to f-string
  • Remove outdated format specifiers

@florianfesti
Copy link
Owner

Is there any reason to covert some things to f strings and others to .format() ?

Remove outdated format specifiers
@Rotzbua
Copy link
Contributor Author

Rotzbua commented Sep 10, 2023

The first step of the conversion by pyupgrade is always percent to .fromat style.
From .format to f-string is not always done as the tool notes:

pyupgrade is intentionally timid and will not create an f-string if it would make the expression longer or if the substitution parameters are sufficiently complicated (as this can decrease readability).

Source: https://github.com/asottile/pyupgrade#f-strings

Also it does not convert multi-line .format and I personally try not to avoid f-string for complex function calls.

If you prefer some different style then just write it 👍

@florianfesti florianfesti merged commit bf9925b into florianfesti:master Sep 10, 2023
4 checks passed
@florianfesti
Copy link
Owner

Nah, I was just wondering if there is a reason. Getting rid of the Python2 code is a good thing no matter what variant being used.

@Rotzbua Rotzbua deleted the pyupgrade_string branch September 10, 2023 16:24
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.

2 participants