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

Function defined_in_superclass

mypy/checkmember.py:1591–1597  ·  view source on GitHub ↗

Check if a variable has an explicit value at class level in any of superclasses.

(info: TypeInfo, name: str)

Source from the content-addressed store, hash-verified

1589
1590
1591def defined_in_superclass(info: TypeInfo, name: str) -> bool:
1592 """Check if a variable has an explicit value at class level in any of superclasses."""
1593 for base in info.mro[1:]:
1594 if (node := base.names.get(name)) is not None:
1595 if not node.implicit and isinstance(node.node, Var) and node.node.has_explicit_value:
1596 return True
1597 return False

Callers 1

Calls 2

isinstanceFunction · 0.85
getMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…