style!: adopt the core lint bar and migrate to it
The package carried no ruff configuration at all, so it ran on the defaults (E4+E7+E9+F) while infinito-nexus-core, its only consumer, holds itself to a far wider selection. Measured against that selection this tree had 224 findings. It now has none. The selector list is core's verbatim so both repositories answer to one bar. target-version stays py39 rather than core's py311, because requires-python still declares >=3.9 and pyupgrade would otherwise propose syntax the declared minimum cannot run. Every ignore carries its reason: S603/S607 in particular, since running docker and dump binaries from PATH in list form is this tool's whole job and is already injection-safe. Two conversions are judgement rather than mechanics. os.path.join(dir, '') was the rsync idiom for a trailing separator, which Path drops, so it becomes an explicit os.sep. os.path.abspath stays where Path.resolve() would follow symlinks and let a symlinked volume test as inside the snapshot subject. BREAKING CHANGE: VersionMismatch is renamed VersionMismatchError. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
94637c32aa
commit
efcfe88e7f
18 files changed
+157
-91
No files matched your search
@@ -12,6 +12,7 @@ from __future__ import annotations
|
||||
|
||||
import os
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
from .run import docker_volume_exists, run, stdout_of
|
||||
|
||||
@@ -21,7 +22,7 @@ INSPECT_FORMAT = (
|
||||
|
||||
|
||||
def restore_volume_files(volume_name: str, backup_files_dir: str) -> int:
|
||||
if not os.path.isdir(backup_files_dir):
|
||||
if not Path(backup_files_dir).is_dir():
|
||||
print(f"ERROR: backup files dir not found: {backup_files_dir}", file=sys.stderr)
|
||||
return 2
|
||||
|
||||
@@ -44,7 +45,7 @@ def restore_volume_files(volume_name: str, backup_files_dir: str) -> int:
|
||||
)
|
||||
return 2
|
||||
|
||||
driver, options = (fields + ["local", "plain"])[1:3]
|
||||
driver, options = ([*fields, "local", "plain"])[1:3]
|
||||
if (driver != "local" or options == "opts") and not os.path.ismount(mountpoint):
|
||||
print(
|
||||
f"ERROR: volume {volume_name} has a backing store of its own "
|
||||
@@ -55,8 +56,9 @@ def restore_volume_files(volume_name: str, backup_files_dir: str) -> int:
|
||||
)
|
||||
return 2
|
||||
|
||||
src = os.path.join(backup_files_dir, "")
|
||||
dest = os.path.join(mountpoint, "")
|
||||
# rsync reads "dir/" as its contents and "dir" as the directory itself.
|
||||
src = f"{Path(backup_files_dir)}{os.sep}"
|
||||
dest = f"{Path(mountpoint)}{os.sep}"
|
||||
run(["rsync", "-avv", "--delete", src, dest])
|
||||
print("File restore complete.")
|
||||
return 0
|
||||
Reference in new issue
Block a user