Skip to content

Commit 3ddca32

Browse files
MathiasVPpaldepind
andauthored
Update misc/scripts/models-as-data/bulk_generate_mad.py
Co-authored-by: Simon Friis Vindum <[email protected]>
1 parent 7c2612a commit 3ddca32

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

misc/scripts/models-as-data/bulk_generate_mad.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -281,16 +281,15 @@ def download_artifact(url: str, artifact_name: str, pat: str) -> str:
281281
headers = {"Authorization": f"token {pat}", "Accept": "application/vnd.github+json"}
282282
response = requests.get(url, stream=True, headers=headers)
283283
zipName = artifact_name + ".zip"
284-
if response.status_code == 200:
285-
target_zip = os.path.join(build_dir, zipName)
286-
with open(target_zip, "wb") as file:
287-
for chunk in response.iter_content(chunk_size=8192):
288-
file.write(chunk)
289-
print(f"Download complete: {target_zip}")
290-
return target_zip
291-
else:
284+
if response.status_code != 200:
292285
print(f"Failed to download file. Status code: {response.status_code}")
293286
sys.exit(1)
287+
target_zip = os.path.join(build_dir, zipName)
288+
with open(target_zip, "wb") as file:
289+
for chunk in response.iter_content(chunk_size=8192):
290+
file.write(chunk)
291+
print(f"Download complete: {target_zip}")
292+
return target_zip
294293

295294

296295
def remove_extension(filename: str) -> str:

0 commit comments

Comments
 (0)