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

Skip to content

Commit 116c587

Browse files
committed
More use of cbook._check_in_list.
1 parent 85eb5eb commit 116c587

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

lib/matplotlib/backend_bases.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -876,10 +876,8 @@ def set_antialiased(self, b):
876876

877877
def set_capstyle(self, cs):
878878
"""Set the capstyle to be one of ('butt', 'round', 'projecting')."""
879-
if cs in ('butt', 'round', 'projecting'):
880-
self._capstyle = cs
881-
else:
882-
raise ValueError('Unrecognized cap style. Found %s' % cs)
879+
cbook._check_in_list(['butt', 'round', 'projecting'], cs=cs)
880+
self._capstyle = cs
883881

884882
def set_clip_rectangle(self, rectangle):
885883
"""
@@ -941,10 +939,8 @@ def set_foreground(self, fg, isRGBA=False):
941939

942940
def set_joinstyle(self, js):
943941
"""Set the join style to be one of ('miter', 'round', 'bevel')."""
944-
if js in ('miter', 'round', 'bevel'):
945-
self._joinstyle = js
946-
else:
947-
raise ValueError('Unrecognized join style. Found %s' % js)
942+
cbook._check_in_list(['miter', 'round', 'bevel'], js=js)
943+
self._joinstyle = js
948944

949945
def set_linewidth(self, w):
950946
"""Set the linewidth in points."""

0 commit comments

Comments
 (0)