MCPcopy Index your code
hub / github.com/python/mypy / get_class_attribute_hook

Method get_class_attribute_hook

mypy/plugin.py:710–726  ·  view source on GitHub ↗

Adjust type of a class attribute. This method is called with attribute full name using the class where the attribute was defined (or Var.info.fullname for generated attributes). For example: class Cls: x: Any Cls.x

(self, fullname: str)

Source from the content-addressed store, hash-verified

708 return None
709
710 def get_class_attribute_hook(self, fullname: str) -> Callable[[AttributeContext], Type] | None:
711 """
712 Adjust type of a class attribute.
713
714 This method is called with attribute full name using the class where the attribute was
715 defined (or Var.info.fullname for generated attributes).
716
717 For example:
718
719 class Cls:
720 x: Any
721
722 Cls.x
723
724 get_class_attribute_hook is called with '__main__.Cls.x' as fullname.
725 """
726 return None
727
728 def get_class_decorator_hook(self, fullname: str) -> Callable[[ClassDefContext], None] | None:
729 """Update class definition for given class decorators.

Callers 2

Calls

no outgoing calls

Tested by

no test coverage detected