summaryrefslogtreecommitdiff
path: root/cmd2/pyscript_bridge.py
diff options
context:
space:
mode:
authorTodd Leonhardt <todd.leonhardt@gmail.com>2018-10-06 18:19:48 -0400
committerTodd Leonhardt <todd.leonhardt@gmail.com>2018-10-06 18:19:48 -0400
commit5fbbc53939b5cf48894e6853852211ec036c7e02 (patch)
tree998d701ef0202f367144e5098ce6ed099b719a3c /cmd2/pyscript_bridge.py
parentfb575e41251156a90044055e8a352079e4f75866 (diff)
downloadcmd2-git-5fbbc53939b5cf48894e6853852211ec036c7e02.tar.gz
Fixed unit test failures and addressed code review comments
Diffstat (limited to 'cmd2/pyscript_bridge.py')
-rw-r--r--cmd2/pyscript_bridge.py11
1 files changed, 6 insertions, 5 deletions
diff --git a/cmd2/pyscript_bridge.py b/cmd2/pyscript_bridge.py
index 8187d7fd..5f5c3542 100644
--- a/cmd2/pyscript_bridge.py
+++ b/cmd2/pyscript_bridge.py
@@ -232,8 +232,8 @@ class ArgparseFunctor:
# If this is a flag parameter that can accept a variable number of arguments and we have not
# reached the max number, add a list completion suffix to tell argparse to move to the next
# parameter
- if action.option_strings and isinstance(action, _RangeAction) \
- and action.nargs_max > len(value):
+ if action.option_strings and isinstance(action, _RangeAction) and action.nargs_max is not None and \
+ action.nargs_max > len(value):
cmd_str[0] += '{0}{0} '.format(self._parser.prefix_chars[0])
else:
@@ -245,8 +245,8 @@ class ArgparseFunctor:
# If this is a flag parameter that can accept a variable number of arguments and we have not
# reached the max number, add a list completion suffix to tell argparse to move to the next
# parameter
- if action.option_strings and isinstance(action, _RangeAction) \
- and action.nargs_max > 1:
+ if action.option_strings and isinstance(action, _RangeAction) and action.nargs_max is not None and \
+ action.nargs_max > 1:
cmd_str[0] += '{0}{0} '.format(self._parser.prefix_chars[0])
def process_action(action):
@@ -269,7 +269,8 @@ class ArgparseFunctor:
process_action(action)
# next process positional arguments
for action in parser._actions:
- if action.dest in self._args and action.dest not in self._flag_args and action.dest != self._remainder_arg:
+ if action.dest in self._args and action.dest not in self._flag_args and \
+ action.dest != self._remainder_arg:
process_action(action)
# Keep remainder argument last
for action in parser._actions: