🌐 AI搜索 & 代理 主页
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ dependencies:
- hypothesis
# For type annotations
- typing_extensions>=4.5.0
- mypy=1.15.0
- mypy=1.16.1
- orjson # makes mypy faster
# For building docs
- sphinx>=4.5.0
Expand Down
6 changes: 3 additions & 3 deletions numpy/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -3814,14 +3814,14 @@ class bool(generic[_BoolItemT_co], Generic[_BoolItemT_co]):
@property
def imag(self) -> np.bool[L[False]]: ...

@overload
def __init__(self: np.bool[L[False]], /) -> None: ...
@overload # mypy bug workaround: https://github.com/numpy/numpy/issues/29245
def __init__(self: np.bool[builtins.bool], value: Never, /) -> None: ...
@overload
def __init__(self: np.bool[L[False]], value: _Falsy = ..., /) -> None: ...
@overload
def __init__(self: np.bool[L[True]], value: _Truthy, /) -> None: ...
@overload
def __init__(self, value: object, /) -> None: ...
def __init__(self: np.bool[builtins.bool], value: object, /) -> None: ...

def __bool__(self, /) -> _BoolItemT_co: ...
@overload
Expand Down
2 changes: 2 additions & 0 deletions numpy/typing/tests/data/reveal/array_constructors.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ assert_type(np.array(B, subok=True), SubClass[np.float64])
assert_type(np.array(B, subok=True, ndmin=0), SubClass[np.float64])
assert_type(np.array(B, subok=True, ndmin=1), SubClass[np.float64])
assert_type(np.array(D), npt.NDArray[np.float64 | np.int64])
# https://github.com/numpy/numpy/issues/29245
assert_type(np.array([], dtype=np.bool), npt.NDArray[np.bool])

assert_type(np.zeros([1, 5, 6]), npt.NDArray[np.float64])
assert_type(np.zeros([1, 5, 6], dtype=np.int64), npt.NDArray[np.int64])
Expand Down
3 changes: 1 addition & 2 deletions numpy/typing/tests/data/reveal/ma.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -343,8 +343,7 @@ assert_type(MAR_b.swapaxes(0, 1), MaskedArray[np.bool])
assert_type(MAR_2d_f4.swapaxes(1, 0), MaskedArray[np.float32])

assert_type(np.ma.nomask, np.bool[Literal[False]])
# https://github.com/python/mypy/issues/18974
assert_type(np.ma.MaskType, type[np.bool]) # type: ignore[assert-type]
assert_type(np.ma.MaskType, type[np.bool])

assert_type(MAR_1d.__setmask__([True, False]), None)
assert_type(MAR_1d.__setmask__(np.False_), None)
Expand Down
2 changes: 1 addition & 1 deletion requirements/test_requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ pytest-timeout
# For testing types. Notes on the restrictions:
# - Mypy relies on C API features not present in PyPy
# NOTE: Keep mypy in sync with environment.yml
mypy==1.15.0; platform_python_implementation != "PyPy"
mypy==1.16.1; platform_python_implementation != "PyPy"
typing_extensions>=4.5.0
# for optional f2py encoding detection
charset-normalizer
Loading