1 from typing import (Any, TypeVar, Set, Dict, List, TextIO, Union, Tuple, Generic, Callable,
\r
2 Coroutine, Generator, Iterable, Awaitable, overload, Sequence, Iterator,
\r
4 from types import FrameType
\r
5 import concurrent.futures
\r
6 from .events import AbstractEventLoop
\r
7 from .futures import Future
\r
12 _T1 = TypeVar('_T1')
\r
13 _T2 = TypeVar('_T2')
\r
14 _T3 = TypeVar('_T3')
\r
15 _T4 = TypeVar('_T4')
\r
16 _T5 = TypeVar('_T5')
\r
17 _FutureT = Union[Future[_T], Generator[Any, None, _T], Awaitable[_T]]
\r
19 FIRST_EXCEPTION: str
\r
20 FIRST_COMPLETED: str
\r
23 def as_completed(fs: Sequence[_FutureT[_T]], *, loop: AbstractEventLoop = ...,
\r
24 timeout: Optional[float] = ...) -> Iterator[Generator[Any, None, _T]]: ...
\r
25 def ensure_future(coro_or_future: _FutureT[_T],
\r
26 *, loop: AbstractEventLoop = ...) -> Future[_T]: ...
\r
27 async = ensure_future
\r
29 def gather(coro_or_future1: _FutureT[_T1],
\r
30 *, loop: AbstractEventLoop = ..., return_exceptions: bool = ...) -> Future[Tuple[_T1]]: ...
\r
32 def gather(coro_or_future1: _FutureT[_T1], coro_or_future2: _FutureT[_T2],
\r
33 *, loop: AbstractEventLoop = ..., return_exceptions: bool = ...) -> Future[Tuple[_T1, _T2]]: ...
\r
35 def gather(coro_or_future1: _FutureT[_T1], coro_or_future2: _FutureT[_T2], coro_or_future3: _FutureT[_T3],
\r
36 *, loop: AbstractEventLoop = ..., return_exceptions: bool = ...) -> Future[Tuple[_T1, _T2, _T3]]: ...
\r
38 def gather(coro_or_future1: _FutureT[_T1], coro_or_future2: _FutureT[_T2], coro_or_future3: _FutureT[_T3],
\r
39 coro_or_future4: _FutureT[_T4],
\r
40 *, loop: AbstractEventLoop = ..., return_exceptions: bool = ...) -> Future[Tuple[_T1, _T2, _T3, _T4]]: ...
\r
42 def gather(coro_or_future1: _FutureT[_T1], coro_or_future2: _FutureT[_T2], coro_or_future3: _FutureT[_T3],
\r
43 coro_or_future4: _FutureT[_T4], coro_or_future5: _FutureT[_T5],
\r
44 *, loop: AbstractEventLoop = ..., return_exceptions: bool = ...) -> Future[Tuple[_T1, _T2, _T3, _T4, _T5]]: ...
\r
46 def gather(coro_or_future1: _FutureT[Any], coro_or_future2: _FutureT[Any], coro_or_future3: _FutureT[Any],
\r
47 coro_or_future4: _FutureT[Any], coro_or_future5: _FutureT[Any], coro_or_future6: _FutureT[Any],
\r
48 *coros_or_futures: _FutureT[Any],
\r
49 loop: AbstractEventLoop = ..., return_exceptions: bool = ...) -> Future[Tuple[Any, ...]]: ...
\r
50 def run_coroutine_threadsafe(coro: _FutureT[_T],
\r
51 loop: AbstractEventLoop) -> concurrent.futures.Future[_T]: ...
\r
52 def shield(arg: _FutureT[_T], *, loop: AbstractEventLoop = ...) -> Future[_T]: ...
\r
53 def sleep(delay: float, result: _T = ..., loop: AbstractEventLoop = ...) -> Future[_T]: ...
\r
54 def wait(fs: Iterable[_FutureT[_T]], *, loop: AbstractEventLoop = ...,
\r
55 timeout: Optional[float] = ...,
\r
56 return_when: str = ...) -> Future[Tuple[Set[Future[_T]], Set[Future[_T]]]]: ...
\r
57 def wait_for(fut: _FutureT[_T], timeout: Optional[float],
\r
58 *, loop: AbstractEventLoop = ...) -> Future[_T]: ...
\r
60 class Task(Future[_T], Generic[_T]):
\r
62 def current_task(cls, loop: AbstractEventLoop = ...) -> Task: ...
\r
64 def all_tasks(cls, loop: AbstractEventLoop = ...) -> Set[Task]: ...
\r
65 def __init__(self, coro: Union[Generator[Any, None, _T], Awaitable[_T]], *, loop: AbstractEventLoop = ...) -> None: ...
\r
66 def __repr__(self) -> str: ...
\r
67 def get_stack(self, *, limit: int = ...) -> List[FrameType]: ...
\r
68 def print_stack(self, *, limit: int = ..., file: TextIO = ...) -> None: ...
\r
69 def cancel(self) -> bool: ...
\r
70 def _step(self, value: Any = ..., exc: Exception = ...) -> None: ...
\r
71 def _wakeup(self, future: Future[Any]) -> None: ...
\r