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

Skip to content

Commit cda758d

Browse files
committed
merged unicode solution
2 parents 09bf2dd + aede120 commit cda758d

1 file changed

Lines changed: 11 additions & 11 deletions

File tree

lib/matplotlib/rcsetup.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ def validate_path_exists(s):
7171

7272
def validate_bool(b):
7373
"""Convert b to a boolean or raise"""
74-
if type(b) is str:
74+
if isinstance(b, basestring):
7575
b = b.lower()
7676
if b in ('t', 'y', 'yes', 'on', 'true', '1', 1, True):
7777
return True
@@ -82,8 +82,8 @@ def validate_bool(b):
8282

8383

8484
def validate_bool_maybe_none(b):
85-
'Convert b to a boolean or raise'
86-
if type(b) is str:
85+
"""Convert b to a boolean, None, or raise"""
86+
if isinstance(b, basestring):
8787
b = b.lower()
8888
if b == 'none':
8989
return None
@@ -177,7 +177,7 @@ def __init__(self, n):
177177

178178
def __call__(self, s):
179179
"""return a seq of n floats or raise"""
180-
if type(s) is str:
180+
if isinstance(s, basestring):
181181
ss = s.split(',')
182182
if len(ss) != self.n:
183183
raise ValueError(
@@ -200,7 +200,7 @@ def __init__(self, n):
200200

201201
def __call__(self, s):
202202
"""return a seq of n ints or raise"""
203-
if type(s) is str:
203+
if isinstance(s, basestring):
204204
ss = s.split(',')
205205
if len(ss) != self.n:
206206
raise ValueError(
@@ -252,7 +252,7 @@ def validate_color(s):
252252

253253
def validate_colorlist(s):
254254
'return a list of colorspecs'
255-
if type(s) is str:
255+
if isinstance(s, basestring):
256256
return [validate_color(c.strip()) for c in s.split(',')]
257257
else:
258258
assert type(s) in [list, tuple]
@@ -266,9 +266,9 @@ def validate_string(s):
266266

267267
def validate_stringlist(s):
268268
'return a list'
269-
if type(s) in (str, unicode):
269+
if isinstance(s, basestring):
270270
return [validate_string(v) for v in s.split(',')]
271-
else:
271+
else :
272272
assert type(s) in [list, tuple]
273273
return [str(v) for v in s]
274274

@@ -287,7 +287,7 @@ def validate_aspect(s):
287287

288288

289289
def validate_fontsize(s):
290-
if type(s) is str:
290+
if isinstance(s, basestring):
291291
s = s.lower()
292292
if s in ['xx-small', 'x-small', 'small', 'medium', 'large', 'x-large',
293293
'xx-large', 'smaller', 'larger']:
@@ -340,7 +340,7 @@ def update_savefig_format(value):
340340

341341

342342
def validate_ps_distiller(s):
343-
if type(s) is str:
343+
if isinstance(s, basestring):
344344
s = s.lower()
345345

346346
if s in ('none', None):
@@ -429,7 +429,7 @@ def validate_hinting(s):
429429

430430

431431
def validate_bbox(s):
432-
if type(s) is str:
432+
if isinstance(s, basestring):
433433
s = s.lower()
434434
if s == 'tight':
435435
return s

0 commit comments

Comments
 (0)