Does t have wider arguments than s?
(t: FunctionLike, s: FunctionLike)
| 9162 | |
| 9163 | |
| 9164 | def 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 | |
| 9182 | def is_same_arg_prefix(t: CallableType, s: CallableType) -> bool: |
no test coverage detected
searching dependent graphs…