Skip to content

Commit e99357f

Browse files
committed
add TypeGuard to coroutines.iscoroutine
1 parent 9b86402 commit e99357f

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

stdlib/asyncio/coroutines.pyi

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
1+
import collections.abc
2+
import types
13
from typing import Any, Callable, TypeVar
4+
from typing_extensions import TypeGuard
25

36
_F = TypeVar("_F", bound=Callable[..., Any])
47

8+
_COROUTINE_TYPE = types.CoroutineType | types.GeneratorType | collections.abc.Coroutine
9+
510
def coroutine(func: _F) -> _F: ...
611
def iscoroutinefunction(func: object) -> bool: ...
7-
def iscoroutine(obj: object) -> bool: ...
12+
def iscoroutine(obj: object) -> TypeGuard[_COROUTINE_TYPE]: ...

0 commit comments

Comments
 (0)