-
-
Notifications
You must be signed in to change notification settings - Fork 32k
gh-120417: Add more #noqa to used imports in the stdlib #120454
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
Conversation
Tools such as ruff can ignore "imported but unused" warnings if a line ends with "# noqa: F401". It avoids the temptation to remove an import which is used effectively.
I'm still against this approach, except for maybe
In my opinion, this is just too ugly for a file like |
tl;dr I strongly favor using In a very few of the cases I'd say the linters aren't able to do a good job of identifying false positives for Here we're dealing with a whole lot of bound objects that are meant to be available to users as part of a module's API. So why are we avoiding Footnotes
|
This is pretty common idiom -- defining the names in the submodules and exposing them as a public API at the package level. Ideally, linters should be aware of this idiom. |
Here is a different approach to fix these warnings: #120461 PR adding |
Thanks Eric, agreed, I like the ultimate explicitness of (as for improvements to static analysis like linters, lets just file those as FRs in their respective trackers - ruff is still young and lacks some practical things) |
I closed this PR: #120461 looks like a better approach. |
Tools such as ruff can ignore "imported but unused" warnings if a line ends with "# noqa: F401". It avoids the temptation to remove an import which is used effectively.