8000 Rename compression._common.streams to compression._common._streams · emmatyping/cpython@c8201ba · GitHub
[go: up one dir, main page]

Skip to content

Commit c8201ba

Browse files
committed
Rename compression._common.streams to compression._common._streams
1 parent 0731130 commit c8201ba

File tree

6 files changed

+20
-20
lines changed

6 files changed

+20
-20
lines changed

Lib/bz2.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
__author__ = "Nadeem Vawda <nadeem.vawda@gmail.com>"
1111

1212
from builtins import open as _builtin_open
13-
from compression._common import streams
13+
from compression._common import _streams
1414
import io
1515
import os
1616

@@ -23,7 +23,7 @@
2323
_MODE_WRITE = 3
2424

2525

26-
class BZ2File(streams.BaseStream):
26+
class BZ2File(_streams.BaseStream):
2727

2828
"""A file object providing transparent bzip2 (de)compression.
2929
@@ -88,7 +88,7 @@ def __init__(self, filename, mode="r", *, compresslevel=9):
8888
raise TypeError("filename must be a str, bytes, file or PathLike object")
8989

9090
if self._mode == _MODE_READ:
91-
raw = streams.DecompressReader(self._fp,
91+
raw = _streams.DecompressReader(self._fp,
9292
BZ2Decompressor, trailing_error=OSError)
9393
self._buffer = io.BufferedReader(raw)
9494
else:
@@ -248,7 +248,7 @@ def writelines(self, seq):
248248
249249
Line separators are not added between the written byte strings.
250250
"""
251-
return streams.BaseStream.writelines(self, seq)
251+
return _streams.BaseStream.writelines(self, seq)
252252

253253
def seek(self, offset, whence=io.SEEK_SET):
254254
"""Change the file position.

Lib/gzip.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
import time
1414
import weakref
1515
import zlib
16-
from compression._common import streams
16+
from compression._common import _streams
1717

1818
__all__ = ["BadGzipFile", "GzipFile", "open", "compress", "decompress"]
1919

@@ -144,7 +144,7 @@ def writable(self):
144144
return True
145145

146146

147-
class GzipFile(streams.BaseStream):
147+
class GzipFile(_streams.BaseStream):
148148
"""The GzipFile class simulates most of the methods of a file object with
149149
the exception of the truncate() method.
150150
@@ -523,7 +523,7 @@ def _read_gzip_header(fp):
523523
return last_mtime
524524

525525

526-
class _GzipReader(streams.DecompressReader):
526+
class _GzipReader(_streams.DecompressReader):
527527
def __init__(self, fp):
528528
super().__init__(_PaddedFile(fp), zlib._ZlibDecompressor,
529529
wbits=-zlib.MAX_WBITS)

Lib/lzma.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
import builtins
2525
import io
2626
import os
27-
from compression._common import streams
27+
from compression._common import _streams
2828
from _lzma import *
2929
from _lzma import _encode_filter_properties, _decode_filter_properties # noqa: F401
3030

@@ -35,7 +35,7 @@
3535
_MODE_WRITE = 3
3636

3737

38-
class LZMAFile(streams.BaseStream):
38+
class LZMAFile(_streams.BaseStream):
3939

4040
"""A file object providing transparent LZMA (de)compression.
4141
@@ -127,7 +127,7 @@ def __init__(self, filename=None, mode="r", *,
127127
raise TypeError("filename must be a str, bytes, file or PathLike object")
128128

129129
if self._mode == _MODE_READ:
130-
raw = streams.DecompressReader(self._fp, LZMADecompressor,
130+
raw = _streams.DecompressReader(self._fp, LZMADecompressor,
131131
trailing_error=LZMAError, format=format, filters=filters)
132132
self._buffer = io.BufferedReader(raw)
133133

Lib/test/test_bz2.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
from test.support import import_helper
1717
from test.support import threading_helper
1818
from test.support.os_helper import unlink, FakePath
19-
from compression._common import streams
19+
from compression._common import _streams
2020
import sys
2121

2222

@@ -126,15 +126,15 @@ def testReadMultiStream(self):
126126
def testReadMonkeyMultiStream(self):
127127
# Test BZ2File.read() on a multi-stream archive where a stream
128128
# boundary coincides with the end of the raw read buffer.
129-
buffer_size = streams.BUFFER_SIZE
130-
streams.BUFFER_SIZE = len(self.DATA)
129+
buffer_size = _streams.BUFFER_SIZE
130+
_streams.BUFFER_SIZE = len(self.DATA)
131131
try:
132132
self.createTempFile(streams=5)
133133
with BZ2File(self.filename) as bz2f:
134134
self.assertRaises(TypeError, bz2f.read, float())
135135
self.assertEqual(bz2f.read(), self.TEXT * 5)
136136
finally:
137-
streams.BUFFER_SIZE = buffer_size
137+
_streams.BUFFER_SIZE = buffer_size
138138

139139
def testReadTrailingJunk(self):
140140
self.createTempFile(suffix=self.BAD_DATA)
@@ -742,7 +742,7 @@ def testOpenPathLikeFilename(self):
742742
def testDecompressLimited(self):
743743
"""Decompressed data buffering should be limited"""
744744
bomb = bz2.compress(b'\0' * int(2e6), compresslevel=9)
745-
self.assertLess(len(bomb), streams.BUFFER_SIZE)
745+
self.assertLess(len(bomb), _streams.BUFFER_SIZE)
746746

747747
decomp = BZ2File(BytesIO(bomb))
748748
self.assertEqual(decomp.read(1), b'\0')

Lib/test/test_lzma.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import sys
77
from test import support
88
import unittest
9-
from compression._common import streams
9+
from compression._common import _streams
1010

1111
from test.support import _4G, bigmemtest
1212
from test.support.import_helper import import_module
@@ -861,13 +861,13 @@ def test_read_multistream(self):
861861
def test_read_multistream_buffer_size_aligned(self):
862862
# Test the case where a stream boundary coincides with the end
863863
# of the raw read buffer.
864-
saved_buffer_size = streams.BUFFER_SIZE
865-
streams.BUFFER_SIZE = len(COMPRESSED_XZ)
864+
saved_buffer_size = _streams.BUFFER_SIZE
865+
_streams.BUFFER_SIZE = len(COMPRESSED_XZ)
866866
try:
867867
with LZMAFile(BytesIO(COMPRESSED_XZ * 5)) as f:
868868
self.assertEqual(f.read(), INPUT * 5)
869869
finally:
870-
streams.BUFFER_SIZE = saved_buffer_size
870+
_streams.BUFFER_SIZE = saved_buffer_size
871871

872872
def test_read_trailing_junk(self):
873873
with LZMAFile(BytesIO(COMPRESSED_XZ + COMPRESSED_BOGUS)) as f:
@@ -1066,7 +1066,7 @@ def test_readlines(self):
10661066
def test_decompress_limited(self):
10671067
"""Decompressed data buffering should be limited"""
10681068
bomb = lzma.compress(b'\0' * int(2e6), preset=6)
1069-
self.assertLess(len(bomb), streams.BUFFER_SIZE)
1069+
self.assertLess(len(bomb), _streams.BUFFER_SIZE)
10701070

10711071
decomp = LZMAFile(BytesIO(bomb))
10721072
self.assertEqual(decomp.read(1), b'\0')

0 commit comments

Comments
 (0)
0