Skip to content

Commit f47c814

Browse files
authored
Merge pull request #467 from RagnarGrootKoerkamp/cd-before-reading-personal-config
[tools] Separate changing to contest directory and getting problems list
2 parents e9e66ec + ad34218 commit f47c814

File tree

6 files changed

+166
-150
lines changed

6 files changed

+166
-150
lines changed

bin/config.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,14 +125,18 @@
125125
# fmt: on
126126

127127

128-
def set_default_args() -> None:
128+
def set_default_args() -> list[str]:
129129
# Set default argument values.
130+
missing = []
130131
for arg in ARGS_LIST:
131132
if not hasattr(args, arg):
132133
setattr(args, arg, None)
134+
missing.append(arg)
133135
for arg, value in DEFAULT_ARGS.items():
134136
if not hasattr(args, arg):
135137
setattr(args, arg, value)
138+
missing.append(arg)
139+
return missing
136140

137141

138142
level: Optional[Literal["problem", "problemset"]] = None

bin/contest.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,11 @@ def problems_yaml() -> Optional[list[dict[str, Any]]]:
3838
_problems_yaml = False
3939
return None
4040
_problems_yaml = read_yaml(problemsyaml_path)
41+
if _problems_yaml is None:
42+
_problems_yaml = False
43+
return None
44+
if not isinstance(_problems_yaml, list):
45+
fatal("problems.yaml must contain a list of problems")
4146
return cast(list[dict[str, Any]], _problems_yaml)
4247

4348

bin/stats.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,7 @@ def get_submissions_row(
380380
values = []
381381
for problem in problems:
382382
directory = (
383-
Path().cwd() / "submissions" / problem.name
383+
Path.cwd() / "submissions" / problem.name
384384
if team_submissions
385385
else problem.path / "submissions"
386386
)

0 commit comments

Comments
 (0)