mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-31 08:34:23 +08:00
Add missing asyncio 3.7 top-level functions (#2320)
This commit is contained in:
committed by
Jelle Zijlstra
parent
4b8c37462e
commit
7bdf4655e0
@@ -97,6 +97,20 @@ if sys.platform != 'win32':
|
||||
start_unix_server as start_unix_server,
|
||||
)
|
||||
|
||||
if sys.version_info >= (3, 7):
|
||||
from asyncio.events import (
|
||||
get_running_loop as get_running_loop,
|
||||
)
|
||||
from asyncio.tasks import (
|
||||
all_tasks as all_tasks,
|
||||
create_task as create_task,
|
||||
current_task as current_task,
|
||||
)
|
||||
from asyncio.runners import (
|
||||
run as run,
|
||||
)
|
||||
|
||||
|
||||
# TODO: It should be possible to instantiate these classes, but mypy
|
||||
# currently disallows this.
|
||||
# See https://github.com/python/mypy/issues/1843
|
||||
|
||||
@@ -223,3 +223,6 @@ def set_child_watcher(watcher: Any) -> None: ... # TODO: unix_events.AbstractCh
|
||||
|
||||
def _set_running_loop(loop: AbstractEventLoop) -> None: ...
|
||||
def _get_running_loop() -> AbstractEventLoop: ...
|
||||
|
||||
if sys.version_info >= (3, 7):
|
||||
def get_running_loop() -> AbstractEventLoop: ...
|
||||
|
||||
9
stdlib/3/asyncio/runners.pyi
Normal file
9
stdlib/3/asyncio/runners.pyi
Normal file
@@ -0,0 +1,9 @@
|
||||
import sys
|
||||
|
||||
|
||||
if sys.version_info >= (3, 7):
|
||||
from typing import Awaitable, TypeVar
|
||||
|
||||
_T = TypeVar('_T')
|
||||
|
||||
def run(main: Awaitable[_T], *, debug: bool = ...) -> _T: ...
|
||||
@@ -1,8 +1,9 @@
|
||||
import concurrent.futures
|
||||
import sys
|
||||
from typing import (Any, TypeVar, Set, Dict, List, TextIO, Union, Tuple, Generic, Callable,
|
||||
Coroutine, Generator, Iterable, Awaitable, overload, Sequence, Iterator,
|
||||
Optional)
|
||||
from types import FrameType
|
||||
import concurrent.futures
|
||||
from .events import AbstractEventLoop
|
||||
from .futures import Future
|
||||
|
||||
@@ -70,3 +71,8 @@ class Task(Future[_T], Generic[_T]):
|
||||
def cancel(self) -> bool: ...
|
||||
def _step(self, value: Any = ..., exc: Exception = ...) -> None: ...
|
||||
def _wakeup(self, future: Future[Any]) -> None: ...
|
||||
|
||||
if sys.version_info >= (3, 7):
|
||||
def all_tasks(loop: Optional[AbstractEventLoop] = ...) -> Set[Task]: ...
|
||||
def create_task(coro: Union[Generator[Any, None, _T], Awaitable[_T]]) -> Task: ...
|
||||
def current_task(loop: Optional[AbstractEventLoop] = ...) -> Optional[Task]: ...
|
||||
|
||||
Reference in New Issue
Block a user