github-rest-api 0.10.0__tar.gz → 0.10.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: github-rest-api
3
- Version: 0.10.0
3
+ Version: 0.10.2
4
4
  Summary: Simple wrapper of GitHub REST APIs.
5
5
  Author: Ben Du
6
6
  Author-email: longendu@yahoo.com
@@ -12,11 +12,11 @@ def _gen_temp_branch() -> str:
12
12
  return "_branch_" + "".join(str(num) for num in nums)
13
13
 
14
14
 
15
- def _copy_last_dev_bench() -> None:
15
+ def _copy_last_dev_bench(bench_dir: Path) -> None:
16
16
  branch = _gen_temp_branch()
17
17
  create_branch(branch)
18
18
  switch_branch(branch="gh-pages", fetch=True)
19
- src = Path("dev/criterion")
19
+ src = bench_dir / "dev/criterion"
20
20
  if src.is_dir():
21
21
  target = Path("target/criterion")
22
22
  target.mkdir(parents=True, exist_ok=True)
@@ -24,12 +24,12 @@ def _copy_last_dev_bench() -> None:
24
24
  switch_branch(branch=branch, fetch=False)
25
25
 
26
26
 
27
- def _cargo_criterion() -> None:
27
+ def _cargo_criterion(bench_dir: Path) -> None:
28
28
  """Run `cargo criterion` to benchmark the specified branch.
29
29
 
30
30
  :param branch: The branch to benchmark.
31
31
  """
32
- _copy_last_dev_bench()
32
+ _copy_last_dev_bench(bench_dir=bench_dir)
33
33
  cmd = "cargo criterion --message-format=json"
34
34
  sp.run(cmd, shell=True, check=True)
35
35
 
@@ -163,7 +163,9 @@ def _clean_bench_dirs(bench_dir: Path, history: int) -> list[Path]:
163
163
  for path in dirs[:-history]:
164
164
  shutil.rmtree(path)
165
165
  dirs = dirs[-history:]
166
- dirs.append(Path("dev"))
166
+ dev = bench_dir / "dev"
167
+ if dev.is_dir():
168
+ dirs.append(dev)
167
169
  return dirs
168
170
 
169
171
 
@@ -201,7 +203,7 @@ def benchmark(
201
203
  user_email=f"bench-bot@{repo}.com",
202
204
  user_name="bench-bot",
203
205
  )
204
- _cargo_criterion()
206
+ _cargo_criterion(bench_dir=bench_dir)
205
207
  _copy_bench_results(bench_dir=bench_dir, storage=storage)
206
208
  dirs = _clean_bench_dirs(bench_dir=bench_dir, history=history)
207
209
  _rename_bench_reports(dirs)
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "github_rest_api"
3
- version = "0.10.0"
3
+ version = "0.10.2"
4
4
  description = "Simple wrapper of GitHub REST APIs."
5
5
  authors = ["Ben Du <longendu@yahoo.com>"]
6
6
  readme = "README.md"