|
1 | | -from typing import Any, Awaitable, TypeVar, List, Callable, Tuple, Union, Dict, Generator, overload |
| 1 | +import sys |
| 2 | +from typing import Any, Awaitable, TypeVar, List, Callable, Tuple, Union, Dict, Generator, overload, Optional |
2 | 3 | from abc import ABCMeta, abstractmethod |
3 | 4 | from asyncio.futures import Future |
4 | 5 | from asyncio.coroutines import coroutine |
| 6 | +from asyncio.tasks import Task |
5 | 7 |
|
6 | 8 | __all__ = ... # type: str |
7 | 9 |
|
@@ -53,6 +55,17 @@ class AbstractEventLoop(metaclass=ABCMeta): |
53 | 55 | def call_at(self, when: float, callback: Callable[..., Any], *args: Any) -> Handle: ... |
54 | 56 | @abstractmethod |
55 | 57 | def time(self) -> float: ... |
| 58 | + # Future methods |
| 59 | + if sys.version_info >= (3, 5): |
| 60 | + @abstractmethod |
| 61 | + def create_future(self) -> Future[Any]: ... |
| 62 | + # Tasks methods |
| 63 | + @abstractmethod |
| 64 | + def create_task(self, coro: Union[Future[_T], Generator[Any, None, _T]]) -> Task[_T]: ... |
| 65 | + @abstractmethod |
| 66 | + def set_task_factory(self, factory: Optional[Callable[[AbstractEventLoop, Generator[Any, None, _T]], Future[_T]]]) -> None: ... |
| 67 | + @abstractmethod |
| 68 | + def get_task_factory(self) -> Optional[Callable[[AbstractEventLoop, Generator[Any, None, _T]], Future[_T]]]: ... |
56 | 69 | # Methods for interacting with threads |
57 | 70 | @abstractmethod |
58 | 71 | def call_soon_threadsafe(self, callback: Callable[..., Any], *args: Any) -> Handle: ... |
|
0 commit comments