basedpyright 1.18.4 → 1.19.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/pyright-langserver.js +1 -1
- package/dist/pyright-langserver.js.map +1 -1
- package/dist/pyright.js +1 -1
- package/dist/pyright.js.map +1 -1
- package/dist/typeshed-fallback/stdlib/_collections_abc.pyi +6 -2
- package/dist/typeshed-fallback/stdlib/_csv.pyi +1 -63
- package/dist/typeshed-fallback/stdlib/_ctypes.pyi +29 -3
- package/dist/typeshed-fallback/stdlib/_interpchannels.pyi +258 -86
- package/dist/typeshed-fallback/stdlib/_interpqueues.pyi +100 -16
- package/dist/typeshed-fallback/stdlib/_interpreters.pyi +204 -50
- package/dist/typeshed-fallback/stdlib/_json.pyi +1 -1
- package/dist/typeshed-fallback/stdlib/_socket.pyi +5 -26
- package/dist/typeshed-fallback/stdlib/_sqlite3.pyi +24 -9
- package/dist/typeshed-fallback/stdlib/_stat.pyi +13 -2
- package/dist/typeshed-fallback/stdlib/_thread.pyi +35 -93
- package/dist/typeshed-fallback/stdlib/asyncio/futures.pyi +3 -1
- package/dist/typeshed-fallback/stdlib/atexit.pyi +6 -20
- package/dist/typeshed-fallback/stdlib/builtins.pyi +250 -251
- package/dist/typeshed-fallback/stdlib/collections/__init__.pyi +8 -7
- package/dist/typeshed-fallback/stdlib/datetime.pyi +9 -3
- package/dist/typeshed-fallback/stdlib/dbm/sqlite3.pyi +29 -29
- package/dist/typeshed-fallback/stdlib/dis.pyi +33 -7
- package/dist/typeshed-fallback/stdlib/functools.pyi +2 -2
- package/dist/typeshed-fallback/stdlib/gc.pyi +5 -11
- package/dist/typeshed-fallback/stdlib/importlib/metadata/__init__.pyi +17 -2
- package/dist/typeshed-fallback/stdlib/importlib/metadata/diagnose.pyi +2 -2
- package/dist/typeshed-fallback/stdlib/importlib/resources/_functional.pyi +30 -30
- package/dist/typeshed-fallback/stdlib/io.pyi +3 -1
- package/dist/typeshed-fallback/stdlib/ipaddress.pyi +8 -1
- package/dist/typeshed-fallback/stdlib/itertools.pyi +3 -6
- package/dist/typeshed-fallback/stdlib/marshal.pyi +61 -4
- package/dist/typeshed-fallback/stdlib/math.pyi +7 -1
- package/dist/typeshed-fallback/stdlib/mmap.pyi +1 -1
- package/dist/typeshed-fallback/stdlib/multiprocessing/managers.pyi +14 -2
- package/dist/typeshed-fallback/stdlib/os/__init__.pyi +43 -9
- package/dist/typeshed-fallback/stdlib/posixpath.pyi +14 -2
- package/dist/typeshed-fallback/stdlib/signal.pyi +2 -3
- package/dist/typeshed-fallback/stdlib/sqlite3/__init__.pyi +54 -6
- package/dist/typeshed-fallback/stdlib/sys/__init__.pyi +11 -17
- package/dist/typeshed-fallback/stdlib/threading.pyi +44 -16
- package/dist/typeshed-fallback/stdlib/time.pyi +2 -10
- package/dist/typeshed-fallback/stdlib/types.pyi +31 -13
- package/dist/typeshed-fallback/stdlib/typing.pyi +6 -2
- package/dist/typeshed-fallback/stdlib/unicodedata.pyi +2 -2
- package/package.json +1 -1
|
@@ -76,7 +76,9 @@ class dict_keys(KeysView[_KT_co], Generic[_KT_co, _VT_co]): # undocumented
|
|
|
76
76
|
"""Return self==value."""
|
|
77
77
|
...
|
|
78
78
|
if sys.version_info >= (3, 13):
|
|
79
|
-
def isdisjoint(self, other: Iterable[_KT_co], /) -> bool:
|
|
79
|
+
def isdisjoint(self, other: Iterable[_KT_co], /) -> bool:
|
|
80
|
+
"""Return True if the view and the given iterable have a null intersection."""
|
|
81
|
+
...
|
|
80
82
|
if sys.version_info >= (3, 10):
|
|
81
83
|
@property
|
|
82
84
|
def mapping(self) -> MappingProxyType[_KT_co, _VT_co]:
|
|
@@ -97,7 +99,9 @@ class dict_items(ItemsView[_KT_co, _VT_co]): # undocumented
|
|
|
97
99
|
"""Return self==value."""
|
|
98
100
|
...
|
|
99
101
|
if sys.version_info >= (3, 13):
|
|
100
|
-
def isdisjoint(self, other: Iterable[tuple[_KT_co, _VT_co]], /) -> bool:
|
|
102
|
+
def isdisjoint(self, other: Iterable[tuple[_KT_co, _VT_co]], /) -> bool:
|
|
103
|
+
"""Return True if the view and the given iterable have a null intersection."""
|
|
104
|
+
...
|
|
101
105
|
if sys.version_info >= (3, 10):
|
|
102
106
|
@property
|
|
103
107
|
def mapping(self) -> MappingProxyType[_KT_co, _VT_co]:
|
|
@@ -1,66 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
CSV parsing and writing.
|
|
3
|
-
|
|
4
|
-
This module provides classes that assist in the reading and writing
|
|
5
|
-
of Comma Separated Value (CSV) files, and implements the interface
|
|
6
|
-
described by PEP 305. Although many CSV files are simple to parse,
|
|
7
|
-
the format is not formally defined by a stable specification and
|
|
8
|
-
is subtle enough that parsing lines of a CSV file with something
|
|
9
|
-
like line.split(",") is bound to fail. The module supports three
|
|
10
|
-
basic APIs: reading, writing, and registration of dialects.
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
DIALECT REGISTRATION:
|
|
14
|
-
|
|
15
|
-
Readers and writers support a dialect argument, which is a convenient
|
|
16
|
-
handle on a group of settings. When the dialect argument is a string,
|
|
17
|
-
it identifies one of the dialects previously registered with the module.
|
|
18
|
-
If it is a class or instance, the attributes of the argument are used as
|
|
19
|
-
the settings for the reader or writer:
|
|
20
|
-
|
|
21
|
-
class excel:
|
|
22
|
-
delimiter = ','
|
|
23
|
-
quotechar = '"'
|
|
24
|
-
escapechar = None
|
|
25
|
-
doublequote = True
|
|
26
|
-
skipinitialspace = False
|
|
27
|
-
lineterminator = '\r\n'
|
|
28
|
-
quoting = QUOTE_MINIMAL
|
|
29
|
-
|
|
30
|
-
SETTINGS:
|
|
31
|
-
|
|
32
|
-
* quotechar - specifies a one-character string to use as the
|
|
33
|
-
quoting character. It defaults to '"'.
|
|
34
|
-
* delimiter - specifies a one-character string to use as the
|
|
35
|
-
field separator. It defaults to ','.
|
|
36
|
-
* skipinitialspace - specifies how to interpret spaces which
|
|
37
|
-
immediately follow a delimiter. It defaults to False, which
|
|
38
|
-
means that spaces immediately following a delimiter is part
|
|
39
|
-
of the following field.
|
|
40
|
-
* lineterminator - specifies the character sequence which should
|
|
41
|
-
terminate rows.
|
|
42
|
-
* quoting - controls when quotes should be generated by the writer.
|
|
43
|
-
It can take on any of the following module constants:
|
|
44
|
-
|
|
45
|
-
csv.QUOTE_MINIMAL means only when required, for example, when a
|
|
46
|
-
field contains either the quotechar or the delimiter
|
|
47
|
-
csv.QUOTE_ALL means that quotes are always placed around fields.
|
|
48
|
-
csv.QUOTE_NONNUMERIC means that quotes are always placed around
|
|
49
|
-
fields which do not parse as integers or floating point
|
|
50
|
-
numbers.
|
|
51
|
-
csv.QUOTE_STRINGS means that quotes are always placed around
|
|
52
|
-
fields which are strings. Note that the Python value None
|
|
53
|
-
is not a string.
|
|
54
|
-
csv.QUOTE_NOTNULL means that quotes are only placed around fields
|
|
55
|
-
that are not the Python value None.
|
|
56
|
-
csv.QUOTE_NONE means that quotes are never placed around fields.
|
|
57
|
-
* escapechar - specifies a one-character string used to escape
|
|
58
|
-
the delimiter when quoting is set to QUOTE_NONE.
|
|
59
|
-
* doublequote - controls the handling of quotes inside fields. When
|
|
60
|
-
True, two consecutive quotes are interpreted as one during read,
|
|
61
|
-
and when writing, each quote character embedded in the data is
|
|
62
|
-
written as two quotes
|
|
63
|
-
"""
|
|
1
|
+
"""CSV parsing and writing."""
|
|
64
2
|
|
|
65
3
|
import sys
|
|
66
4
|
from _typeshed import SupportsWrite
|
|
@@ -109,8 +109,26 @@ class _Pointer(_PointerLike, _CData, Generic[_CT]):
|
|
|
109
109
|
"""Set self[key] to value."""
|
|
110
110
|
...
|
|
111
111
|
|
|
112
|
-
def POINTER(type: type[_CT], /) -> type[_Pointer[_CT]]:
|
|
113
|
-
|
|
112
|
+
def POINTER(type: type[_CT], /) -> type[_Pointer[_CT]]:
|
|
113
|
+
"""
|
|
114
|
+
Create and return a new ctypes pointer type.
|
|
115
|
+
|
|
116
|
+
type
|
|
117
|
+
A ctypes type.
|
|
118
|
+
|
|
119
|
+
Pointer types are cached and reused internally,
|
|
120
|
+
so calling this function repeatedly is cheap.
|
|
121
|
+
"""
|
|
122
|
+
...
|
|
123
|
+
def pointer(obj: _CT, /) -> _Pointer[_CT]:
|
|
124
|
+
"""
|
|
125
|
+
Create a new pointer instance, pointing to 'obj'.
|
|
126
|
+
|
|
127
|
+
The returned object is of the type POINTER(type(obj)). Note that if you
|
|
128
|
+
just want to pass a pointer to an object to a foreign function call, you
|
|
129
|
+
should use byref(obj) which is much faster.
|
|
130
|
+
"""
|
|
131
|
+
...
|
|
114
132
|
|
|
115
133
|
class _CArgObject: ...
|
|
116
134
|
|
|
@@ -181,7 +199,15 @@ class Structure(_StructUnionBase):
|
|
|
181
199
|
...
|
|
182
200
|
|
|
183
201
|
class Array(_CData, Generic[_CT]):
|
|
184
|
-
"""
|
|
202
|
+
"""
|
|
203
|
+
Abstract base class for arrays.
|
|
204
|
+
|
|
205
|
+
The recommended way to create concrete array types is by multiplying any
|
|
206
|
+
ctypes data type with a non-negative integer. Alternatively, you can subclass
|
|
207
|
+
this type and define _length_ and _type_ class variables. Array elements can
|
|
208
|
+
be read and written using standard subscript and slice accesses for slice
|
|
209
|
+
reads, the resulting object is not itself an Array.
|
|
210
|
+
"""
|
|
185
211
|
@property
|
|
186
212
|
@abstractmethod
|
|
187
213
|
def _length_(self) -> int: ...
|
|
@@ -1,86 +1,258 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
class
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
def
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
def
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
"
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
"
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
"
|
|
40
|
-
|
|
41
|
-
)
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
def
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
def
|
|
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
|
-
def
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
def
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
def
|
|
1
|
+
"""
|
|
2
|
+
This module provides primitive operations to manage Python interpreters.
|
|
3
|
+
The 'interpreters' module provides a more convenient interface.
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
from _typeshed import structseq
|
|
7
|
+
from typing import Any, Final, Literal, SupportsIndex, final
|
|
8
|
+
from typing_extensions import Buffer, Self
|
|
9
|
+
|
|
10
|
+
class ChannelError(RuntimeError): ...
|
|
11
|
+
class ChannelClosedError(ChannelError): ...
|
|
12
|
+
class ChannelEmptyError(ChannelError): ...
|
|
13
|
+
class ChannelNotEmptyError(ChannelError): ...
|
|
14
|
+
class ChannelNotFoundError(ChannelError): ...
|
|
15
|
+
|
|
16
|
+
# Mark as final, since instantiating ChannelID is not supported.
|
|
17
|
+
@final
|
|
18
|
+
class ChannelID:
|
|
19
|
+
"""A channel ID identifies a channel and may be used as an int."""
|
|
20
|
+
@property
|
|
21
|
+
def end(self) -> Literal["send", "recv", "both"]:
|
|
22
|
+
"""'send', 'recv', or 'both'"""
|
|
23
|
+
...
|
|
24
|
+
@property
|
|
25
|
+
def send(self) -> Self:
|
|
26
|
+
"""the 'send' end of the channel"""
|
|
27
|
+
...
|
|
28
|
+
@property
|
|
29
|
+
def recv(self) -> Self:
|
|
30
|
+
"""the 'recv' end of the channel"""
|
|
31
|
+
...
|
|
32
|
+
def __eq__(self, other: object) -> bool:
|
|
33
|
+
"""Return self==value."""
|
|
34
|
+
...
|
|
35
|
+
def __ge__(self, other: ChannelID) -> bool:
|
|
36
|
+
"""Return self>=value."""
|
|
37
|
+
...
|
|
38
|
+
def __gt__(self, other: ChannelID) -> bool:
|
|
39
|
+
"""Return self>value."""
|
|
40
|
+
...
|
|
41
|
+
def __hash__(self) -> int:
|
|
42
|
+
"""Return hash(self)."""
|
|
43
|
+
...
|
|
44
|
+
def __index__(self) -> int:
|
|
45
|
+
"""Return self converted to an integer, if self is suitable for use as an index into a list."""
|
|
46
|
+
...
|
|
47
|
+
def __int__(self) -> int:
|
|
48
|
+
"""int(self)"""
|
|
49
|
+
...
|
|
50
|
+
def __le__(self, other: ChannelID) -> bool:
|
|
51
|
+
"""Return self<=value."""
|
|
52
|
+
...
|
|
53
|
+
def __lt__(self, other: ChannelID) -> bool:
|
|
54
|
+
"""Return self<value."""
|
|
55
|
+
...
|
|
56
|
+
def __ne__(self, other: object) -> bool:
|
|
57
|
+
"""Return self!=value."""
|
|
58
|
+
...
|
|
59
|
+
|
|
60
|
+
@final
|
|
61
|
+
class ChannelInfo(structseq[int], tuple[bool, bool, bool, int, int, int, int, int]):
|
|
62
|
+
"""
|
|
63
|
+
ChannelInfo
|
|
64
|
+
|
|
65
|
+
A named tuple of a channel's state.
|
|
66
|
+
"""
|
|
67
|
+
__match_args__: Final = (
|
|
68
|
+
"open",
|
|
69
|
+
"closing",
|
|
70
|
+
"closed",
|
|
71
|
+
"count",
|
|
72
|
+
"num_interp_send",
|
|
73
|
+
"num_interp_send_released",
|
|
74
|
+
"num_interp_recv",
|
|
75
|
+
"num_interp_recv_released",
|
|
76
|
+
)
|
|
77
|
+
@property
|
|
78
|
+
def open(self) -> bool:
|
|
79
|
+
"""both ends are open"""
|
|
80
|
+
...
|
|
81
|
+
@property
|
|
82
|
+
def closing(self) -> bool:
|
|
83
|
+
"""send is closed, recv is non-empty"""
|
|
84
|
+
...
|
|
85
|
+
@property
|
|
86
|
+
def closed(self) -> bool:
|
|
87
|
+
"""both ends are closed"""
|
|
88
|
+
...
|
|
89
|
+
@property
|
|
90
|
+
def count(self) -> int:
|
|
91
|
+
"""queued objects"""
|
|
92
|
+
...
|
|
93
|
+
@property
|
|
94
|
+
def num_interp_send(self) -> int:
|
|
95
|
+
"""interpreters bound to the send end"""
|
|
96
|
+
...
|
|
97
|
+
@property
|
|
98
|
+
def num_interp_send_released(self) -> int:
|
|
99
|
+
"""interpreters bound to the send end and released"""
|
|
100
|
+
...
|
|
101
|
+
@property
|
|
102
|
+
def num_interp_recv(self) -> int:
|
|
103
|
+
"""interpreters bound to the send end"""
|
|
104
|
+
...
|
|
105
|
+
@property
|
|
106
|
+
def num_interp_recv_released(self) -> int:
|
|
107
|
+
"""interpreters bound to the send end and released"""
|
|
108
|
+
...
|
|
109
|
+
@property
|
|
110
|
+
def num_interp_both(self) -> int:
|
|
111
|
+
"""interpreters bound to both ends"""
|
|
112
|
+
...
|
|
113
|
+
@property
|
|
114
|
+
def num_interp_both_recv_released(self) -> int:
|
|
115
|
+
"""interpreters bound to both ends and released_from_the recv end"""
|
|
116
|
+
...
|
|
117
|
+
@property
|
|
118
|
+
def num_interp_both_send_released(self) -> int:
|
|
119
|
+
"""interpreters bound to both ends and released_from_the send end"""
|
|
120
|
+
...
|
|
121
|
+
@property
|
|
122
|
+
def num_interp_both_released(self) -> int:
|
|
123
|
+
"""interpreters bound to both ends and released_from_both"""
|
|
124
|
+
...
|
|
125
|
+
@property
|
|
126
|
+
def recv_associated(self) -> bool:
|
|
127
|
+
"""current interpreter is bound to the recv end"""
|
|
128
|
+
...
|
|
129
|
+
@property
|
|
130
|
+
def recv_released(self) -> bool:
|
|
131
|
+
"""current interpreter *was* bound to the recv end"""
|
|
132
|
+
...
|
|
133
|
+
@property
|
|
134
|
+
def send_associated(self) -> bool:
|
|
135
|
+
"""current interpreter is bound to the send end"""
|
|
136
|
+
...
|
|
137
|
+
@property
|
|
138
|
+
def send_released(self) -> bool:
|
|
139
|
+
"""current interpreter *was* bound to the send end"""
|
|
140
|
+
...
|
|
141
|
+
|
|
142
|
+
def create(unboundop: Literal[1, 2, 3]) -> ChannelID:
|
|
143
|
+
"""
|
|
144
|
+
channel_create(unboundop) -> cid
|
|
145
|
+
|
|
146
|
+
Create a new cross-interpreter channel and return a unique generated ID.
|
|
147
|
+
"""
|
|
148
|
+
...
|
|
149
|
+
def destroy(cid: SupportsIndex) -> None:
|
|
150
|
+
"""
|
|
151
|
+
channel_destroy(cid)
|
|
152
|
+
|
|
153
|
+
Close and finalize the channel. Afterward attempts to use the channel
|
|
154
|
+
will behave as though it never existed.
|
|
155
|
+
"""
|
|
156
|
+
...
|
|
157
|
+
def list_all() -> list[ChannelID]:
|
|
158
|
+
"""
|
|
159
|
+
channel_list_all() -> [cid]
|
|
160
|
+
|
|
161
|
+
Return the list of all IDs for active channels.
|
|
162
|
+
"""
|
|
163
|
+
...
|
|
164
|
+
def list_interpreters(cid: SupportsIndex, *, send: bool) -> list[int]:
|
|
165
|
+
"""
|
|
166
|
+
channel_list_interpreters(cid, *, send) -> [id]
|
|
167
|
+
|
|
168
|
+
Return the list of all interpreter IDs associated with an end of the channel.
|
|
169
|
+
|
|
170
|
+
The 'send' argument should be a boolean indicating whether to use the send or
|
|
171
|
+
receive end.
|
|
172
|
+
"""
|
|
173
|
+
...
|
|
174
|
+
def send(cid: SupportsIndex, obj: object, *, blocking: bool = True, timeout: float | None = None) -> None:
|
|
175
|
+
"""
|
|
176
|
+
channel_send(cid, obj, *, blocking=True, timeout=None)
|
|
177
|
+
|
|
178
|
+
Add the object's data to the channel's queue.
|
|
179
|
+
By default this waits for the object to be received.
|
|
180
|
+
"""
|
|
181
|
+
...
|
|
182
|
+
def send_buffer(cid: SupportsIndex, obj: Buffer, *, blocking: bool = True, timeout: float | None = None) -> None:
|
|
183
|
+
"""
|
|
184
|
+
channel_send_buffer(cid, obj, *, blocking=True, timeout=None)
|
|
185
|
+
|
|
186
|
+
Add the object's buffer to the channel's queue.
|
|
187
|
+
By default this waits for the object to be received.
|
|
188
|
+
"""
|
|
189
|
+
...
|
|
190
|
+
def recv(cid: SupportsIndex, default: object = ...) -> tuple[Any, Literal[1, 2, 3]]:
|
|
191
|
+
"""
|
|
192
|
+
channel_recv(cid, [default]) -> (obj, unboundop)
|
|
193
|
+
|
|
194
|
+
Return a new object from the data at the front of the channel's queue.
|
|
195
|
+
|
|
196
|
+
If there is nothing to receive then raise ChannelEmptyError, unless
|
|
197
|
+
a default value is provided. In that case return it.
|
|
198
|
+
"""
|
|
199
|
+
...
|
|
200
|
+
def close(cid: SupportsIndex, *, send: bool = False, recv: bool = False) -> None:
|
|
201
|
+
"""
|
|
202
|
+
channel_close(cid, *, send=None, recv=None, force=False)
|
|
203
|
+
|
|
204
|
+
Close the channel for all interpreters.
|
|
205
|
+
|
|
206
|
+
If the channel is empty then the keyword args are ignored and both
|
|
207
|
+
ends are immediately closed. Otherwise, if 'force' is True then
|
|
208
|
+
all queued items are released and both ends are immediately
|
|
209
|
+
closed.
|
|
210
|
+
|
|
211
|
+
If the channel is not empty *and* 'force' is False then following
|
|
212
|
+
happens:
|
|
213
|
+
|
|
214
|
+
* recv is True (regardless of send):
|
|
215
|
+
- raise ChannelNotEmptyError
|
|
216
|
+
* recv is None and send is None:
|
|
217
|
+
- raise ChannelNotEmptyError
|
|
218
|
+
* send is True and recv is not True:
|
|
219
|
+
- fully close the 'send' end
|
|
220
|
+
- close the 'recv' end to interpreters not already receiving
|
|
221
|
+
- fully close it once empty
|
|
222
|
+
|
|
223
|
+
Closing an already closed channel results in a ChannelClosedError.
|
|
224
|
+
|
|
225
|
+
Once the channel's ID has no more ref counts in any interpreter
|
|
226
|
+
the channel will be destroyed.
|
|
227
|
+
"""
|
|
228
|
+
...
|
|
229
|
+
def get_count(cid: SupportsIndex) -> int:
|
|
230
|
+
"""
|
|
231
|
+
get_count(cid)
|
|
232
|
+
|
|
233
|
+
Return the number of items in the channel.
|
|
234
|
+
"""
|
|
235
|
+
...
|
|
236
|
+
def get_info(cid: SupportsIndex) -> ChannelInfo:
|
|
237
|
+
"""
|
|
238
|
+
get_info(cid)
|
|
239
|
+
|
|
240
|
+
Return details about the channel.
|
|
241
|
+
"""
|
|
242
|
+
...
|
|
243
|
+
def get_channel_defaults(cid: SupportsIndex) -> Literal[1, 2, 3]:
|
|
244
|
+
"""
|
|
245
|
+
get_channel_defaults(cid)
|
|
246
|
+
|
|
247
|
+
Return the channel's default values, set when it was created.
|
|
248
|
+
"""
|
|
249
|
+
...
|
|
250
|
+
def release(cid: SupportsIndex, *, send: bool = False, recv: bool = False, force: bool = False) -> None:
|
|
251
|
+
"""
|
|
252
|
+
channel_release(cid, *, send=None, recv=None, force=True)
|
|
253
|
+
|
|
254
|
+
Close the channel for the current interpreter. 'send' and 'recv'
|
|
255
|
+
(bool) may be used to indicate the ends to close. By default both
|
|
256
|
+
ends are closed. Closing an already closed end is a noop.
|
|
257
|
+
"""
|
|
258
|
+
...
|
|
@@ -1,16 +1,100 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
def
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
1
|
+
"""
|
|
2
|
+
This module provides primitive operations to manage Python interpreters.
|
|
3
|
+
The 'interpreters' module provides a more convenient interface.
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
from typing import Any, SupportsIndex
|
|
7
|
+
|
|
8
|
+
class QueueError(RuntimeError):
|
|
9
|
+
"""Indicates that a queue-related error happened."""
|
|
10
|
+
...
|
|
11
|
+
class QueueNotFoundError(QueueError): ...
|
|
12
|
+
|
|
13
|
+
def bind(qid: SupportsIndex) -> None:
|
|
14
|
+
"""
|
|
15
|
+
bind(qid)
|
|
16
|
+
|
|
17
|
+
Take a reference to the identified queue.
|
|
18
|
+
The queue is not destroyed until there are no references left.
|
|
19
|
+
"""
|
|
20
|
+
...
|
|
21
|
+
def create(maxsize: SupportsIndex, fmt: SupportsIndex) -> int:
|
|
22
|
+
"""
|
|
23
|
+
create(maxsize, fmt, unboundop) -> qid
|
|
24
|
+
|
|
25
|
+
Create a new cross-interpreter queue and return its unique generated ID.
|
|
26
|
+
It is a new reference as though bind() had been called on the queue.
|
|
27
|
+
|
|
28
|
+
The caller is responsible for calling destroy() for the new queue
|
|
29
|
+
before the runtime is finalized.
|
|
30
|
+
"""
|
|
31
|
+
...
|
|
32
|
+
def destroy(qid: SupportsIndex) -> None:
|
|
33
|
+
"""
|
|
34
|
+
destroy(qid)
|
|
35
|
+
|
|
36
|
+
Clear and destroy the queue. Afterward attempts to use the queue
|
|
37
|
+
will behave as though it never existed.
|
|
38
|
+
"""
|
|
39
|
+
...
|
|
40
|
+
def get(qid: SupportsIndex) -> tuple[Any, int]:
|
|
41
|
+
"""
|
|
42
|
+
get(qid) -> (obj, fmt)
|
|
43
|
+
|
|
44
|
+
Return a new object from the data at the front of the queue.
|
|
45
|
+
The object's format is also returned.
|
|
46
|
+
|
|
47
|
+
If there is nothing to receive then raise QueueEmpty.
|
|
48
|
+
"""
|
|
49
|
+
...
|
|
50
|
+
def get_count(qid: SupportsIndex) -> int:
|
|
51
|
+
"""
|
|
52
|
+
get_count(qid)
|
|
53
|
+
|
|
54
|
+
Return the number of items in the queue.
|
|
55
|
+
"""
|
|
56
|
+
...
|
|
57
|
+
def get_maxsize(qid: SupportsIndex) -> int:
|
|
58
|
+
"""
|
|
59
|
+
get_maxsize(qid)
|
|
60
|
+
|
|
61
|
+
Return the maximum number of items in the queue.
|
|
62
|
+
"""
|
|
63
|
+
...
|
|
64
|
+
def get_queue_defaults(qid: SupportsIndex) -> tuple[int]:
|
|
65
|
+
"""
|
|
66
|
+
get_queue_defaults(qid)
|
|
67
|
+
|
|
68
|
+
Return the queue's default values, set when it was created.
|
|
69
|
+
"""
|
|
70
|
+
...
|
|
71
|
+
def is_full(qid: SupportsIndex) -> bool:
|
|
72
|
+
"""
|
|
73
|
+
is_full(qid)
|
|
74
|
+
|
|
75
|
+
Return true if the queue has a maxsize and has reached it.
|
|
76
|
+
"""
|
|
77
|
+
...
|
|
78
|
+
def list_all() -> list[tuple[int, int]]:
|
|
79
|
+
"""
|
|
80
|
+
list_all() -> [(qid, fmt)]
|
|
81
|
+
|
|
82
|
+
Return the list of IDs for all queues.
|
|
83
|
+
Each corresponding default format is also included.
|
|
84
|
+
"""
|
|
85
|
+
...
|
|
86
|
+
def put(qid: SupportsIndex, obj: Any, fmt: SupportsIndex) -> None:
|
|
87
|
+
"""
|
|
88
|
+
put(qid, obj, fmt)
|
|
89
|
+
|
|
90
|
+
Add the object's data to the queue.
|
|
91
|
+
"""
|
|
92
|
+
...
|
|
93
|
+
def release(qid: SupportsIndex) -> None:
|
|
94
|
+
"""
|
|
95
|
+
release(qid)
|
|
96
|
+
|
|
97
|
+
Release a reference to the queue.
|
|
98
|
+
The queue is destroyed once there are no references left.
|
|
99
|
+
"""
|
|
100
|
+
...
|