Skip to content

Use newer ruff style #2031

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 30, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
repos:
- repo: https://github.com/codespell-project/codespell
rev: v2.3.0
rev: v2.4.1
hooks:
- id: codespell
additional_dependencies: [tomli]
exclude: ^test/fixtures/

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.6.0
rev: v0.11.12
hooks:
- id: ruff
- id: ruff-check
args: ["--fix"]
exclude: ^git/ext/
- id: ruff-format
Expand All @@ -23,7 +23,7 @@ repos:
exclude: ^test/fixtures/polyglot$|^git/ext/

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
rev: v5.0.0
hooks:
- id: end-of-file-fixer
exclude: ^test/fixtures/|COPYING|LICENSE
Expand All @@ -33,6 +33,6 @@ repos:
- id: check-merge-conflict

- repo: https://github.com/abravalheri/validate-pyproject
rev: v0.19
rev: v0.24.1
hooks:
- id: validate-pyproject
4 changes: 2 additions & 2 deletions git/cmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ def pump_stream(
)
if stderr_handler:
error_str: Union[str, bytes] = (
"error: process killed because it timed out." f" kill_after_timeout={kill_after_timeout} seconds"
f"error: process killed because it timed out. kill_after_timeout={kill_after_timeout} seconds"
)
if not decode_streams and isinstance(p_stderr, BinaryIO):
# Assume stderr_handler needs binary input.
Expand Down Expand Up @@ -1319,7 +1319,7 @@ def communicate() -> Tuple[AnyStr, AnyStr]:
out, err = proc.communicate()
watchdog.cancel()
if kill_check.is_set():
err = 'Timeout: the command "%s" did not complete in %d ' "secs." % (
err = 'Timeout: the command "%s" did not complete in %d secs.' % (
" ".join(redacted_command),
timeout,
)
Expand Down
2 changes: 1 addition & 1 deletion git/refs/log.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ def from_line(cls, line: bytes) -> "RefLogEntry":
elif len(fields) == 2:
info, msg = fields
else:
raise ValueError("Line must have up to two TAB-separated fields." " Got %s" % repr(line_str))
raise ValueError("Line must have up to two TAB-separated fields. Got %s" % repr(line_str))
# END handle first split

oldhexsha = info[:40]
Expand Down
2 changes: 1 addition & 1 deletion git/repo/fun.py
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,7 @@ def rev_parse(repo: "Repo", rev: str) -> AnyGitObject:
# END end handle tag
except (IndexError, AttributeError) as e:
raise BadName(
f"Invalid revision spec '{rev}' - not enough " f"parent commits to reach '{token}{int(num)}'"
f"Invalid revision spec '{rev}' - not enough parent commits to reach '{token}{int(num)}'"
) from e
# END exception handling
# END parse loop
Expand Down
2 changes: 1 addition & 1 deletion test/test_git.py
Original file line number Diff line number Diff line change
Expand Up @@ -747,7 +747,7 @@ def test_environment(self, rw_dir):

path = osp.join(rw_dir, "failing-script.sh")
with open(path, "wt") as stream:
stream.write("#!/usr/bin/env sh\n" "echo FOO\n")
stream.write("#!/usr/bin/env sh\necho FOO\n")
os.chmod(path, 0o777)

rw_repo = Repo.init(osp.join(rw_dir, "repo"))
Expand Down
2 changes: 1 addition & 1 deletion test/test_quick_doc.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ def test_cloned_repo_object(self, local_dir):
# [15-test_cloned_repo_object]
def print_files_from_git(root, level=0):
for entry in root:
print(f'{"-" * 4 * level}| {entry.path}, {entry.type}')
print(f"{'-' * 4 * level}| {entry.path}, {entry.type}")
if entry.type == "tree":
print_files_from_git(entry, level + 1)

Expand Down
Loading