Skip to content

Commit 0ad6df3

Browse files
authored
Merge pull request #374 from faster-cpython/minor-changes
Some minor changes suggested by Copilot
2 parents c4a77ec + 16724bb commit 0ad6df3

File tree

5 files changed

+11
-12
lines changed

5 files changed

+11
-12
lines changed

bench_runner/scripts/backfill.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def __init__(self, cpython: PathLike, ref: str, source: str):
4545
self.source = source
4646
self.runners: list[RunnerType] = []
4747

48-
def _set_hash_and_date(self):
48+
def _set_hash_and_date(self) -> None:
4949
self._hash, self._date = _get_hash_and_date(self.cpython, self.ref)
5050

5151
@property

bench_runner/scripts/compare.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
import argparse
1010
from pathlib import Path
1111
import sys
12-
from typing import TextIO, Iterable, Sequence, TypeAlias
12+
from typing import Literal, TextIO, Iterable, Sequence, TypeAlias
1313

1414

1515
import rich
@@ -25,7 +25,7 @@
2525

2626
ParsedCommits: TypeAlias = Sequence[
2727
tuple[str, list[str], str, Iterable[mod_result.Result]]
28-
]
28+
] # (commit_hash, flags, name, results)
2929

3030

3131
def parse_commit(commit: str) -> tuple[str, str, list[str]]:
@@ -143,7 +143,9 @@ def do_many_to_many(
143143
fd.write("\n\nRows are 'bases', columns are 'heads'\n")
144144

145145

146-
def _main_with_hashes(commits: Sequence[str], output_dir: Path, comparison_type: str):
146+
def _main_with_hashes(
147+
commits: Sequence[str], output_dir: Path, comparison_type: Literal["1:n", "n:n"]
148+
):
147149
results = mod_result.load_all_results(
148150
None, Path("results"), sorted=False, match=False
149151
)
@@ -228,7 +230,9 @@ def _main_with_files(commits: Sequence[str], output_dir: Path, comparison_type:
228230
rich.print()
229231

230232

231-
def _main(commits: Sequence[str], output_dir: PathLike, comparison_type: str):
233+
def _main(
234+
commits: Sequence[str], output_dir: PathLike, comparison_type: Literal["1:n", "n:n"]
235+
):
232236
if len(commits) < 2:
233237
raise ValueError("Must provide at least 2 commits")
234238

bench_runner/scripts/generate_results.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,6 @@ def recurse(entry: tuple, d: dict):
4747
return d
4848

4949

50-
def _worker(args) -> None:
51-
func, output_filename = args
52-
func(output_filename)
53-
54-
5550
def save_generated_results(results: Iterable[Result], force: bool = False) -> None:
5651
"""
5752
Write out the comparison tables and plots for every result.

bench_runner/scripts/get_merge_base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
from bench_runner.util import PathLike
1414

1515

16-
def get_python_version(cpython: PathLike):
16+
def get_python_version(cpython: PathLike) -> str:
1717
with (Path(cpython) / "Include" / "patchlevel.h").open() as fd:
1818
for line in fd.readlines():
1919
if m := re.match(r'#define\s+PY_VERSION\s+"(.+)"', line.strip()):

bench_runner/scripts/notify.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ def _main(
3030
github_repo = os.environ.get("GITHUB_REPOSITORY", "UNKNOWN")
3131

3232
lines = ["🤖 This is the friendly benchmarking bot with some new results!", ""]
33-
line = f"@{actor}: " f"[{fork}/{ref}]"
33+
line = f"@{actor}: [{fork}/{ref}]"
3434
skip_publish = (
3535
config.get_bench_runner_config().get("publish_mirror", {}).get("skip", False)
3636
)

0 commit comments

Comments
 (0)