@@ -45,9 +45,9 @@ class MatplotlibDeprecationWarning(UserWarning):
45
45
mplDeprecation = MatplotlibDeprecationWarning
46
46
47
47
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' ):
51
51
52
52
if not message :
53
53
altmessage = ''
@@ -464,9 +464,11 @@ class CallbackRegistry:
464
464
"""
465
465
def __init__ (self , * args ):
466
466
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" )
470
472
self .callbacks = dict ()
471
473
self ._cid = 0
472
474
self ._func_cid_map = {}
@@ -750,6 +752,16 @@ def is_scalar_or_string(val):
750
752
return is_string_like (val ) or not iterable (val )
751
753
752
754
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
+
753
765
def get_sample_data (fname , asfileobj = True ):
754
766
"""
755
767
Return a sample data file. *fname* is a path relative to the
@@ -1724,8 +1736,8 @@ def simple_linear_interpolation(a, steps):
1724
1736
1725
1737
def recursive_remove (path ):
1726
1738
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 , '.*' ) )):
1729
1741
if os .path .isdir (fname ):
1730
1742
recursive_remove (fname )
1731
1743
os .removedirs (fname )
0 commit comments