Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

gh-132983: Add documentation for compression.zstd#133911

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
gpshead merged 23 commits intopython:mainfromemmatyping:zstd-docs
May 21, 2025
Merged
Changes from1 commit
Commits
Show all changes
23 commits
Select commitHold shift + click to select a range
49d9c30
Add documentation for compression.zstd
emmatypingMay 12, 2025
62ef4dc
Add examples
emmatypingMay 12, 2025
0b154b1
Fix camelcase name references
emmatypingMay 12, 2025
63f963f
CParameter->CompressionParameter
emmatypingMay 12, 2025
cfe0590
Apply suggestions from AA-Turner
emmatypingMay 12, 2025
5115b4c
Apply suggestions from reviewers
emmatypingMay 12, 2025
4ab7fd7
Apply suggestions from reviewers
emmatypingMay 12, 2025
5eb5efc
Apply suggestions from reviewers
emmatypingMay 14, 2025
987bd27
Don't reference self when referring to items
emmatypingMay 14, 2025
615ed7f
Updates to respond to review
emmatypingMay 14, 2025
0f7bc05
Remove outdated paragraph
emmatypingMay 15, 2025
44173f3
Remove Zstandard dictionary after ZstdDict
emmatypingMay 16, 2025
8bd5500
Rewrite introduction to compression package to be more timeless
emmatypingMay 18, 2025
24f3761
Remove content_size_flag
emmatypingMay 18, 2025
d04ce4f
Merge branch 'zstd-docs' of github.com:emmatyping/cpython into zstd-docs
emmatypingMay 18, 2025
e61e9a1
Apply suggestions from Sumana and Stan
emmatypingMay 19, 2025
1149832
Remove ref to Meta and clean up mode usage
emmatypingMay 20, 2025
71ed7c3
Apply suggestions from vadmium
emmatypingMay 20, 2025
2f895dd
Many updates to respond to review
emmatypingMay 20, 2025
f25e6e7
Add examples to (De)compressionParameter
emmatypingMay 20, 2025
9ff6320
Add reference to zstd manual and blurb on algorithm
emmatypingMay 20, 2025
daa9df1
Expand on the connection between level and compression_level
emmatypingMay 21, 2025
b3fd3cd
Resolve review suggestions
emmatypingMay 21, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
PrevPrevious commit
NextNext commit
Apply suggestions from vadmium
Co-authored-by: Martin Panter <vadmium@users.noreply.github.com>
  • Loading branch information
@emmatyping@vadmium
emmatyping andvadmium authoredMay 20, 2025
commit71ed7c3b5efdd6ac77b5ad8e277be9a05324f36e
28 changes: 14 additions & 14 deletionsDoc/library/compression.zstd.rst
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -65,7 +65,7 @@ Reading and writing compressed files
:class:`DecompressionParameter` for detailed information about supported
parameters. The *zstd_dict* argument is a :class:`ZstdDict` instance to be
used during decompression. When opening a file for reading, if the *level*
argument ispassed, a :exc:`!TypeError` will be raised.
argument isnot None, a :exc:`!TypeError` will be raised.

When opening a file for writing, the *options* argument can be a dictionary
providing advanced decompression parameters; see
Expand DownExpand Up@@ -105,9 +105,9 @@ Reading and writing compressed files
``'w'`` does not truncate the file, and is instead equivalent to ``'a'``.

When opening a file for reading, the *options* argument can be a dictionary
providing advanced decompression parameters, see
providing advanced decompression parameters; see
:class:`DecompressionParameter` for detailed information about supported
parameters. The *zstd_dict* argument is a :class:`!ZstdDict` instance to be
parameters. The *zstd_dict* argument is a :class:`ZstdDict` instance to be
used during decompression. When opening a file for reading, if the *level*
argument is passed a :exc:`!TypeError` will be raised.

Expand DownExpand Up@@ -205,7 +205,7 @@ Compressing and decompressing data in memory
parameters. The valid keys and values for compression parameters are
documented as part of the :class:`CompressionParameter` documentation.

