From 07aa59e855366af2310cfc1c9ea302a3f64ffa15 Mon Sep 17 00:00:00 2001 From: Ed_ Date: Wed, 24 Jun 2026 17:42:11 -0400 Subject: [PATCH] fix(optional): convert Optional[T] returns to T | None syntax; regen type registry --- docs/type_registry/src_openai_schemas.md | 2 +- docs/type_registry/src_provider_state.md | 2 +- src/ai_client.py | 11 +++++------ 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/docs/type_registry/src_openai_schemas.md b/docs/type_registry/src_openai_schemas.md index 60a65c62..f145140f 100644 --- a/docs/type_registry/src_openai_schemas.md +++ b/docs/type_registry/src_openai_schemas.md @@ -30,7 +30,7 @@ Auto-generated from source. 6 struct(s) defined in this module. ## `src\openai_schemas.py::OpenAICompatibleRequest` **Kind:** `dataclass` -**Defined at:** line 120 +**Defined at:** line 97 **Fields:** - `messages: list[ChatMessage]` diff --git a/docs/type_registry/src_provider_state.md b/docs/type_registry/src_provider_state.md index 649f4d49..6f596919 100644 --- a/docs/type_registry/src_provider_state.md +++ b/docs/type_registry/src_provider_state.md @@ -5,7 +5,7 @@ Auto-generated from source. 1 struct(s) defined in this module. ## `src\provider_state.py::ProviderHistory` **Kind:** `dataclass` -**Defined at:** line 26 +**Defined at:** line 27 **Fields:** - `messages: list[HistoryMessage]` diff --git a/src/ai_client.py b/src/ai_client.py index 39a61a68..fbaeb9c3 100644 --- a/src/ai_client.py +++ b/src/ai_client.py @@ -726,17 +726,16 @@ def _gemini_tool_declaration_result() -> Result[types.Tool]: return Result(data=None, errors=[ErrorInfo(kind=ErrorKind.NOT_FOUND, message="No tool declarations to build", source="ai_client._gemini_tool_declaration_result")]) return Result(data=types.Tool(function_declarations=declarations)) -def _gemini_tool_declaration_result_legacy_compat() -> Optional[types.Tool]: +def _gemini_tool_declaration_result_legacy_compat() -> types.Tool | None: """ LEGACY: prefer _gemini_tool_declaration_result() (returns Result[types.Tool]). - This wrapper is retained for tests that call _gemini_tool_declaration() directly; - it returns Optional[types.Tool] for backward compat only. + This wrapper is retained for tests that call _gemini_tool_declaration() directly. [C: tests/test_tool_access_exclusion.py:test_gemini_tool_declaration_excludes_disabled] """ r = _gemini_tool_declaration_result() return r.data if r.ok else None -def _gemini_tool_declaration() -> Optional[types.Tool]: +def _gemini_tool_declaration() -> types.Tool | None: """Backward-compat alias for _gemini_tool_declaration_result_legacy_compat.""" return _gemini_tool_declaration_result_legacy_compat() @@ -3120,12 +3119,12 @@ def _run_tier4_patch_callback_result(stderr: str, base_dir: str) -> Result[str]: ) -def run_tier4_patch_callback_legacy_compat(stderr: str, base_dir: str) -> Optional[str]: +def run_tier4_patch_callback_legacy_compat(stderr: str, base_dir: str) -> str | None: """LEGACY: prefer _run_tier4_patch_callback_result() (returns Result[str]).""" r = _run_tier4_patch_callback_result(stderr, base_dir) return r.data if r.ok and r.data else None -def run_tier4_patch_callback(stderr: str, base_dir: str) -> Optional[str]: +def run_tier4_patch_callback(stderr: str, base_dir: str) -> str | None: """Backward-compat alias for run_tier4_patch_callback_legacy_compat.""" return run_tier4_patch_callback_legacy_compat(stderr, base_dir)