Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit cfd6374

Browse files
committed
Added support of 'true' and 'false' to cbook._string_to_bool
1 parent 78e44a6 commit cfd6374

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

lib/matplotlib/cbook.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -788,11 +788,12 @@ def _string_to_bool(s):
788788
"""Parses the string argument as a boolean"""
789789
if not is_string_like(s):
790790
return bool(s)
791-
if s.lower() == 'on':
791+
if s.lower() in ['on', 'true']:
792792
return True
793-
if s.lower() == 'off':
793+
if s.lower() in ['off', 'false']:
794794
return False
795-
raise ValueError('String "%s" must be either "on" or "off"' % s)
795+
raise ValueError('String "%s" must be one of: '
796+
'"on", "off", "true", or "false"' % s)
796797

797798

798799
def get_sample_data(fname, asfileobj=True):

0 commit comments

Comments
 (0)