@@ -2695,6 +2695,52 @@ def _infer_name(self, frame, name):
2695
2695
return name
2696
2696
2697
2697
2698
+ class ParamSpec (_base_nodes .AssignTypeNode ):
2699
+ """Class representing a :class:`ast.ParamSpec` node.
2700
+
2701
+ >>> import astroid
2702
+ >>> node = astroid.extract_node('type Alias[**P] = Callable[P, int]')
2703
+ >>> node.type_params[0]
2704
+ <ParamSpec l.1 at 0x7f23b2e4e198>
2705
+ """
2706
+
2707
+ def __init__ (
2708
+ self ,
2709
+ lineno : int | None = None ,
2710
+ col_offset : int | None = None ,
2711
+ parent : NodeNG | None = None ,
2712
+ * ,
2713
+ end_lineno : int | None = None ,
2714
+ end_col_offset : int | None = None ,
2715
+ ) -> None :
2716
+ self .name : str
2717
+ super ().__init__ (
2718
+ lineno = lineno ,
2719
+ col_offset = col_offset ,
2720
+ end_lineno = end_lineno ,
2721
+ end_col_offset = end_col_offset ,
2722
+ parent = parent ,
2723
+ )
2724
+
2725
+ def postinit (self , name : str ) -> None :
2726
+ self .name = name
2727
+
2728
+ assigned_stmts : ClassVar [
2729
+ Callable [
2730
+ [
2731
+ ParamSpec ,
2732
+ AssignName ,
2733
+ InferenceContext | None ,
2734
+ None ,
2735
+ ],
2736
+ Generator [NodeNG , None , None ],
2737
+ ]
2738
+ ]
2739
+ """Returns the assigned statement (non inferred) according to the assignment type.
2740
+ See astroid/protocols.py for actual implementation.
2741
+ """
2742
+
2743
+
2698
2744
class Pass (_base_nodes .NoChildrenNode , _base_nodes .Statement ):
2699
2745
"""Class representing an :class:`ast.Pass` node.
2700
2746
@@ -3329,7 +3375,7 @@ def __init__(
3329
3375
end_lineno : int | None = None ,
3330
3376
end_col_offset : int | None = None ,
3331
3377
) -> None :
3332
- self .type_params : list [TypeVar ]
3378
+ self .type_params : list [TypeVar , ParamSpec ]
3333
3379
self .value : NodeNG
3334
3380
super ().__init__ (
3335
3381
lineno = lineno ,
@@ -3342,7 +3388,7 @@ def __init__(
3342
3388
def postinit (
3343
3389
self ,
3344
3390
* ,
3345
- type_params : list [TypeVar ],
3391
+ type_params : list [TypeVar , ParamSpec ],
3346
3392
value : NodeNG ,
3347
3393
) -> None :
3348
3394
self .type_params = type_params
0 commit comments