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

Skip to content

Commit 0e29b47

Browse files
committed
Rewrite an argument check to _check_getitem
1 parent 32231f2 commit 0e29b47

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

lib/matplotlib/axes/_base.py

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2858,14 +2858,8 @@ def ticklabel_format(self, *, axis='both', style='', scilimits=None,
28582858
m + n + 1 # check that both are numbers
28592859
except (ValueError, TypeError):
28602860
raise ValueError("scilimits must be a sequence of 2 integers")
2861-
if style[:3] == 'sci':
2862-
sb = True
2863-
elif style == 'plain':
2864-
sb = False
2865-
elif style == '':
2866-
sb = None
2867-
else:
2868-
raise ValueError("%s is not a valid style value")
2861+
STYLES = {'sci': True, 'scientific': True, 'plain': False, '': None}
2862+
sb = cbook._check_getitem(STYLES, style=style)
28692863
try:
28702864
if sb is not None:
28712865
if axis == 'both' or axis == 'x':

0 commit comments

Comments
 (0)