basedpyright 1.12.6 → 1.13.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/_ast.pyi +279 -42
- package/dist/typeshed-fallback/stdlib/_bisect.pyi +149 -12
- package/dist/typeshed-fallback/stdlib/_codecs.pyi +125 -14
- package/dist/typeshed-fallback/stdlib/_csv.pyi +130 -7
- package/dist/typeshed-fallback/stdlib/_ctypes.pyi +72 -17
- package/dist/typeshed-fallback/stdlib/_curses.pyi +626 -78
- package/dist/typeshed-fallback/stdlib/_decimal.pyi +775 -153
- package/dist/typeshed-fallback/stdlib/_heapq.pyi +61 -5
- package/dist/typeshed-fallback/stdlib/_imp.pyi +70 -15
- package/dist/typeshed-fallback/stdlib/_json.pyi +55 -12
- package/dist/typeshed-fallback/stdlib/_locale.pyi +63 -12
- package/dist/typeshed-fallback/stdlib/_lsprof.pyi +61 -4
- package/dist/typeshed-fallback/stdlib/_operator.pyi +238 -62
- package/dist/typeshed-fallback/stdlib/_posixsubprocess.pyi +25 -1
- package/dist/typeshed-fallback/stdlib/_random.pyi +23 -5
- package/dist/typeshed-fallback/stdlib/_socket.pyi +618 -63
- package/dist/typeshed-fallback/stdlib/_stat.pyi +140 -13
- package/dist/typeshed-fallback/stdlib/_thread.pyi +215 -22
- package/dist/typeshed-fallback/stdlib/_tkinter.pyi +44 -11
- package/dist/typeshed-fallback/stdlib/_tracemalloc.pyi +71 -10
- package/dist/typeshed-fallback/stdlib/_warnings.pyi +53 -6
- package/dist/typeshed-fallback/stdlib/_weakref.pyi +43 -10
- package/dist/typeshed-fallback/stdlib/_winapi.pyi +255 -255
- package/dist/typeshed-fallback/stdlib/array.pyi +233 -44
- package/dist/typeshed-fallback/stdlib/atexit.pyi +50 -5
- package/dist/typeshed-fallback/stdlib/audioop.pyi +78 -26
- package/dist/typeshed-fallback/stdlib/binascii.pyi +105 -18
- package/dist/typeshed-fallback/stdlib/builtins.pyi +5254 -829
- package/dist/typeshed-fallback/stdlib/cmath.pyi +99 -23
- package/dist/typeshed-fallback/stdlib/errno.pyi +15 -0
- package/dist/typeshed-fallback/stdlib/faulthandler.pyi +33 -8
- package/dist/typeshed-fallback/stdlib/fcntl.pyi +199 -8
- package/dist/typeshed-fallback/stdlib/gc.pyi +130 -18
- package/dist/typeshed-fallback/stdlib/grp.pyi +58 -7
- package/dist/typeshed-fallback/stdlib/itertools.pyi +281 -42
- package/dist/typeshed-fallback/stdlib/marshal.pyi +82 -4
- package/dist/typeshed-fallback/stdlib/math.pyi +357 -61
- package/dist/typeshed-fallback/stdlib/mmap.pyi +47 -8
- package/dist/typeshed-fallback/stdlib/msvcrt.pyi +32 -32
- package/dist/typeshed-fallback/stdlib/nt.pyi +118 -111
- package/dist/typeshed-fallback/stdlib/parser.pyi +55 -24
- package/dist/typeshed-fallback/stdlib/posix.pyi +7 -0
- package/dist/typeshed-fallback/stdlib/pwd.pyi +60 -10
- package/dist/typeshed-fallback/stdlib/pyexpat/__init__.pyi +61 -12
- package/dist/typeshed-fallback/stdlib/readline.pyi +184 -27
- package/dist/typeshed-fallback/stdlib/resource.pyi +56 -16
- package/dist/typeshed-fallback/stdlib/select.pyi +97 -5
- package/dist/typeshed-fallback/stdlib/spwd.pyi +60 -11
- package/dist/typeshed-fallback/stdlib/sys/__init__.pyi +386 -48
- package/dist/typeshed-fallback/stdlib/syslog.pyi +27 -7
- package/dist/typeshed-fallback/stdlib/termios.pyi +88 -8
- package/dist/typeshed-fallback/stdlib/time.pyi +314 -37
- package/dist/typeshed-fallback/stdlib/unicodedata.pyi +264 -34
- package/dist/typeshed-fallback/stdlib/winreg.pyi +172 -132
- package/dist/typeshed-fallback/stdlib/zlib.pyi +108 -7
- package/package.json +1 -1
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
"""
|
|
2
|
+
This module provides access to mathematical functions for complex
|
|
3
|
+
numbers.
|
|
4
|
+
"""
|
|
5
|
+
|
|
1
6
|
from typing import SupportsComplex, SupportsFloat, SupportsIndex
|
|
2
7
|
from typing_extensions import TypeAlias
|
|
3
8
|
|
|
@@ -11,26 +16,97 @@ tau: float
|
|
|
11
16
|
|
|
12
17
|
_C: TypeAlias = SupportsFloat | SupportsComplex | SupportsIndex | complex
|
|
13
18
|
|
|
14
|
-
def acos(z: _C, /) -> complex:
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
def
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
def
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
def
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
def
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
def
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
def
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
def
|
|
36
|
-
|
|
19
|
+
def acos(z: _C, /) -> complex:
|
|
20
|
+
"""Return the arc cosine of z."""
|
|
21
|
+
...
|
|
22
|
+
def acosh(z: _C, /) -> complex:
|
|
23
|
+
"""Return the inverse hyperbolic cosine of z."""
|
|
24
|
+
...
|
|
25
|
+
def asin(z: _C, /) -> complex:
|
|
26
|
+
"""Return the arc sine of z."""
|
|
27
|
+
...
|
|
28
|
+
def asinh(z: _C, /) -> complex:
|
|
29
|
+
"""Return the inverse hyperbolic sine of z."""
|
|
30
|
+
...
|
|
31
|
+
def atan(z: _C, /) -> complex:
|
|
32
|
+
"""Return the arc tangent of z."""
|
|
33
|
+
...
|
|
34
|
+
def atanh(z: _C, /) -> complex:
|
|
35
|
+
"""Return the inverse hyperbolic tangent of z."""
|
|
36
|
+
...
|
|
37
|
+
def cos(z: _C, /) -> complex:
|
|
38
|
+
"""Return the cosine of z."""
|
|
39
|
+
...
|
|
40
|
+
def cosh(z: _C, /) -> complex:
|
|
41
|
+
"""Return the hyperbolic cosine of z."""
|
|
42
|
+
...
|
|
43
|
+
def exp(z: _C, /) -> complex:
|
|
44
|
+
"""Return the exponential value e**z."""
|
|
45
|
+
...
|
|
46
|
+
def isclose(a: _C, b: _C, *, rel_tol: SupportsFloat = 1e-09, abs_tol: SupportsFloat = 0.0) -> bool:
|
|
47
|
+
"""
|
|
48
|
+
Determine whether two complex numbers are close in value.
|
|
49
|
+
|
|
50
|
+
rel_tol
|
|
51
|
+
maximum difference for being considered "close", relative to the
|
|
52
|
+
magnitude of the input values
|
|
53
|
+
abs_tol
|
|
54
|
+
maximum difference for being considered "close", regardless of the
|
|
55
|
+
magnitude of the input values
|
|
56
|
+
|
|
57
|
+
Return True if a is close in value to b, and False otherwise.
|
|
58
|
+
|
|
59
|
+
For the values to be considered close, the difference between them must be
|
|
60
|
+
smaller than at least one of the tolerances.
|
|
61
|
+
|
|
62
|
+
-inf, inf and NaN behave similarly to the IEEE 754 Standard. That is, NaN is
|
|
63
|
+
not close to anything, even itself. inf and -inf are only close to themselves.
|
|
64
|
+
"""
|
|
65
|
+
...
|
|
66
|
+
def isinf(z: _C, /) -> bool:
|
|
67
|
+
"""Checks if the real or imaginary part of z is infinite."""
|
|
68
|
+
...
|
|
69
|
+
def isnan(z: _C, /) -> bool:
|
|
70
|
+
"""Checks if the real or imaginary part of z not a number (NaN)."""
|
|
71
|
+
...
|
|
72
|
+
def log(x: _C, base: _C = ..., /) -> complex:
|
|
73
|
+
"""
|
|
74
|
+
log(z[, base]) -> the logarithm of z to the given base.
|
|
75
|
+
|
|
76
|
+
If the base not specified, returns the natural logarithm (base e) of z.
|
|
77
|
+
"""
|
|
78
|
+
...
|
|
79
|
+
def log10(z: _C, /) -> complex:
|
|
80
|
+
"""Return the base-10 logarithm of z."""
|
|
81
|
+
...
|
|
82
|
+
def phase(z: _C, /) -> float:
|
|
83
|
+
"""Return argument, also known as the phase angle, of a complex."""
|
|
84
|
+
...
|
|
85
|
+
def polar(z: _C, /) -> tuple[float, float]:
|
|
86
|
+
"""
|
|
87
|
+
Convert a complex from rectangular coordinates to polar coordinates.
|
|
88
|
+
|
|
89
|
+
r is the distance from 0 and phi the phase angle.
|
|
90
|
+
"""
|
|
91
|
+
...
|
|
92
|
+
def rect(r: float, phi: float, /) -> complex:
|
|
93
|
+
"""Convert from polar coordinates to rectangular coordinates."""
|
|
94
|
+
...
|
|
95
|
+
def sin(z: _C, /) -> complex:
|
|
96
|
+
"""Return the sine of z."""
|
|
97
|
+
...
|
|
98
|
+
def sinh(z: _C, /) -> complex:
|
|
99
|
+
"""Return the hyperbolic sine of z."""
|
|
100
|
+
...
|
|
101
|
+
def sqrt(z: _C, /) -> complex:
|
|
102
|
+
"""Return the square root of z."""
|
|
103
|
+
...
|
|
104
|
+
def tan(z: _C, /) -> complex:
|
|
105
|
+
"""Return the tangent of z."""
|
|
106
|
+
...
|
|
107
|
+
def tanh(z: _C, /) -> complex:
|
|
108
|
+
"""Return the hyperbolic tangent of z."""
|
|
109
|
+
...
|
|
110
|
+
def isfinite(z: _C, /) -> bool:
|
|
111
|
+
"""Return True if both the real and imaginary parts of z are finite, else False."""
|
|
112
|
+
...
|
|
@@ -1,3 +1,18 @@
|
|
|
1
|
+
"""
|
|
2
|
+
This module makes available standard errno system symbols.
|
|
3
|
+
|
|
4
|
+
The value of each symbol is the corresponding integer value,
|
|
5
|
+
e.g., on most systems, errno.ENOENT equals the integer 2.
|
|
6
|
+
|
|
7
|
+
The dictionary errno.errorcode maps numeric codes to symbol names,
|
|
8
|
+
e.g., errno.errorcode[2] could be the string 'ENOENT'.
|
|
9
|
+
|
|
10
|
+
Symbols that are not relevant to the underlying system are not defined.
|
|
11
|
+
|
|
12
|
+
To map error codes to error messages, use the function os.strerror(),
|
|
13
|
+
e.g. os.strerror(2) could return 'No such file or directory'.
|
|
14
|
+
"""
|
|
15
|
+
|
|
1
16
|
import sys
|
|
2
17
|
from collections.abc import Mapping
|
|
3
18
|
|
|
@@ -1,13 +1,38 @@
|
|
|
1
|
+
"""faulthandler module."""
|
|
2
|
+
|
|
1
3
|
import sys
|
|
2
4
|
from _typeshed import FileDescriptorLike
|
|
3
5
|
|
|
4
|
-
def cancel_dump_traceback_later() -> None:
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
def cancel_dump_traceback_later() -> None:
|
|
7
|
+
"""
|
|
8
|
+
cancel_dump_traceback_later():
|
|
9
|
+
cancel the previous call to dump_traceback_later().
|
|
10
|
+
"""
|
|
11
|
+
...
|
|
12
|
+
def disable() -> None:
|
|
13
|
+
"""disable(): disable the fault handler"""
|
|
14
|
+
...
|
|
15
|
+
def dump_traceback(file: FileDescriptorLike = ..., all_threads: bool = ...) -> None:
|
|
16
|
+
"""dump_traceback(file=sys.stderr, all_threads=True): dump the traceback of the current thread, or of all threads if all_threads is True, into file"""
|
|
17
|
+
...
|
|
18
|
+
def dump_traceback_later(timeout: float, repeat: bool = ..., file: FileDescriptorLike = ..., exit: bool = ...) -> None:
|
|
19
|
+
"""
|
|
20
|
+
dump_traceback_later(timeout, repeat=False, file=sys.stderrn, exit=False):
|
|
21
|
+
dump the traceback of all threads in timeout seconds,
|
|
22
|
+
or each timeout seconds if repeat is True. If exit is True, call _exit(1) which is not safe.
|
|
23
|
+
"""
|
|
24
|
+
...
|
|
25
|
+
def enable(file: FileDescriptorLike = ..., all_threads: bool = ...) -> None:
|
|
26
|
+
"""enable(file=sys.stderr, all_threads=True): enable the fault handler"""
|
|
27
|
+
...
|
|
28
|
+
def is_enabled() -> bool:
|
|
29
|
+
"""is_enabled()->bool: check if the handler is enabled"""
|
|
30
|
+
...
|
|
10
31
|
|
|
11
32
|
if sys.platform != "win32":
|
|
12
|
-
def register(signum: int, file: FileDescriptorLike = ..., all_threads: bool = ..., chain: bool = ...) -> None:
|
|
13
|
-
|
|
33
|
+
def register(signum: int, file: FileDescriptorLike = ..., all_threads: bool = ..., chain: bool = ...) -> None:
|
|
34
|
+
"""register(signum, file=sys.stderr, all_threads=True, chain=False): register a handler for the signal 'signum': dump the traceback of the current thread, or of all threads if all_threads is True, into file"""
|
|
35
|
+
...
|
|
36
|
+
def unregister(signum: int, /) -> None:
|
|
37
|
+
"""unregister(signum): unregister the handler of the signal 'signum' registered by register()"""
|
|
38
|
+
...
|
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
"""
|
|
2
|
+
This module performs file control and I/O control on file
|
|
3
|
+
descriptors. It is an interface to the fcntl() and ioctl() Unix
|
|
4
|
+
routines. File descriptors can be obtained with the fileno() method of
|
|
5
|
+
a file or socket object.
|
|
6
|
+
"""
|
|
7
|
+
|
|
1
8
|
import sys
|
|
2
9
|
from _typeshed import FileDescriptorLike, ReadOnlyBuffer, WriteableBuffer
|
|
3
10
|
from typing import Any, Literal, overload
|
|
@@ -106,22 +113,206 @@ if sys.platform != "win32":
|
|
|
106
113
|
FICLONERANGE: int
|
|
107
114
|
|
|
108
115
|
@overload
|
|
109
|
-
def fcntl(fd: FileDescriptorLike, cmd: int, arg: int = 0, /) -> int:
|
|
116
|
+
def fcntl(fd: FileDescriptorLike, cmd: int, arg: int = 0, /) -> int:
|
|
117
|
+
"""
|
|
118
|
+
Perform the operation `cmd` on file descriptor fd.
|
|
119
|
+
|
|
120
|
+
The values used for `cmd` are operating system dependent, and are available
|
|
121
|
+
as constants in the fcntl module, using the same names as used in
|
|
122
|
+
the relevant C header files. The argument arg is optional, and
|
|
123
|
+
defaults to 0; it may be an int or a string. If arg is given as a string,
|
|
124
|
+
the return value of fcntl is a string of that length, containing the
|
|
125
|
+
resulting value put in the arg buffer by the operating system. The length
|
|
126
|
+
of the arg string is not allowed to exceed 1024 bytes. If the arg given
|
|
127
|
+
is an integer or if none is specified, the result value is an integer
|
|
128
|
+
corresponding to the return value of the fcntl call in the C code.
|
|
129
|
+
"""
|
|
130
|
+
...
|
|
110
131
|
@overload
|
|
111
|
-
def fcntl(fd: FileDescriptorLike, cmd: int, arg: str | ReadOnlyBuffer, /) -> bytes:
|
|
132
|
+
def fcntl(fd: FileDescriptorLike, cmd: int, arg: str | ReadOnlyBuffer, /) -> bytes:
|
|
133
|
+
"""
|
|
134
|
+
Perform the operation `cmd` on file descriptor fd.
|
|
135
|
+
|
|
136
|
+
The values used for `cmd` are operating system dependent, and are available
|
|
137
|
+
as constants in the fcntl module, using the same names as used in
|
|
138
|
+
the relevant C header files. The argument arg is optional, and
|
|
139
|
+
defaults to 0; it may be an int or a string. If arg is given as a string,
|
|
140
|
+
the return value of fcntl is a string of that length, containing the
|
|
141
|
+
resulting value put in the arg buffer by the operating system. The length
|
|
142
|
+
of the arg string is not allowed to exceed 1024 bytes. If the arg given
|
|
143
|
+
is an integer or if none is specified, the result value is an integer
|
|
144
|
+
corresponding to the return value of the fcntl call in the C code.
|
|
145
|
+
"""
|
|
146
|
+
...
|
|
112
147
|
# If arg is an int, return int
|
|
113
148
|
@overload
|
|
114
|
-
def ioctl(fd: FileDescriptorLike, request: int, arg: int = 0, mutate_flag: bool = True, /) -> int:
|
|
149
|
+
def ioctl(fd: FileDescriptorLike, request: int, arg: int = 0, mutate_flag: bool = True, /) -> int:
|
|
150
|
+
"""
|
|
151
|
+
Perform the operation `request` on file descriptor `fd`.
|
|
152
|
+
|
|
153
|
+
The values used for `request` are operating system dependent, and are available
|
|
154
|
+
as constants in the fcntl or termios library modules, using the same names as
|
|
155
|
+
used in the relevant C header files.
|
|
156
|
+
|
|
157
|
+
The argument `arg` is optional, and defaults to 0; it may be an int or a
|
|
158
|
+
buffer containing character data (most likely a string or an array).
|
|
159
|
+
|
|
160
|
+
If the argument is a mutable buffer (such as an array) and if the
|
|
161
|
+
mutate_flag argument (which is only allowed in this case) is true then the
|
|
162
|
+
buffer is (in effect) passed to the operating system and changes made by
|
|
163
|
+
the OS will be reflected in the contents of the buffer after the call has
|
|
164
|
+
returned. The return value is the integer returned by the ioctl system
|
|
165
|
+
call.
|
|
166
|
+
|
|
167
|
+
If the argument is a mutable buffer and the mutable_flag argument is false,
|
|
168
|
+
the behavior is as if a string had been passed.
|
|
169
|
+
|
|
170
|
+
If the argument is an immutable buffer (most likely a string) then a copy
|
|
171
|
+
of the buffer is passed to the operating system and the return value is a
|
|
172
|
+
string of the same length containing whatever the operating system put in
|
|
173
|
+
the buffer. The length of the arg buffer in this case is not allowed to
|
|
174
|
+
exceed 1024 bytes.
|
|
175
|
+
|
|
176
|
+
If the arg given is an integer or if none is specified, the result value is
|
|
177
|
+
an integer corresponding to the return value of the ioctl call in the C
|
|
178
|
+
code.
|
|
179
|
+
"""
|
|
180
|
+
...
|
|
115
181
|
# The return type works as follows:
|
|
116
182
|
# - If arg is a read-write buffer, return int if mutate_flag is True, otherwise bytes
|
|
117
183
|
# - If arg is a read-only buffer, return bytes (and ignore the value of mutate_flag)
|
|
118
184
|
# We can't represent that precisely as we can't distinguish between read-write and read-only
|
|
119
185
|
# buffers, so we add overloads for a few unambiguous cases and use Any for the rest.
|
|
120
186
|
@overload
|
|
121
|
-
def ioctl(fd: FileDescriptorLike, request: int, arg: bytes, mutate_flag: bool = True, /) -> bytes:
|
|
187
|
+
def ioctl(fd: FileDescriptorLike, request: int, arg: bytes, mutate_flag: bool = True, /) -> bytes:
|
|
188
|
+
"""
|
|
189
|
+
Perform the operation `request` on file descriptor `fd`.
|
|
190
|
+
|
|
191
|
+
The values used for `request` are operating system dependent, and are available
|
|
192
|
+
as constants in the fcntl or termios library modules, using the same names as
|
|
193
|
+
used in the relevant C header files.
|
|
194
|
+
|
|
195
|
+
The argument `arg` is optional, and defaults to 0; it may be an int or a
|
|
196
|
+
buffer containing character data (most likely a string or an array).
|
|
197
|
+
|
|
198
|
+
If the argument is a mutable buffer (such as an array) and if the
|
|
199
|
+
mutate_flag argument (which is only allowed in this case) is true then the
|
|
200
|
+
buffer is (in effect) passed to the operating system and changes made by
|
|
201
|
+
the OS will be reflected in the contents of the buffer after the call has
|
|
202
|
+
returned. The return value is the integer returned by the ioctl system
|
|
203
|
+
call.
|
|
204
|
+
|
|
205
|
+
If the argument is a mutable buffer and the mutable_flag argument is false,
|
|
206
|
+
the behavior is as if a string had been passed.
|
|
207
|
+
|
|
208
|
+
If the argument is an immutable buffer (most likely a string) then a copy
|
|
209
|
+
of the buffer is passed to the operating system and the return value is a
|
|
210
|
+
string of the same length containing whatever the operating system put in
|
|
211
|
+
the buffer. The length of the arg buffer in this case is not allowed to
|
|
212
|
+
exceed 1024 bytes.
|
|
213
|
+
|
|
214
|
+
If the arg given is an integer or if none is specified, the result value is
|
|
215
|
+
an integer corresponding to the return value of the ioctl call in the C
|
|
216
|
+
code.
|
|
217
|
+
"""
|
|
218
|
+
...
|
|
122
219
|
@overload
|
|
123
|
-
def ioctl(fd: FileDescriptorLike, request: int, arg: WriteableBuffer, mutate_flag: Literal[False], /) -> bytes:
|
|
220
|
+
def ioctl(fd: FileDescriptorLike, request: int, arg: WriteableBuffer, mutate_flag: Literal[False], /) -> bytes:
|
|
221
|
+
"""
|
|
222
|
+
Perform the operation `request` on file descriptor `fd`.
|
|
223
|
+
|
|
224
|
+
The values used for `request` are operating system dependent, and are available
|
|
225
|
+
as constants in the fcntl or termios library modules, using the same names as
|
|
226
|
+
used in the relevant C header files.
|
|
227
|
+
|
|
228
|
+
The argument `arg` is optional, and defaults to 0; it may be an int or a
|
|
229
|
+
buffer containing character data (most likely a string or an array).
|
|
230
|
+
|
|
231
|
+
If the argument is a mutable buffer (such as an array) and if the
|
|
232
|
+
mutate_flag argument (which is only allowed in this case) is true then the
|
|
233
|
+
buffer is (in effect) passed to the operating system and changes made by
|
|
234
|
+
the OS will be reflected in the contents of the buffer after the call has
|
|
235
|
+
returned. The return value is the integer returned by the ioctl system
|
|
236
|
+
call.
|
|
237
|
+
|
|
238
|
+
If the argument is a mutable buffer and the mutable_flag argument is false,
|
|
239
|
+
the behavior is as if a string had been passed.
|
|
240
|
+
|
|
241
|
+
If the argument is an immutable buffer (most likely a string) then a copy
|
|
242
|
+
of the buffer is passed to the operating system and the return value is a
|
|
243
|
+
string of the same length containing whatever the operating system put in
|
|
244
|
+
the buffer. The length of the arg buffer in this case is not allowed to
|
|
245
|
+
exceed 1024 bytes.
|
|
246
|
+
|
|
247
|
+
If the arg given is an integer or if none is specified, the result value is
|
|
248
|
+
an integer corresponding to the return value of the ioctl call in the C
|
|
249
|
+
code.
|
|
250
|
+
"""
|
|
251
|
+
...
|
|
124
252
|
@overload
|
|
125
|
-
def ioctl(fd: FileDescriptorLike, request: int, arg: Buffer, mutate_flag: bool = True, /) -> Any:
|
|
126
|
-
|
|
127
|
-
|
|
253
|
+
def ioctl(fd: FileDescriptorLike, request: int, arg: Buffer, mutate_flag: bool = True, /) -> Any:
|
|
254
|
+
"""
|
|
255
|
+
Perform the operation `request` on file descriptor `fd`.
|
|
256
|
+
|
|
257
|
+
The values used for `request` are operating system dependent, and are available
|
|
258
|
+
as constants in the fcntl or termios library modules, using the same names as
|
|
259
|
+
used in the relevant C header files.
|
|
260
|
+
|
|
261
|
+
The argument `arg` is optional, and defaults to 0; it may be an int or a
|
|
262
|
+
buffer containing character data (most likely a string or an array).
|
|
263
|
+
|
|
264
|
+
If the argument is a mutable buffer (such as an array) and if the
|
|
265
|
+
mutate_flag argument (which is only allowed in this case) is true then the
|
|
266
|
+
buffer is (in effect) passed to the operating system and changes made by
|
|
267
|
+
the OS will be reflected in the contents of the buffer after the call has
|
|
268
|
+
returned. The return value is the integer returned by the ioctl system
|
|
269
|
+
call.
|
|
270
|
+
|
|
271
|
+
If the argument is a mutable buffer and the mutable_flag argument is false,
|
|
272
|
+
the behavior is as if a string had been passed.
|
|
273
|
+
|
|
274
|
+
If the argument is an immutable buffer (most likely a string) then a copy
|
|
275
|
+
of the buffer is passed to the operating system and the return value is a
|
|
276
|
+
string of the same length containing whatever the operating system put in
|
|
277
|
+
the buffer. The length of the arg buffer in this case is not allowed to
|
|
278
|
+
exceed 1024 bytes.
|
|
279
|
+
|
|
280
|
+
If the arg given is an integer or if none is specified, the result value is
|
|
281
|
+
an integer corresponding to the return value of the ioctl call in the C
|
|
282
|
+
code.
|
|
283
|
+
"""
|
|
284
|
+
...
|
|
285
|
+
def flock(fd: FileDescriptorLike, operation: int, /) -> None:
|
|
286
|
+
"""
|
|
287
|
+
Perform the lock operation `operation` on file descriptor `fd`.
|
|
288
|
+
|
|
289
|
+
See the Unix manual page for flock(2) for details (On some systems, this
|
|
290
|
+
function is emulated using fcntl()).
|
|
291
|
+
"""
|
|
292
|
+
...
|
|
293
|
+
def lockf(fd: FileDescriptorLike, cmd: int, len: int = 0, start: int = 0, whence: int = 0, /) -> Any:
|
|
294
|
+
"""
|
|
295
|
+
A wrapper around the fcntl() locking calls.
|
|
296
|
+
|
|
297
|
+
`fd` is the file descriptor of the file to lock or unlock, and operation is one
|
|
298
|
+
of the following values:
|
|
299
|
+
|
|
300
|
+
LOCK_UN - unlock
|
|
301
|
+
LOCK_SH - acquire a shared lock
|
|
302
|
+
LOCK_EX - acquire an exclusive lock
|
|
303
|
+
|
|
304
|
+
When operation is LOCK_SH or LOCK_EX, it can also be bitwise ORed with
|
|
305
|
+
LOCK_NB to avoid blocking on lock acquisition. If LOCK_NB is used and the
|
|
306
|
+
lock cannot be acquired, an OSError will be raised and the exception will
|
|
307
|
+
have an errno attribute set to EACCES or EAGAIN (depending on the operating
|
|
308
|
+
system -- for portability, check for either value).
|
|
309
|
+
|
|
310
|
+
`len` is the number of bytes to lock, with the default meaning to lock to
|
|
311
|
+
EOF. `start` is the byte offset, relative to `whence`, to that the lock
|
|
312
|
+
starts. `whence` is as with fileobj.seek(), specifically:
|
|
313
|
+
|
|
314
|
+
0 - relative to the start of the file (SEEK_SET)
|
|
315
|
+
1 - relative to the current buffer position (SEEK_CUR)
|
|
316
|
+
2 - relative to the end of the file (SEEK_END)
|
|
317
|
+
"""
|
|
318
|
+
...
|
|
@@ -1,3 +1,25 @@
|
|
|
1
|
+
"""
|
|
2
|
+
This module provides access to the garbage collector for reference cycles.
|
|
3
|
+
|
|
4
|
+
enable() -- Enable automatic garbage collection.
|
|
5
|
+
disable() -- Disable automatic garbage collection.
|
|
6
|
+
isenabled() -- Returns true if automatic collection is enabled.
|
|
7
|
+
collect() -- Do a full collection right now.
|
|
8
|
+
get_count() -- Return the current collection counts.
|
|
9
|
+
get_stats() -- Return list of dictionaries containing per-generation stats.
|
|
10
|
+
set_debug() -- Set debugging flags.
|
|
11
|
+
get_debug() -- Get debugging flags.
|
|
12
|
+
set_threshold() -- Set the collection thresholds.
|
|
13
|
+
get_threshold() -- Return the current the collection thresholds.
|
|
14
|
+
get_objects() -- Return a list of all objects tracked by the collector.
|
|
15
|
+
is_tracked() -- Returns true if a given object is tracked.
|
|
16
|
+
get_referrers() -- Return the list of objects that refer to an object.
|
|
17
|
+
get_referents() -- Return the list of objects that an object refers to.
|
|
18
|
+
freeze() -- Freeze all tracked objects and ignore them for future collections.
|
|
19
|
+
unfreeze() -- Unfreeze all objects in the permanent generation.
|
|
20
|
+
get_freeze_count() -- Return the number of objects in the permanent generation.
|
|
21
|
+
"""
|
|
22
|
+
|
|
1
23
|
import sys
|
|
2
24
|
from collections.abc import Callable
|
|
3
25
|
from typing import Any, Literal
|
|
@@ -14,24 +36,114 @@ _CallbackType: TypeAlias = Callable[[Literal["start", "stop"], dict[str, int]],
|
|
|
14
36
|
callbacks: list[_CallbackType]
|
|
15
37
|
garbage: list[Any]
|
|
16
38
|
|
|
17
|
-
def collect(generation: int = 2) -> int:
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
def
|
|
29
|
-
|
|
30
|
-
|
|
39
|
+
def collect(generation: int = 2) -> int:
|
|
40
|
+
"""
|
|
41
|
+
Run the garbage collector.
|
|
42
|
+
|
|
43
|
+
With no arguments, run a full collection. The optional argument
|
|
44
|
+
may be an integer specifying which generation to collect. A ValueError
|
|
45
|
+
is raised if the generation number is invalid.
|
|
46
|
+
|
|
47
|
+
The number of unreachable objects is returned.
|
|
48
|
+
"""
|
|
49
|
+
...
|
|
50
|
+
def disable() -> None:
|
|
51
|
+
"""Disable automatic garbage collection."""
|
|
52
|
+
...
|
|
53
|
+
def enable() -> None:
|
|
54
|
+
"""Enable automatic garbage collection."""
|
|
55
|
+
...
|
|
56
|
+
def get_count() -> tuple[int, int, int]:
|
|
57
|
+
"""Return a three-tuple of the current collection counts."""
|
|
58
|
+
...
|
|
59
|
+
def get_debug() -> int:
|
|
60
|
+
"""Get the garbage collection debugging flags."""
|
|
61
|
+
...
|
|
62
|
+
def get_objects(generation: int | None = None) -> list[Any]:
|
|
63
|
+
"""
|
|
64
|
+
Return a list of objects tracked by the collector (excluding the list returned).
|
|
65
|
+
|
|
66
|
+
generation
|
|
67
|
+
Generation to extract the objects from.
|
|
68
|
+
|
|
69
|
+
If generation is not None, return only the objects tracked by the collector
|
|
70
|
+
that are in that generation.
|
|
71
|
+
"""
|
|
72
|
+
...
|
|
73
|
+
def freeze() -> None:
|
|
74
|
+
"""
|
|
75
|
+
Freeze all current tracked objects and ignore them for future collections.
|
|
76
|
+
|
|
77
|
+
This can be used before a POSIX fork() call to make the gc copy-on-write friendly.
|
|
78
|
+
Note: collection before a POSIX fork() call may free pages for future allocation
|
|
79
|
+
which can cause copy-on-write.
|
|
80
|
+
"""
|
|
81
|
+
...
|
|
82
|
+
def unfreeze() -> None:
|
|
83
|
+
"""
|
|
84
|
+
Unfreeze all objects in the permanent generation.
|
|
85
|
+
|
|
86
|
+
Put all objects in the permanent generation back into oldest generation.
|
|
87
|
+
"""
|
|
88
|
+
...
|
|
89
|
+
def get_freeze_count() -> int:
|
|
90
|
+
"""Return the number of objects in the permanent generation."""
|
|
91
|
+
...
|
|
92
|
+
def get_referents(*objs: Any) -> list[Any]:
|
|
93
|
+
"""
|
|
94
|
+
get_referents(*objs) -> list
|
|
95
|
+
Return the list of objects that are directly referred to by objs.
|
|
96
|
+
"""
|
|
97
|
+
...
|
|
98
|
+
def get_referrers(*objs: Any) -> list[Any]:
|
|
99
|
+
"""
|
|
100
|
+
get_referrers(*objs) -> list
|
|
101
|
+
Return the list of objects that directly refer to any of objs.
|
|
102
|
+
"""
|
|
103
|
+
...
|
|
104
|
+
def get_stats() -> list[dict[str, Any]]:
|
|
105
|
+
"""Return a list of dictionaries containing per-generation statistics."""
|
|
106
|
+
...
|
|
107
|
+
def get_threshold() -> tuple[int, int, int]:
|
|
108
|
+
"""Return the current collection thresholds."""
|
|
109
|
+
...
|
|
110
|
+
def is_tracked(obj: Any, /) -> bool:
|
|
111
|
+
"""
|
|
112
|
+
Returns true if the object is tracked by the garbage collector.
|
|
113
|
+
|
|
114
|
+
Simple atomic objects will return false.
|
|
115
|
+
"""
|
|
116
|
+
...
|
|
31
117
|
|
|
32
118
|
if sys.version_info >= (3, 9):
|
|
33
|
-
def is_finalized(obj: Any, /) -> bool:
|
|
119
|
+
def is_finalized(obj: Any, /) -> bool:
|
|
120
|
+
"""Returns true if the object has been already finalized by the GC."""
|
|
121
|
+
...
|
|
122
|
+
|
|
123
|
+
def isenabled() -> bool:
|
|
124
|
+
"""Returns true if automatic garbage collection is enabled."""
|
|
125
|
+
...
|
|
126
|
+
def set_debug(flags: int, /) -> None:
|
|
127
|
+
"""
|
|
128
|
+
Set the garbage collection debugging flags.
|
|
129
|
+
|
|
130
|
+
flags
|
|
131
|
+
An integer that can have the following bits turned on:
|
|
132
|
+
DEBUG_STATS - Print statistics during collection.
|
|
133
|
+
DEBUG_COLLECTABLE - Print collectable objects found.
|
|
134
|
+
DEBUG_UNCOLLECTABLE - Print unreachable but uncollectable objects
|
|
135
|
+
found.
|
|
136
|
+
DEBUG_SAVEALL - Save objects to gc.garbage rather than freeing them.
|
|
137
|
+
DEBUG_LEAK - Debug leaking programs (everything but STATS).
|
|
138
|
+
|
|
139
|
+
Debugging information is written to sys.stderr.
|
|
140
|
+
"""
|
|
141
|
+
...
|
|
142
|
+
def set_threshold(threshold0: int, threshold1: int = ..., threshold2: int = ...) -> None:
|
|
143
|
+
"""
|
|
144
|
+
set_threshold(threshold0, [threshold1, threshold2]) -> None
|
|
34
145
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
146
|
+
Sets the collection thresholds. Setting threshold0 to zero disables
|
|
147
|
+
collection.
|
|
148
|
+
"""
|
|
149
|
+
...
|
|
@@ -1,3 +1,20 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Access to the Unix group database.
|
|
3
|
+
|
|
4
|
+
Group entries are reported as 4-tuples containing the following fields
|
|
5
|
+
from the group database, in order:
|
|
6
|
+
|
|
7
|
+
gr_name - name of the group
|
|
8
|
+
gr_passwd - group password (encrypted); often empty
|
|
9
|
+
gr_gid - numeric ID of the group
|
|
10
|
+
gr_mem - list of members
|
|
11
|
+
|
|
12
|
+
The gid is an integer, name and password are strings. (Note that most
|
|
13
|
+
users are not explicitly listed as members of the groups they are in
|
|
14
|
+
according to the password database. Check both databases to get
|
|
15
|
+
complete membership information.)
|
|
16
|
+
"""
|
|
17
|
+
|
|
1
18
|
import sys
|
|
2
19
|
from _typeshed import structseq
|
|
3
20
|
from typing import Any, Final, final
|
|
@@ -5,18 +22,52 @@ from typing import Any, Final, final
|
|
|
5
22
|
if sys.platform != "win32":
|
|
6
23
|
@final
|
|
7
24
|
class struct_group(structseq[Any], tuple[str, str | None, int, list[str]]):
|
|
25
|
+
"""
|
|
26
|
+
grp.struct_group: Results from getgr*() routines.
|
|
27
|
+
|
|
28
|
+
This object may be accessed either as a tuple of
|
|
29
|
+
(gr_name,gr_passwd,gr_gid,gr_mem)
|
|
30
|
+
or via the object attributes as named in the above tuple.
|
|
31
|
+
"""
|
|
8
32
|
if sys.version_info >= (3, 10):
|
|
9
33
|
__match_args__: Final = ("gr_name", "gr_passwd", "gr_gid", "gr_mem")
|
|
10
34
|
|
|
11
35
|
@property
|
|
12
|
-
def gr_name(self) -> str:
|
|
36
|
+
def gr_name(self) -> str:
|
|
37
|
+
"""group name"""
|
|
38
|
+
...
|
|
13
39
|
@property
|
|
14
|
-
def gr_passwd(self) -> str | None:
|
|
40
|
+
def gr_passwd(self) -> str | None:
|
|
41
|
+
"""password"""
|
|
42
|
+
...
|
|
15
43
|
@property
|
|
16
|
-
def gr_gid(self) -> int:
|
|
44
|
+
def gr_gid(self) -> int:
|
|
45
|
+
"""group id"""
|
|
46
|
+
...
|
|
17
47
|
@property
|
|
18
|
-
def gr_mem(self) -> list[str]:
|
|
48
|
+
def gr_mem(self) -> list[str]:
|
|
49
|
+
"""group members"""
|
|
50
|
+
...
|
|
51
|
+
|
|
52
|
+
def getgrall() -> list[struct_group]:
|
|
53
|
+
"""
|
|
54
|
+
Return a list of all available group entries, in arbitrary order.
|
|
55
|
+
|
|
56
|
+
An entry whose name starts with '+' or '-' represents an instruction
|
|
57
|
+
to use YP/NIS and may not be accessible via getgrnam or getgrgid.
|
|
58
|
+
"""
|
|
59
|
+
...
|
|
60
|
+
def getgrgid(id: int) -> struct_group:
|
|
61
|
+
"""
|
|
62
|
+
Return the group database entry for the given numeric group ID.
|
|
63
|
+
|
|
64
|
+
If id is not valid, raise KeyError.
|
|
65
|
+
"""
|
|
66
|
+
...
|
|
67
|
+
def getgrnam(name: str) -> struct_group:
|
|
68
|
+
"""
|
|
69
|
+
Return the group database entry for the given group name.
|
|
19
70
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
71
|
+
If name is not valid, raise KeyError.
|
|
72
|
+
"""
|
|
73
|
+
...
|