[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 21:39:52 +00:00
commit 75716ea697
5 changed files with 12 additions and 5 deletions

View file

@ -3579,7 +3579,6 @@ def _cached_repo_task(repo_info) -> Optional[str]:
# refuses its repo id, so tagging it text-to-image put a row in the Images picker that 400s.
try:
from core.inference.diffusion import _is_trusted_diffusion_repo
return "text-to-image" if _is_trusted_diffusion_repo(repo_id) else None
except Exception: # noqa: BLE001 -- an import failure must not hide a usable repo
return "text-to-image"

View file

@ -1188,7 +1188,6 @@ def diffusion_dataset_interlock():
TrainingActiveError,
get_diffusion_training_service,
)
service = get_diffusion_training_service()
except Exception: # noqa: BLE001 -- unknowable state never blocks a mutation
yield

View file

@ -1488,7 +1488,9 @@ def test_cached_repo_task_gates_an_image_pipeline_on_the_load_path_trust_rule(tm
assert models_route._cached_repo_task(_pipeline_repo("unsloth/Qwen-Image", tmp_path)) == (
"text-to-image"
)
assert models_route._cached_repo_task(_pipeline_repo("someone/their-sdxl-mix", tmp_path)) is None
assert (
models_route._cached_repo_task(_pipeline_repo("someone/their-sdxl-mix", tmp_path)) is None
)
def test_cached_repo_task_hides_an_untrusted_video_repo_instead_of_listing_it_under_images(

View file

@ -326,7 +326,11 @@ def test_save_leaves_no_orphan_mp4_when_sidecar_publish_fails(monkeypatch):
assert gallery.list_videos() == []
def _real_mp4_bytes(frames: int = 8, size: int = 32, rate: int = 8) -> bytes:
def _real_mp4_bytes(
frames: int = 8,
size: int = 32,
rate: int = 8,
) -> bytes:
# A real (tiny) MP4 for the transcode tests: flat-color frames encoded with mpeg4 (bundled in
# every PyAV build, unlike libx264). The GIF cap tests ask for more/larger frames.
av = pytest.importorskip("av")

View file

@ -622,7 +622,10 @@ def test_a_routed_curated_pick_uses_the_same_load_spec_as_a_direct_one():
repo that has no model_index.json. The catalog spec the page's own picker consults has to win."""
helper = _read("lib/diffusion-route-pick.ts")
assert re.search(r"spec\?:\s*\{\s*kind:", helper), "the helper takes no catalog spec"
assert "if (spec) return { repoId: model, opts: { kind: spec.kind, filename: spec.filename } };" in helper
assert (
"if (spec) return { repoId: model, opts: { kind: spec.kind, filename: spec.filename } };"
in helper
)
for rel, catalog in (
("features/images/images-page.tsx", "IMAGE_CATALOG"),
("features/video/video-page.tsx", "VIDEO_CATALOG"),