MCPcopy Create free account
hub / github.com/python/mypy / min_tuple_length

Method min_tuple_length

mypy/checkexpr.py:4600–4608  ·  view source on GitHub ↗
(self, left: TupleType)

Source from the content-addressed store, hash-verified

4598 return result
4599
4600 def min_tuple_length(self, left: TupleType) -> int:
4601 unpack_index = find_unpack_in_list(left.items)
4602 if unpack_index is None:
4603 return left.length()
4604 unpack = left.items[unpack_index]
4605 assert isinstance(unpack, UnpackType)
4606 if isinstance(unpack.type, TypeVarTupleType):
4607 return left.length() - 1 + unpack.type.min_len
4608 return left.length() - 1
4609
4610 def visit_tuple_index_helper(self, left: TupleType, n: int) -> Type | None:
4611 unpack_index = find_unpack_in_list(left.items)

Callers 2

visit_index_with_typeMethod · 0.95

Calls 3

find_unpack_in_listFunction · 0.90
isinstanceFunction · 0.85
lengthMethod · 0.45

Tested by

no test coverage detected