Content-Length: 32217 | pFad | https://docs.astral.sh/ruff/rules/duplicate-literal-member/

duplicate-literal-member (PYI062) | Ruff
Skip to content

duplicate-literal-member (PYI062)

Derived from the flake8-pyi linter.

Fix is always available.

What it does

Checks for duplicate members in a typing.Literal[] slice.

Why is this bad?

Duplicate literal members are redundant and should be removed.

Example

foo: Literal["a", "b", "a"]

Use instead:

foo: Literal["a", "b"]

Fix safety

This rule's fix is marked as safe, unless the type annotation contains comments.

Note that while the fix may flatten nested literals into a single top-level literal, the semantics of the annotation will remain unchanged.

References









ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: https://docs.astral.sh/ruff/rules/duplicate-literal-member/

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy