fix: merge master
Some checks failed
build / build (pull_request) Failing after 2m34s
build / build (push) Failing after 2m32s

This commit is contained in:
李衍志523370910113 2025-02-27 14:37:40 +08:00
commit adfdc027f2
3 changed files with 8 additions and 15 deletions

View File

@ -109,7 +109,7 @@ class Task(BaseModel):
class Config(BaseModel):
root: Path = Path(".")
path: Path = Path("conf.toml")
task: Task
path: Path = Path("task.toml")
task: Task # Task name (e.g., hw3 ex5)
release: Release # Release configuration
stages: List[Stage] # list of stage configurations

View File

@ -11,15 +11,15 @@ from joj3_config_generator.models import repo, task
def read_convert_files(
case_name: str,
) -> Tuple[repo.Config, task.Config, Dict[str, Any]]:
root = Path(__file__).resolve().parent
repo_toml_path = root.absolute() / case_name / "repo.toml"
root = Path(__file__).resolve().parent / case_name
repo_toml_path = root / "repo.toml"
repo_toml = repo_toml_path.read_text() if repo_toml_path.exists() else ""
task_toml_path = root.absolute() / case_name / "task.toml"
task_toml_path = root / "task.toml"
task_toml = task_toml_path.read_text() if task_toml_path.exists() else ""
result = json.loads((root.absolute() / case_name / "task.json").read_text())
result = json.loads((root / "task.json").read_text())
return (
repo.Config(**rtoml.loads(repo_toml)),
task.Config(**rtoml.loads(task_toml)),
repo.Config(root=root, **rtoml.loads(repo_toml)),
task.Config(root=root, **rtoml.loads(task_toml)),
result,
)

View File

@ -1,7 +0,0 @@
from typing import Any
def safe_id(x: Any) -> str:
if not x or not isinstance(x, (tuple, list)) or len(x) == 0:
return "no_test_cases"
return str(x[0])