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

Function cache_class_attrs

mypyc/irbuild/classdef.py:936–944  ·  view source on GitHub ↗

Add class attributes to be cached to the global cache.

(
    builder: IRBuilder, attrs_to_cache: list[tuple[Lvalue, RType]], cdef: ClassDef
)

Source from the content-addressed store, hash-verified

934
935
936def cache_class_attrs(
937 builder: IRBuilder, attrs_to_cache: list[tuple[Lvalue, RType]], cdef: ClassDef
938) -> None:
939 """Add class attributes to be cached to the global cache."""
940 typ = builder.load_native_type_object(cdef.info.fullname)
941 for lval, rtype in attrs_to_cache:
942 assert isinstance(lval, NameExpr), lval
943 rval = builder.py_get_attr(typ, lval.name, cdef.line)
944 builder.init_final_static(lval, rval, cdef.name, type_override=rtype)
945
946
947def create_mypyc_attrs_tuple(builder: IRBuilder, ir: ClassIR, line: int) -> Value:

Callers 1

finalizeMethod · 0.85

Calls 4

isinstanceFunction · 0.85
init_final_staticMethod · 0.80
py_get_attrMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…