Skip to content

Commit baae8d8

Browse files
mzuennithorehusfeldtmpsijm
authored
Draft visualizer (#448)
* copied from mpsijm * update identity * update schemas * update doc * default value for action * move visualizer * remove testcases * add warning for outdated visualizer * add output visualizer (and made open more consistent) * add comments * implemented output visualizer * change visualizer interface * handle args * dont use answer_validator_args * properly resolve problem paths * fix * typing * typing * typing * typing * allow empty .ans files for multipass * fix test * refactored movetree * allow moving sylinks * improve _move_dir * improved user experience * add extra assert * substitute more constants in export * implement visualizer for interactive problems * `identity` output-visualize also ans and in * add example arg * fix arg passing * fix wsl * disable output visualizer again * removed outdated warning * always copy output visualizer from skel * `guess` output visualizer for an interactive problem * update type * more feedback * Update skel/problem/input_visualizer/readme.md Co-authored-by: Maarten Sijm <[email protected]> * Update skel/problem/input_visualizer/readme.md Co-authored-by: Maarten Sijm <[email protected]> * Update bin/generate.py Co-authored-by: Maarten Sijm <[email protected]> * update version * format * format * added example * update visualizer logic * fix mode * fix mode * simplify code * add warning for deprecated root key * Problem._parse_testdata_yaml: enforce validator/visualizer args to be lists of strings * [visualize] Rename InputVisualizer to TestCaseVisualizer --------- Co-authored-by: Thore Husfeldt <[email protected]> Co-authored-by: Maarten Sijm <[email protected]>
1 parent dd7cb2d commit baae8d8

File tree

42 files changed

+787
-446
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+787
-446
lines changed

.github/workflows/ci.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -51,5 +51,6 @@ jobs:
5151
texlive-science
5252
latexmk
5353
texlive-lang-german
54+
asymptote
5455
- shell: wsl-bash {0}
5556
run: pytest

bin/config.py

+2
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,8 @@
108108
"jobs": (os.cpu_count() or 1) // 2,
109109
"time": 600, # Used for `bt fuzz`
110110
"verbose": 0,
111+
"action": None,
112+
"no_visualizer": True,
111113
}
112114

113115

bin/contest.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def problems_yaml() -> Optional[list[dict[str, Any]]]:
4141

4242

4343
def get_api() -> str:
44-
api = config.args.api or contest_yaml().get("api")
44+
api = config.args.api or cast(str, contest_yaml().get("api"))
4545
if not api:
4646
fatal(
4747
"Could not find key `api` in contest.yaml and it was not specified on the command line."

bin/export.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
from latex import PdfType
1414
from problem import Problem
1515
from validate import InputValidator, AnswerValidator, OutputValidator
16+
from visualize import TestCaseVisualizer, OutputVisualizer
1617

1718

1819
def select_languages(problems: list[Problem]) -> list[str]:
@@ -125,6 +126,8 @@ def build_problem_zip(problem: Problem, output: Path) -> bool:
125126
("submissions/accepted/**/*", True),
126127
("submissions/*/**/*", False),
127128
("attachments/**/*", problem.interactive or problem.multi_pass),
129+
(f"{TestCaseVisualizer.source_dir}/**/*", False),
130+
(f"{OutputVisualizer.source_dir}/**/*", False),
128131
]
129132

130133
# Do not include PDFs for kattis.
@@ -212,6 +215,8 @@ def add_testcase(in_file: Path) -> None:
212215
f"{OutputValidator.source_dir}/**/*",
213216
# "statement/*", "solution/*", "problem_slide/*", use \constant{} commands
214217
# "submissions/*/**/*", removed support?
218+
f"{TestCaseVisualizer.source_dir}/**/*",
219+
f"{OutputVisualizer.source_dir}/**/*",
215220
]
216221
for pattern in constants_supported:
217222
for f in export_dir.glob(pattern):
@@ -292,7 +297,7 @@ def add_testcase(in_file: Path) -> None:
292297
validator_flags = " ".join(
293298
problem.get_testdata_yaml(
294299
problem.path / "data",
295-
"output_validator_args",
300+
OutputValidator.args_key,
296301
PrintBar("Getting validator_flags for legacy export"),
297302
)
298303
)

0 commit comments

Comments
 (0)