aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/tools/python3/src/Lib/bz2.py
diff options
context:
space:
mode:
authorshadchin <shadchin@yandex-team.ru>2022-02-10 16:44:39 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:44:39 +0300
commite9656aae26e0358d5378e5b63dcac5c8dbe0e4d0 (patch)
tree64175d5cadab313b3e7039ebaa06c5bc3295e274 /contrib/tools/python3/src/Lib/bz2.py
parent2598ef1d0aee359b4b6d5fdd1758916d5907d04f (diff)
downloadydb-e9656aae26e0358d5378e5b63dcac5c8dbe0e4d0.tar.gz
Restoring authorship annotation for <shadchin@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'contrib/tools/python3/src/Lib/bz2.py')
-rw-r--r--contrib/tools/python3/src/Lib/bz2.py26
1 files changed, 13 insertions, 13 deletions
diff --git a/contrib/tools/python3/src/Lib/bz2.py b/contrib/tools/python3/src/Lib/bz2.py
index 8005febeef..7447d12fc4 100644
--- a/contrib/tools/python3/src/Lib/bz2.py
+++ b/contrib/tools/python3/src/Lib/bz2.py
@@ -35,7 +35,7 @@ class BZ2File(_compression.BaseStream):
returned as bytes, and data to be written should be given as bytes.
"""
- def __init__(self, filename, mode="r", *, compresslevel=9):
+ def __init__(self, filename, mode="r", *, compresslevel=9):
"""Open a bzip2-compressed file.
If filename is a str, bytes, or PathLike object, it gives the
@@ -226,23 +226,23 @@ class BZ2File(_compression.BaseStream):
"""Write a byte string to the file.
Returns the number of uncompressed bytes written, which is
- always the length of data in bytes. Note that due to buffering,
- the file on disk may not reflect the data written until close()
- is called.
+ always the length of data in bytes. Note that due to buffering,
+ the file on disk may not reflect the data written until close()
+ is called.
"""
with self._lock:
self._check_can_write()
- if isinstance(data, (bytes, bytearray)):
- length = len(data)
- else:
- # accept any data that supports the buffer protocol
- data = memoryview(data)
- length = data.nbytes
-
+ if isinstance(data, (bytes, bytearray)):
+ length = len(data)
+ else:
+ # accept any data that supports the buffer protocol
+ data = memoryview(data)
+ length = data.nbytes
+
compressed = self._compressor.compress(data)
self._fp.write(compressed)
- self._pos += length
- return length
+ self._pos += length
+ return length
def writelines(self, seq):
"""Write a sequence of byte strings to the file.