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

Method check_runtime_protocol_test

mypy/checkexpr.py:754–763  ·  view source on GitHub ↗
(self, e: CallExpr)

Source from the content-addressed store, hash-verified

752 return False
753
754 def check_runtime_protocol_test(self, e: CallExpr) -> None:
755 for expr in mypy.checker.flatten(e.args[1]):
756 tp = get_proper_type(self.chk.lookup_type(expr))
757 if (
758 isinstance(tp, FunctionLike)
759 and tp.is_type_obj()
760 and tp.type_object().is_protocol
761 and not tp.type_object().runtime_protocol
762 ):
763 self.chk.fail(message_registry.RUNTIME_PROTOCOL_EXPECTED, e)
764
765 def check_protocol_issubclass(self, e: CallExpr) -> None:
766 for expr in mypy.checker.flatten(e.args[1]):

Callers 1

visit_call_expr_innerMethod · 0.95

Calls 6

get_proper_typeFunction · 0.90
isinstanceFunction · 0.85
lookup_typeMethod · 0.45
is_type_objMethod · 0.45
type_objectMethod · 0.45
failMethod · 0.45

Tested by

no test coverage detected