From c855d764251a0122f74b6ae80373dfc14f7c96dc Mon Sep 17 00:00:00 2001 From: Tim Hoffmann <2836374+timhoffm@users.noreply.github.com> Date: Mon, 30 Dec 2024 00:58:34 +0100 Subject: [PATCH] MNT: Remove *args for OffsetBox.__init__() *args were passed on to Artist.__init__(), but Artist does not accept any positional parameters. Passing any positional parameters to Offsetbox would thus have always failed internally. It is thus clearer to not accept any positional parameters for OffsetBox in the first place . --- lib/matplotlib/offsetbox.py | 6 +++--- lib/matplotlib/offsetbox.pyi | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/matplotlib/offsetbox.py b/lib/matplotlib/offsetbox.py index 91858c23ad62..af554c69bc02 100644 --- a/lib/matplotlib/offsetbox.py +++ b/lib/matplotlib/offsetbox.py @@ -206,10 +206,10 @@ class OffsetBox(martist.Artist): The child artists are meant to be drawn at a relative position to its parent. - Being an artist itself, all parameters are passed on to `.Artist`. + Being an artist itself, all keyword arguments are passed on to `.Artist`. """ - def __init__(self, *args, **kwargs): - super().__init__(*args) + def __init__(self, **kwargs): + super().__init__() self._internal_update(kwargs) # Clipping has not been implemented in the OffsetBox family, so # disable the clip flag for consistency. It can always be turned back diff --git a/lib/matplotlib/offsetbox.pyi b/lib/matplotlib/offsetbox.pyi index 3b1520e17138..8a2016c0320a 100644 --- a/lib/matplotlib/offsetbox.pyi +++ b/lib/matplotlib/offsetbox.pyi @@ -26,7 +26,7 @@ def _get_packed_offsets( class OffsetBox(martist.Artist): width: float | None height: float | None - def __init__(self, *args, **kwargs) -> None: ... + def __init__(self, **kwargs) -> None: ... def set_figure(self, fig: Figure | SubFigure) -> None: ... def set_offset( self,