Skip to content

Commit 9c99dcf

Browse files
committed
Merge branch 'main' of https://github.com/microsoft/python-type-stubs into Replace-Remove-doc-comments-script-with-RUff
2 parents 075a285 + 5ef1657 commit 9c99dcf

File tree

95 files changed

+220
-340
lines changed

Some content is hidden

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

95 files changed

+220
-340
lines changed

.github/workflows/test.yml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,7 @@ jobs:
4646
uses: actions/checkout@v2
4747

4848
- name: Run Ruff Linter
49-
uses: astral-sh/ruff-action@v1
50-
51-
- name: Run Ruff Formatter
52-
uses: astral-sh/ruff-action@v1
49+
uses: astral-sh/ruff-action@v3
5350
with:
54-
args: "format --check"
51+
version: "0.9.*"
52+
- run: ruff format --check

pyproject.toml

Lines changed: 5 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -37,76 +37,33 @@ ignore = [
3737
###
3838
# Rules we don't want or don't agree with
3939
###
40-
# Typeshed doesn't want complex or non-literal defaults for maintenance and testing reasons.
40+
# Typeshed doesn't want complex or non-literal defaults, or long strings, for maintenance and testing reasons.
4141
# This doesn't affect us, let's have more complete stubs.
4242
"PYI011",
4343
"PYI014",
44+
"PYI053",
4445

4546
# TODO: Investigate and fix or configure
4647
"PYI001",
4748
"PYI002",
4849
"PYI017",
49-
"PYI019", # Request for autofix: https://github.com/astral-sh/ruff/issues/14183
50+
"PYI019", # Request for more autofixes: https://github.com/astral-sh/ruff/issues/15798
5051
"PYI024",
51-
"PYI034", # Request for autofix: https://github.com/astral-sh/ruff/issues/14184
52-
"PYI041", # Request for autofix: https://github.com/astral-sh/ruff/issues/14185
5352
"PYI048",
5453
"PYI051", # Request for autofix: https://github.com/astral-sh/ruff/issues/14185
5554
"PYI052",
5655
]
56+
5757
[tool.ruff.lint.per-file-ignores]
5858
# We keep docstrings in sklearn
5959
"stubs/sklearn/**" = ["PYI021"]
6060

6161
[tool.ruff.lint.isort]
6262
combine-as-imports = true
6363
extra-standard-library = [
64+
# Group these with stdlib
6465
"typing_extensions",
6566
"_typeshed",
66-
# Extra modules not recognized by Ruff/isort
67-
"_ast",
68-
"_bisect",
69-
"_bootlocale",
70-
"_codecs",
71-
"_collections_abc",
72-
"_compat_pickle",
73-
"_compression",
74-
"_csv",
75-
"_ctypes",
76-
"_curses",
77-
"_decimal",
78-
"_dummy_thread",
79-
"_dummy_threading",
80-
"_heapq",
81-
"_imp",
82-
"_json",
83-
"_locale",
84-
"_lsprof",
85-
"_markupbase",
86-
"_msi",
87-
"_operator",
88-
"_osx_support",
89-
"_posixsubprocess",
90-
"_py_abc",
91-
"_pydecimal",
92-
"_random",
93-
"_sitebuiltins",
94-
"_socket",
95-
"_sqlite3",
96-
"_ssl",
97-
"_stat",
98-
"_thread",
99-
"_threading_local",
100-
"_tkinter",
101-
"_tracemalloc",
102-
"_warnings",
103-
"_weakref",
104-
"_weakrefset",
105-
"_winapi",
106-
"genericpath",
107-
"opcode",
108-
"pyexpat",
109-
"zoneinfo",
11067
]
11168

