Skip to content

Commit 18f493a

Browse files
authored
Merge pull request #24923 from QuLogic/clean-cbook
Cleanup cbook deprecations and layout
2 parents e147ff1 + 6731a00 commit 18f493a

File tree

2 files changed

+15
-42
lines changed

2 files changed

+15
-42
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
cbook removals
2+
~~~~~~~~~~~~~~
3+
4+
- ``matplotlib.cbook.MatplotlibDeprecationWarning`` and
5+
``matplotlib.cbook.mplDeprecation`` are removed; use
6+
`matplotlib.MatplotlibDeprecationWarning` instead.
7+
- ``cbook.maxdict``; use the standard library ``functools.lru_cache`` instead.
8+
9+
Groupers from ``get_shared_x_axes`` / ``get_shared_y_axes`` are immutable
10+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
11+
12+
Modifications to the Groupers returned by ``get_shared_x_axes`` and
13+
``get_shared_y_axes`` are no longer allowed. Note that previously, calling e.g.
14+
``join()`` would already fail to set up the correct structures for sharing
15+
axes; use `.Axes.sharex` or `.Axes.sharey` instead.

lib/matplotlib/cbook/__init__.py renamed to lib/matplotlib/cbook.py

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -30,19 +30,6 @@
3030
from matplotlib import _api, _c_internal_utils
3131

3232

33-
@_api.caching_module_getattr
34-
class __getattr__:
35-
# module-level deprecations
36-
MatplotlibDeprecationWarning = _api.deprecated(
37-
"3.6", obj_type="",
38-
alternative="matplotlib.MatplotlibDeprecationWarning")(
39-
property(lambda self: _api.deprecation.MatplotlibDeprecationWarning))
40-
mplDeprecation = _api.deprecated(
41-
"3.6", obj_type="",
42-
alternative="matplotlib.MatplotlibDeprecationWarning")(
43-
property(lambda self: _api.deprecation.MatplotlibDeprecationWarning))
44-
45-
4633
def _get_running_interactive_framework():
4734
"""
4835
Return the interactive framework whose event loop is currently running, if
@@ -578,27 +565,6 @@ def flatten(seq, scalarp=is_scalar_or_string):
578565
yield from flatten(item, scalarp)
579566

580567

581-
@_api.deprecated("3.6", alternative="functools.lru_cache")
582-
class maxdict(dict):
583-
"""
584-
A dictionary with a maximum size.
585-
586-
Notes
587-
-----
588-
This doesn't override all the relevant methods to constrain the size,
589-
just ``__setitem__``, so use with caution.
590-
"""
591-
592-
def __init__(self, maxsize):
593-
super().__init__()
594-
self.maxsize = maxsize
595-
596-
def __setitem__(self, k, v):
597-
super().__setitem__(k, v)
598-
while len(self) >= self.maxsize:
599-
del self[next(iter(self))]
600-
601-
602568
class Stack:
603569
"""
604570
Stack of elements with a movable cursor.
@@ -891,25 +857,17 @@ def __init__(self, grouper):
891857
self._grouper = grouper
892858

893859
class _GrouperMethodForwarder:
894-
def __init__(self, deprecated_kw=None):
895-
self._deprecated_kw = deprecated_kw
896-
897860
def __set_name__(self, owner, name):
898861
wrapped = getattr(Grouper, name)
899862
forwarder = functools.wraps(wrapped)(
900863
lambda self, *args, **kwargs: wrapped(
901864
self._grouper, *args, **kwargs))
902-
if self._deprecated_kw:
903-
forwarder = _api.deprecated(**self._deprecated_kw)(forwarder)
904865
setattr(owner, name, forwarder)
905866

906867
__contains__ = _GrouperMethodForwarder()
907868
__iter__ = _GrouperMethodForwarder()
908869
joined = _GrouperMethodForwarder()
909870
get_siblings = _GrouperMethodForwarder()
910-
clean = _GrouperMethodForwarder(deprecated_kw=dict(since="3.6"))
911-
join = _GrouperMethodForwarder(deprecated_kw=dict(since="3.6"))
912-
remove = _GrouperMethodForwarder(deprecated_kw=dict(since="3.6"))
913871

914872

915873
def simple_linear_interpolation(a, steps):

0 commit comments

Comments
 (0)