From 592b8902a00d8562661e766f08960af07d4a7148 Mon Sep 17 00:00:00 2001 From: RockChinQ <45992437+RockChinQ@users.noreply.github.com> Date: Fri, 26 Jun 2026 11:28:36 -0400 Subject: [PATCH] style: fix ruff format issues in plugin_diagnostics and test_handler_actions --- .../pkg/pipeline/plugin_diagnostics.py | 4 +-- .../unit_tests/plugin/test_handler_actions.py | 32 ++++++++++--------- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/src/langbot/pkg/pipeline/plugin_diagnostics.py b/src/langbot/pkg/pipeline/plugin_diagnostics.py index 951ae6e5c..3e1195cf2 100644 --- a/src/langbot/pkg/pipeline/plugin_diagnostics.py +++ b/src/langbot/pkg/pipeline/plugin_diagnostics.py @@ -216,9 +216,7 @@ def _build_plugin_sources( if response_sources is not None: plugin_refs = [_extract_response_source_plugin_ref(source) for source in response_sources] return [ - PluginResponseSource(plugin=plugin, event_name=event_name) - for plugin in plugin_refs - if plugin is not None + PluginResponseSource(plugin=plugin, event_name=event_name) for plugin in plugin_refs if plugin is not None ] if emitted_plugins: diff --git a/tests/unit_tests/plugin/test_handler_actions.py b/tests/unit_tests/plugin/test_handler_actions.py index a135e8b91..2dbc1f4f9 100644 --- a/tests/unit_tests/plugin/test_handler_actions.py +++ b/tests/unit_tests/plugin/test_handler_actions.py @@ -51,13 +51,15 @@ class TestRagRerankAction: app.model_mgr.get_rerank_model_by_uuid = AsyncMock(return_value=rerank_model) runtime_handler = make_handler(app) - response = await runtime_handler.actions[PluginToRuntimeAction.INVOKE_RERANK.value]({ - 'rerank_model_uuid': 'rerank-1', - 'query': 'hello', - 'documents': ['a', 'b'], - 'top_k': 1, - 'extra_args': {'return_documents': False}, - }) + response = await runtime_handler.actions[PluginToRuntimeAction.INVOKE_RERANK.value]( + { + 'rerank_model_uuid': 'rerank-1', + 'query': 'hello', + 'documents': ['a', 'b'], + 'top_k': 1, + 'extra_args': {'return_documents': False}, + } + ) assert response.code == 0 assert response.data['results'] == [{'index': 1, 'relevance_score': 0.9}] @@ -72,16 +74,16 @@ class TestRagRerankAction: @pytest.mark.asyncio async def test_returns_error_when_rerank_model_missing(self, app): """Missing rerank model returns an action error.""" - app.model_mgr.get_rerank_model_by_uuid = AsyncMock( - side_effect=ValueError('not found') - ) + app.model_mgr.get_rerank_model_by_uuid = AsyncMock(side_effect=ValueError('not found')) runtime_handler = make_handler(app) - response = await runtime_handler.actions[PluginToRuntimeAction.INVOKE_RERANK.value]({ - 'rerank_model_uuid': 'missing', - 'query': 'hello', - 'documents': ['a'], - }) + response = await runtime_handler.actions[PluginToRuntimeAction.INVOKE_RERANK.value]( + { + 'rerank_model_uuid': 'missing', + 'query': 'hello', + 'documents': ['a'], + } + ) assert response.code != 0 assert 'Rerank model with rerank_model_uuid missing not found' in response.message