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

Method callable

mypy/test/testtypes.py:1389–1394  ·  view source on GitHub ↗

callable(a1, ..., an, r) constructs a callable with argument types a1, ... an and return type r.

(self, *a: Type)

Source from the content-addressed store, hash-verified

1387 return TupleType(list(a), self.fx.std_tuple)
1388
1389 def callable(self, *a: Type) -> CallableType:
1390 """callable(a1, ..., an, r) constructs a callable with argument types
1391 a1, ... an and return type r.
1392 """
1393 n = len(a) - 1
1394 return CallableType(list(a[:-1]), [ARG_POS] * n, [None] * n, a[-1], self.fx.function)
1395
1396
1397class SameTypeSuite(Suite):

Callers 6

test_function_typesMethod · 0.95
test_noneMethod · 0.95
test_unbound_typeMethod · 0.95
test_dynamic_typeMethod · 0.95
test_simple_genericsMethod · 0.95

Calls 3

CallableTypeClass · 0.90
lenFunction · 0.85
listClass · 0.85

Tested by

no test coverage detected