From f9d6218ab7b882ce97084c521446c5da31ddd093 Mon Sep 17 00:00:00 2001 From: Tomasz Elendt Date: Mon, 6 Feb 2017 19:25:40 +0100 Subject: [PATCH] Fix definitions of various AbstractEventLoop methods (#902) --- stdlib/3.4/asyncio/events.pyi | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/stdlib/3.4/asyncio/events.pyi b/stdlib/3.4/asyncio/events.pyi index 2e87f70b3..ade397d0b 100644 --- a/stdlib/3.4/asyncio/events.pyi +++ b/stdlib/3.4/asyncio/events.pyi @@ -1,5 +1,5 @@ import sys -from typing import Any, Awaitable, TypeVar, List, Callable, Tuple, Union, Dict, Generator, overload, Optional +from typing import Any, Awaitable, Callable, Dict, Generator, List, Optional, Tuple, TypeVar, Union, overload from abc import ABCMeta, abstractmethod from asyncio.futures import Future from asyncio.coroutines import coroutine @@ -8,6 +8,7 @@ from asyncio.tasks import Task __all__ = ... # type: str _T = TypeVar('_T') +_Context = Dict[str, Any] PIPE = ... # type: Any # from subprocess.PIPE @@ -71,7 +72,7 @@ class AbstractEventLoop(metaclass=ABCMeta): def call_soon_threadsafe(self, callback: Callable[..., Any], *args: Any) -> Handle: ... @abstractmethod def run_in_executor(self, executor: Any, - callback: Callable[[], Any], *args: Any) -> Future[Any]: ... + callback: Callable[..., Any], *args: Any) -> Future[Any]: ... @abstractmethod def set_default_executor(self, executor: Any) -> None: ... # Network I/O methods returning Futures. @@ -113,11 +114,11 @@ class AbstractEventLoop(metaclass=ABCMeta): stdout: Any = ..., stderr: Any = ..., **kwargs: Any) -> tuple: ... @abstractmethod - def add_reader(self, fd: int, callback: Callable[[], Any], *args: List[Any]) -> None: ... + def add_reader(self, fd: int, callback: Callable[..., Any], *args: List[Any]) -> None: ... @abstractmethod def remove_reader(self, fd: int) -> None: ... @abstractmethod - def add_writer(self, fd: int, callback: Callable[[], Any], *args: List[Any]) -> None: ... + def add_writer(self, fd: int, callback: Callable[..., Any], *args: List[Any]) -> None: ... @abstractmethod def remove_writer(self, fd: int) -> None: ... # Completion based I/O methods returning Futures. @@ -131,16 +132,16 @@ class AbstractEventLoop(metaclass=ABCMeta): def sock_accept(self, sock: Any) -> Any: ... # Signal handling. @abstractmethod - def add_signal_handler(self, sig: int, callback: Callable[[], Any], *args: List[Any]) -> None: ... + def add_signal_handler(self, sig: int, callback: Callable[..., Any], *args: List[Any]) -> None: ... @abstractmethod def remove_signal_handler(self, sig: int) -> None: ... # Error handlers. @abstractmethod - def set_exception_handler(self, handler: Callable[[], Any]) -> None: ... + def set_exception_handler(self, handler: Callable[[AbstractEventLoop, _Context], Any]) -> None: ... @abstractmethod - def default_exception_handler(self, context: Any) -> None: ... + def default_exception_handler(self, context: _Context) -> None: ... @abstractmethod - def call_exception_handler(self, context: Any) -> None: ... + def call_exception_handler(self, context: _Context) -> None: ... # Debug flag management. @abstractmethod def get_debug(self) -> bool: ...