Skip to content

Commit be90519

Browse files
[pre-commit.ci] pre-commit autoupdate (#178)
* [pre-commit.ci] pre-commit autoupdate updates: - [github.com/astral-sh/ruff-pre-commit: v0.15.22 → v0.16.0](astral-sh/ruff-pre-commit@v0.15.22...v0.16.0) * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Fixes * Fix --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Ian Thomas <ianthomas23@gmail.com>
1 parent 039d66c commit be90519

13 files changed

Lines changed: 38 additions & 27 deletions

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ repos:
2424
exclude_types: [javascript,json]
2525

2626
- repo: https://github.com/astral-sh/ruff-pre-commit
27-
rev: v0.15.22
27+
rev: v0.16.0
2828
hooks:
2929
- id: ruff-check
3030
args: [--fix]

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",

docs/create_markdown.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import os
2-
from pathlib import Path
32
import re
43
import subprocess
4+
from pathlib import Path
55

66

77
def get_filename(args):

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.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
GIT2CPP_TEST_WASM = os.getenv("GIT2CPP_TEST_WASM") == "1"
99

1010
if GIT2CPP_TEST_WASM:
11-
from .conftest_wasm import * # noqa: F403
11+
from .conftest_wasm import *
1212

1313

1414
# Fixture to run test in current tmp_path

test/conftest_wasm.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
# Extra fixtures used for wasm testing, including some that override the default pytest fixtures.
2-
from functools import partial
32
import os
43
import pathlib
5-
from playwright.sync_api import Page
6-
import pytest
74
import re
85
import subprocess
96
import time
7+
from functools import partial
8+
9+
import pytest
10+
from playwright.sync_api import Page
1011

1112

1213
# Only include particular test files when testing wasm.
@@ -94,14 +95,13 @@ def read_bytes(self) -> bytes:
9495
def read_text(self) -> str:
9596
p = subprocess.run(["cat", str(self)], capture_output=True, text=True, check=True)
9697
text = p.stdout
97-
if text.endswith("\n"):
98-
text = text[:-1]
98+
text = text.removesuffix("\n")
9999
return text
100100

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(f"\\x{d:02x}" for d in data)
105105
cmd = ["echo", "-e", encoded_string, ">", str(self)]
106106
subprocess.run(cmd, capture_output=True, text=True, check=True)
107107
return len(data)
@@ -110,8 +110,7 @@ def write_text(self, data: str):
110110
# Note that in general it is not valid to direct output of a subprocess.run call to a file,
111111
# but we get away with it here as the command arguments are passed straight through to
112112
# cockle without being checked.
113-
if data.endswith("\n"):
114-
data = data[:-1]
113+
data = data.removesuffix("\n")
115114
cmd = ["echo", data, ">", str(self)]
116115
subprocess.run(cmd, capture_output=True, text=True, check=True)
117116
return len(data)

test/test_clone.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1-
import pytest
21
import subprocess
2+
3+
import pytest
4+
35
from .conftest import GIT2CPP_TEST_WASM
46

57
xtl_url = "https://github.com/xtensor-stack/xtl.git"
@@ -77,7 +79,7 @@ def test_clone_private_repo_fails_then_succeeds(
7779
# Fails with wrong credentials, then succeeds with correct ones.
7880
username = "xyz" # Can be any non-empty string.
7981
password = private_test_repo["token"]
80-
input = "\n".join(["wrong1", "wrong2", username, password]) + "\n"
82+
input = f"wrong1\nwrong2\n{username}\n{password}"
8183
repo_path = tmp_path / private_test_repo["repo_name"]
8284

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

test/test_fixtures.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import re
44
import subprocess
5+
56
from .conftest import GIT2CPP_TEST_WASM
67

78

test/test_git.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1-
import pytest
21
import re
32
import subprocess
3+
4+
import pytest
5+
46
from .conftest import GIT2CPP_TEST_WASM
57

68

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",

0 commit comments

Comments
 (0)