clan-cli: Fix Ruff linting errors
clan-cli: Ruff fixes ignore noqa lint fix more ruff issues
This commit is contained in:
@@ -10,9 +10,9 @@ from clan_cli.tests.helpers import cli
|
|||||||
from clan_cli.vars.check import check_vars
|
from clan_cli.vars.check import check_vars
|
||||||
from clan_cli.vars.generate import (
|
from clan_cli.vars.generate import (
|
||||||
Generator,
|
Generator,
|
||||||
run_generators,
|
|
||||||
create_machine_vars_interactive,
|
create_machine_vars_interactive,
|
||||||
get_generators,
|
get_generators,
|
||||||
|
run_generators,
|
||||||
)
|
)
|
||||||
from clan_cli.vars.get import get_machine_var
|
from clan_cli.vars.get import get_machine_var
|
||||||
from clan_cli.vars.graph import all_missing_closure, requested_closure
|
from clan_cli.vars.graph import all_missing_closure, requested_closure
|
||||||
|
|||||||
@@ -79,7 +79,10 @@ class SecretStore(StoreBase):
|
|||||||
return Path(self.entry_prefix) / self.rel_dir(generator, name)
|
return Path(self.entry_prefix) / self.rel_dir(generator, name)
|
||||||
|
|
||||||
def _run_pass(
|
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]:
|
) -> subprocess.CompletedProcess[bytes]:
|
||||||
cmd = [self._pass_command, *args]
|
cmd = [self._pass_command, *args]
|
||||||
# We need bytes support here, so we can not use clan cmd.
|
# We need bytes support here, so we can not use clan cmd.
|
||||||
|
|||||||
@@ -156,9 +156,10 @@ def is_type_in_union(union_type: type | UnionType, target_type: type) -> bool:
|
|||||||
return True
|
return True
|
||||||
# For generic types like dict[str, str], check their origin
|
# For generic types like dict[str, str], check their origin
|
||||||
elif get_origin(arg) is not None:
|
elif get_origin(arg) is not None:
|
||||||
if get_origin(arg) == target_type or (get_origin(target_type) is not None and get_origin(
|
if get_origin(arg) == target_type or (
|
||||||
arg
|
get_origin(target_type) is not None
|
||||||
) == get_origin(target_type)):
|
and get_origin(arg) == get_origin(target_type)
|
||||||
|
):
|
||||||
return True
|
return True
|
||||||
# For actual classes, use issubclass
|
# For actual classes, use issubclass
|
||||||
elif inspect.isclass(arg) and inspect.isclass(target_type):
|
elif inspect.isclass(arg) and inspect.isclass(target_type):
|
||||||
@@ -326,7 +327,7 @@ def construct_value(
|
|||||||
raise ClanError(msg)
|
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: type[T], data: dict[str, Any], path: list[str] | None = None
|
||||||
) -> T:
|
) -> T:
|
||||||
"""
|
"""
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ from clan_cli.machines.create import create_machine
|
|||||||
from clan_cli.secrets.key import generate_key
|
from clan_cli.secrets.key import generate_key
|
||||||
from clan_cli.secrets.sops import maybe_get_admin_public_keys
|
from clan_cli.secrets.sops import maybe_get_admin_public_keys
|
||||||
from clan_cli.secrets.users import add_user
|
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.disk import hw_main_disk_options, set_machine_disk_schema
|
||||||
from clan_lib.api.modules import list_modules
|
from clan_lib.api.modules import list_modules
|
||||||
|
|||||||
@@ -51,6 +51,7 @@ lint.ignore = [
|
|||||||
"A005",
|
"A005",
|
||||||
"TRY301",
|
"TRY301",
|
||||||
"ANN401",
|
"ANN401",
|
||||||
|
"RUF100",
|
||||||
"TRY400",
|
"TRY400",
|
||||||
"E402",
|
"E402",
|
||||||
"E501",
|
"E501",
|
||||||
|
|||||||
Reference in New Issue
Block a user