GH-124693: Support parsing negative scientific and complex numbers argparse (GH-124823)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
This commit is contained in:
Savannah Ostrowski 2024-10-09 15:56:50 -06:00 committed by GitHub
parent 52f70da19c
commit 0c5a48c1c9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 22 additions and 8 deletions

View file

@ -1367,7 +1367,7 @@ class _ActionsContainer(object):
self._defaults = {}
# determines whether an "option" looks like a negative number
self._negative_number_matcher = _re.compile(r'^-(?:\d+(?:_\d+)*(?:\.\d+(?:_\d+)*)?|\.\d+(?:_\d+)*)$')
self._negative_number_matcher = _re.compile(r'-\.?\d')
# whether or not there are any optionals that look like negative
# numbers -- uses a list so it can be shared and edited