runner.pyi 760 B

1234567891011121314151617181920212223242526
  1. from _typeshed import Unused
  2. from asyncio import AbstractEventLoop
  3. from contextvars import Context
  4. from typing import Any, TypeVar, Optional, Callable, Coroutine
  5. from typing_extensions import Self, final
  6. __all__ = ("Runner",)
  7. _T = TypeVar("_T")
  8. @final
  9. class Runner:
  10. def __init__(
  11. self,
  12. *,
  13. debug: Optional[bool] = None,
  14. loop_factory: Optional[Callable[[], AbstractEventLoop]] = None,
  15. ) -> None: ...
  16. def __enter__(self) -> Self: ...
  17. def __exit__(self, exc_type: Unused, exc_val: Unused, exc_tb: Unused) -> None: ...
  18. def close(self) -> None: ...
  19. def get_loop(self) -> AbstractEventLoop: ...
  20. def run(
  21. self, coro: Coroutine[Any, Any, _T], *, context: Optional[Context] = None
  22. ) -> _T: ...