refactor(convert): remove distribute json
Some checks failed
build / build (push) Failing after 2m18s
build / build (pull_request) Failing after 2m22s

This commit is contained in:
李衍志523370910113 2025-02-27 09:58:19 +08:00
parent c19801f9a1
commit 2a2387fff2

View File

@ -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!"