Skip to content

Commit ea14f9d

Browse files
committed
python3.8 compat
1 parent 710413d commit ea14f9d

File tree

2 files changed

+15
-16
lines changed

2 files changed

+15
-16
lines changed

.github/triage/jax_toolbox_triage/logic.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import collections
21
from dataclasses import dataclass
32
import datetime
43
import functools
@@ -204,7 +203,7 @@ def _not_first(d):
204203

205204
def commit_search(
206205
*,
207-
commits: collections.OrderedDict[
206+
commits: typing.OrderedDict[
208207
str, typing.Sequence[typing.Tuple[str, datetime.datetime]]
209208
],
210209
build_and_test: BuildAndTest,
@@ -342,13 +341,13 @@ def commit_search(
342341
for secondary, secondary_commit in _not_first(blame_commits):
343342
log_str += f" {secondary} {secondary_commit}"
344343
logger.info(log_str)
345-
return {
344+
ret = {
346345
f"{primary}_bad": bad_commit,
347346
f"{primary}_good": good_commit,
348-
} | {
349-
f"{secondary}_ref": secondary_commit
350-
for secondary, secondary_commit in _not_first(blame_commits)
351347
}
348+
for secondary, secondary_commit in _not_first(blame_commits):
349+
ret[f"{secondary}_ref"] = secondary_commit
350+
return ret
352351
else:
353352
# Test failed with both {pX, sZ, tZ, ...} and {pZ, sZ, tZ, ...}, so
354353
# we can fix the primary package to pX and recurse with the old

.github/triage/tests/test_triage_logic.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ def dummy_test(*, commits):
135135
)
136136
# Do not check the reference commits, it's a bit underspecified quite what they
137137
# mean, other than that the dummy_test assertions below should pass
138-
ref_commits = {
138+
commits = {
139139
package: algorithm_result.pop(f"{package}_ref")
140140
for package in package_names
141141
if package != culprit
@@ -144,12 +144,10 @@ def dummy_test(*, commits):
144144
f"{culprit}_bad": bad_commit,
145145
f"{culprit}_good": good_commit,
146146
} == algorithm_result
147-
assert dummy_test(
148-
commits={culprit: algorithm_result[f"{culprit}_good"]} | ref_commits
149-
).result
150-
assert not dummy_test(
151-
commits={culprit: algorithm_result[f"{culprit}_bad"]} | ref_commits
152-
).result
147+
commits[culprit] = algorithm_result[f"{culprit}_good"]
148+
assert dummy_test(commits=commits).result
149+
commits[culprit] = algorithm_result[f"{culprit}_bad"]
150+
assert not dummy_test(commits=commits).result
153151

154152

155153
def other(project):
@@ -267,13 +265,15 @@ def dummy_test(*, commits):
267265
assert algorithm_result[f"{bad_project}_bad"] == bad_commit
268266
assert algorithm_result[f"{bad_project}_good"] == good_commit
269267
# Do check that the reference commit gives the expected results
270-
ref_commits = {
268+
commits = {
271269
proj: algorithm_result[f"{proj}_ref"]
272270
for proj in all_projects
273271
if proj != bad_project
274272
}
275-
assert not dummy_test(commits={bad_project: bad_commit} | ref_commits).result
276-
assert dummy_test(commits={bad_project: good_commit} | ref_commits).result
273+
commits[bad_project] = bad_commit
274+
assert not dummy_test(commits=commits).result
275+
commits[bad_project] = good_commit
276+
assert dummy_test(commits=commits).result
277277

278278

279279
@pytest.mark.parametrize(

0 commit comments

Comments
 (0)