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

Skip to content

Commit 017a88f

Browse files
committed
remove type checking for strings in '_validate_linestyle'
1 parent 1182770 commit 017a88f

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

lib/matplotlib/rcsetup.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -910,9 +910,13 @@ def _validate_linestyle(ls):
910910
A validator for all possible line styles, the named ones *and*
911911
the on-off ink sequences.
912912
"""
913-
# Named line style, like u'--' or u'solid'
914-
if isinstance(ls, six.text_type):
913+
# Look first for a valid named line style, like '--' or 'solid'
914+
try:
915915
return _validate_named_linestyle(ls)
916+
except (KeyError, AttributeError):
917+
# AttributeError may be raised by ls.lower() that can be called
918+
# inside _validate_named_linestyle.
919+
pass
916920

917921
# On-off ink (in points) sequence *of even length*.
918922
# Offset is set to None.
@@ -926,7 +930,7 @@ def _validate_linestyle(ls):
926930
# (called inside the instance of validate_nseq_float).
927931
pass
928932

929-
raise ValueError("linestyle must be a string or " +
933+
raise ValueError("linestyle must be a valid string or " +
930934
"an even-length sequence of floats.")
931935

932936

0 commit comments

Comments
 (0)