Remove redundant if check from optional argument function in argparse. (GH-8766)

This commit is contained in:
Shashank Parekh 2019-06-21 08:32:22 +05:30 committed by Benjamin Peterson
parent 1e61504b8b
commit b9600b0fbd
1 changed files with 2 additions and 4 deletions

View File

@ -1479,10 +1479,8 @@ class _ActionsContainer(object):
# strings starting with two prefix characters are long options
option_strings.append(option_string)
if option_string[0] in self.prefix_chars:
if len(option_string) > 1:
if option_string[1] in self.prefix_chars:
long_option_strings.append(option_string)
if len(option_string) > 1 and option_string[1] in self.prefix_chars:
long_option_strings.append(option_string)
# infer destination, '--foo-bar' -> 'foo_bar' and '-x' -> 'x'
dest = kwargs.pop('dest', None)