-
-
Notifications
You must be signed in to change notification settings - Fork 33.1k
zlib.rst
: Link to constants and deduplicate text
#140115
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
Open
StanFromIreland
wants to merge
2
commits into
python:main
Choose a base branch
from
StanFromIreland:zlib-doc
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -58,21 +58,20 @@ The available exception and functions in this module are: | |
|
||
.. versionadded:: next | ||
|
||
.. function:: compress(data, /, level=-1, wbits=MAX_WBITS) | ||
.. function:: compress(data, /, level=Z_DEFAULT_COMPRESSION, wbits=MAX_WBITS) | ||
|
||
Compresses the bytes in *data*, returning a bytes object containing compressed data. | ||
*level* is an integer from ``0`` to ``9`` or ``-1`` controlling the level of compression; | ||
``1`` (Z_BEST_SPEED) is fastest and produces the least compression, ``9`` (Z_BEST_COMPRESSION) | ||
is slowest and produces the most. ``0`` (Z_NO_COMPRESSION) is no compression. | ||
The default value is ``-1`` (Z_DEFAULT_COMPRESSION). Z_DEFAULT_COMPRESSION represents a default | ||
compromise between speed and compression (currently equivalent to level 6). | ||
See :const:`Z_BEST_SPEED` (``1``), :const:`Z_BEST_COMPRESSION` (``9``), | ||
:const:`Z_NO_COMPRESSION` (``0``), and the default, | ||
:const:`Z_DEFAULT_COMPRESSION` (``-1``) for more information about these values. | ||
|
||
.. _compress-wbits: | ||
|
||
The *wbits* argument controls the size of the history buffer (or the | ||
"window size") used when compressing data, and whether a header and | ||
trailer is included in the output. It can take several ranges of values, | ||
defaulting to ``15`` (MAX_WBITS): | ||
defaulting to ``15`` (:const:`MAX_WBITS`): | ||
|
||
* +9 to +15: The base-two logarithm of the window size, which | ||
therefore ranges between 512 and 32768. Larger values produce | ||
|
@@ -96,17 +95,15 @@ The available exception and functions in this module are: | |
The *wbits* parameter is now available to set window bits and | ||
compression type. | ||
|
||
.. function:: compressobj(level=-1, method=DEFLATED, wbits=MAX_WBITS, memLevel=DEF_MEM_LEVEL, strategy=Z_DEFAULT_STRATEGY[, zdict]) | ||
.. function:: compressobj(level=Z_DEFAULT_COMPRESSION, method=DEFLATED, wbits=MAX_WBITS, memLevel=DEF_MEM_LEVEL, strategy=Z_DEFAULT_STRATEGY[, zdict]) | ||
|
||
Returns a compression object, to be used for compressing data streams that won't | ||
fit into memory at once. | ||
|
||
*level* is the compression level -- an integer from ``0`` to ``9`` or ``-1``. | ||
A value of ``1`` (Z_BEST_SPEED) is fastest and produces the least compression, | ||
while a value of ``9`` (Z_BEST_COMPRESSION) is slowest and produces the most. | ||
``0`` (Z_NO_COMPRESSION) is no compression. The default value is ``-1`` (Z_DEFAULT_COMPRESSION). | ||
Z_DEFAULT_COMPRESSION represents a default compromise between speed and compression | ||
(currently equivalent to level 6). | ||
See :const:`Z_BEST_SPEED` (``1``), :const:`Z_BEST_COMPRESSION` (``9``), | ||
:const:`Z_NO_COMPRESSION` (``0``), and the default, | ||
:const:`Z_DEFAULT_COMPRESSION` (``-1``) for more information about these values. | ||
|
||
*method* is the compression algorithm. Currently, the only supported value is | ||
:const:`DEFLATED`. | ||
|
@@ -121,7 +118,7 @@ The available exception and functions in this module are: | |
|
||
*strategy* is used to tune the compression algorithm. Possible values are | ||
:const:`Z_DEFAULT_STRATEGY`, :const:`Z_FILTERED`, :const:`Z_HUFFMAN_ONLY`, | ||
:const:`Z_RLE` (zlib 1.2.0.1) and :const:`Z_FIXED` (zlib 1.2.2.2). | ||
:const:`Z_RLE` and :const:`Z_FIXED`. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think there is no need to reference version here, the information is now provided in the doc of the constant. |
||
|
||
*zdict* is a predefined compression dictionary. This is a sequence of bytes | ||
(such as a :class:`bytes` object) containing subsequences that are expected | ||
|
@@ -249,7 +246,7 @@ Compression objects support the following methods: | |
All pending input is processed, and a bytes object containing the remaining compressed | ||
output is returned. *mode* can be selected from the constants | ||
:const:`Z_NO_FLUSH`, :const:`Z_PARTIAL_FLUSH`, :const:`Z_SYNC_FLUSH`, | ||
:const:`Z_FULL_FLUSH`, :const:`Z_BLOCK` (zlib 1.2.3.4), or :const:`Z_FINISH`, | ||
:const:`Z_FULL_FLUSH`, :const:`Z_BLOCK`, or :const:`Z_FINISH`, | ||
defaulting to :const:`Z_FINISH`. Except :const:`Z_FINISH`, all constants | ||
allow compressing further bytestrings of data, while :const:`Z_FINISH` finishes the | ||
compressed stream and prevents compressing any more data. After calling :meth:`flush` | ||
|
@@ -367,24 +364,25 @@ behavior: | |
|
||
.. data:: Z_NO_COMPRESSION | ||
|
||
Compression level ``0``. | ||
Compression level ``0``; no compression. | ||
|
||
.. versionadded:: 3.6 | ||
|
||
|
||
.. data:: Z_BEST_SPEED | ||
|
||
Compression level ``1``. | ||
Compression level ``1``; fastest and produces the least compression. | ||
|
||
|
||
.. data:: Z_BEST_COMPRESSION | ||
|
||
Compression level ``9``. | ||
Compression level ``9``; slowest and produces the most compression. | ||
|
||
|
||
.. data:: Z_DEFAULT_COMPRESSION | ||
|
||
Default compression level (``-1``). | ||
Default compression level (``-1``); a compromise between speed and | ||
compression. Currently equivalent to compression level ``6``. | ||
|
||
|
||
.. data:: Z_DEFAULT_STRATEGY | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Per the clinic, this is what it defaults to. Ditto below.