Add support for optparse's 'float' and 'complex' types.

This helps normalize_from_setuptools, to handle all
optparse's standard-option-types.

Fixes #452
This commit is contained in:
ymdatta 2018-10-28 17:21:39 +05:30
parent 4773995430
commit 6341d1382e

View file

@ -156,6 +156,10 @@ class Option(object):
value = self.normalize(value)
if self.type == "int" or self.action == "count":
return int(value)
elif self.type == "float":
return float(value)
elif self.type == "complex":
return complex(value)
if self.action in ("store_true", "store_false"):
value = str(value).upper()
if value in ("1", "T", "TRUE", "ON"):