From 6769e19d832d1db8befab41da96178a27cd43cd9 Mon Sep 17 00:00:00 2001 From: Boming Zhang Date: Sun, 29 Jun 2025 13:33:21 -0400 Subject: [PATCH] chore: organize fields --- joj3_config_generator/models/repo.py | 5 +++-- joj3_config_generator/models/task.py | 18 +++++++++--------- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/joj3_config_generator/models/repo.py b/joj3_config_generator/models/repo.py index 74d0936..c0bdf47 100644 --- a/joj3_config_generator/models/repo.py +++ b/joj3_config_generator/models/repo.py @@ -34,6 +34,9 @@ class Issue(BaseModel): class Config(BaseModel): + root: Path = Field(Path("."), exclude=True) + path: Path = Field(Path("repo.toml"), exclude=True) + max_size: float = Field( 10, ge=0, validation_alias=AliasChoices("max-size", "max_size") ) @@ -61,8 +64,6 @@ class Config(BaseModel): ), ) groups: Groups = Groups() - root: Path = Path(".") - path: Path = Path("repo.toml") grading_repo_name: str = Field( "", validation_alias=AliasChoices("grading-repo-name", "grading_repo_name"), diff --git a/joj3_config_generator/models/task.py b/joj3_config_generator/models/task.py index 0b24f3b..8ccdf28 100644 --- a/joj3_config_generator/models/task.py +++ b/joj3_config_generator/models/task.py @@ -263,20 +263,20 @@ class Penalties(BaseModel): class Config(BaseModel): - root: Path = Path(".") - path: Path = Path("task.toml") + root: Path = Field(Path("."), exclude=True) + path: Path = Field(Path("task.toml"), exclude=True) + suffix: str = Field("", exclude=True) + task: Task = Task() # Task name (e.g., hw3 ex5) - time: SubmissionTime = SubmissionTime() # Valid time configuration - release: Release = Release() # Release configuration - stages: List[Stage] = [] # list of stage configurations - groups: Groups = Groups() - penalties: Penalties = Penalties() max_total_score: Optional[int] = Field( None, validation_alias=AliasChoices("max-total-score", "max_total_score") ) scoreboard: str = "scoreboard.csv" - - suffix: str = Field("", exclude=True) + time: SubmissionTime = SubmissionTime() # Valid time configuration + release: Release = Release() # Release configuration + groups: Groups = Groups() + penalties: Penalties = Penalties() + stages: List[Stage] = [] # list of stage configurations @model_validator(mode="after") def set_suffix(self) -> "Config":