44import inspect
55import sys
66from types import GenericAlias , UnionType
7- from typing import TYPE_CHECKING , Any , Literal , cast , get_args as _get_args
7+ from typing import TYPE_CHECKING , Any , Literal , TypeAlias , cast , get_args as _get_args
88
99
1010if sys .version_info >= (3 , 13 ):
@@ -80,7 +80,7 @@ def is_iterable(obj: object, /) -> TypeIs[AnyIterable]:
8080
8181 # not all sequence-likes implement __len__, e.g. `ctypes.pointer`
8282 try :
83- obj [0 ]
83+ obj [0 ] # pyright: ignore[reportArgumentType]
8484 except (IndexError , StopIteration ):
8585 pass
8686 except (KeyError , ValueError , TypeError ):
@@ -91,6 +91,9 @@ def is_iterable(obj: object, /) -> TypeIs[AnyIterable]:
9191 return False
9292
9393
94+ _AnyClassMethod : TypeAlias = "classmethod[Any, ..., object]" # pyright: ignore[reportExplicitAny]
95+
96+
9497@overload
9598def is_final (final_cls_or_method : WrappedFinalType , / ) -> Literal [True ]: ...
9699@overload
@@ -101,7 +104,7 @@ def is_final(fn: CanCall[..., object], /) -> bool: ...
101104def is_final (prop : property , / ) -> bool : ...
102105@overload
103106def is_final (
104- clsmethod : classmethod [ Any , ..., object ] | staticmethod [..., object ],
107+ clsmethod : _AnyClassMethod | staticmethod [..., object ],
105108 / ,
106109) -> bool : ...
107110def is_final (
@@ -110,7 +113,7 @@ def is_final(
110113 | type
111114 | CanCall [..., object ]
112115 | property
113- | classmethod [ Any , ..., object ]
116+ | _AnyClassMethod
114117 | staticmethod [..., object ]
115118 ),
116119 / ,
0 commit comments