FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

gh-102515: Remove unused imports in the `Lib/` directory by AlexWaygood · Pull Request #102516 · python/cpython · GitHub

/ cpython Public

gh-102515: Remove unused imports in the Lib/ directory - #102516

Merged
pablogsal merged 4 commits into
python:mainfrom
AlexWaygood:unused-imports
Mar 8, 2023
Merged

gh-102515: Remove unused imports in the Lib/ directory#102516
pablogsal merged 4 commits into
python:mainfrom
AlexWaygood:unused-imports

Conversation

AlexWaygood commented Mar 7, 2023
edited
Loading

Copy link
Copy Markdown
Member

Identified using the pycln tool; manually reviewed by me.

hugovk commented Mar 7, 2023

Copy link
Copy Markdown
Member

Maybe worth commenting some of the less-obvious, required imports for next time?

Copy link
Copy Markdown
Member

Of the 34 files with 'extra' imports, 28 are in test. If the tests pass, we may assume that the deletions are really unused. I am checking the deletions in regular code and already found an error.

Copy link
Copy Markdown
Member

Guido refuted my comment about not checking tests, and found the issue with multliprocessing.connection. I consider that to be a bug in pycln.

terryjreedy closed this Mar 7, 2023
terryjreedy reopened this Mar 7, 2023

Copy link
Copy Markdown
Member Author

I consider that to be a bug in pycln.

It's an imperfect tool, and the stdlib is possibly the worst kind of code to judge it on. I've had good experiences with using the tool on other projects, but if you simply run pycln Lib --all in the CPython repo, it removes 290 imports from 150 files. Most of these are false positives.

rhettinger removed their request for review March 8, 2023 02:49
pablogsal merged commit 401d7a7 into python:main Mar 8, 2023
AlexWaygood deleted the unused-imports branch March 8, 2023 11:47

AlexWaygood commented Mar 8, 2023
edited
Loading

Copy link
Copy Markdown
Member Author

Thanks @gvanrossum, @terryjreedy and @kumaraditya303 for the careful reviews! Much appreciated.

carljm added a commit to carljm/cpython that referenced this pull request Mar 8, 2023
* main:
  pythongh-102304: Consolidate Direct Usage of _Py_RefTotal (pythongh-102514)
  pythongh-102192: Replace PyErr_Fetch/Restore etc by more efficient alternatives (in Objects/) (python#102218)
  pythongh-102507 Remove invisible pagebreak characters (python#102531)
  pythongh-102515: Remove unused imports in the `Lib/` directory (python#102516)
  Remove or update bitbucket links (pythonGH-101963)
  pythongh-101100: Fix sphinx warnings in `zipapp` and `zipfile` modules (python#102526)
  pythonGH-102397: Fix segfault from race condition in signal handling (python#102399)
  Fix style in argparse.rst (python#101733)
  Post 3.12.0a6
  fix typo in async generator code field name `ag_code` (python#102448)
  Python 3.12.0a6
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skip news stdlib Standard Library Python modules in the Lib/ directory

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Unused imports in the Lib/ directory

8 participants


Back | FazBrowse Home | New Git URL