|
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__)
|
@@ -1236,7 +1234,7 @@ def use(backend, *, force=True):
|
1236 | 1234 | matplotlib.pyplot.switch_backend
|
1237 | 1235 |
|
1238 | 1236 | """
|
1239 |
| - name = validate_backend(backend) |
| 1237 | + name = rcsetup.validate_backend(backend) |
1240 | 1238 | # don't (prematurely) resolve the "auto" backend setting
|
1241 | 1239 | if rcParams._get_backend_or_none() == name:
|
1242 | 1240 | # Nothing to do if the requested backend is already set
|
@@ -1340,7 +1338,7 @@ def _replacer(data, value):
|
1340 | 1338 | except Exception:
|
1341 | 1339 | # key does not exist, silently fall back to key
|
1342 | 1340 | pass
|
1343 |
| - return sanitize_sequence(value) |
| 1341 | + return cbook.sanitize_sequence(value) |
1344 | 1342 |
|
1345 | 1343 |
|
1346 | 1344 | def _label_from_arg(y, default_name):
|
@@ -1472,8 +1470,8 @@ def inner(ax, *args, data=None, **kwargs):
|
1472 | 1470 | if data is None:
|
1473 | 1471 | return func(
|
1474 | 1472 | ax,
|
1475 |
| - *map(sanitize_sequence, args), |
1476 |
| - **{k: sanitize_sequence(v) for k, v in kwargs.items()}) |
| 1473 | + *map(cbook.sanitize_sequence, args), |
| 1474 | + **{k: cbook.sanitize_sequence(v) for k, v in kwargs.items()}) |
1477 | 1475 |
|
1478 | 1476 | bound = new_sig.bind(ax, *args, **kwargs)
|
1479 | 1477 | auto_label = (bound.arguments.get(label_namer)
|
@@ -1510,6 +1508,16 @@ def inner(ax, *args, data=None, **kwargs):
|
1510 | 1508 | _log.debug('platform is %s', sys.platform)
|
1511 | 1509 |
|
1512 | 1510 |
|
| 1511 | +@_api.deprecated("3.10", alternative="matplotlib.cbook.sanitize_sequence") |
| 1512 | +def sanitize_sequence(data): |
| 1513 | + return cbook.sanitize_sequence(data) |
| 1514 | + |
| 1515 | + |
| 1516 | +@_api.deprecated("3.10", alternative="matplotlib.rcsetup.validate_backend") |
| 1517 | +def validate_backend(s): |
| 1518 | + return rcsetup.validate_backend(s) |
| 1519 | + |
| 1520 | + |
1513 | 1521 | # workaround: we must defer colormaps import to after loading rcParams, because
|
1514 | 1522 | # colormap creation depends on rcParams
|
1515 | 1523 | from matplotlib.cm import _colormaps as colormaps # noqa: E402
|
|
0 commit comments