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

Function addToZip

Lib/zipfile/__init__.py:2365–2374  ·  view source on GitHub ↗
(zf, path, zippath)

Source from the content-addressed store, hash-verified

2363 files = args.create
2364
2365 def addToZip(zf, path, zippath):
2366 if os.path.isfile(path):
2367 zf.write(path, zippath, ZIP_DEFLATED)
2368 elif os.path.isdir(path):
2369 if zippath:
2370 zf.write(path, zippath)
2371 for nm in sorted(os.listdir(path)):
2372 addToZip(zf,
2373 os.path.join(path, nm), os.path.join(zippath, nm))
2374 # else: ignore
2375
2376 with ZipFile(zip_name, 'w') as zf:
2377 for path in files:

Callers 1

mainFunction · 0.85

Calls 5

listdirMethod · 0.80
isfileMethod · 0.45
writeMethod · 0.45
isdirMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…