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 @@ -130,13 +130,31 @@ def bind_params(
130
130
"""
131
131
Binds parameters to values or callables that produce values.
132
132
133
- Args:
134
- bound_params: A mapping of parameter names to values or callables that
135
- produce values.
133
+ Args:
134
+ bound_params: A mapping of parameter names to values or callables that
135
+ produce values.
136
136
137
- Returns:
138
- A new ToolboxSyncTool instance with the specified parameters bound.
137
+ Returns:
138
+ A new ToolboxSyncTool instance with the specified parameters bound.
139
139
"""
140
140
141
141
new_async_tool = self .__async_tool .bind_params (bound_params )
142
142
return ToolboxSyncTool (new_async_tool , self .__loop , self .__thread )
143
+
144
+ def bind_param (
145
+ self ,
146
+ param_name : str ,
147
+ param_value : Union [Callable [[], Any ], Any ],
148
+ ) -> "ToolboxTool" :
149
+ """
150
+ Binds a parameter to the value or callables that produce it.
151
+
152
+ Args:
153
+ param_name: The name of the bound parameter.
154
+ param_value: The value of the bound parameter, or a callable that
155
+ returns the value.
156
+
157
+ Returns:
158
+ A new ToolboxSyncTool instance with the specified parameter bound.
159
+ """
160
+ return self .bind_params ({param_name : param_value })
Original file line number Diff line number Diff line change @@ -279,12 +279,12 @@ def bind_params(
279
279
"""
280
280
Binds parameters to values or callables that produce values.
281
281
282
- Args:
283
- bound_params: A mapping of parameter names to values or callables that
284
- produce values.
282
+ Args:
283
+ bound_params: A mapping of parameter names to values or callables that
284
+ produce values.
285
285
286
- Returns:
287
- A new ToolboxTool instance with the specified parameters bound.
286
+ Returns:
287
+ A new ToolboxTool instance with the specified parameters bound.
288
288
"""
289
289
param_names = set (p .name for p in self .__params )
290
290
for name in bound_params .keys ():
@@ -307,3 +307,21 @@ def bind_params(
307
307
params = new_params ,
308
308
bound_params = types .MappingProxyType (all_bound_params ),
309
309
)
310
+
311
+ def bind_param (
312
+ self ,
313
+ param_name : str ,
314
+ param_value : Union [Callable [[], Any ], Any ],
315
+ ) -> "ToolboxTool" :
316
+ """
317
+ Binds a parameter to the value or callables that produce it.
318
+
319
+ Args:
320
+ param_name: The name of the bound parameter.
321
+ param_value: The value of the bound parameter, or a callable that
322
+ returns the value.
323
+
324
+ Returns:
325
+ A new ToolboxTool instance with the specified parameters bound.
326
+ """
327
+ return self .bind_params ({param_name : param_value })
You can’t perform that action at this time.
0 commit comments