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

Function meta_has_operator

mypy/checkmember.py:1579–1588  ·  view source on GitHub ↗
(item: Type, op_method: str)

Source from the content-addressed store, hash-verified

1577
1578
1579def meta_has_operator(item: Type, op_method: str) -> bool:
1580 item = get_proper_type(item)
1581 if isinstance(item, AnyType):
1582 return True
1583 item = instance_fallback(item)
1584 meta = item.type.metaclass_type
1585 if meta is None:
1586 type_type = lookup_stdlib_typeinfo("builtins.type", modules_state.modules)
1587 meta = Instance(type_type, [])
1588 return meta.type.has_readable_member(op_method)
1589
1590
1591def defined_in_superclass(info: TypeInfo, name: str) -> bool:

Callers 1

has_operatorFunction · 0.85

Calls 6

get_proper_typeFunction · 0.90
lookup_stdlib_typeinfoFunction · 0.90
InstanceClass · 0.90
isinstanceFunction · 0.85
instance_fallbackFunction · 0.85
has_readable_memberMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…