Skip to content

Commit 6b32c92

Browse files
Commit
1 parent 87eadce commit 6b32c92

File tree

1 file changed

+16
-18
lines changed

1 file changed

+16
-18
lines changed

Doc/library/zlib.rst

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -58,21 +58,20 @@ The available exception and functions in this module are:
5858

5959
.. versionadded:: next
6060

61-
.. function:: compress(data, /, level=-1, wbits=MAX_WBITS)
61+
.. function:: compress(data, /, level=Z_DEFAULT_COMPRESSION, wbits=MAX_WBITS)
6262

6363
Compresses the bytes in *data*, returning a bytes object containing compressed data.
6464
*level* is an integer from ``0`` to ``9`` or ``-1`` controlling the level of compression;
65-
``1`` (Z_BEST_SPEED) is fastest and produces the least compression, ``9`` (Z_BEST_COMPRESSION)
66-
is slowest and produces the most. ``0`` (Z_NO_COMPRESSION) is no compression.
67-
The default value is ``-1`` (Z_DEFAULT_COMPRESSION). Z_DEFAULT_COMPRESSION represents a default
68-
compromise between speed and compression (currently equivalent to level 6).
65+
See :const:`Z_BEST_SPEED` (``1``), :const:`Z_BEST_COMPRESSION` (``9``),
66+
:const:`Z_NO_COMPRESSION` (``0``), and the default,
67+
:const:`Z_DEFAULT_COMPRESSION` (``-1``) for more information about these values.
6968

7069
.. _compress-wbits:
7170

7271
The *wbits* argument controls the size of the history buffer (or the
7372
"window size") used when compressing data, and whether a header and
7473
trailer is included in the output. It can take several ranges of values,
75-
defaulting to ``15`` (MAX_WBITS):
74+
defaulting to ``15`` (:const:`MAX_WBITS`):
7675

7776
* +9 to +15: The base-two logarithm of the window size, which
7877
therefore ranges between 512 and 32768. Larger values produce
@@ -96,17 +95,15 @@ The available exception and functions in this module are:
9695
The *wbits* parameter is now available to set window bits and
9796
compression type.
9897

99-
.. function:: compressobj(level=-1, method=DEFLATED, wbits=MAX_WBITS, memLevel=DEF_MEM_LEVEL, strategy=Z_DEFAULT_STRATEGY[, zdict])
98+
.. function:: compressobj(level=Z_DEFAULT_COMPRESSION, method=DEFLATED, wbits=MAX_WBITS, memLevel=DEF_MEM_LEVEL, strategy=Z_DEFAULT_STRATEGY[, zdict])
10099

101100
Returns a compression object, to be used for compressing data streams that won't
102101
fit into memory at once.
103102

104103
*level* is the compression level -- an integer from ``0`` to ``9`` or ``-1``.
105-
A value of ``1`` (Z_BEST_SPEED) is fastest and produces the least compression,
106-
while a value of ``9`` (Z_BEST_COMPRESSION) is slowest and produces the most.
107-
``0`` (Z_NO_COMPRESSION) is no compression. The default value is ``-1`` (Z_DEFAULT_COMPRESSION).
108-
Z_DEFAULT_COMPRESSION represents a default compromise between speed and compression
109-
(currently equivalent to level 6).
104+
See :const:`Z_BEST_SPEED` (``1``), :const:`Z_BEST_COMPRESSION` (``9``),
105+
:const:`Z_NO_COMPRESSION` (``0``), and the default,
106+
:const:`Z_DEFAULT_COMPRESSION` (``-1``) for more information about these values.
110107

111108
*method* is the compression algorithm. Currently, the only supported value is
112109
:const:`DEFLATED`.
@@ -121,7 +118,7 @@ The available exception and functions in this module are:
121118

122119
*strategy* is used to tune the compression algorithm. Possible values are
123120
:const:`Z_DEFAULT_STRATEGY`, :const:`Z_FILTERED`, :const:`Z_HUFFMAN_ONLY`,
124-
:const:`Z_RLE` (zlib 1.2.0.1) and :const:`Z_FIXED` (zlib 1.2.2.2).
121+
:const:`Z_RLE` and :const:`Z_FIXED`.
125122

126123
*zdict* is a predefined compression dictionary. This is a sequence of bytes
127124
(such as a :class:`bytes` object) containing subsequences that are expected
@@ -249,7 +246,7 @@ Compression objects support the following methods:
249246
All pending input is processed, and a bytes object containing the remaining compressed
250247
output is returned. *mode* can be selected from the constants
251248
:const:`Z_NO_FLUSH`, :const:`Z_PARTIAL_FLUSH`, :const:`Z_SYNC_FLUSH`,
252-
:const:`Z_FULL_FLUSH`, :const:`Z_BLOCK` (zlib 1.2.3.4), or :const:`Z_FINISH`,
249+
:const:`Z_FULL_FLUSH`, :const:`Z_BLOCK`, or :const:`Z_FINISH`,
253250
defaulting to :const:`Z_FINISH`. Except :const:`Z_FINISH`, all constants
254251
allow compressing further bytestrings of data, while :const:`Z_FINISH` finishes the
255252
compressed stream and prevents compressing any more data. After calling :meth:`flush`
@@ -367,24 +364,25 @@ behavior:
367364

368365
.. data:: Z_NO_COMPRESSION
369366

370-
Compression level ``0``.
367+
Compression level ``0``; no compression.
371368

372369
.. versionadded:: 3.6
373370

374371

375372
.. data:: Z_BEST_SPEED
376373

377-
Compression level ``1``.
374+
Compression level ``1``; fastest and produces the least compression.
378375

379376

380377
.. data:: Z_BEST_COMPRESSION
381378

382-
Compression level ``9``.
379+
Compression level ``9``; slowest and produces the most compression.
383380

384381

385382
.. data:: Z_DEFAULT_COMPRESSION
386383

387-
Default compression level (``-1``).
384+
Default compression level (``-1``); a compromise between speed and
385+
compression. Equivalent to compression level ``6``.
388386

389387

390388
.. data:: Z_DEFAULT_STRATEGY

0 commit comments

Comments
 (0)