Skip to content

Commit c2a08e0

Browse files
committed
Rename variables multipass to multi_pass
1 parent 57d26ec commit c2a08e0

10 files changed

+45
-45
lines changed

bin/constraints.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ def check_validators(problem):
2222
if not in_constraints:
2323
warn("No constraint validation of input values found in input validators.")
2424
problem.validate_data(validate.Mode.ANSWER, constraints=ans_constraints)
25-
if not problem.interactive and not problem.multipass and not ans_constraints:
25+
if not problem.interactive and not problem.multi_pass and not ans_constraints:
2626
log("No constraint validation of answer values found in answer or output validators.")
2727
print()
2828

bin/export.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -74,11 +74,11 @@ def build_samples_zip(problems, output, statement_language):
7474
outputdir = Path(problem.label)
7575

7676
attachments_dir = problem.path / "attachments"
77-
if (problem.interactive or problem.multipass) and not attachments_dir.is_dir():
77+
if (problem.interactive or problem.multi_pass) and not attachments_dir.is_dir():
7878
interactive = "interactive " if problem.interactive else ""
79-
multipass = "multi-pass " if problem.multipass else ""
79+
multi_pass = "multi-pass " if problem.multi_pass else ""
8080
util.error(
81-
f"{interactive}{multipass}problem {problem.name} does not have an attachments/ directory."
81+
f"{interactive}{multi_pass}problem {problem.name} does not have an attachments/ directory."
8282
)
8383
continue
8484

@@ -96,7 +96,7 @@ def build_samples_zip(problems, output, statement_language):
9696
util.error(f"Cannot include broken file {f}.")
9797

9898
# Add samples for non-interactive and non-multi-pass problems.
99-
if not problem.interactive and not problem.multipass:
99+
if not problem.interactive and not problem.multi_pass:
100100
samples = problem.testcases(only_samples=True)
101101
if samples:
102102
for i in range(0, len(samples)):
@@ -128,15 +128,15 @@ def build_problem_zip(problem, output):
128128
("problem_statement/*", True),
129129
("submissions/accepted/**/*", True),
130130
("submissions/*/**/*", False),
131-
("attachments/**/*", problem.interactive or problem.multipass),
131+
("attachments/**/*", problem.interactive or problem.multi_pass),
132132
]
133133

134134
testcases = [
135135
("data/secret/**/*.in", True),
136-
("data/sample/**/*.in", not problem.interactive and not problem.multipass),
136+
("data/sample/**/*.in", not problem.interactive and not problem.multi_pass),
137137
]
138138

139-
if problem.interactive or problem.multipass:
139+
if problem.interactive or problem.multi_pass:
140140
# .interaction files don't need a corresponding .in
141141
# therefore we can handle them like all other files
142142
files += [("data/sample/**/*.interaction", False)]

bin/fuzz.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ def _run(self, bar):
7272
localbar.done()
7373

7474
# Generate .ans.
75-
if not self.fuzz.problem.interactive and not self.fuzz.problem.multipass:
75+
if not self.fuzz.problem.interactive and not self.fuzz.problem.multi_pass:
7676
if self.solution and not testcase.ans_path.is_file():
7777
if testcase.ans_path.is_file():
7878
testcase.ans_path.unlink()

bin/generate.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -706,11 +706,11 @@ def validate_ans(t, problem, testcase, meta_yaml, bar):
706706
ansfile = problem.tmpdir / "data" / t.hash / "testcase.ans"
707707
assert ansfile.is_file()
708708

