From 92e5f43abe226431dfe0055045629d3d7ca33d9c Mon Sep 17 00:00:00 2001 From: Paul Gauthier Date: Fri, 30 Jun 2023 20:42:54 -0700 Subject: [PATCH] intro --- benchmark/benchmark.py | 24 ++++++++++-------------- docs/benchmarks.md | 2 +- 2 files changed, 11 insertions(+), 15 deletions(-) diff --git a/benchmark/benchmark.py b/benchmark/benchmark.py index 36f670fb0..e9d0c4f45 100755 --- a/benchmark/benchmark.py +++ b/benchmark/benchmark.py @@ -42,8 +42,6 @@ def show_stats(dirnames): row = summarize_results(dirname) raw_rows.append(row) - return - repeats = [] seen = dict() rows = [] @@ -71,10 +69,6 @@ def show_stats(dirnames): seen[kind] = row.dir_name rows.append(vars(row)) - repeats = pd.DataFrame.from_records(repeats) - repeat_max = repeats["pass_rate_2"].max() - repeat_min = repeats["pass_rate_2"].min() - df = pd.DataFrame.from_records(rows) df.sort_values(by=["model", "edit_format"], inplace=True) @@ -135,9 +129,14 @@ def show_stats(dirnames): if zorder == 2: ax.bar_label(rects, padding=8, labels=[f"{v:.0f}%" for v in df[fmt]], size=11) - lo = 44 - repeat_min - hi = repeat_max - 44 - ax.errorbar(1.4, 44, yerr=[[lo], [hi]], fmt="none", zorder=5, capsize=5) + if repeats: + repeats = pd.DataFrame.from_records(repeats) + repeat_max = repeats["pass_rate_2"].max() + repeat_min = repeats["pass_rate_2"].min() + + lo = 44 - repeat_min + hi = repeat_max - 44 + ax.errorbar(1.4, 44, yerr=[[lo], [hi]], fmt="none", zorder=5, capsize=5) ax.set_xticks([p + 1.5 * width for p in pos]) ax.set_xticklabels(models, rotation=45) @@ -428,11 +427,8 @@ def run_test( shutil.copy(original_fname, fname) file_list = " ".join(fname.name for fname in fnames) - intro = testdir / ".docs/introduction.md" - if intro.exists(): - instructions = intro.read_text() + "\n\n" - else: - instructions = "" + + instructions = "" introduction = testdir / ".docs/introduction.md" if introduction.exists(): diff --git a/docs/benchmarks.md b/docs/benchmarks.md index 6f0523600..b2b9b8b16 100644 --- a/docs/benchmarks.md +++ b/docs/benchmarks.md @@ -74,7 +74,7 @@ their coding skills. Each exercise has: - - Some instructions about the exercise, in a markdown file. + - Some instructions for the exercise, in markdown files. - Stub code for the implementation in a python file, specifying the functions/classes that need to be implemented. - Unit tests in a seperate python file.