clan-cli: Fix regression in ruff linter, where linter rules got overriden by local pyproject.toml

clan-app: Fix ruff regression where linter rules got overriden by local pyproject.toml
This commit is contained in:
Qubasa
2025-07-08 12:46:44 +07:00
parent de664fbf17
commit f854c39292
23 changed files with 43 additions and 50 deletions

View File

@@ -15,8 +15,8 @@ from . import (
clan,
secrets,
select,
templates,
state,
templates,
vms,
)
from .arg_actions import AppendOptionAction

View File

@@ -14,7 +14,7 @@ log = logging.getLogger(__name__)
@contextmanager
def pause_automounting(
devices: list[Path], machine: Machine, request_graphical: bool = False
) -> Generator[None, None, None]:
) -> Generator[None]:
"""
Pause automounting on the device for the duration of this context
manager

View File

@@ -1,5 +1,6 @@
# !/usr/bin/env python3
import argparse
from .list import register_list_parser

View File

@@ -1,11 +1,10 @@
import pytest
from pathlib import Path
import pytest
from clan_cli.tests.fixtures_flakes import FlakeForTest
from clan_lib.cmd import run
from clan_lib.flake import Flake
from clan_lib.nix import nix_command
from clan_lib.templates import list_templates
from clan_lib.templates.filesystem import copy_from_nixstore

View File

@@ -1,11 +1,11 @@
import argparse
import logging
from typing import TYPE_CHECKING
from clan_cli.completions import add_dynamic_completer, complete_machines
from clan_lib.errors import ClanError
from clan_lib.machines.machines import Machine
from clan_lib.flake import Flake
from typing import TYPE_CHECKING
from clan_lib.machines.machines import Machine
if TYPE_CHECKING:
from .generate import Var

View File

@@ -54,7 +54,8 @@ class Generator:
@cached_property
def exists(self) -> bool:
assert self.machine is not None and self._flake is not None
assert self.machine is not None
assert self._flake is not None
return check_vars(self.machine, self._flake, generator_name=self.name)
@classmethod
@@ -116,7 +117,8 @@ class Generator:
return generators
def final_script(self) -> Path:
assert self.machine is not None and self._flake is not None
assert self.machine is not None
assert self._flake is not None
from clan_lib.machines.machines import Machine
from clan_lib.nix import nix_test_store
@@ -131,7 +133,8 @@ class Generator:
return output
def validation(self) -> str | None:
assert self.machine is not None and self._flake is not None
assert self.machine is not None
assert self._flake is not None
from clan_lib.machines.machines import Machine
machine = Machine(name=self.machine, flake=self._flake)

View File

@@ -1,7 +1,7 @@
import io
import logging
import tarfile
import subprocess
import tarfile
from collections.abc import Iterable
from pathlib import Path
from tempfile import TemporaryDirectory
@@ -79,7 +79,7 @@ class SecretStore(StoreBase):
return Path(self.entry_prefix) / self.rel_dir(generator, name)
def _run_pass(
self, *args: str, input: bytes | None = None, check: bool = True
self, *args: str, input: bytes | None = None, check: bool = True # noqa: A002
) -> subprocess.CompletedProcess[bytes]:
cmd = [self._pass_command, *args]
# We need bytes support here, so we can not use clan cmd.
@@ -88,8 +88,7 @@ class SecretStore(StoreBase):
return subprocess.run(
cmd,
input=input,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
capture_output=True,
check=check,
)
@@ -152,7 +151,7 @@ class SecretStore(StoreBase):
if not local_hash:
return True
from clan_lib.cmd import RunOpts, Log
from clan_lib.cmd import Log, RunOpts
remote_hash = host.run(
[

View File

@@ -139,7 +139,7 @@ def qemu_command(
"-chardev", f"socket,path={qga_socket_file},server=on,wait=off,id=qga0",
"-device", "virtio-serial",
"-device", "virtserialport,chardev=qga0,name=org.qemu.guest_agent.0",
] # fmt: on
]
if interactive:
command.extend(
[
@@ -187,7 +187,7 @@ class QMPWrapper:
self._qga_socket: Path = state_dir / "qga.sock"
@contextmanager
def qmp_ctx(self) -> Generator[QEMUMonitorProtocol, None, None]:
def qmp_ctx(self) -> Generator[QEMUMonitorProtocol]:
rpath = self._qmp_socket.resolve()
if not rpath.exists():
msg = f"qmp socket {rpath} does not exist. Is the VM running?"