Skip to content

Don't consider __future__ imports and __all__ unused #10019

@Syndace

Description

@Syndace

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    False Positive 🦟A message is emitted but nothing is wrong with the codeNeeds PRThis issue is accepted, sufficiently specified and now needs an implementation

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions