@@ -45,9 +45,9 @@ class MatplotlibDeprecationWarning(UserWarning):
4545mplDeprecation = MatplotlibDeprecationWarning
4646
4747
48- def _generate_deprecation_message (
49- since , message = '' , name = '' , alternative = '' , pending = False ,
50- obj_type = 'attribute' ):
48+ def _generate_deprecation_message (since , message = '' , name = '' ,
49+ alternative = '' , pending = False ,
50+ obj_type = 'attribute' ):
5151
5252 if not message :
5353 altmessage = ''
@@ -464,9 +464,11 @@ class CallbackRegistry:
464464 """
465465 def __init__ (self , * args ):
466466 if len (args ):
467- warn_deprecated ('1.3' , message =
468- "CallbackRegistry no longer requires a list of callback "
469- "types. Ignoring arguments. *args will be removed in 1.5" )
467+ warn_deprecated (
468+ '1.3' ,
469+ message = "CallbackRegistry no longer requires a list of "
470+ "callback types. Ignoring arguments. *args will "
471+ "be removed in 1.5" )
470472 self .callbacks = dict ()
471473 self ._cid = 0
472474 self ._func_cid_map = {}
@@ -750,6 +752,16 @@ def is_scalar_or_string(val):
750752 return is_string_like (val ) or not iterable (val )
751753
752754
755+ def _string_to_bool (s ):
756+ if not is_string_like (s ):
757+ return s
758+ if s == 'on' :
759+ return True
760+ if s == 'off' :
761+ return False
762+ raise ValueError ("string argument must be either 'on' or 'off'" )
763+
764+
753765def get_sample_data (fname , asfileobj = True ):
754766 """
755767 Return a sample data file. *fname* is a path relative to the
@@ -1724,8 +1736,8 @@ def simple_linear_interpolation(a, steps):
17241736
17251737def recursive_remove (path ):
17261738 if os .path .isdir (path ):
1727- for fname in glob .glob (os .path .join (path , '*' )) + \
1728- glob .glob (os .path .join (path , '.*' )):
1739+ for fname in ( glob .glob (os .path .join (path , '*' )) +
1740+ glob .glob (os .path .join (path , '.*' ) )):
17291741 if os .path .isdir (fname ):
17301742 recursive_remove (fname )
17311743 os .removedirs (fname )
0 commit comments