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

Function instance_fallback

mypy/checkmember.py:1566–1576  ·  view source on GitHub ↗
(typ: ProperType)

Source from the content-addressed store, hash-verified

1564
1565
1566def instance_fallback(typ: ProperType) -> Instance:
1567 if isinstance(typ, Instance):
1568 return typ
1569 if isinstance(typ, TupleType):
1570 return tuple_fallback(typ)
1571 if isinstance(typ, (LiteralType, TypedDictType)):
1572 return typ.fallback
1573 if instance_cache.object_type is None:
1574 object_typeinfo = lookup_stdlib_typeinfo("builtins.object", modules_state.modules)
1575 instance_cache.object_type = Instance(object_typeinfo, [])
1576 return instance_cache.object_type
1577
1578
1579def meta_has_operator(item: Type, op_method: str) -> bool:

Callers 2

has_operatorFunction · 0.85
meta_has_operatorFunction · 0.85

Calls 4

tuple_fallbackFunction · 0.90
lookup_stdlib_typeinfoFunction · 0.90
InstanceClass · 0.90
isinstanceFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…