style(widgets): apply formatter to widget rebind files
This commit is contained in:
@@ -58,10 +58,7 @@ def _validate_widget_input(body: WidgetInstanceInput, store: SettingsStore) -> N
|
||||
if widget_kind is None:
|
||||
raise HTTPException(
|
||||
status_code=status.HTTP_422_UNPROCESSABLE_CONTENT,
|
||||
detail=(
|
||||
f"Service type '{service['service_type']}' does not provide "
|
||||
f"widget kind '{body.widget_kind}'"
|
||||
),
|
||||
detail=(f"Service type '{service['service_type']}' does not provide widget kind '{body.widget_kind}'"),
|
||||
)
|
||||
if widget_kind.config_model is not None:
|
||||
try:
|
||||
@@ -76,8 +73,7 @@ def _validate_widget_input(body: WidgetInstanceInput, store: SettingsStore) -> N
|
||||
raise HTTPException(
|
||||
status_code=status.HTTP_422_UNPROCESSABLE_CONTENT,
|
||||
detail=(
|
||||
f"Unknown built-in widget kind '{body.widget_kind}' "
|
||||
"(set service_id for service-bound widgets)"
|
||||
f"Unknown built-in widget kind '{body.widget_kind}' (set service_id for service-bound widgets)"
|
||||
),
|
||||
)
|
||||
try:
|
||||
|
||||
@@ -1404,10 +1404,7 @@ class SettingsStore:
|
||||
) -> dict[str, Any]:
|
||||
current = self.get_widget(widget_id) if widget_id else None
|
||||
widget_id = str(payload.get("id") or widget_id or uuid.uuid4().hex[:12]).strip() or uuid.uuid4().hex[:12]
|
||||
service_id = (
|
||||
str(payload.get("service_id") or (current or {}).get("service_id") or "").strip()
|
||||
or None
|
||||
)
|
||||
service_id = str(payload.get("service_id") or (current or {}).get("service_id") or "").strip() or None
|
||||
widget_kind = str(payload.get("widget_kind") or (current or {}).get("widget_kind", "")).strip()
|
||||
title = str(payload.get("title") or (current or {}).get("title", "") or "").strip()
|
||||
config = payload.get("config", (current or {}).get("config", {}))
|
||||
|
||||
@@ -375,8 +375,9 @@ async def test_ssh_task_adapter_records_history_on_run(client):
|
||||
service_record = ServiceRecord(
|
||||
id=service["id"], service_type="ssh_tasks", name="box", config={"host": "h", "username": "u"}
|
||||
)
|
||||
with patch("media_library_viewer_api.widgets.sources.get_settings_store", return_value=store), patch(
|
||||
"media_library_viewer_api.widgets.sources._build_ssh_client", return_value=fake_client
|
||||
with (
|
||||
patch("media_library_viewer_api.widgets.sources.get_settings_store", return_value=store),
|
||||
patch("media_library_viewer_api.widgets.sources._build_ssh_client", return_value=fake_client),
|
||||
):
|
||||
result = await adapter.fetch(service_record, "task_output", {"task_id": task["id"]})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user