From 16c6b7eacf8473411f65cdba186e676096684b10 Mon Sep 17 00:00:00 2001 From: Michael Panchenko Date: Sat, 3 Jan 2026 20:03:33 +0700 Subject: [PATCH] Fixes in typed dicts (incorrect translation from java) --- src/serena/tools/jetbrains_tools.py | 2 +- src/serena/tools/jetbrains_types.py | 15 +++++---------- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/src/serena/tools/jetbrains_tools.py b/src/serena/tools/jetbrains_tools.py index 45d0675a..9ec7e456 100644 --- a/src/serena/tools/jetbrains_tools.py +++ b/src/serena/tools/jetbrains_tools.py @@ -194,7 +194,7 @@ class JetBrainsTypeHierarchyTool(Tool, ToolMarkerSymbolicRead, ToolMarkerOptiona """ @staticmethod - def _transform_hierarchy_nodes(nodes: list[jb.TypeHierarchyNode] | None) -> dict[str, list]: + def _transform_hierarchy_nodes(nodes: list[jb.TypeHierarchyNodeDTO] | None) -> dict[str, list]: """ Transform a list of TypeHierarchyNode into a file-grouped compact format. diff --git a/src/serena/tools/jetbrains_types.py b/src/serena/tools/jetbrains_types.py index d7646bd9..24ad71e8 100644 --- a/src/serena/tools/jetbrains_types.py +++ b/src/serena/tools/jetbrains_types.py @@ -17,12 +17,12 @@ class SymbolDTO(TypedDict): name_path: str relative_path: str type: str - body: str + body: NotRequired[str] quick_info: NotRequired[str] """Quick info text (e.g., type signature) for the symbol, as HTML string.""" documentation: NotRequired[str] """Documentation text for the symbol (if available), as HTML string.""" - text_range: TextRangeDTO + text_range: NotRequired[TextRangeDTO] children: NotRequired[list["SymbolDTO"]] @@ -33,18 +33,13 @@ class SymbolCollectionResponse(TypedDict): as HTML string.""" -class TypeHierarchyNode(TypedDict): +class TypeHierarchyNodeDTO(TypedDict): symbol: SymbolDTO - children: NotRequired[list["TypeHierarchyNode"]] - - -class TypeHierarchy(TypedDict): - nodes: list[TypeHierarchyNode] - depth: int + children: NotRequired[list["TypeHierarchyNodeDTO"]] class TypeHierarchyResponse(TypedDict): symbol: NotRequired[SymbolDTO] - hierarchy: NotRequired[list[TypeHierarchyNode]] + hierarchy: NotRequired[list[TypeHierarchyNodeDTO]] error: NotRequired[str] num_levels_not_included: NotRequired[int]