Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
cba14976
Kaydet (Commit)
cba14976
authored
Kas 11, 2012
tarafından
Nadeem Vawda
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Sade Fark
Issue #15677: Document that zlib and gzip accept a compression level of 0 to mean 'no compression'.
Patch by Brian Brazil.
üst
c2c4cb62
6ff262e1
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
20 additions
and
14 deletions
+20
-14
gzip.rst
Doc/library/gzip.rst
+5
-4
zlib.rst
Doc/library/zlib.rst
+6
-5
gzip.py
Lib/gzip.py
+4
-3
NEWS
Misc/NEWS
+3
-0
zlibmodule.c
Modules/zlibmodule.c
+2
-2
No files found.
Doc/library/gzip.rst
Dosyayı görüntüle @
cba14976
...
...
@@ -38,7 +38,7 @@ The module defines the following items:
``'w'``, or ``'wb'`` for binary mode, or ``'rt'``, ``'at'``, or ``'wt'`` for
text mode. The default is ``'rb'``.
The *compresslevel* argument is an integer from
1
to 9, as for the
The *compresslevel* argument is an integer from
0
to 9, as for the
:class:`GzipFile` constructor.
For binary mode, this function is equivalent to the :class:`GzipFile`
...
...
@@ -80,9 +80,10 @@ The module defines the following items:
in text mode, use :func:`.open` (or wrap your :class:`GzipFile` with an
:class:`io.TextIOWrapper`).
The *compresslevel* argument is an integer from ``1`` to ``9`` controlling the
level of compression; ``1`` is fastest and produces the least compression, and
``9`` is slowest and produces the most compression. The default is ``9``.
The *compresslevel* argument is an integer from ``0`` to ``9`` controlling
the level of compression; ``1`` is fastest and produces the least
compression, and ``9`` is slowest and produces the most compression. ``0``
is no compression. The default is ``9``.
The *mtime* argument is an optional numeric timestamp to be written to
the stream when compressing. All :program:`gzip` compressed streams are
...
...
Doc/library/zlib.rst
Dosyayı görüntüle @
cba14976
...
...
@@ -52,10 +52,10 @@ The available exception and functions in this module are:
.. function:: compress(data[, level])
Compresses the bytes in *data*, returning a bytes object containing compressed data.
*level* is an integer from ``
1
`` to ``9`` controlling the level of compression;
*level* is an integer from ``
0
`` to ``9`` controlling the level of compression;
``1`` is fastest and produces the least compression, ``9`` is slowest and
produces the most.
The default value is ``6``. Raises the :exc:`error`
exception if any error occurs.
produces the most.
``0`` is no compression. The default value is ``6``.
Raises the :exc:`error`
exception if any error occurs.
.. function:: compressobj(level=-1, method=DEFLATED, wbits=15, memlevel=8, strategy=Z_DEFAULT_STRATEGY[, zdict])
...
...
@@ -63,9 +63,10 @@ The available exception and functions in this module are:
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 ``
1
`` to ``9``. A value
*level* is the compression level -- an integer from ``
0
`` to ``9``. A value
of ``1`` is fastest and produces the least compression, while a value of
``9`` is slowest and produces the most. The default value is ``6``.
``9`` is slowest and produces the most. ``0`` is no compression. The default
value is ``6``.
*method* is the compression algorithm. Currently, the only supported value is
``DEFLATED``.
...
...
Lib/gzip.py
Dosyayı görüntüle @
cba14976
...
...
@@ -160,9 +160,10 @@ class GzipFile(io.BufferedIOBase):
A mode of 'r' is equivalent to one of 'rb', and similarly for 'w' and
'wb', and 'a' and 'ab'.
The compresslevel argument is an integer from
1
to 9 controlling the
The compresslevel argument is an integer from
0
to 9 controlling the
level of compression; 1 is fastest and produces the least compression,
and 9 is slowest and produces the most compression. The default is 9.
and 9 is slowest and produces the most compression. 0 is no compression
at all. The default is 9.
The mtime argument is an optional numeric timestamp to be written
to the stream when compressing. All gzip compressed streams
...
...
@@ -622,7 +623,7 @@ class GzipFile(io.BufferedIOBase):
def
compress
(
data
,
compresslevel
=
9
):
"""Compress data in one shot and return the compressed string.
Optional argument is the compression level, in range of
1
-9.
Optional argument is the compression level, in range of
0
-9.
"""
buf
=
io
.
BytesIO
()
with
GzipFile
(
fileobj
=
buf
,
mode
=
'wb'
,
compresslevel
=
compresslevel
)
as
f
:
...
...
Misc/NEWS
Dosyayı görüntüle @
cba14976
...
...
@@ -359,6 +359,9 @@ Tools/Demos
Documentation
-------------
- Issue #15677: Document that zlib and gzip accept a compression level of 0 to
mean '
no
compression
'. Patch by Brian Brazil.
- Issue #8040: added a version switcher to the documentation. Patch by
Yury Selivanov.
...
...
Modules/zlibmodule.c
Dosyayı görüntüle @
cba14976
...
...
@@ -139,7 +139,7 @@ newcompobject(PyTypeObject *type)
PyDoc_STRVAR
(
compress__doc__
,
"compress(string[, level]) -- Returned compressed string.
\n
"
"
\n
"
"Optional arg level is the compression level, in
1
-9."
);
"Optional arg level is the compression level, in
0
-9."
);
static
PyObject
*
PyZlib_compress
(
PyObject
*
self
,
PyObject
*
args
)
...
...
@@ -1227,7 +1227,7 @@ PyDoc_STRVAR(zlib_module_documentation,
"zlib library, which is based on GNU zip.
\n
"
"
\n
"
"adler32(string[, start]) -- Compute an Adler-32 checksum.
\n
"
"compress(string[, level]) -- Compress string, with compression level in
1
-9.
\n
"
"compress(string[, level]) -- Compress string, with compression level in
0
-9.
\n
"
"compressobj([level[, ...]]) -- Return a compressor object.
\n
"
"crc32(string[, start]) -- Compute a CRC-32 checksum.
\n
"
"decompress(string,[wbits],[bufsize]) -- Decompresses a compressed string.
\n
"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment