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

Method get_dynamic_class_hook

mypy/plugin.py:794–809  ·  view source on GitHub ↗

Semantically analyze a dynamic class definition. This plugin hook allows one to semantically analyze dynamic class definitions like: from lib import dynamic_class X = dynamic_class('X', []) For such definition, this hook will be called with 'lib.dynamic_cl

(
        self, fullname: str
    )

Source from the content-addressed store, hash-verified

792 return None
793
794 def get_dynamic_class_hook(
795 self, fullname: str
796 ) -> Callable[[DynamicClassDefContext], None] | None:
797 """Semantically analyze a dynamic class definition.
798
799 This plugin hook allows one to semantically analyze dynamic class definitions like:
800
801 from lib import dynamic_class
802
803 X = dynamic_class('X', [])
804
805 For such definition, this hook will be called with 'lib.dynamic_class'.
806 The plugin should create the corresponding TypeInfo, and place it into a relevant
807 symbol table, e.g. using ctx.api.add_symbol_table_node().
808 """
809 return None
810
811
812T = TypeVar("T")

Callers 2

Calls

no outgoing calls

Tested by

no test coverage detected