3 from _typeshed import Self
4 from socket import socket
5 from typing import Any, Callable, Type
7 from .base_events import Server
8 from .events import AbstractEventLoop, BaseDefaultEventLoopPolicy, _ProtocolFactory, _SSLContext
9 from .selector_events import BaseSelectorEventLoop
11 class AbstractChildWatcher:
12 def add_child_handler(self, pid: int, callback: Callable[..., Any], *args: Any) -> None: ...
13 def remove_child_handler(self, pid: int) -> bool: ...
14 def attach_loop(self, loop: AbstractEventLoop | None) -> None: ...
15 def close(self) -> None: ...
16 def __enter__(self: Self) -> Self: ...
17 def __exit__(self, typ: Type[BaseException] | None, exc: BaseException | None, tb: types.TracebackType | None) -> None: ...
18 if sys.version_info >= (3, 8):
19 def is_active(self) -> bool: ...
21 class BaseChildWatcher(AbstractChildWatcher):
22 def __init__(self) -> None: ...
24 class SafeChildWatcher(BaseChildWatcher):
25 def __enter__(self: Self) -> Self: ...
27 class FastChildWatcher(BaseChildWatcher):
28 def __enter__(self: Self) -> Self: ...
30 class _UnixSelectorEventLoop(BaseSelectorEventLoop):
31 if sys.version_info < (3, 7):
32 async def create_unix_server(
34 protocol_factory: _ProtocolFactory,
35 path: str | None = ...,
37 sock: socket | None = ...,
39 ssl: _SSLContext = ...,
42 class _UnixDefaultEventLoopPolicy(BaseDefaultEventLoopPolicy):
43 def get_child_watcher(self) -> AbstractChildWatcher: ...
44 def set_child_watcher(self, watcher: AbstractChildWatcher | None) -> None: ...
46 SelectorEventLoop = _UnixSelectorEventLoop
48 DefaultEventLoopPolicy = _UnixDefaultEventLoopPolicy
50 if sys.version_info >= (3, 8):
52 from typing import Protocol
53 class _Warn(Protocol):
55 self, message: str, category: Type[Warning] | None = ..., stacklevel: int = ..., source: Any | None = ...
57 class MultiLoopChildWatcher(AbstractChildWatcher):
58 def __enter__(self: Self) -> Self: ...
59 class ThreadedChildWatcher(AbstractChildWatcher):
60 def __enter__(self: Self) -> Self: ...
61 def __del__(self, _warn: _Warn = ...) -> None: ...