|
157 | 157 | # cbook must import matplotlib only within function
|
158 | 158 | # definitions, so it is safe to import from it here.
|
159 | 159 | from . import _api, _version, cbook, _docstring, rcsetup
|
160 |
| -from matplotlib.cbook import sanitize_sequence |
161 | 160 | from matplotlib._api import MatplotlibDeprecationWarning
|
162 | 161 | from matplotlib.rcsetup import cycler # noqa: F401
|
163 |
| -from matplotlib.rcsetup import validate_backend |
164 | 162 |
|
165 | 163 |
|
166 | 164 | _log = logging.getLogger(__name__)
|
@@ -1258,7 +1256,7 @@ def use(backend, *, force=True):
|
1258 | 1256 | matplotlib.pyplot.switch_backend
|
1259 | 1257 |
|
1260 | 1258 | """
|
1261 |
| - name = validate_backend(backend) |
| 1259 | + name = rcsetup.validate_backend(backend) |
1262 | 1260 | # don't (prematurely) resolve the "auto" backend setting
|
1263 | 1261 | if rcParams._get_backend_or_none() == name:
|
1264 | 1262 | # Nothing to do if the requested backend is already set
|
@@ -1362,7 +1360,7 @@ def _replacer(data, value):
|
1362 | 1360 | except Exception:
|
1363 | 1361 | # key does not exist, silently fall back to key
|
1364 | 1362 | pass
|
1365 |
| - return sanitize_sequence(value) |
| 1363 | + return cbook.sanitize_sequence(value) |
1366 | 1364 |
|
1367 | 1365 |
|
1368 | 1366 | def _label_from_arg(y, default_name):
|
@@ -1494,8 +1492,8 @@ def inner(ax, *args, data=None, **kwargs):
|
1494 | 1492 | if data is None:
|
1495 | 1493 | return func(
|
1496 | 1494 | ax,
|
1497 |
| - *map(sanitize_sequence, args), |
1498 |
| - **{k: sanitize_sequence(v) for k, v in kwargs.items()}) |
| 1495 | + *map(cbook.sanitize_sequence, args), |
| 1496 | + **{k: cbook.sanitize_sequence(v) for k, v in kwargs.items()}) |
1499 | 1497 |
|
1500 | 1498 | bound = new_sig.bind(ax, *args, **kwargs)
|
1501 | 1499 | auto_label = (bound.arguments.get(label_namer)
|
@@ -1532,6 +1530,16 @@ def inner(ax, *args, data=None, **kwargs):
|
1532 | 1530 | _log.debug('platform is %s', sys.platform)
|
1533 | 1531 |
|
1534 | 1532 |
|
| 1533 | +@_api.deprecated("3.10", alternative="matplotlib.cbook.sanitize_sequence") |
| 1534 | +def sanitize_sequence(data): |
| 1535 | + return cbook.sanitize_sequence(data) |
| 1536 | + |
| 1537 | + |
| 1538 | +@_api.deprecated("3.10", alternative="matplotlib.rcsetup.validate_backend") |
| 1539 | +def validate_backend(s): |
| 1540 | + return rcsetup.validate_backend(s) |
| 1541 | + |
| 1542 | + |
1535 | 1543 | # workaround: we must defer colormaps import to after loading rcParams, because
|
1536 | 1544 | # colormap creation depends on rcParams
|
1537 | 1545 | from matplotlib.cm import _colormaps as colormaps # noqa: E402
|
|
0 commit comments