Catch shadowed imports in style checks.#16193
Conversation
| import numpy as np | ||
| from numpy import ma | ||
|
|
||
| import matplotlib.category as _ # <-registers a category unit converter |
There was a problem hiding this comment.
Actually, I like the idea of import as _ to mark an unused import, but won't insistent on it.
There was a problem hiding this comment.
It is a nice way to mark that something a bit funny (side effects on import) is going on here.
There was a problem hiding this comment.
I rewrote the comment to more forcefully point to the side-effect, but I can also just revert the change and flake8-exclude this file if you prefer.
There was a problem hiding this comment.
My preferred version would be,
import matplotlib.category as _ # Register category unit converter
or keep your version but without the exclamation marks. I'm quite allergic to them, even more so, if there's more than one. 😄
There was a problem hiding this comment.
Ah, I guess I forgot to mention that this is needed because the underscore-import triggers F811 per PyCQA/pyflakes#366.
I just removed the exclamation marks for now.
`matplotlib.rc_context` is redefined in pyplot with a wrapper function so that it shows up in the docs (like setp, getp and a few others). spines imports cbook twice. The imports of category and dates in _axes.py don't need to be assigned to "_" (they're not assigned to a global name to start with anyways).
matplotlib.rc_contextis redefined in pyplot with a wrapper functionso that it shows up in the docs (like setp, getp and a few others).
spines imports cbook twice.
The imports of category and dates in
_axes.pydon't need to be assignedto "_" (they're not assigned to a global name to start with anyways).
Would have caught #16189 (comment).
PR Summary
PR Checklist