Skip to content

Commit fe4289a

Browse files
Revert "check paramspec flavor"
This reverts commit e8dcf88.
1 parent e8dcf88 commit fe4289a

File tree

1 file changed

+2
-11
lines changed

1 file changed

+2
-11
lines changed

mypy/argmap.py

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
AnyType,
1414
CallableType,
1515
Instance,
16-
ParamSpecFlavor,
1716
ParamSpecType,
1817
ProperType,
1918
TupleType,
@@ -246,9 +245,6 @@ def expand_actual_type(
246245
return item
247246
elif isinstance(star_args_type, ParamSpecType):
248247
# ParamSpec is valid in *args but it can't be unpacked.
249-
assert (
250-
star_args_type.flavor == ParamSpecFlavor.ARGS
251-
), f"ParamSpecType for *args should have ARGS flavor, got {star_args_type.flavor}"
252248
return star_args_type
253249
else:
254250
return AnyType(TypeOfAny.from_error)
@@ -390,17 +386,12 @@ def parse_star_args_type(
390386
) -> TupleType | IterableType | ParamSpecType | AnyType:
391387
"""Parse the type of a ``*args`` argument.
392388
393-
Returns one of TupleType, IterableType, ParamSpecType (ARGS flavor),
394-
or AnyType(TypeOfAny.from_error) if the type cannot be parsed or is invalid.
389+
Returns one of TupleType, TupleInstance or AnyType.
395390
"""
396391
p_t = get_proper_type(typ)
397-
if isinstance(p_t, (TupleType, AnyType)):
392+
if isinstance(p_t, (TupleType, ParamSpecType, AnyType)):
398393
# just return the type as-is
399394
return p_t
400-
elif isinstance(p_t, ParamSpecType):
401-
if p_t.flavor == ParamSpecFlavor.ARGS:
402-
return p_t
403-
return AnyType(TypeOfAny.from_error)
404395
elif isinstance(p_t, TypeVarTupleType):
405396
return self.parse_star_args_type(p_t.upper_bound)
406397
elif isinstance(p_t, UnionType):

0 commit comments

Comments
 (0)