5
5
import codecs
6
6
import mmap
7
7
from contextlib import contextmanager , closing
8
- from zipfile import ZipFile
8
+ import zipfile
9
9
10
10
from pandas .compat import StringIO , BytesIO , string_types , text_type
11
11
from pandas import compat
@@ -428,7 +428,7 @@ def _get_handle(path_or_buf, mode, encoding=None, compression=None,
428
428
return f , handles
429
429
430
430
431
- class BytesZipFile (ZipFile , BytesIO ):
431
+ class BytesZipFile (zipfile . ZipFile , BytesIO ):
432
432
"""
433
433
Wrapper for standard library class ZipFile and allow the returned file-like
434
434
handle to accept byte strings via `write` method.
@@ -437,10 +437,10 @@ class BytesZipFile(ZipFile, BytesIO):
437
437
bytes strings into a member of the archive.
438
438
"""
439
439
# GH 17778
440
- def __init__ (self , file , mode = 'r' , ** kwargs ):
440
+ def __init__ (self , file , mode , compression = zipfile . ZIP_DEFLATED , ** kwargs ):
441
441
if mode in ['wb' , 'rb' ]:
442
442
mode = mode .replace ('b' , '' )
443
- super (BytesZipFile , self ).__init__ (file , mode , ** kwargs )
443
+ super (BytesZipFile , self ).__init__ (file , mode , compression , ** kwargs )
444
444
445
445
def write (self , data ):
446
446
super (BytesZipFile , self ).writestr (self .filename , data )
0 commit comments