[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 23:40:54 +00:00
commit 416393e724
3 changed files with 21 additions and 7 deletions

View file

@ -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

View file

@ -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.

View file

@ -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)