def init_inc_idx(cls, inc_idx):
if inc_idx == Ellipsis:
# if no index is provided, we will extract signature from the fn body
pass
elif isinstance(inc_idx, tuple):
inc_idx = cls._normalize_fn_idx(inc_idx)
(arg_types, return_type) = inc_idx
for arg_type in arg_types:
if not isinstance(arg_type, typy.Type):
raise typy.TypeFormationError(
"Argument type is not a type.")
if return_type != Ellipsis:
raise typy.TypeFormationError(
"Return type for an incomplete fn type must be elided.")
else:
raise typy.TypeFormationError(
"Incomplete fn type index is not an ellipsis or pair.")
return inc_idx
评论列表
文章目录