Skip to content

Commit e5d9634

Browse files
mzuennimpsijm
andcommitted
Add bt upgrade (#432)
* add bt upgrade * implemented todos * introduce SPEC constant * remove legacy parsing * fix * fix * simplify code * upgrade test files * remove empty keys * updated test yamls * fix * fix name * use newer version of bt upgrade * improve bt upgrade * add missing dir * [upgrade] Remove comments from limits if both limits are the new default * [upgrade] Ad-hoc import for CommentedMap and CommentedSeq * try to insert testdata before data * try to preserve the right comments * try to preserve the right comments * [upgrade] Improve preserving of comments when removing keys * [upgrade] Improve replacing of keys at their original position * fix errors * rerun upgrade * readd output validator dir * [upgrade] Only write generators.yaml when it changed --------- Co-authored-by: Maarten Sijm <[email protected]>
1 parent 8161d45 commit e5d9634

File tree

38 files changed

+600
-498
lines changed

38 files changed

+600
-498
lines changed

bin/config.py

+2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
from collections.abc import Mapping, Sequence
88
from typing import Final, Literal, Optional
99

10+
SPEC_VERSION: Final[str] = "2023-07-draft"
11+
1012
# return values
1113
RTV_AC: Final[int] = 42
1214
RTV_WA: Final[int] = 43

bin/export.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ def add_file(path, source):
172172

173173
# DOMjudge does not support 'type' in problem.yaml nor 'output_validator_args' in testdata.yaml yet.
174174
# TODO: Remove this once it does.
175-
if not config.args.kattis and not problem.settings.is_legacy():
175+
if not config.args.kattis:
176176
yaml_path = export_dir / "problem.yaml"
177177
yaml_data = [yaml_path.read_text(), "\nvalidation:"]
178178
if problem.custom_output:

bin/problem.py

+88-210
Large diffs are not rendered by default.

bin/tools.py

+13
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
import solve_stats
4040
import download_submissions
4141
import stats
42+
import upgrade
4243
import validate
4344
import signal
4445

@@ -351,6 +352,13 @@ def build_parser():
351352
)
352353
subparsers.required = True
353354

355+
# upgrade
356+
subparsers.add_parser(
357+
"upgrade",
358+
parents=[global_parser],
359+
help="Upgrade a problem or contest.",
360+
)
361+
354362
# New contest
355363
contestparser = subparsers.add_parser(
356364
"new_contest",
@@ -916,6 +924,11 @@ def run_parsed_arguments(args):
916924
else:
917925
config.args.testcases = []
918926

927+
# upgrade commands.
928+
if action == "upgrade":
929+
upgrade.upgrade()
930+
return
931+
919932
# Skel commands.
920933
if action == "new_contest":
921934
skel.new_contest()

0 commit comments

Comments
 (0)