Skip to content

Commit

Permalink
Fix formatting to make CI happy
Browse files Browse the repository at this point in the history
  • Loading branch information
mpsijm committed Feb 16, 2024
1 parent d6cb3f7 commit 7b52afd
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 21 deletions.
4 changes: 1 addition & 3 deletions bin/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -448,9 +448,7 @@ def build_parser():
input_answer_group.add_argument(
'--input', '-i', action='store_true', help='Only validate input.'
)
input_answer_group.add_argument(
'--answer', action='store_true', help='Only validate answer.'
)
input_answer_group.add_argument('--answer', action='store_true', help='Only validate answer.')
input_answer_group.add_argument(
'--invalid', action='store_true', help='Only check invalid files for validity.'
)
Expand Down
7 changes: 6 additions & 1 deletion bin/validate.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,12 @@ def _run_helper(self, testcase, constraints, args):
cwd = testcase.in_path.with_suffix('.feedbackdir')
else:
name = self.tmpdir.relative_to(self.problem.tmpdir)
cwd = self.problem.tmpdir / 'tool_runs' / name / testcase.short_path.with_suffix('.feedbackdir')
cwd = (
self.problem.tmpdir
/ 'tool_runs'
/ name
/ testcase.short_path.with_suffix('.feedbackdir')
)
cwd.mkdir(parents=True, exist_ok=True)
arglist = []
if args is not None:
Expand Down
2 changes: 0 additions & 2 deletions doc/validation.md
Original file line number Diff line number Diff line change
Expand Up @@ -171,5 +171,3 @@ For interactive problems (`validation: custom interactive`), the invocation is
the same as above, but `stdin` is a pipe that feeds team output into the
validator instead of a file.
Similarly, `stdout` is connected to a pipe that forwards to the submission's `stdin`.


12 changes: 3 additions & 9 deletions skel/testing_tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,7 @@ def read(p):
return line


parser = argparse.ArgumentParser(
description="Testing tool for problem Ducky Debugging."
)
parser = argparse.ArgumentParser(description="Testing tool for problem XXX.") # TODO update name
parser.add_argument(
"-f",
dest="inputfile",
Expand Down Expand Up @@ -117,12 +115,8 @@ def type(x, y):
assert 1 <= x2 and x2 <= w, "Point not in bounds"
assert 1 <= y2 and y2 <= h, "Point not in bounds"
assert (x1, y1) != (x2, y2)
assert (
type(x1, y1) == "horizon"
), "First point does not lie on the horizon."
assert (
type(x2, y2) == "horizon"
), "First point does not lie on the horizon."
assert type(x1, y1) == "horizon", "First point does not lie on the horizon."
assert type(x2, y2) == "horizon", "First point does not lie on the horizon."
break
else:
assert False, "Line does not start with question or exclamation mark."
Expand Down
4 changes: 2 additions & 2 deletions support/schemas/generators.cue
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ package problemformat
import "struct"

// A command invokes a generator, like "tree --n 5".
// The regex restricts occurrences of curly-bracked expressions
// The regex restricts occurrences of curly-bracketed expressions
// to things like "tree --random --seed {seed:5}"
command: !="" & (=~"^[^{}]*(\\{seed(:[0-9]+)?\\}[^{}]*)*$")

Expand All @@ -16,7 +16,7 @@ command: !="" & (=~"^[^{}]*(\\{seed(:[0-9]+)?\\}[^{}]*)*$")
let basename = "([A-Za-z0-9][A-Za-z0-9_-]*[A-Za-z0-9]|[A-Za-z0-9])"
name: =~"^\(basename)$"

// Filenames are somewhat like names, but can also contain '.'
// Filenames are somewhat like names, but can also contain '.'
// and have length at least 2, such as "good-solution_02.py"
// but not "huge_" or "a".
let filename = "[A-Za-z0-9][A-Za-z0-9_.-]*[A-Za-z0-9]"
Expand Down
8 changes: 4 additions & 4 deletions support/schemas/testdata.cue
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,21 @@ import "strconv"
reject_score: *"0" | #score
range: *"-inf +inf" | string
// Verify that the scores and ranges make sense:
_range_syntax: strings.Split(range, " ") & [#score, #score] // space-separated scores
_range_syntax: strings.Split(range, " ") & [#score, #score] // space-separated scores
_lo: strconv.ParseFloat(strings.Split(range, " ")[0], 64) // parses to float (including '-inf')
_hi: strconv.ParseFloat(strings.Split(range, " ")[1], 64)
_wa: strconv.ParseFloat(reject_score, 64)
_ac: strconv.ParseFloat(accept_score, 64)
_order: true & _lo <= _wa & _wa <= _ac & _ac <= _hi
}
// matches "1", "06", "21", ".4", "-1.2", but not 'inf'
#score: =~ "^-?([0-9]+|[0-9]*.[0-9]+)$"
#score: =~ "^-?([0-9]+|[0-9]*.[0-9]+)$"

// Default grader
// --------------

#default_grader_flags: this={
string
string
_as_struct: { for w in strings.Split(this, " ") { (w): _ } } // convert to struct and ...
_as_struct: #valid_default_grader_fields // ... validate its fields
}
Expand All @@ -45,4 +45,4 @@ import "strconv"
}

#verdict_aggregation_mode: {first_error: _ } | *{worst_error: _ } | {always_accept: _ }
#score_aggregation_mode: {min: _ } | {max: _ } | *{sum: _ } | {avg: _ }
#score_aggregation_mode: {min: _ } | {max: _ } | *{sum: _ } | {avg: _ }

0 comments on commit 7b52afd

Please sign in to comment.