709-
if problem.interactive or problem.multipass:
709+
if problem.interactive or problem.multi_pass:
710710
if ansfile.stat().st_size != 0:
711711
interactive = "interaction " if problem.interactive else ""
712-
multipass = "multipass " if problem.multipass else ""
713-
bar.warn(f".ans file for {interactive}{multipass}problem is expected to be empty.")
712+
multi_pass = "multi-pass " if problem.multi_pass else ""
713+
bar.warn(f".ans file for {interactive}{multi_pass}problem is expected to be empty.")
714714
else:
715715
size = ansfile.stat().st_size
716716
if (
@@ -958,8 +958,8 @@ def needed(ext):
958958

959959
used_solution = False
960960
changed_ans = False
961-
if problem.interactive or problem.multipass:
962-
# Generate empty ans file for interactive/multipass problems
961+
if problem.interactive or problem.multi_pass:
962+
# Generate empty ans file for interactive/multi-pass problems
963963
if ".ans" not in meta_yaml["generated_extensions"]:
964964
if not ansfile.is_file() or ansfile.stat().st_size != 0:
965965
ansfile.write_text("")
@@ -1829,7 +1829,7 @@ def build_program(p):
18291829
build_programs(program.Visualizer, visualizers_used)
18301830

18311831
self.problem.validators(validate.InputValidator)
1832-
if not self.problem.interactive and not self.problem.multipass:
1832+
if not self.problem.interactive and not self.problem.multi_pass:
18331833
self.problem.validators(validate.AnswerValidator)
18341834
self.problem.validators(validate.OutputValidator)
18351835

bin/interactive.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ def get_validator_command():
6464
validator_dir = output_validator.tmpdir
6565
submission_dir = run.submission.tmpdir
6666

67-
nextpass = run.feedbackdir / "nextpass.in" if run.problem.multipass else False
67+
nextpass = run.feedbackdir / "nextpass.in" if run.problem.multi_pass else False
6868

6969
if config.args.verbose >= 2:
7070
print("Validator: ", *get_validator_command(), file=sys.stderr)
@@ -132,7 +132,7 @@ def get_validator_command():
132132
_feedback(run, validator_err),
133133
exec_res.err,
134134
verdict,
135-
pass_id if run.problem.multipass else None,
135+
pass_id if run.problem.multi_pass else None,
136136
)
137137
else:
138138
tle_result.timeout_expired |= max_duration >= timeout
@@ -170,7 +170,7 @@ def get_validator_command():
170170
_feedback(run, validator_err),
171171
exec_res.err,
172172
verdict,
173-
pass_id if run.problem.multipass else None,
173+
pass_id if run.problem.multi_pass else None,
174174
)
175175
else:
176176
tle_result.duration = max_duration
@@ -401,7 +401,7 @@ def kill_handler_function():
401401
val_err,
402402
team_err,
403403
verdict,
404-
pass_id if run.problem.multipass else None,
404+
pass_id if run.problem.multi_pass else None,
405405
)
406406
else:
407407
tle_result.timeout_expired |= aborted
@@ -433,7 +433,7 @@ def kill_handler_function():
433433
val_err,
434434
team_err,
435435
verdict,
436-
pass_id if run.problem.multipass else None,
436+
pass_id if run.problem.multi_pass else None,
437437
)
438438
else:
439439
tle_result.duration = max_duration

bin/latex.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -104,10 +104,10 @@ def flush():
104104
last = line[0]
105105
flush()
106106
else:
107-
assert problem.multipass
107+
assert problem.multi_pass
108108

109-
multipass_dir = builddir / "multipass"
110-
multipass_dir.mkdir(exist_ok=True)
109+
multi_pass_dir = builddir / "multi_pass"
110+
multi_pass_dir.mkdir(exist_ok=True)
111111

112112
lines = sample.read_text()
113113
last = "<"
@@ -121,8 +121,8 @@ def flush():
121121
def flush():
122122
nonlocal current_sample
123123

124-
in_path = multipass_dir / f"{sample_name}-{pass_id:02}.in"
125-
out_path = multipass_dir / f"{sample_name}-{pass_id:02}.out"
124+
in_path = multi_pass_dir / f"{sample_name}-{pass_id:02}.in"
125+
out_path = multi_pass_dir / f"{sample_name}-{pass_id:02}.out"
126126
in_path.write_text(cur_in)
127127
out_path.write_text(cur_out)
128128

