@@ -52,9 +52,9 @@ def __init__(
52
52
if not isinstance (async_tool , ToolboxTool ):
53
53
raise TypeError ("async_tool must be an instance of ToolboxTool" )
54
54
55
- self .__async_tool = async_tool
56
- self .__loop = loop
57
- self .__thread = thread
55
+ self ._async_tool = async_tool
56
+ self ._loop = loop
57
+ self ._thread = thread
58
58
59
59
# NOTE: We cannot define __qualname__ as a @property here.
60
60
# Properties are designed to compute values dynamically when accessed on an *instance* (using 'self').
@@ -65,27 +65,39 @@ def __init__(
65
65
# a string value immediately, not a descriptor that evaluates later.
66
66
self .__qualname__ = f"{ self .__class__ .__qualname__ } .{ self .__async_tool ._name } "
67
67
68
+ @property
69
+ def _async_tool (self ) -> ToolboxTool :
70
+ return self ._async_tool
71
+
72
+ @property
73
+ def _loop (self ) -> AbstractEventLoop :
74
+ return self ._loop
75
+
76
+ @property
77
+ def _thread (self ) -> Thread :
78
+ return self ._thread
79
+
68
80
@property
69
81
def __name__ (self ) -> str :
70
- return self .__async_tool .__name__
82
+ return self ._async_tool .__name__
71
83
72
84
@property
73
85
def __doc__ (self ) -> Union [str , None ]: # type: ignore[override]
74
86
# Standard Python object attributes like __doc__ are technically "writable".
75
87
# But not defining a setter function makes this a read-only property.
76
88
# Mypy flags this issue in the type checks.
77
- return self .__async_tool .__doc__
89
+ return self ._async_tool .__doc__
78
90
79
91
@property
80
92
def __signature__ (self ) -> Signature :
81
- return self .__async_tool .__signature__
93
+ return self ._async_tool .__signature__
82
94
83
95
@property
84
96
def __annotations__ (self ) -> dict [str , Any ]: # type: ignore[override]
85
97
# Standard Python object attributes like __doc__ are technically "writable".
86
98
# But not defining a setter function makes this a read-only property.
87
99
# Mypy flags this issue in the type checks.
88
- return self .__async_tool .__annotations__
100
+ return self ._async_tool .__annotations__
89
101
90
102
@property
91
103
def _name (self ) -> str :
@@ -129,8 +141,8 @@ def __call__(self, *args: Any, **kwargs: Any) -> str:
129
141
Returns:
130
142
The string result returned by the remote tool execution.
131
143
"""
132
- coro = self .__async_tool (* args , ** kwargs )
133
- return asyncio .run_coroutine_threadsafe (coro , self .__loop ).result ()
144
+ coro = self ._async_tool (* args , ** kwargs )
145
+ return asyncio .run_coroutine_threadsafe (coro , self ._loop ).result ()
134
146
135
147
def add_auth_token_getters (
136
148
self ,
@@ -149,8 +161,8 @@ def add_auth_token_getters(
149
161
getters registered.
150
162
"""
151
163
152
- new_async_tool = self .__async_tool .add_auth_token_getters (auth_token_getters )
153
- return ToolboxSyncTool (new_async_tool , self .__loop , self .__thread )
164
+ new_async_tool = self ._async_tool .add_auth_token_getters (auth_token_getters )
165
+ return ToolboxSyncTool (new_async_tool , self ._loop , self ._thread )
154
166
155
167
def bind_params (
156
168
self , bound_params : Mapping [str , Union [Callable [[], Any ], Any ]]
@@ -166,8 +178,8 @@ def bind_params(
166
178
A new ToolboxSyncTool instance with the specified parameters bound.
167
179
"""
168
180
169
- new_async_tool = self .__async_tool .bind_params (bound_params )
170
- return ToolboxSyncTool (new_async_tool , self .__loop , self .__thread )
181
+ new_async_tool = self ._async_tool .bind_params (bound_params )
182
+ return ToolboxSyncTool (new_async_tool , self ._loop , self ._thread )
171
183
172
184
def bind_param (
173
185
self ,
0 commit comments