MCPcopy
hub / github.com/python/mypy / _arg_accepts_function

Function _arg_accepts_function

mypy/suggestions.py:233–242  ·  view source on GitHub ↗
(typ: ProperType)

Source from the content-addressed store, hash-verified

231
232
233def _arg_accepts_function(typ: ProperType) -> bool:
234 return (
235 # TypeVar / Callable
236 isinstance(typ, (TypeVarType, CallableType))
237 or
238 # Protocol with __call__
239 isinstance(typ, Instance)
240 and typ.type.is_protocol
241 and typ.type.get_method("__call__") is not None
242 )
243
244
245class SuggestionEngine:

Callers 1

Calls 2

isinstanceFunction · 0.85
get_methodMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…