From 67ccd784402dadd9a9b137027f144ef284f3f585 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Fri, 19 Jun 2026 20:49:37 +0000 Subject: [PATCH] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- studio/backend/core/tool_healing.py | 7 ++++++- studio/backend/tests/test_mcp_servers.py | 9 +++++---- tests/studio/test_stream_cancel_registration_timing.py | 4 +--- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/studio/backend/core/tool_healing.py b/studio/backend/core/tool_healing.py index b0e74f20fa..fcc733796d 100644 --- a/studio/backend/core/tool_healing.py +++ b/studio/backend/core/tool_healing.py @@ -39,7 +39,12 @@ _PARAM_CLOSE_TAG = "" _FUNC_CLOSE_TAG = "" -def _balanced_brace_end(content: str, brace_start: int, *, gemma_quotes: bool = False) -> int: +def _balanced_brace_end( + content: str, + brace_start: int, + *, + gemma_quotes: bool = False, +) -> int: depth = 0 i = brace_start in_string = False diff --git a/studio/backend/tests/test_mcp_servers.py b/studio/backend/tests/test_mcp_servers.py index 81153e26ba..12239e7113 100644 --- a/studio/backend/tests/test_mcp_servers.py +++ b/studio/backend/tests/test_mcp_servers.py @@ -433,7 +433,6 @@ def test_tool_healing_strip_handles_gemma_native_tool_call(): def test_tool_healing_strip_handles_gemma_close_only_marker(): from core.tool_healing import strip_tool_call_markup - assert strip_tool_call_markup("before after") == "before after" assert strip_tool_call_markup("before after", final = True) == "before after" @@ -454,9 +453,11 @@ def test_tool_healing_json_parser_preserves_literal_gemma_quote_token(): from core.tool_healing import parse_tool_calls_from_text import json as _json - text = "" + _json.dumps( - {"name": "python", "arguments": {"code": "print('<|\"|>')"}} - ) + "" + text = ( + "" + + _json.dumps({"name": "python", "arguments": {"code": "print('<|\"|>')"}}) + + "" + ) calls = parse_tool_calls_from_text(text, allow_incomplete = False) assert len(calls) == 1 assert _json.loads(calls[0]["function"]["arguments"]) == {"code": "print('<|\"|>')"} diff --git a/tests/studio/test_stream_cancel_registration_timing.py b/tests/studio/test_stream_cancel_registration_timing.py index 09e30bb730..33deb7af9d 100644 --- a/tests/studio/test_stream_cancel_registration_timing.py +++ b/tests/studio/test_stream_cancel_registration_timing.py @@ -284,9 +284,7 @@ def _load_same_task_response_module(): raise AssertionError("_SameTaskStreamingResponse missing") mod = {} exec( - "class StreamingResponse: pass\n" - "class ClientDisconnect(Exception): pass\n" - + source, + "class StreamingResponse: pass\nclass ClientDisconnect(Exception): pass\n" + source, mod, ) return mod