Skip to content

Commit ca99add

Browse files
committed
MaD generator: address review
1 parent ecc35e5 commit ca99add

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
@@ -353,7 +353,7 @@ def download_dca_databases(
353353
)
354354
targets = response["targets"]
355355
project_map = {project["name"]: project for project in projects}
356-
artifact_map = {}
356+
analyzed_databases = {}
357357
for data in targets.values():
358358
downloads = data["downloads"]
359359
analyzed_database = downloads["analyzed_database"]
@@ -364,12 +364,12 @@ def download_dca_databases(
364364
print(f"Skipping {pretty_name} as it is not in the list of projects")
365365
continue
366366

367-
if pretty_name in artifact_map:
367+
if pretty_name in analyzed_databases:
368368
print(
369-
f"Skipping previous database {artifact_map[pretty_name]['artifact_name']} for {pretty_name}"
369+
f"Skipping previous database {analyzed_databases[pretty_name]['artifact_name']} for {pretty_name}"
370370
)
371371

372-
artifact_map[pretty_name] = analyzed_database
372+
analyzed_databases[pretty_name] = analyzed_database
373373

374374
def download_and_decompress(analyzed_database: dict) -> str:
375375
artifact_name = analyzed_database["artifact_name"]
@@ -397,8 +397,7 @@ def download_and_decompress(analyzed_database: dict) -> str:
397397
shutil.rmtree(artifact_unzipped_location, ignore_errors=True)
398398
# And then we extract it to build_dir/artifact_name
399399
zip_ref.extractall(artifact_unzipped_location)
400-
# And then we iterate over the contents of the extracted directory
401-
# and extract the language tar.gz file inside it
400+
# And then we extract the language tar.gz file inside it
402401
artifact_tar_location = os.path.join(
403402
artifact_unzipped_location, f"{language}.tar.gz"
404403
)
@@ -411,7 +410,7 @@ def download_and_decompress(analyzed_database: dict) -> str:
411410

412411
results = run_in_parallel(
413412
download_and_decompress,
414-
list(artifact_map.values()),
413+
list(analyzed_databases.values()),
415414
on_error=lambda db, exc: print(
416415
f"ERROR: Failed to download and decompress {db["artifact_name"]}: {exc}"
417416
),
@@ -422,7 +421,7 @@ def download_and_decompress(analyzed_database: dict) -> str:
422421

423422
print(f"\n=== Fetched {len(results)} databases ===")
424423

425-
return [(project_map[n], r) for n, r in zip(artifact_map, results)]
424+
return [(project_map[n], r) for n, r in zip(analyzed_databases, results)]
426425

427426

428427
def get_mad_destination_for_project(config, name: str) -> str:

0 commit comments

Comments
 (0)