flake8-pyi icon indicating copy to clipboard operation
flake8-pyi copied to clipboard

Check for unused imports

Open srittau opened this issue 5 years ago • 3 comments

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.

srittau avatar Jun 02 '20 18:06 srittau

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.

JelleZijlstra avatar Dec 06 '20 18:12 JelleZijlstra

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.

JelleZijlstra avatar Jan 15 '22 21:01 JelleZijlstra

Link to some related issues

  • https://github.com/PyCQA/pyflakes/issues/474
  • https://github.com/python/typeshed/issues/3322

Zeckie avatar May 20 '22 14:05 Zeckie