Skip to content

Commit 97fb1da

Browse files
authored
Merge pull request #496 from numpy/bump-dev-deps
2 parents 3b13c9b + 2051dbc commit 97fb1da

File tree

13 files changed

+117
-112
lines changed

13 files changed

+117
-112
lines changed

lefthook.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ pre-commit:
1313
glob: "*.{py,pyi}"
1414
run: uv run --no-sync tool/format_ignores.py {staged_files}
1515
stage_fixed: true
16+
exclude:
17+
- "tool/test/test_format_ignores.py"
1618
docs-check:
1719
glob:
1820
- "docs/**"

pyproject.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,11 @@ dependencies = []
5050

5151
[dependency-groups]
5252
numpy = ["numtype[numpy]"]
53-
lint = ["ruff>=0.11.4"]
53+
lint = ["ruff>=0.11.5"]
5454
pytest = [
5555
{include-group = "numpy"},
5656
"pytest>=8.3.5",
57-
"typing_extensions>=4.13.1",
57+
"typing_extensions>=4.13.2",
5858
]
5959
list_and_test = [
6060
{include-group = "lint"},
@@ -68,7 +68,7 @@ types = [
6868
basedpyright = [
6969
{include-group = "numpy"},
7070
{include-group = "types"},
71-
"basedpyright>=1.28.4",
71+
"basedpyright>=1.28.5",
7272
]
7373
mypy = [
7474
{include-group = "types"},

src/_numtype/@test/test_to_array.pyi

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# ruff: noqa: PYI042, UP018
21
from typing import TypeAlias
32
from typing_extensions import TypeVar
43

src/numpy-stubs/__init__.pyi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8147,7 +8147,7 @@ class float64(floating[_n._64], float): # type: ignore[misc]
81478147
@overload
81488148
def __rfloordiv__(self, x: _CoFloat64, /) -> Self: ...
81498149
@overload
8150-
def __rfloordiv__(self, x: _JustFloating | _nt.Just[inexact], /) -> floating: ... # pyright: ignore[reportIncompatibleMethodOverride]
8150+
def __rfloordiv__(self, x: _JustFloating | _nt.Just[inexact], /) -> floating: ...
81518151

81528152
# keep in sync with `__truediv__` (minus the complex overloads)
81538153
@overload
@@ -8159,7 +8159,7 @@ class float64(floating[_n._64], float): # type: ignore[misc]
81598159
@overload
81608160
def __rmod__(self, x: _CoFloat64, /) -> Self: ...
81618161
@overload
8162-
def __rmod__(self, x: _JustFloating | _nt.Just[inexact], /) -> floating: ... # pyright: ignore[reportIncompatibleMethodOverride]
8162+
def __rmod__(self, x: _JustFloating | _nt.Just[inexact], /) -> floating: ...
81638163

81648164
# keep in sync with `__truediv__` (minus the complex overloads)
81658165
@overload

src/numpy-stubs/ma/core.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ class MaskedArray(np.ndarray[_ShapeT_co, _DTypeT_co]):
313313
@override
314314
def shape(self) -> _ShapeT_co: ...
315315
@shape.setter
316-
def shape(self: MaskedArray[_ShapeT], shape: _ShapeT, /) -> None: ... # pyright: ignore[reportIncompatibleMethodOverride]
316+
def shape(self: MaskedArray[_ShapeT], shape: _ShapeT, /) -> None: ...
317317

318318
#
319319
@property

src/numpy-stubs/matrixlib/defmatrix.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ class matrix(np.ndarray[_ShapeT_co, _DTypeT_co]):
231231
#
232232
@property
233233
@override
234-
def T(self) -> matrix[_2D, _DTypeT_co]: ... # type: ignore[override] # pyright: ignore[reportIncompatibleMethodOverride]
234+
def T(self) -> matrix[_2D, _DTypeT_co]: ... # type: ignore[override]
235235
def getT(self) -> matrix[_2D, _DTypeT_co]: ...
236236

237237
#

src/numpy-stubs/random/bit_generator.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ class ISeedSequence(abc.ABC):
9393

9494
class ISpawnableSeedSequence(ISeedSequence, abc.ABC):
9595
@abc.abstractmethod
96-
def spawn(self, /, n_children: int) -> list[Self]: ...
96+
def spawn(self, /, n_children: int) -> Sequence[Self]: ...
9797

9898
class SeedlessSeedSequence(_GenerateStateMixin, ISpawnableSeedSequence):
9999
@override

src/numpy-stubs/testing/_private/utils.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ class KnownFailureException(Exception): ...
129129
class IgnoreException(Exception): ...
130130

131131
# NOTE: `warnings.catch_warnings` is incorrectly defined as invariant in typeshed
132-
class clear_and_catch_warnings(warnings.catch_warnings[_W_co], Generic[_W_co]): # type: ignore[type-var] # pyright: ignore[reportInvalidTypeArguments]
132+
class clear_and_catch_warnings(warnings.catch_warnings[_W_co], Generic[_W_co]): # type: ignore[type-var]
133133
class_modules: ClassVar[tuple[types.ModuleType, ...]] = ()
134134
modules: Final[set[types.ModuleType]]
135135

tool/stubtest.py.lock

Lines changed: 21 additions & 21 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tool/test/test_format_ignores.py

Lines changed: 25 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
"""Test the format_ignores module."""
22

3-
# ruff: noqa: PLC2701
43
import errno
54
import sys
65
from pathlib import Path
@@ -14,6 +13,16 @@
1413
main,
1514
)
1615

16+
_TEST_SOURCE_TEMPLATE = """
17+
def func1() -> None:
18+
# {}
19+
pass
20+
21+
def func2() -> None:
22+
# {}
23+
pass
24+
""".lstrip()
25+
1726

1827
@pytest.mark.parametrize(
1928
("input_text", "expected_output"),
@@ -35,15 +44,16 @@ def test_sort_ignore_list(input_text: str, expected_output: str) -> None:
3544

3645
def test_process_file(tmpdir: pytest.TempdirFactory) -> None:
3746
"""Test _process_file function."""
38-
test_file = Path(str(tmpdir)) / "test.pyi"
39-
test_content = """def func1() -> None:
40-
# type: ignore[attr-defined, no-any-return]
41-
pass
47+
test_content = _TEST_SOURCE_TEMPLATE.format(
48+
"type: ignore[attr-defined, no-any-return]",
49+
"pyright: ignore[reportUnknownMemberType,reportUnknownVariableType]",
50+
)
51+
expected_content = _TEST_SOURCE_TEMPLATE.format(
52+
"type: ignore[attr-defined, no-any-return]",
53+
"pyright: ignore[reportUnknownMemberType, reportUnknownVariableType]",
54+
)
4255

43-
def func2() -> None:
44-
# pyright: ignore[reportUnknownMemberType,reportUnknownVariableType]
45-
pass
46-
"""
56+
test_file = Path(str(tmpdir)) / "test.pyi"
4757
test_file.write_text(test_content, encoding="utf-8")
4858

4959
# Check-only mode
@@ -54,15 +64,6 @@ def func2() -> None:
5464
# Processing mode
5565
modified = _process_file(test_file)
5666
assert modified is True
57-
58-
expected_content = """def func1() -> None:
59-
# type: ignore[attr-defined, no-any-return]
60-
pass
61-
62-
def func2() -> None:
63-
# pyright: ignore[reportUnknownMemberType, reportUnknownVariableType]
64-
pass
65-
"""
6667
assert test_file.read_text(encoding="utf-8") == expected_content
6768

6869
# Re-processing
@@ -95,7 +96,7 @@ def test_process_directory(tmpdir: pytest.TempdirFactory) -> None:
9596
encoding="utf-8",
9697
)
9798
test_files[2].write_text(
98-
"# pyright: ignore[reportUnknownVariableType,reportUnknownMemberType]",
99+
"# " + "pyright: ignore[reportUnknownVariableType,reportUnknownMemberType]",
99100
encoding="utf-8",
100101
)
101102
test_files[3].write_text(
@@ -134,7 +135,7 @@ def test_process_directory(tmpdir: pytest.TempdirFactory) -> None:
134135
)
135136
assert (
136137
test_files[2].read_text(encoding="utf-8")
137-
== "# pyright: ignore[reportUnknownMemberType, reportUnknownVariableType]"
138+
== "# " + "pyright: ignore[reportUnknownMemberType, reportUnknownVariableType]"
138139
)
139140
assert (
140141
test_files[3].read_text(encoding="utf-8")
@@ -206,7 +207,10 @@ def test_main_custom_pattern(
206207
"""Test main function with custom pattern."""
207208
temp_dir = Path(str(tmpdir))
208209
test_py = temp_dir / "test.py"
209-
test_py.write_text("# type: ignore[no-any-return, attr-defined]", encoding="utf-8")
210+
test_py.write_text(
211+
"# type: ignore[attr-defined, no-any-return]",
212+
encoding="utf-8",
213+
)
210214

211215
monkeypatch.setattr(
212216
sys,

0 commit comments

Comments
 (0)