@@ -20,6 +20,7 @@ from typing import (
2020 Tuple ,
2121 Type as Type ,
2222 TypeVar ,
23+ Union ,
2324 ValuesView ,
2425 overload as overload ,
2526)
@@ -96,22 +97,33 @@ if sys.version_info >= (3, 7):
9697Annotated : _SpecialForm = ...
9798_AnnotatedAlias : Any = ... # undocumented
9899
99- # TypeAlias is a (non-subscriptable) special form.
100- class TypeAlias : ...
101-
102100@runtime_checkable
103101class SupportsIndex (Protocol , metaclass = abc .ABCMeta ):
104102 @abc .abstractmethod
105103 def __index__ (self ) -> int : ...
106104
107105# PEP 612 support for Python < 3.9
108106if sys .version_info >= (3 , 10 ):
109- from typing import Concatenate as Concatenate , ParamSpec as ParamSpec
107+ from typing import Concatenate as Concatenate , ParamSpec as ParamSpec , TypeAlias as TypeAlias , TypeGuard as TypeGuard
110108else :
109+ class ParamSpecArgs :
110+ __origin__ : ParamSpec
111+ def __init__ (self , origin : ParamSpec ) -> None : ...
112+ class ParamSpecKwargs :
113+ __origin__ : ParamSpec
114+ def __init__ (self , origin : ParamSpec ) -> None : ...
111115 class ParamSpec :
112116 __name__ : str
113- def __init__ (self , name : str ) -> None : ...
117+ __bound__ : Optional [Type [Any ]]
118+ __covariant__ : bool
119+ __contravariant__ : bool
120+ def __init__ (
121+ self , name : str , bound : Union [None , Type [Any ], str ] = ..., contravariant : bool = ..., covariant : bool = ...
122+ ) -> None : ...
123+ @property
124+ def args (self ) -> ParamSpecArgs : ...
125+ @property
126+ def kwargs (self ) -> ParamSpecKwargs : ...
114127 Concatenate : _SpecialForm = ...
115-
116- # PEP 647
117- TypeGuard : _SpecialForm = ...
128+ TypeAlias : _SpecialForm = ...
129+ TypeGuard : _SpecialForm = ...
0 commit comments