Prefer f-strings instead of str.format - #2164
Conversation
webknjaz
left a comment
There was a problem hiding this comment.
I wonder if pyupgrade could've handled this.
| @@ -429,9 +429,9 @@ def get_best_match(self, ireq: InstallRequirement) -> InstallRequirement: | |||
|
|
|||
| # Format the best match | |||
| log.debug( | |||
There was a problem hiding this comment.
Logging is supposed to pass params through dedicated arguments, though. Instead of pre-rendering strings before passing them into logging..
There was a problem hiding this comment.
That's exactly what my change does.
Previously a pre-rendered string was being passed (one using .format()). Now dedicated arguments are passed.
Ruff's pyupgrade re-implementation does handle this. This PR and #2163 are groundwork for using ruff instead of flake8+pyupgrade, but can be merged independently. |
|
Not sure about th CI failures. Rebased onto latest |
|
I think pyupgrade would, indeed, handle a couple of these and is a good idea (original implementation or ruff) regardless for the numerous other fixes it applies. But that's doesn't block this PR. I've hit the GitHub rebase button since a lot of CI has been fixed significantly at this point. |
No user facing changes.