The *zstd_dict* argument is an instance of :class:`ZstdDict`
The *zstd_dict* argument is anoptionalinstance of :class:`ZstdDict`
containing trained data to improve compression efficiency. The
function :func:`train_dict` can be used to generate a Zstandard dictionary.

Expand DownExpand Up@@ -285,7 +285,7 @@ Compressing and decompressing data in memory
The returned data should be concatenated with the output of any previous
calls to :meth:`!decompress`.

If *max_length* is non-negative, returns at most *max_length*
If *max_length* is non-negative,the methodreturns at most *max_length*
bytes of decompressed data. If this limit is reached and further
output can be produced, the :attr:`~.needs_input` attribute will
be set to ``False``. In this case, the next call to
Expand DownExpand Up@@ -314,7 +314,7 @@ Compressing and decompressing data in memory
.. attribute:: needs_input

``False`` if the :meth:`.decompress` method can provide more
decompressed data before requiring newuncompressed input.
decompressed data before requiring newcompressed input.


Zstandard dictionaries
Expand All@@ -330,7 +330,7 @@ Zstandard dictionaries
files), Zstandard dictionaries can improve compression ratios and speed
significantly.

The *samples* argument (an iterable of :class:`bytes`), is the population of
The *samples* argument (an iterable of :class:`bytes` objects), is the population of
samples used to train the Zstandard dictionary.

The *dict_size* argument, an integer, is the maximum size (in bytes) the
Expand DownExpand Up@@ -421,7 +421,7 @@ Zstandard dictionaries

.. attribute:: dict_id

Identifier of the Zstandard dictionary,anint value between zero and.
Identifier of the Zstandard dictionary,a non-negativeint value.

Non-zero means the dictionary is ordinary, created by Zstandard
functions and following the Zstandard format.
Expand All@@ -437,7 +437,7 @@ Zstandard dictionaries

.. attribute:: as_digested_dict

Load as a digested dictionary, see below.
Load as a digested dictionary.

.. attribute:: as_undigested_dict

Expand All@@ -450,7 +450,7 @@ Advanced parameter control
.. class:: CompressionParameter()

An :class:`~enum.IntEnum` containing the advanced compression parameter
names that can be used when compressing data.
keys that can be used when compressing data.

The :meth:`~.bounds` method can be used on any attribute to get the valid
values for that parameter.
Expand All@@ -472,7 +472,7 @@ Advanced parameter control

A high-level means of setting other compression parameters that affect
the speed and ratio of compressing data. Setting the level to zero uses
the default:attr:`COMPRESSION_LEVEL_DEFAULT`.
:attr:`COMPRESSION_LEVEL_DEFAULT`.

.. attribute:: window_log

Expand DownExpand Up@@ -509,7 +509,7 @@ Advanced parameter control
decompression speed, but decrease ratio. Note that Zstandard can still
find matches of smaller size, it just tweaks its search algorithm to look
for this size and larger. For all strategies < :attr:`~Strategy.btopt`,
the effective minimum is ``4``, for all strategies
the effective minimum is ``4``; for all strategies
> :attr:`~Strategy.fast`, the effective maximum is ``6``.

.. attribute:: target_length
Expand DownExpand Up@@ -621,13 +621,13 @@ Advanced parameter control
parameter. This method should be called on the attribute you wish to
retrieve the bounds of. For example, to get the valid values for
:attr:`~.window_log_max`, one may check the result of
``CompressionParameter.window_log_max.bounds()``.
``DecompressionParameter.window_log_max.bounds()``.

Both the lower and upper bounds are inclusive.

.. attribute:: window_log_max

Thepoweroftwo maximum size of the window used during decompression.
Thebase-two logarithmofthe maximum size of the window used during decompression.
This can be useful to limit the amount of memory used when decompressing
data.

Expand Down
Loading

[8]ページ先頭

©2009-2025 Movatter.jp