Skip to content

unnecessary-type-union (PYI055)#

Derived from the flake8-pyi linter.

Fix is sometimes available.

What it does#

Checks for the presence of multiple types in a union.

Why is this bad?#

The type built-in function accepts unions, and it is clearer to explicitly specify them as a single type.

Example#

field: type[int] | type[float]

Use instead:

field: type[int | float]