basedpyright 1.31.6 → 1.31.7

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.
Files changed (63) hide show
  1. package/README.md +1 -1
  2. package/dist/pyright-langserver.js +1 -1
  3. package/dist/pyright-langserver.js.map +1 -1
  4. package/dist/pyright.js +1 -1
  5. package/dist/pyright.js.map +1 -1
  6. package/dist/typeshed-fallback/stdlib/_asyncio.pyi +6 -2
  7. package/dist/typeshed-fallback/stdlib/_compression.pyi +28 -28
  8. package/dist/typeshed-fallback/stdlib/_contextvars.pyi +6 -2
  9. package/dist/typeshed-fallback/stdlib/_ctypes.pyi +10 -51
  10. package/dist/typeshed-fallback/stdlib/_curses.pyi +187 -17
  11. package/dist/typeshed-fallback/stdlib/_decimal.pyi +7 -1
  12. package/dist/typeshed-fallback/stdlib/_heapq.pyi +20 -5
  13. package/dist/typeshed-fallback/stdlib/_interpqueues.pyi +6 -6
  14. package/dist/typeshed-fallback/stdlib/_interpreters.pyi +1 -7
  15. package/dist/typeshed-fallback/stdlib/_io.pyi +9 -5
  16. package/dist/typeshed-fallback/stdlib/_lsprof.pyi +12 -20
  17. package/dist/typeshed-fallback/stdlib/_operator.pyi +6 -2
  18. package/dist/typeshed-fallback/stdlib/_pickle.pyi +3 -3
  19. package/dist/typeshed-fallback/stdlib/_posixsubprocess.pyi +26 -26
  20. package/dist/typeshed-fallback/stdlib/_socket.pyi +6 -18
  21. package/dist/typeshed-fallback/stdlib/_stat.pyi +1 -1
  22. package/dist/typeshed-fallback/stdlib/_thread.pyi +10 -2
  23. package/dist/typeshed-fallback/stdlib/_zstd.pyi +300 -97
  24. package/dist/typeshed-fallback/stdlib/annotationlib.pyi +146 -146
  25. package/dist/typeshed-fallback/stdlib/ast.pyi +256 -96
  26. package/dist/typeshed-fallback/stdlib/asyncio/graph.pyi +28 -28
  27. package/dist/typeshed-fallback/stdlib/asyncio/tasks.pyi +3 -1
  28. package/dist/typeshed-fallback/stdlib/asyncio/tools.pyi +46 -46
  29. package/dist/typeshed-fallback/stdlib/builtins.pyi +46 -36
  30. package/dist/typeshed-fallback/stdlib/compression/_common/_streams.pyi +26 -26
  31. package/dist/typeshed-fallback/stdlib/compression/bz2.pyi +1 -1
  32. package/dist/typeshed-fallback/stdlib/compression/gzip.pyi +1 -1
  33. package/dist/typeshed-fallback/stdlib/compression/lzma.pyi +1 -1
  34. package/dist/typeshed-fallback/stdlib/compression/zlib.pyi +1 -1
  35. package/dist/typeshed-fallback/stdlib/compression/zstd/__init__.pyi +88 -88
  36. package/dist/typeshed-fallback/stdlib/compression/zstd/_zstdfile.pyi +117 -117
  37. package/dist/typeshed-fallback/stdlib/concurrent/futures/interpreter.pyi +79 -79
  38. package/dist/typeshed-fallback/stdlib/concurrent/futures/thread.pyi +8 -8
  39. package/dist/typeshed-fallback/stdlib/concurrent/interpreters/__init__.pyi +68 -68
  40. package/dist/typeshed-fallback/stdlib/concurrent/interpreters/_crossinterp.pyi +30 -30
  41. package/dist/typeshed-fallback/stdlib/concurrent/interpreters/_queues.pyi +74 -74
  42. package/dist/typeshed-fallback/stdlib/ctypes/__init__.pyi +7 -1
  43. package/dist/typeshed-fallback/stdlib/datetime.pyi +6 -2
  44. package/dist/typeshed-fallback/stdlib/decimal.pyi +12 -1
  45. package/dist/typeshed-fallback/stdlib/faulthandler.pyi +7 -5
  46. package/dist/typeshed-fallback/stdlib/functools.pyi +5 -9
  47. package/dist/typeshed-fallback/stdlib/gc.pyi +1 -1
  48. package/dist/typeshed-fallback/stdlib/marshal.pyi +6 -6
  49. package/dist/typeshed-fallback/stdlib/math.pyi +1 -3
  50. package/dist/typeshed-fallback/stdlib/multiprocessing/managers.pyi +3 -1
  51. package/dist/typeshed-fallback/stdlib/numbers.pyi +2 -10
  52. package/dist/typeshed-fallback/stdlib/os/__init__.pyi +15 -1
  53. package/dist/typeshed-fallback/stdlib/pathlib/__init__.pyi +6 -1
  54. package/dist/typeshed-fallback/stdlib/pathlib/types.pyi +8 -8
  55. package/dist/typeshed-fallback/stdlib/pyexpat/__init__.pyi +1 -1
  56. package/dist/typeshed-fallback/stdlib/string/templatelib.pyi +46 -36
  57. package/dist/typeshed-fallback/stdlib/sys/__init__.pyi +25 -2
  58. package/dist/typeshed-fallback/stdlib/tkinter/__init__.pyi +7 -1
  59. package/dist/typeshed-fallback/stdlib/types.pyi +22 -8
  60. package/dist/typeshed-fallback/stdlib/unicodedata.pyi +2 -2
  61. package/dist/typeshed-fallback/stdlib/winsound.pyi +4 -0
  62. package/dist/typeshed-fallback/stdlib/xxlimited.pyi +3 -16
  63. package/package.json +1 -1
