Skip to content

Commit 1b7dc86

Browse files
RagnarGrootKoerkampmpsijm
authored andcommitted
Add update_problems_yaml --number to use numeric Sxx labels
1 parent 034f16b commit 1b7dc86

File tree

3 files changed

+15
-1
lines changed

3 files changed

+15
-1
lines changed

bin/config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@
120120
grep -Ev '^(h|jobs|time|verbose)$' | sed 's/^/"/;s/$/",/' | tr '\n' ' ' | sed 's/^/ARGS_LIST: Final[Sequence[str]] = [/;s/, $/]\n/'
121121
"""
122122
# fmt: off
123-
ARGS_LIST: Final[Sequence[str]] = ["1", "add", "all", "answer", "api", "author", "check_deterministic", "clean", "colors", "contest", "contest_id", "contestname", "cp", "defaults", "default_solution", "depth", "directory", "error", "force", "force_build", "generic", "input", "interaction", "interactive", "invalid", "kattis", "lang", "latest_bt", "legacy", "memory", "more", "move_to", "no_bar", "no_generate", "no_solution", "no_solutions", "no_testcase_sanity_checks", "no_time_limit", "no_validators", "no_visualizer", "open", "order", "order_from_ccs", "overview", "password", "post_freeze", "problem", "problemname", "remove", "reorder", "samples", "sanitizer", "skel", "skip", "sort", "submissions", "table", "testcases", "time_limit", "timeout", "token", "tree", "type", "username", "valid_output", "watch", "web", "write"]
123+
ARGS_LIST: Final[Sequence[str]] = ["1", "add", "all", "answer", "api", "author", "check_deterministic", "clean", "colors", "contest", "contest_id", "contestname", "cp", "defaults", "default_solution", "depth", "directory", "error", "force", "force_build", "generic", "input", "interaction", "interactive", "invalid", "kattis", "lang", "latest_bt", "legacy", "memory", "more", "move_to", "no_bar", "no_generate", "no_solution", "no_solutions", "no_testcase_sanity_checks", "no_time_limit", "no_validators", "no_visualizer", "number", "open", "order", "order_from_ccs", "overview", "password", "post_freeze", "problem", "problemname", "remove", "reorder", "samples", "sanitizer", "skel", "skip", "sort", "submissions", "table", "testcases", "time_limit", "timeout", "token", "tree", "type", "username", "valid_output", "watch", "web", "write"]
124124
# fmt: on
125125

126126

bin/export.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -565,6 +565,15 @@ def update_problems_yaml(problems: list[Problem], colors: Optional[list[str]] =
565565
d["label"] = label
566566
label = inc_label(label)
567567

568+
if config.args.number:
569+
n = 0
570+
for d in data:
571+
n += 1
572+
newlabel = f"S{n:>02}"
573+
if d["label"] != newlabel:
574+
d["label"] = newlabel
575+
change = True
576+
568577
if change:
569578
if config.args.action in ["update_problems_yaml"] or ask_variable_bool(
570579
"Update problems.yaml with latest values"

bin/tools.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -927,6 +927,11 @@ def build_parser():
927927
action="store_true",
928928
help="Sort the problems by id.",
929929
)
930+
updateproblemsyamlparser.add_argument(
931+
"--number",
932+
action="store_true",
933+
help="Use Sxx as problem labels.",
934+
)
930935
updateproblemsyamlparser.add_argument(
931936
"--legacy",
932937
action="store_true",

0 commit comments

Comments
 (0)