@@ -227,8 +227,8 @@ def define_steps(self, module):
227
227
step = self .get_module_step (module , id )
228
228
229
229
# Method should have an argument for each parameter of the step
230
- arguments = [k ['name' ] for k in step .inputs ]
231
- arg_types = [k ['type' ] for k in step .inputs ]
230
+ arguments = [k ['name' ] for k in step .get ( ' inputs' , []) ]
231
+ arg_types = [k ['type' ] for k in step .get ( ' inputs' , []) ]
232
232
233
233
# Format call to execute_module_step()
234
234
call_params = ['{}={}' .format (i , i ) for i in arguments ]
@@ -237,28 +237,31 @@ def define_steps(self, module):
237
237
type_string = ' # type: ({})' .format (', ' .join (arg_types ))
238
238
239
239
# Method signature
240
- signature = 'def _%s_%s(%s, **kwargs):' \
240
+ input_params = [a for a in arguments ] + ['**kwargs' ]
241
+ signature = 'def _%s_%s(%s):' \
241
242
% (module .name ,
242
243
step .id ,
243
- ', ' .join (a for a in arguments ))
244
+ ', ' .join (input_params ))
244
245
245
246
# MAS always lower-cases variable names
246
247
# Since the original Python variables may have a different case,
247
248
# allow kwargs to be used to input alternative caps
248
- arg_checks = ['for k in kwargs.keys():' ]
249
- for arg in arguments :
250
- arg_checks .append (" if k.lower() == '%s':" % arg .lower ())
251
- arg_checks .append (" %s = kwargs[k]" % arg )
252
- arg_checks .append (" continue" )
249
+ if len (arguments ):
250
+ arg_checks = ['for k in kwargs.keys():' ]
251
+ for arg in arguments :
252
+ arg_checks .append (" if k.lower() == '%s':" % arg .lower ())
253
+ arg_checks .append (" %s = kwargs[k]" % arg )
254
+ arg_checks .append (" continue" )
255
+ else :
256
+ arg_checks = []
253
257
254
258
# Full method source code
255
259
# Drops 'rc' and 'msg' from return values
256
260
code = (signature ,
257
261
type_string ,
258
262
' """Execute step %s of module %s."""' % (step , module ),
259
263
'\n ' .join ([' %s' % a for a in arg_checks ]),
260
- ' r = execute_module_step(module, step, {})' .format (
261
- ', ' .join (call_params )),
264
+ ' r = execute_module_step(%s)' % ', ' .join (['module' , 'step' ] + call_params ),
262
265
' r.pop("rc", None)' ,
263
266
' r.pop("msg", None)' ,
264
267
' if len(r) == 1:' ,
0 commit comments