Skip to content

custom-type-var-for-self (PYI019): misses types in quotes cls: "type[_S]" #18257

@collinanderson

Description

@collinanderson

Summary

custom-type-var-for-self (PYI019) catches cls: type[_S] but misses cls: "type[_S]"

from typing import TypeVar

_S = TypeVar("_S", bound="Foo")

class Foo:
    @classmethod
    def bar(cls: "type[_S]", arg: int) -> _S: ...

Version

ruff 0.11.10

Metadata

Metadata

Assignees

No one assigned

    Labels

    ruleImplementing or modifying a lint rule

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions