From b95898e9f6621827f7831fe63a7e5ad6b6ce74e3 Mon Sep 17 00:00:00 2001 From: Zhenghao Peng Date: Mon, 19 Feb 2024 16:50:49 -0800 Subject: [PATCH] fix a typo (#62) --- scenarionet/builder/utils.py | 8 ++++---- scenarionet/common_utils.py | 2 +- scenarionet/converter/utils.py | 4 ++-- scenarionet/verifier/error.py | 4 ++-- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/scenarionet/builder/utils.py b/scenarionet/builder/utils.py index ebc9617..ea781d1 100644 --- a/scenarionet/builder/utils.py +++ b/scenarionet/builder/utils.py @@ -11,7 +11,7 @@ from typing import Callable, List import tqdm from metadrive.scenario.scenario_description import ScenarioDescription -from scenarionet.common_utils import save_summary_anda_mapping +from scenarionet.common_utils import save_summary_and_mapping logger = logging.getLogger(__name__) @@ -110,7 +110,7 @@ def merge_database( summaries.pop(file) mappings.pop(file) if save: - save_summary_anda_mapping(summary_file, mapping_file, summaries, mappings) + save_summary_and_mapping(summary_file, mapping_file, summaries, mappings) return summaries, mappings @@ -144,7 +144,7 @@ def copy_database(from_path, to_path, exist_ok=False, overwrite=False, copy_raw_ rel_path = mappings[scenario_file] shutil.copyfile(os.path.join(to_path, rel_path, scenario_file), os.path.join(to_path, scenario_file)) mappings = {key: "./" for key in summaries.keys()} - save_summary_anda_mapping(summary_file, mapping_file, summaries, mappings) + save_summary_and_mapping(summary_file, mapping_file, summaries, mappings) if remove_source: if ScenarioDescription.DATASET.MAPPING_FILE in files and ScenarioDescription.DATASET.SUMMARY_FILE in files \ @@ -204,6 +204,6 @@ def split_database( selected_summary[scenario] = summaries[scenario] selected_mapping[scenario] = os.path.relpath(osp.join(abs_dir_path, mappings[scenario]), output_abs_path) - save_summary_anda_mapping(summary_file, mapping_file, selected_summary, selected_mapping) + save_summary_and_mapping(summary_file, mapping_file, selected_summary, selected_mapping) return summaries, mappings diff --git a/scenarionet/common_utils.py b/scenarionet/common_utils.py index 68c2c70..93c6229 100644 --- a/scenarionet/common_utils.py +++ b/scenarionet/common_utils.py @@ -66,7 +66,7 @@ def dict_recursive_remove_array_and_set(d): return d -def save_summary_anda_mapping(summary_file_path, mapping_file_path, summary, mapping): +def save_summary_and_mapping(summary_file_path, mapping_file_path, summary, mapping): with open(summary_file_path, "wb") as file: pickle.dump(dict_recursive_remove_array_and_set(summary), file) with open(mapping_file_path, "wb") as file: diff --git a/scenarionet/converter/utils.py b/scenarionet/converter/utils.py index d83c138..c48dc06 100644 --- a/scenarionet/converter/utils.py +++ b/scenarionet/converter/utils.py @@ -15,7 +15,7 @@ import tqdm from metadrive.scenario import ScenarioDescription as SD from scenarionet.builder.utils import merge_database -from scenarionet.common_utils import save_summary_anda_mapping +from scenarionet.common_utils import save_summary_and_mapping from scenarionet.converter.pg.utils import convert_pg_scenario, make_env logger = logging.getLogger(__file__) @@ -249,7 +249,7 @@ def write_to_directory_single_worker( count += 1 # store summary file - save_summary_anda_mapping(summary_file_path, mapping_file_path, summary, mapping) + save_summary_and_mapping(summary_file_path, mapping_file_path, summary, mapping) # rename and save if delay_remove is not None: diff --git a/scenarionet/verifier/error.py b/scenarionet/verifier/error.py index e7d8351..fdbddb7 100644 --- a/scenarionet/verifier/error.py +++ b/scenarionet/verifier/error.py @@ -6,7 +6,7 @@ from typing import List from metadrive.scenario.scenario_description import ScenarioDescription as SD -from scenarionet.common_utils import save_summary_anda_mapping, read_dataset_summary +from scenarionet.common_utils import save_summary_and_mapping, read_dataset_summary logger = logging.getLogger(__name__) @@ -98,5 +98,5 @@ class ErrorFile: new_summary[scenario] = origin_summary[scenario] scenario_dir = os.path.join(origin_dataset_path, origin_mapping[scenario]) new_mapping[scenario] = os.path.relpath(scenario_dir, new_dataset_path) - save_summary_anda_mapping(new_summary_file_path, new_mapping_file_path, new_summary, new_mapping) + save_summary_and_mapping(new_summary_file_path, new_mapping_file_path, new_summary, new_mapping) return new_summary, new_mapping