Skip to content

Commit 5115b4c

Browse files
emmatypingAA-TurnerStanFromIreland
authored
Apply suggestions from reviewers
Co-authored-by: Adam Turner <[email protected]> Co-authored-by: Stan Ulbrych <[email protected]>
1 parent cfe0590 commit 5115b4c

File tree

1 file changed

+15
-7
lines changed

1 file changed

+15
-7
lines changed

Doc/library/compression.zstd.rst

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,10 @@ The :mod:`compression.zstd` module contains:
4040
Reading and writing compressed files
4141
------------------------------------
4242

43-
.. function:: open(file, /, mode="rb", *, level=None, options=None, zstd_dict=None, encoding=None, errors=None, newline=None)
43+
.. function:: open(file, /, mode='rb', *, level=None, options=None, \
44+
zstd_dict=None, encoding=None, errors=None, newline=None)
4445

45-
Open an Zstandard-compressed file in binary or text mode, returning a
46+
Open a Zstandard-compressed file in binary or text mode, returning a
4647
:term:`file object`.
4748

4849
The *file* argument can be either an actual file name (given as a
@@ -79,14 +80,14 @@ Reading and writing compressed files
7980
behavior, and line ending(s).
8081

8182

82-
.. class:: ZstdFile(file, /, mode="r", *, level=None, options=None, zstd_dict=None)
83+
.. class:: ZstdFile(file, /, mode='r', *, level=None, options=None, zstd_dict=None)
8384

8485
Open a Zstandard-compressed file in binary mode.
8586

8687
A :class:`ZstdFile` can wrap an already-open :term:`file object`, or operate
8788
directly on a named file. The *file* argument specifies either the file
8889
object to wrap, or the name of the file to open (as a :class:`str`,
89-
:class:`bytes` or :term:`path-like <path-like object>` object). When
90+
:class:`bytes` or :term:`path-like <path-like object>` object). If
9091
wrapping an existing file object, the wrapped file will not be closed when
9192
the :class:`ZstdFile` is closed.
9293

@@ -527,7 +528,7 @@ Advanced parameter control
527528
The impact of this field depends on the selected :class:`Strategy`.
528529

529530
For strategies :attr:`~Strategy.btopt`, :attr:`~Strategy.btultra` and
530-
:attr:`~Strategy.btultra2`, the values is the length of a match
531+
:attr:`~Strategy.btultra2`, the value is the length of a match
531532
considered "good enough" to stop searching. Larger values make
532533
compression ratios better, but compresses slower.
533534

@@ -571,6 +572,7 @@ Advanced parameter control
571572
Log size of each bucket in the long distance matcher hash table for
572573
collision resolution. Larger values improve collision resolution but
573574
decrease compression speed.
575+
574576
.. attribute:: ldm_hash_rate_log
575577

576578
Frequency of inserting/looking up entries into the long distance matcher
@@ -598,7 +600,7 @@ Advanced parameter control
598600
Select how many threads will be spawned to compress in parallel. When
599601
:attr:`~.nb_workers` >= 1, enables multi-threaded compression, 1
600602
means "1-thread multi-threaded mode". More workers improve speed, but
601-
also increases memory usage and slightly reduce compression ratio.
603+
also increase memory usage and slightly reduce compression ratio.
602604

603605
.. attribute:: job_size
604606

@@ -610,7 +612,7 @@ Advanced parameter control
610612
.. attribute:: overlap_log
611613

612614
Sets how much data is reloaded from previous jobs (threads) for new jobs
613-
to be used by the look behind window during compression. This values is
615+
to be used by the look behind window during compression. This value is
614616
only used when :attr:`~CompressionParameter.nb_workers` >= 1. Acceptable
615617
values vary from 0 to 9.
616618

@@ -720,13 +722,15 @@ Examples
720722
Reading in a compressed file:
721723

722724
.. code-block:: python
725+
723726
from compression import zstd
724727
with zstd.open("file.zst") as f:
725728
file_content = f.read()
726729
727730
Creating a compressed file:
728731

729732
.. code-block:: python
733+
730734
from compression import zstd
731735
data = b"Insert Data Here"
732736
with zstd.open("file.zst", "w") as f:
@@ -735,13 +739,15 @@ Creating a compressed file:
735739
Compressing data in memory:
736740

737741
.. code-block:: python
742+
738743
from compression import zstd
739744
data_in = b"Insert Data Here"
740745
data_out = zstd.compress(data_in)
741746
742747
Incremental compression:
743748

744749
.. code-block:: python
750+
745751
from compression import zstd
746752
comp = zstd.ZstdCompressor()
747753
out1 = comp.compress(b"Some data\n")
@@ -754,6 +760,7 @@ Incremental compression:
754760
Writing compressed data to an already-open file:
755761

756762
.. code-block:: python
763+
757764
from compression import zstd
758765
with open("file.zst", "wb") as f:
759766
f.write(b"This data will not be compressed\n")
@@ -764,6 +771,7 @@ Writing compressed data to an already-open file:
764771
Creating a compressed file using compression parameters:
765772

766773
.. code-block:: python
774+
767775
from compression import zstd
768776
options = {
769777
zstd.CompressionParameter.checksum_flag: 1

0 commit comments

Comments
 (0)