[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-29 00:20:51 +00:00
commit df3a4582f8
3 changed files with 14 additions and 12 deletions

View file

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

View file

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

View file

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