File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11import sys
22import typing
33from contextlib import suppress
4- from typing import NewType , Any
4+ from typing import NewType , Any , TypeVar as IntTypeVar , Union
55
66from typing_extensions import get_origin , get_args
7+ from typing_extensions import TypeVar as ExtTypeVar
78
89if sys .version_info [:2 ] >= (3 , 8 ):
910 from typing import Protocol , Literal , runtime_checkable , TypedDict
@@ -81,14 +82,14 @@ def bar():
8182
8283if sys .version_info [:2 ] >= (3 , 13 ):
8384
84- def typevar_has_no_default (t : TypeVar ) -> TypeGuard [NoDefaultType ]:
85+ def typevar_has_no_default (t : Union [ IntTypeVar , ExtTypeVar ] ) -> TypeGuard [NoDefaultType ]:
8586 return t .__default__ is NoDefault
8687
8788else :
8889
89- def typevar_has_no_default (t : TypeVar ) -> TypeGuard [NoDefaultType ]:
90+ def typevar_has_no_default (t : Union [ IntTypeVar , ExtTypeVar ] ) -> TypeGuard [NoDefaultType ]:
9091 with suppress (AttributeError ):
91- return t .__default__ is NoDefault # type:ignore[attr-defined ]
92+ return t .__default__ is NoDefault # type:ignore[union-attr ]
9293 return False
9394
9495
You can’t perform that action at this time.
0 commit comments