Skip to content

Commit 2567874

Browse files
committed
Fix checker to include __init__; expire deprecations in type hints
1 parent e965a90 commit 2567874

19 files changed

+74
-35
lines changed

lib/matplotlib/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@
103103
104104
"""
105105

106-
__all_ignore__ = [
106+
__all__ = [
107107
"__bibtex__",
108108
"__version__",
109109
"__version_info__",

lib/matplotlib/__init__.pyi

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,9 @@ class _VersionInfo(NamedTuple):
5050
releaselevel: str
5151
serial: int
5252

53-
__version__: str
54-
__version_info__: _VersionInfo
53+
class __getattr__:
54+
__version__: str
55+
__version_info__: _VersionInfo
5556

5657
def set_loglevel(level: str) -> None: ...
5758

lib/matplotlib/axes/_base.pyi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -310,9 +310,9 @@ class _AxesBase(martist.Artist):
310310
self,
311311
left: float | None = ...,
312312
right: float | None = ...,
313+
*,
313314
emit: bool = ...,
314315
auto: bool | None = ...,
315-
*,
316316
xmin: float | None = ...,
317317
xmax: float | None = ...
318318
) -> tuple[float, float]: ...
@@ -336,9 +336,9 @@ class _AxesBase(martist.Artist):
336336
self,
337337
bottom: float | None = ...,
338338
top: float | None = ...,
339+
*,
339340
emit: bool = ...,
340341
auto: bool | None = ...,
341-
*,
342342
ymin: float | None = ...,
343343
ymax: float | None = ...
344344
) -> tuple[float, float]: ...

lib/matplotlib/axis.pyi

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,6 @@ class Tick(martist.Artist):
5050
grid_alpha: float | None = ...,
5151
**kwargs
5252
) -> None: ...
53-
@property
54-
def label(self) -> Text: ...
5553
def get_tickdir(self) -> Literal["in", "inout", "out"]: ...
5654
def get_tick_padding(self) -> float: ...
5755
def get_children(self) -> list[martist.Artist]: ...

lib/matplotlib/backend_bases.pyi

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ from matplotlib.texmanager import TexManager
2626
from matplotlib.text import Text
2727
from matplotlib.transforms import Affine2D, Transform, TransformedPath, Bbox
2828

29-
from collections.abc import Callable, Sequence
29+
from collections.abc import Callable, Iterable, Sequence
3030
from typing import Any, Literal, NamedTuple, TypeVar
3131
from numpy.typing import ArrayLike
3232
from .typing import ColorType, LineStyleType
@@ -246,6 +246,8 @@ class LocationEvent(Event):
246246
x: int,
247247
y: int,
248248
guiEvent: Any | None = ...,
249+
*,
250+
modifiers: Iterable[str] | None = ...,
249251
) -> None: ...
250252

251253
class MouseButton(IntEnum):
@@ -271,6 +273,8 @@ class MouseEvent(LocationEvent):
271273
step: float = ...,
272274
dblclick: bool = ...,
273275
guiEvent: Any | None = ...,
276+
*,
277+
modifiers: Iterable[str] | None = ...,
274278
) -> None: ...
275279

276280
class PickEvent(Event):

lib/matplotlib/backend_tools.pyi

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,7 @@ class ToolToggleBase(ToolBase):
4343
radio_group: str | None
4444
cursor: Cursors | None
4545
default_toggled: bool
46-
def __init__(
47-
self, toolmanager: ToolManager, name: str, *, toggled: bool = ...
48-
) -> None: ...
46+
def __init__(self, *args, **kwargs) -> None: ...
4947
def enable(self, event: ToolEvent | None = ...) -> None: ...
5048
def disable(self, event: ToolEvent | None = ...) -> None: ...
5149
@property

lib/matplotlib/collections.pyi

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ from .typing import ColorType, LineStyleType
1717
class Collection(artist.Artist, cm.ScalarMappable):
1818
def __init__(
1919
self,
20+
*,
2021
edgecolors: ColorType | Sequence[ColorType] | None = ...,
2122
facecolors: ColorType | Sequence[ColorType] | None = ...,
2223
linewidths: float | Sequence[float] | None = ...,
@@ -31,7 +32,6 @@ class Collection(artist.Artist, cm.ScalarMappable):
3132
pickradius: float = ...,
3233
hatch: str | None = ...,
3334
urls: Sequence[str] | None = ...,
34-
*,
3535
zorder: float = ...,
3636
**kwargs
3737
) -> None: ...
@@ -92,6 +92,7 @@ class PolyCollection(_CollectionWithSizes):
9292
self,
9393
verts: Sequence[ArrayLike],
9494
sizes: ArrayLike | None = ...,
95+
*,
9596
closed: bool = ...,
9697
**kwargs
9798
) -> None: ...
@@ -117,7 +118,7 @@ class BrokenBarHCollection(PolyCollection):
117118

118119
class RegularPolyCollection(_CollectionWithSizes):
119120
def __init__(
120-
self, numsides: int, rotation: float = ..., sizes: ArrayLike = ..., **kwargs
121+
self, numsides: int, *, rotation: float = ..., sizes: ArrayLike = ..., **kwargs
121122
) -> None: ...
122123
def get_numsides(self) -> int: ...
123124
def get_rotation(self) -> float: ...
@@ -143,6 +144,7 @@ class EventCollection(LineCollection):
143144
self,
144145
positions: ArrayLike,
145146
orientation: Literal["horizontal", "vertical"] = ...,
147+
*,
146148
lineoffset: float = ...,
147149
linelength: float = ...,
148150
linewidth: float | Sequence[float] | None = ...,
@@ -179,6 +181,7 @@ class EllipseCollection(Collection):
179181
widths: ArrayLike,
180182
heights: ArrayLike,
181183
angles: ArrayLike,
184+
*,
182185
units: Literal[
183186
"points", "inches", "dots", "width", "height", "x", "y", "xy"
184187
] = ...,
@@ -187,7 +190,7 @@ class EllipseCollection(Collection):
187190

188191
class PatchCollection(Collection):
189192
def __init__(
190-
self, patches: Iterable[Patch], match_original: bool = ..., **kwargs
193+
self, patches: Iterable[Patch], *, match_original: bool = ..., **kwargs
191194
) -> None: ...
192195
def set_paths(self, patches: Iterable[Patch]) -> None: ... # type: ignore[override]
193196

lib/matplotlib/figure.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -299,14 +299,14 @@ class Figure(FigureBase):
299299
self,
300300
figsize: tuple[float, float] | None = ...,
301301
dpi: float | None = ...,
302+
*,
302303
facecolor: ColorType | None = ...,
303304
edgecolor: ColorType | None = ...,
304305
linewidth: float = ...,
305306
frameon: bool | None = ...,
306307
subplotpars: SubplotParams | None = ...,
307308
tight_layout: bool | dict[str, Any] | None = ...,
308309
constrained_layout: bool | dict[str, Any] | None = ...,
309-
*,
310310
layout: Literal["constrained", "compressed", "tight"]
311311
| LayoutEngine
312312
| None = ...,

lib/matplotlib/image.pyi

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ class AxesImage(_ImageBase):
7676
def __init__(
7777
self,
7878
ax: Axes,
79+
*,
7980
cmap: str | Colormap | None = ...,
8081
norm: str | Normalize | None = ...,
8182
interpolation: str | None = ...,
@@ -84,7 +85,6 @@ class AxesImage(_ImageBase):
8485
filternorm: bool = ...,
8586
filterrad: float = ...,
8687
resample: bool = ...,
87-
*,
8888
interpolation_stage: Literal["data", "rgba"] | None = ...,
8989
**kwargs
9090
) -> None: ...
@@ -114,6 +114,7 @@ class PcolorImage(AxesImage):
114114
x: ArrayLike | None = ...,
115115
y: ArrayLike | None = ...,
116116
A: ArrayLike | None = ...,
117+
*,
117118
cmap: str | Colormap | None = ...,
118119
norm: str | Normalize | None = ...,
119120
**kwargs
@@ -129,6 +130,7 @@ class FigureImage(_ImageBase):
129130
def __init__(
130131
self,
131132
fig: Figure,
133+
*,
132134
cmap: str | Colormap | None = ...,
133135
norm: str | Normalize | None = ...,
134136
offsetx: int = ...,
@@ -142,6 +144,7 @@ class BboxImage(_ImageBase):
142144
def __init__(
143145
self,
144146
bbox: Bbox,
147+
*,
145148
cmap: str | Colormap | None = ...,
146149
norm: str | Normalize | None = ...,
147150
interpolation: str | None = ...,

lib/matplotlib/legend.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ class Legend(Artist):
7474
parent: Axes | Figure,
7575
handles: Iterable[Artist],
7676
labels: Iterable[str],
77+
*,
7778
loc: str | tuple[float, float] | int | None = ...,
7879
numpoints: int | None = ...,
7980
markerscale: float | None = ...,
@@ -112,7 +113,6 @@ class Legend(Artist):
112113
handler_map: dict[Artist | type, HandlerBase] | None = ...,
113114
title_fontproperties: FontProperties | dict[str, Any] | None = ...,
114115
alignment: Literal["center", "left", "right"] = ...,
115-
*,
116116
ncol: int = ...,
117117
draggable: bool = ...
118118
) -> None: ...

0 commit comments

Comments
 (0)