-
Notifications
You must be signed in to change notification settings - Fork 668
Expand file tree
/
Copy path__init__.pyi
More file actions
239 lines (209 loc) · 5.59 KB
/
Copy path__init__.pyi
File metadata and controls
239 lines (209 loc) · 5.59 KB
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
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
from collections.abc import Sequence
from typing import Any, Final, Protocol, overload, type_check_only
from _typeshed import HasFileno
from typing_extensions import Buffer, Literal, Self
import zmq
from .select import select_backend as select_backend
__all__ = [
'Context',
'Socket',
'Frame',
'Message',
'proxy',
'proxy_steerable',
'zmq_poll',
'strerror',
'zmq_errno',
'has',
'curve_keypair',
'curve_public',
'zmq_version_info',
'IPC_PATH_MAX_LEN',
'PYZMQ_DRAFT_API',
]
IPC_PATH_MAX_LEN: Final[int] = ...
PYZMQ_DRAFT_API: Final[bool] = ...
class Frame:
more: bool
tracker: Any
def __init__(
self,
data: Any = None,
track: bool = False,
copy: bool | None = None,
copy_threshold: int | None = None,
) -> None: ...
def __len__(self) -> int: ...
def __copy__(self) -> Self: ...
def fast_copy(self) -> Self: ...
#
@overload
def get(self, option: int | Literal["routing_id"]) -> int: ...
@overload
def get(self, option: bytes | Literal["group"]) -> str: ...
@overload
def get(self, option: str) -> int | str: ...
#
@overload
def set(self, option: Literal["routing_id"], value: int) -> None: ...
@overload
def set(self, option: Literal["group"], value: str | bytes) -> None: ...
@overload
def set(self, option: int, value: int) -> None: ...
#
@property
def buffer(self) -> memoryview: ...
@property
def bytes(self) -> bytes: ...
Message = Frame
class Socket:
context: zmq.Context
copy_threshold: int
# specific option types
FD: int
def __init__(
self,
context: Context | None = None,
socket_type: int = -1,
shadow: int = 0,
copy_threshold: int | None = None,
) -> None: ...
#
@property
def underlying(self) -> int: ...
@property
def closed(self) -> bool: ...
#
def close(self, linger: int | None = None) -> None: ...
#
def set(self, option: int, optval: int | bytes) -> None: ...
def get(self, option: int) -> int | bytes: ...
#
def bind(self, addr: str) -> None: ...
def connect(self, addr: str) -> None: ...
def unbind(self, addr: str | bytes) -> None: ...
def disconnect(self, addr: str | bytes) -> None: ...
def monitor(
self,
addr: str | bytes | None,
events: int = zmq.EVENT_ALL,
) -> None: ...
def join(self, group: str | bytes) -> None: ...
def leave(self, group: str | bytes) -> None: ...
#
@overload # data: Buffer, copy=True (default)
def send(
self,
data: Buffer,
flags: int = 0,
copy: Literal[True] = True,
track: bool = False,
) -> None: ...
@overload # data: Buffer, copy=False (keyword)
def send(
self,
data: Buffer,
flags: int = 0,
*,
copy: Literal[False],
track: bool = False,
) -> zmq.MessageTracker: ...
@overload # data: Buffer, copy=False (positional)
def send(
self,
data: Buffer,
flags: int,
copy: Literal[False],
track: bool = False,
) -> zmq.MessageTracker: ...
@overload # data: Frame
def send(
self,
data: Frame,
flags: int = 0,
copy: bool = True,
track: bool = False,
) -> zmq.MessageTracker: ...
#
@overload # copy=True (default)
def recv(
self,
flags: int = 0,
copy: Literal[True] = True,
track: bool = False,
) -> bytes: ...
@overload # copy=False (keyword)
def recv(
self,
flags: int = 0,
*,
copy: Literal[False],
track: bool = False,
) -> zmq.Frame: ...
@overload # copy=False (positional)
def recv(
self,
flags: int,
copy: Literal[False],
track: bool = False,
) -> zmq.Frame: ...
@overload # fallback overload (mypy bug workaround)
def recv(
self,
flags: int = 0,
copy: bool = True,
track: bool = False,
) -> bytes | zmq.Frame: ...
#
def recv_into(
self, buffer: Buffer, /, *, nbytes: int = 0, flags: int = 0
) -> int: ...
class Context:
handle: int
closed: bool
def __init__(self, io_threads: int = 1, shadow: int = 0) -> None: ...
#
@property
def underlying(self) -> int: ...
#
def term(self) -> None: ...
def set(self, option: int, optval: int) -> None: ...
def get(self, option: int) -> int: ...
def zmq_errno() -> int: ...
def strerror(errno: int) -> str: ...
def zmq_version_info() -> tuple[int, int, int]: ...
def has(capability: str) -> bool: ...
def curve_keypair() -> tuple[bytes, bytes]: ...
def curve_public(secret_key: str | bytes) -> bytes: ...
#
@overload
def zmq_poll(
sockets: Sequence[tuple[Socket, int]],
timeout: int = -1,
) -> list[tuple[Socket, int]]: ...
@overload
def zmq_poll(
sockets: Sequence[tuple[int | HasFileno, int]],
timeout: int = -1,
) -> list[tuple[int, int]]: ...
#
def proxy(frontend: Socket, backend: Socket, capture: Socket | None = None) -> int: ...
def proxy_steerable(
frontend: Socket,
backend: Socket,
capture: Socket | None = None,
control: Socket | None = None,
) -> int: ...
@type_check_only
class _MonitoredQueueFunction(Protocol):
def __call__(
self,
/,
in_socket: Socket,
out_socket: Socket,
mon_socket: Socket,
in_prefix: Buffer = b"in",
out_prefix: Buffer = b"out",
) -> int: ...
# None for the cffi backend
monitored_queue: Final[_MonitoredQueueFunction | None] = ...