Replace str.format() with f-string

Proprietary

Replace "...".format(...) calls with f-strings (Python 3.6+). Only converts cases where the format string is a literal and the conversion is safe. A format string with a backslash escape, a raw or bytes prefix, or a field reading an attribute or index is left alone. So is a call with an unpacked argument, a string literal argument, or an argument that has side effects and is used more than once, and a call with a comment inside it, which the f-string would drop.

org.openrewrite.python.migrate.ReplaceStrFormatWithFString
mod run . --recipe=org.openrewrite.python.migrate.ReplaceStrFormatWithFString

Install it once, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.