Thanks to visit codestin.com
Credit goes to github.com

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: ...

lib/matplotlib/lines.pyi

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ class Line2D(Artist):
4646
self,
4747
xdata: ArrayLike,
4848
ydata: ArrayLike,
49+
*,
4950
linewidth: float | None = ...,
5051
linestyle: LineStyleType | None = ...,
5152
color: ColorType | None = ...,

lib/matplotlib/offsetbox.pyi

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ class PaddedBox(OffsetBox):
7979
self,
8080
child: martist.Artist,
8181
pad: float | None = ...,
82+
*,
8283
draw_frame: bool = ...,
8384
patch_attrs: dict[str, Any] | None = ...,
8485
) -> None: ...
@@ -117,6 +118,7 @@ class TextArea(OffsetBox):
117118
def __init__(
118119
self,
119120
s: str,
121+
*,
120122
textprops: dict[str, Any] | None = ...,
121123
multilinebaseline: bool = ...,
122124
) -> None: ...
@@ -154,6 +156,7 @@ class AnchoredOffsetbox(OffsetBox):
154156
def __init__(
155157
self,
156158
loc: str,
159+
*,
157160
pad: float = ...,
158161
borderpad: float = ...,
159162
child: OffsetBox | None = ...,
@@ -186,6 +189,7 @@ class AnchoredText(AnchoredOffsetbox):
186189
self,
187190
s: str,
188191
loc: str,
192+
*,
189193
pad: float = ...,
190194
borderpad: float = ...,
191195
prop: dict[str, Any] | None = ...,
@@ -197,6 +201,7 @@ class OffsetImage(OffsetBox):
197201
def __init__(
198202
self,
199203
arr: ArrayLike,
204+
*,
200205
zoom: float = ...,
201206
cmap: Colormap | str | None = ...,
202207
norm: Normalize | str | None = ...,
@@ -231,6 +236,7 @@ class AnnotationBbox(martist.Artist, mtext._AnnotationBase):
231236
offsetbox: OffsetBox,
232237
xy: tuple[float, float],
233238
xybox: tuple[float, float] | None = ...,
239+
*,
234240
xycoords: str
235241
| tuple[str, str]
236242
| martist.Artist

lib/matplotlib/patches.pyi

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ class Patch(artist.Artist):
2525
zorder: float
2626
def __init__(
2727
self,
28+
*,
2829
edgecolor: ColorType | None = ...,
2930
facecolor: ColorType | None = ...,
3031
color: ColorType | None = ...,
@@ -82,8 +83,8 @@ class Rectangle(Patch):
8283
xy: tuple[float, float],
8384
width: float,
8485
height: float,
85-
angle: float = ...,
8686
*,
87+
angle: float = ...,
8788
rotation_point: Literal["xy", "center"] | tuple[float, float] = ...,
8889
**kwargs,
8990
) -> None: ...
@@ -125,6 +126,7 @@ class RegularPolygon(Patch):
125126
self,
126127
xy: tuple[float, float],
127128
numVertices: int,
129+
*,
128130
radius: float = ...,
129131
orientation: float = ...,
130132
**kwargs,
@@ -156,7 +158,7 @@ class StepPatch(PathPatch):
156158
) -> None: ...
157159

158160
class Polygon(Patch):
159-
def __init__(self, xy: ArrayLike, closed: bool = ..., **kwargs) -> None: ...
161+
def __init__(self, xy: ArrayLike, *, closed: bool = ..., **kwargs) -> None: ...
160162
def get_closed(self) -> bool: ...
161163
def set_closed(self, closed: bool) -> None: ...
162164
def get_xy(self) -> np.ndarray: ...
@@ -175,6 +177,7 @@ class Wedge(Patch):
175177
r: float,
176178
theta1: float,
177179
theta2: float,
180+
*,
178181
width: float | None = ...,
179182
**kwargs,
180183
) -> None: ...
@@ -186,7 +189,7 @@ class Wedge(Patch):
186189

187190
class Arrow(Patch):
188191
def __init__(
189-
self, x: float, y: float, dx: float, dy: float, width: float = ..., **kwargs
192+
self, x: float, y: float, dx: float, dy: float, *, width: float = ..., **kwargs
190193
) -> None: ...
191194

192195
class FancyArrow(Polygon):
@@ -196,6 +199,7 @@ class FancyArrow(Polygon):
196199
y: float,
197200
dx: float,
198201
dy: float,
202+
*,
199203
width: float = ...,
200204
length_includes_head: bool = ...,
201205
head_width: float | None = ...,
@@ -222,6 +226,7 @@ class CirclePolygon(RegularPolygon):
222226
self,
223227
xy: tuple[float, float],
224228
radius: float = ...,
229+
*,
225230
resolution: int = ...,
226231
**kwargs,
227232
) -> None: ...
@@ -232,6 +237,7 @@ class Ellipse(Patch):
232237
xy: tuple[float, float],
233238
width: float,
234239
height: float,
240+
*,
235241
angle: float = ...,
236242
**kwargs,
237243
) -> None: ...
@@ -298,6 +304,7 @@ class Arc(Ellipse):
298304
xy: tuple[float, float],
299305
width: float,
300306
height: float,
307+
*,
301308
angle: float = ...,
302309
theta1: float = ...,
303310
theta2: float = ...,
@@ -682,6 +689,7 @@ class FancyArrowPatch(Patch):
682689
self,
683690
posA: tuple[float, float] | None = ...,
684691
posB: tuple[float, float] | None = ...,
692+
*,
685693
path: Path | None = ...,
686694
arrowstyle: str | ArrowStyle = ...,
687695
connectionstyle: str | ConnectionStyle = ...,
@@ -722,6 +730,7 @@ class ConnectionPatch(FancyArrowPatch):
722730
xyB: tuple[float, float],
723731
coordsA: str | Transform,
724732
coordsB: str | Transform | None = ...,
733+
*,
725734
axesA: Axes | None = ...,
726735
axesB: Axes | None = ...,
727736
arrowstyle: str | ArrowStyle = ...,

lib/matplotlib/projections/polar.pyi

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ class PolarTransform(mtransforms.Transform):
2222
axis: PolarAxes | None = ...,
2323
use_rmin: bool = ...,
2424
_apply_theta_transforms: bool = ...,
25+
*,
26+
scale_transform: mtransforms.Transform,
2527
) -> None: ...
2628
def inverted(self) -> InvertedPolarTransform: ...
2729

@@ -159,6 +161,7 @@ class PolarAxes(Axes):
159161
self,
160162
bottom: float | None = ...,
161163
top: float | None = ...,
164+
*,
162165
emit: bool = ...,
163166
auto: bool = ...,
164167
**kwargs,

0 commit comments

Comments
 (0)