Skip to content

Commit 85a090e

Browse files
authored
Merge branch 'main' into Update-astral-sh/ruff-action
2 parents a18f9e1 + a721313 commit 85a090e

File tree

336 files changed

+893
-1908
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

336 files changed

+893
-1908
lines changed

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
python-version: "3.11"
1818

1919
- name: Cache pip
20-
uses: actions/cache@v2
20+
uses: actions/cache@v4
2121
with:
2222
path: ~/.cache/pip
2323
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}

pyproject.toml

Lines changed: 27 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -27,59 +27,42 @@ line-length = 130
2727
target-version = "py39"
2828

2929
[tool.ruff.lint]
30+
# TODO: Use extend-select instead to get base E and F rules that don't conflict with the formatter
3031
select = [
32+
"FA", # flake8-future-annotations
3133
"I", # isort
34+
"PYI", # flake8-pyi
35+
]
36+
ignore = [
37+
###
38+
# Rules we don't want or don't agree with
39+
###
40+
# Typeshed doesn't want complex or non-literal defaults, or long strings, for maintenance and testing reasons.
41+
# This doesn't affect us, let's have more complete stubs.
42+
"PYI011",
43+
"PYI014",
44+
"PYI053",
45+
46+
# TODO: Handle in its own PR
47+
"PYI021", # https://github.com/microsoft/python-type-stubs/pull/343
48+
49+
# TODO: Investigate and fix or configure
50+
"PYI001",
51+
"PYI002",
52+
"PYI017",
53+
"PYI019", # Request for more autofixes: https://github.com/astral-sh/ruff/issues/15798
54+
"PYI024",
55+
"PYI048",
56+
"PYI051", # Request for autofix: https://github.com/astral-sh/ruff/issues/14185
57+
"PYI052",
3258
]
3359

3460
[tool.ruff.lint.isort]
3561
combine-as-imports = true
3662
extra-standard-library = [
63+
# Group these with stdlib
3764
"typing_extensions",
3865
"_typeshed",
39-
# Extra modules not recognized by Ruff/isort
40-
"_ast",
41-
"_bisect",
42-
"_bootlocale",
43-
"_codecs",
44-
"_collections_abc",
45-
"_compat_pickle",
46-
"_compression",
47-
"_csv",
48-
"_ctypes",
49-
"_curses",
50-
"_decimal",
51-
"_dummy_thread",
52-
"_dummy_threading",
53-
"_heapq",
54-
"_imp",
55-
"_json",
56-
"_locale",
57-
"_lsprof",
58-
"_markupbase",
59-
"_msi",
60-
"_operator",
61-
"_osx_support",
62-
"_posixsubprocess",
63-
"_py_abc",
64-
"_pydecimal",
65-
"_random",
66-
"_sitebuiltins",
67-
"_socket",
68-
"_sqlite3",
69-
"_ssl",
70-
"_stat",
71-
"_thread",
72-
"_threading_local",
73-
"_tkinter",
74-
"_tracemalloc",
75-
"_warnings",
76-
"_weakref",
77-
"_weakrefset",
78-
"_winapi",
79-
"genericpath",
80-
"opcode",
81-
"pyexpat",
82-
"zoneinfo",
8366
]
8467

8568
[tool.pyright]

stubs/matplotlib/__init__.pyi

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,5 +47,4 @@ def is_interactive() -> bool: ...
4747

4848
default_test_modules: list[str] = ...
4949

50-
def test(verbosity=..., coverage=..., **kwargs):
51-
int: ...
50+
def test(verbosity=..., coverage=..., **kwargs): ...

stubs/matplotlib/_layoutgrid.pyi

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ class LayoutGrid:
1818
width_ratios: None | list[float] = None,
1919
height_ratios: None | list[float] = None,
2020
) -> None: ...
21-
def __repr__(self) -> str: ...
2221
def reset_margins(self) -> None: ...
2322
def add_constraints(self) -> None: ...
2423
def hard_constraints(self) -> None: ...

stubs/matplotlib/_mathtext.pyi

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,6 @@ class DejaVuSansFontConstants(FontConstantsBase): ...
111111

