File tree Expand file tree Collapse file tree 2 files changed +46
-10
lines changed
packages/toolbox-core/src/toolbox_core Expand file tree Collapse file tree 2 files changed +46
-10
lines changed Original file line number Diff line number Diff line change @@ -159,13 +159,31 @@ def bind_params(
159
159
"""
160
160
Binds parameters to values or callables that produce values.
161
161
162
- Args:
163
- bound_params: A mapping of parameter names to values or callables that
164
- produce values.
162
+ Args:
163
+ bound_params: A mapping of parameter names to values or callables that
164
+ produce values.
165
165
166
- Returns:
167
- A new ToolboxSyncTool instance with the specified parameters bound.
166
+ Returns:
167
+ A new ToolboxSyncTool instance with the specified parameters bound.
168
168
"""
169
169
170
170
new_async_tool = self .__async_tool .bind_params (bound_params )
171
171
return ToolboxSyncTool (new_async_tool , self .__loop , self .__thread )
172
+
173
+ def bind_param (
174
+ self ,
175
+ param_name : str ,
176
+ param_value : Union [Callable [[], Any ], Any ],
177
+ ) -> "ToolboxTool" :
178
+ """
179
+ Binds a parameter to the value or callables that produce it.
180
+
181
+ Args:
182
+ param_name: The name of the bound parameter.
183
+ param_value: The value of the bound parameter, or a callable that
184
+ returns the value.
185
+
186
+ Returns:
187
+ A new ToolboxSyncTool instance with the specified parameter bound.
188
+ """
189
+ return self .bind_params ({param_name : param_value })
Original file line number Diff line number Diff line change @@ -307,12 +307,12 @@ def bind_params(
307
307
"""
308
308
Binds parameters to values or callables that produce values.
309
309
310
- Args:
311
- bound_params: A mapping of parameter names to values or callables that
312
- produce values.
310
+ Args:
311
+ bound_params: A mapping of parameter names to values or callables that
312
+ produce values.
313
313
314
- Returns:
315
- A new ToolboxTool instance with the specified parameters bound.
314
+ Returns:
315
+ A new ToolboxTool instance with the specified parameters bound.
316
316
"""
317
317
param_names = set (p .name for p in self .__params )
318
318
for name in bound_params .keys ():
@@ -335,3 +335,21 @@ def bind_params(
335
335
params = new_params ,
336
336
bound_params = MappingProxyType (all_bound_params ),
337
337
)
338
+
339
+ def bind_param (
340
+ self ,
341
+ param_name : str ,
342
+ param_value : Union [Callable [[], Any ], Any ],
343
+ ) -> "ToolboxTool" :
344
+ """
345
+ Binds a parameter to the value or callables that produce it.
346
+
347
+ Args:
348
+ param_name: The name of the bound parameter.
349
+ param_value: The value of the bound parameter, or a callable that
350
+ returns the value.
351
+
352
+ Returns:
353
+ A new ToolboxTool instance with the specified parameters bound.
354
+ """
355
+ return self .bind_params ({param_name : param_value })
You can’t perform that action at this time.
0 commit comments