@@ -26,7 +26,7 @@ from types import (
26
26
WrapperDescriptorType ,
27
27
)
28
28
from typing import Any , ClassVar , Literal , NamedTuple , Protocol , TypeVar , overload
29
- from typing_extensions import ParamSpec , Self , TypeAlias , TypeGuard
29
+ from typing_extensions import ParamSpec , Self , TypeAlias , TypeGuard , TypeIs
30
30
31
31
if sys .version_info >= (3 , 11 ):
32
32
__all__ = [
@@ -192,10 +192,10 @@ if sys.version_info >= (3, 11):
192
192
def getmembers_static (object : object , predicate : _GetMembersPredicate | None = None ) -> _GetMembersReturn : ...
193
193
194
194
def getmodulename (path : StrPath ) -> str | None : ...
195
- def ismodule (object : object ) -> TypeGuard [ModuleType ]: ...
196
- def isclass (object : object ) -> TypeGuard [type [Any ]]: ...
197
- def ismethod (object : object ) -> TypeGuard [MethodType ]: ...
198
- def isfunction (object : object ) -> TypeGuard [FunctionType ]: ...
195
+ def ismodule (object : object ) -> TypeIs [ModuleType ]: ...
196
+ def isclass (object : object ) -> TypeIs [type [Any ]]: ...
197
+ def ismethod (object : object ) -> TypeIs [MethodType ]: ...
198
+ def isfunction (object : object ) -> TypeIs [FunctionType ]: ...
199
199
200
200
if sys .version_info >= (3 , 12 ):
201
201
def markcoroutinefunction (func : _F ) -> _F : ...
@@ -214,9 +214,9 @@ def iscoroutinefunction(obj: Callable[_P, Awaitable[_T]]) -> TypeGuard[Callable[
214
214
def iscoroutinefunction (obj : Callable [_P , object ]) -> TypeGuard [Callable [_P , CoroutineType [Any , Any , Any ]]]: ...
215
215
@overload
216
216
def iscoroutinefunction (obj : object ) -> TypeGuard [Callable [..., CoroutineType [Any , Any , Any ]]]: ...
217
- def isgenerator (object : object ) -> TypeGuard [GeneratorType [Any , Any , Any ]]: ...
218
- def iscoroutine (object : object ) -> TypeGuard [CoroutineType [Any , Any , Any ]]: ...
219
- def isawaitable (object : object ) -> TypeGuard [Awaitable [Any ]]: ...
217
+ def isgenerator (object : object ) -> TypeIs [GeneratorType [Any , Any , Any ]]: ...
218
+ def iscoroutine (object : object ) -> TypeIs [CoroutineType [Any , Any , Any ]]: ...
219
+ def isawaitable (object : object ) -> TypeIs [Awaitable [Any ]]: ...
220
220
@overload
221
221
def isasyncgenfunction (obj : Callable [..., AsyncGenerator [Any , Any ]]) -> bool : ...
222
222
@overload
@@ -230,18 +230,18 @@ class _SupportsSet(Protocol[_T_cont, _V_cont]):
230
230
class _SupportsDelete (Protocol [_T_cont ]):
231
231
def __delete__ (self , instance : _T_cont , / ) -> None : ...
232
232
233
- def isasyncgen (object : object ) -> TypeGuard [AsyncGeneratorType [Any , Any ]]: ...
234
- def istraceback (object : object ) -> TypeGuard [TracebackType ]: ...
235
- def isframe (object : object ) -> TypeGuard [FrameType ]: ...
236
- def iscode (object : object ) -> TypeGuard [CodeType ]: ...
237
- def isbuiltin (object : object ) -> TypeGuard [BuiltinFunctionType ]: ...
233
+ def isasyncgen (object : object ) -> TypeIs [AsyncGeneratorType [Any , Any ]]: ...
234
+ def istraceback (object : object ) -> TypeIs [TracebackType ]: ...
235
+ def isframe (object : object ) -> TypeIs [FrameType ]: ...
236
+ def iscode (object : object ) -> TypeIs [CodeType ]: ...
237
+ def isbuiltin (object : object ) -> TypeIs [BuiltinFunctionType ]: ...
238
238
239
239
if sys .version_info >= (3 , 11 ):
240
- def ismethodwrapper (object : object ) -> TypeGuard [MethodWrapperType ]: ...
240
+ def ismethodwrapper (object : object ) -> TypeIs [MethodWrapperType ]: ...
241
241
242
242
def isroutine (
243
243
object : object ,
244
- ) -> TypeGuard [
244
+ ) -> TypeIs [
245
245
FunctionType
246
246
| LambdaType
247
247
| MethodType
@@ -251,11 +251,11 @@ def isroutine(
251
251
| MethodDescriptorType
252
252
| ClassMethodDescriptorType
253
253
]: ...
254
- def ismethoddescriptor (object : object ) -> TypeGuard [MethodDescriptorType ]: ...
255
- def ismemberdescriptor (object : object ) -> TypeGuard [MemberDescriptorType ]: ...
254
+ def ismethoddescriptor (object : object ) -> TypeIs [MethodDescriptorType ]: ...
255
+ def ismemberdescriptor (object : object ) -> TypeIs [MemberDescriptorType ]: ...
256
256
def isabstract (object : object ) -> bool : ...
257
- def isgetsetdescriptor (object : object ) -> TypeGuard [GetSetDescriptorType ]: ...
258
- def isdatadescriptor (object : object ) -> TypeGuard [_SupportsSet [Any , Any ] | _SupportsDelete [Any ]]: ...
257
+ def isgetsetdescriptor (object : object ) -> TypeIs [GetSetDescriptorType ]: ...
258
+ def isdatadescriptor (object : object ) -> TypeIs [_SupportsSet [Any , Any ] | _SupportsDelete [Any ]]: ...
259
259
260
260
#
261
261
# Retrieving source code
0 commit comments