MCPcopy Index your code
hub / github.com/python/cpython / writeZip

Method writeZip

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

Source from the content-addressed store, hash-verified

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

Callers 3

makeZipMethod · 0.95
testInvalidateCachesMethod · 0.95

Calls 5

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

Tested by

no test coverage detected