diff --git a/doc/api/next_api_changes/removals/24923-ES.rst b/doc/api/next_api_changes/removals/24923-ES.rst new file mode 100644 index 000000000000..fcab80e66e8d --- /dev/null +++ b/doc/api/next_api_changes/removals/24923-ES.rst @@ -0,0 +1,15 @@ +cbook removals +~~~~~~~~~~~~~~ + +- ``matplotlib.cbook.MatplotlibDeprecationWarning`` and + ``matplotlib.cbook.mplDeprecation`` are removed; use + `matplotlib.MatplotlibDeprecationWarning` instead. +- ``cbook.maxdict``; use the standard library ``functools.lru_cache`` instead. + +Groupers from ``get_shared_x_axes`` / ``get_shared_y_axes`` are immutable +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Modifications to the Groupers returned by ``get_shared_x_axes`` and +``get_shared_y_axes`` are no longer allowed. Note that previously, calling e.g. +``join()`` would already fail to set up the correct structures for sharing +axes; use `.Axes.sharex` or `.Axes.sharey` instead. diff --git a/lib/matplotlib/cbook/__init__.py b/lib/matplotlib/cbook.py similarity index 98% rename from lib/matplotlib/cbook/__init__.py rename to lib/matplotlib/cbook.py index 1e51f6a834cc..817034e2b042 100644 --- a/lib/matplotlib/cbook/__init__.py +++ b/lib/matplotlib/cbook.py @@ -30,19 +30,6 @@ from matplotlib import _api, _c_internal_utils -@_api.caching_module_getattr -class __getattr__: - # module-level deprecations - MatplotlibDeprecationWarning = _api.deprecated( - "3.6", obj_type="", - alternative="matplotlib.MatplotlibDeprecationWarning")( - property(lambda self: _api.deprecation.MatplotlibDeprecationWarning)) - mplDeprecation = _api.deprecated( - "3.6", obj_type="", - alternative="matplotlib.MatplotlibDeprecationWarning")( - property(lambda self: _api.deprecation.MatplotlibDeprecationWarning)) - - def _get_running_interactive_framework(): """ Return the interactive framework whose event loop is currently running, if @@ -578,27 +565,6 @@ def flatten(seq, scalarp=is_scalar_or_string): yield from flatten(item, scalarp) -@_api.deprecated("3.6", alternative="functools.lru_cache") -class maxdict(dict): - """ - A dictionary with a maximum size. - - Notes - ----- - This doesn't override all the relevant methods to constrain the size, - just ``__setitem__``, so use with caution. - """ - - def __init__(self, maxsize): - super().__init__() - self.maxsize = maxsize - - def __setitem__(self, k, v): - super().__setitem__(k, v) - while len(self) >= self.maxsize: - del self[next(iter(self))] - - class Stack: """ Stack of elements with a movable cursor. @@ -891,25 +857,17 @@ def __init__(self, grouper): self._grouper = grouper class _GrouperMethodForwarder: - def __init__(self, deprecated_kw=None): - self._deprecated_kw = deprecated_kw - def __set_name__(self, owner, name): wrapped = getattr(Grouper, name) forwarder = functools.wraps(wrapped)( lambda self, *args, **kwargs: wrapped( self._grouper, *args, **kwargs)) - if self._deprecated_kw: - forwarder = _api.deprecated(**self._deprecated_kw)(forwarder) setattr(owner, name, forwarder) __contains__ = _GrouperMethodForwarder() __iter__ = _GrouperMethodForwarder() joined = _GrouperMethodForwarder() get_siblings = _GrouperMethodForwarder() - clean = _GrouperMethodForwarder(deprecated_kw=dict(since="3.6")) - join = _GrouperMethodForwarder(deprecated_kw=dict(since="3.6")) - remove = _GrouperMethodForwarder(deprecated_kw=dict(since="3.6")) def simple_linear_interpolation(a, steps):