MCPcopy Create free account
hub / github.com/python/mypy / attributes_initialized_by_init_call

Function attributes_initialized_by_init_call

mypyc/analysis/attrdefined.py:286–291  ·  view source on GitHub ↗

Calculate attributes that are always initialized by a super().__init__ call.

(op: Call)

Source from the content-addressed store, hash-verified

284
285
286def attributes_initialized_by_init_call(op: Call) -> set[str]:
287 """Calculate attributes that are always initialized by a super().__init__ call."""
288 self_type = op.fn.sig.args[0].type
289 assert isinstance(self_type, RInstance), self_type
290 cl = self_type.class_ir
291 return {a for base in cl.mro for a in base.attributes if base.is_always_defined(a)}
292
293
294def attributes_maybe_initialized_by_init_call(op: Call) -> set[str]:

Callers 2

visit_register_opMethod · 0.85

Calls 2

isinstanceFunction · 0.85
is_always_definedMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…