Skip to content

After F821 (Undefined name) for "Literal", fix for PYI020 (QuotedAnnotationInStub) is undesirable #21077

@pajod

Description

@pajod

Summary

When combined with some other formatting fix, this one is still consistent .. but hardly ever helpful:

ruff check --diff --no-fix --fix --isolated --stdin-filename="r.pyi" --select=PYI020,F821 -- <<<'v: Literal["return", "0o7", "0*3", "int", "foo"]'
--- r.pyi
+++ r.pyi
@@ -1 +1 @@
-v: Literal["return", "0o7", "0*3", "int", "foo"]
+v: Literal["return", 0o7, 0*3, int, foo]

Would fix 4 errors.

NB: Selected F821 only to showcase what is going on. Nothing special about that, just happens to match one case where PYI020 cannot be positively confirmed to be safe to apply.

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionAsking for support or clarification

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions