redundant-none-literal (PYI061)
Added in 0.13.0 · Related issues · View source
Derived from the flake8-pyi linter.
Fix is sometimes available.
What it does
Checks for redundant Literal[None] annotations.
Why is this bad?
While Literal[None] is a valid type annotation, it is semantically equivalent to None.
Prefer None over Literal[None] for both consistency and readability.
Example
Use instead:
Fix safety and availability
This rule's fix is marked as safe unless the literal contains comments.
There is currently no fix available when applying the fix would lead to
a TypeError from an expression of the form None | None or when we
are unable to import the symbol typing.Optional and the Python version
is 3.9 or below.