[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-26 16:13:14 +00:00
commit 2c2975d62e
4 changed files with 16 additions and 4 deletions

View file

@ -369,7 +369,6 @@ def dit_accelerator_missing_reason(resolved_family: str) -> Optional[str]:
return None
try:
import torch
def probe(owner: Any) -> bool:
# Each accelerator is probed on its own: one missing or throwing probe must not
# decide the other two. torch.mps.is_available() only exists from torch 2.5 and

View file

@ -2595,7 +2595,11 @@ async def delete_finetuned_model(
continue
try:
status = backend.status()
held = [status.get(key) for key in ("repo_id", "base_repo")] if status.get("loaded") else []
held = (
[status.get(key) for key in ("repo_id", "base_repo")]
if status.get("loaded")
else []
)
held += list(getattr(backend, "loaded_repo_ids", tuple)())
if any(h and _loaded_model_matches_deleted_path(str(h), target_path) for h in held):
raise HTTPException(

View file

@ -26,7 +26,14 @@ from routes.models import router as models_router
class _Backend:
"""Minimal stand-in for the Images engine / Video backend delete-guard surface."""
def __init__(self, *, loaded=None, base=None, loading=(), extra=()):
def __init__(
self,
*,
loaded = None,
base = None,
loading = (),
extra = (),
):
self._loaded = loaded
self._base = base
self._loading = tuple(loading)

View file

@ -31,7 +31,9 @@ FILES = ["model_index.json", "transformer/diffusion_pytorch_model.safetensors"]
def offline(monkeypatch, tmp_path):
"""A worker whose metadata lookups all fail, pointed at a snapshot dir we control."""
monkeypatch.setattr(
hf_download, "_model_info_with_retry", lambda *a, **k: (_ for _ in ()).throw(OSError("no net"))
hf_download,
"_model_info_with_retry",
lambda *a, **k: (_ for _ in ()).throw(OSError("no net")),
)
monkeypatch.setattr(hf_download, "_protected_blob_hashes", lambda: frozenset())
monkeypatch.setattr(hf_download, "_preflight_disk_space", lambda *a, **k: None)