mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-08 13:04:46 +08:00
add TypeGuard to coroutines.iscoroutine (#6105)
make CoroutineType extend Coroutine
This commit is contained in:
@@ -1,7 +1,16 @@
|
||||
from typing import Any, Callable, TypeVar
|
||||
import sys
|
||||
import types
|
||||
from collections.abc import Callable, Coroutine
|
||||
from typing import Any, TypeVar
|
||||
from typing_extensions import TypeGuard
|
||||
|
||||
_F = TypeVar("_F", bound=Callable[..., Any])
|
||||
|
||||
def coroutine(func: _F) -> _F: ...
|
||||
def iscoroutinefunction(func: object) -> bool: ...
|
||||
def iscoroutine(obj: object) -> bool: ...
|
||||
|
||||
if sys.version_info < (3, 8):
|
||||
def iscoroutine(obj: object) -> TypeGuard[types.GeneratorType[Any, Any, Any] | Coroutine[Any, Any, Any]]: ...
|
||||
|
||||
else:
|
||||
def iscoroutine(obj: object) -> TypeGuard[Coroutine[Any, Any, Any]]: ...
|
||||
|
||||
Reference in New Issue
Block a user