diff options
author | Kevin Van Brunt <kmvanbrunt@gmail.com> | 2019-07-11 23:20:53 -0400 |
---|---|---|
committer | Kevin Van Brunt <kmvanbrunt@gmail.com> | 2019-07-11 23:20:53 -0400 |
commit | 5546bd8d72d67c6a605f19e427deb137443097af (patch) | |
tree | f77a593f00ca1903b0e9b05d39677ad8bfbbc9be /cmd2/argparse_custom.py | |
parent | 2a1f548f7d078d01028e022d13aef196dbe500ce (diff) | |
download | cmd2-git-5546bd8d72d67c6a605f19e427deb137443097af.tar.gz |
Changed how re is being imported
Diffstat (limited to 'cmd2/argparse_custom.py')
-rw-r--r-- | cmd2/argparse_custom.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/cmd2/argparse_custom.py b/cmd2/argparse_custom.py index dbe12d93..43099823 100644 --- a/cmd2/argparse_custom.py +++ b/cmd2/argparse_custom.py @@ -140,7 +140,7 @@ argparse.ArgumentParser._match_argument - adds support to for nargs ranges """ import argparse -import re as _re +import re import sys # noinspection PyUnresolvedReferences,PyProtectedMember @@ -369,7 +369,7 @@ orig_argument_parser_match_argument = argparse.ArgumentParser._match_argument def _match_argument_wrapper(self, action, arg_strings_pattern) -> int: # Wrapper around ArgumentParser._match_argument behavior to support nargs ranges nargs_pattern = self._get_nargs_pattern(action) - match = _re.match(nargs_pattern, arg_strings_pattern) + match = re.match(nargs_pattern, arg_strings_pattern) # raise an exception if we weren't able to find a match if match is None: @@ -444,9 +444,9 @@ class Cmd2HelpFormatter(argparse.RawTextHelpFormatter): req_usage = format(required_options, groups) opt_usage = format(optionals, groups) pos_usage = format(positionals, groups) - req_parts = _re.findall(part_regexp, req_usage) - opt_parts = _re.findall(part_regexp, opt_usage) - pos_parts = _re.findall(part_regexp, pos_usage) + req_parts = re.findall(part_regexp, req_usage) + opt_parts = re.findall(part_regexp, opt_usage) + pos_parts = re.findall(part_regexp, pos_usage) assert ' '.join(req_parts) == req_usage assert ' '.join(opt_parts) == opt_usage assert ' '.join(pos_parts) == pos_usage |