Skip to content

unaliased-collections-abc-set-import (PYI025)#

Derived from the flake8-pyi linter.

Fix is sometimes available.

What it does#

Checks for from import Set imports that do not alias Set to AbstractSet.

Why is this bad?#

The Set type in is an abstract base class for set-like types. It is easily confused with, and not equivalent to, the set builtin.

To avoid confusion, Set should be aliased to AbstractSet when imported. This makes it clear that the imported type is an abstract base class, and not the set builtin.


from import Set

Use instead:

from import Set as AbstractSet