From b8df3de81a4172ffec8d68de512251fc030847b1 Mon Sep 17 00:00:00 2001 From: Tomasz Elendt Date: Tue, 31 Jan 2017 23:28:07 +0100 Subject: [PATCH] Coroutine functions should return Generator type (#903) --- stdlib/3.4/asyncio/locks.pyi | 12 ++++++------ stdlib/3.4/asyncio/queues.pyi | 10 +++++----- stdlib/3.4/asyncio/streams.pyi | 2 +- stdlib/3.4/asyncio/subprocess.pyi | 10 +++++----- 4 files changed, 17 insertions(+), 17 deletions(-) diff --git a/stdlib/3.4/asyncio/locks.pyi b/stdlib/3.4/asyncio/locks.pyi index 2467ffec0..21459490d 100644 --- a/stdlib/3.4/asyncio/locks.pyi +++ b/stdlib/3.4/asyncio/locks.pyi @@ -24,7 +24,7 @@ class Lock(_ContextManagerMixin): def __init__(self, *, loop: AbstractEventLoop = None) -> None: ... def locked(self) -> bool: ... @coroutine - def acquire(self) -> Future[bool]: ... + def acquire(self) -> Generator[Any, None, bool]: ... def release(self) -> None: ... class Event: @@ -33,18 +33,18 @@ class Event: def set(self) -> None: ... def clear(self) -> None: ... @coroutine - def wait(self) -> bool: ... + def wait(self) -> Generator[Any, None, bool]: ... class Condition(_ContextManagerMixin): def __init__(self, lock: Lock = None, *, loop: AbstractEventLoop = None) -> None: ... def locked(self) -> bool: ... @coroutine - def acquire(self) -> Future[bool]: ... + def acquire(self) -> Generator[Any, None, bool]: ... def release(self) -> None: ... @coroutine - def wait(self) -> Future[bool]: ... + def wait(self) -> Generator[Any, None, bool]: ... @coroutine - def wait_for(self, predicate: Callable[[], T]) -> Future[T]: ... + def wait_for(self, predicate: Callable[[], T]) -> Generator[Any, None, T]: ... def notify(self, n: int = 1) -> None: ... def notify_all(self) -> None: ... @@ -52,7 +52,7 @@ class Semaphore(_ContextManagerMixin): def __init__(self, value: int = 1, *, loop: AbstractEventLoop = None) -> None: ... def locked(self) -> bool: ... @coroutine - def acquire(self) -> Future[bool]: ... + def acquire(self) -> Generator[Any, None, bool]: ... def release(self) -> None: ... class BoundedSemaphore(Semaphore): diff --git a/stdlib/3.4/asyncio/queues.pyi b/stdlib/3.4/asyncio/queues.pyi index 2901218f5..1c9363edb 100644 --- a/stdlib/3.4/asyncio/queues.pyi +++ b/stdlib/3.4/asyncio/queues.pyi @@ -2,7 +2,7 @@ import sys from asyncio.events import AbstractEventLoop from .coroutines import coroutine from .futures import Future -from typing import TypeVar, Generic +from typing import Any, Generator, Generic, TypeVar __all__ = ... # type: str @@ -28,14 +28,14 @@ class Queue(Generic[T]): def empty(self) -> bool: ... def full(self) -> bool: ... @coroutine - def put(self, item: T) -> Future[None]: ... + def put(self, item: T) -> Generator[Any, None, None]: ... def put_nowait(self, item: T) -> None: ... @coroutine - def get(self) -> Future[T]: ... + def get(self) -> Generator[Any, None, T]: ... def get_nowait(self) -> T: ... if sys.version_info >= (3, 4): @coroutine - def join(self) -> None: ... + def join(self) -> Generator[Any, None, bool]: ... def task_done(self) -> None: ... @@ -48,4 +48,4 @@ if sys.version_info < (3, 5): class JoinableQueue(Queue): def task_done(self) -> None: ... @coroutine - def join(self) -> None: ... + def join(self) -> Generator[Any, None, bool]: ... diff --git a/stdlib/3.4/asyncio/streams.pyi b/stdlib/3.4/asyncio/streams.pyi index 82893f012..21f468bd0 100644 --- a/stdlib/3.4/asyncio/streams.pyi +++ b/stdlib/3.4/asyncio/streams.pyi @@ -84,7 +84,7 @@ class StreamWriter: def close(self) -> None: ... def get_extra_info(self, name: str, default: Any = ...) -> Any: ... @coroutines.coroutine - def drain(self) -> None: ... + def drain(self) -> Generator[Any, None, None]: ... class StreamReader: def __init__(self, diff --git a/stdlib/3.4/asyncio/subprocess.pyi b/stdlib/3.4/asyncio/subprocess.pyi index b492506e1..21a33a3ab 100644 --- a/stdlib/3.4/asyncio/subprocess.pyi +++ b/stdlib/3.4/asyncio/subprocess.pyi @@ -3,7 +3,7 @@ from asyncio import protocols from asyncio import streams from asyncio import transports from asyncio.coroutines import coroutine -from typing import Any, AnyStr, Optional, Tuple, Union +from typing import Any, AnyStr, Generator, Optional, Tuple, Union __all__ = ... # type: str @@ -28,12 +28,12 @@ class Process: @property def returncode(self) -> int: ... @coroutine - def wait(self) -> int: ... + def wait(self) -> Generator[Any, None, int]: ... def send_signal(self, signal: int) -> None: ... def terminate(self) -> None: ... def kill(self) -> None: ... @coroutine - def communicate(self, input: Optional[bytes] = ...) -> Tuple[bytes, bytes]: ... + def communicate(self, input: Optional[bytes] = ...) -> Generator[Any, None, Tuple[bytes, bytes]]: ... @coroutine @@ -45,7 +45,7 @@ def create_subprocess_shell( loop: events.AbstractEventLoop = ..., limit: int = ..., **kwds: Any -): ... +) -> Generator[Any, None, Process]: ... @coroutine def create_subprocess_exec( @@ -57,4 +57,4 @@ def create_subprocess_exec( loop: events.AbstractEventLoop = ..., limit: int = ..., **kwds: Any -) -> Process: ... +) -> Generator[Any, None, Process]: ...