11269
[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-
...
50+
def test(verbosity=..., coverage=..., **kwargs): ...

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-
...
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/backends/backend_agg.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class RendererAgg(RendererBase):
3535
def get_text_width_height_descent(self, s: str, prop: FontProperties, ismath: bool) -> tuple[float, float, float]: ...
3636
def draw_tex(self, gc: GraphicsContextBase, x, y, s: str, prop: FontProperties, angle, *, mtext=...) -> None: ...
3737
def get_canvas_width_height(self) -> tuple[float, float]: ...
38-
def points_to_pixels(self, points: int | float) -> float: ...
38+
def points_to_pixels(self, points: float) -> float: ...
3939
def buffer_rgba(self) -> memoryview: ...
4040
def tostring_argb(self) -> bytes: ...
4141
def tostring_rgb(self) -> bytes: ...

stubs/matplotlib/backends/backend_pdf.pyi

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ from enum import Enum
22
from functools import total_ordering
33
from io import BytesIO
44
from typing import Any, Callable, Optional, Set
5+
from typing_extensions import Self
56

67
import numpy as np
78
from matplotlib._enums import CapStyle, JoinStyle
@@ -217,7 +218,7 @@ class GraphicsContextPdf(GraphicsContextBase):
217218
joinstyles: dict[str, int] = ...
218219
def capstyle_cmd(self, style: CapStyle) -> list[int | Op]: ...
219220
def joinstyle_cmd(self, style: JoinStyle) -> list[int | Op]: ...
220-
def linewidth_cmd(self, width: int | float) -> list[float | Op]: ...
221+
def linewidth_cmd(self, width: float) -> list[float | Op]: ...
221222
def dash_cmd(self, dashes) -> list: ...
222223
def alpha_cmd(self, alpha: float, forced: bool, effective_alphas: tuple[float, float]) -> list[Name | Op]: ...
223224
def hatch_cmd(self, hatch: None, hatch_color: tuple[float, float, float, float]) -> list[Name | Op | float]: ...
@@ -239,7 +240,7 @@ class GraphicsContextPdf(GraphicsContextBase):
239240

240241
class PdfPages:
241242
def __init__(self, filename: str, keep_empty: bool = ..., metadata: dict[str, Any] = ...) -> None: ...
242-
def __enter__(self) -> PdfPages: ...
243+
def __enter__(self) -> Self: ...
243244
def __exit__(self, exc_type, exc_val, exc_tb) -> None: ...
244245
def close(self) -> None: ...
245246
def infodict(self) -> dict[str, Any]: ...

stubs/matplotlib/backends/backend_pgf.pyi

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from typing import Any, Callable
2+
from typing_extensions import Self
23

34
import numpy as np
45
from matplotlib import _api
@@ -89,7 +90,7 @@ class _BackendPgf(_Backend):
8990

9091
class PdfPages:
9192
def __init__(self, filename: str | PathLike, *, keep_empty: bool = True, metadata: dict[str, Any] = ...) -> None: ...
92-
def __enter__(self) -> PdfPages: ...
93+
def __enter__(self) -> Self: ...
9394
def __exit__(self, exc_type, exc_val, exc_tb) -> None: ...
9495
def close(self) -> None: ...
9596
def savefig(self, figure: Figure | int = ..., **kwargs) -> None: ...

stubs/matplotlib/backends/backend_qt.pyi

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ class FigureCanvasQT(QtWidgets.QWidget, FigureCanvasBase):
4747
def keyPressEvent(self, event) -> None: ...
4848
def keyReleaseEvent(self, event) -> None: ...
4949
def resizeEvent(self, event) -> None: ...
50-
def sizeHint(self) -> QtCore.QSize: ...
51-
def minumumSizeHint(self) -> QtCore.QSize: ...
50+
def sizeHint(self) -> QtCore.QSize: ... # type: ignore
51+
def minumumSizeHint(self) -> QtCore.QSize: ... # type: ignore
5252
def flush_events(self) -> None: ...
5353
def start_event_loop(self, timeout=...) -> None: ...
5454
def stop_event_loop(self, event=...) -> None: ...
@@ -58,7 +58,7 @@ class FigureCanvasQT(QtWidgets.QWidget, FigureCanvasBase):
5858
def drawRectangle(self, rect) -> None: ...
5959

6060
class MainWindow(QtWidgets.QMainWindow):
61-
closing: QtCore.Signal = ...
61+
closing: QtCore.Signal = ... # type: ignore
6262
def closeEvent(self, event) -> None: ...
6363

6464
class FigureManagerQT(FigureManagerBase):
@@ -71,7 +71,7 @@ class FigureManagerQT(FigureManagerBase):
7171
def set_window_title(self, title) -> None: ...
7272

7373
class NavigationToolbar2QT(NavigationToolbar2, QtWidgets.QToolBar):
74-
message: QtCore.Signal = ...
74+
message: QtCore.Signal = ... # type: ignore
7575
toolitems: list = ...
7676
def __init__(self, canvas, parent=..., coordinates=...) -> None: ...
7777
def edit_parameters(self) -> None: ...

stubs/matplotlib/cbook/__init__.pyi

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,7 @@ class Stack:
6363
def bubble(self, o): ...
6464
def remove(self, o) -> None: ...
6565

66-
def report_memory(i=...):
67-
...
68-
66+
def report_memory(i=...): ...
6967
def safe_masked_invalid(x, copy=...) -> np.ndarray: ...
7068
def print_cycles(objects, outstream=..., show_progress: bool = ...) -> None: ...
7169

0 commit comments

Comments
 (0)