Skip to content

Commit 9c69c32

Browse files
authored
Merge pull request matplotlib#28593 from QuLogic/ruff-update
Update ruff to 0.2.0
2 parents e6f2b0c + 9d6e216 commit 9c69c32

22 files changed

+90
-78
lines changed

.flake8

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,17 +34,18 @@ exclude =
3434

3535
per-file-ignores =
3636
lib/matplotlib/_cm.py: E202, E203, E302
37-
lib/matplotlib/_mathtext.py: E221, E251
38-
lib/matplotlib/_mathtext_data.py: E203, E261
37+
lib/matplotlib/_mathtext.py: E221
38+
lib/matplotlib/_mathtext_data.py: E203
3939
lib/matplotlib/backends/backend_template.py: F401
4040
lib/matplotlib/mathtext.py: E221
4141
lib/matplotlib/pylab.py: F401, F403
4242
lib/matplotlib/pyplot.py: F811
4343
lib/matplotlib/tests/test_mathtext.py: E501
44-
lib/matplotlib/transforms.py: E201, E202, E203
44+
lib/matplotlib/transforms.py: E201, E202
4545
lib/matplotlib/tri/_triinterpolate.py: E201, E221
4646
lib/mpl_toolkits/axes_grid1/axes_size.py: E272
4747
lib/mpl_toolkits/axisartist/angle_helper.py: E221
48+
lib/mpl_toolkits/mplot3d/proj3d.py: E201
4849

4950
doc/conf.py: E402
5051
galleries/users_explain/quick_start.py: E402

lib/matplotlib/__init__.pyi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,5 +111,5 @@ def _preprocess_data(
111111
label_namer: str | None = ...
112112
) -> Callable: ...
113113

114-
from matplotlib.cm import _colormaps as colormaps
115-
from matplotlib.colors import _color_sequences as color_sequences
114+
from matplotlib.cm import _colormaps as colormaps # noqa: E402
115+
from matplotlib.colors import _color_sequences as color_sequences # noqa: E402

lib/matplotlib/_api/__init__.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ from typing_extensions import Self # < Py 3.11
44

55
from numpy.typing import NDArray
66

