From f9d4ed29996d9300b7fa08a5add27aadd97eba05 Mon Sep 17 00:00:00 2001 From: Oscar Gustafsson Date: Sun, 18 May 2025 12:06:40 +0200 Subject: [PATCH] Remove deprecations: is_bbox and more --- .../next_api_changes/removals/30067-OG.rst | 23 +++++++++++++++ lib/matplotlib/backend_bases.py | 15 ++-------- lib/matplotlib/backend_bases.pyi | 2 +- lib/matplotlib/rcsetup.py | 28 +------------------ lib/matplotlib/rcsetup.pyi | 3 -- lib/matplotlib/tests/test_backend_registry.py | 11 -------- lib/matplotlib/transforms.py | 23 --------------- lib/matplotlib/transforms.pyi | 4 --- 8 files changed, 27 insertions(+), 82 deletions(-) create mode 100644 doc/api/next_api_changes/removals/30067-OG.rst diff --git a/doc/api/next_api_changes/removals/30067-OG.rst b/doc/api/next_api_changes/removals/30067-OG.rst new file mode 100644 index 000000000000..1a8d8bc5c2c5 --- /dev/null +++ b/doc/api/next_api_changes/removals/30067-OG.rst @@ -0,0 +1,23 @@ +``TransformNode.is_bbox`` +^^^^^^^^^^^^^^^^^^^^^^^^^ + +... is removed. Instead check the object using ``isinstance(..., BboxBase)``. + +``rcsetup.interactive_bk``, ``rcsetup.non_interactive_bk`` and ``rcsetup.all_backends`` +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +... are removed and replaced by ``matplotlib.backends.backend_registry.list_builtin`` +with the following arguments + +- ``matplotlib.backends.BackendFilter.INTERACTIVE`` +- ``matplotlib.backends.BackendFilter.NON_INTERACTIVE`` +- ``None`` + +``BboxTransformToMaxOnly`` +^^^^^^^^^^^^^^^^^^^^^^^^^^ + +... is removed. It can be replaced by ``BboxTransformTo(LockableBbox(bbox, x0=0, y0=0))``. + +*interval* parameter of ``TimerBase.start`` +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +The timer interval parameter can no longer be set while starting it. The interval can be specified instead in the timer constructor, or by setting the timer.interval attribute. diff --git a/lib/matplotlib/backend_bases.py b/lib/matplotlib/backend_bases.py index 1992cc90ca26..527d8c010710 100644 --- a/lib/matplotlib/backend_bases.py +++ b/lib/matplotlib/backend_bases.py @@ -1067,19 +1067,8 @@ def __del__(self): """Need to stop timer and possibly disconnect timer.""" self._timer_stop() - @_api.delete_parameter("3.9", "interval", alternative="timer.interval") - def start(self, interval=None): - """ - Start the timer object. - - Parameters - ---------- - interval : int, optional - Timer interval in milliseconds; overrides a previously set interval - if provided. - """ - if interval is not None: - self.interval = interval + def start(self): + """Start the timer.""" self._timer_start() def stop(self): diff --git a/lib/matplotlib/backend_bases.pyi b/lib/matplotlib/backend_bases.pyi index 0603988399f1..24669bfb3aeb 100644 --- a/lib/matplotlib/backend_bases.pyi +++ b/lib/matplotlib/backend_bases.pyi @@ -186,7 +186,7 @@ class TimerBase: callbacks: list[tuple[Callable, tuple, dict[str, Any]]] | None = ..., ) -> None: ... def __del__(self) -> None: ... - def start(self, interval: int | None = ...) -> None: ... + def start(self) -> None: ... def stop(self) -> None: ... @property def interval(self) -> int: ... diff --git a/lib/matplotlib/rcsetup.py b/lib/matplotlib/rcsetup.py index ce29c5076100..02e3601ff4c2 100644 --- a/lib/matplotlib/rcsetup.py +++ b/lib/matplotlib/rcsetup.py @@ -24,7 +24,7 @@ import matplotlib as mpl from matplotlib import _api, cbook -from matplotlib.backends import BackendFilter, backend_registry +from matplotlib.backends import backend_registry from matplotlib.cbook import ls_mapper from matplotlib.colors import Colormap, is_color_like from matplotlib._fontconfig_pattern import parse_fontconfig_pattern @@ -34,32 +34,6 @@ from cycler import Cycler, cycler as ccycler -@_api.caching_module_getattr -class __getattr__: - @_api.deprecated( - "3.9", - alternative="``matplotlib.backends.backend_registry.list_builtin" - "(matplotlib.backends.BackendFilter.INTERACTIVE)``") - @property - def interactive_bk(self): - return backend_registry.list_builtin(BackendFilter.INTERACTIVE) - - @_api.deprecated( - "3.9", - alternative="``matplotlib.backends.backend_registry.list_builtin" - "(matplotlib.backends.BackendFilter.NON_INTERACTIVE)``") - @property - def non_interactive_bk(self): - return backend_registry.list_builtin(BackendFilter.NON_INTERACTIVE) - - @_api.deprecated( - "3.9", - alternative="``matplotlib.backends.backend_registry.list_builtin()``") - @property - def all_backends(self): - return backend_registry.list_builtin() - - class ValidateInStrings: def __init__(self, key, valid, ignorecase=False, *, _deprecated_since=None): diff --git a/lib/matplotlib/rcsetup.pyi b/lib/matplotlib/rcsetup.pyi index 79538511c0e4..eb1d7c9f3a33 100644 --- a/lib/matplotlib/rcsetup.pyi +++ b/lib/matplotlib/rcsetup.pyi @@ -4,9 +4,6 @@ from collections.abc import Callable, Iterable from typing import Any, Literal, TypeVar from matplotlib.typing import ColorType, LineStyleType, MarkEveryType -interactive_bk: list[str] -non_interactive_bk: list[str] -all_backends: list[str] _T = TypeVar("_T") diff --git a/lib/matplotlib/tests/test_backend_registry.py b/lib/matplotlib/tests/test_backend_registry.py index 80c2ce4fc51a..2bd8e161bd6b 100644 --- a/lib/matplotlib/tests/test_backend_registry.py +++ b/lib/matplotlib/tests/test_backend_registry.py @@ -3,7 +3,6 @@ import pytest -import matplotlib as mpl from matplotlib.backends import BackendFilter, backend_registry @@ -95,16 +94,6 @@ def test_backend_normalization(backend, normalized): assert backend_registry._backend_module_name(backend) == normalized -def test_deprecated_rcsetup_attributes(): - match = "was deprecated in Matplotlib 3.9" - with pytest.warns(mpl.MatplotlibDeprecationWarning, match=match): - mpl.rcsetup.interactive_bk - with pytest.warns(mpl.MatplotlibDeprecationWarning, match=match): - mpl.rcsetup.non_interactive_bk - with pytest.warns(mpl.MatplotlibDeprecationWarning, match=match): - mpl.rcsetup.all_backends - - def test_entry_points_inline(): pytest.importorskip('matplotlib_inline') backends = backend_registry.list_all() diff --git a/lib/matplotlib/transforms.py b/lib/matplotlib/transforms.py index 2cca56f04457..7228f05bcf9e 100644 --- a/lib/matplotlib/transforms.py +++ b/lib/matplotlib/transforms.py @@ -98,7 +98,6 @@ class TransformNode: # Some metadata about the transform, used to determine whether an # invalidation is affine-only is_affine = False - is_bbox = _api.deprecated("3.9")(_api.classproperty(lambda cls: False)) pass_through = False """ @@ -216,7 +215,6 @@ class BboxBase(TransformNode): and height, but these are not stored explicitly. """ - is_bbox = _api.deprecated("3.9")(_api.classproperty(lambda cls: True)) is_affine = True if DEBUG: @@ -2627,27 +2625,6 @@ def get_matrix(self): return self._mtx -@_api.deprecated("3.9") -class BboxTransformToMaxOnly(BboxTransformTo): - """ - `BboxTransformToMaxOnly` is a transformation that linearly transforms points from - the unit bounding box to a given `Bbox` with a fixed upper left of (0, 0). - """ - def get_matrix(self): - # docstring inherited - if self._invalid: - xmax, ymax = self._boxout.max - if DEBUG and (xmax == 0 or ymax == 0): - raise ValueError("Transforming to a singular bounding box.") - self._mtx = np.array([[xmax, 0.0, 0.0], - [ 0.0, ymax, 0.0], - [ 0.0, 0.0, 1.0]], - float) - self._inverted = None - self._invalid = 0 - return self._mtx - - class BboxTransformFrom(Affine2DBase): """ `BboxTransformFrom` linearly transforms points from a given `Bbox` to the diff --git a/lib/matplotlib/transforms.pyi b/lib/matplotlib/transforms.pyi index 551487a11c60..07d299be297c 100644 --- a/lib/matplotlib/transforms.pyi +++ b/lib/matplotlib/transforms.pyi @@ -12,7 +12,6 @@ class TransformNode: INVALID_NON_AFFINE: int INVALID_AFFINE: int INVALID: int - is_bbox: bool # Implemented as a standard attr in base class, but functionally readonly and some subclasses implement as such @property def is_affine(self) -> bool: ... @@ -24,7 +23,6 @@ class TransformNode: def frozen(self) -> TransformNode: ... class BboxBase(TransformNode): - is_bbox: bool is_affine: bool def frozen(self) -> Bbox: ... def __array__(self, *args, **kwargs): ... @@ -295,8 +293,6 @@ class BboxTransform(Affine2DBase): class BboxTransformTo(Affine2DBase): def __init__(self, boxout: BboxBase, **kwargs) -> None: ... -class BboxTransformToMaxOnly(BboxTransformTo): ... - class BboxTransformFrom(Affine2DBase): def __init__(self, boxin: BboxBase, **kwargs) -> None: ... pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy