1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168
|
import sys
from _typeshed import FileDescriptorLike
from collections.abc import Iterable
from types import TracebackType
from typing import Any, ClassVar, Final, TypeVar, final, overload
from typing_extensions import Never, Self, deprecated
if sys.platform != "win32":
PIPE_BUF: Final[int]
POLLERR: Final[int]
POLLHUP: Final[int]
POLLIN: Final[int]
if sys.platform == "linux":
POLLMSG: Final[int]
POLLNVAL: Final[int]
POLLOUT: Final[int]
POLLPRI: Final[int]
POLLRDBAND: Final[int]
if sys.platform == "linux":
POLLRDHUP: Final[int]
POLLRDNORM: Final[int]
POLLWRBAND: Final[int]
POLLWRNORM: Final[int]
# This is actually a function that returns an instance of a class.
# The class is not accessible directly, and also calls itself select.poll.
class poll:
# default value is select.POLLIN | select.POLLPRI | select.POLLOUT
def register(self, fd: FileDescriptorLike, eventmask: int = 7, /) -> None: ...
def modify(self, fd: FileDescriptorLike, eventmask: int, /) -> None: ...
def unregister(self, fd: FileDescriptorLike, /) -> None: ...
def poll(self, timeout: float | None = None, /) -> list[tuple[int, int]]: ...
_R = TypeVar("_R", default=Never)
_W = TypeVar("_W", default=Never)
_X = TypeVar("_X", default=Never)
def select(
rlist: Iterable[_R], wlist: Iterable[_W], xlist: Iterable[_X], timeout: float | None = None, /
) -> tuple[list[_R], list[_W], list[_X]]: ...
error = OSError
if sys.platform != "linux" and sys.platform != "win32":
# BSD only
@final
class kevent:
data: Any
fflags: int
filter: int
flags: int
ident: int
udata: Any
def __init__(
self, ident: FileDescriptorLike, filter: int = ..., flags: int = ..., fflags: int = 0, data: Any = 0, udata: Any = 0
) -> None: ...
__hash__: ClassVar[None] # type: ignore[assignment]
# BSD only
@final
class kqueue:
closed: bool
def __init__(self) -> None: ...
def close(self) -> None: ...
def control(
self, changelist: Iterable[kevent] | None, maxevents: int, timeout: float | None = None, /
) -> list[kevent]: ...
def fileno(self) -> int: ...
@classmethod
def fromfd(cls, fd: FileDescriptorLike, /) -> kqueue: ...
KQ_EV_ADD: Final[int]
KQ_EV_CLEAR: Final[int]
KQ_EV_DELETE: Final[int]
KQ_EV_DISABLE: Final[int]
KQ_EV_ENABLE: Final[int]
KQ_EV_EOF: Final[int]
KQ_EV_ERROR: Final[int]
KQ_EV_FLAG1: Final[int]
KQ_EV_ONESHOT: Final[int]
KQ_EV_SYSFLAGS: Final[int]
KQ_FILTER_AIO: Final[int]
if sys.platform != "darwin":
KQ_FILTER_NETDEV: Final[int]
KQ_FILTER_PROC: Final[int]
KQ_FILTER_READ: Final[int]
KQ_FILTER_SIGNAL: Final[int]
KQ_FILTER_TIMER: Final[int]
KQ_FILTER_VNODE: Final[int]
KQ_FILTER_WRITE: Final[int]
KQ_NOTE_ATTRIB: Final[int]
KQ_NOTE_CHILD: Final[int]
KQ_NOTE_DELETE: Final[int]
KQ_NOTE_EXEC: Final[int]
KQ_NOTE_EXIT: Final[int]
KQ_NOTE_EXTEND: Final[int]
KQ_NOTE_FORK: Final[int]
KQ_NOTE_LINK: Final[int]
if sys.platform != "darwin":
KQ_NOTE_LINKDOWN: Final[int]
KQ_NOTE_LINKINV: Final[int]
KQ_NOTE_LINKUP: Final[int]
KQ_NOTE_LOWAT: Final[int]
KQ_NOTE_PCTRLMASK: Final[int]
KQ_NOTE_PDATAMASK: Final[int]
KQ_NOTE_RENAME: Final[int]
KQ_NOTE_REVOKE: Final[int]
KQ_NOTE_TRACK: Final[int]
KQ_NOTE_TRACKERR: Final[int]
KQ_NOTE_WRITE: Final[int]
if sys.platform == "linux":
@final
class epoll:
@overload
def __new__(self, sizehint: int = -1) -> Self: ...
@overload
@deprecated(
"The `flags` parameter is deprecated since Python 3.4. "
"Use `os.set_inheritable()` to make the file descriptor inheritable."
)
def __new__(self, sizehint: int = -1, flags: int = 0) -> Self: ...
def __enter__(self) -> Self: ...
def __exit__(
self,
exc_type: type[BaseException] | None = None,
exc_value: BaseException | None = None,
exc_tb: TracebackType | None = None,
/,
) -> None: ...
def close(self) -> None: ...
closed: bool
def fileno(self) -> int: ...
def register(self, fd: FileDescriptorLike, eventmask: int = ...) -> None: ...
def modify(self, fd: FileDescriptorLike, eventmask: int) -> None: ...
def unregister(self, fd: FileDescriptorLike) -> None: ...
def poll(self, timeout: float | None = None, maxevents: int = -1) -> list[tuple[int, int]]: ...
@classmethod
def fromfd(cls, fd: FileDescriptorLike, /) -> epoll: ...
EPOLLERR: Final[int]
EPOLLEXCLUSIVE: Final[int]
EPOLLET: Final[int]
EPOLLHUP: Final[int]
EPOLLIN: Final[int]
EPOLLMSG: Final[int]
EPOLLONESHOT: Final[int]
EPOLLOUT: Final[int]
EPOLLPRI: Final[int]
EPOLLRDBAND: Final[int]
EPOLLRDHUP: Final[int]
EPOLLRDNORM: Final[int]
EPOLLWRBAND: Final[int]
EPOLLWRNORM: Final[int]
EPOLL_CLOEXEC: Final[int]
if sys.version_info >= (3, 14):
EPOLLWAKEUP: Final[int]
if sys.platform != "linux" and sys.platform != "darwin" and sys.platform != "win32":
# Solaris only
class devpoll:
def close(self) -> None: ...
closed: bool
def fileno(self) -> int: ...
def register(self, fd: FileDescriptorLike, eventmask: int = ...) -> None: ...
def modify(self, fd: FileDescriptorLike, eventmask: int = ...) -> None: ...
def unregister(self, fd: FileDescriptorLike) -> None: ...
def poll(self, timeout: float | None = None) -> list[tuple[int, int]]: ...
|