Skip to content

Commit 7b90fde

Browse files
committed
Fixes
1 parent b63f21e commit 7b90fde

8 files changed

Lines changed: 20 additions & 13 deletions

File tree

docs/conf.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
from datetime import date
1+
from datetime import UTC, datetime
22

33
project = "git2cpp"
44
author = "QuantStack"
5-
copyright = f"2025-{date.today().year}"
5+
copyright = f"2025-{datetime.now(UTC).year}"
66

77
extensions = [
88
"myst_parser",

pyproject.toml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,11 @@
22
[tool.ruff]
33
line-length = 100
44
target-version = "py312"
5+
56
[tool.ruff.format]
67
line-ending = "lf"
8+
9+
[tool.ruff.lint]
10+
ignore = [
11+
"PLW1510"
12+
]

test/conftest_wasm.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ def read_text(self) -> str:
101101
def write_bytes(self, data: bytes):
102102
# Convert binary data to a string where each element is backslash-escaped so that we can
103103
# write to file in cockle using `echo -e <backslash-escaped data>`.
104-
encoded_string = "".join(map(lambda d: f"\\x{d:02x}", data))
104+
encoded_string = "".join(lambda d: f"\\x{d:02x}", data)
105105
cmd = ["echo", "-e", encoded_string, ">", str(self)]
106106
subprocess.run(cmd, capture_output=True, text=True, check=True)
107107
return len(data)

test/test_clone.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ def test_clone_private_repo_fails_then_succeeds(
7979
# Fails with wrong credentials, then succeeds with correct ones.
8080
username = "xyz" # Can be any non-empty string.
8181
password = private_test_repo["token"]
82-
input = "\n".join(["wrong1", "wrong2", username, password]) + "\n"
82+
input = f"wrong1\nwrong2\n{username}\n{password}"
8383
repo_path = tmp_path / private_test_repo["repo_name"]
8484

8585
clone_cmd = [git2cpp_path, "clone", private_test_repo["https_url"]]

test/test_init.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ def test_init_in_directory(git2cpp_path, tmp_path):
1212
assert p.stdout.startswith("Initialized empty Git repository in ")
1313
assert p.stdout.strip().endswith("/")
1414

15-
assert sorted(map(lambda path: path.name, tmp_path.iterdir())) == [
15+
assert sorted(path.name for path in tmp_path.iterdir()) == [
1616
"HEAD",
1717
"config",
1818
"description",
@@ -36,7 +36,7 @@ def test_init_in_cwd(git2cpp_path, tmp_path, run_in_tmp_path):
3636
assert p.stdout.startswith("Initialized empty Git repository in ")
3737
assert p.stdout.strip().endswith("/")
3838

39-
assert sorted(map(lambda path: path.name, tmp_path.iterdir())) == [
39+
assert sorted(path.name for path in tmp_path.iterdir()) == [
4040
"HEAD",
4141
"config",
4242
"description",
@@ -60,9 +60,9 @@ def test_init_not_bare(git2cpp_path, tmp_path):
6060
assert p.stdout.strip().endswith(".git/")
6161

6262
# Directory contains just .git directory.
63-
assert sorted(map(lambda path: path.name, tmp_path.iterdir())) == [".git"]
63+
assert sorted(path.name for path in tmp_path.iterdir()) == [".git"]
6464
# .git directory is a valid repo.
65-
assert sorted(map(lambda path: path.name, (tmp_path / ".git").iterdir())) == [
65+
assert sorted(path.name for path in (tmp_path / ".git").iterdir()) == [
6666
"HEAD",
6767
"config",
6868
"description",

test/test_log.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ def test_log_commit_without_references(commit_env_config, git2cpp_path, tmp_path
256256

257257
# First commit line should have references
258258
lines = strip_ansi_colours(p_log.stdout).split("\n")
259-
first_commit_line = [line for line in lines if line.startswith("commit")][0]
259+
first_commit_line = next(line for line in lines if line.startswith("commit"))
260260
assert "(" in first_commit_line # Has references
261261

262262
# Second commit (older one) should not have empty parentheses

test/test_remote.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ def repo_with_remote(git2cpp_path, tmp_path, run_in_tmp_path):
297297

298298
def test_fetch_from_remote(git2cpp_path, repo_with_remote):
299299
"""Test fetching from a remote."""
300-
local_path, remote_path = repo_with_remote
300+
local_path, _remote_path = repo_with_remote
301301

302302
# Note: This is a bare repo with no refs, so fetch will fail gracefully
303303
# For now, just test that /stdofetch command runs (it will fail gracefully if no refs)
@@ -309,7 +309,7 @@ def test_fetch_from_remote(git2cpp_path, repo_with_remote):
309309

310310
def test_fetch_default_origin(git2cpp_path, repo_with_remote):
311311
"""Test fetching with default origin."""
312-
local_path, remote_path = repo_with_remote
312+
local_path, _remote_path = repo_with_remote
313313

314314
cmd = [git2cpp_path, "fetch"]
315315
p = subprocess.run(cmd, capture_output=True, text=True, cwd=local_path)

wasm/recipe/modify-recipe.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
import argparse
55
import shutil
6+
import sys
67
from pathlib import Path
78

89
import yaml
@@ -14,11 +15,11 @@
1415

1516
input_dir = args.input_directory
1617
if not input_dir.is_dir():
17-
quit(f"{input_dir} should exist and be a directory")
18+
sys.exit(f"{input_dir} should exist and be a directory")
1819

1920
input_filename = input_dir / "recipe.yaml"
2021
if not input_filename.is_file():
21-
quit(f"{input_filename} should exist and be a file")
22+
sys.exit(f"{input_filename} should exist and be a file")
2223

2324
# If backup does not exist create it.
2425
input_backup = input_dir / "recipe_original.yaml"

0 commit comments

Comments
 (0)