Skip to content

Commit 44f9e36

Browse files
authored
asyncio.unix_events is not available on Windows (#6809)
1 parent 4c61bdb commit 44f9e36

File tree

1 file changed

+38
-39
lines changed

1 file changed

+38
-39
lines changed

stdlib/asyncio/unix_events.pyi

+38-39
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ from .base_events import Server
88
from .events import AbstractEventLoop, BaseDefaultEventLoopPolicy, _ProtocolFactory, _SSLContext
99
from .selector_events import BaseSelectorEventLoop
1010

11+
# This is also technically not available on Win,
12+
# but other parts of typeshed need this defintion.
13+
# So, it is special cased.
1114
class AbstractChildWatcher:
1215
def add_child_handler(self, pid: int, callback: Callable[..., Any], *args: Any) -> None: ...
1316
def remove_child_handler(self, pid: int) -> bool: ...
@@ -18,44 +21,40 @@ class AbstractChildWatcher:
1821
if sys.version_info >= (3, 8):
1922
def is_active(self) -> bool: ...
2023

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):
24+
if sys.platform != "win32":
25+
class BaseChildWatcher(AbstractChildWatcher):
26+
def __init__(self) -> None: ...
27+
class SafeChildWatcher(BaseChildWatcher):
5828
def __enter__(self: Self) -> Self: ...
59-
class ThreadedChildWatcher(AbstractChildWatcher):
29+
class FastChildWatcher(BaseChildWatcher):
6030
def __enter__(self: Self) -> Self: ...
61-
def __del__(self, _warn: _Warn = ...) -> None: ...
31+
class _UnixSelectorEventLoop(BaseSelectorEventLoop):
32+
if sys.version_info < (3, 7):
33+
async def create_unix_server(
34+
self,
35+
protocol_factory: _ProtocolFactory,
36+
path: str | None = ...,
37+
*,
38+
sock: socket | None = ...,
39+
backlog: int = ...,
40+
ssl: _SSLContext = ...,
41+
) -> Server: ...
42+
class _UnixDefaultEventLoopPolicy(BaseDefaultEventLoopPolicy):
43+
def get_child_watcher(self) -> AbstractChildWatcher: ...
44+
def set_child_watcher(self, watcher: AbstractChildWatcher | None) -> None: ...
45+
SelectorEventLoop = _UnixSelectorEventLoop
46+
47+
DefaultEventLoopPolicy = _UnixDefaultEventLoopPolicy
48+
49+
if sys.version_info >= (3, 8):
50+
51+
from typing import Protocol
52+
class _Warn(Protocol):
53+
def __call__(
54+
self, message: str, category: Type[Warning] | None = ..., stacklevel: int = ..., source: Any | None = ...
55+
) -> None: ...
56+
class MultiLoopChildWatcher(AbstractChildWatcher):
57+
def __enter__(self: Self) -> Self: ...
58+
class ThreadedChildWatcher(AbstractChildWatcher):
59+
def __enter__(self: Self) -> Self: ...
60+
def __del__(self, _warn: _Warn = ...) -> None: ...

0 commit comments

Comments
 (0)