@@ -51,9 +51,9 @@ def __init__(
51
51
if not isinstance (async_tool , ToolboxTool ):
52
52
raise TypeError ("async_tool must be an instance of ToolboxTool" )
53
53
54
- self .__async_tool = async_tool
55
- self .__loop = loop
56
- self .__thread = thread
54
+ self ._async_tool = async_tool
55
+ self ._loop = loop
56
+ self ._thread = thread
57
57
58
58
# NOTE: We cannot define __qualname__ as a @property here.
59
59
# Properties are designed to compute values dynamically when accessed on an *instance* (using 'self').
@@ -64,27 +64,39 @@ def __init__(
64
64
# a string value immediately, not a descriptor that evaluates later.
65
65
self .__qualname__ = f"{ self .__class__ .__qualname__ } .{ self .__name__ } "
66
66
67
+ @property
68
+ def _async_tool (self ) -> ToolboxTool :
69
+ return self ._async_tool
70
+
71
+ @property
72
+ def _loop (self ) -> AbstractEventLoop :
73
+ return self ._loop
74
+
75
+ @property
76
+ def _thread (self ) -> Thread :
77
+ return self ._thread
78
+
67
79
@property
68
80
def __name__ (self ) -> str :
69
- return self .__async_tool .__name__
81
+ return self ._async_tool .__name__
70
82
71
83
@property
72
84
def __doc__ (self ) -> Union [str , None ]: # type: ignore[override]
73
85
# Standard Python object attributes like __doc__ are technically "writable".
74
86
# But not defining a setter function makes this a read-only property.
75
87
# Mypy flags this issue in the type checks.
76
- return self .__async_tool .__doc__
88
+ return self ._async_tool .__doc__
77
89
78
90
@property
79
91
def __signature__ (self ) -> Signature :
80
- return self .__async_tool .__signature__
92
+ return self ._async_tool .__signature__
81
93
82
94
@property
83
95
def __annotations__ (self ) -> dict [str , Any ]: # type: ignore[override]
84
96
# Standard Python object attributes like __doc__ are technically "writable".
85
97
# But not defining a setter function makes this a read-only property.
86
98
# Mypy flags this issue in the type checks.
87
- return self .__async_tool .__annotations__
99
+ return self ._async_tool .__annotations__
88
100
89
101
def __call__ (self , * args : Any , ** kwargs : Any ) -> str :
90
102
"""
@@ -100,8 +112,8 @@ def __call__(self, *args: Any, **kwargs: Any) -> str:
100
112
Returns:
101
113
The string result returned by the remote tool execution.
102
114
"""
103
- coro = self .__async_tool (* args , ** kwargs )
104
- return asyncio .run_coroutine_threadsafe (coro , self .__loop ).result ()
115
+ coro = self ._async_tool (* args , ** kwargs )
116
+ return asyncio .run_coroutine_threadsafe (coro , self ._loop ).result ()
105
117
106
118
def add_auth_token_getters (
107
119
self ,
@@ -120,8 +132,8 @@ def add_auth_token_getters(
120
132
getters registered.
121
133
"""
122
134
123
- new_async_tool = self .__async_tool .add_auth_token_getters (auth_token_getters )
124
- return ToolboxSyncTool (new_async_tool , self .__loop , self .__thread )
135
+ new_async_tool = self ._async_tool .add_auth_token_getters (auth_token_getters )
136
+ return ToolboxSyncTool (new_async_tool , self ._loop , self ._thread )
125
137
126
138
def bind_params (
127
139
self , bound_params : Mapping [str , Union [Callable [[], Any ], Any ]]
@@ -137,8 +149,8 @@ def bind_params(
137
149
A new ToolboxSyncTool instance with the specified parameters bound.
138
150
"""
139
151
140
- new_async_tool = self .__async_tool .bind_params (bound_params )
141
- return ToolboxSyncTool (new_async_tool , self .__loop , self .__thread )
152
+ new_async_tool = self ._async_tool .bind_params (bound_params )
153
+ return ToolboxSyncTool (new_async_tool , self ._loop , self ._thread )
142
154
143
155
def bind_param (
144
156
self ,
0 commit comments