Separate grouping logic for input arguments and corresponding batch indices into reusable python function for use in different Python modules, e.g. in harmony-autotester.
The grouping logic is repeated here:
|
batch_indices = get_batch_indices(input_filenames) |
|
unique_category_indices: list[int] = sorted(set(batch_indices), key=batch_indices.index) |
|
logging.info(f"batch_indices = {batch_indices}") |
|
|
|
# --- Construct a STAC object based on the batch indices --- |
|
grouped: dict[int, list[str]] = {} |
|
for k, v in zip(batch_indices, input_filenames, strict=False): |
|
grouped.setdefault(k, []).append(v) |
and
|
grouped: dict[int, list[Item]] = {} |
|
for k, v in zip(batch_indices, items, strict=False): |
|
grouped.setdefault(k, []).append(v) |
Replace the duplicated implementations in both locations with the reusable function and develop unit test for it.
Separate grouping logic for input arguments and corresponding batch indices into reusable python function for use in different Python modules, e.g. in harmony-autotester.
The grouping logic is repeated here:
batchee/batchee/tempo_filename_parser.py
Lines 143 to 150 in cb6246b
batchee/batchee/harmony/service_adapter.py
Lines 103 to 105 in cb6246b
Replace the duplicated implementations in both locations with the reusable function and develop unit test for it.