RUF100: fix

This commit is contained in:
Jörg Thalheim
2025-08-26 15:26:11 +02:00
parent d5b09f18ed
commit 8ba8fda54b
10 changed files with 16 additions and 25 deletions

View File

@@ -1,4 +1,3 @@
# ruff: noqa: SLF001
import argparse
import pytest

View File

@@ -45,15 +45,15 @@ def test_cache_persistance(flake: ClanFlake) -> None:
flake2 = Flake(str(flake.path))
flake1.invalidate_cache()
flake2.invalidate_cache()
assert isinstance(flake1._cache, FlakeCache) # noqa: SLF001
assert isinstance(flake2._cache, FlakeCache) # noqa: SLF001
assert not flake1._cache.is_cached( # noqa: SLF001
assert isinstance(flake1._cache, FlakeCache)
assert isinstance(flake2._cache, FlakeCache)
assert not flake1._cache.is_cached(
"nixosConfigurations.*.config.networking.hostName",
)
flake1.select("nixosConfigurations.*.config.networking.hostName")
flake1.select("nixosConfigurations.*.config.networking.{hostName,hostId}")
flake2.invalidate_cache()
assert flake2._cache.is_cached( # noqa: SLF001
assert flake2._cache.is_cached(
"nixosConfigurations.*.config.networking.{hostName,hostId}",
)
@@ -312,10 +312,10 @@ def test_cache_gc(tmp_path: Path, monkeypatch: pytest.MonkeyPatch) -> None:
my_flake.select("testfile")
else:
my_flake.select("testfile")
assert my_flake._cache is not None # noqa: SLF001
assert my_flake._cache.is_cached("testfile") # noqa: SLF001
assert my_flake._cache is not None
assert my_flake._cache.is_cached("testfile")
subprocess.run(["nix-collect-garbage"], check=True)
assert not my_flake._cache.is_cached("testfile") # noqa: SLF001
assert not my_flake._cache.is_cached("testfile")
def test_store_path_with_line_numbers_not_wrapped() -> None:

View File

@@ -207,8 +207,8 @@ def test_conditional_all_selector(flake: ClanFlake) -> None:
flake2 = Flake(str(flake.path))
flake1.invalidate_cache()
flake2.invalidate_cache()
assert isinstance(flake1._cache, FlakeCache) # noqa: SLF001
assert isinstance(flake2._cache, FlakeCache) # noqa: SLF001
assert isinstance(flake1._cache, FlakeCache)
assert isinstance(flake2._cache, FlakeCache)
log.info("First select")
res1 = flake1.select("inputs.*.{?clan,?missing}.templates.*.*.description")

View File

@@ -212,7 +212,7 @@ def test_get_machine_writeability(clan_flake: Callable[..., Flake]) -> None:
inventory_store.write(inventory, message="Test writeability")
# Check that the tags were updated
persisted = inventory_store._get_persisted() # noqa: SLF001
persisted = inventory_store._get_persisted()
assert get_value_by_path(persisted, "machines.jon.tags", []) == new_tags
write_info = get_machine_fields_schema(Machine("jon", flake))

View File

@@ -1,9 +1,6 @@
# DO NOT EDIT THIS FILE MANUALLY. IT IS GENERATED.
# This file was generated by running `pkgs/clan-cli/clan_lib.inventory/update.sh`
#
# ruff: noqa: N815
# ruff: noqa: N806
# ruff: noqa: F401
# fmt: off
from typing import Any, Literal, NotRequired, TypedDict

View File

@@ -1,4 +1,3 @@
# ruff: noqa: SLF001
import json
import os
import shutil