Skip to content

Commit 1e92a79

Browse files
[Automated Commit] Format Codebase
1 parent ec38014 commit 1e92a79

File tree

3 files changed

+38
-14
lines changed

3 files changed

+38
-14
lines changed

tools/submission/submission_checker/loader.py

Lines changed: 35 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -22,35 +22,58 @@ def __init__(self, root, version) -> None:
2222
self.root = root
2323
self.version = version
2424
self.logger = logging.getLogger("LoadgenParser")
25-
self.perf_log_path = os.path.join(self.root, PERFORMANCE_LOG_PATH.get(version, PERFORMANCE_LOG_PATH["default"]))
26-
self.perf_summary_path = os.path.join(self.root, PERFORMANCE_SUMMARY_PATH.get(version, PERFORMANCE_SUMMARY_PATH["default"]))
27-
self.acc_log_path = os.path.join(self.root, ACCURACY_LOG_PATH.get(version, ACCURACY_LOG_PATH["default"]))
25+
self.perf_log_path = os.path.join(
26+
self.root, PERFORMANCE_LOG_PATH.get(
27+
version, PERFORMANCE_LOG_PATH["default"]))
28+
self.perf_summary_path = os.path.join(
29+
self.root, PERFORMANCE_SUMMARY_PATH.get(
30+
version, PERFORMANCE_SUMMARY_PATH["default"]))
31+
self.acc_log_path = os.path.join(
32+
self.root, ACCURACY_LOG_PATH.get(
33+
version, ACCURACY_LOG_PATH["default"]))
2834

29-
def load_single_log(self, path, log_type: Literal["Performance", "Accuracy", "Test"]):
35+
def load_single_log(
36+
self, path, log_type: Literal["Performance", "Accuracy", "Test"]):
3037
log = None
3138
if os.path.exists(path):
3239
self.logger.info("Loading %s log from %s", log_type, path)
3340
log = LoadgenParser(path)
3441
else:
35-
self.logger.info("Could not load %s log from %s, path does not exist", log_type, path)
42+
self.logger.info(
43+
"Could not load %s log from %s, path does not exist",
44+
log_type,
45+
path)
3646
return log
3747

38-
3948
def load(self) -> Generator[SubmissionLogs, None, None]:
4049
for division in list_dir(self.root):
4150
if division not in VALID_DIVISIONS:
4251
continue
4352
division_path = os.path.join(self.root, division)
4453
for submitter in list_dir(division_path):
45-
results_path = os.path.join(division_path, submitter, "results")
54+
results_path = os.path.join(
55+
division_path, submitter, "results")
4656
for system in list_dir(results_path):
4757
system_path = os.path.join(results_path, system)
4858
for benchmark in list_dir(system_path):
4959
benchmark_path = os.path.join(system_path, benchmark)
5060
for scenario in list_dir(benchmark_path):
51-
scenario_path = os.path.join(benchmark_path, benchmark)
52-
perf_path = self.perf_log_path.format(division = division, submitter = submitter, system = system, benchmark = benchmark, scenario = scenario)
53-
acc_path = self.acc_log_path.format(division = division, submitter = submitter, system = system, benchmark = benchmark, scenario = scenario)
54-
perf_log = self.load_single_log(perf_path, "Performance")
55-
acc_log = perf_log = self.load_single_log(acc_path, "Accuracy")
61+
scenario_path = os.path.join(
62+
benchmark_path, benchmark)
63+
perf_path = self.perf_log_path.format(
64+
division=division,
65+
submitter=submitter,
66+
system=system,
67+
benchmark=benchmark,
68+
scenario=scenario)
69+
acc_path = self.acc_log_path.format(
70+
division=division,
71+
submitter=submitter,
72+
system=system,
73+
benchmark=benchmark,
74+
scenario=scenario)
75+
perf_log = self.load_single_log(
76+
perf_path, "Performance")
77+
acc_log = perf_log = self.load_single_log(
78+
acc_path, "Accuracy")
5679
yield SubmissionLogs(perf_log, acc_log)

tools/submission/submission_checker/main.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,6 @@ def main():
110110
if v is None:
111111
log.error("NoResults %s", k)
112112

113-
114113
# print summary
115114
log.info("---")
116115
log.info(

tools/submission/submission_checker/utils.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ def get_boolean(s):
7373
f"Variable should be bool, string or int, got {type(s)} instead"
7474
)
7575

76+
7677
def merge_two_dict(x, y):
7778
z = x.copy()
7879
for key in y:
@@ -82,8 +83,9 @@ def merge_two_dict(x, y):
8283
z[key] += y[key]
8384
return z
8485

86+
8587
def sum_dict_values(x):
8688
count = 0
8789
for key in x:
8890
count += x[key]
89-
return count
91+
return count

0 commit comments

Comments
 (0)