Skip to content

Commit a4d1f4e

Browse files
committed
Use cbook methods for string checking
1 parent e9f1d7b commit a4d1f4e

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

lib/matplotlib/_mathtext.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2766,7 +2766,7 @@ def _auto_sized_delimiter(self, front: str,
27662766
depth = max([x.depth for x in middle if not isinstance(x, str)])
27672767
factor = None
27682768
for idx, el in enumerate(middle):
2769-
if isinstance(el, str) and el == '\\middle':
2769+
if el == r'\middle':
27702770
c = T.cast(str, middle[idx + 1]) # Should be one of p.delims.
27712771
if c != '.':
27722772
middle[idx + 1] = AutoHeightChar(

lib/matplotlib/legend.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
import numpy as np
3030

3131
import matplotlib as mpl
32-
from matplotlib import _api, _docstring, colors, offsetbox
32+
from matplotlib import _api, _docstring, cbook, colors, offsetbox
3333
from matplotlib.artist import Artist, allow_rasterization
3434
from matplotlib.cbook import silent_list
3535
from matplotlib.font_manager import FontProperties
@@ -622,7 +622,7 @@ def __init__(
622622
break
623623
except AttributeError:
624624
pass
625-
elif isinstance(labelcolor, str) and labelcolor == 'none':
625+
elif cbook._str_equal(labelcolor, 'none'):
626626
for text in self.texts:
627627
text.set_color(labelcolor)
628628
elif np.iterable(labelcolor):

lib/matplotlib/rcsetup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ def _make_type_validator(cls, *, allow_none=False):
179179

180180
def validator(s):
181181
if (allow_none and
182-
(s is None or isinstance(s, str) and s.lower() == "none")):
182+
(s is None or cbook._str_lower_equal(s, "none"))):
183183
return None
184184
if cls is str and not isinstance(s, str):
185185
raise ValueError(f'Could not convert {s!r} to str')
@@ -615,7 +615,7 @@ def _validate_minor_tick_ndivs(n):
615615
two major ticks.
616616
"""
617617

618-
if isinstance(n, str) and n.lower() == 'auto':
618+
if cbook._str_lower_equal(n, 'auto'):
619619
return n
620620
try:
621621
n = _validate_int_greaterequal0(n)

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy