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

Function object_from_instance

mypy/join.py:870–874  ·  view source on GitHub ↗

Construct the type 'builtins.object' from an instance type.

(instance: Instance)

Source from the content-addressed store, hash-verified

868
869
870def object_from_instance(instance: Instance) -> Instance:
871 """Construct the type 'builtins.object' from an instance type."""
872 # Use the fact that 'object' is always the last class in the mro.
873 res = Instance(instance.type.mro[-1], [])
874 return res
875
876
877def object_or_any_from_type(typ: ProperType) -> ProperType:

Callers 4

join_instancesMethod · 0.85
join_tuplesMethod · 0.85
defaultMethod · 0.85
object_or_any_from_typeFunction · 0.85

Calls 1

InstanceClass · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…