Skip to content

Commit 3483acf

Browse files
committed
MNT: Deprecate reimported functions in top-level namespace
1 parent 7a2ea1c commit 3483acf

File tree

2 files changed

+21
-3
lines changed

2 files changed

+21
-3
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
matplotlib.validate_backend
2+
~~~~~~~~~~~~~~~~~~~~~~~~~~~
3+
4+
...is deprecated. Please use `matplotlib.rcsetup.validate_backend` instead.
5+
6+
7+
matplotlib.sanitize_sequence
8+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
9+
10+
...is deprecated. Please use `matplotlib.cbook.sanitize_sequence` instead.

lib/matplotlib/__init__.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -157,10 +157,8 @@
157157
# cbook must import matplotlib only within function
158158
# definitions, so it is safe to import from it here.
159159
from . import _api, _version, cbook, _docstring, rcsetup
160-
from matplotlib.cbook import sanitize_sequence
161160
from matplotlib._api import MatplotlibDeprecationWarning
162161
from matplotlib.rcsetup import cycler # noqa: F401
163-
from matplotlib.rcsetup import validate_backend
164162

165163

166164
_log = logging.getLogger(__name__)
@@ -1236,7 +1234,7 @@ def use(backend, *, force=True):
12361234
matplotlib.pyplot.switch_backend
12371235
12381236
"""
1239-
name = validate_backend(backend)
1237+
name = rcsetup.validate_backend(backend)
12401238
# don't (prematurely) resolve the "auto" backend setting
12411239
if rcParams._get_backend_or_none() == name:
12421240
# Nothing to do if the requested backend is already set
@@ -1510,6 +1508,16 @@ def inner(ax, *args, data=None, **kwargs):
15101508
_log.debug('platform is %s', sys.platform)
15111509

15121510

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+
15131521
# workaround: we must defer colormaps import to after loading rcParams, because
15141522
# colormap creation depends on rcParams
15151523
from matplotlib.cm import _colormaps as colormaps # noqa: E402

0 commit comments

Comments
 (0)