pylint icon indicating copy to clipboard operation
pylint copied to clipboard

Don't consider `__future__` imports and `__all__` unused

Open Syndace opened this issue 4 months ago • 5 comments

Bug description

from __future__ import annotations

__all__ = [ "foo" ]

def foo():
    pass

Command used

pylint foo.py --allow-global-unused-variables n

Pylint output

************* Module foo
...
foo.py:3:0: W0612: Unused variable '__all__' (unused-variable)
foo.py:1:0: W0612: Unused variable 'annotations' (unused-variable)

Expected behavior

Imports from __future__ and the __all__ variable are implicitly used by the interpreter and should as such not be considered unused, even with --allow-global-unused-variables n.

Pylint version

All versions

Syndace avatar Oct 14 '24 08:10 Syndace