MAINT: removed unused imports listed in LGTM#19090
Conversation
eric-wieser
left a comment
There was a problem hiding this comment.
Not all unused imports are safe to remove; some of them have side-effects, while others are part of the public API
| import io | ||
|
|
||
| import abc | ||
| from abc import ABC as abc_ABC |
There was a problem hiding this comment.
The fact these are imported here is considered public API for this module
| import builtins | ||
|
|
||
| # needed in this module for compatibility | ||
| from numpy.lib.histograms import histogram, histogramdd |
There was a problem hiding this comment.
idem., See the comment on the line above.
There was a problem hiding this comment.
Should these be added to __all__ then?
There was a problem hiding this comment.
Might be worthwhile to figure out why exactly they're here in the first place.
Based on the answer deprecating (or removing) them might be desirable over adding them to __all__.
There was a problem hiding this comment.
Ah, found it: four years ago they were moved from function_base to histograms in a namespace clean up (#10186).
Honestly, this period is long enough that I'd advocate for their deprecation.
| import textwrap | ||
|
|
||
| # Overwrite certain distutils.ccompiler functions: | ||
| import numpy.distutils.ccompiler # noqa: F401 |
There was a problem hiding this comment.
It's possible this import is needed to do some monkey-patching. I don't know for sure.
|
got it, do not remove things blindly. |
|
No need to make a new PR, you can edit this one. All of the |
|
The changes to |
|
@eric-wieser hey, looks like |
Nothing, that run is flaky. |
|
so, its going to be merged soon ? |
eric-wieser
left a comment
There was a problem hiding this comment.
The non-typing bits look good to me, and it sounds like @BvB93 is happy with the typing parts.
|
fine, Ill go ahead and fix unused variables. |
|
@eric-wieser shoot!!, pushed another commit which fixes unused variables on the same branch. |
If you have the new work saved somewhere, you can just do followed by the force push. |
|
You can keep pushing to the current branch as long as you want. However, at some point you may want to combine various commits using |
|
@charris Thanks for the info. I now reverted the changes to older commit. Can you confirm if its ready to merge and merge it so that i can go ahead and do another PR for the |
|
The travis error can be ignored. |
|
Thanks @default-303 . |
|
welcome, thank you all for guiding me, I've raised a new PR for unused variables, check and tell if it needs a review. |
Removed most of the unused imports mentions in LGTM.
closes #19077