From 116c58708e342192670277bbf9dcf42216e05b19 Mon Sep 17 00:00:00 2001 From: Antony Lee Date: Wed, 27 Feb 2019 13:51:55 +0100 Subject: [PATCH] More use of cbook._check_in_list. --- lib/matplotlib/backend_bases.py | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/lib/matplotlib/backend_bases.py b/lib/matplotlib/backend_bases.py index 89587c7a483d..a2d76de1466f 100644 --- a/lib/matplotlib/backend_bases.py +++ b/lib/matplotlib/backend_bases.py @@ -876,10 +876,8 @@ def set_antialiased(self, b): def set_capstyle(self, cs): """Set the capstyle to be one of ('butt', 'round', 'projecting').""" - if cs in ('butt', 'round', 'projecting'): - self._capstyle = cs - else: - raise ValueError('Unrecognized cap style. Found %s' % cs) + cbook._check_in_list(['butt', 'round', 'projecting'], cs=cs) + self._capstyle = cs def set_clip_rectangle(self, rectangle): """ @@ -941,10 +939,8 @@ def set_foreground(self, fg, isRGBA=False): def set_joinstyle(self, js): """Set the join style to be one of ('miter', 'round', 'bevel').""" - if js in ('miter', 'round', 'bevel'): - self._joinstyle = js - else: - raise ValueError('Unrecognized join style. Found %s' % js) + cbook._check_in_list(['miter', 'round', 'bevel'], js=js) + self._joinstyle = js def set_linewidth(self, w): """Set the linewidth in points."""