Fix definitions of various AbstractEventLoop methods (#902)

This commit is contained in:
Tomasz Elendt
2017-02-06 19:25:40 +01:00
committed by Guido van Rossum
parent 31d4a4277b
commit f9d6218ab7

View File

@@ -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: ...