@@ -254,14 +254,18 @@ def generate_workflow(
254
254
class_def_params = self .get_function_parameters (
255
255
getattr (class_def , class_def .FUNCTION )
256
256
)
257
+ no_params = class_def_params is None
257
258
258
259
# Remove any keyword arguments from **inputs if they are not in class_def_params
259
260
inputs = {
260
- key : value for key , value in inputs .items () if key in class_def_params
261
+ key : value
262
+ for key , value in inputs .items ()
263
+ if no_params or key in class_def_params
261
264
}
262
265
# Deal with hidden variables
263
- if "unique_id" in class_def_params :
264
- inputs ["unique_id" ] = random .randint (1 , 2 ** 64 )
266
+ if class_def_params is not None :
267
+ if "unique_id" in class_def_params :
268
+ inputs ["unique_id" ] = random .randint (1 , 2 ** 64 )
265
269
266
270
# Create executed variable and generate code
267
271
executed_variables [idx ] = f"{ self .clean_variable_name (class_type )} _{ idx } "
@@ -471,7 +475,11 @@ def get_function_parameters(self, func: Callable) -> List:
471
475
name : param .default if param .default != param .empty else None
472
476
for name , param in signature .parameters .items ()
473
477
}
474
- return list (parameters .keys ())
478
+ catch_all = any (
479
+ param .kind == inspect .Parameter .VAR_KEYWORD
480
+ for param in signature .parameters .values ()
481
+ )
482
+ return list (parameters .keys ()) if not catch_all else None
475
483
476
484
def update_inputs (self , inputs : Dict , executed_variables : Dict ) -> Dict :
477
485
"""Update inputs based on the executed variables.
0 commit comments