Skip to content

Commit 9e1da13

Browse files
committed
fix qualname
1 parent d620c25 commit 9e1da13

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

packages/toolbox-core/src/toolbox_core/sync_tool.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,15 @@ def __init__(
5656
self.__loop = loop
5757
self.__thread = thread
5858

59+
# NOTE: We cannot define __qualname__ as a @property here.
60+
# Properties are designed to compute values dynamically when accessed on an *instance* (using 'self').
61+
# However, Python needs the class's __qualname__ attribute to be a plain string
62+
# *before* any instances exist, specifically when the 'class ToolboxSyncTool:' statement
63+
# itself is being processed during module import or class definition.
64+
# Defining __qualname__ as a property leads to a TypeError because the class object needs
65+
# a string value immediately, not a descriptor that evaluates later.
66+
self.__qualname__ = f"{self.__class__.__qualname__}.{self.__name__}"
67+
5968
@property
6069
def __name__(self) -> str:
6170
return self.__async_tool.__name__
@@ -78,10 +87,6 @@ def __annotations__(self) -> dict[str, Any]: # type: ignore[override]
7887
# Mypy flags this issue in the type checks.
7988
return self.__async_tool.__annotations__
8089

81-
@property
82-
def __qualname__(self) -> str:
83-
return f"{self.__class__.__qualname__}.{self.__name__}"
84-
8590
def __call__(self, *args: Any, **kwargs: Any) -> str:
8691
"""
8792
Synchronously calls the remote tool with the provided arguments.

0 commit comments

Comments
 (0)