File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2929 _AnnotatedAlias ,
3030 _GenericAlias ,
3131 _SpecialGenericAlias ,
32- _UnionGenericAlias ,
3332 get_args ,
3433 get_origin ,
3534 get_type_hints ,
@@ -256,7 +255,22 @@ def is_tuple(type):
256255 )
257256
258257
259- if sys .version_info >= (3 , 10 ):
258+ if sys .version_info >= (3 , 14 ):
259+
260+ def is_union_type (obj ):
261+ from types import UnionType # noqa: PLC0415
262+
263+ return obj is Union or isinstance (obj , UnionType )
264+
265+ def get_newtype_base (typ : Any ) -> Optional [type ]:
266+ if typ is NewType or isinstance (typ , NewType ):
267+ return typ .__supertype__
268+ return None
269+
270+ from typing import NotRequired , Required
271+
272+ elif sys .version_info >= (3 , 10 ):
273+ from typing import _UnionGenericAlias
260274
261275 def is_union_type (obj ):
262276 from types import UnionType # noqa: PLC0415
@@ -279,6 +293,8 @@ def get_newtype_base(typ: Any) -> Optional[type]:
279293
280294else :
281295 # 3.9
296+ from typing import _UnionGenericAlias
297+
282298 from typing_extensions import NotRequired , Required
283299
284300 def is_union_type (obj ):
You can’t perform that action at this time.
0 commit comments