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.


field: type[int] | type[float]

Use instead:

field: type[int | float]