MCPcopy Index your code
hub / github.com/RustPython/RustPython / _paramspec_prepare_subst

Function _paramspec_prepare_subst

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

Source from the content-addressed store, hash-verified

1094
1095
1096def _paramspec_prepare_subst(self, alias, args):
1097 params = alias.__parameters__
1098 i = params.index(self)
1099 if i == len(args) and self.has_default():
1100 args = (*args, self.__default__)
1101 if i >= len(args):
1102 raise TypeError(f"Too few arguments for {alias}")
1103 # Special case where Z[[int, str, bool]] == Z[int, str, bool] in PEP 612.
1104 if len(params) == 1 and not _is_param_expr(args[0]):
1105 assert i == 0
1106 args = (args,)
1107 # Convert lists to tuples to help other libraries cache the results.
1108 elif isinstance(args[i], list):
1109 args = (*args[:i], tuple(args[i]), *args[i+1:])
1110 return args
1111
1112
1113@_tp_cache

Callers

nothing calls this directly

Calls 5

lenFunction · 0.85
isinstanceFunction · 0.85
has_defaultMethod · 0.80
_is_param_exprFunction · 0.70
indexMethod · 0.45

Tested by

no test coverage detected