@@ -6,7 +6,7 @@ import collections # noqa: F401 # pyright: ignore[reportUnusedImport]
6
6
import sys
7
7
import typing_extensions
8
8
from _collections_abc import dict_items , dict_keys , dict_values
9
- from _typeshed import AnnotationForm , IdentityFunction , ReadableBuffer , SupportsKeysAndGetItem
9
+ from _typeshed import IdentityFunction , ReadableBuffer , SupportsKeysAndGetItem
10
10
from abc import ABCMeta , abstractmethod
11
11
from re import Match as Match , Pattern as Pattern
12
12
from types import (
@@ -142,6 +142,10 @@ if sys.version_info >= (3, 12):
142
142
if sys .version_info >= (3 , 13 ):
143
143
__all__ += ["get_protocol_members" , "is_protocol" , "NoDefault" , "TypeIs" , "ReadOnly" ]
144
144
145
+ # We can't use this name here because it leads to issues with mypy, likely
146
+ # due to an import cycle. Below instead we use Any with a comment.
147
+ # from _typeshed import AnnotationForm
148
+
145
149
class Any : ...
146
150
class _Final : ...
147
151
@@ -151,9 +155,9 @@ class TypeVar:
151
155
@property
152
156
def __name__ (self ) -> str : ...
153
157
@property
154
- def __bound__ (self ) -> AnnotationForm | None : ...
158
+ def __bound__ (self ) -> Any | None : ... # AnnotationForm
155
159
@property
156
- def __constraints__ (self ) -> tuple [AnnotationForm , ...]: ...
160
+ def __constraints__ (self ) -> tuple [Any , ...]: ... # AnnotationForm
157
161
@property
158
162
def __covariant__ (self ) -> bool : ...
159
163
@property
@@ -163,24 +167,24 @@ class TypeVar:
163
167
def __infer_variance__ (self ) -> bool : ...
164
168
if sys .version_info >= (3 , 13 ):
165
169
@property
166
- def __default__ (self ) -> AnnotationForm : ...
170
+ def __default__ (self ) -> Any : ... # AnnotationForm
167
171
if sys .version_info >= (3 , 13 ):
168
172
def __new__ (
169
173
cls ,
170
174
name : str ,
171
- * constraints : AnnotationForm ,
172
- bound : AnnotationForm | None = None ,
175
+ * constraints : Any , # AnnotationForm
176
+ bound : Any | None = None , # AnnotationForm
173
177
contravariant : bool = False ,
174
178
covariant : bool = False ,
175
179
infer_variance : bool = False ,
176
- default : AnnotationForm = ...,
180
+ default : Any = ..., # AnnotationForm
177
181
) -> Self : ...
178
182
elif sys .version_info >= (3 , 12 ):
179
183
def __new__ (
180
184
cls ,
181
185
name : str ,
182
- * constraints : AnnotationForm ,
183
- bound : AnnotationForm | None = None ,
186
+ * constraints : Any , # AnnotationForm
187
+ bound : Any | None = None , # AnnotationForm
184
188
covariant : bool = False ,
185
189
contravariant : bool = False ,
186
190
infer_variance : bool = False ,
@@ -189,23 +193,23 @@ class TypeVar:
189
193
def __new__ (
190
194
cls ,
191
195
name : str ,
192
- * constraints : AnnotationForm ,
193
- bound : AnnotationForm | None = None ,
196
+ * constraints : Any , # AnnotationForm
197
+ bound : Any | None = None , # AnnotationForm
194
198
covariant : bool = False ,
195
199
contravariant : bool = False ,
196
200
) -> Self : ...
197
201
else :
198
202
def __init__ (
199
203
self ,
200
204
name : str ,
201
- * constraints : AnnotationForm ,
202
- bound : AnnotationForm | None = None ,
205
+ * constraints : Any , # AnnotationForm
206
+ bound : Any | None = None , # AnnotationForm
203
207
covariant : bool = False ,
204
208
contravariant : bool = False ,
205
209
) -> None : ...
206
210
if sys .version_info >= (3 , 10 ):
207
- def __or__ (self , right : AnnotationForm ) -> _SpecialForm : ...
208
- def __ror__ (self , left : AnnotationForm ) -> _SpecialForm : ...
211
+ def __or__ (self , right : Any ) -> _SpecialForm : ... # AnnotationForm
212
+ def __ror__ (self , left : Any ) -> _SpecialForm : ... # AnnotationForm
209
213
if sys .version_info >= (3 , 11 ):
210
214
def __typing_subst__ (self , arg : Any ) -> Any : ...
211
215
if sys .version_info >= (3 , 13 ):
@@ -260,10 +264,10 @@ if sys.version_info >= (3, 11):
260
264
def __name__ (self ) -> str : ...
261
265
if sys .version_info >= (3 , 13 ):
262
266
@property
263
- def __default__ (self ) -> AnnotationForm : ...
267
+ def __default__ (self ) -> Any : ... # AnnotationForm
264
268
def has_default (self ) -> bool : ...
265
269
if sys .version_info >= (3 , 13 ):
266
- def __new__ (cls , name : str , * , default : AnnotationForm = ...) -> Self : ...
270
+ def __new__ (cls , name : str , * , default : Any = ...) -> Self : ... # AnnotationForm
267
271
elif sys .version_info >= (3 , 12 ):
268
272
def __new__ (cls , name : str ) -> Self : ...
269
273
else :
@@ -306,7 +310,7 @@ if sys.version_info >= (3, 10):
306
310
@property
307
311
def __name__ (self ) -> str : ...
308
312
@property
309
- def __bound__ (self ) -> AnnotationForm | None : ...
313
+ def __bound__ (self ) -> Any | None : ... # AnnotationForm
310
314
@property
311
315
def __covariant__ (self ) -> bool : ...
312
316
@property
@@ -316,35 +320,45 @@ if sys.version_info >= (3, 10):
316
320
def __infer_variance__ (self ) -> bool : ...
317
321
if sys .version_info >= (3 , 13 ):
318
322
@property
319
- def __default__ (self ) -> AnnotationForm : ...
323
+ def __default__ (self ) -> Any : ... # AnnotationForm
320
324
if sys .version_info >= (3 , 13 ):
321
325
def __new__ (
322
326
cls ,
323
327
name : str ,
324
328
* ,
325
- bound : AnnotationForm | None = None ,
329
+ bound : Any | None = None , # AnnotationForm
326
330
contravariant : bool = False ,
327
331
covariant : bool = False ,
328
332
infer_variance : bool = False ,
329
- default : AnnotationForm = ...,
333
+ default : Any = ..., # AnnotationForm
330
334
) -> Self : ...
331
335
elif sys .version_info >= (3 , 12 ):
332
336
def __new__ (
333
337
cls ,
334
338
name : str ,
335
339
* ,
336
- bound : AnnotationForm | None = None ,
340
+ bound : Any | None = None , # AnnotationForm
337
341
contravariant : bool = False ,
338
342
covariant : bool = False ,
339
343
infer_variance : bool = False ,
340
344
) -> Self : ...
341
345
elif sys .version_info >= (3 , 11 ):
342
346
def __new__ (
343
- cls , name : str , * , bound : AnnotationForm | None = None , contravariant : bool = False , covariant : bool = False
347
+ cls ,
348
+ name : str ,
349
+ * ,
350
+ bound : Any | None = None , # AnnotationForm
351
+ contravariant : bool = False ,
352
+ covariant : bool = False ,
344
353
) -> Self : ...
345
354
else :
346
355
def __init__ (
347
- self , name : str , * , bound : AnnotationForm | None = None , contravariant : bool = False , covariant : bool = False
356
+ self ,
357
+ name : str ,
358
+ * ,
359
+ bound : Any | None = None , # AnnotationForm
360
+ contravariant : bool = False ,
361
+ covariant : bool = False ,
348
362
) -> None : ...
349
363
350
364
@property
@@ -368,7 +382,7 @@ if sys.version_info >= (3, 10):
368
382
TypeGuard : _SpecialForm
369
383
370
384
class NewType :
371
- def __init__ (self , name : str , tp : AnnotationForm ) -> None : ...
385
+ def __init__ (self , name : str , tp : Any ) -> None : ... # AnnotationForm
372
386
if sys .version_info >= (3 , 11 ):
373
387
@staticmethod
374
388
def __call__ (x : _T , / ) -> _T : ...
@@ -901,17 +915,17 @@ if sys.version_info >= (3, 14):
901
915
include_extras : bool = False ,
902
916
* ,
903
917
format : Format | None = None ,
904
- ) -> dict [str , AnnotationForm ]: ...
918
+ ) -> dict [str , Any ]: ... # AnnotationForm
905
919
906
920
else :
907
921
def get_type_hints (
908
922
obj : _get_type_hints_obj_allowed_types ,
909
923
globalns : dict [str , Any ] | None = None ,
910
924
localns : Mapping [str , Any ] | None = None ,
911
925
include_extras : bool = False ,
912
- ) -> dict [str , AnnotationForm ]: ...
926
+ ) -> dict [str , Any ]: ... # AnnotationForm
913
927
914
- def get_args (tp : AnnotationForm ) -> tuple [AnnotationForm , ...]: ...
928
+ def get_args (tp : Any ) -> tuple [Any , ...]: ... # AnnotationForm
915
929
916
930
if sys .version_info >= (3 , 10 ):
917
931
@overload
@@ -922,7 +936,7 @@ if sys.version_info >= (3, 10):
922
936
@overload
923
937
def get_origin (tp : GenericAlias ) -> type : ...
924
938
@overload
925
- def get_origin (tp : AnnotationForm ) -> AnnotationForm | None : ...
939
+ def get_origin (tp : Any ) -> Any | None : ... # AnnotationForm
926
940
@overload
927
941
def cast (typ : type [_T ], val : Any ) -> _T : ...
928
942
@overload
@@ -933,7 +947,7 @@ def cast(typ: object, val: Any) -> Any: ...
933
947
if sys .version_info >= (3 , 11 ):
934
948
def reveal_type (obj : _T , / ) -> _T : ...
935
949
def assert_never (arg : Never , / ) -> Never : ...
936
- def assert_type (val : _T , typ : AnnotationForm , / ) -> _T : ...
950
+ def assert_type (val : _T , typ : Any , / ) -> _T : ... # AnnotationForm
937
951
def clear_overloads () -> None : ...
938
952
def get_overloads (func : Callable [..., object ]) -> Sequence [Callable [..., object ]]: ...
939
953
def dataclass_transform (
@@ -1020,15 +1034,15 @@ if sys.version_info >= (3, 14):
1020
1034
locals : Mapping [str , Any ] | None = None ,
1021
1035
type_params : tuple [TypeVar , ParamSpec , TypeVarTuple ] | None = None ,
1022
1036
format : Format | None = None ,
1023
- ) -> AnnotationForm : ...
1037
+ ) -> Any : ... # AnnotationForm
1024
1038
1025
1039
else :
1026
1040
@final
1027
1041
class ForwardRef (_Final ):
1028
1042
__forward_arg__ : str
1029
1043
__forward_code__ : CodeType
1030
1044
__forward_evaluated__ : bool
1031
- __forward_value__ : AnnotationForm | None
1045
+ __forward_value__ : Any | None # AnnotationForm
1032
1046
__forward_is_argument__ : bool
1033
1047
__forward_is_class__ : bool
1034
1048
__forward_module__ : Any | None
@@ -1044,7 +1058,7 @@ else:
1044
1058
)
1045
1059
def _evaluate (
1046
1060
self , globalns : dict [str , Any ] | None , localns : Mapping [str , Any ] | None , * , recursive_guard : frozenset [str ]
1047
- ) -> AnnotationForm | None : ...
1061
+ ) -> Any | None : ... # AnnotationForm
1048
1062
@overload
1049
1063
def _evaluate (
1050
1064
self ,
@@ -1053,7 +1067,7 @@ else:
1053
1067
type_params : tuple [TypeVar | ParamSpec | TypeVarTuple , ...],
1054
1068
* ,
1055
1069
recursive_guard : frozenset [str ],
1056
- ) -> AnnotationForm | None : ...
1070
+ ) -> Any | None : ... # AnnotationForm
1057
1071
elif sys .version_info >= (3 , 12 ):
1058
1072
def _evaluate (
1059
1073
self ,
@@ -1062,11 +1076,11 @@ else:
1062
1076
type_params : tuple [TypeVar | ParamSpec | TypeVarTuple , ...] | None = None ,
1063
1077
* ,
1064
1078
recursive_guard : frozenset [str ],
1065
- ) -> AnnotationForm | None : ...
1079
+ ) -> Any | None : ... # AnnotationForm
1066
1080
else :
1067
1081
def _evaluate (
1068
1082
self , globalns : dict [str , Any ] | None , localns : Mapping [str , Any ] | None , recursive_guard : frozenset [str ]
1069
- ) -> AnnotationForm | None : ...
1083
+ ) -> Any | None : ... # AnnotationForm
1070
1084
1071
1085
def __eq__ (self , other : object ) -> bool : ...
1072
1086
def __hash__ (self ) -> int : ...
@@ -1085,17 +1099,17 @@ if sys.version_info >= (3, 12):
1085
1099
class TypeAliasType :
1086
1100
def __new__ (cls , name : str , value : Any , * , type_params : tuple [TypeVar | ParamSpec | TypeVarTuple , ...] = ()) -> Self : ...
1087
1101
@property
1088
- def __value__ (self ) -> AnnotationForm : ...
1102
+ def __value__ (self ) -> Any : ... # AnnotationForm
1089
1103
@property
1090
1104
def __type_params__ (self ) -> tuple [TypeVar | ParamSpec | TypeVarTuple , ...]: ...
1091
1105
@property
1092
- def __parameters__ (self ) -> tuple [AnnotationForm , ...]: ...
1106
+ def __parameters__ (self ) -> tuple [Any , ...]: ... # AnnotationForm
1093
1107
@property
1094
1108
def __name__ (self ) -> str : ...
1095
1109
# It's writable on types, but not on instances of TypeAliasType.
1096
1110
@property
1097
1111
def __module__ (self ) -> str | None : ... # type: ignore[override]
1098
- def __getitem__ (self , parameters : AnnotationForm ) -> GenericAlias : ...
1112
+ def __getitem__ (self , parameters : Any ) -> GenericAlias : ... # AnnotationForm
1099
1113
def __or__ (self , right : Any ) -> _SpecialForm : ...
1100
1114
def __ror__ (self , left : Any ) -> _SpecialForm : ...
1101
1115
if sys .version_info >= (3 , 14 ):
0 commit comments