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

use f-strings #855

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

use f-strings #855

wants to merge 1 commit into from

Conversation

ikamensh
Copy link

@ikamensh ikamensh commented Sep 28, 2020

I've used flynt to convert the source to use f-strings:

> flynt . -ll 110 

Execution time:                            1.278s
Files modified:                            19
Character count reduction:                 1400 (0.22%)

Per expression type:
No old style (`%`) expressions attempted.
`.format(...)` calls attempted:            169/170 (99.4%)
No concatenations attempted.
F-string expressions created:              158

Since unit tests only run for python 3.6+, I gathered this should be acceptable for the dependencies.

I've also done a manual change in a place where f-string wouldn't be created automatically:

"{0} is not a valid comparison operator: {0}".format(operator)
-> "{operator} is not a valid comparison operator."

@ikamensh
Copy link
Author

Hello hello - any opinions on this?

@ikonst
Copy link
Contributor

ikonst commented Nov 2, 2020

Maybe we should pre-commit along with pyupgrade to modernize this and other aspects of our codebase?

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.

None yet

2 participants