basedpyright 1.15.2 → 1.16.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/_bisect.pyi +16 -8
- package/dist/typeshed-fallback/stdlib/_csv.pyi +13 -4
- package/dist/typeshed-fallback/stdlib/_curses.pyi +1 -1
- package/dist/typeshed-fallback/stdlib/_decimal.pyi +19 -1
- package/dist/typeshed-fallback/stdlib/_imp.pyi +1 -1
- package/dist/typeshed-fallback/stdlib/_locale.pyi +11 -28
- package/dist/typeshed-fallback/stdlib/_lsprof.pyi +2 -0
- package/dist/typeshed-fallback/stdlib/_operator.pyi +1 -1
- package/dist/typeshed-fallback/stdlib/_posixsubprocess.pyi +10 -8
- package/dist/typeshed-fallback/stdlib/_socket.pyi +3 -15
- package/dist/typeshed-fallback/stdlib/_thread.pyi +6 -2
- package/dist/typeshed-fallback/stdlib/_warnings.pyi +2 -2
- package/dist/typeshed-fallback/stdlib/_weakref.pyi +9 -10
- package/dist/typeshed-fallback/stdlib/array.pyi +1 -1
- package/dist/typeshed-fallback/stdlib/atexit.pyi +4 -1
- package/dist/typeshed-fallback/stdlib/builtins.pyi +214 -203
- package/dist/typeshed-fallback/stdlib/cmath.pyi +1 -1
- package/dist/typeshed-fallback/stdlib/collections/__init__.pyi +15 -12
- package/dist/typeshed-fallback/stdlib/datetime.pyi +3 -3
- package/dist/typeshed-fallback/stdlib/faulthandler.pyi +8 -12
- package/dist/typeshed-fallback/stdlib/functools.pyi +18 -13
- package/dist/typeshed-fallback/stdlib/gc.pyi +1 -0
- package/dist/typeshed-fallback/stdlib/importlib/metadata/__init__.pyi +6 -5
- package/dist/typeshed-fallback/stdlib/io.pyi +48 -42
- package/dist/typeshed-fallback/stdlib/ipaddress.pyi +2 -2
- package/dist/typeshed-fallback/stdlib/itertools.pyi +6 -4
- package/dist/typeshed-fallback/stdlib/math.pyi +17 -5
- package/dist/typeshed-fallback/stdlib/multiprocessing/shared_memory.pyi +1 -1
- package/dist/typeshed-fallback/stdlib/os/__init__.pyi +22 -14
- package/dist/typeshed-fallback/stdlib/readline.pyi +29 -83
- package/dist/typeshed-fallback/stdlib/signal.pyi +4 -4
- package/dist/typeshed-fallback/stdlib/sqlite3/dbapi2.pyi +65 -55
- package/dist/typeshed-fallback/stdlib/ssl.pyi +1 -1
- package/dist/typeshed-fallback/stdlib/struct.pyi +1 -8
- package/dist/typeshed-fallback/stdlib/sys/__init__.pyi +7 -5
- package/dist/typeshed-fallback/stdlib/termios.pyi +14 -23
- package/dist/typeshed-fallback/stdlib/time.pyi +2 -2
- package/dist/typeshed-fallback/stdlib/types.pyi +49 -25
- package/dist/typeshed-fallback/stdlib/typing.pyi +25 -225
- package/dist/typeshed-fallback/stdlib/unicodedata.pyi +2 -2
- package/dist/typeshed-fallback/stdlib/zlib.pyi +1 -1
- package/package.json +2 -2
|
@@ -33,6 +33,8 @@ if sys.version_info >= (3, 10):
|
|
|
33
33
|
|
|
34
34
|
Optional args lo (default 0) and hi (default len(a)) bound the
|
|
35
35
|
slice of a to be searched.
|
|
36
|
+
|
|
37
|
+
A custom key function can be supplied to customize the sort order.
|
|
36
38
|
"""
|
|
37
39
|
...
|
|
38
40
|
@overload
|
|
@@ -53,6 +55,8 @@ if sys.version_info >= (3, 10):
|
|
|
53
55
|
|
|
54
56
|
Optional args lo (default 0) and hi (default len(a)) bound the
|
|
55
57
|
slice of a to be searched.
|
|
58
|
+
|
|
59
|
+
A custom key function can be supplied to customize the sort order.
|
|
56
60
|
"""
|
|
57
61
|
...
|
|
58
62
|
@overload
|
|
@@ -73,6 +77,8 @@ if sys.version_info >= (3, 10):
|
|
|
73
77
|
|
|
74
78
|
Optional args lo (default 0) and hi (default len(a)) bound the
|
|
75
79
|
slice of a to be searched.
|
|
80
|
+
|
|
81
|
+
A custom key function can be supplied to customize the sort order.
|
|
76
82
|
"""
|
|
77
83
|
...
|
|
78
84
|
@overload
|
|
@@ -93,6 +99,8 @@ if sys.version_info >= (3, 10):
|
|
|
93
99
|
|
|
94
100
|
Optional args lo (default 0) and hi (default len(a)) bound the
|
|
95
101
|
slice of a to be searched.
|
|
102
|
+
|
|
103
|
+
A custom key function can be supplied to customize the sort order.
|
|
96
104
|
"""
|
|
97
105
|
...
|
|
98
106
|
@overload
|
|
@@ -111,6 +119,8 @@ if sys.version_info >= (3, 10):
|
|
|
111
119
|
|
|
112
120
|
Optional args lo (default 0) and hi (default len(a)) bound the
|
|
113
121
|
slice of a to be searched.
|
|
122
|
+
|
|
123
|
+
A custom key function can be supplied to customize the sort order.
|
|
114
124
|
"""
|
|
115
125
|
...
|
|
116
126
|
@overload
|
|
@@ -124,6 +134,8 @@ if sys.version_info >= (3, 10):
|
|
|
124
134
|
|
|
125
135
|
Optional args lo (default 0) and hi (default len(a)) bound the
|
|
126
136
|
slice of a to be searched.
|
|
137
|
+
|
|
138
|
+
A custom key function can be supplied to customize the sort order.
|
|
127
139
|
"""
|
|
128
140
|
...
|
|
129
141
|
@overload
|
|
@@ -142,6 +154,8 @@ if sys.version_info >= (3, 10):
|
|
|
142
154
|
|
|
143
155
|
Optional args lo (default 0) and hi (default len(a)) bound the
|
|
144
156
|
slice of a to be searched.
|
|
157
|
+
|
|
158
|
+
A custom key function can be supplied to customize the sort order.
|
|
145
159
|
"""
|
|
146
160
|
...
|
|
147
161
|
@overload
|
|
@@ -155,6 +169,8 @@ if sys.version_info >= (3, 10):
|
|
|
155
169
|
|
|
156
170
|
Optional args lo (default 0) and hi (default len(a)) bound the
|
|
157
171
|
slice of a to be searched.
|
|
172
|
+
|
|
173
|
+
A custom key function can be supplied to customize the sort order.
|
|
158
174
|
"""
|
|
159
175
|
...
|
|
160
176
|
|
|
@@ -163,8 +179,6 @@ else:
|
|
|
163
179
|
a: SupportsLenAndGetItem[SupportsRichComparisonT], x: SupportsRichComparisonT, lo: int = 0, hi: int | None = None
|
|
164
180
|
) -> int:
|
|
165
181
|
"""
|
|
166
|
-
bisect_left(a, x[, lo[, hi]]) -> index
|
|
167
|
-
|
|
168
182
|
Return the index where to insert item x in list a, assuming a is sorted.
|
|
169
183
|
|
|
170
184
|
The return value i is such that all e in a[:i] have e < x, and all e in
|
|
@@ -179,8 +193,6 @@ else:
|
|
|
179
193
|
a: SupportsLenAndGetItem[SupportsRichComparisonT], x: SupportsRichComparisonT, lo: int = 0, hi: int | None = None
|
|
180
194
|
) -> int:
|
|
181
195
|
"""
|
|
182
|
-
bisect_right(a, x[, lo[, hi]]) -> index
|
|
183
|
-
|
|
184
196
|
Return the index where to insert item x in list a, assuming a is sorted.
|
|
185
197
|
|
|
186
198
|
The return value i is such that all e in a[:i] have e <= x, and all e in
|
|
@@ -195,8 +207,6 @@ else:
|
|
|
195
207
|
a: MutableSequence[SupportsRichComparisonT], x: SupportsRichComparisonT, lo: int = 0, hi: int | None = None
|
|
196
208
|
) -> None:
|
|
197
209
|
"""
|
|
198
|
-
insort_left(a, x[, lo[, hi]])
|
|
199
|
-
|
|
200
210
|
Insert item x in list a, and keep it sorted assuming a is sorted.
|
|
201
211
|
|
|
202
212
|
If x is already in a, insert it to the left of the leftmost x.
|
|
@@ -209,8 +219,6 @@ else:
|
|
|
209
219
|
a: MutableSequence[SupportsRichComparisonT], x: SupportsRichComparisonT, lo: int = 0, hi: int | None = None
|
|
210
220
|
) -> None:
|
|
211
221
|
"""
|
|
212
|
-
insort_right(a, x[, lo[, hi]])
|
|
213
|
-
|
|
214
222
|
Insert item x in list a, and keep it sorted assuming a is sorted.
|
|
215
223
|
|
|
216
224
|
If x is already in a, insert it to the right of the rightmost x.
|
|
@@ -33,9 +33,9 @@ SETTINGS:
|
|
|
33
33
|
quoting character. It defaults to '"'.
|
|
34
34
|
* delimiter - specifies a one-character string to use as the
|
|
35
35
|
field separator. It defaults to ','.
|
|
36
|
-
* skipinitialspace - specifies how to interpret
|
|
37
|
-
immediately
|
|
38
|
-
means that
|
|
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
39
|
of the following field.
|
|
40
40
|
* lineterminator - specifies the character sequence which should
|
|
41
41
|
terminate rows.
|
|
@@ -48,6 +48,11 @@ SETTINGS:
|
|
|
48
48
|
csv.QUOTE_NONNUMERIC means that quotes are always placed around
|
|
49
49
|
fields which do not parse as integers or floating point
|
|
50
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.
|
|
51
56
|
csv.QUOTE_NONE means that quotes are never placed around fields.
|
|
52
57
|
* escapechar - specifies a one-character string used to escape
|
|
53
58
|
the delimiter when quoting is set to QUOTE_NONE.
|
|
@@ -187,24 +192,28 @@ def register_dialect(
|
|
|
187
192
|
def unregister_dialect(name: str) -> None:
|
|
188
193
|
"""
|
|
189
194
|
Delete the name/dialect mapping associated with a string name.
|
|
195
|
+
|
|
190
196
|
csv.unregister_dialect(name)
|
|
191
197
|
"""
|
|
192
198
|
...
|
|
193
199
|
def get_dialect(name: str) -> Dialect:
|
|
194
200
|
"""
|
|
195
201
|
Return the dialect instance associated with name.
|
|
202
|
+
|
|
196
203
|
dialect = csv.get_dialect(name)
|
|
197
204
|
"""
|
|
198
205
|
...
|
|
199
206
|
def list_dialects() -> list[str]:
|
|
200
207
|
"""
|
|
201
|
-
Return a list of all
|
|
208
|
+
Return a list of all known dialect names.
|
|
209
|
+
|
|
202
210
|
names = csv.list_dialects()
|
|
203
211
|
"""
|
|
204
212
|
...
|
|
205
213
|
def field_size_limit(new_limit: int = ...) -> int:
|
|
206
214
|
"""
|
|
207
215
|
Sets an upper limit on parsed fields.
|
|
216
|
+
|
|
208
217
|
csv.field_size_limit([limit])
|
|
209
218
|
|
|
210
219
|
Returns old limit. If limit is not given, no new limit is set and
|
|
@@ -666,7 +666,7 @@ def pair_content(pair_number: int, /) -> tuple[int, int]:
|
|
|
666
666
|
Return a tuple (fg, bg) containing the colors for the requested color pair.
|
|
667
667
|
|
|
668
668
|
pair_number
|
|
669
|
-
The number of the color pair (
|
|
669
|
+
The number of the color pair (0 - (COLOR_PAIRS-1)).
|
|
670
670
|
"""
|
|
671
671
|
...
|
|
672
672
|
def pair_number(attr: int, /) -> int:
|
|
@@ -15,6 +15,7 @@ __version__: Final[str]
|
|
|
15
15
|
__libmpdec_version__: Final[str]
|
|
16
16
|
|
|
17
17
|
class DecimalTuple(NamedTuple):
|
|
18
|
+
"""DecimalTuple(sign, digits, exponent)"""
|
|
18
19
|
sign: int
|
|
19
20
|
digits: tuple[int, ...]
|
|
20
21
|
exponent: int | Literal["n", "N", "F"]
|
|
@@ -88,6 +89,12 @@ else:
|
|
|
88
89
|
...
|
|
89
90
|
|
|
90
91
|
class Decimal:
|
|
92
|
+
"""
|
|
93
|
+
Construct a new Decimal object. 'value' can be an integer, string, tuple,
|
|
94
|
+
or another Decimal object. If no value is given, return Decimal('0'). The
|
|
95
|
+
context does not affect the conversion and is only passed to determine if
|
|
96
|
+
the InvalidOperation trap is active.
|
|
97
|
+
"""
|
|
91
98
|
def __new__(cls, value: _DecimalNew = ..., context: Context | None = ...) -> Self: ...
|
|
92
99
|
@classmethod
|
|
93
100
|
def from_float(cls, f: float, /) -> Self:
|
|
@@ -107,7 +114,7 @@ class Decimal:
|
|
|
107
114
|
"""
|
|
108
115
|
...
|
|
109
116
|
def __bool__(self) -> bool:
|
|
110
|
-
"""self
|
|
117
|
+
"""True if self else False"""
|
|
111
118
|
...
|
|
112
119
|
def compare(self, other: _Decimal, context: Context | None = None) -> Decimal:
|
|
113
120
|
"""
|
|
@@ -607,6 +614,17 @@ class _ContextManager:
|
|
|
607
614
|
_TrapType: TypeAlias = type[DecimalException]
|
|
608
615
|
|
|
609
616
|
class Context:
|
|
617
|
+
"""
|
|
618
|
+
The context affects almost all operations and controls rounding,
|
|
619
|
+
Over/Underflow, raising of exceptions and much more. A new context
|
|
620
|
+
can be constructed as follows:
|
|
621
|
+
|
|
622
|
+
>>> c = Context(prec=28, Emin=-425000000, Emax=425000000,
|
|
623
|
+
... rounding=ROUND_HALF_EVEN, capitals=1, clamp=1,
|
|
624
|
+
... traps=[InvalidOperation, DivisionByZero, Overflow],
|
|
625
|
+
... flags=[])
|
|
626
|
+
>>>
|
|
627
|
+
"""
|
|
610
628
|
# TODO: Context doesn't allow you to delete *any* attributes from instances of the class at runtime,
|
|
611
629
|
# even settable attributes like `prec` and `rounding`,
|
|
612
630
|
# but that's inexpressable in the stub.
|
|
@@ -13,10 +13,10 @@ LC_ALL: int
|
|
|
13
13
|
CHAR_MAX: int
|
|
14
14
|
|
|
15
15
|
def setlocale(category: int, locale: str | None = None, /) -> str:
|
|
16
|
-
"""
|
|
16
|
+
"""Activates/queries locale processing."""
|
|
17
17
|
...
|
|
18
18
|
def localeconv() -> Mapping[str, int | str | list[int]]:
|
|
19
|
-
"""
|
|
19
|
+
"""Returns numeric and monetary locale-specific parameters."""
|
|
20
20
|
...
|
|
21
21
|
|
|
22
22
|
if sys.version_info >= (3, 11):
|
|
@@ -25,14 +25,10 @@ if sys.version_info >= (3, 11):
|
|
|
25
25
|
...
|
|
26
26
|
|
|
27
27
|
def strcoll(os1: str, os2: str, /) -> int:
|
|
28
|
-
"""
|
|
28
|
+
"""Compares two strings according to the locale."""
|
|
29
29
|
...
|
|
30
30
|
def strxfrm(string: str, /) -> str:
|
|
31
|
-
"""
|
|
32
|
-
strxfrm(string) -> string.
|
|
33
|
-
|
|
34
|
-
Return a string that can be used as a key for locale-aware comparisons.
|
|
35
|
-
"""
|
|
31
|
+
"""Return a string that can be used as a key for locale-aware comparisons."""
|
|
36
32
|
...
|
|
37
33
|
|
|
38
34
|
# native gettext functions
|
|
@@ -104,10 +100,7 @@ if sys.platform != "win32":
|
|
|
104
100
|
ALT_DIGITS: int
|
|
105
101
|
|
|
106
102
|
def nl_langinfo(key: int, /) -> str:
|
|
107
|
-
"""
|
|
108
|
-
nl_langinfo(key) -> string
|
|
109
|
-
Return the value for the locale information associated with key.
|
|
110
|
-
"""
|
|
103
|
+
"""Return the value for the locale information associated with key."""
|
|
111
104
|
...
|
|
112
105
|
|
|
113
106
|
# This is dependent on `libintl.h` which is a part of `gettext`
|
|
@@ -116,36 +109,26 @@ if sys.platform != "win32":
|
|
|
116
109
|
def gettext(msg: str, /) -> str:
|
|
117
110
|
"""
|
|
118
111
|
gettext(msg) -> string
|
|
112
|
+
|
|
119
113
|
Return translation of msg.
|
|
120
114
|
"""
|
|
121
115
|
...
|
|
122
116
|
def dgettext(domain: str | None, msg: str, /) -> str:
|
|
123
117
|
"""
|
|
124
118
|
dgettext(domain, msg) -> string
|
|
119
|
+
|
|
125
120
|
Return translation of msg in domain.
|
|
126
121
|
"""
|
|
127
122
|
...
|
|
128
123
|
def dcgettext(domain: str | None, msg: str, category: int, /) -> str:
|
|
129
|
-
"""
|
|
130
|
-
dcgettext(domain, msg, category) -> string
|
|
131
|
-
Return translation of msg in domain and category.
|
|
132
|
-
"""
|
|
124
|
+
"""Return translation of msg in domain and category."""
|
|
133
125
|
...
|
|
134
126
|
def textdomain(domain: str | None, /) -> str:
|
|
135
|
-
"""
|
|
136
|
-
textdomain(domain) -> string
|
|
137
|
-
Set the C library's textdmain to domain, returning the new domain.
|
|
138
|
-
"""
|
|
127
|
+
"""Set the C library's textdmain to domain, returning the new domain."""
|
|
139
128
|
...
|
|
140
129
|
def bindtextdomain(domain: str, dir: StrPath | None, /) -> str:
|
|
141
|
-
"""
|
|
142
|
-
bindtextdomain(domain, dir) -> string
|
|
143
|
-
Bind the C library's domain to dir.
|
|
144
|
-
"""
|
|
130
|
+
"""Bind the C library's domain to dir."""
|
|
145
131
|
...
|
|
146
132
|
def bind_textdomain_codeset(domain: str, codeset: str | None, /) -> str | None:
|
|
147
|
-
"""
|
|
148
|
-
bind_textdomain_codeset(domain, codeset) -> string
|
|
149
|
-
Bind the C library's domain to codeset.
|
|
150
|
-
"""
|
|
133
|
+
"""Bind the C library's domain to codeset."""
|
|
151
134
|
...
|
|
@@ -146,7 +146,7 @@ def contains(a: Container[object], b: object, /) -> bool:
|
|
|
146
146
|
"""Same as b in a (note reversed operands)."""
|
|
147
147
|
...
|
|
148
148
|
def countOf(a: Iterable[object], b: object, /) -> int:
|
|
149
|
-
"""Return the number of
|
|
149
|
+
"""Return the number of items in a which are, or which equal, b."""
|
|
150
150
|
...
|
|
151
151
|
@overload
|
|
152
152
|
def delitem(a: MutableSequence[Any], b: SupportsIndex, /) -> None:
|
|
@@ -34,16 +34,18 @@ if sys.platform != "win32":
|
|
|
34
34
|
/,
|
|
35
35
|
) -> int:
|
|
36
36
|
"""
|
|
37
|
-
|
|
38
|
-
p2cread, p2cwrite, c2pread, c2pwrite,
|
|
39
|
-
errread, errwrite, errpipe_read, errpipe_write,
|
|
40
|
-
restore_signals, call_setsid, preexec_fn)
|
|
37
|
+
Spawn a fresh new child process.
|
|
41
38
|
|
|
42
|
-
|
|
43
|
-
child and
|
|
44
|
-
process.
|
|
39
|
+
Fork a child process, close parent file descriptors as appropriate in the
|
|
40
|
+
child and duplicate the few that are needed before calling exec() in the
|
|
41
|
+
child process.
|
|
42
|
+
|
|
43
|
+
If close_fds is True, close file descriptors 3 and higher, except those listed
|
|
44
|
+
in the sorted tuple pass_fds.
|
|
45
|
+
|
|
46
|
+
The preexec_fn, if supplied, will be called immediately before closing file
|
|
47
|
+
descriptors and exec.
|
|
45
48
|
|
|
46
|
-
The preexec_fn, if supplied, will be called immediately before exec.
|
|
47
49
|
WARNING: preexec_fn is NOT SAFE if your application uses threads.
|
|
48
50
|
It may trigger infrequent, difficult to debug deadlocks.
|
|
49
51
|
|
|
@@ -725,14 +725,11 @@ class socket:
|
|
|
725
725
|
sendall(data[, flags]) -- send all data
|
|
726
726
|
send(data[, flags]) -- send data, may not send all of it
|
|
727
727
|
sendto(data[, flags], addr) -- send data to a given address
|
|
728
|
-
setblocking(
|
|
728
|
+
setblocking(bool) -- set or clear the blocking I/O flag
|
|
729
729
|
getblocking() -- return True if socket is blocking, False if non-blocking
|
|
730
730
|
setsockopt(level, optname, value[, optlen]) -- set socket options
|
|
731
731
|
settimeout(None | float) -- set or clear the timeout
|
|
732
732
|
shutdown(how) -- shut down traffic in one or both directions
|
|
733
|
-
if_nameindex() -- return all network interface indices and names
|
|
734
|
-
if_nametoindex(name) -- return the corresponding interface index
|
|
735
|
-
if_indextoname(index) -- return the corresponding interface name
|
|
736
733
|
|
|
737
734
|
[*] not available on all platforms!
|
|
738
735
|
"""
|
|
@@ -821,7 +818,8 @@ class socket:
|
|
|
821
818
|
|
|
822
819
|
Return the address of the local endpoint. The format depends on the
|
|
823
820
|
address family. For IPv4 sockets, the address info is a pair
|
|
824
|
-
(hostaddr, port).
|
|
821
|
+
(hostaddr, port). For IPv6 sockets, the address info is a 4-tuple
|
|
822
|
+
(hostaddr, port, flowinfo, scope_id).
|
|
825
823
|
"""
|
|
826
824
|
...
|
|
827
825
|
@overload
|
|
@@ -1214,11 +1212,6 @@ def ntohs(x: int, /) -> int:
|
|
|
1214
1212
|
ntohs(integer) -> integer
|
|
1215
1213
|
|
|
1216
1214
|
Convert a 16-bit unsigned integer from network to host byte order.
|
|
1217
|
-
Note that in case the received integer does not fit in 16-bit unsigned
|
|
1218
|
-
integer, but does fit in a positive C int, it is silently truncated to
|
|
1219
|
-
16-bit unsigned integer.
|
|
1220
|
-
However, this silent truncation feature is deprecated, and will raise an
|
|
1221
|
-
exception in future versions of Python.
|
|
1222
1215
|
"""
|
|
1223
1216
|
...
|
|
1224
1217
|
def htonl(x: int, /) -> int:
|
|
@@ -1233,11 +1226,6 @@ def htons(x: int, /) -> int:
|
|
|
1233
1226
|
htons(integer) -> integer
|
|
1234
1227
|
|
|
1235
1228
|
Convert a 16-bit unsigned integer from host to network byte order.
|
|
1236
|
-
Note that in case the received integer does not fit in 16-bit unsigned
|
|
1237
|
-
integer, but does fit in a positive C int, it is silently truncated to
|
|
1238
|
-
16-bit unsigned integer.
|
|
1239
|
-
However, this silent truncation feature is deprecated, and will raise an
|
|
1240
|
-
exception in future versions of Python.
|
|
1241
1229
|
"""
|
|
1242
1230
|
...
|
|
1243
1231
|
def inet_aton(ip_addr: str, /) -> bytes:
|
|
@@ -129,10 +129,14 @@ def start_new_thread(function: Callable[..., object], args: tuple[Any, ...], kwa
|
|
|
129
129
|
...
|
|
130
130
|
def interrupt_main() -> None:
|
|
131
131
|
"""
|
|
132
|
-
interrupt_main()
|
|
132
|
+
interrupt_main(signum=signal.SIGINT, /)
|
|
133
133
|
|
|
134
|
-
|
|
134
|
+
Simulate the arrival of the given signal in the main thread,
|
|
135
|
+
where the corresponding signal handler will be executed.
|
|
136
|
+
If *signum* is omitted, SIGINT is assumed.
|
|
135
137
|
A subthread can use this function to interrupt the main thread.
|
|
138
|
+
|
|
139
|
+
Note: the default signal handler for SIGINT raises ``KeyboardInterrupt``.
|
|
136
140
|
"""
|
|
137
141
|
...
|
|
138
142
|
def exit() -> NoReturn:
|
|
@@ -85,7 +85,7 @@ def warn_explicit(
|
|
|
85
85
|
module_globals: dict[str, Any] | None = ...,
|
|
86
86
|
source: Any | None = ...,
|
|
87
87
|
) -> None:
|
|
88
|
-
"""
|
|
88
|
+
"""Issue a warning, or maybe ignore it or raise an exception."""
|
|
89
89
|
...
|
|
90
90
|
@overload
|
|
91
91
|
def warn_explicit(
|
|
@@ -98,5 +98,5 @@ def warn_explicit(
|
|
|
98
98
|
module_globals: dict[str, Any] | None = ...,
|
|
99
99
|
source: Any | None = ...,
|
|
100
100
|
) -> None:
|
|
101
|
-
"""
|
|
101
|
+
"""Issue a warning, or maybe ignore it or raise an exception."""
|
|
102
102
|
...
|
|
@@ -50,26 +50,25 @@ def getweakrefcount(object: Any, /) -> int:
|
|
|
50
50
|
"""Return the number of weak references to 'object'."""
|
|
51
51
|
...
|
|
52
52
|
def getweakrefs(object: Any, /) -> list[Any]:
|
|
53
|
-
"""
|
|
54
|
-
getweakrefs(object) -- return a list of all weak reference objects
|
|
55
|
-
that point to 'object'.
|
|
56
|
-
"""
|
|
53
|
+
"""Return a list of all weak reference objects pointing to 'object'."""
|
|
57
54
|
...
|
|
58
55
|
|
|
59
56
|
# Return CallableProxyType if object is callable, ProxyType otherwise
|
|
60
57
|
@overload
|
|
61
58
|
def proxy(object: _C, callback: Callable[[_C], Any] | None = None, /) -> CallableProxyType[_C]:
|
|
62
59
|
"""
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
60
|
+
Create a proxy object that weakly references 'object'.
|
|
61
|
+
|
|
62
|
+
'callback', if given, is called with a reference to the
|
|
63
|
+
proxy when 'object' is about to be finalized.
|
|
66
64
|
"""
|
|
67
65
|
...
|
|
68
66
|
@overload
|
|
69
67
|
def proxy(object: _T, callback: Callable[[_T], Any] | None = None, /) -> Any:
|
|
70
68
|
"""
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
69
|
+
Create a proxy object that weakly references 'object'.
|
|
70
|
+
|
|
71
|
+
'callback', if given, is called with a reference to the
|
|
72
|
+
proxy when 'object' is about to be finalized.
|
|
74
73
|
"""
|
|
75
74
|
...
|
|
@@ -132,7 +132,7 @@ class array(MutableSequence[_T]):
|
|
|
132
132
|
"""Append items to the end of the array."""
|
|
133
133
|
...
|
|
134
134
|
def frombytes(self, buffer: ReadableBuffer, /) -> None:
|
|
135
|
-
"""Appends items from the string, interpreting it as an array of machine values, as if it had been read from a file using the fromfile() method
|
|
135
|
+
"""Appends items from the string, interpreting it as an array of machine values, as if it had been read from a file using the fromfile() method."""
|
|
136
136
|
...
|
|
137
137
|
def fromfile(self, f: SupportsRead[bytes], n: int, /) -> None:
|
|
138
138
|
"""Read n objects from the file object f and append them to the end of the array."""
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"""
|
|
2
|
-
allow programmer to define multiple exit functions to be
|
|
2
|
+
allow programmer to define multiple exit functions to be executed
|
|
3
|
+
upon normal program termination.
|
|
3
4
|
|
|
4
5
|
Two public functions, register and unregister, are defined.
|
|
5
6
|
"""
|
|
@@ -30,6 +31,8 @@ def _run_exitfuncs() -> None:
|
|
|
30
31
|
_run_exitfuncs() -> None
|
|
31
32
|
|
|
32
33
|
Run all registered exit functions.
|
|
34
|
+
|
|
35
|
+
If a callback raises an exception, it is logged with sys.unraisablehook.
|
|
33
36
|
"""
|
|
34
37
|
...
|
|
35
38
|
def register(func: Callable[_P, _T], /, *args: _P.args, **kwargs: _P.kwargs) -> Callable[_P, _T]:
|