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,64 @@
|
|
|
1
|
+
"""
|
|
2
|
+
S_IFMT_: file type bits
|
|
3
|
+
S_IFDIR: directory
|
|
4
|
+
S_IFCHR: character device
|
|
5
|
+
S_IFBLK: block device
|
|
6
|
+
S_IFREG: regular file
|
|
7
|
+
S_IFIFO: fifo (named pipe)
|
|
8
|
+
S_IFLNK: symbolic link
|
|
9
|
+
S_IFSOCK: socket file
|
|
10
|
+
S_IFDOOR: door
|
|
11
|
+
S_IFPORT: event port
|
|
12
|
+
S_IFWHT: whiteout
|
|
13
|
+
|
|
14
|
+
S_ISUID: set UID bit
|
|
15
|
+
S_ISGID: set GID bit
|
|
16
|
+
S_ENFMT: file locking enforcement
|
|
17
|
+
S_ISVTX: sticky bit
|
|
18
|
+
S_IREAD: Unix V7 synonym for S_IRUSR
|
|
19
|
+
S_IWRITE: Unix V7 synonym for S_IWUSR
|
|
20
|
+
S_IEXEC: Unix V7 synonym for S_IXUSR
|
|
21
|
+
S_IRWXU: mask for owner permissions
|
|
22
|
+
S_IRUSR: read by owner
|
|
23
|
+
S_IWUSR: write by owner
|
|
24
|
+
S_IXUSR: execute by owner
|
|
25
|
+
S_IRWXG: mask for group permissions
|
|
26
|
+
S_IRGRP: read by group
|
|
27
|
+
S_IWGRP: write by group
|
|
28
|
+
S_IXGRP: execute by group
|
|
29
|
+
S_IRWXO: mask for others (not in group) permissions
|
|
30
|
+
S_IROTH: read by others
|
|
31
|
+
S_IWOTH: write by others
|
|
32
|
+
S_IXOTH: execute by others
|
|
33
|
+
|
|
34
|
+
UF_NODUMP: do not dump file
|
|
35
|
+
UF_IMMUTABLE: file may not be changed
|
|
36
|
+
UF_APPEND: file may only be appended to
|
|
37
|
+
UF_OPAQUE: directory is opaque when viewed through a union stack
|
|
38
|
+
UF_NOUNLINK: file may not be renamed or deleted
|
|
39
|
+
UF_COMPRESSED: OS X: file is hfs-compressed
|
|
40
|
+
UF_HIDDEN: OS X: file should not be displayed
|
|
41
|
+
SF_ARCHIVED: file may be archived
|
|
42
|
+
SF_IMMUTABLE: file may not be changed
|
|
43
|
+
SF_APPEND: file may only be appended to
|
|
44
|
+
SF_NOUNLINK: file may not be renamed or deleted
|
|
45
|
+
SF_SNAPSHOT: file is a snapshot file
|
|
46
|
+
|
|
47
|
+
ST_MODE
|
|
48
|
+
ST_INO
|
|
49
|
+
ST_DEV
|
|
50
|
+
ST_NLINK
|
|
51
|
+
ST_UID
|
|
52
|
+
ST_GID
|
|
53
|
+
ST_SIZE
|
|
54
|
+
ST_ATIME
|
|
55
|
+
ST_MTIME
|
|
56
|
+
ST_CTIME
|
|
57
|
+
|
|
58
|
+
FILE_ATTRIBUTE_*: Windows file attribute constants
|
|
59
|
+
(only present on Windows)
|
|
60
|
+
"""
|
|
61
|
+
|
|
1
62
|
import sys
|
|
2
63
|
from typing import Literal
|
|
3
64
|
|
|
@@ -64,19 +125,85 @@ UF_NODUMP: Literal[0x00000001]
|
|
|
64
125
|
UF_NOUNLINK: Literal[0x00000010]
|
|
65
126
|
UF_OPAQUE: Literal[0x00000008]
|
|
66
127
|
|
|
67
|
-
def S_IMODE(mode: int, /) -> int:
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
def
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
def
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
128
|
+
def S_IMODE(mode: int, /) -> int:
|
|
129
|
+
"""Return the portion of the file's mode that can be set by os.chmod()."""
|
|
130
|
+
...
|
|
131
|
+
def S_IFMT(mode: int, /) -> int:
|
|
132
|
+
"""Return the portion of the file's mode that describes the file type."""
|
|
133
|
+
...
|
|
134
|
+
def S_ISBLK(mode: int, /) -> bool:
|
|
135
|
+
"""
|
|
136
|
+
S_ISBLK(mode) -> bool
|
|
137
|
+
|
|
138
|
+
Return True if mode is from a block special device file.
|
|
139
|
+
"""
|
|
140
|
+
...
|
|
141
|
+
def S_ISCHR(mode: int, /) -> bool:
|
|
142
|
+
"""
|
|
143
|
+
S_ISCHR(mode) -> bool
|
|
144
|
+
|
|
145
|
+
Return True if mode is from a character special device file.
|
|
146
|
+
"""
|
|
147
|
+
...
|
|
148
|
+
def S_ISDIR(mode: int, /) -> bool:
|
|
149
|
+
"""
|
|
150
|
+
S_ISDIR(mode) -> bool
|
|
151
|
+
|
|
152
|
+
Return True if mode is from a directory.
|
|
153
|
+
"""
|
|
154
|
+
...
|
|
155
|
+
def S_ISDOOR(mode: int, /) -> bool:
|
|
156
|
+
"""
|
|
157
|
+
S_ISDOOR(mode) -> bool
|
|
158
|
+
|
|
159
|
+
Return True if mode is from a door.
|
|
160
|
+
"""
|
|
161
|
+
...
|
|
162
|
+
def S_ISFIFO(mode: int, /) -> bool:
|
|
163
|
+
"""
|
|
164
|
+
S_ISFIFO(mode) -> bool
|
|
165
|
+
|
|
166
|
+
Return True if mode is from a FIFO (named pipe).
|
|
167
|
+
"""
|
|
168
|
+
...
|
|
169
|
+
def S_ISLNK(mode: int, /) -> bool:
|
|
170
|
+
"""
|
|
171
|
+
S_ISLNK(mode) -> bool
|
|
172
|
+
|
|
173
|
+
Return True if mode is from a symbolic link.
|
|
174
|
+
"""
|
|
175
|
+
...
|
|
176
|
+
def S_ISPORT(mode: int, /) -> bool:
|
|
177
|
+
"""
|
|
178
|
+
S_ISPORT(mode) -> bool
|
|
179
|
+
|
|
180
|
+
Return True if mode is from an event port.
|
|
181
|
+
"""
|
|
182
|
+
...
|
|
183
|
+
def S_ISREG(mode: int, /) -> bool:
|
|
184
|
+
"""
|
|
185
|
+
S_ISREG(mode) -> bool
|
|
186
|
+
|
|
187
|
+
Return True if mode is from a regular file.
|
|
188
|
+
"""
|
|
189
|
+
...
|
|
190
|
+
def S_ISSOCK(mode: int, /) -> bool:
|
|
191
|
+
"""
|
|
192
|
+
S_ISSOCK(mode) -> bool
|
|
193
|
+
|
|
194
|
+
Return True if mode is from a socket.
|
|
195
|
+
"""
|
|
196
|
+
...
|
|
197
|
+
def S_ISWHT(mode: int, /) -> bool:
|
|
198
|
+
"""
|
|
199
|
+
S_ISWHT(mode) -> bool
|
|
200
|
+
|
|
201
|
+
Return True if mode is from a whiteout.
|
|
202
|
+
"""
|
|
203
|
+
...
|
|
204
|
+
def filemode(mode: int, /) -> str:
|
|
205
|
+
"""Convert a file's mode to a string of the form '-rwxrwxrwx'"""
|
|
206
|
+
...
|
|
80
207
|
|
|
81
208
|
if sys.platform == "win32":
|
|
82
209
|
IO_REPARSE_TAG_SYMLINK: int
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
"""
|
|
2
|
+
This module provides primitive operations to write multi-threaded programs.
|
|
3
|
+
The 'threading' module provides a more convenient interface.
|
|
4
|
+
"""
|
|
5
|
+
|
|
1
6
|
import sys
|
|
2
7
|
from _typeshed import structseq
|
|
3
8
|
from collections.abc import Callable
|
|
@@ -10,50 +15,238 @@ _Ts = TypeVarTuple("_Ts")
|
|
|
10
15
|
|
|
11
16
|
error = RuntimeError
|
|
12
17
|
|
|
13
|
-
def _count() -> int:
|
|
18
|
+
def _count() -> int:
|
|
19
|
+
"""
|
|
20
|
+
_count() -> integer
|
|
21
|
+
|
|
22
|
+
Return the number of currently running Python threads, excluding
|
|
23
|
+
the main thread. The returned number comprises all threads created
|
|
24
|
+
through `start_new_thread()` as well as `threading.Thread`, and not
|
|
25
|
+
yet finished.
|
|
26
|
+
|
|
27
|
+
This function is meant for internal and specialized purposes only.
|
|
28
|
+
In most applications `threading.enumerate()` should be used instead.
|
|
29
|
+
"""
|
|
30
|
+
...
|
|
14
31
|
@final
|
|
15
32
|
class LockType:
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
33
|
+
"""
|
|
34
|
+
A lock object is a synchronization primitive. To create a lock,
|
|
35
|
+
call threading.Lock(). Methods are:
|
|
36
|
+
|
|
37
|
+
acquire() -- lock the lock, possibly blocking until it can be obtained
|
|
38
|
+
release() -- unlock of the lock
|
|
39
|
+
locked() -- test whether the lock is currently locked
|
|
40
|
+
|
|
41
|
+
A lock is not owned by the thread that locked it; another thread may
|
|
42
|
+
unlock it. A thread attempting to lock a lock that it has already locked
|
|
43
|
+
will block until another thread unlocks it. Deadlocks may ensue.
|
|
44
|
+
"""
|
|
45
|
+
def acquire(self, blocking: bool = ..., timeout: float = ...) -> bool:
|
|
46
|
+
"""
|
|
47
|
+
acquire(blocking=True, timeout=-1) -> bool
|
|
48
|
+
(acquire_lock() is an obsolete synonym)
|
|
49
|
+
|
|
50
|
+
Lock the lock. Without argument, this blocks if the lock is already
|
|
51
|
+
locked (even by the same thread), waiting for another thread to release
|
|
52
|
+
the lock, and return True once the lock is acquired.
|
|
53
|
+
With an argument, this will only block if the argument is true,
|
|
54
|
+
and the return value reflects whether the lock is acquired.
|
|
55
|
+
The blocking operation is interruptible.
|
|
56
|
+
"""
|
|
57
|
+
...
|
|
58
|
+
def release(self) -> None:
|
|
59
|
+
"""
|
|
60
|
+
release()
|
|
61
|
+
(release_lock() is an obsolete synonym)
|
|
62
|
+
|
|
63
|
+
Release the lock, allowing another thread that is blocked waiting for
|
|
64
|
+
the lock to acquire the lock. The lock must be in the locked state,
|
|
65
|
+
but it needn't be locked by the same thread that unlocks it.
|
|
66
|
+
"""
|
|
67
|
+
...
|
|
68
|
+
def locked(self) -> bool:
|
|
69
|
+
"""
|
|
70
|
+
locked() -> bool
|
|
71
|
+
(locked_lock() is an obsolete synonym)
|
|
72
|
+
|
|
73
|
+
Return whether the lock is in the locked state.
|
|
74
|
+
"""
|
|
75
|
+
...
|
|
76
|
+
def __enter__(self) -> bool:
|
|
77
|
+
"""
|
|
78
|
+
acquire(blocking=True, timeout=-1) -> bool
|
|
79
|
+
(acquire_lock() is an obsolete synonym)
|
|
80
|
+
|
|
81
|
+
Lock the lock. Without argument, this blocks if the lock is already
|
|
82
|
+
locked (even by the same thread), waiting for another thread to release
|
|
83
|
+
the lock, and return True once the lock is acquired.
|
|
84
|
+
With an argument, this will only block if the argument is true,
|
|
85
|
+
and the return value reflects whether the lock is acquired.
|
|
86
|
+
The blocking operation is interruptible.
|
|
87
|
+
"""
|
|
88
|
+
...
|
|
20
89
|
def __exit__(
|
|
21
90
|
self, type: type[BaseException] | None, value: BaseException | None, traceback: TracebackType | None
|
|
22
|
-
) -> None:
|
|
91
|
+
) -> None:
|
|
92
|
+
"""
|
|
93
|
+
release()
|
|
94
|
+
(release_lock() is an obsolete synonym)
|
|
95
|
+
|
|
96
|
+
Release the lock, allowing another thread that is blocked waiting for
|
|
97
|
+
the lock to acquire the lock. The lock must be in the locked state,
|
|
98
|
+
but it needn't be locked by the same thread that unlocks it.
|
|
99
|
+
"""
|
|
100
|
+
...
|
|
23
101
|
|
|
24
102
|
@overload
|
|
25
|
-
def start_new_thread(function: Callable[[Unpack[_Ts]], object], args: tuple[Unpack[_Ts]]) -> int:
|
|
103
|
+
def start_new_thread(function: Callable[[Unpack[_Ts]], object], args: tuple[Unpack[_Ts]]) -> int:
|
|
104
|
+
"""
|
|
105
|
+
start_new_thread(function, args[, kwargs])
|
|
106
|
+
(start_new() is an obsolete synonym)
|
|
107
|
+
|
|
108
|
+
Start a new thread and return its identifier. The thread will call the
|
|
109
|
+
function with positional arguments from the tuple args and keyword arguments
|
|
110
|
+
taken from the optional dictionary kwargs. The thread exits when the
|
|
111
|
+
function returns; the return value is ignored. The thread will also exit
|
|
112
|
+
when the function raises an unhandled exception; a stack trace will be
|
|
113
|
+
printed unless the exception is SystemExit.
|
|
114
|
+
"""
|
|
115
|
+
...
|
|
26
116
|
@overload
|
|
27
|
-
def start_new_thread(function: Callable[..., object], args: tuple[Any, ...], kwargs: dict[str, Any]) -> int:
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
117
|
+
def start_new_thread(function: Callable[..., object], args: tuple[Any, ...], kwargs: dict[str, Any]) -> int:
|
|
118
|
+
"""
|
|
119
|
+
start_new_thread(function, args[, kwargs])
|
|
120
|
+
(start_new() is an obsolete synonym)
|
|
121
|
+
|
|
122
|
+
Start a new thread and return its identifier. The thread will call the
|
|
123
|
+
function with positional arguments from the tuple args and keyword arguments
|
|
124
|
+
taken from the optional dictionary kwargs. The thread exits when the
|
|
125
|
+
function returns; the return value is ignored. The thread will also exit
|
|
126
|
+
when the function raises an unhandled exception; a stack trace will be
|
|
127
|
+
printed unless the exception is SystemExit.
|
|
128
|
+
"""
|
|
129
|
+
...
|
|
130
|
+
def interrupt_main() -> None:
|
|
131
|
+
"""
|
|
132
|
+
interrupt_main()
|
|
133
|
+
|
|
134
|
+
Raise a KeyboardInterrupt in the main thread.
|
|
135
|
+
A subthread can use this function to interrupt the main thread.
|
|
136
|
+
"""
|
|
137
|
+
...
|
|
138
|
+
def exit() -> NoReturn:
|
|
139
|
+
"""
|
|
140
|
+
exit()
|
|
141
|
+
(exit_thread() is an obsolete synonym)
|
|
142
|
+
|
|
143
|
+
This is synonymous to ``raise SystemExit''. It will cause the current
|
|
144
|
+
thread to exit silently unless the exception is caught.
|
|
145
|
+
"""
|
|
146
|
+
...
|
|
147
|
+
def allocate_lock() -> LockType:
|
|
148
|
+
"""
|
|
149
|
+
allocate_lock() -> lock object
|
|
150
|
+
(allocate() is an obsolete synonym)
|
|
151
|
+
|
|
152
|
+
Create a new lock object. See help(type(threading.Lock())) for
|
|
153
|
+
information about locks.
|
|
154
|
+
"""
|
|
155
|
+
...
|
|
156
|
+
def get_ident() -> int:
|
|
157
|
+
"""
|
|
158
|
+
get_ident() -> integer
|
|
159
|
+
|
|
160
|
+
Return a non-zero integer that uniquely identifies the current thread
|
|
161
|
+
amongst other threads that exist simultaneously.
|
|
162
|
+
This may be used to identify per-thread resources.
|
|
163
|
+
Even though on some platforms threads identities may appear to be
|
|
164
|
+
allocated consecutive numbers starting at 1, this behavior should not
|
|
165
|
+
be relied upon, and the number should be seen purely as a magic cookie.
|
|
166
|
+
A thread's identity may be reused for another thread after it exits.
|
|
167
|
+
"""
|
|
168
|
+
...
|
|
169
|
+
def stack_size(size: int = ...) -> int:
|
|
170
|
+
"""
|
|
171
|
+
stack_size([size]) -> size
|
|
172
|
+
|
|
173
|
+
Return the thread stack size used when creating new threads. The
|
|
174
|
+
optional size argument specifies the stack size (in bytes) to be used
|
|
175
|
+
for subsequently created threads, and must be 0 (use platform or
|
|
176
|
+
configured default) or a positive integer value of at least 32,768 (32k).
|
|
177
|
+
If changing the thread stack size is unsupported, a ThreadError
|
|
178
|
+
exception is raised. If the specified size is invalid, a ValueError
|
|
179
|
+
exception is raised, and the stack size is unmodified. 32k bytes
|
|
180
|
+
currently the minimum supported stack size value to guarantee
|
|
181
|
+
sufficient stack space for the interpreter itself.
|
|
182
|
+
|
|
183
|
+
Note that some platforms may have particular restrictions on values for
|
|
184
|
+
the stack size, such as requiring a minimum stack size larger than 32 KiB or
|
|
185
|
+
requiring allocation in multiples of the system memory page size
|
|
186
|
+
- platform documentation should be referred to for more information
|
|
187
|
+
(4 KiB pages are common; using multiples of 4096 for the stack size is
|
|
188
|
+
the suggested approach in the absence of more specific information).
|
|
189
|
+
"""
|
|
190
|
+
...
|
|
33
191
|
|
|
34
192
|
TIMEOUT_MAX: float
|
|
35
193
|
|
|
36
|
-
def get_native_id() -> int:
|
|
194
|
+
def get_native_id() -> int:
|
|
195
|
+
"""
|
|
196
|
+
get_native_id() -> integer
|
|
197
|
+
|
|
198
|
+
Return a non-negative integer identifying the thread as reported
|
|
199
|
+
by the OS (kernel). This may be used to uniquely identify a
|
|
200
|
+
particular thread within a system.
|
|
201
|
+
"""
|
|
202
|
+
...
|
|
37
203
|
@final
|
|
38
204
|
class _ExceptHookArgs(structseq[Any], tuple[type[BaseException], BaseException | None, TracebackType | None, Thread | None]):
|
|
205
|
+
"""
|
|
206
|
+
ExceptHookArgs
|
|
207
|
+
|
|
208
|
+
Type used to pass arguments to threading.excepthook.
|
|
209
|
+
"""
|
|
39
210
|
if sys.version_info >= (3, 10):
|
|
40
211
|
__match_args__: Final = ("exc_type", "exc_value", "exc_traceback", "thread")
|
|
41
212
|
|
|
42
213
|
@property
|
|
43
|
-
def exc_type(self) -> type[BaseException]:
|
|
214
|
+
def exc_type(self) -> type[BaseException]:
|
|
215
|
+
"""Exception type"""
|
|
216
|
+
...
|
|
44
217
|
@property
|
|
45
|
-
def exc_value(self) -> BaseException | None:
|
|
218
|
+
def exc_value(self) -> BaseException | None:
|
|
219
|
+
"""Exception value"""
|
|
220
|
+
...
|
|
46
221
|
@property
|
|
47
|
-
def exc_traceback(self) -> TracebackType | None:
|
|
222
|
+
def exc_traceback(self) -> TracebackType | None:
|
|
223
|
+
"""Exception traceback"""
|
|
224
|
+
...
|
|
48
225
|
@property
|
|
49
|
-
def thread(self) -> Thread | None:
|
|
226
|
+
def thread(self) -> Thread | None:
|
|
227
|
+
"""Thread"""
|
|
228
|
+
...
|
|
50
229
|
|
|
51
230
|
_excepthook: Callable[[_ExceptHookArgs], Any]
|
|
52
231
|
|
|
53
232
|
if sys.version_info >= (3, 12):
|
|
54
|
-
def daemon_threads_allowed() -> bool:
|
|
233
|
+
def daemon_threads_allowed() -> bool:
|
|
234
|
+
"""
|
|
235
|
+
daemon_threads_allowed()
|
|
236
|
+
|
|
237
|
+
Return True if daemon threads are allowed in the current interpreter,
|
|
238
|
+
and False otherwise.
|
|
239
|
+
"""
|
|
240
|
+
...
|
|
55
241
|
|
|
56
242
|
class _local:
|
|
57
|
-
|
|
58
|
-
def
|
|
59
|
-
|
|
243
|
+
"""Thread-local data"""
|
|
244
|
+
def __getattribute__(self, name: str, /) -> Any:
|
|
245
|
+
"""Return getattr(self, name)."""
|
|
246
|
+
...
|
|
247
|
+
def __setattr__(self, name: str, value: Any, /) -> None:
|
|
248
|
+
"""Implement setattr(self, name, value)."""
|
|
249
|
+
...
|
|
250
|
+
def __delattr__(self, name: str, /) -> None:
|
|
251
|
+
"""Implement delattr(self, name)."""
|
|
252
|
+
...
|
|
@@ -17,16 +17,32 @@ from typing import Any, ClassVar, Literal, final
|
|
|
17
17
|
@final
|
|
18
18
|
class Tcl_Obj:
|
|
19
19
|
@property
|
|
20
|
-
def string(self) -> str:
|
|
20
|
+
def string(self) -> str:
|
|
21
|
+
"""the string representation of this object, either as str or bytes"""
|
|
22
|
+
...
|
|
21
23
|
@property
|
|
22
|
-
def typename(self) -> str:
|
|
24
|
+
def typename(self) -> str:
|
|
25
|
+
"""name of the Tcl type"""
|
|
26
|
+
...
|
|
23
27
|
__hash__: ClassVar[None] # type: ignore[assignment]
|
|
24
|
-
def __eq__(self, value, /):
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
def
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
def __eq__(self, value, /):
|
|
29
|
+
"""Return self==value."""
|
|
30
|
+
...
|
|
31
|
+
def __ge__(self, value, /):
|
|
32
|
+
"""Return self>=value."""
|
|
33
|
+
...
|
|
34
|
+
def __gt__(self, value, /):
|
|
35
|
+
"""Return self>value."""
|
|
36
|
+
...
|
|
37
|
+
def __le__(self, value, /):
|
|
38
|
+
"""Return self<=value."""
|
|
39
|
+
...
|
|
40
|
+
def __lt__(self, value, /):
|
|
41
|
+
"""Return self<value."""
|
|
42
|
+
...
|
|
43
|
+
def __ne__(self, value, /):
|
|
44
|
+
"""Return self!=value."""
|
|
45
|
+
...
|
|
30
46
|
|
|
31
47
|
class TclError(Exception): ...
|
|
32
48
|
|
|
@@ -116,6 +132,23 @@ def create(
|
|
|
116
132
|
sync: bool = False,
|
|
117
133
|
use: str | None = None,
|
|
118
134
|
/,
|
|
119
|
-
):
|
|
120
|
-
|
|
121
|
-
|
|
135
|
+
):
|
|
136
|
+
"""
|
|
137
|
+
wantTk
|
|
138
|
+
if false, then Tk_Init() doesn't get called
|
|
139
|
+
sync
|
|
140
|
+
if true, then pass -sync to wish
|
|
141
|
+
use
|
|
142
|
+
if not None, then pass -use to wish
|
|
143
|
+
"""
|
|
144
|
+
...
|
|
145
|
+
def getbusywaitinterval():
|
|
146
|
+
"""Return the current busy-wait interval between successive calls to Tcl_DoOneEvent in a threaded Python interpreter."""
|
|
147
|
+
...
|
|
148
|
+
def setbusywaitinterval(new_val, /):
|
|
149
|
+
"""
|
|
150
|
+
Set the busy-wait interval in milliseconds between successive calls to Tcl_DoOneEvent in a threaded Python interpreter.
|
|
151
|
+
|
|
152
|
+
It should be set to a divisor of the maximum time between frames in an animation.
|
|
153
|
+
"""
|
|
154
|
+
...
|
|
@@ -1,17 +1,78 @@
|
|
|
1
|
+
"""Debug module to trace memory blocks allocated by Python."""
|
|
2
|
+
|
|
1
3
|
import sys
|
|
2
4
|
from collections.abc import Sequence
|
|
3
5
|
from tracemalloc import _FrameTuple, _TraceTuple
|
|
4
6
|
|
|
5
|
-
def _get_object_traceback(obj: object, /) -> Sequence[_FrameTuple] | None:
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
7
|
+
def _get_object_traceback(obj: object, /) -> Sequence[_FrameTuple] | None:
|
|
8
|
+
"""
|
|
9
|
+
Get the traceback where the Python object obj was allocated.
|
|
10
|
+
|
|
11
|
+
Return a tuple of (filename: str, lineno: int) tuples.
|
|
12
|
+
Return None if the tracemalloc module is disabled or did not
|
|
13
|
+
trace the allocation of the object.
|
|
14
|
+
"""
|
|
15
|
+
...
|
|
16
|
+
def _get_traces() -> Sequence[_TraceTuple]:
|
|
17
|
+
"""
|
|
18
|
+
Get traces of all memory blocks allocated by Python.
|
|
19
|
+
|
|
20
|
+
Return a list of (size: int, traceback: tuple) tuples.
|
|
21
|
+
traceback is a tuple of (filename: str, lineno: int) tuples.
|
|
22
|
+
|
|
23
|
+
Return an empty list if the tracemalloc module is disabled.
|
|
24
|
+
"""
|
|
25
|
+
...
|
|
26
|
+
def clear_traces() -> None:
|
|
27
|
+
"""Clear traces of memory blocks allocated by Python."""
|
|
28
|
+
...
|
|
29
|
+
def get_traceback_limit() -> int:
|
|
30
|
+
"""
|
|
31
|
+
Get the maximum number of frames stored in the traceback of a trace.
|
|
32
|
+
|
|
33
|
+
By default, a trace of an allocated memory block only stores
|
|
34
|
+
the most recent frame: the limit is 1.
|
|
35
|
+
"""
|
|
36
|
+
...
|
|
37
|
+
def get_traced_memory() -> tuple[int, int]:
|
|
38
|
+
"""
|
|
39
|
+
Get the current size and peak size of memory blocks traced by tracemalloc.
|
|
40
|
+
|
|
41
|
+
Returns a tuple: (current: int, peak: int).
|
|
42
|
+
"""
|
|
43
|
+
...
|
|
44
|
+
def get_tracemalloc_memory() -> int:
|
|
45
|
+
"""
|
|
46
|
+
Get the memory usage in bytes of the tracemalloc module.
|
|
47
|
+
|
|
48
|
+
This memory is used internally to trace memory allocations.
|
|
49
|
+
"""
|
|
50
|
+
...
|
|
51
|
+
def is_tracing() -> bool:
|
|
52
|
+
"""Return True if the tracemalloc module is tracing Python memory allocations."""
|
|
53
|
+
...
|
|
12
54
|
|
|
13
55
|
if sys.version_info >= (3, 9):
|
|
14
|
-
def reset_peak() -> None:
|
|
56
|
+
def reset_peak() -> None:
|
|
57
|
+
"""
|
|
58
|
+
Set the peak size of memory blocks traced by tracemalloc to the current size.
|
|
59
|
+
|
|
60
|
+
Do nothing if the tracemalloc module is not tracing memory allocations.
|
|
61
|
+
"""
|
|
62
|
+
...
|
|
63
|
+
|
|
64
|
+
def start(nframe: int = 1, /) -> None:
|
|
65
|
+
"""
|
|
66
|
+
Start tracing Python memory allocations.
|
|
67
|
+
|
|
68
|
+
Also set the maximum number of frames stored in the traceback of a
|
|
69
|
+
trace to nframe.
|
|
70
|
+
"""
|
|
71
|
+
...
|
|
72
|
+
def stop() -> None:
|
|
73
|
+
"""
|
|
74
|
+
Stop tracing Python memory allocations.
|
|
15
75
|
|
|
16
|
-
|
|
17
|
-
|
|
76
|
+
Also clear traces of memory blocks allocated by Python.
|
|
77
|
+
"""
|
|
78
|
+
...
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
"""
|
|
2
|
+
_warnings provides basic warning filtering support.
|
|
3
|
+
It is a helper module to speed up interpreter start-up.
|
|
4
|
+
"""
|
|
5
|
+
|
|
1
6
|
import sys
|
|
2
7
|
from typing import Any, overload
|
|
3
8
|
|
|
@@ -14,7 +19,24 @@ if sys.version_info >= (3, 12):
|
|
|
14
19
|
source: Any | None = None,
|
|
15
20
|
*,
|
|
16
21
|
skip_file_prefixes: tuple[str, ...] = (),
|
|
17
|
-
) -> None:
|
|
22
|
+
) -> None:
|
|
23
|
+
"""
|
|
24
|
+
Issue a warning, or maybe ignore it or raise an exception.
|
|
25
|
+
|
|
26
|
+
message
|
|
27
|
+
Text of the warning message.
|
|
28
|
+
category
|
|
29
|
+
The Warning category subclass. Defaults to UserWarning.
|
|
30
|
+
stacklevel
|
|
31
|
+
How far up the call stack to make this warning appear. A value of 2 for
|
|
32
|
+
example attributes the warning to the caller of the code calling warn().
|
|
33
|
+
source
|
|
34
|
+
If supplied, the destroyed object which emitted a ResourceWarning
|
|
35
|
+
skip_file_prefixes
|
|
36
|
+
An optional tuple of module filename prefixes indicating frames to skip
|
|
37
|
+
during stacklevel computations for stack frame attribution.
|
|
38
|
+
"""
|
|
39
|
+
...
|
|
18
40
|
@overload
|
|
19
41
|
def warn(
|
|
20
42
|
message: Warning,
|
|
@@ -23,13 +45,34 @@ if sys.version_info >= (3, 12):
|
|
|
23
45
|
source: Any | None = None,
|
|
24
46
|
*,
|
|
25
47
|
skip_file_prefixes: tuple[str, ...] = (),
|
|
26
|
-
) -> None:
|
|
48
|
+
) -> None:
|
|
49
|
+
"""
|
|
50
|
+
Issue a warning, or maybe ignore it or raise an exception.
|
|
51
|
+
|
|
52
|
+
message
|
|
53
|
+
Text of the warning message.
|
|
54
|
+
category
|
|
55
|
+
The Warning category subclass. Defaults to UserWarning.
|
|
56
|
+
stacklevel
|
|
57
|
+
How far up the call stack to make this warning appear. A value of 2 for
|
|
58
|
+
example attributes the warning to the caller of the code calling warn().
|
|
59
|
+
source
|
|
60
|
+
If supplied, the destroyed object which emitted a ResourceWarning
|
|
61
|
+
skip_file_prefixes
|
|
62
|
+
An optional tuple of module filename prefixes indicating frames to skip
|
|
63
|
+
during stacklevel computations for stack frame attribution.
|
|
64
|
+
"""
|
|
65
|
+
...
|
|
27
66
|
|
|
28
67
|
else:
|
|
29
68
|
@overload
|
|
30
|
-
def warn(message: str, category: type[Warning] | None = None, stacklevel: int = 1, source: Any | None = None) -> None:
|
|
69
|
+
def warn(message: str, category: type[Warning] | None = None, stacklevel: int = 1, source: Any | None = None) -> None:
|
|
70
|
+
"""Issue a warning, or maybe ignore it or raise an exception."""
|
|
71
|
+
...
|
|
31
72
|
@overload
|
|
32
|
-
def warn(message: Warning, category: Any = None, stacklevel: int = 1, source: Any | None = None) -> None:
|
|
73
|
+
def warn(message: Warning, category: Any = None, stacklevel: int = 1, source: Any | None = None) -> None:
|
|
74
|
+
"""Issue a warning, or maybe ignore it or raise an exception."""
|
|
75
|
+
...
|
|
33
76
|
|
|
34
77
|
@overload
|
|
35
78
|
def warn_explicit(
|
|
@@ -41,7 +84,9 @@ def warn_explicit(
|
|
|
41
84
|
registry: dict[str | tuple[str, type[Warning], int], int] | None = ...,
|
|
42
85
|
module_globals: dict[str, Any] | None = ...,
|
|
43
86
|
source: Any | None = ...,
|
|
44
|
-
) -> None:
|
|
87
|
+
) -> None:
|
|
88
|
+
"""Low-level interface to warnings functionality."""
|
|
89
|
+
...
|
|
45
90
|
@overload
|
|
46
91
|
def warn_explicit(
|
|
47
92
|
message: Warning,
|
|
@@ -52,4 +97,6 @@ def warn_explicit(
|
|
|
52
97
|
registry: dict[str | tuple[str, type[Warning], int], int] | None = ...,
|
|
53
98
|
module_globals: dict[str, Any] | None = ...,
|
|
54
99
|
source: Any | None = ...,
|
|
55
|
-
) -> None:
|
|
100
|
+
) -> None:
|
|
101
|
+
"""Low-level interface to warnings functionality."""
|
|
102
|
+
...
|