From 61cdd4b7aefb3dda3665753031523234fbb8bc12 Mon Sep 17 00:00:00 2001 From: Jason Fried Date: Tue, 3 Jan 2017 11:05:04 -0800 Subject: [PATCH] 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) --- stdlib/3.4/asyncio/events.pyi | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/stdlib/3.4/asyncio/events.pyi b/stdlib/3.4/asyncio/events.pyi index 46628a0b0..2e87f70b3 100644 --- a/stdlib/3.4/asyncio/events.pyi +++ b/stdlib/3.4/asyncio/events.pyi @@ -1,7 +1,9 @@ -from typing import Any, Awaitable, TypeVar, List, Callable, Tuple, Union, Dict, Generator, overload +import sys +from typing import Any, Awaitable, TypeVar, List, Callable, Tuple, Union, Dict, Generator, overload, Optional from abc import ABCMeta, abstractmethod from asyncio.futures import Future from asyncio.coroutines import coroutine +from asyncio.tasks import Task __all__ = ... # type: str @@ -53,6 +55,17 @@ class AbstractEventLoop(metaclass=ABCMeta): def call_at(self, when: float, callback: Callable[..., Any], *args: Any) -> Handle: ... @abstractmethod def time(self) -> float: ... + # Future methods + if sys.version_info >= (3, 5): + @abstractmethod + def create_future(self) -> Future[Any]: ... + # Tasks methods + @abstractmethod + def create_task(self, coro: Union[Future[_T], Generator[Any, None, _T]]) -> Task[_T]: ... + @abstractmethod + def set_task_factory(self, factory: Optional[Callable[[AbstractEventLoop, Generator[Any, None, _T]], Future[_T]]]) -> None: ... + @abstractmethod + def get_task_factory(self) -> Optional[Callable[[AbstractEventLoop, Generator[Any, None, _T]], Future[_T]]]: ... # Methods for interacting with threads @abstractmethod def call_soon_threadsafe(self, callback: Callable[..., Any], *args: Any) -> Handle: ...