chore: simpler models
This commit is contained in:
parent
09409158fa
commit
a03c1d8cf5
|
@ -139,7 +139,7 @@ class Parser(str, Enum):
|
||||||
ELF = "elf"
|
ELF = "elf"
|
||||||
|
|
||||||
|
|
||||||
class CaseBase(BaseModel):
|
class Case(BaseModel):
|
||||||
env: List[str] = []
|
env: List[str] = []
|
||||||
command: str = "" # Command to run
|
command: str = "" # Command to run
|
||||||
files: StageFiles = StageFiles()
|
files: StageFiles = StageFiles()
|
||||||
|
@ -149,14 +149,10 @@ class CaseBase(BaseModel):
|
||||||
True, validation_alias=AliasChoices("copy-in-cwd", "copy_in_cwd")
|
True, validation_alias=AliasChoices("copy-in-cwd", "copy_in_cwd")
|
||||||
)
|
)
|
||||||
limit: Limit = Limit()
|
limit: Limit = Limit()
|
||||||
score: int = 0
|
|
||||||
|
|
||||||
|
|
||||||
class DictCase(CaseBase):
|
|
||||||
diff: ParserDiff = ParserDiff()
|
diff: ParserDiff = ParserDiff()
|
||||||
|
|
||||||
|
|
||||||
class Stage(CaseBase):
|
class Stage(Case):
|
||||||
name: str = "" # stage name
|
name: str = "" # stage name
|
||||||
skip: List[str] = []
|
skip: List[str] = []
|
||||||
|
|
||||||
|
@ -176,9 +172,9 @@ class Stage(CaseBase):
|
||||||
validation_alias=AliasChoices("result-detail", "result_detail"),
|
validation_alias=AliasChoices("result-detail", "result_detail"),
|
||||||
)
|
)
|
||||||
file: ParserFile = ParserFile()
|
file: ParserFile = ParserFile()
|
||||||
diff: ParserDiff = ParserDiff()
|
# diff: ParserDiff = ParserDiff() # inherited from Case
|
||||||
|
|
||||||
cases: Dict[str, DictCase] = {}
|
cases: Dict[str, Case] = {}
|
||||||
|
|
||||||
model_config = ConfigDict(extra="allow")
|
model_config = ConfigDict(extra="allow")
|
||||||
|
|
||||||
|
|
|
@ -276,7 +276,7 @@ def fix_diff(
|
||||||
|
|
||||||
|
|
||||||
def get_unspecified_cases(
|
def get_unspecified_cases(
|
||||||
task_root: Path, task_path: Path, cases: Dict[str, task.DictCase]
|
task_root: Path, task_path: Path, cases: Dict[str, task.Case]
|
||||||
) -> List[str]:
|
) -> List[str]:
|
||||||
testcases = set()
|
testcases = set()
|
||||||
for testcases_path in (task_root / task_path).parent.glob("**/*.in"):
|
for testcases_path in (task_root / task_path).parent.glob("**/*.in"):
|
||||||
|
@ -306,7 +306,7 @@ def get_unspecified_cases(
|
||||||
|
|
||||||
|
|
||||||
def get_stdin_stdout(
|
def get_stdin_stdout(
|
||||||
task_root: Path, task_path: Path, case_name: str, case: task.DictCase
|
task_root: Path, task_path: Path, case_name: str, case: task.Case
|
||||||
) -> Tuple[result.Stdin, Optional[str]]:
|
) -> Tuple[result.Stdin, Optional[str]]:
|
||||||
case_stdout_name = case.out_ if case.out_ else f"{case_name}.out"
|
case_stdout_name = case.out_ if case.out_ else f"{case_name}.out"
|
||||||
stdin: result.Stdin = result.MemoryFile(content="")
|
stdin: result.Stdin = result.MemoryFile(content="")
|
||||||
|
|
Loading…
Reference in New Issue
Block a user