[pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci
This commit is contained in:
pre-commit-ci[bot] 2026-07-27 10:46:55 +00:00
commit 5434520e67
5 changed files with 16 additions and 9 deletions

View file

@ -707,7 +707,6 @@ class SdCppDiffusionBackend:
out: dict[tuple[str, str], int] = {}
try:
from huggingface_hub import HfApi
api = HfApi(token = hf_token)
except Exception: # noqa: BLE001 -- sizes are best-effort
return out

View file

@ -16097,7 +16097,6 @@ async def diffusion_download_plan(
planner = backend
if fam is not None and predict_engine(fam, model_kind = kind) == ENGINE_SD_CPP:
from core.inference.sd_cpp_backend import get_sd_cpp_backend
planner = get_sd_cpp_backend()
plan = await asyncio.to_thread(
planner.download_plan,

View file

@ -408,9 +408,9 @@ def test_predict_engine_falls_back_when_install_is_disabled_and_nothing_is_insta
@pytest.mark.parametrize(
"kwargs, device",
[
({"model_kind": "pipeline"}, "cpu"), # native is GGUF-only
({"model_kind": "pipeline"}, "cpu"), # native is GGUF-only
({"model_kind": "single_file"}, "cpu"),
({"model_kind": "gguf"}, "cuda"), # a usable GPU always means diffusers
({"model_kind": "gguf"}, "cuda"), # a usable GPU always means diffusers
],
)
def test_predict_engine_returns_diffusers_where_the_load_would(monkeypatch, kwargs, device):

View file

@ -1082,8 +1082,14 @@ def test_download_plan_uses_the_engine_the_load_will_pick(client, monkeypatch):
monkeypatch.setattr(router, "predict_engine", lambda fam, **_: ENGINE_SD_CPP)
native_plan = {
"entries": [{"repo_id": "Comfy-Org/z_image_turbo", "files": ["ae.safetensors"],
"bytes": 7, "gguf_filename": None}],
"entries": [
{
"repo_id": "Comfy-Org/z_image_turbo",
"files": ["ae.safetensors"],
"bytes": 7,
"gguf_filename": None,
}
],
"total_bytes": 7,
}
seen: dict = {}

View file

@ -240,9 +240,12 @@ def test_download_plan_stages_exactly_what_sd_cli_opens(monkeypatch):
)
fam = detect_family("z-image")
expected = {(r, f) for r, f, _k in b._asset_specs(
"unsloth/Z-Image-Turbo-GGUF", "z-image-turbo-Q4_K_M.gguf", fam
)}
expected = {
(r, f)
for r, f, _k in b._asset_specs(
"unsloth/Z-Image-Turbo-GGUF", "z-image-turbo-Q4_K_M.gguf", fam
)
}
listed = {(e["repo_id"], f) for e in plan["entries"] for f in e["files"]}
assert listed == expected
assert plan["total_bytes"] == 12_300