Skip to content

Commit 61cdd4b

Browse files
friedambv
authored andcommitted
AbstractEventLoop missing methods from 3.4.2 and up. (#798)
* Update asyncio/events.pyi for python 3.5.2 create_future, create_task, set_task_factory, get_task_factory * Gate create_future to >= (3, 5)
1 parent 844b32c commit 61cdd4b

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

stdlib/3.4/asyncio/events.pyi

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
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
23
from abc import ABCMeta, abstractmethod
34
from asyncio.futures import Future
45
from asyncio.coroutines import coroutine
6+
from asyncio.tasks import Task
57

68
__all__ = ... # type: str
79

@@ -53,6 +55,17 @@ class AbstractEventLoop(metaclass=ABCMeta):
5355
def call_at(self, when: float, callback: Callable[..., Any], *args: Any) -> Handle: ...
5456
@abstractmethod
5557
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]]]: ...
5669
# Methods for interacting with threads
5770
@abstractmethod
5871
def call_soon_threadsafe(self, callback: Callable[..., Any], *args: Any) -> Handle: ...

0 commit comments

Comments
 (0)