chore: organize fields

This commit is contained in:
张泊明518370910136 2025-06-29 13:33:21 -04:00
parent 26824fd93c
commit 6769e19d83
GPG Key ID: D47306D7062CDA9D
2 changed files with 12 additions and 11 deletions

View File

@ -34,6 +34,9 @@ class Issue(BaseModel):
class Config(BaseModel): class Config(BaseModel):
root: Path = Field(Path("."), exclude=True)
path: Path = Field(Path("repo.toml"), exclude=True)
max_size: float = Field( max_size: float = Field(
10, ge=0, validation_alias=AliasChoices("max-size", "max_size") 10, ge=0, validation_alias=AliasChoices("max-size", "max_size")
) )
@ -61,8 +64,6 @@ class Config(BaseModel):
), ),
) )
groups: Groups = Groups() groups: Groups = Groups()
root: Path = Path(".")
path: Path = Path("repo.toml")
grading_repo_name: str = Field( grading_repo_name: str = Field(
"", "",
validation_alias=AliasChoices("grading-repo-name", "grading_repo_name"), validation_alias=AliasChoices("grading-repo-name", "grading_repo_name"),

View File

@ -263,20 +263,20 @@ class Penalties(BaseModel):
class Config(BaseModel): class Config(BaseModel):
root: Path = Path(".") root: Path = Field(Path("."), exclude=True)
path: Path = Path("task.toml") path: Path = Field(Path("task.toml"), exclude=True)
suffix: str = Field("", exclude=True)
task: Task = Task() # Task name (e.g., hw3 ex5) 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( max_total_score: Optional[int] = Field(
None, validation_alias=AliasChoices("max-total-score", "max_total_score") None, validation_alias=AliasChoices("max-total-score", "max_total_score")
) )
scoreboard: str = "scoreboard.csv" scoreboard: str = "scoreboard.csv"
time: SubmissionTime = SubmissionTime() # Valid time configuration
suffix: str = Field("", exclude=True) release: Release = Release() # Release configuration
groups: Groups = Groups()
penalties: Penalties = Penalties()
stages: List[Stage] = [] # list of stage configurations
@model_validator(mode="after") @model_validator(mode="after")
def set_suffix(self) -> "Config": def set_suffix(self) -> "Config":