massive update, probably broken
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-pyright / node_modules / pyright / dist / typeshed-fallback / stdlib / asyncio / unix_events.pyi
1 import sys
2 import types
3 from _typeshed import Self
4 from socket import socket
5 from typing import Any, Callable, Type
6
7 from .base_events import Server
8 from .events import AbstractEventLoop, BaseDefaultEventLoopPolicy, _ProtocolFactory, _SSLContext
9 from .selector_events import BaseSelectorEventLoop
10
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: ...
20
21 class BaseChildWatcher(AbstractChildWatcher):
22     def __init__(self) -> None: ...
23
24 class SafeChildWatcher(BaseChildWatcher):
25     def __enter__(self: Self) -> Self: ...
26
27 class FastChildWatcher(BaseChildWatcher):
28     def __enter__(self: Self) -> Self: ...
29
30 class _UnixSelectorEventLoop(BaseSelectorEventLoop):
31     if sys.version_info < (3, 7):
32         async def create_unix_server(
33             self,
34             protocol_factory: _ProtocolFactory,
35             path: str | None = ...,
36             *,
37             sock: socket | None = ...,
38             backlog: int = ...,
39             ssl: _SSLContext = ...,
40         ) -> Server: ...
41
42 class _UnixDefaultEventLoopPolicy(BaseDefaultEventLoopPolicy):
43     def get_child_watcher(self) -> AbstractChildWatcher: ...
44     def set_child_watcher(self, watcher: AbstractChildWatcher | None) -> None: ...
45
46 SelectorEventLoop = _UnixSelectorEventLoop
47
48 DefaultEventLoopPolicy = _UnixDefaultEventLoopPolicy
49
50 if sys.version_info >= (3, 8):
51
52     from typing import Protocol
53     class _Warn(Protocol):
54         def __call__(
55             self, message: str, category: Type[Warning] | None = ..., stacklevel: int = ..., source: Any | None = ...
56         ) -> 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: ...