stouputils.dont_look.zip_file_override module

This module provides a zip file override to handle some corrupted zip files.

For instance, some Minecraft servers resource packs are slightly corrupted and cannot be opened with the standard zipfile module. See the archive.py module for more information.

class ZipExtFileOverride(fileobj, mode, zipinfo, pwd=None, close_fileobj=False)[source]

Bases: ZipExtFile

Override of the ZipExtFile class

_update_crc(newdata) None[source]

Override of the _update_crc method

_abc_impl = <_abc._abc_data object>
class ZipFileOverride(file, mode='r', compression=0, allowZip64=True, compresslevel=None, *, strict_timestamps=True)[source]

Bases: ZipFile

Override of the ZipFile class

open(name, mode='r', pwd=None, *, force_zip64=False)[source]

Return file-like object for ‘name’.

name is a string for the file name within the ZIP file, or a ZipInfo object.

mode should be ‘r’ to read a file already in the ZIP file, or ‘w’ to write to a file newly added to the archive.

pwd is the password to decrypt files (only used for reading).

When writing, if the file size is not known in advance but may exceed 2 GiB, pass force_zip64 to use the ZIP64 format, which can handle large files. If the size is known in advance, it is best to pass a ZipInfo instance for name, with zinfo.file_size set.