Fix AbstractEventLoop.call* callable definitions. (#753)

Several asyncio AbstractEventLoop methods take a callback as
an argument that is passed *args. The Callable definition was
incorrect for those callbacks.
This commit is contained in:
Simon Ekstrand
2016-12-17 00:15:20 +01:00
committed by Guido van Rossum
parent 830c2fb089
commit aa6f4a07c1

View File

@@ -16,7 +16,7 @@ class Handle:
__slots__ = ... # type: List[str]
_cancelled = False
_args = ... # type: List[Any]
def __init__(self, callback: Callable[[],Any], args: List[Any],
def __init__(self, callback: Callable[..., Any], args: List[Any],
loop: AbstractEventLoop) -> None: ...
def __repr__(self) -> str: ...
def cancel(self) -> None: ...
@@ -47,16 +47,16 @@ class AbstractEventLoop(metaclass=ABCMeta):
def close(self) -> None: ...
# Methods scheduling callbacks. All these return Handles.
@abstractmethod
def call_soon(self, callback: Callable[[],Any], *args: Any) -> Handle: ...
def call_soon(self, callback: Callable[..., Any], *args: Any) -> Handle: ...
@abstractmethod
def call_later(self, delay: Union[int, float], callback: Callable[[],Any], *args: Any) -> Handle: ...
def call_later(self, delay: Union[int, float], callback: Callable[..., Any], *args: Any) -> Handle: ...
@abstractmethod
def call_at(self, when: float, callback: Callable[[],Any], *args: Any) -> Handle: ...
def call_at(self, when: float, callback: Callable[..., Any], *args: Any) -> Handle: ...
@abstractmethod
def time(self) -> float: ...
# Methods for interacting with threads
@abstractmethod
def call_soon_threadsafe(self, callback: Callable[[],Any], *args: Any) -> Handle: ...
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]: ...