From b38b10c9a6150efb0d0ffcba07cb5244ad6b3fd7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= Date: Mon, 25 Aug 2025 12:15:13 +0200 Subject: [PATCH] automatic ruff fixes --- pkgs/clan-cli/clan_cli/network/list.py | 3 ++- pkgs/clan-cli/clan_cli/tests/test_vars.py | 3 +-- pkgs/clan-cli/clan_lib/flake/flake.py | 3 ++- .../clan_lib/sandbox_exec/tests/test_sandbox_exec.py | 5 ++++- pkgs/clan-cli/clan_lib/ssh/remote.py | 5 ++++- pkgs/clan-cli/clan_lib/templates/disk.py | 4 +++- 6 files changed, 16 insertions(+), 7 deletions(-) diff --git a/pkgs/clan-cli/clan_cli/network/list.py b/pkgs/clan-cli/clan_cli/network/list.py index 73bb9abb0..ac3afb744 100644 --- a/pkgs/clan-cli/clan_cli/network/list.py +++ b/pkgs/clan-cli/clan_cli/network/list.py @@ -19,7 +19,8 @@ def list_command(args: argparse.Namespace) -> None: col_network = max(12, *(len(name) for name in networks)) col_priority = 8 col_module = max( - 10, *(len(net.module_name.split(".")[-1]) for net in networks.values()) + 10, + *(len(net.module_name.split(".")[-1]) for net in networks.values()), ) col_running = 8 diff --git a/pkgs/clan-cli/clan_cli/tests/test_vars.py b/pkgs/clan-cli/clan_cli/tests/test_vars.py index 89941821d..2430f16a7 100644 --- a/pkgs/clan-cli/clan_cli/tests/test_vars.py +++ b/pkgs/clan-cli/clan_cli/tests/test_vars.py @@ -1146,8 +1146,7 @@ def test_share_mode_switch_regenerates_secret( monkeypatch: pytest.MonkeyPatch, flake_with_sops: ClanFlake, ) -> None: - """ - Test that switching a generator from share=false to share=true + """Test that switching a generator from share=false to share=true causes the secret to be regenerated with a new value. """ flake = flake_with_sops diff --git a/pkgs/clan-cli/clan_lib/flake/flake.py b/pkgs/clan-cli/clan_lib/flake/flake.py index 243128023..612bf3fbb 100644 --- a/pkgs/clan-cli/clan_lib/flake/flake.py +++ b/pkgs/clan-cli/clan_lib/flake/flake.py @@ -555,7 +555,8 @@ class FlakeCacheEntry: # string and maybe work the same for cache checking if (selector.type in (SelectorType.STR, SelectorType.MAYBE)) and isinstance( - self.value, dict + self.value, + dict, ): if not isinstance(selector.value, str): msg = f"Expected str for STR/MAYBE selector value in caching, got {type(selector.value)}" diff --git a/pkgs/clan-cli/clan_lib/sandbox_exec/tests/test_sandbox_exec.py b/pkgs/clan-cli/clan_lib/sandbox_exec/tests/test_sandbox_exec.py index b9b17a28f..f6154e944 100644 --- a/pkgs/clan-cli/clan_lib/sandbox_exec/tests/test_sandbox_exec.py +++ b/pkgs/clan-cli/clan_lib/sandbox_exec/tests/test_sandbox_exec.py @@ -43,7 +43,10 @@ def test_sandbox_denies_write_to_home() -> None: with sandbox_exec_cmd(script, tmpdir_path) as cmd: result = subprocess.run( - cmd, check=False, capture_output=True, text=True + cmd, + check=False, + capture_output=True, + text=True, ) # Check that either the write was denied or the file wasn't created diff --git a/pkgs/clan-cli/clan_lib/ssh/remote.py b/pkgs/clan-cli/clan_lib/ssh/remote.py index f89f62617..69081388d 100644 --- a/pkgs/clan-cli/clan_lib/ssh/remote.py +++ b/pkgs/clan-cli/clan_lib/ssh/remote.py @@ -172,7 +172,10 @@ class Remote: ] exit_cmd.append(remote.target) subprocess.run( - exit_cmd, check=False, capture_output=True, timeout=5 + exit_cmd, + check=False, + capture_output=True, + timeout=5, ) except (subprocess.TimeoutExpired, subprocess.CalledProcessError): # If exit fails still try to stop the master connection diff --git a/pkgs/clan-cli/clan_lib/templates/disk.py b/pkgs/clan-cli/clan_lib/templates/disk.py index 027c475e0..ff42d5382 100644 --- a/pkgs/clan-cli/clan_lib/templates/disk.py +++ b/pkgs/clan-cli/clan_lib/templates/disk.py @@ -134,7 +134,9 @@ def get_machine_disk_schemas( raw_readme = (disk_template / "README.md").read_text() frontmatter, readme = extract_frontmatter( - raw_readme, f"{disk_template}/README.md", fm_class=DiskManifest + raw_readme, + f"{disk_template}/README.md", + fm_class=DiskManifest, ) disk_schemas[schema_name] = DiskSchema(