Skip to content

Commit 511232b

Browse files
committed
remove redundant string handling
1 parent c069b30 commit 511232b

File tree

1 file changed

+7
-12
lines changed

1 file changed

+7
-12
lines changed

lib/matplotlib/collections.py

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -608,18 +608,13 @@ def set_linestyle(self, ls):
608608
complete description.
609609
"""
610610
try:
611-
if isinstance(ls, str):
612-
ls = cbook.ls_mapper.get(ls, ls)
613-
dashes = [mlines._get_dash_pattern(ls)]
614-
else:
615-
try:
616-
dashes = [mlines._get_dash_pattern(ls)]
617-
except ValueError:
618-
dashes = [mlines._get_dash_pattern(x) for x in ls]
619-
620-
except ValueError as err:
621-
raise ValueError('Do not know how to convert {!r} to '
622-
'dashes'.format(ls)) from err
611+
dashes = [mlines._get_dash_pattern(ls)]
612+
except ValueError:
613+
try:
614+
dashes = [mlines._get_dash_pattern(x) for x in ls]
615+
except ValueError as err:
616+
raise ValueError('Do not know how to convert {!r} to '
617+
'dashes'.format(ls)) from err
623618

624619
# get the list of raw 'unscaled' dash patterns
625620
self._us_linestyles = dashes

0 commit comments

Comments
 (0)