-
Notifications
You must be signed in to change notification settings - Fork 809
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
Stop using printf
-style string formatting for direct string interpolation (%s
)
#2277
base: main
Are you sure you want to change the base?
Conversation
…using-printf-style-formatting
…using-printf-style-formatting
…using-printf-style-formatting
…using-printf-style-formatting
…using-printf-style-formatting
…using-printf-style-formatting
Ruff was updated to catch more cases that are not autofixable. I'll have to split this one in more gradual parts. |
I'm having real trouble getting excited about changes dictated by an external tool which don't actually fix or change any functionality. These kinds of changes (and many of the other PRs, particularly ones described as "prefer x over y") are IMO best done when the code is otherwise being changed. Some of the typing related changes seem good if they help consumers of these packages (eg, typing params to public functions), but in the same way, internal changes which only type things but otherwise make no changes seem like busy work. |
Follow-up to #2122
Merging #2278 first will reduce changes
Ran using
ruff check --select=UP031 --exclude=adodbapi --unsafe-fixes --fix
thenruff format
This replaces all usages of exclusively
%s
for string formatting with newer style.format
introduced in Python 2.6 .This autofix is considered "unsafe" when Ruff cannot statically establish that the following case is always false:
References:
https://docs.astral.sh/ruff/rules/printf-string-formatting/#why-is-this-bad
https://docs.python.org/3/library/stdtypes.html#printf-style-string-formatting