@@ -31,7 +31,31 @@ if sys.platform != "win32":
31
31
  child_umask: int,
32
32
  preexec_fn: Callable[[], None],
33
33
  /,
34
- ) -> int: ...
34
+ ) -> int:
35
+ """
36
+ Spawn a fresh new child process.
37
+
38
+ Fork a child process, close parent file descriptors as appropriate in the
39
+ child and duplicate the few that are needed before calling exec() in the
40
+ child process.
41
+
42
+ If close_fds is True, close file descriptors 3 and higher, except those listed
43
+ in the sorted tuple pass_fds.
44
+
45
+ The preexec_fn, if supplied, will be called immediately before closing file
46
+ descriptors and exec.
47
+
48
+ WARNING: preexec_fn is NOT SAFE if your application uses threads.
49
+ It may trigger infrequent, difficult to debug deadlocks.
50
+
51
+ If an error occurs in the child process before the exec, it is
52
+ serialized and written to the errpipe_write fd per subprocess.py.
53
+
54
+ Returns: the child process's PID.
55
+
56
+ Raises: Only on an error in the parent process.
57
+ """
58
+ ...
35
59
  else:
36
60
  def fork_exec(
37
61
  args: Sequence[StrOrBytesPath] | None,
@@ -58,28 +82,4 @@ if sys.platform != "win32":
58
82
  preexec_fn: Callable[[], None],
59
83
  allow_vfork: bool,
60
84
  /,
61
- ) -> int:
62
- """
63
- Spawn a fresh new child process.
64
-
65
- Fork a child process, close parent file descriptors as appropriate in the
66
- child and duplicate the few that are needed before calling exec() in the
67
- child process.
68
-
69
- If close_fds is True, close file descriptors 3 and higher, except those listed
70
- in the sorted tuple pass_fds.
71
-
72
- The preexec_fn, if supplied, will be called immediately before closing file
73
- descriptors and exec.
74
-
75
- WARNING: preexec_fn is NOT SAFE if your application uses threads.
76
- It may trigger infrequent, difficult to debug deadlocks.
77
-
78
- If an error occurs in the child process before the exec, it is
79
- serialized and written to the errpipe_write fd per subprocess.py.
80
-
81
- Returns: the child process's PID.
82
-
83
- Raises: Only on an error in the parent process.
84
- """
85
- ...
85
+ ) -> int: ...
@@ -1249,21 +1249,13 @@ def getservbyport(port: int, protocolname: str = ..., /) -> str:
1249
1249
  """
1250
1250
  ...
1251
1251
  def ntohl(x: int, /) -> int:
1252
- """
1253
- ntohl(integer) -> integer
1254
-
1255
- Convert a 32-bit integer from network to host byte order.
1256
- """
1252
+ """Convert a 32-bit unsigned integer from network to host byte order."""
1257
1253
  ...
1258
1254
  def ntohs(x: int, /) -> int:
1259
1255
  """Convert a 16-bit unsigned integer from network to host byte order."""
1260
1256
  ...
1261
1257
  def htonl(x: int, /) -> int:
1262
- """
1263
- htonl(integer) -> integer
1264
-
1265
- Convert a 32-bit integer from host to network byte order.
1266
- """
1258
+ """Convert a 32-bit unsigned integer from host to network byte order."""
1267
1259
  ...
1268
1260
  def htons(x: int, /) -> int:
1269
1261
  """Convert a 16-bit unsigned integer from host to network byte order."""
@@ -1366,15 +1358,11 @@ def if_nametoindex(oname: str, /) -> int:
1366
1358
  ...
1367
1359
 
1368
1360
  if sys.version_info >= (3, 14):
1369
- def if_indextoname(if_index: int, /) -> str: ...
1361
+ def if_indextoname(if_index: int, /) -> str:
1362
+ """Returns the interface name corresponding to the interface index if_index."""
1363
+ ...
1370
1364
 
1371
1365
  else:
1372
- def if_indextoname(index: int, /) -> str:
1373
- """
1374
- if_indextoname(if_index)
1375
-
1376
- Returns the interface name corresponding to the interface index if_index.
1377
- """
1378
- ...
1366
+ def if_indextoname(index: int, /) -> str: ...
1379
1367
 
1380
1368
  CAPI: CapsuleType
@@ -31,7 +31,7 @@ S_IROTH: read by others
31
31
  S_IWOTH: write by others
32
32
  S_IXOTH: execute by others
33
33
 
34
- UF_SETTABLE: mask of owner changable flags
34
+ UF_SETTABLE: mask of owner changeable flags
35
35
  UF_NODUMP: do not dump file
36
36
  UF_IMMUTABLE: file may not be changed
37
37
  UF_APPEND: file may only be appended to
@@ -62,7 +62,13 @@ class RLock:
62
62
  """Release the lock."""
63
63
  ...
64
64
  if sys.version_info >= (3, 14):
65
- def locked(self) -> bool: ...
65
+ def locked(self) -> bool:
66
+ """
67
+ locked()
68
+
69
+ Return a boolean indicating whether this object is locked right now.
70
+ """
71
+ ...
66
72
 
67
73
  if sys.version_info >= (3, 13):
68
74
  @final
@@ -304,7 +310,9 @@ if sys.version_info >= (3, 12):
304
310
  ...
305
311
 
306
312
  if sys.version_info >= (3, 14):
307
- def set_name(name: str) -> None: ...
313
+ def set_name(name: str) -> None:
314
+ """Set the name of the current thread."""
315
+ ...
308
316
 
309
317
  @disjoint_base
310
318
  class _local:
@@ -1,97 +1,300 @@
1
- from _typeshed import ReadableBuffer
2
- from collections.abc import Mapping
3
- from compression.zstd import CompressionParameter, DecompressionParameter
4
- from typing import Final, Literal, final
5
- from typing_extensions import Self, TypeAlias
6
-
7
- ZSTD_CLEVEL_DEFAULT: Final = 3
8
- ZSTD_DStreamOutSize: Final = 131072
9
- ZSTD_btlazy2: Final = 6
10
- ZSTD_btopt: Final = 7
11
- ZSTD_btultra: Final = 8
12
- ZSTD_btultra2: Final = 9
13
- ZSTD_c_chainLog: Final = 103
14
- ZSTD_c_checksumFlag: Final = 201
15
- ZSTD_c_compressionLevel: Final = 100
16
- ZSTD_c_contentSizeFlag: Final = 200
17
- ZSTD_c_dictIDFlag: Final = 202
18
- ZSTD_c_enableLongDistanceMatching: Final = 160
19
- ZSTD_c_hashLog: Final = 102
20
- ZSTD_c_jobSize: Final = 401
21
- ZSTD_c_ldmBucketSizeLog: Final = 163
22
- ZSTD_c_ldmHashLog: Final = 161
23
- ZSTD_c_ldmHashRateLog: Final = 164
24
- ZSTD_c_ldmMinMatch: Final = 162
25
- ZSTD_c_minMatch: Final = 105
26
- ZSTD_c_nbWorkers: Final = 400
27
- ZSTD_c_overlapLog: Final = 402
28
- ZSTD_c_searchLog: Final = 104
29
- ZSTD_c_strategy: Final = 107
30
- ZSTD_c_targetLength: Final = 106
31
- ZSTD_c_windowLog: Final = 101
32
- ZSTD_d_windowLogMax: Final = 100
33
- ZSTD_dfast: Final = 2
34
- ZSTD_fast: Final = 1
35
- ZSTD_greedy: Final = 3
36
- ZSTD_lazy: Final = 4
37
- ZSTD_lazy2: Final = 5
38
-
39
- _ZstdCompressorContinue: TypeAlias = Literal[0]
40
- _ZstdCompressorFlushBlock: TypeAlias = Literal[1]
41
- _ZstdCompressorFlushFrame: TypeAlias = Literal[2]
42
-
43
- @final
44
- class ZstdCompressor:
45
- CONTINUE: Final = 0
46
- FLUSH_BLOCK: Final = 1
47
- FLUSH_FRAME: Final = 2
48
- def __new__(
49
- cls, level: int | None = None, options: Mapping[int, int] | None = None, zstd_dict: ZstdDict | None = None
50
- ) -> Self: ...
51
- def compress(
52
- self, /, data: ReadableBuffer, mode: _ZstdCompressorContinue | _ZstdCompressorFlushBlock | _ZstdCompressorFlushFrame = 0
53
- ) -> bytes: ...
54
- def flush(self, /, mode: _ZstdCompressorFlushBlock | _ZstdCompressorFlushFrame = 2) -> bytes: ...
55
- def set_pledged_input_size(self, size: int | None, /) -> None: ...
56
- @property
57
- def last_mode(self) -> _ZstdCompressorContinue | _ZstdCompressorFlushBlock | _ZstdCompressorFlushFrame: ...
58
-
59
- @final
60
- class ZstdDecompressor:
61
- def __new__(cls, zstd_dict: ZstdDict | None = None, options: Mapping[int, int] | None = None) -> Self: ...
62
- def decompress(self, /, data: ReadableBuffer, max_length: int = -1) -> bytes: ...
63
- @property
64
- def eof(self) -> bool: ...
65
- @property
66
- def needs_input(self) -> bool: ...
67
- @property
68
- def unused_data(self) -> bytes: ...
69
-
70
- @final
71
- class ZstdDict:
72
- def __new__(cls, dict_content: bytes, /, *, is_raw: bool = False) -> Self: ...
73
- def __len__(self, /) -> int: ...
74
- @property
75
- def as_digested_dict(self) -> tuple[Self, int]: ...
76
- @property
77
- def as_prefix(self) -> tuple[Self, int]: ...
78
- @property
79
- def as_undigested_dict(self) -> tuple[Self, int]: ...
80
- @property
81
- def dict_content(self) -> bytes: ...
82
- @property
83
- def dict_id(self) -> int: ...
84
-
85
- class ZstdError(Exception): ...
86
-
87
- def finalize_dict(
88
- custom_dict_bytes: bytes, samples_bytes: bytes, samples_sizes: tuple[int, ...], dict_size: int, compression_level: int, /
89
- ) -> bytes: ...
90
- def get_frame_info(frame_buffer: ReadableBuffer) -> tuple[int, int]: ...
91
- def get_frame_size(frame_buffer: ReadableBuffer) -> int: ...
92
- def get_param_bounds(parameter: int, is_compress: bool) -> tuple[int, int]: ...
93
- def set_parameter_types(c_parameter_type: type[CompressionParameter], d_parameter_type: type[DecompressionParameter]) -> None: ...
94
- def train_dict(samples_bytes: bytes, samples_sizes: tuple[int, ...], dict_size: int, /) -> bytes: ...
95
-
96
- zstd_version: Final[str]
97
- zstd_version_number: Final[int]
1
+ """Implementation module for Zstandard compression."""
2
+
3
+ from _typeshed import ReadableBuffer
4
+ from collections.abc import Mapping
5
+ from compression.zstd import CompressionParameter, DecompressionParameter
6
+ from typing import Final, Literal, final
7
+ from typing_extensions import Self, TypeAlias
8
+
9
+ ZSTD_CLEVEL_DEFAULT: Final = 3
10
+ ZSTD_DStreamOutSize: Final = 131072
11
+ ZSTD_btlazy2: Final = 6
12
+ ZSTD_btopt: Final = 7
13
+ ZSTD_btultra: Final = 8
14
+ ZSTD_btultra2: Final = 9
15
+ ZSTD_c_chainLog: Final = 103
16
+ ZSTD_c_checksumFlag: Final = 201
17
+ ZSTD_c_compressionLevel: Final = 100
18
+ ZSTD_c_contentSizeFlag: Final = 200
19
+ ZSTD_c_dictIDFlag: Final = 202
20
+ ZSTD_c_enableLongDistanceMatching: Final = 160
21
+ ZSTD_c_hashLog: Final = 102
22
+ ZSTD_c_jobSize: Final = 401
23
+ ZSTD_c_ldmBucketSizeLog: Final = 163
24
+ ZSTD_c_ldmHashLog: Final = 161
25
+ ZSTD_c_ldmHashRateLog: Final = 164
26
+ ZSTD_c_ldmMinMatch: Final = 162
27
+ ZSTD_c_minMatch: Final = 105
28
+ ZSTD_c_nbWorkers: Final = 400
29
+ ZSTD_c_overlapLog: Final = 402
30
+ ZSTD_c_searchLog: Final = 104
31
+ ZSTD_c_strategy: Final = 107
32
+ ZSTD_c_targetLength: Final = 106
33
+ ZSTD_c_windowLog: Final = 101
34
+ ZSTD_d_windowLogMax: Final = 100
35
+ ZSTD_dfast: Final = 2
36
+ ZSTD_fast: Final = 1
37
+ ZSTD_greedy: Final = 3
38
+ ZSTD_lazy: Final = 4
39
+ ZSTD_lazy2: Final = 5
40
+
41
+ _ZstdCompressorContinue: TypeAlias = Literal[0]
42
+ _ZstdCompressorFlushBlock: TypeAlias = Literal[1]
43
+ _ZstdCompressorFlushFrame: TypeAlias = Literal[2]
44
+
45
+ @final
46
+ class ZstdCompressor:
47
+ CONTINUE: Final = 0
48
+ FLUSH_BLOCK: Final = 1
49
+ FLUSH_FRAME: Final = 2
50
+ def __new__(
51
+ cls, level: int | None = None, options: Mapping[int, int] | None = None, zstd_dict: ZstdDict | None = None
52
+ ) -> Self: ...
53
+ def compress(
54
+ self, /, data: ReadableBuffer, mode: _ZstdCompressorContinue | _ZstdCompressorFlushBlock | _ZstdCompressorFlushFrame = 0
55
+ ) -> bytes:
56
+ """
57
+ Provide data to the compressor object.
58
+
59
+ mode
60
+ Can be these 3 values ZstdCompressor.CONTINUE,
61
+ ZstdCompressor.FLUSH_BLOCK, ZstdCompressor.FLUSH_FRAME
62
+
63
+ Return a chunk of compressed data if possible, or b'' otherwise. When you have
64
+ finished providing data to the compressor, call the flush() method to finish
65
+ the compression process.
66
+ """
67
+ ...
68
+ def flush(self, /, mode: _ZstdCompressorFlushBlock | _ZstdCompressorFlushFrame = 2) -> bytes:
69
+ """
70
+ Finish the compression process.
71
+
72
+ mode
73
+ Can be these 2 values ZstdCompressor.FLUSH_FRAME,
74
+ ZstdCompressor.FLUSH_BLOCK
75
+
76
+ Flush any remaining data left in internal buffers. Since Zstandard data
77
+ consists of one or more independent frames, the compressor object can still
78
+ be used after this method is called.
79
+ """
80
+ ...
81
+ def set_pledged_input_size(self, size: int | None, /) -> None:
82
+ """
83
+ Set the uncompressed content size to be written into the frame header.
84
+
85
+ size
86
+ The size of the uncompressed data to be provided to the compressor.
87
+
88
+ This method can be used to ensure the header of the frame about to be written
89
+ includes the size of the data, unless the CompressionParameter.content_size_flag
90
+ is set to False. If last_mode != FLUSH_FRAME, then a RuntimeError is raised.
91
+
92
+ It is important to ensure that the pledged data size matches the actual data
93
+ size. If they do not match the compressed output data may be corrupted and the
94
+ final chunk written may be lost.
95
+ """
96
+ ...
97
+ @property
98
+ def last_mode(self) -> _ZstdCompressorContinue | _ZstdCompressorFlushBlock | _ZstdCompressorFlushFrame:
99
+ """
100
+ The last mode used to this compressor object, its value can be .CONTINUE,
101
+ .FLUSH_BLOCK, .FLUSH_FRAME. Initialized to .FLUSH_FRAME.
102
+
103
+ It can be used to get the current state of a compressor, such as, data
104
+ flushed, or a frame ended.
105
+ """
106
+ ...
107
+
108
+ @final
109
+ class ZstdDecompressor:
110
+ def __new__(cls, zstd_dict: ZstdDict | None = None, options: Mapping[int, int] | None = None) -> Self: ...
111
+ def decompress(self, /, data: ReadableBuffer, max_length: int = -1) -> bytes:
112
+ """
113
+ Decompress *data*, returning uncompressed bytes if possible, or b'' otherwise.
114
+
115
+ data
116
+ A bytes-like object, Zstandard data to be decompressed.
117
+ max_length
118
+ Maximum size of returned data. When it is negative, the size of
119
+ output buffer is unlimited. When it is nonnegative, returns at
120
+ most max_length bytes of decompressed data.
121
+
122
+ If *max_length* is nonnegative, returns at most *max_length* bytes of
123
+ decompressed data. If this limit is reached and further output can be
124
+ produced, *self.needs_input* will be set to ``False``. In this case, the next
125
+ call to *decompress()* may provide *data* as b'' to obtain more of the output.
126
+
127
+ If all of the input data was decompressed and returned (either because this
128
+ was less than *max_length* bytes, or because *max_length* was negative),
129
+ *self.needs_input* will be set to True.
130
+
131
+ Attempting to decompress data after the end of a frame is reached raises an
132
+ EOFError. Any data found after the end of the frame is ignored and saved in
133
+ the self.unused_data attribute.
134
+ """
135
+ ...
136
+ @property
137
+ def eof(self) -> bool:
138
+ """
139
+ True means the end of the first frame has been reached. If decompress data
140
+ after that, an EOFError exception will be raised.
141
+ """
142
+ ...
143
+ @property
144
+ def needs_input(self) -> bool:
145
+ """
146
+ If the max_length output limit in .decompress() method has been reached,
147
+ and the decompressor has (or may has) unconsumed input data, it will be set
148
+ to False. In this case, passing b'' to the .decompress() method may output
149
+ further data.
150
+ """
151
+ ...
152
+ @property
153
+ def unused_data(self) -> bytes:
154
+ """
155
+ A bytes object of un-consumed input data.
156
+
157
+ When ZstdDecompressor object stops after a frame is
158
+ decompressed, unused input data after the frame. Otherwise this will be b''.
159
+ """
160
+ ...
161
+
162
+ @final
163
+ class ZstdDict:
164
+ def __new__(cls, dict_content: bytes, /, *, is_raw: bool = False) -> Self: ...
165
+ def __len__(self, /) -> int:
166
+ """Return len(self)."""
167
+ ...
168
+ @property
169
+ def as_digested_dict(self) -> tuple[Self, int]:
170
+ """
171
+ Load as a digested dictionary to compressor.
172
+
173
+ Pass this attribute as zstd_dict argument:
174
+ compress(dat, zstd_dict=zd.as_digested_dict)
175
+
176
+ 1. Some advanced compression parameters of compressor may be overridden
177
+ by parameters of digested dictionary.
178
+ 2. ZstdDict has a digested dictionaries cache for each compression level.
179
+ It's faster when loading again a digested dictionary with the same
180
+ compression level.
181
+ 3. No need to use this for decompression.
182
+ """
183
+ ...
184
+ @property
185
+ def as_prefix(self) -> tuple[Self, int]:
186
+ """
187
+ Load as a prefix to compressor/decompressor.
188
+
189
+ Pass this attribute as zstd_dict argument:
190
+ compress(dat, zstd_dict=zd.as_prefix)
191
+
192
+ 1. Prefix is compatible with long distance matching, while dictionary is not.
193
+ 2. It only works for the first frame, then the compressor/decompressor will
194
+ return to no prefix state.
195
+ 3. When decompressing, must use the same prefix as when compressing.
196
+ """
197
+ ...
198
+ @property
199
+ def as_undigested_dict(self) -> tuple[Self, int]:
200
+ """
201
+ Load as an undigested dictionary to compressor.
202
+
203
+ Pass this attribute as zstd_dict argument:
204
+ compress(dat, zstd_dict=zd.as_undigested_dict)
205
+
206
+ 1. The advanced compression parameters of compressor will not be overridden.
207
+ 2. Loading an undigested dictionary is costly. If load an undigested dictionary
208
+ multiple times, consider reusing a compressor object.
209
+ 3. No need to use this for decompression.
210
+ """
211
+ ...
212
+ @property
213
+ def dict_content(self) -> bytes:
214
+ """The content of a Zstandard dictionary, as a bytes object."""
215
+ ...
216
+ @property
217
+ def dict_id(self) -> int:
218
+ """
219
+ The Zstandard dictionary, an int between 0 and 2**32.
220
+
221
+ A non-zero value represents an ordinary Zstandard dictionary,
222
+ conforming to the standardised format.
223
+
224
+ A value of zero indicates a 'raw content' dictionary,
225
+ without any restrictions on format or content.
226
+ """
227
+ ...
228
+
229
+ class ZstdError(Exception): ...
230
+
231
+ def finalize_dict(
232
+ custom_dict_bytes: bytes, samples_bytes: bytes, samples_sizes: tuple[int, ...], dict_size: int, compression_level: int, /
233
+ ) -> bytes:
234
+ """
235
+ Finalize a Zstandard dictionary.
236
+
237
+ custom_dict_bytes
238
+ Custom dictionary content.
239
+ samples_bytes
240
+ Concatenation of samples.
241
+ samples_sizes
242
+ Tuple of samples' sizes.
243
+ dict_size
244
+ The size of the dictionary.
245
+ compression_level
246
+ Optimize for a specific Zstandard compression level, 0 means default.
247
+ """
248
+ ...
249
+ def get_frame_info(frame_buffer: ReadableBuffer) -> tuple[int, int]:
250
+ """
251
+ Get Zstandard frame infomation from a frame header.
252
+
253
+ frame_buffer
254
+ A bytes-like object, containing the header of a Zstandard frame.
255
+ """
256
+ ...
257
+ def get_frame_size(frame_buffer: ReadableBuffer) -> int:
258
+ """
259
+ Get the size of a Zstandard frame, including the header and optional checksum.
260
+
261
+ frame_buffer
262
+ A bytes-like object, it should start from the beginning of a frame,
263
+ and contains at least one complete frame.
264
+ """
265
+ ...
266
+ def get_param_bounds(parameter: int, is_compress: bool) -> tuple[int, int]:
267
+ """
268
+ Get CompressionParameter/DecompressionParameter bounds.
269
+
270
+ parameter
271
+ The parameter to get bounds.
272
+ is_compress
273
+ True for CompressionParameter, False for DecompressionParameter.
274
+ """
275
+ ...
276
+ def set_parameter_types(c_parameter_type: type[CompressionParameter], d_parameter_type: type[DecompressionParameter]) -> None:
277
+ """
278
+ Set CompressionParameter and DecompressionParameter types for validity check.
279
+
280
+ c_parameter_type
281
+ CompressionParameter IntEnum type object
282
+ d_parameter_type
283
+ DecompressionParameter IntEnum type object
284
+ """
285
+ ...
286
+ def train_dict(samples_bytes: bytes, samples_sizes: tuple[int, ...], dict_size: int, /) -> bytes:
287
+ """
288
+ Train a Zstandard dictionary on sample data.
289
+
290
+ samples_bytes
291
+ Concatenation of samples.
292
+ samples_sizes
293
+ Tuple of samples' sizes.
294
+ dict_size
295
+ The size of the dictionary.
296
+ """
297
+ ...
298
+
299
+ zstd_version: Final[str]
300
+ zstd_version_number: Final[int]