flake8-pyi
flake8-pyi copied to clipboard
Check for unused imports
A check that knows the special import handling in stubs. E.g.:
from x import a, b, c as c
x: b
This should complain about a being unused, but not b or c.
If there's an existing flake8 check or plugin that does this, it might just be a matter of adding the right incantations so that that check covers stub files.
In typeshed we now get unused import checking from Pyright. I suppose it's still useful for flake8 to do it too (e.g. for other stub projects that don't support Pyright), but it feels low priority.
Link to some related issues
- https://github.com/PyCQA/pyflakes/issues/474
- https://github.com/python/typeshed/issues/3322