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

Skip to content

Commit d58a84a

Browse files
author
Marek Rudnicki
committed
validate_color can accept and return None
1 parent bd6cf8e commit d58a84a

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

lib/matplotlib/rcsetup.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -227,16 +227,16 @@ def __call__(self, s):
227227

228228
def validate_color(s):
229229
'return a valid color arg'
230-
try:
231-
if s.lower() == 'none':
232-
return 'None'
233-
except AttributeError:
234-
pass
230+
if s in (None, 'none', 'None'):
231+
return None
232+
235233
if is_color_like(s):
236234
return s
235+
237236
stmp = '#' + s
238237
if is_color_like(stmp):
239238
return stmp
239+
240240
# If it is still valid, it must be a tuple.
241241
colorarg = s
242242
msg = ''

0 commit comments

Comments
 (0)