112112
class Node:
113113
def __init__(self) -> None: ...
114-
def __repr__(self) -> str: ...
115114
def get_kerning(self, next) -> float: ...
116115
def shrink(self) -> None: ...
117116
def render(self, x: float, y: float) -> None: ...
@@ -129,7 +128,6 @@ class Hbox(Box):
129128

130129
class Char(Node):
131130
def __init__(self, c, state) -> None: ...
132-
def __repr__(self) -> str: ...
133131
def is_slanted(self) -> bool: ...
134132
def get_kerning(self, next) -> float: ...
135133
def render(self, x: float, y: float) -> None: ...
@@ -141,7 +139,6 @@ class Accent(Char):
141139

142140
class List(Box):
143141
def __init__(self, elements) -> None: ...
144-
def __repr__(self) -> str: ...
145142
def shrink(self) -> None: ...
146143

147144
class Hlist(List):
@@ -179,7 +176,6 @@ class Kern(Node):
179176
height: float = ...
180177
depth: float = ...
181178
def __init__(self, width: float) -> None: ...
182-
def __repr__(self) -> str: ...
183179
def shrink(self) -> None: ...
184180

185181
class AutoHeightChar(Hlist):

stubs/matplotlib/_typing.pyi

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,21 @@
11
import decimal
22
import io
3+
import typing_extensions
34

45
import numpy.typing
56
import pandas as pd
67

78
Decimal = decimal.Decimal
8-
PythonScalar = str | int | float | bool
9+
PythonScalar: typing_extensions.TypeAlias = str | int | float | bool
910

1011
ArrayLike = numpy.typing.ArrayLike
1112
FileLike = io.IOBase
1213
PathLike = str
1314

14-
PandasScalar = pd.Period | pd.Timestamp | pd.Timedelta | pd.Interval
15-
Scalar = PythonScalar | PandasScalar
15+
PandasScalar: typing_extensions.TypeAlias = pd.Period | pd.Timestamp | pd.Timedelta | pd.Interval
16+
Scalar: typing_extensions.TypeAlias = PythonScalar | PandasScalar
1617

17-
Color = tuple[float, float, float] | str
18+
Color: typing_extensions.TypeAlias = tuple[float, float, float] | str
1819

1920
__all__ = [
2021
"ArrayLike",

stubs/matplotlib/animation.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class MovieWriterRegistry:
1515
def __init__(self) -> None: ...
1616
def register(self, name: str) -> Callable: ...
1717
def is_available(self, name: str) -> bool: ...
18-
def __iter__(self) -> Generator: ...
18+
def __iter__(self) -> Iterator: ...
1919
def list(self) -> list[MovieWriter]: ...
2020
def __getitem__(self, name) -> MovieWriter: ...
2121

stubs/matplotlib/artist.pyi

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@ def allow_rasterization(
1313
draw,
1414
) -> Callable: ...
1515

16-
class _Unset:
17-
def __repr__(self) -> str: ...
16+
class _Unset: ...
1817

1918
class Artist:
2019
zorder: int = ...

stubs/matplotlib/axes/_axes.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -574,7 +574,7 @@ class Axes(_AxesBase):
574574
precision: float | Literal["present"] = 0,
575575
marker=...,
576576
markersize=...,
577-
aspect: Literal["equal", "auto", None] | float = "equal",
577+
aspect: Literal["equal", "auto"] | None | float = "equal",
578578
origin: Literal["upper", "lower"] = ...,
579579
**kwargs,
580580
) -> AxesImage | Line2D: ...

stubs/matplotlib/axes/_base.pyi

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ class _axis_method_wrapper:
2525
class _AxesBase(Artist):
2626
name: str = ...
2727

28-
def __str__(self) -> str: ...
2928
def __init__(
3029
self,
3130
fig: Figure,
@@ -43,7 +42,6 @@ class _AxesBase(Artist):
4342
) -> None: ...
4443
def __getstate__(self) -> dict[str, Any]: ...
4544
def __setstate__(self, state) -> None: ...
46-
def __repr__(self) -> str: ...
4745
def get_window_extent(self, renderer=..., *args, **kwargs) -> TransformedBbox: ...
4846
def set_figure(self, fig: Figure) -> None: ...
4947
@property

0 commit comments

Comments
 (0)