MCPcopy Index your code
hub / github.com/RustPython/RustPython / writeZip

Method writeZip

Lib/test/test_zipimport.py:135–151  ·  view source on GitHub ↗
(self, z, files, *, file_comment=None, prefix='')

Source from the content-addressed store, hash-verified

133 f.write(data)
134
135 def writeZip(self, z, files, *, file_comment=None, prefix=''):
136 for name, data in files.items():
137 if isinstance(data, tuple):
138 mtime, data = data
139 else:
140 mtime = NOW
141 name = name.replace(os.sep, '/')
142 zinfo = ZipInfo(prefix + name, time.localtime(mtime))
143 zinfo.compress_type = self.compression
144 if file_comment is not None:
145 zinfo.comment = file_comment
146 if data is None:
147 zinfo.CRC = 0
148 z.mkdir(zinfo)
149 else:
150 assert name[-1] != '/'
151 z.writestr(zinfo, data)
152
153 def getZip64Files(self):
154 # This is the simplest way to make zipfile generate the zip64 EOCD block

Callers 3

makeZipMethod · 0.95
testInvalidateCachesMethod · 0.95

Calls 6

ZipInfoClass · 0.90
isinstanceFunction · 0.85
writestrMethod · 0.80
itemsMethod · 0.45
replaceMethod · 0.45
mkdirMethod · 0.45

Tested by

no test coverage detected