Skip to content

Commit 15cef45

Browse files
committed
format
1 parent 98a1bff commit 15cef45

File tree

3 files changed

+45
-11
lines changed

3 files changed

+45
-11
lines changed

.github/triage/jax_toolbox_triage/args.py

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -175,19 +175,33 @@ def parse_args(args=None):
175175
)
176176
args = parser.parse_args(args=args)
177177
assert args.container_runtime in {"docker", "pyxis"}, args.container_runtime
178-
passing_commits_known = (args.passing_container is not None) or (args.passing_commits is not None)
179-
failing_commits_known = (args.failing_container is not None) or (args.failing_commits is not None)
178+
passing_commits_known = (args.passing_container is not None) or (
179+
args.passing_commits is not None
180+
)
181+
failing_commits_known = (args.failing_container is not None) or (
182+
args.failing_commits is not None
183+
)
180184
sets_of_known_commits = passing_commits_known + failing_commits_known
181185
if sets_of_known_commits == 2:
182186
# If the container-level search is being skipped, because a valid combination
183187
# of --{passing,failing}-{commits,container} is passed, then no container-level
184188
# search options should be passed.
185-
assert args.container is None and args.start_date is None and args.end_date is None, "No container-level search options should be passed if the passing/failing containers/commits have been passed explicitly."
186-
assert args.passing_container is not None or args.failing_container is not None, ""
189+
assert (
190+
args.container is None and args.start_date is None and args.end_date is None
191+
), (
192+
"No container-level search options should be passed if the passing/failing containers/commits have been passed explicitly."
193+
)
194+
assert (
195+
args.passing_container is not None or args.failing_container is not None
196+
), ""
187197
elif sets_of_known_commits == 1:
188-
raise Exception("If --passing-{commits OR container} is passed then --failing-{commits OR container} should be too")
198+
raise Exception(
199+
"If --passing-{commits OR container} is passed then --failing-{commits OR container} should be too"
200+
)
189201
else:
190202
# None of --{passing,failing}-{commits,container} were passed, make sure the
191203
# compulsory arguments for the container-level search were passed
192-
assert args.container is not None, "--container must be passed for the container-level search"
204+
assert args.container is not None, (
205+
"--container must be passed for the container-level search"
206+
)
193207
return args

.github/triage/jax_toolbox_triage/pyxis.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
# for .exists()
1212
_process_token = secrets.token_bytes()
1313

14+
1415
class PyxisContainer:
1516
def __init__(
1617
self,

.github/triage/tests/test_arg_parsing.py

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,18 @@
99
"failing-url",
1010
]
1111
valid_container_and_commits = [
12-
["--passing-container", "passing-url", "--failing-commits", "jax:0123456789,xla:fedcba9876543210"],
13-
["--failing-container", "failing-url", "--passing-commits", "xla:fedcba9876543210,jax:0123456789"],
12+
[
13+
"--passing-container",
14+
"passing-url",
15+
"--failing-commits",
16+
"jax:0123456789,xla:fedcba9876543210",
17+
],
18+
[
19+
"--failing-container",
20+
"failing-url",
21+
"--passing-commits",
22+
"xla:fedcba9876543210,jax:0123456789",
23+
],
1424
]
1525
valid_start_end_date_args = [
1626
["--container", "jax"],
@@ -21,7 +31,10 @@
2131

2232

2333
@pytest.mark.parametrize(
24-
"good_args", [valid_start_end_container] + valid_start_end_date_args + valid_container_and_commits
34+
"good_args",
35+
[valid_start_end_container]
36+
+ valid_start_end_date_args
37+
+ valid_container_and_commits,
2538
)
2639
def test_good_container_args(good_args):
2740
args = parse_args(good_args + test_command)
@@ -48,7 +61,12 @@ def test_bad_container_arg_combinations_across_groups(date_args):
4861
["--passing-container", "passing-url"],
4962
["--failing-container", "failing-url"],
5063
# Need at least one container
51-
["--passing-commits", "jax:0123456789,xla:fedcba9876543210", "--failing-commits", "xla:fedcba9876543210,jax:0123456789"],
64+
[
65+
"--passing-commits",
66+
"jax:0123456789,xla:fedcba9876543210",
67+
"--failing-commits",
68+
"xla:fedcba9876543210,jax:0123456789",
69+
],
5270
# Cannot combine --passing-container with --passing-commits etc.
5371
["--passing-container", "passing-url", "--passing-commits", "jax:123,xla:456"],
5472
["--failing-container", "failing-url", "--failing-commits", "jax:123,xla:456"],
@@ -76,6 +94,7 @@ def test_unparsable_container_args(container_args):
7694
with pytest.raises(SystemExit):
7795
parse_args(container_args + test_command)
7896

97+
7998
def test_invalid_container_runtime():
8099
with pytest.raises(Exception):
81-
parse_args(["--container-runtime=magic-beans"] + test_command)
100+
parse_args(["--container-runtime=magic-beans"] + test_command)

0 commit comments

Comments
 (0)