Package grizzled :: Package io :: Class Zip
[hide private]
[frames] | no frames]

Class Zip

source code

     object --+    
              |    
zipfile.ZipFile --+
                  |
                 Zip

Zip extends the standard zipfile.ZipFile class and provides a method to extract the contents of a zip file into a directory. Adapted from http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/252508.
Instance Methods [hide private]
 
__init__(self, file, mode='r', compression=0, allow_zip64=False)
Constructor.
source code
 
extract(self, output_dir)
Unpack the zip file into the specified output directory.
source code

Inherited from zipfile.ZipFile: __del__, __enter__, __exit__, close, extractall, getinfo, infolist, namelist, open, printdir, read, setpassword, testzip, write, writestr

Inherited from zipfile.ZipFile (private): _RealGetContents, _extract_member, _writecheck

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Class Variables [hide private]

Inherited from zipfile.ZipFile: fp

Properties [hide private]

Inherited from zipfile.ZipFile: comment

Inherited from object: __class__

Method Details [hide private]

__init__(self, file, mode='r', compression=0, allow_zip64=False)
(Constructor)

source code 
Constructor. Initialize a new zip file.
Parameters:
  • file (str) - path to zip file
  • mode (str) - open mode. Valid values are 'r' (read), 'w' (write), and 'a' (append)
  • compression (int) - Compression type. Valid values: zipfile.ZIP_STORED`, ``zipfile.ZIP_DEFLATED
  • allow_zip64 (bool) - Whether or not Zip64 extensions are to be used
Overrides: object.__init__

extract(self, output_dir)

source code 
Unpack the zip file into the specified output directory.
Parameters:
  • output_dir (str) - path to output directory. The directory is created if it doesn't already exist.
Overrides: zipfile.ZipFile.extract