-
-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Closed
Milestone
Description
rcsetup.validate_bool_maybe_none(None) raise a ValueError. This is relevant when you deepcopy a rcParam structure or add all key,values of an old rcParam to a new rcParam. This problem showed up in the theme development of ggplot.
The function could be changed to:
def validate_bool_maybe_none(b):
'Convert b to a boolean or raise'
if type(b) is str:
b = b.lower()
if b is None or b == 'none':
return None
if b in ('t', 'y', 'yes', 'on', 'true', '1', 1, True):
return True
elif b in ('f', 'n', 'no', 'off', 'false', '0', 0, False):
return False
else:
raise ValueError('Could not convert "%s" to boolean' % b)Metadata
Metadata
Assignees
Labels
No labels