-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
Update %-format call to use str.format #6973
Comments
I like simple. As long as you are not expecting this yesterday, I'll be happy to take this. |
👋 submitting PR now |
is there a general issue? happy to do that too |
All yours then @dyspop |
FYI, to catch Usage: $ pip install flake8 flake8-printf-formatting
$ flake8 src/pip/_internal/operations/prepare.py --select=MOD
src/pip/_internal/operations/prepare.py:111:13: MOD001 do not use printf-style string formatting
src/pip/_internal/operations/prepare.py:147:21: MOD001 do not use printf-style string formatting
src/pip/_internal/operations/prepare.py:217:21: MOD001 do not use printf-style string formatting
src/pip/_internal/operations/prepare.py:249:21: MOD001 do not use printf-style string formatting
src/pip/_internal/operations/prepare.py:277:13: MOD001 do not use printf-style string formatting following the #6763 (comment) |
One clarification / caveat: we probably want to exclude logging calls from this change. I can provide reasons if desired. |
@cjerdonek I agree -- #6968 (comment). I do wonder if there's some way to make the format strings for logging calls to use the new-style formatting. Let's discuss in a new issue. |
The style parameter documented here allows this. But it's Python 3 only. Can we stop supporting Python 2 now, please? 🙂 |
Reopened since there's still more references of this. |
Are there any reasons not to use f-strings ? |
f-strings are not compatible with python 2.7 and 3.5. |
Working on it. |
I've done some work on this issue in the bugfix/6973-format-method branch. In that patch, I've also patched addressed two regressions introduced in the earlier work. I'm taking a break because this translation is a lot of work. |
I've removed the |
Thanks everyone who's worked on this! ^>^ |
Could be related to this issue. I see now these logs on
|
What's the problem this feature will solve?
Currently in
src/pip/_internal/operations/prepare.py
, we use%
-style string formatting.Describe the solution you'd like
We should use the
.format
method for consistency with the rest of the code base.We should also consider doing the same for the rest of the code base. Whoever takes care of this specific issue should make a general issue for that!
Posted in its original form by @pradyunsg in #6968 (comment)
This issue is a good starting point for anyone who wants to help out with pip's development -- it's simple and the process of fixing this should be a good introduction to pip's development workflow.
The text was updated successfully, but these errors were encountered: