8000 gh-132983: Add documentation for compression.zstd by emmatyping · Pull Request #133911 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-132983: Add documentation for compression.zstd 8000 #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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 23 commits into from
May 21, 2025
Merged
Changes from 1 commit
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
49d9c30
Add documentation for compression.zstd
emmatyping May 12, 2025
62ef4dc
Add examples
emmatyping May 12, 2025
0b154b1
Fix camelcase name references
emmatyping May 12, 2025
63f963f
CParameter->CompressionParameter
emmatyping May 12, 2025
cfe0590
Apply suggestions from AA-Turner
emmatyping May 12, 2025
5115b4c
Apply suggestions from reviewers
emmatyping May 12, 2025
4ab7fd7
Apply suggestions from reviewers
emmatyping May 12, 2025
5eb5efc
Apply suggestions from reviewers
emmatyping May 14, 2025
987bd27
Don't reference self when referring to items
emmatyping May 14, 2025
615ed7f
Updates to respond to review
emmatyping May 14, 2025
0f7bc05
Remove outdated paragraph
emmatyping May 15, 2025
44173f3
Remove Zstandard dictionary after ZstdDict
emmatyping May 16, 2025
8bd5500
Rewrite introduction to compression package to be more timeless
emmatyping May 18, 2025
24f3761
Remove content_size_flag
emmatyping May 18, 2025
d04ce4f
Merge branch 'zstd-docs' of github.com:emmatyping/cpython into zstd-docs
emmatyping May 18, 2025
e61e9a1
Apply suggestions from Sumana and Stan
emmatyping May 19, 2025
1149832
Remove ref to Meta and clean up mode usage
emmatyping May 20, 2025
71ed7c3
Apply suggestions from vadmium
emmatyping May 20, 2025
2f895dd
Many updates to respond to review
emmatyping May 20, 2025
f25e6e7
Add examples to (De)compressionParameter
emmatyping May 20, 2025
9ff6320
Add reference to zstd manual and blurb on algorithm
emmatyping May 20, 2025
daa9df1
Expand on the connection between level and compression_level
emmatyping May 21, 2025
b3fd3cd
Resolve review suggestions
emmatyping May 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
Prev Previous commit
Next Next commit
Don't reference self when referring to items
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
  • Loading branch information
emmatyping and hugovk authored May 14, 2025
commit 987bd2788c8d19df316bc445aa1e92beb55af818
18 changes: 9 additions & 9 deletions Doc/library/compression.zstd.rst
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ Reading and writing compressed files
When opening a file for reading, the *options* argument can be a dictionary
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, the *level*
argument should not be used.

Expand All @@ -111,13 +111,13 @@ Reading and writing compressed files
:class:`CompressionParameter` for detailed information about supported
parameters. The *level* argument is the compression level to use when
writing compressed data. Only one of *level* or *options* may be passed. The
*zstd_dict* argument is a :class:`ZstdDict` instance to be used during
*zstd_dict* argument is a :class:`!ZstdDict` instance to be used during
compression.

When opening a file for writing, the *options*, *zstd_dict* and *level*
arguments have the same meanings as for :class:`ZstdCompressor`.

:class:`ZstdFile` supports all the members specified by
:class:`!ZstdFile` supports all the members specified by
:class:`io.BufferedIOBase`, except for :meth:`~io.BufferedIOBase.detach`
and :meth:`~io.IOBase.truncate`.
Iteration and the :keyword:`with` statement are supported.
Expand Down Expand Up @@ -231,7 +231,7 @@ Compressing and decompressing data in memory
Compress *data* (a :term:`bytes-like object`), returning a :class:`bytes`
object if possible, or an empty byte string otherwise. Some of *data* may
be buffered internally, for use in later calls to
:meth:`~.compress` and :meth:`~.flush`. The
:meth:`!compress` and :meth:`~.flush`. The
returned data should be concatenated with the output of any previous calls
to :meth:`~.compress`.

Expand Down Expand Up @@ -273,15 +273,15 @@ Compressing and decompressing data in memory
compressed frames, unlike the :func:`decompress` function and
:class:`ZstdFile` class. To decompress a multi-frame input, you should
use :func:`decompress`, :class:`ZstdFile` if working with a
:term:`file object`, or multiple :class:`ZstdDecompressor` instances.
:term:`file object`, or multiple :class:`!ZstdDecompressor` instances.

.. method:: decompress(data, max_length=-1)

Decompress *data* (a :term:`bytes-like object`), returning
uncompressed data as bytes. Some of *data* may be buffered
internally, for use in later calls to :meth:`~.decompress`.
internally, for use in later calls to :meth:`!decompress`.
The returned data should be concatenated with the output of any previous
calls to :meth:`~.decompress`.
calls to :meth:`!decompress`.

If *max_length* is non-negative, returns at most *max_length*
bytes of decompressed data. If this limit is reached and further
Expand Down Expand Up @@ -395,7 +395,7 @@ Zstandard dictionaries

.. note::

The meaning of ``0`` for :attr:`ZstdDict.dict_id` is different from
The meaning of ``0`` for :attr:`!ZstdDict.dict_id` is different from
the ``dictionary_id`` argument to the :func:`get_frame_info`
function.

Expand Down Expand Up @@ -598,7 +598,7 @@ Advanced parameter control
.. attribute:: nb_workers

Select how many threads will be spawned to compress in parallel. When
:attr:`~.nb_workers` >= 1, enables multi-threaded compression, 1
:attr:`!nb_workers` >= 1, enables multi-threaded compression, 1
means "1-thread multi-threaded mode". More workers improve speed, but
also increase memory usage and slightly reduce compression ratio.

Expand Down
Loading
0