Skip to content

Commit

Permalink
Merge pull request #1533 from parichit/docstring_param_mismatch_message
Browse files Browse the repository at this point in the history
Show message if number of arguments mismatch between the doc string and the run method.
  • Loading branch information
skoudoro committed Jul 9, 2018
2 parents e17a7ea + 357a792 commit 3ef405c
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions dipy/workflows/base.py
Expand Up @@ -101,19 +101,25 @@ def add_workflow(self, workflow):
ref_text = [text if text else "\n" for text in npds['References']]
ref_idx = self.epilog.find('References: \n') + len('References: \n')
self.epilog = "{0}{1}\n{2}".format(self.epilog[:ref_idx],
''.join([text for text in ref_text]),
''.join(ref_text),
self.epilog[ref_idx:])

self.outputs = [param for param in npds['Parameters'] if
'out_' in param[0]]

args, defaults = get_args_default(workflow.run)

output_args = self.add_argument_group('output arguments(optional)')

len_args = len(args)
len_defaults = len(defaults)

output_args = \
self.add_argument_group('output arguments(optional)')
if len_args != len(self.doc):
raise ValueError(
self.prog + ": Number of parameters in the "
"doc string and run method does not match. "
"Please ensure that the number of parameters "
"in the run method is same as the doc string.")

for i, arg in enumerate(args):
prefix = ''
Expand Down

0 comments on commit 3ef405c

Please sign in to comment.