MCPcopy Index your code
hub / github.com/python/cpython / _paramspec_prepare_subst

Function _paramspec_prepare_subst

Lib/typing.py:1144–1158  ·  view source on GitHub ↗
(self, alias, args)

Source from the content-addressed store, hash-verified

1142
1143
1144def _paramspec_prepare_subst(self, alias, args):
1145 params = alias.__parameters__
1146 i = params.index(self)
1147 if i == len(args) and self.has_default():
1148 args = (*args, self.__default__)
1149 if i >= len(args):
1150 raise TypeError(f"Too few arguments for {alias}")
1151 # Special case where Z[[int, str, bool]] == Z[int, str, bool] in PEP 612.
1152 if len(params) == 1 and not _is_param_expr(args[0]):
1153 assert i == 0
1154 args = (args,)
1155 # Convert lists to tuples to help other libraries cache the results.
1156 elif isinstance(args[i], list):
1157 args = (*args[:i], tuple(args[i]), *args[i+1:])
1158 return args
1159
1160
1161@_tp_cache

Callers

nothing calls this directly

Calls 2

_is_param_exprFunction · 0.70
indexMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…