From 416393e7249d9f2b9ae2ae8faa166ca87c4ea91d Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Sun, 26 Jul 2026 23:40:54 +0000 Subject: [PATCH] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- studio/backend/routes/inference.py | 4 +++- studio/backend/tests/test_diffusion_dataset_api.py | 11 +++++++---- studio/backend/tests/test_video_gallery.py | 13 +++++++++++-- 3 files changed, 21 insertions(+), 7 deletions(-) diff --git a/studio/backend/routes/inference.py b/studio/backend/routes/inference.py index 6a9b3f2fd4..1d750b5cdc 100644 --- a/studio/backend/routes/inference.py +++ b/studio/backend/routes/inference.py @@ -16544,7 +16544,9 @@ def _absolute_image_url(request: Request, image_id: str) -> str: """The absolute, directly fetchable link for one gallery image, on the request's own scheme+host. Signed rather than bearer-gated (see above), so a standard image client can download it; b64_json still avoids the round trip entirely.""" - relative = f"/api/inference/images/gallery/{image_id}/file-signed?token={_sign_image_id(image_id)}" + relative = ( + f"/api/inference/images/gallery/{image_id}/file-signed?token={_sign_image_id(image_id)}" + ) return str(request.base_url).rstrip("/") + relative diff --git a/studio/backend/tests/test_diffusion_dataset_api.py b/studio/backend/tests/test_diffusion_dataset_api.py index e76e38bc2c..2361815f77 100644 --- a/studio/backend/tests/test_diffusion_dataset_api.py +++ b/studio/backend/tests/test_diffusion_dataset_api.py @@ -305,7 +305,12 @@ class _FakeDS: return iter(self._rows) -def _install_fake_load_dataset(monkeypatch, n_rows, features = "default", streamable = True): +def _install_fake_load_dataset( + monkeypatch, + n_rows, + features = "default", + streamable = True, +): calls = {"count": 0, "streaming": [], "features": features} rows = [ {"image": Image.new("RGB", (8, 8), (i * 30 % 255, 60, 90)), "prompt": f"caption {i}"} @@ -371,9 +376,7 @@ def test_import_example_respects_cap(client, ds_root, monkeypatch): assert r.json()["image_count"] == 2 -def test_import_example_streams_instead_of_preparing_the_whole_split( - client, ds_root, monkeypatch -): +def test_import_example_streams_instead_of_preparing_the_whole_split(client, ds_root, monkeypatch): # The cap keeps 10-100 rows, while the curated repos run to 49,859 rows / 328 MB # (m1guelpf/nouns), all of which a prepared load downloads and converts before the first row is # read. The import must ask for a streamed split. diff --git a/studio/backend/tests/test_video_gallery.py b/studio/backend/tests/test_video_gallery.py index 73719a0c3f..f18db6d9a8 100644 --- a/studio/backend/tests/test_video_gallery.py +++ b/studio/backend/tests/test_video_gallery.py @@ -354,7 +354,11 @@ def _real_mp4_bytes( return buf.getvalue() -def _real_mp4_with_audio(seconds: int = 1, size: int = 32, rate: int = 8) -> bytes: +def _real_mp4_with_audio( + seconds: int = 1, + size: int = 32, + rate: int = 8, +) -> bytes: # An LTX-2-shaped clip: video plus a synchronized audio track (a 440 Hz tone), so the WebM # export can be checked for the track rather than assumed silent. av = pytest.importorskip("av") @@ -432,7 +436,12 @@ def test_webm_export_still_works_without_an_audio_encoder(monkeypatch): real_add_stream = av.container.OutputContainer.add_stream - def _no_opus(self, codec_name = None, *args, **kwargs): + def _no_opus( + self, + codec_name = None, + *args, + **kwargs, + ): if codec_name == "libopus": raise ValueError("unknown encoder 'libopus'") return real_add_stream(self, codec_name, *args, **kwargs)