From 128fe0e979fba998c43144d44d75bc38368ec924 Mon Sep 17 00:00:00 2001 From: Ruth Comer <10599679+rcomer@users.noreply.github.com> Date: Sat, 24 Feb 2024 17:20:02 +0000 Subject: [PATCH] MNT: remove draw method args and kwargs --- ci/mypy-stubtest-allowlist.txt | 2 -- doc/api/next_api_changes/deprecations/27768-REC.rst | 5 ----- lib/matplotlib/axis.py | 4 +--- lib/matplotlib/image.py | 4 +--- lib/matplotlib/image.pyi | 2 +- 5 files changed, 3 insertions(+), 14 deletions(-) delete mode 100644 doc/api/next_api_changes/deprecations/27768-REC.rst diff --git a/ci/mypy-stubtest-allowlist.txt b/ci/mypy-stubtest-allowlist.txt index 19fb0879b7a2..73dfb1d8ceb0 100644 --- a/ci/mypy-stubtest-allowlist.txt +++ b/ci/mypy-stubtest-allowlist.txt @@ -18,8 +18,6 @@ matplotlib.pyplot.* matplotlib.typing.* # Other decorator modifying signature -# Runtime picks up *args **kwargs, but only decorated by a decorator that uses @wraps so? -matplotlib.axis.Axis.draw # Backcompat decorator which does not modify runtime reported signature matplotlib.offsetbox.*Offset[Bb]ox.get_offset diff --git a/doc/api/next_api_changes/deprecations/27768-REC.rst b/doc/api/next_api_changes/deprecations/27768-REC.rst deleted file mode 100644 index 357545a41efe..000000000000 --- a/doc/api/next_api_changes/deprecations/27768-REC.rst +++ /dev/null @@ -1,5 +0,0 @@ -``[XYZ]Axis.draw``, ``*Image.draw`` *args* and *kwargs*... -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -... are deprecated because they have no effect. This will make the calling sequence -consistent with the ``draw`` method of other artists. diff --git a/lib/matplotlib/axis.py b/lib/matplotlib/axis.py index e76f9fdcf5aa..c0cd2617e878 100644 --- a/lib/matplotlib/axis.py +++ b/lib/matplotlib/axis.py @@ -1373,10 +1373,8 @@ def get_tick_padding(self): values.append(self.minorTicks[0].get_tick_padding()) return max(values, default=0) - @_api.delete_parameter('3.9', 'args') - @_api.delete_parameter('3.9', 'kwargs') @martist.allow_rasterization - def draw(self, renderer, *args, **kwargs): + def draw(self, renderer): # docstring inherited if not self.get_visible(): diff --git a/lib/matplotlib/image.py b/lib/matplotlib/image.py index 4673c6c4d529..73738fe3bdbe 100644 --- a/lib/matplotlib/image.py +++ b/lib/matplotlib/image.py @@ -626,10 +626,8 @@ def _check_unsampled_image(self): """ return False - @_api.delete_parameter('3.9', 'args') - @_api.delete_parameter('3.9', 'kwargs') @martist.allow_rasterization - def draw(self, renderer, *args, **kwargs): + def draw(self, renderer): # if not visible, declare victory and return if not self.get_visible(): self.stale = False diff --git a/lib/matplotlib/image.pyi b/lib/matplotlib/image.pyi index 426e34ec83c9..20fdc3ff946a 100644 --- a/lib/matplotlib/image.pyi +++ b/lib/matplotlib/image.pyi @@ -82,7 +82,7 @@ class _ImageBase(martist.Artist, cm.ScalarMappable): def make_image( self, renderer: RendererBase, magnification: float = ..., unsampled: bool = ... ) -> tuple[np.ndarray, float, float, Affine2D]: ... - def draw(self, renderer: RendererBase, *args, **kwargs) -> None: ... + def draw(self, renderer: RendererBase) -> None: ... def write_png(self, fname: str | pathlib.Path | BinaryIO) -> None: ... def set_data(self, A: ArrayLike | None) -> None: ... def set_array(self, A: ArrayLike | None) -> None: ...