redundant-final-literal (PYI064)
Derived from the flake8-pyi linter.
Fix is sometimes available.
What it does
Checks for redundant Final[Literal[...]]
annotations.
Why is this bad?
All constant variables annotated as Final
are understood as implicitly
having Literal
types by a type checker. As such, a Final[Literal[...]]
annotation can often be replaced with a bare Final
, annotation, which
will have the same meaning to the type checker while being more concise and
more readable.
Example
Use instead: