Ran using ruff check --fix --unsafe-fixes --select=UP031 --exclude=adodbapi then black .
This replaces all usages of %r for string formatting with newer style {!r}.
printf-style string formatting has a number of quirks, and leads to less readable code than using str.format calls or f-strings. In general, prefer the newer str.format and f-strings constructs over printf-style string formatting.
Note The formatting operations described here exhibit a variety of quirks that lead to a number of common errors (such as failing to display tuples and dictionaries correctly). Using the newer formatted string literals, the str.format() interface, or template strings may help avoid these errors. Each of these alternatives provides their own trade-offs and benefits of simplicity, flexibility, and/or extensibility.
Follow-up to https://github.com/mhammond/pywin32/pull/2122
Ran using
ruff check --fix --unsafe-fixes --select=UP031 --exclude=adodbapi
thenblack .
This replaces all usages of%r
for string formatting with newer style{!r}
.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