MCPcopy Create free account
hub / github.com/doldecomp/mkdd / download

Function download

tools/download_tool.py:95–109  ·  view source on GitHub ↗
(url, response, output)

Source from the content-addressed store, hash-verified

93
94
95def download(url, response, output) -> None:
96 if url.endswith(".zip"):
97 data = io.BytesIO(response.read())
98 with zipfile.ZipFile(data) as f:
99 f.extractall(output)
100 # Make all files executable
101 for root, _, files in os.walk(output):
102 for name in files:
103 os.chmod(os.path.join(root, name), 0o755)
104 output.touch(mode=0o755) # Update dir modtime
105 else:
106 with open(output, "wb") as f:
107 shutil.copyfileobj(response, f)
108 st = os.stat(output)
109 os.chmod(output, st.st_mode | stat.S_IEXEC)
110
111
112def main() -> None:

Callers 1

mainFunction · 0.85

Calls 2

openFunction · 0.85
readMethod · 0.45

Tested by

no test coverage detected