From df3a4582f8f059132382ce026c751fab1f1c2e82 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 29 Jul 2026 00:20:51 +0000 Subject: [PATCH] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- studio/backend/core/inference/api_monitor.py | 4 +--- .../backend/tests/test_openai_auto_download.py | 18 ++++++++++++------ tests/studio/test_model_picker_contracts.py | 4 +--- 3 files changed, 14 insertions(+), 12 deletions(-) diff --git a/studio/backend/core/inference/api_monitor.py b/studio/backend/core/inference/api_monitor.py index 92b4f43879..6239361dcb 100644 --- a/studio/backend/core/inference/api_monitor.py +++ b/studio/backend/core/inference/api_monitor.py @@ -446,9 +446,7 @@ class ApiMonitor: # one: they are another caller's history too, and an owned shared row # is exactly what an API-key load produces. self._entries = deque( - entry - for entry in self._entries - if entry.shared or entry.subject != subject + entry for entry in self._entries if entry.shared or entry.subject != subject ) def _visible(self, entry: ApiMonitorEntry, subject: Optional[str]) -> bool: diff --git a/studio/backend/tests/test_openai_auto_download.py b/studio/backend/tests/test_openai_auto_download.py index f14ab02ad9..6eb76e3db1 100644 --- a/studio/backend/tests/test_openai_auto_download.py +++ b/studio/backend/tests/test_openai_auto_download.py @@ -684,7 +684,12 @@ class _Req: self.headers = headers or {} -def _hook(model, request, enabled, current_subject = None): +def _hook( + model, + request, + enabled, + current_subject = None, +): import utils.openai_auto_switch_settings as s original = s.get_openai_auto_download_enabled @@ -730,7 +735,11 @@ def test_hook_uses_the_anthropic_envelope_on_messages(hub): def test_hook_swallows_unexpected_failures(hub, monkeypatch): # A broken download path must not turn a servable request into a 500. - async def _boom(model, hf_token = None, **kwargs): + async def _boom( + model, + hf_token = None, + **kwargs, + ): raise RuntimeError("boom") monkeypatch.setattr(auto_dl, "maybe_auto_download", _boom) @@ -739,7 +748,6 @@ def test_hook_swallows_unexpected_failures(hub, monkeypatch): def _download_rows(): from core.inference.api_monitor import api_monitor - return [e for e in api_monitor.snapshot() if e["event"] == "download"] @@ -777,9 +785,7 @@ def test_an_api_key_download_keeps_the_attribution_and_names_its_caller(hub): rows = _download_rows() assert rows and all(row["via_api_key"] is True for row in rows) # Still shared: another subject sees the row, just not the attribution. - others = [ - e for e in api_monitor.snapshot(subject = "someone-else") if e["event"] == "download" - ] + others = [e for e in api_monitor.snapshot(subject = "someone-else") if e["event"] == "download"] assert len(others) == len(rows) assert all(row["via_api_key"] is False for row in others) diff --git a/tests/studio/test_model_picker_contracts.py b/tests/studio/test_model_picker_contracts.py index c1c4c02b5d..bdc90d7ad4 100644 --- a/tests/studio/test_model_picker_contracts.py +++ b/tests/studio/test_model_picker_contracts.py @@ -1081,9 +1081,7 @@ def test_the_hub_settings_editor_reseeds_when_the_live_config_lands(): sidebar = " ".join(_read("features/model-picker/components/sidebar-model-config.tsx").split()) assert "key={modelConfigInstanceKey(modelId, ggufVariant, loadedConfig)}" in sidebar - signature = " ".join( - _read("features/model-picker/model-config/config-signature.ts").split() - ) + signature = " ".join(_read("features/model-picker/model-config/config-signature.ts").split()) # "No live config yet" has to be its own value: that transition is exactly # the one that must remount. assert 'if (!config) { return "none"; }' in signature