[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-04 03:29:45 +00:00
commit 32556949ce
5 changed files with 22 additions and 12 deletions

View file

@ -911,9 +911,7 @@ async def list_local_models(
models = collect_local_models(models_root)
# Tag each model with its task so the Images picker can filter to diffusion
# (GGUF by architecture; local diffusers checkpoints by pipeline / family).
models = [
m.model_copy(update = {"task": _local_model_task(m)}) for m in models
]
models = [m.model_copy(update = {"task": _local_model_task(m)}) for m in models]
return LocalModelListResponse(
models_dir = str(models_root),

View file

@ -64,8 +64,10 @@ def test_list_images_caption_precedence(client, ds_root):
# a.png -> sidecar (an explicit edit beats the metadata row), b.png -> metadata-only,
# c.png -> none.
(folder / "metadata.jsonl").write_text(
json.dumps({"file_name": "a.png", "text": "from metadata"}) + "\n"
+ json.dumps({"file_name": "b.png", "text": "from metadata"}) + "\n",
json.dumps({"file_name": "a.png", "text": "from metadata"})
+ "\n"
+ json.dumps({"file_name": "b.png", "text": "from metadata"})
+ "\n",
encoding = "utf-8",
)
(folder / "a.txt").write_text("edited sidecar", encoding = "utf-8")

View file

@ -58,7 +58,10 @@ def test_select_lora_targets_explicit_override_wins():
base_model = "black-forest-labs/FLUX.1-dev", data_dir = "d", output_dir = "o"
).normalized()
assert cfg.lora_target_modules == DEFAULT_LORA_TARGETS
assert _select_lora_targets(cfg.lora_target_modules, _SPECS["flux.1"].lora_targets) == _FLUX_TARGETS
assert (
_select_lora_targets(cfg.lora_target_modules, _SPECS["flux.1"].lora_targets)
== _FLUX_TARGETS
)
@pytest.mark.parametrize(

View file

@ -471,8 +471,10 @@ def test_diffusion_info_counts_metadata_captions(client, dataset_roots):
(folder / "c.png").write_bytes(b"x")
# a.png + b.png via metadata; a.png also has a sidecar (must count once); c.png none.
(folder / "metadata.jsonl").write_text(
json.dumps({"file_name": "a.png", "text": "cap a"}) + "\n"
+ json.dumps({"file_name": "b.png", "text": "cap b"}) + "\n",
json.dumps({"file_name": "a.png", "text": "cap a"})
+ "\n"
+ json.dumps({"file_name": "b.png", "text": "cap b"})
+ "\n",
encoding = "utf-8",
)
(folder / "a.txt").write_text("edited a", encoding = "utf-8")

View file

@ -121,7 +121,14 @@ def test_scan_models_dir_classifies_root_gguf_with_config(tmp_path):
from models.models import LocalModelInfo # noqa: E402
def _local(path, *, model_format = None, model_id = None, display_name = "m", id = "m"):
def _local(
path,
*,
model_format = None,
model_id = None,
display_name = "m",
id = "m",
):
return LocalModelInfo(
id = id,
display_name = display_name,
@ -147,9 +154,7 @@ def test_local_task_tags_diffusers_by_family_id(tmp_path):
d = tmp_path / "flux-checkpoint"
_touch(d / "flux1-dev.safetensors")
assert (
models_route._local_model_task(
_local(d, model_id = "black-forest-labs/FLUX.1-dev")
)
models_route._local_model_task(_local(d, model_id = "black-forest-labs/FLUX.1-dev"))
== "text-to-image"
)