ruff/crates/ty_python_semantic/resources/mdtest/annotations/cls.md
2025-10-25 13:14:46 +02:00

343 B

cls

[environment]
python-version = "3.13"

Methods

from typing import Type, Self

class C:
    @classmethod
    def make_instance(cls: Type[Self]) -> Self:
        return cls()

reveal_type(C.make_instance())  # revealed: C
reveal_type(C.make_instance)  # revealed: bound method <class 'C'>.make_instance() -> C