question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

`pyupgrade` is not idempotent: upgrading %-formatting to f-strings takes two passes.

See original GitHub issue
$ echo '"%s, %r" % (x, y)' > example.py

$ pyupgrade --py36-plus example.py 
Rewriting example.py

$ cat example.py 
"{}, {!r}".format(x, y)

$ pyupgrade --py36-plus example.py
Rewriting example.py

$ cat example.py
f"{x}, {y!r}"

I think this is probably just a matter of pass ordering, and would be fixed if the percent-formatting fixer ran before the f-strings fixer?

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
asottilecommented, Sep 11, 2022

shed’s also in unsupported territory 😛

0reactions
Zac-HDcommented, Sep 12, 2022

Ah, I hadn’t considered it a ‘substantial portion’ since it’s really just some regex patterns and the textwrap logic, both rewritten, and there are notes in the readme and code comments. If you have a suggested form of attribution I’d be very happy to add it though!

Read more comments on GitHub >

github_iconTop Results From Across the Web

asottile/pyupgrade: A tool (and pre-commit hook) to ... - GitHub
GitHub - asottile/pyupgrade: A tool (and pre-commit hook) to automatically upgrade syntax for newer versions of the language.
Read more >
Release Notes — Airflow Documentation
To create a DAG that runs whenever a Dataset is updated use the new schedule parameter (see below) and pass a list of...
Read more >
How to clean packages compatible Python 2.7 + 3 to make ...
I think a hypothetical internalization (which in many cases won't append) should not stop us from using f-strings, which are just cleaner (and ......
Read more >
apache-airflow-backport-providers-google 2021.3.3 - PyPI
If your DAG uses an object from the above mentioned libraries passed by XCom, it is necessary to update the naming convention of...
Read more >
fr2.rpmfind.net/linux/opensuse/ports/ppc/tumblewee...
#9562 #9567 ++++ icingaweb2: - Update to 2.11.2 It brings performance ... fix format sorting * Fix blur/contrast for X11 window if Xwayland...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found