Dashboard › institutional-transition-lab › Distillation
5bb366cb-783d-4d6c-adb6-cd7132db47e1["lore_tm_v1_x77PFs9wcK3BOaj85zxTEbf8Lhv9Ya_YkbPn4cZ126U"]
_open_to_write(self, zinfo, force_zip64=False): rejects force_zip64=True when _allowZip64 is false; rejects opening another write handle while _writing is true; resets zinfo.compress_size and zinfo.CRC; sets zinfo.flag_bits, including _MASK_COMPRESS_OPTION_1 for ZIP_LZMA EOS markers and _MASK_USE_DATA_DESCRIPTOR for non-seekable output; defaults zinfo.external_attr to 0o600 << 16; selects ZIP64 when forced or when zinfo.file_size * 1.05 > ZIP64_LIMIT; writes zinfo.FileHeader(zip64) and returns _ZipWriteFile(self, zinfo, zip64)._ZipWriteFile: __init__() obtains the compressor through _get_compressor(zinfo.compress_type, zinfo._compresslevel) and initializes _file_size, _compress_size, and _crc to 0; write() accepts bytes, bytearray, or any buffer-protocol object, updates the byte count and crc32, compresses when applicable, writes output to the underlying ZIP file, and returns the uncompressed byte count._ZipWriteFile.close(): flushes the compressor, finalizes compress_size, CRC, and file_size; raises RuntimeError if a non-ZIP64 entry exceeds ZIP64_LIMIT; for _MASK_USE_DATA_DESCRIPTOR, appends CRC and sizes using '<LLQQ' for ZIP64 or '<LLLL' otherwise; for seekable output, rewrites the local file header at zinfo.header_offset; then appends the entry to filelist, stores it in NameToInfo[zinfo.filename], and clears _zipfile._writing in finally.