Skip to content

Commit 1a8b6d3

Browse files
committed
chore(ruff): Unsafe autofixes for ruff with Python 3.10+
uv run ruff check --select ALL . --fix --unsafe-fixes --preview --show-fixes Fixed 11 errors: - src/libvcs/_internal/query_list.py: 2 × G004 (logging-f-string) - src/libvcs/sync/git.py: 9 × G004 (logging-f-string) Found 1040 errors. 1029 files left unchanged
1 parent 9008ed0 commit 1a8b6d3

File tree

2 files changed

+14
-14
lines changed

2 files changed

+14
-14
lines changed

src/libvcs/_internal/query_list.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ def keygetter(
9191
dct = getattr(dct, sub_field)
9292
except Exception as e:
9393
traceback.print_stack()
94-
logger.debug(f"The above error was {e}")
94+
logger.debug("The above error was %s", e)
9595
return None
9696
return dct
9797

@@ -122,12 +122,12 @@ def parse_lookup(obj: Mapping[str, t.Any], path: str, lookup: str) -> t.Any | No
122122
"""
123123
try:
124124
if isinstance(path, str) and isinstance(lookup, str) and path.endswith(lookup):
125-
field_name = path.rsplit(lookup)[0]
125+
field_name = path.split(lookup, maxsplit=1)[0]
126126
if field_name is not None:
127127
return keygetter(obj, field_name)
128128
except Exception as e:
129129
traceback.print_stack()
130-
logger.debug(f"The above error was {e}")
130+
logger.debug("The above error was %s", e)
131131
return None
132132

133133

src/libvcs/sync/git.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -401,9 +401,9 @@ def update_repo(
401401
self.log.debug("No git revision set, defaulting to origin/master")
402402
symref = self.cmd.symbolic_ref(name="HEAD", short=True)
403403
git_tag = symref.rstrip() if symref else "origin/master"
404-
self.log.debug(f"git_tag: {git_tag}")
404+
self.log.debug("git_tag: %s", git_tag)
405405

406-
self.log.info(f"Updating to '{git_tag}'.")
406+
self.log.info("Updating to '%s'.", git_tag)
407407

408408
# Get head sha
409409
try:
@@ -416,14 +416,14 @@ def update_repo(
416416
self.log.exception("Failed to get the hash for HEAD")
417417
return
418418

419-
self.log.debug(f"head_sha: {head_sha}")
419+
self.log.debug("head_sha: %s", head_sha)
420420

421421
# If a remote ref is asked for, which can possibly move around,
422422
# we must always do a fetch and checkout.
423423
show_ref_output = self.cmd.show_ref(pattern=git_tag, check_returncode=False)
424-
self.log.debug(f"show_ref_output: {show_ref_output}")
424+
self.log.debug("show_ref_output: %s", show_ref_output)
425425
is_remote_ref = "remotes" in show_ref_output
426-
self.log.debug(f"is_remote_ref: {is_remote_ref}")
426+
self.log.debug("is_remote_ref: %s", is_remote_ref)
427427

428428
# show-ref output is in the form "<sha> refs/remotes/<remote>/<tag>"
429429
# we must strip the remote from the tag.
@@ -441,8 +441,8 @@ def update_repo(
441441
raise GitRemoteRefNotFound(git_tag=git_tag, ref_output=show_ref_output)
442442
git_remote_name = m.group("git_remote_name")
443443
git_tag = m.group("git_tag")
444-
self.log.debug(f"git_remote_name: {git_remote_name}")
445-
self.log.debug(f"git_tag: {git_tag}")
444+
self.log.debug("git_remote_name: %s", git_remote_name)
445+
self.log.debug("git_tag: %s", git_tag)
446446

447447
# This will fail if the tag does not exist (it probably has not
448448
# been fetched yet).
@@ -456,7 +456,7 @@ def update_repo(
456456
except exc.CommandError as e:
457457
error_code = e.returncode if e.returncode is not None else 0
458458
tag_sha = ""
459-
self.log.debug(f"tag_sha: {tag_sha}")
459+
self.log.debug("tag_sha: %s", tag_sha)
460460

461461
# Is the hash checkout out what we want?
462462
somethings_up = (error_code, is_remote_ref, tag_sha != head_sha)
@@ -467,7 +467,7 @@ def update_repo(
467467
try:
468468
process = self.cmd.fetch(log_in_real_time=True, check_returncode=True)
469469
except exc.CommandError:
470-
self.log.exception(f"Failed to fetch repository '{url}'")
470+
self.log.exception("Failed to fetch repository '%s'", url)
471471
return
472472

473473
if is_remote_ref:
@@ -493,7 +493,7 @@ def update_repo(
493493
try:
494494
process = self.cmd.checkout(branch=git_tag)
495495
except exc.CommandError:
496-
self.log.exception(f"Failed to checkout tag: '{git_tag}'")
496+
self.log.exception("Failed to checkout tag: '%s'", git_tag)
497497
return
498498

499499
# Rebase changes from the remote branch
@@ -537,7 +537,7 @@ def update_repo(
537537
try:
538538
process = self.cmd.checkout(branch=git_tag)
539539
except exc.CommandError:
540-
self.log.exception(f"Failed to checkout tag: '{git_tag}'")
540+
self.log.exception("Failed to checkout tag: '%s'", git_tag)
541541
return
542542

543543
self.cmd.submodule.update(recursive=True, init=True, log_in_real_time=True)

0 commit comments

Comments
 (0)