Jelle Zijlstra
2022-05-17 18:11:29 -07:00
committed by GitHub
co-authored by Shantanu Alex Waygood
parent ada3615a24
commit eab82c838a
18 changed files with 487 additions and 175 deletions
+22 -5
View File
@@ -1,11 +1,28 @@
import sys
from collections.abc import Awaitable
from typing import TypeVar
from _typeshed import Self
from collections.abc import Callable, Coroutine
from contextvars import Context
from typing import Any, TypeVar
__all__ = ("run",)
from .events import AbstractEventLoop
if sys.version_info >= (3, 11):
__all__ = ("Runner", "run")
else:
__all__ = ("run",)
_T = TypeVar("_T")
if sys.version_info >= (3, 11):
class Runner:
def __init__(self, *, debug: bool | None = ..., loop_factory: Callable[[], AbstractEventLoop] | None = ...) -> None: ...
def __enter__(self: Self) -> Self: ...
def __exit__(self, exc_type: object, exc_val: object, exc_tb: object) -> None: ...
def close(self) -> None: ...
def get_loop(self) -> AbstractEventLoop: ...
def run(self, coro: Coroutine[Any, Any, _T], *, context: Context | None = ...) -> _T: ...
if sys.version_info >= (3, 8):
def run(main: Awaitable[_T], *, debug: bool | None = ...) -> _T: ...
def run(main: Coroutine[Any, Any, _T], *, debug: bool | None = ...) -> _T: ...
else:
def run(main: Awaitable[_T], *, debug: bool = ...) -> _T: ...
def run(main: Coroutine[Any, Any, _T], *, debug: bool = ...) -> _T: ...