Skip to content

Commit 0cee12b

Browse files
committed
Fix msmb bug: cmdline.py
action and type cannot be accepted at the same time
1 parent 069863a commit 0cee12b

File tree

1 file changed

+13
-12
lines changed

1 file changed

+13
-12
lines changed

msmbuilder/cmdline.py

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -367,19 +367,20 @@ def _register_arguments(cls, subparser):
367367
if 'bool' in typemap[arg]:
368368
kwargs['action'] = FlagAction
369369

370-
if hasattr(cls, '_{}_type'.format(arg)):
371-
# If the docstring *contains* the word float or int,
372-
# parsing will fail for things not of that type
373-
# even if a custom loader will eventually be used.
374-
# Let's check for custom loaders here and set the type
375-
# to str.
376-
kwargs['type'] = str
377370
else:
378-
basic_types = {'str': str, 'float': float, 'int': int}
379-
for basic_type in basic_types:
380-
if basic_type in typemap[arg]:
381-
kwargs['type'] = basic_types[basic_type]
382-
break
371+
if hasattr(cls, '_{}_type'.format(arg)):
372+
# If the docstring *contains* the word float or int,
373+
# parsing will fail for things not of that type
374+
# even if a custom loader will eventually be used.
375+
# Let's check for custom loaders here and set the type
376+
# to str.
377+
kwargs['type'] = str
378+
else:
379+
basic_types = {'str': str, 'float': float, 'int': int}
380+
for basic_type in basic_types:
381+
if basic_type in typemap[arg]:
382+
kwargs['type'] = basic_types[basic_type]
383+
break
383384

384385
group.add_argument('--{}'.format(arg), **kwargs)
385386

0 commit comments

Comments
 (0)