bin/problem.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -309,15 +309,15 @@ def _read_settings(self):
309309
# Aliasing fields makes life easier for us 😛
310310
self.limits: ProblemLimits = self.settings.limits
311311
self.interactive: bool = self.settings.interactive
312-
self.multipass: bool = self.settings.multi_pass
312+
self.multi_pass: bool = self.settings.multi_pass
313313
self.custom_output: bool = self.settings.custom_output
314314

315315
# Handle dependencies...
316316
has_validation_passes = self.limits.validation_passes is not None
317-
if self.multipass and not has_validation_passes:
317+
if self.multi_pass and not has_validation_passes:
318318
self.limits.validation_passes = 2
319-
if not self.multipass and has_validation_passes:
320-
warn("limit: validation_passes is only used for multipass problems. SKIPPED.")
319+
if not self.multi_pass and has_validation_passes:
320+
warn("limit: validation_passes is only used for multi_pass problems. SKIPPED.")
321321

322322
def _parse_testdata_yaml(p, path, bar):
323323
assert path.is_relative_to(p.path / "data")
@@ -470,14 +470,14 @@ def testcases(
470470
for f in in_paths:
471471
t = testcase.Testcase(p, f, print_warn=True)
472472
if (
473-
(p.interactive or p.multipass)
473+
(p.interactive or p.multi_pass)
474474
and mode == validate.Mode.INVALID
475475
and t.root in ["invalid_answers", "invalid_outputs"]
476476
):
477477
msg = ""
478478
if p.interactive:
479479
msg += " interactive"
480-
if p.multipass:
480+
if p.multi_pass:
481481
msg += " multi-pass"
482482
warn(f"Found file {f} for {mode} validation in{msg} problem. Skipping.")
483483
continue
@@ -530,7 +530,7 @@ def statement_samples(p) -> list[Path | tuple[Path, Path]]:
530530
# Non-interactive and Non-multi-pass problems should not have .interaction files.
531531
# On the other hand, interactive problems are allowed to have .{in,ans}.statement files,
532532
# so that they can emulate a non-interactive problem with on-the-fly generated input.
533-
if not p.interactive and not p.multipass:
533+
if not p.interactive and not p.multi_pass:
534534
if len(interaction_paths) != 0:
535535
warn(
536536
f"Non-interactive/Non-multi-pass problem {p.name} should not have data/sample/*.interaction files."
@@ -934,12 +934,12 @@ def validate_data(problem, mode: validate.Mode, constraints: dict | bool | None
934934
constraints = {}
935935
assert constraints is None or isinstance(constraints, dict)
936936

937-
if (problem.interactive or problem.multipass) and mode == validate.Mode.ANSWER:
937+
if (problem.interactive or problem.multi_pass) and mode == validate.Mode.ANSWER:
938938
if (problem.path / "answer_validators").exists():
939939
msg = ""
940940
if problem.interactive:
941941
msg += " interactive"
942-
if problem.multipass:
942+
if problem.multi_pass:
943943
msg += " multi-pass"
944944
log(f"Not running answer_validators for{msg} problems.")
945945
return True
@@ -953,12 +953,12 @@ def validate_data(problem, mode: validate.Mode, constraints: dict | bool | None
953953
testcases = problem.testcases(mode=mode)
954954
case validate.Mode.ANSWER:
955955
assert not problem.interactive
956-
assert not problem.multipass
956+
assert not problem.multi_pass
957957
problem.validators(validate.AnswerValidator, check_constraints=check_constraints)
958958
testcases = problem.testcases(mode=mode)
959959
case validate.Mode.INVALID:
960960
problem.validators(validate.InputValidator)
961-
if not problem.interactive and not problem.multipass:
961+
if not problem.interactive and not problem.multi_pass:
962962
problem.validators(validate.AnswerValidator)
963963
testcases = problem.testcases(mode=mode)
964964
case _:

bin/run.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ def run(self, bar, *, interaction=None, submission_args=None):
7676
if interaction:
7777
assert not interaction.is_relative_to(self.tmpdir)
7878
interaction = interaction.open("a")
79-
nextpass = self.feedbackdir / "nextpass.in" if self.problem.multipass else False
79+
nextpass = self.feedbackdir / "nextpass.in" if self.problem.multi_pass else False
8080
pass_id = 0
8181
max_duration = 0
8282
tle_result = None
@@ -103,7 +103,7 @@ def run(self, bar, *, interaction=None, submission_args=None):
103103
result.verdict = Verdict.TIME_LIMIT_EXCEEDED
104104
if tle_result is None:
105105
tle_result = result
106-
tle_result.pass_id = pass_id if self.problem.multipass else None
106+
tle_result.pass_id = pass_id if self.problem.multi_pass else None
107107
else:
108108
tle_result.timeout_expired |= result.timeout_expired
109109
if not self._continue_with_tle(result.verdict, result.timeout_expired):
@@ -163,7 +163,7 @@ def run(self, bar, *, interaction=None, submission_args=None):
163163
if interaction:
164164
interaction.close()
165165

166-
if self.problem.multipass:
166+
if self.problem.multi_pass:
167167
result.pass_id = pass_id
168168

169169
if tle_result is not None:
@@ -180,15 +180,15 @@ def run(self, bar, *, interaction=None, submission_args=None):
180180
self.out_path.unlink()
181181

182182
if result.verdict and (self.feedbackdir / "nextpass.in").is_file():
183-
assert not self.problem.multipass
183+
assert not self.problem.multi_pass
184184
bar.warn("Validator created nextpass.in for non multi-pass problem. Ignored.")
185185

186186
self.result = result
187187
return result
188188

189189
# check if we should continue after tle
190190
def _continue_with_tle(self, verdict, timeout_expired):
191-
if not self.problem.multipass:
191+
if not self.problem.multi_pass:
192192
return False
193193
if verdict != Verdict.TIME_LIMIT_EXCEEDED:
194194
return False
@@ -374,7 +374,7 @@ def run_testcases(
374374
):
375375
runs = [Run(self.problem, self, testcase) for testcase in testcases]
376376
max_testcase_len = max(len(run.name) for run in runs)
377-
if self.problem.multipass:
377+
if self.problem.multi_pass:
378378
max_testcase_len += 2
379379
max_item_len = max_testcase_len + max_submission_name_len - len(self.name)
380380
padding_len = max_submission_name_len - len(self.name)
@@ -463,7 +463,7 @@ def process_run(run: Run):
463463
timeout = result.duration >= self.limits["timeout"]
464464
duration_style = Style.BRIGHT if timeout else ""
465465
passmsg = (
466-
f":{Fore.CYAN}{result.pass_id}{Style.RESET_ALL}" if self.problem.multipass else ""
466+
f":{Fore.CYAN}{result.pass_id}{Style.RESET_ALL}" if self.problem.multi_pass else ""
467467
)
468468
testcase = f"{run.name}{Style.RESET_ALL}{passmsg}"
469469
style_len = len(f"{Style.RESET_ALL}")

bin/stats.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ def count(path):
173173
def value(x):
174174
if x[0] == " time" or x[0] == "subs":
175175
return x[1](problem)
176-
if x[0] == "A" and (problem.interactive or problem.multipass):
176+
if x[0] == "A" and (problem.interactive or problem.multi_pass):
177177
return None # Do not show an entry for the answer validator if it is not required
178178
if x[0] == "O" and not problem.custom_output:
179179
return None # Do not show an entry for the output validator if it is not required

bin/testcase.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ def validate_format(
218218
return ok
219219

220220
assert not self.problem.interactive
221-
assert not self.problem.multipass
221+
assert not self.problem.multi_pass
222222

223223
ok = self.validate_format(
224224
validate.Mode.ANSWER,

0 commit comments

Comments
 (0)