From 2a2387fff21f612e9368e19d37dffd972f046d60 Mon Sep 17 00:00:00 2001 From: jon-lee Date: Thu, 27 Feb 2025 09:58:19 +0800 Subject: [PATCH] refactor(convert): remove distribute json --- joj3_config_generator/convert.py | 21 --------------------- 1 file changed, 21 deletions(-) diff --git a/joj3_config_generator/convert.py b/joj3_config_generator/convert.py index b8defb5..c683ddc 100644 --- a/joj3_config_generator/convert.py +++ b/joj3_config_generator/convert.py @@ -73,24 +73,3 @@ def convert_joj1(joj1_conf: joj1.Config) -> task.Config: release=task.Release(deadline=None, begin_time=None), stages=[], ) - - -def distribute_json(folder_path: str, repo_obj: Any, repo_conf: Path) -> None: - for root, _, files in os.walk(folder_path): - for file in files: - if file.endswith(".toml"): # to pass test here - toml_file_path = os.path.join(root, file) - json_file_path = os.path.join(root, file.replace(".toml", ".json")) - with open(toml_file_path) as toml_file: - task_toml = toml_file.read() - task_obj = rtoml.loads(task_toml) - result_model = convert(repo.Config(**repo_obj), task.Config(**task_obj)) - result_dict = result_model.model_dump(by_alias=True, exclude_none=True) - - with open(json_file_path, "w") as result_file: - json.dump(result_dict, result_file, ensure_ascii=False, indent=4) - result_file.write("\n") - print(f"Successfully convert {toml_file_path} into json!") - assert os.path.exists( - json_file_path - ), f"Failed to convert {toml_file_path} into json!"