@@ -2435,6 +2435,9 @@ def py_arg_names(self):
24352435 @property
24362436 def additional_args (self ):
24372437 return self ._additional_args
2438+
2439+ def remove_last_arg (self ):
2440+ self ._arguments .pop ()
24382441
24392442
24402443class XMLCommand (Element ):
@@ -2513,6 +2516,10 @@ def arg_desc(self) -> List[Argument]:
25132516 arg_file = Path ("args.txt" )
25142517
25152518 if arguments is not None :
2519+ # Remove last argument if it's empty
2520+ while arguments .py_arg_names [- 1 ] == "" :
2521+ arguments .remove_last_arg ()
2522+
25162523 if len (arguments .py_arg_names ) != len (arguments .initial_args ):
25172524 # This function needs a special treatment
25182525 if arg_file .exists ():
@@ -2979,9 +2986,6 @@ def py_source(self, custom_functions=None, indent=""):
29792986 command += arg .py_arg_name
29802987 command += "}"
29812988 command += '"\n '
2982- while command != command .replace (',"' , '"' ): # remove extra commas at the end of the command
2983- command = command .replace (',"' , '"' )
2984- # ",{" + "},{".join(self.arg_desc.py_arg_name) + '}"\n'
29852989 else :
29862990 command = 'command = f"' + self .name + '"\n '
29872991 return_command = "return self.run(command, **kwargs)\n "
0 commit comments