7-
from .deprecation import ( # noqa: re-exported API
7+
from .deprecation import ( # noqa: F401, re-exported API
88
deprecated as deprecated,
99
warn_deprecated as warn_deprecated,
1010
rename_parameter as rename_parameter,

lib/matplotlib/_mathtext.py

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -379,27 +379,27 @@ def _get_info(self, fontname: str, font_class: str, sym: str, fontsize: float,
379379
xmin, ymin, xmax, ymax = [val/64.0 for val in glyph.bbox]
380380
offset = self._get_offset(font, glyph, fontsize, dpi)
381381
metrics = FontMetrics(
382-
advance = glyph.linearHoriAdvance/65536.0,
383-
height = glyph.height/64.0,
384-
width = glyph.width/64.0,
385-
xmin = xmin,
386-
xmax = xmax,
387-
ymin = ymin+offset,
388-
ymax = ymax+offset,
382+
advance=glyph.linearHoriAdvance / 65536,
383+
height=glyph.height / 64,
384+
width=glyph.width / 64,
385+
xmin=xmin,
386+
xmax=xmax,
387+
ymin=ymin + offset,
388+
ymax=ymax + offset,
389389
# iceberg is the equivalent of TeX's "height"
390-
iceberg = glyph.horiBearingY/64.0 + offset,
391-
slanted = slanted
392-
)
390+
iceberg=glyph.horiBearingY / 64 + offset,
391+
slanted=slanted
392+
)
393393

394394
return FontInfo(
395-
font = font,
396-
fontsize = fontsize,
397-
postscript_name = font.postscript_name,
398-
metrics = metrics,
399-
num = num,
400-
glyph = glyph,
401-
offset = offset
402-
)
395+
font=font,
396+
fontsize=fontsize,
397+
postscript_name=font.postscript_name,
398+
metrics=metrics,
399+
num=num,
400+
glyph=glyph,
401+
offset=offset
402+
)
403403

404404
def get_xheight(self, fontname: str, fontsize: float, dpi: float) -> float:
405405
font = self._get_font(fontname)

lib/matplotlib/axes/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from . import _base
2-
from ._axes import Axes # noqa: F401
2+
from ._axes import Axes
33

44
# Backcompat.
55
Subplot = Axes

lib/matplotlib/axes/_axes.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
import matplotlib.collections as mcoll
1515
import matplotlib.colors as mcolors
1616
import matplotlib.contour as mcontour
17-
import matplotlib.dates # noqa # Register date unit converter as side effect.
17+
import matplotlib.dates # noqa: F401, Register date unit converter as side effect.
1818
import matplotlib.image as mimage
1919
import matplotlib.legend as mlegend
2020
import matplotlib.lines as mlines

lib/matplotlib/axes/_axes.pyi

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ class Axes(_AxesBase):
202202
*args: float | ArrayLike | str,
203203
scalex: bool = ...,
204204
scaley: bool = ...,
205-
data = ...,
205+
data=...,
206206
**kwargs
207207
) -> list[Line2D]: ...
208208
def plot_date(
@@ -232,7 +232,7 @@ class Axes(_AxesBase):
232232
detrend: Callable[[ArrayLike], ArrayLike] = ...,
233233
usevlines: bool = ...,
234234
maxlags: int = ...,
235-
data = ...,
235+
data=...,
236236
**kwargs
237237
) -> tuple[np.ndarray, np.ndarray, LineCollection | Line2D, Line2D | None]: ...
238238
def step(
@@ -241,7 +241,7 @@ class Axes(_AxesBase):
241241
y: ArrayLike,
242242
*args,
243243
where: Literal["pre", "post", "mid"] = ...,
244-
data = ...,
244+
data=...,
245245
**kwargs
246246
) -> list[Line2D]: ...
247247
def bar(
@@ -252,7 +252,7 @@ class Axes(_AxesBase):
252252
bottom: float | ArrayLike | None = ...,
253253
*,
254254
align: Literal["center", "edge"] = ...,
255-
data = ...,
255+
data=...,
256256
**kwargs
257257
) -> BarContainer: ...
258258
def barh(
@@ -263,7 +263,7 @@ class Axes(_AxesBase):
263263
left: float | ArrayLike | None = ...,
264264
*,
265265
align: Literal["center", "edge"] = ...,
266-
data = ...,
266+
data=...,
267267
**kwargs
268268
) -> BarContainer: ...
269269
def bar_label(

lib/matplotlib/backends/qt_compat.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
if QT_API_ENV in ["pyqt5", "pyside2"]:
5050
QT_API = _ETS[QT_API_ENV]
5151
else:
52-
_QT_FORCE_QT5_BINDING = True # noqa
52+
_QT_FORCE_QT5_BINDING = True # noqa: F811
5353
QT_API = None
5454
# A non-Qt backend was selected but we still got there (possible, e.g., when
5555
# fully manually embedding Matplotlib in a Qt app without using pyplot).

lib/matplotlib/contour.pyi

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ from matplotlib.artist import Artist
33
from matplotlib.axes import Axes
44
from matplotlib.collections import Collection, PathCollection
55
from matplotlib.colors import Colormap, Normalize
6-
from matplotlib.font_manager import FontProperties
76
from matplotlib.path import Path
87
from matplotlib.patches import Patch
98
from matplotlib.text import Text

lib/matplotlib/gridspec.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ from typing import Any, Literal, overload
33
from numpy.typing import ArrayLike
44
import numpy as np
55

6-
from matplotlib.axes import Axes, SubplotBase
6+
from matplotlib.axes import Axes
77
from matplotlib.backend_bases import RendererBase
88
from matplotlib.figure import Figure
99
from matplotlib.transforms import Bbox

0 commit comments

Comments
 (0)