Debian Codegraph @

jedi/third_party/typeshed/stdlib/select.pyi

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