Skip to content

redundant-final-literal (PYI064)

Derived from the flake8-pyi linter.

Fix is sometimes available.

This rule is unstable and in preview. The --preview flag is required for use.

What it does

Checks for redundant Final[Literal[...]] annotations.

Why is this bad?

A Final[Literal[...]] annotation can be replaced with Final; the literal use is unnecessary.

Example

x: Final[Literal[42]]
y: Final[Literal[42]] = 42

Use instead:

x: Final = 42
y: Final = 42