You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It would be lovely to have this built into pyupgrade!
For HypothesisWorks/hypothesis#3657 I did this with a regex replacement r"(.+?)=\{\1!r\}" -> r"\{\1=\}", which in principle is super inefficient but in practice worked just fine. Applying it only to f-string tokens would be a nice precision and safety improvement, which I'd appreciate as part of my autoformatting stack 🙂
The text was updated successfully, but these errors were encountered:
Zac-HD
changed the title
Rewrite f"x={x!r}" to f"{x=}` on Python 3.8+
Rewrite f"x={x!r}" to f"{x=} on Python 3.8+
Jun 3, 2023
It would be lovely to have this built into
pyupgrade
!For HypothesisWorks/hypothesis#3657 I did this with a regex replacement
r"(.+?)=\{\1!r\}"
->r"\{\1=\}"
, which in principle is super inefficient but in practice worked just fine. Applying it only to f-string tokens would be a nice precision and safety improvement, which I'd appreciate as part of my autoformatting stack 🙂The text was updated successfully, but these errors were encountered: