mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-10 14:01:55 +08:00
Coroutine functions should return Generator type (#903)
This commit is contained in:
committed by
Guido van Rossum
parent
987f465b4f
commit
b8df3de81a
@@ -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):
|
||||
|
||||
@@ -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]: ...
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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]: ...
|
||||
|
||||
Reference in New Issue
Block a user