clan-cli: Fix Ruff linting errors

clan-cli: Ruff fixes

ignore noqa lint

fix more ruff issues
This commit is contained in:
Qubasa
2025-07-08 14:49:31 +07:00
parent ad243d843e
commit 152ac2c07e
5 changed files with 12 additions and 7 deletions

View File

@@ -10,9 +10,9 @@ from clan_cli.tests.helpers import cli
from clan_cli.vars.check import check_vars
from clan_cli.vars.generate import (
Generator,
run_generators,
create_machine_vars_interactive,
get_generators,
run_generators,
)
from clan_cli.vars.get import get_machine_var
from clan_cli.vars.graph import all_missing_closure, requested_closure

View File

@@ -79,7 +79,10 @@ 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 # noqa: A002
self,
*args: str,
input: bytes | None = None, # noqa: A002
check: bool = True,
) -> subprocess.CompletedProcess[bytes]:
cmd = [self._pass_command, *args]
# We need bytes support here, so we can not use clan cmd.

View File

@@ -156,9 +156,10 @@ def is_type_in_union(union_type: type | UnionType, target_type: type) -> bool:
return True
# For generic types like dict[str, str], check their origin
elif get_origin(arg) is not None:
if get_origin(arg) == target_type or (get_origin(target_type) is not None and get_origin(
arg
) == get_origin(target_type)):
if get_origin(arg) == target_type or (
get_origin(target_type) is not None
and get_origin(arg) == get_origin(target_type)
):
return True
# For actual classes, use issubclass
elif inspect.isclass(arg) and inspect.isclass(target_type):
@@ -326,7 +327,7 @@ def construct_value(
raise ClanError(msg)
def construct_dataclass[T: dataclass](
def construct_dataclass[T: Any](
t: type[T], data: dict[str, Any], path: list[str] | None = None
) -> T:
"""

View File

@@ -14,7 +14,7 @@ from clan_cli.machines.create import create_machine
from clan_cli.secrets.key import generate_key
from clan_cli.secrets.sops import maybe_get_admin_public_keys
from clan_cli.secrets.users import add_user
from clan_cli.vars.generate import run_generators, get_generators
from clan_cli.vars.generate import get_generators, run_generators
from clan_lib.api.disk import hw_main_disk_options, set_machine_disk_schema
from clan_lib.api.modules import list_modules

View File

@@ -51,6 +51,7 @@ lint.ignore = [
"A005",
"TRY301",
"ANN401",
"RUF100",
"TRY400",
"E402",
"E501",