mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-09 21:46:42 +08:00
Fix asyncio.wait for() and add exceptions (#676)
* asyncio.wait_for() should accept Awaitable[_T] same as asyncio.gather()
* {Cancelled,Timeout,InvalidState}Error types missing
This commit is contained in:
committed by
Guido van Rossum
parent
bf8b5ac5fd
commit
3f03849b70
@@ -37,6 +37,9 @@ from asyncio.transports import (
|
||||
)
|
||||
from asyncio.futures import (
|
||||
Future as Future,
|
||||
CancelledError as CancelledError,
|
||||
TimeoutError as TimeoutError,
|
||||
InvalidStateError as InvalidStateError,
|
||||
)
|
||||
from asyncio.tasks import (
|
||||
FIRST_COMPLETED as FIRST_COMPLETED,
|
||||
|
||||
@@ -5,6 +5,15 @@ __all__ = ... # type: str
|
||||
|
||||
_T = TypeVar('_T')
|
||||
|
||||
from concurrent.futures._base import (
|
||||
Error as Error,
|
||||
)
|
||||
from concurrent.futures import (
|
||||
CancelledError as CancelledError,
|
||||
TimeoutError as TimeoutError,
|
||||
)
|
||||
class InvalidStateError(Error): ...
|
||||
|
||||
class _TracebackLogger:
|
||||
__slots__ = ... # type: List[str]
|
||||
exc = ... # type: BaseException
|
||||
|
||||
@@ -30,7 +30,7 @@ def sleep(delay: float, result: _T = ..., loop: AbstractEventLoop = ...) -> Futu
|
||||
def wait(fs: List[Task[_T]], *, loop: AbstractEventLoop = ...,
|
||||
timeout: float = ...,
|
||||
return_when: str = ...) -> Future[Tuple[Set[Future[_T]], Set[Future[_T]]]]: ...
|
||||
def wait_for(fut: Union[Future[_T], Generator[Any, None, _T]], timeout: Optional[float],
|
||||
def wait_for(fut: Union[Future[_T], Generator[Any, None, _T], Awaitable[_T]], timeout: Optional[float],
|
||||
*, loop: AbstractEventLoop = ...) -> Future[_T]: ...
|
||||
|
||||
class Task(Future[_T], Generic[_T]):
|
||||
|
||||
Reference in New Issue
Block a user