Skip to content

Commit c855d76

Browse files
committed
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 .
1 parent c11175d commit c855d76

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

lib/matplotlib/offsetbox.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -206,10 +206,10 @@ class OffsetBox(martist.Artist):
206206
The child artists are meant to be drawn at a relative position to its
207207
parent.
208208
209-
Being an artist itself, all parameters are passed on to `.Artist`.
209+
Being an artist itself, all keyword arguments are passed on to `.Artist`.
210210
"""
211-
def __init__(self, *args, **kwargs):
212-
super().__init__(*args)
211+
def __init__(self, **kwargs):
212+
super().__init__()
213213
self._internal_update(kwargs)
214214
# Clipping has not been implemented in the OffsetBox family, so
215215
# disable the clip flag for consistency. It can always be turned back

lib/matplotlib/offsetbox.pyi

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ def _get_packed_offsets(
2626
class OffsetBox(martist.Artist):
2727
width: float | None
2828
height: float | None
29-
def __init__(self, *args, **kwargs) -> None: ...
29+
def __init__(self, **kwargs) -> None: ...
3030
def set_figure(self, fig: Figure | SubFigure) -> None: ...
3131
def set_offset(
3232
self,

0 commit comments

Comments
 (0)