[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-05-25 10:33:03 +00:00
commit 63f3faf022
3 changed files with 9 additions and 14 deletions

View file

@ -338,8 +338,9 @@ def _scrub_validation_obj(value):
# ``{"hf_xxxxx": "owner/repo"}``. Scrub string keys too so the
# token does not leak through the 422 response body.
return {
(_scrub_validation_obj(k) if isinstance(k, str) else k):
_scrub_validation_obj(v)
(
_scrub_validation_obj(k) if isinstance(k, str) else k
): _scrub_validation_obj(v)
for k, v in value.items()
}
return value

View file

@ -1681,19 +1681,11 @@ async def unload_model(
llama_matches_request = (
loaded_identifier == request.model_path
or loading_identifier == request.model_path
or is_registered_native_path_label(
loaded_identifier, request.model_path
)
or is_registered_native_path_label(
loading_identifier, request.model_path
)
or is_registered_native_path_label(loaded_identifier, request.model_path)
or is_registered_native_path_label(loading_identifier, request.model_path)
)
if (
getattr(llama_backend, "is_active", False)
or loading_identifier
) and (
llama_matches_request
or not getattr(llama_backend, "is_loaded", False)
if (getattr(llama_backend, "is_active", False) or loading_identifier) and (
llama_matches_request or not getattr(llama_backend, "is_loaded", False)
):
# Round 19 P1 #6: previously this called
# ``llama_backend.unload_model()`` and unconditionally

View file

@ -398,9 +398,11 @@ def _install_fake_diffusers(monkeypatch, *, raise_on_pipeline = False):
# ``subfolder="transformer"``) so existing tests that exercise
# the GGUF path do not hit a TypeError from the fake signature.
fake_hub = types.ModuleType("huggingface_hub")
def _fake_download(repo_id, filename, token = None, subfolder = None, **_kwargs):
sub = f"{subfolder}/" if subfolder else ""
return f"/fake/{repo_id}/{sub}{filename}"
fake_hub.hf_hub_download = _fake_download
monkeypatch.setitem(sys.modules, "huggingface_hub", fake_hub)