ikamensh / flynt

A tool to automatically convert old string literal formatting to f-strings
MIT License
689 stars 33 forks source link

Don't put string literals into f-strings #181

Closed wimglenn closed 1 year ago

wimglenn commented 1 year ago

Similar to https://github.com/ikamensh/flynt/pull/75 but for %s formatting

Input:

x = 1
y = 3
s = "%s/%s/%s" % (x, "two", y)

Output (expected):

x = 1
y = 3
s = f"{x}/two/{y}"

Output (actual):

x = 1
y = 3
s = f"{x}/{'two'}/{y}"
ikamensh commented 1 year ago

Thanks for the bug report, fixed in https://github.com/ikamensh/flynt/commit/6aae029b500a63c5f2c982dbff6243540fc7c487