Skip to content

IDLE - Update code with pyupgrade #103668

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
terryjreedy opened this issue Apr 21, 2023 · 1 comment
Closed

IDLE - Update code with pyupgrade #103668

terryjreedy opened this issue Apr 21, 2023 · 1 comment
Labels
topic-IDLE type-feature A feature request or enhancement

Comments

@terryjreedy
Copy link
Member

terryjreedy commented Apr 21, 2023

Item 7 for #87179. In #87179 (comment), Anthony Sottile suggestted running his program pyupgrade, which automates code updates. It would have done some of the things already done and will do some more. In response to my query, he said on another comment that it has been well tested on multiple packages to only do valid changes. His comment includes a bash command:
git ls-files -- Lib/idlelib | grep '\\.py$' | xargs pyupgrade --py36-plus
On Windows, use pyupgrade-directories or try above with git bash on idlelib and idle_test.

Linked PRs

@sobolevn
Copy link
Member

Two notes:

  1. --py36-plus -> --py311-plus
  2. It is a good practice to run pyugrade multiple times (until there are no new changes produced, because it might upgrade stuff several times: % -> .format -> f'')

I've sent a demo PR (feel free to close if the diff is too large / not useful).

terryjreedy added a commit that referenced this issue Apr 23, 2023
---------
Co-authored-by: Terry Jan Reedy <[email protected]>
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Apr 23, 2023
---------
Co-authored-by: Terry Jan Reedy <[email protected]>
(cherry picked from commit bd2dca0)

Co-authored-by: Nikita Sobolev <[email protected]>
terryjreedy pushed a commit that referenced this issue Apr 24, 2023
---------
(cherry picked from commit bd2dca0)
Co-authored-by: Nikita Sobolev <[email protected]>
Co-authored-by: Terry Jan Reedy [email protected]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic-IDLE type-feature A feature request or enhancement
Projects
Status: Done
Development

No branches or pull requests

2 participants