mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-01-08 20:43:25 +08:00
Add type information for asyncio.coroutines
This commit is contained in:
committed by
David Soria Parra
parent
4292211da9
commit
4d0a9e6d49
@@ -1,9 +1,13 @@
|
||||
"""The asyncio package, tracking PEP 3156."""
|
||||
from asyncio.coroutines import (
|
||||
coroutine as coroutine,
|
||||
iscoroutinefunction as iscoroutinefunction,
|
||||
iscoroutine as iscoroutine,
|
||||
)
|
||||
from asyncio.futures import (
|
||||
Future as Future,
|
||||
)
|
||||
from asyncio.tasks import (
|
||||
coroutine as coroutine,
|
||||
sleep as sleep,
|
||||
Task as Task,
|
||||
FIRST_COMPLETED as FIRST_COMPLETED,
|
||||
@@ -27,7 +31,8 @@ from asyncio.queues import (
|
||||
QueueEmpty as QueueEmpty,
|
||||
)
|
||||
|
||||
__all__ = (futures.__all__ +
|
||||
__all__ = (coroutines.__all__ +
|
||||
futures.__all__ +
|
||||
tasks.__all__ +
|
||||
events.__all__ +
|
||||
queues.__all__)
|
||||
|
||||
8
stdlib/3.4/asyncio/coroutines.pyi
Normal file
8
stdlib/3.4/asyncio/coroutines.pyi
Normal file
@@ -0,0 +1,8 @@
|
||||
from typing import Callable, Any
|
||||
|
||||
__all__ = ['coroutine',
|
||||
'iscoroutinefunction', 'iscoroutine']
|
||||
|
||||
def coroutine(func: Callable[..., Any]) -> Callable[..., Any]: ...
|
||||
def iscoroutinefunction(func: Callable[..., Any]) -> bool: ...
|
||||
def iscoroutine(obj: Any) -> bool: ...
|
||||
@@ -4,7 +4,7 @@ __all__ = ['Queue', 'PriorityQueue', 'LifoQueue', 'JoinableQueue',
|
||||
'QueueFull', 'QueueEmpty']
|
||||
|
||||
from asyncio.events import AbstractEventLoop
|
||||
from .tasks import coroutine
|
||||
from .coroutines import coroutine
|
||||
from .futures import Future
|
||||
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ from asyncio.futures import Future
|
||||
# 'gather', 'shield',
|
||||
# ]
|
||||
|
||||
__all__ = ['coroutine', 'Task', 'sleep',
|
||||
__all__ = ['Task', 'sleep',
|
||||
'FIRST_COMPLETED', 'FIRST_EXCEPTION', 'ALL_COMPLETED',
|
||||
'wait', 'wait_for']
|
||||
|
||||
@@ -14,7 +14,6 @@ FIRST_EXCEPTION = 'FIRST_EXCEPTION'
|
||||
FIRST_COMPLETED = 'FIRST_COMPLETED'
|
||||
ALL_COMPLETED = 'ALL_COMPLETED'
|
||||
_T = TypeVar('_T')
|
||||
def coroutine(f: _T) -> _T: ... # Here comes and go a function
|
||||
def sleep(delay: float, result: _T = ..., loop: AbstractEventLoop = ...) -> Future[_T]: ...
|
||||
def wait(fs: List[Task[_T]], *, loop: AbstractEventLoop = ...,
|
||||
timeout: float = ..., return_when: str = ...) -> Future[Tuple[Set[Future[_T]], Set[Future[_T]]]]: ...
|
||||
|
||||
Reference in New Issue
Block a user