Skip to content

Commit de200e1

Browse files
committed
Fix.
1 parent e0ed3fe commit de200e1

1 file changed

Lines changed: 12 additions & 17 deletions

File tree

lamar/combine_results.py

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -51,33 +51,28 @@
5151
help="Output directory where the zip will be saved.",
5252
required=True,
5353
)
54-
args = parser.parse_args()
55-
56-
# Define all arguments and their human-readable names.
57-
arg_paths = {
58-
("CAB", "phone"): args.cab_phone_path,
59-
("LIN", "phone"): args.lin_phone_path,
60-
("HGE", "phone"): args.hge_phone_path,
61-
("CAB", "hololens"): args.cab_hololens_path,
62-
("LIN", "hololens"): args.lin_hololens_path,
63-
("HGE", "hololens"): args.hge_hololens_path,
64-
}
65-
54+
args = parser.parse_args().__dict__
55+
output_dir = args.pop("output_dir")
56+
6657
# Generate timestamp for the zip file name.
6758
timestamp = datetime.datetime.now().strftime("%Y.%m.%d_%H.%M.%S")
68-
zip_filename = args.output_dir / f"result_{timestamp}.zip"
59+
zip_filename = output_dir / f"result_{timestamp}.zip"
6960

7061
# Create the zip file with existing paths.
7162
logger.info(f"Creating zip file at {zip_filename}")
72-
args.output_dir.mkdir(parents=True, exist_ok=True)
63+
output_dir.mkdir(parents=True, exist_ok=True)
7364
with zipfile.ZipFile(zip_filename, "w", zipfile.ZIP_DEFLATED) as zipf:
74-
for split, path in arg_paths.items():
65+
for name, path in args.items():
66+
split = name.split("_")
67+
assert len(split) == 3
68+
assert split[-1] == "path"
69+
split = split[:-1]
7570
if path is None:
76-
logger.warning(f"No path provided for [{split}], skipping")
71+
logger.warning(f"No path provided for [{split}], skipping...")
7772
continue
7873
assert path.exists()
7974
assert path.is_file()
8075
assert path.suffix == ".txt", f"Expected .txt file, got {path.suffix}"
8176
logger.info(f"Adding [{split}] file from {path} to zip")
82-
zipf.write(path, arcname=f"{split[0]}_query_{split[1]}.txt")
77+
zipf.write(path, arcname=f"{split[0].upper()}_query_{split[1]}.txt")
8378
logger.info(f"Successfully created zip file at {zip_filename}")

0 commit comments

Comments
 (0)