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

Function add_info_hook

test-data/unit/plugins/dyn_class.py:26–36  ·  view source on GitHub ↗
(ctx: DynamicClassDefContext)

Source from the content-addressed store, hash-verified

24
25
26def add_info_hook(ctx: DynamicClassDefContext) -> None:
27 class_def = ClassDef(ctx.name, Block([]))
28 class_def.fullname = ctx.api.qualified_name(ctx.name)
29
30 info = TypeInfo(SymbolTable(), class_def, ctx.api.cur_mod_id)
31 class_def.info = info
32 obj = ctx.api.named_type("builtins.object")
33 info.mro = [info, obj.type]
34 info.bases = [obj]
35 ctx.api.add_symbol_table_node(ctx.name, SymbolTableNode(GDEF, info))
36 DECL_BASES.add(class_def.fullname)
37
38
39def replace_col_hook(ctx: ClassDefContext) -> None:

Callers

nothing calls this directly

Calls 9

ClassDefClass · 0.90
BlockClass · 0.90
TypeInfoClass · 0.90
SymbolTableClass · 0.90
SymbolTableNodeClass · 0.90
qualified_nameMethod · 0.45
named_typeMethod · 0.45
add_symbol_table_nodeMethod · 0.45
addMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…