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

Method is_valid_var_arg

mypy/checkexpr.py:6231–6236  ·  view source on GitHub ↗

Is a type valid as a *args argument?

(self, typ: Type)

Source from the content-addressed store, hash-verified

6229 return self.named_type("typing_extensions.TypeAliasType")
6230
6231 def is_valid_var_arg(self, typ: Type) -> bool:
6232 """Is a type valid as a *args argument?"""
6233 typ = get_proper_type(typ)
6234 return isinstance(typ, (TupleType, AnyType, ParamSpecType, UnpackType)) or is_subtype(
6235 typ, self.chk.named_generic_type("typing.Iterable", [AnyType(TypeOfAny.special_form)])
6236 )
6237
6238 def is_valid_keyword_var_arg(self, typ: Type) -> bool:
6239 """Is a type valid as a **kwargs argument?"""

Callers 2

check_var_args_kwargsMethod · 0.95
visit_comparison_exprMethod · 0.95

Calls 5

get_proper_typeFunction · 0.90
is_subtypeFunction · 0.90
AnyTypeClass · 0.90
isinstanceFunction · 0.85
named_generic_typeMethod · 0.45

Tested by

no test coverage detected