Skip to content

Commit be6560e

Browse files
committed
formatting
1 parent 90c4652 commit be6560e

1 file changed

Lines changed: 28 additions & 18 deletions

File tree

scoring/score_submissions.py

Lines changed: 28 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,15 @@
4747
False,
4848
'Whether to score on self-tuning ruleset or externally tuned ruleset')
4949
flags.DEFINE_string(
50-
'save_results_to_filename',
51-
None,
52-
'Filename to save the processed results that are fed into the performance profile functions.')
50+
'save_results_to_filename',
51+
None,
52+
'Filename to save the processed results that are fed into the performance profile functions.'
53+
)
5354
flags.DEFINE_boolean(
54-
'load_results_from_filename',
55-
None,
56-
'Filename to load processed results from that are fed into performance profile functions')
55+
'load_results_from_filename',
56+
None,
57+
'Filename to load processed results from that are fed into performance profile functions'
58+
)
5759
FLAGS = flags.FLAGS
5860

5961

@@ -131,25 +133,33 @@ def main(_):
131133
results = {}
132134
os.makedirs(FLAGS.output_dir, exist_ok=True)
133135

134-
# Optionally read results to filename
136+
# Optionally read results to filename
135137
if FLAGS.load_results_from_filename:
136-
with open(os.path.join(FLAGS.output_dir, FLAGS.load_results_from_filename), 'rb') as f:
138+
with open(
139+
os.path.join(FLAGS.output_dir, FLAGS.load_results_from_filename),
140+
'rb') as f:
137141
results = pickle.load(f)
138142
else:
139143
for team in os.listdir(FLAGS.submission_directory):
140-
for submission in os.listdir(os.path.join(FLAGS.submission_directory, team)):
141-
print(submission)
142-
experiment_path = os.path.join(FLAGS.submission_directory, team, submission)
143-
df = scoring_utils.get_experiment_df(experiment_path)
144-
results[submission] = df
145-
summary_df = get_submission_summary(df)
146-
with open(os.path.join(FLAGS.output_dir, f'{submission}_summary.csv'),
147-
'w') as fout:
148-
summary_df.to_csv(fout)
144+
for submission in os.listdir(
145+
os.path.join(FLAGS.submission_directory, team)):
146+
print(submission)
147+
experiment_path = os.path.join(FLAGS.submission_directory,
148+
team,
149+
submission)
150+
df = scoring_utils.get_experiment_df(experiment_path)
151+
results[submission] = df
152+
summary_df = get_submission_summary(df)
153+
with open(
154+
os.path.join(FLAGS.output_dir, f'{submission}_summary.csv'),
155+
'w') as fout:
156+
summary_df.to_csv(fout)
149157

150158
# Optionally save results to filename
151159
if FLAGS.save_results_to_filename:
152-
with open(os.path.join(FLAGS.output_dir, FLAGS.save_results_to_filename), 'wb') as f:
160+
with open(
161+
os.path.join(FLAGS.output_dir, FLAGS.save_results_to_filename),
162+
'wb') as f:
153163
pickle.dump(results, f)
154164

155165
if not FLAGS.strict:

0 commit comments

Comments
 (0)