Merge branch 'master' into 'master'

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

Closes #452

See merge request pycqa/flake8!261
This commit is contained in:
Ian Stapleton Cordasco 2019-01-17 13:50:50 +00:00
commit 0f3f4ff9b4
2 changed files with 14 additions and 0 deletions

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"):