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

Function is_more_general_arg_prefix

mypy/checker.py:9164–9179  ·  view source on GitHub ↗

Does t have wider arguments than s?

(t: FunctionLike, s: FunctionLike)

Source from the content-addressed store, hash-verified

9162
9163
9164def is_more_general_arg_prefix(t: FunctionLike, s: FunctionLike) -> bool:
9165 """Does t have wider arguments than s?"""
9166 # TODO should an overload with additional items be allowed to be more
9167 # general than one with fewer items (or just one item)?
9168 if isinstance(t, CallableType):
9169 if isinstance(s, CallableType):
9170 return is_callable_compatible(
9171 t, s, is_compat=is_proper_subtype, is_proper_subtype=True, ignore_return=True
9172 )
9173 elif isinstance(t, FunctionLike):
9174 if isinstance(s, FunctionLike):
9175 if len(t.items) == len(s.items):
9176 return all(
9177 is_same_arg_prefix(items, itemt) for items, itemt in zip(t.items, s.items)
9178 )
9179 return False
9180
9181
9182def is_same_arg_prefix(t: CallableType, s: CallableType) -> bool:

Callers 1

Calls 6

is_callable_compatibleFunction · 0.90
isinstanceFunction · 0.85
lenFunction · 0.85
allFunction · 0.85
is_same_arg_prefixFunction · 0.85
zipFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…