From 686e404d0765ac584aac8d3ee2fbe81ced03fbf8 Mon Sep 17 00:00:00 2001 From: jorenham Date: Tue, 28 Jan 2025 16:45:49 +0100 Subject: [PATCH 1/3] =?UTF-8?q?=F0=9F=93=9D=20briefly=20describe=20the=20m?= =?UTF-8?q?echanism=20behind=20the=20rejection=20and=20acceptance=20static?= =?UTF-8?q?=20type-tests?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test/static/accept/README.md | 4 +++- test/static/reject/README.md | 7 ++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/test/static/accept/README.md b/test/static/accept/README.md index a23aa7d..10b702c 100644 --- a/test/static/accept/README.md +++ b/test/static/accept/README.md @@ -1 +1,3 @@ -Static acceptance type-tests for true negatives. +# Static acceptance type-tests for true negatives + +This mainly relies on `typing_extensions.assert_type`. diff --git a/test/static/reject/README.md b/test/static/reject/README.md index 4d62693..c6757e8 100644 --- a/test/static/reject/README.md +++ b/test/static/reject/README.md @@ -1 +1,6 @@ -Static rejection type-tests for true positives. +# Static rejection type-tests for true positives + +For (based)mypy, this requires the `ignore-without-code` error code and the `warn_unused_ignores` +setting to be enabled. +For (based)pyright, the `enableTypeIgnoreComments` and `reportUnnecessaryTypeIgnoreComment` rules +must be enabled. From c5ed92fae1eec7b61b44c2f315632ad6ea23ddef Mon Sep 17 00:00:00 2001 From: jorenham Date: Tue, 28 Jan 2025 16:46:53 +0100 Subject: [PATCH 2/3] =?UTF-8?q?=E2=9C=85=20migrate=20numpy's=20static=20re?= =?UTF-8?q?jections=20tests=20for=20specific=20error=20codes?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test/static/reject/arithmetic.pyi | 140 +++++----- test/static/reject/array_constructors.pyi | 42 +-- test/static/reject/array_like.pyi | 10 +- test/static/reject/array_pad.pyi | 2 +- test/static/reject/arrayprint.pyi | 12 +- test/static/reject/arrayterator.pyi | 16 +- test/static/reject/bitwise_ops.pyi | 35 ++- test/static/reject/char.pyi | 94 ++++--- test/static/reject/chararray.pyi | 114 ++++---- test/static/reject/comparisons.pyi | 42 +-- test/static/reject/constants.pyi | 2 +- test/static/reject/datasource.pyi | 14 +- test/static/reject/dtype.pyi | 24 +- test/static/reject/einsumfunc.pyi | 12 +- test/static/reject/flatiter.pyi | 23 +- test/static/reject/fromnumeric.pyi | 301 ++++++++++----------- test/static/reject/histograms.pyi | 8 +- test/static/reject/index_tricks.pyi | 25 +- test/static/reject/lib_function_base.pyi | 97 +++---- test/static/reject/lib_polynomial.pyi | 30 +- test/static/reject/lib_utils.pyi | 2 +- test/static/reject/lib_version.pyi | 4 +- test/static/reject/linalg.pyi | 54 ++-- test/static/reject/memmap.pyi | 5 +- test/static/reject/modules.pyi | 23 +- test/static/reject/multiarray.pyi | 54 ++-- test/static/reject/ndarray.pyi | 15 +- test/static/reject/ndarray_misc.pyi | 52 ++-- test/static/reject/nditer.pyi | 10 +- test/static/reject/nested_sequence.pyi | 10 +- test/static/reject/npyio.pyi | 18 +- test/static/reject/numerictypes.pyi | 5 +- test/static/reject/rec.pyi | 28 +- test/static/reject/ruff.toml | 6 +- test/static/reject/scalars.pyi | 133 ++++----- test/static/reject/shape.pyi | 2 +- test/static/reject/shape_base.pyi | 2 +- test/static/reject/stride_tricks.pyi | 8 +- test/static/reject/strings.pyi | 111 ++++---- test/static/reject/testing.pyi | 34 +-- test/static/reject/twodim_base.pyi | 24 +- test/static/reject/type_check.pyi | 12 +- test/static/reject/ufunc_config.pyi | 18 +- test/static/reject/ufunclike.pyi | 22 +- test/static/reject/ufuncs.pyi | 17 +- test/static/reject/warnings_and_errors.pyi | 6 +- 46 files changed, 856 insertions(+), 862 deletions(-) diff --git a/test/static/reject/arithmetic.pyi b/test/static/reject/arithmetic.pyi index 3924204..d66b5b8 100644 --- a/test/static/reject/arithmetic.pyi +++ b/test/static/reject/arithmetic.pyi @@ -28,96 +28,96 @@ AR_LIKE_M: list[np.datetime64] # Array subtraction # NOTE: mypys `NoReturn` errors are, unfortunately, not that great -_1 = ... # E: Need type annotation -_2 = ... # E: Need type annotation -AR_i - b"" # E: No overload variant +_1 = AR_b - AR_LIKE_b # type: ignore[var-annotated] +_2 = AR_LIKE_b - AR_b # type: ignore[var-annotated] +AR_i - b"" # type: ignore[operator] # pyright: ignore[reportOperatorIssue] -AR_f - AR_LIKE_m # E: Unsupported operand types -AR_f - AR_LIKE_M # E: Unsupported operand types -AR_c - AR_LIKE_m # E: Unsupported operand types -AR_c - AR_LIKE_M # E: Unsupported operand types +AR_f - AR_LIKE_m # type: ignore[operator] # pyright: ignore[reportOperatorIssue] +AR_f - AR_LIKE_M # type: ignore[operator] # pyright: ignore[reportOperatorIssue] +AR_c - AR_LIKE_m # type: ignore[operator] # pyright: ignore[reportOperatorIssue] +AR_c - AR_LIKE_M # type: ignore[operator] # pyright: ignore[reportOperatorIssue] -AR_m - AR_LIKE_f # E: Unsupported operand types -AR_M - AR_LIKE_f # E: Unsupported operand types -AR_m - AR_LIKE_c # E: Unsupported operand types -AR_M - AR_LIKE_c # E: Unsupported operand types +AR_m - AR_LIKE_f # type: ignore[operator] # pyright: ignore[reportOperatorIssue] +AR_M - AR_LIKE_f # type: ignore[operator] # pyright: ignore[reportOperatorIssue] +AR_m - AR_LIKE_c # type: ignore[operator] # pyright: ignore[reportOperatorIssue] +AR_M - AR_LIKE_c # type: ignore[operator] # pyright: ignore[reportOperatorIssue] -AR_m - AR_LIKE_M # E: Unsupported operand types -AR_LIKE_m - AR_M # E: Unsupported operand types +AR_m - AR_LIKE_M # type: ignore[operator] # pyright: ignore[reportOperatorIssue] +AR_LIKE_m - AR_M # type: ignore[operator] # pyright: ignore[reportOperatorIssue] # array floor division -AR_M // AR_LIKE_b # E: Unsupported operand types -AR_M // AR_LIKE_u # E: Unsupported operand types -AR_M // AR_LIKE_i # E: Unsupported operand types -AR_M // AR_LIKE_f # E: Unsupported operand types -AR_M // AR_LIKE_c # E: Unsupported operand types -AR_M // AR_LIKE_m # E: Unsupported operand types -AR_M // AR_LIKE_M # E: Unsupported operand types - -AR_b // AR_LIKE_M # E: Unsupported operand types -AR_u // AR_LIKE_M # E: Unsupported operand types -AR_i // AR_LIKE_M # E: Unsupported operand types -AR_f // AR_LIKE_M # E: Unsupported operand types -AR_c // AR_LIKE_M # E: Unsupported operand types -AR_m // AR_LIKE_M # E: Unsupported operand types -AR_M // AR_LIKE_M # E: Unsupported operand types - -_3 = ... # E: Need type annotation -AR_m // AR_LIKE_c # E: Unsupported operand types - -AR_b // AR_LIKE_m # E: Unsupported operand types -AR_u // AR_LIKE_m # E: Unsupported operand types -AR_i // AR_LIKE_m # E: Unsupported operand types -AR_f // AR_LIKE_m # E: Unsupported operand types -AR_c // AR_LIKE_m # E: Unsupported operand types +AR_M // AR_LIKE_b # type: ignore[operator] # pyright: ignore[reportOperatorIssue] +AR_M // AR_LIKE_u # type: ignore[operator] # pyright: ignore[reportOperatorIssue] +AR_M // AR_LIKE_i # type: ignore[operator] # pyright: ignore[reportOperatorIssue] +AR_M // AR_LIKE_f # type: ignore[operator] # pyright: ignore[reportOperatorIssue] +AR_M // AR_LIKE_c # type: ignore[operator] # pyright: ignore[reportOperatorIssue] +AR_M // AR_LIKE_m # type: ignore[operator] # pyright: ignore[reportOperatorIssue] +AR_M // AR_LIKE_M # type: ignore[operator] # pyright: ignore[reportOperatorIssue] + +AR_b // AR_LIKE_M # type: ignore[operator] # pyright: ignore[reportOperatorIssue] +AR_u // AR_LIKE_M # type: ignore[operator] # pyright: ignore[reportOperatorIssue] +AR_i // AR_LIKE_M # type: ignore[operator] # pyright: ignore[reportOperatorIssue] +AR_f // AR_LIKE_M # type: ignore[operator] # pyright: ignore[reportOperatorIssue] +AR_c // AR_LIKE_M # type: ignore[operator] # pyright: ignore[reportOperatorIssue] +AR_m // AR_LIKE_M # type: ignore[operator] # pyright: ignore[reportOperatorIssue] +AR_M // AR_LIKE_M # type: ignore[operator] # pyright: ignore[reportOperatorIssue] + +_3 = AR_m // AR_LIKE_b # type: ignore[var-annotated] +AR_m // AR_LIKE_c # type: ignore[operator] # pyright: ignore[reportOperatorIssue] + +AR_b // AR_LIKE_m # type: ignore[operator] # pyright: ignore[reportOperatorIssue] +AR_u // AR_LIKE_m # type: ignore[operator] # pyright: ignore[reportOperatorIssue] +AR_i // AR_LIKE_m # type: ignore[operator] # pyright: ignore[reportOperatorIssue] +AR_f // AR_LIKE_m # type: ignore[operator] # pyright: ignore[reportOperatorIssue] +AR_c // AR_LIKE_m # type: ignore[operator] # pyright: ignore[reportOperatorIssue] # Array multiplication -AR_b *= AR_LIKE_u # E: incompatible type -AR_b *= AR_LIKE_i # E: incompatible type -AR_b *= AR_LIKE_f # E: incompatible type -AR_b *= AR_LIKE_c # E: incompatible type -AR_b *= AR_LIKE_m # E: incompatible type +AR_b *= AR_LIKE_u # type: ignore[arg-type] # pyright: ignore[reportAssignmentType] +AR_b *= AR_LIKE_i # type: ignore[arg-type] # pyright: ignore[reportAssignmentType] +AR_b *= AR_LIKE_f # type: ignore[arg-type] # pyright: ignore[reportAssignmentType] +AR_b *= AR_LIKE_c # type: ignore[arg-type] # pyright: ignore[reportAssignmentType] +AR_b *= AR_LIKE_m # type: ignore[arg-type] # pyright: ignore[reportAssignmentType] -AR_u *= AR_LIKE_i # E: incompatible type -AR_u *= AR_LIKE_f # E: incompatible type -AR_u *= AR_LIKE_c # E: incompatible type -AR_u *= AR_LIKE_m # E: incompatible type +AR_u *= AR_LIKE_i # type: ignore[arg-type] # pyright: ignore[reportAssignmentType] +AR_u *= AR_LIKE_f # type: ignore[arg-type] # pyright: ignore[reportAssignmentType] +AR_u *= AR_LIKE_c # type: ignore[arg-type] # pyright: ignore[reportAssignmentType] +AR_u *= AR_LIKE_m # type: ignore[arg-type] # pyright: ignore[reportAssignmentType] -AR_i *= AR_LIKE_f # E: incompatible type -AR_i *= AR_LIKE_c # E: incompatible type -AR_i *= AR_LIKE_m # E: incompatible type +AR_i *= AR_LIKE_f # type: ignore[arg-type] # pyright: ignore[reportAssignmentType] +AR_i *= AR_LIKE_c # type: ignore[arg-type] # pyright: ignore[reportAssignmentType] +AR_i *= AR_LIKE_m # type: ignore[arg-type] # pyright: ignore[reportAssignmentType] -AR_f *= AR_LIKE_c # E: incompatible type -AR_f *= AR_LIKE_m # E: incompatible type +AR_f *= AR_LIKE_c # type: ignore[arg-type] # pyright: ignore[reportAssignmentType] +AR_f *= AR_LIKE_m # type: ignore[arg-type] # pyright: ignore[reportAssignmentType] # Array power -AR_b **= AR_LIKE_b # E: Invalid self argument -AR_b **= AR_LIKE_u # E: Invalid self argument -AR_b **= AR_LIKE_i # E: Invalid self argument -AR_b **= AR_LIKE_f # E: Invalid self argument -AR_b **= AR_LIKE_c # E: Invalid self argument +AR_b **= AR_LIKE_b # type: ignore[misc] # pyright: ignore[reportAssignmentType] +AR_b **= AR_LIKE_u # type: ignore[misc] # pyright: ignore[reportAssignmentType] +AR_b **= AR_LIKE_i # type: ignore[misc] # pyright: ignore[reportAssignmentType] +AR_b **= AR_LIKE_f # type: ignore[misc] # pyright: ignore[reportAssignmentType] +AR_b **= AR_LIKE_c # type: ignore[misc] # pyright: ignore[reportAssignmentType] -AR_u **= AR_LIKE_i # E: incompatible type -AR_u **= AR_LIKE_f # E: incompatible type -AR_u **= AR_LIKE_c # E: incompatible type +AR_u **= AR_LIKE_i # type: ignore[arg-type] # pyright: ignore[reportAssignmentType] +AR_u **= AR_LIKE_f # type: ignore[arg-type] # pyright: ignore[reportAssignmentType] +AR_u **= AR_LIKE_c # type: ignore[arg-type] # pyright: ignore[reportAssignmentType] -AR_i **= AR_LIKE_f # E: incompatible type -AR_i **= AR_LIKE_c # E: incompatible type +AR_i **= AR_LIKE_f # type: ignore[arg-type] # pyright: ignore[reportAssignmentType] +AR_i **= AR_LIKE_c # type: ignore[arg-type] # pyright: ignore[reportAssignmentType] -AR_f **= AR_LIKE_c # E: incompatible type +AR_f **= AR_LIKE_c # type: ignore[arg-type] # pyright: ignore[reportAssignmentType] # Scalars -b_ - b_ # E: No overload variant +b_ - b_ # type: ignore[call-overload] # pyright: ignore[reportOperatorIssue] -dt + dt # E: Unsupported operand types -td - dt # E: Unsupported operand types -td % 1 # E: Unsupported operand types -td / dt # E: No overload -td % dt # E: Unsupported operand types +dt + dt # type: ignore[operator] # pyright: ignore[reportOperatorIssue] +td - dt # type: ignore[operator] # pyright: ignore[reportOperatorIssue] +td % 1 # type: ignore[operator] # pyright: ignore[reportOperatorIssue] +td / dt # type: ignore[operator] # pyright: ignore[reportOperatorIssue] +td % dt # type: ignore[operator] # pyright: ignore[reportOperatorIssue] --b_ # E: Unsupported operand type -+b_ # E: Unsupported operand type +-b_ # type: ignore[operator] # pyright: ignore[reportOperatorIssue] ++b_ # type: ignore[operator] # pyright: ignore[reportOperatorIssue] diff --git a/test/static/reject/array_constructors.pyi b/test/static/reject/array_constructors.pyi index 366ac26..8604aec 100644 --- a/test/static/reject/array_constructors.pyi +++ b/test/static/reject/array_constructors.pyi @@ -2,33 +2,33 @@ import numpy as np import numpy.typing as npt a: npt.NDArray[np.float64] -generator = ... +generator = (i for i in range(10)) -np.require(a, requirements=1) # E: No overload variant -np.require(a, requirements="TEST") # E: incompatible type +np.require(a, requirements=1) # type: ignore[call-overload] # pyright: ignore[reportCallIssue,reportArgumentType] +np.require(a, requirements="TEST") # type: ignore[arg-type] # pyright: ignore[reportCallIssue,reportArgumentType] -np.zeros("test") # E: incompatible type -np.zeros() # E: require at least one argument +np.zeros("test") # type: ignore[arg-type] # pyright: ignore[reportCallIssue,reportArgumentType] +np.zeros() # type: ignore[call-overload] # pyright: ignore[reportCallIssue] -np.ones("test") # E: incompatible type -np.ones() # E: require at least one argument +np.ones("test") # type: ignore[arg-type] # pyright: ignore[reportCallIssue,reportArgumentType] +np.ones() # type: ignore[call-overload] # pyright: ignore[reportCallIssue] -np.array(0, float, True) # E: No overload variant +np.array(0, float, True) # type: ignore[call-overload] # pyright: ignore[reportCallIssue] -np.linspace(None, "bob") # E: No overload variant -np.linspace(0, 2, num=10.0) # E: No overload variant -np.linspace(0, 2, endpoint="True") # E: No overload variant -np.linspace(0, 2, retstep=b"False") # E: No overload variant -np.linspace(0, 2, dtype=0) # E: No overload variant -np.linspace(0, 2, axis=None) # E: No overload variant +np.linspace(None, "bob") # type: ignore[call-overload] # pyright: ignore[reportCallIssue,reportArgumentType] +np.linspace(0, 2, num=10.0) # type: ignore[call-overload] # pyright: ignore[reportCallIssue,reportArgumentType] +np.linspace(0, 2, endpoint="True") # type: ignore[call-overload] # pyright: ignore[reportCallIssue,reportArgumentType] +np.linspace(0, 2, retstep=b"False") # type: ignore[call-overload] # pyright: ignore[reportCallIssue,reportArgumentType] +np.linspace(0, 2, dtype=0) # type: ignore[call-overload] # pyright: ignore[reportCallIssue,reportArgumentType] +np.linspace(0, 2, axis=None) # type: ignore[call-overload] # pyright: ignore[reportCallIssue,reportArgumentType] -np.logspace(None, "bob") # E: No overload variant -np.logspace(0, 2, base=None) # E: No overload variant +np.logspace(None, "bob") # type: ignore[call-overload] # pyright: ignore[reportCallIssue,reportArgumentType] +np.logspace(0, 2, base=None) # type: ignore[call-overload] # pyright: ignore[reportCallIssue,reportArgumentType] -np.geomspace(None, "bob") # E: No overload variant +np.geomspace(None, "bob") # type: ignore[call-overload] # pyright: ignore[reportCallIssue,reportArgumentType] -np.stack(generator) # E: No overload variant -np.hstack({1, 2}) # E: No overload variant -np.vstack(1) # E: No overload variant +np.stack(generator) # type: ignore[call-overload] # pyright: ignore[reportCallIssue,reportArgumentType] +np.hstack({1, 2}) # type: ignore[call-overload] # pyright: ignore[reportCallIssue,reportArgumentType] +np.vstack(1) # type: ignore[call-overload] # pyright: ignore[reportCallIssue,reportArgumentType] -np.array([1], like=1) # E: No overload variant +np.array([1], like=1) # type: ignore[call-overload] # pyright: ignore[reportCallIssue,reportArgumentType] diff --git a/test/static/reject/array_like.pyi b/test/static/reject/array_like.pyi index e99a694..daeb92d 100644 --- a/test/static/reject/array_like.pyi +++ b/test/static/reject/array_like.pyi @@ -3,11 +3,11 @@ from numpy._typing import ArrayLike class A: ... -x1: ArrayLike = ... # E: Incompatible types in assignment -x2: ArrayLike = ... # E: Incompatible types in assignment -x3: ArrayLike = {1: "foo", 2: "bar"} # E: Incompatible types in assignment +x1: ArrayLike = (i for i in range(10)) # type: ignore[assignment] # pyright: ignore[reportAssignmentType] +x2: ArrayLike = A() # type: ignore[assignment] # pyright: ignore[reportAssignmentType] +x3: ArrayLike = {1: "foo", 2: "bar"} # type: ignore[assignment] # pyright: ignore[reportAssignmentType] scalar = np.int64(1) -scalar.__array__(dtype=np.float64) # E: No overload variant +scalar.__array__(dtype=np.float64) # type: ignore[call-overload] # pyright: ignore[reportCallIssue] array = np.array([1]) -array.__array__(dtype=np.float64) # E: No overload variant +array.__array__(dtype=np.float64) # type: ignore[call-overload] # pyright: ignore[reportCallIssue] diff --git a/test/static/reject/array_pad.pyi b/test/static/reject/array_pad.pyi index 2be51a8..0b99071 100644 --- a/test/static/reject/array_pad.pyi +++ b/test/static/reject/array_pad.pyi @@ -3,4 +3,4 @@ import numpy.typing as npt AR_i8: npt.NDArray[np.int64] -np.pad(AR_i8, 2, mode="bob") # E: No overload variant +np.pad(AR_i8, 2, mode="bob") # type: ignore[call-overload] # pyright: ignore[reportCallIssue,reportArgumentType] diff --git a/test/static/reject/arrayprint.pyi b/test/static/reject/arrayprint.pyi index f8c8a32..ccb91f3 100644 --- a/test/static/reject/arrayprint.pyi +++ b/test/static/reject/arrayprint.pyi @@ -8,9 +8,9 @@ AR: npt.NDArray[np.float64] func1: Callable[[Any], str] func2: Callable[[np.integer[Any]], str] -np.array2string(AR, style=None) # E: Unexpected keyword argument -np.array2string(AR, legacy="1.14") # E: incompatible type -np.array2string(AR, sign="*") # E: incompatible type -np.array2string(AR, floatmode="default") # E: incompatible type -np.array2string(AR, formatter={"A": func1}) # E: incompatible type -np.array2string(AR, formatter={"float": func2}) # E: Incompatible types +np.array2string(AR, style=None) # type: ignore[call-arg] # pyright: ignore[reportCallIssue] +np.array2string(AR, legacy="1.14") # type: ignore[arg-type] # pyright: ignore[reportArgumentType] +np.array2string(AR, sign="*") # type: ignore[arg-type] # pyright: ignore[reportArgumentType] +np.array2string(AR, floatmode="default") # type: ignore[arg-type] # pyright: ignore[reportArgumentType] +np.array2string(AR, formatter={"A": func1}) # type: ignore[arg-type] # pyright: ignore[reportArgumentType] +np.array2string(AR, formatter={"float": func2}) # type: ignore[typeddict-item] # pyright: ignore[reportArgumentType] diff --git a/test/static/reject/arrayterator.pyi b/test/static/reject/arrayterator.pyi index 00280b3..c0b29d1 100644 --- a/test/static/reject/arrayterator.pyi +++ b/test/static/reject/arrayterator.pyi @@ -4,11 +4,11 @@ import numpy.typing as npt AR_i8: npt.NDArray[np.int64] ar_iter = np.lib.Arrayterator(AR_i8) -np.lib.Arrayterator(np.int64()) # E: incompatible type -ar_iter.shape = (10, 5) # E: is read-only -ar_iter[None] # E: Invalid index type -ar_iter[None, 1] # E: Invalid index type -ar_iter[np.intp()] # E: Invalid index type -ar_iter[np.intp(), ...] # E: Invalid index type -ar_iter[AR_i8] # E: Invalid index type -ar_iter[AR_i8, :] # E: Invalid index type +np.lib.Arrayterator(np.int64()) # type: ignore[arg-type] # pyright: ignore[reportArgumentType] +ar_iter.shape = (10, 5) # type: ignore[misc] # pyright: ignore[reportAttributeAccessIssue] +ar_iter[None] # type: ignore[index] # pyright: ignore[reportArgumentType] +ar_iter[None, 1] # type: ignore[index] # pyright: ignore[reportArgumentType] +ar_iter[np.intp()] # type: ignore[index] # pyright: ignore[reportArgumentType] +ar_iter[np.intp(), ...] # type: ignore[index] # pyright: ignore[reportArgumentType] +ar_iter[AR_i8] # type: ignore[index] # pyright: ignore[reportArgumentType] +ar_iter[AR_i8, :] # type: ignore[index] # pyright: ignore[reportArgumentType] diff --git a/test/static/reject/bitwise_ops.pyi b/test/static/reject/bitwise_ops.pyi index 1302833..8676e75 100644 --- a/test/static/reject/bitwise_ops.pyi +++ b/test/static/reject/bitwise_ops.pyi @@ -2,22 +2,31 @@ from typing import Final import numpy as np -i8: Final[np.int64] = ... +i0: Final[int] = ... + +b1: Final[np.bool] = ... i4: Final[np.int32] = ... +i8: Final[np.int64] = ... u8: Final[np.uint64] = ... -b_: Final[np.bool] = ... -i: Final[int] = 0 +f8: Final[np.float64] = ... -f8 = np.float64() +### -b_ >> f8 # E: No overload variant -i8 << f8 # E: No overload variant -i | f8 # E: Unsupported operand types -i8 ^ f8 # E: No overload variant -u8 & f8 # E: No overload variant -~f8 # E: Unsupported operand type # TODO: Certain mixes like i4 << u8 go to float and thus should fail -# mypys' error message for `NoReturn` is unfortunately pretty bad -# TODO: Re-enable this once we add support for numerical precision for `number`s -# a = u8 | 0 # E: Need type annotation +~f8 # type: ignore[operator] # pyright: ignore[reportOperatorIssue] + +b1 >> f8 # type: ignore[call-overload] # pyright: ignore[reportOperatorIssue] +f8 >> b1 # type: ignore[call-overload] # pyright: ignore[reportOperatorIssue] + +i8 << f8 # type: ignore[call-overload] # pyright: ignore[reportOperatorIssue] +f8 << i8 # type: ignore[call-overload] # pyright: ignore[reportOperatorIssue] + +f8 | i0 # type: ignore[operator] # pyright: ignore[reportOperatorIssue] +i0 | f8 # type: ignore[operator] # pyright: ignore[reportOperatorIssue] + +f8 ^ i8 # type: ignore[call-overload] # pyright: ignore[reportOperatorIssue] +i8 ^ f8 # type: ignore[call-overload] # pyright: ignore[reportOperatorIssue] + +f8 & u8 # type: ignore[call-overload] # pyright: ignore[reportOperatorIssue] +u8 & f8 # type: ignore[call-overload] # pyright: ignore[reportOperatorIssue] diff --git a/test/static/reject/char.pyi b/test/static/reject/char.pyi index 542a273..49f4d3b 100644 --- a/test/static/reject/char.pyi +++ b/test/static/reject/char.pyi @@ -4,66 +4,64 @@ import numpy.typing as npt AR_U: npt.NDArray[np.str_] AR_S: npt.NDArray[np.bytes_] -np.char.equal(AR_U, AR_S) # E: incompatible type +np.char.equal(AR_U, AR_S) # type: ignore[arg-type] # pyright: ignore[reportCallIssue,reportArgumentType] +np.char.not_equal(AR_U, AR_S) # type: ignore[arg-type] # pyright: ignore[reportCallIssue,reportArgumentType] +np.char.greater_equal(AR_U, AR_S) # type: ignore[arg-type] # pyright: ignore[reportCallIssue,reportArgumentType] +np.char.greater(AR_U, AR_S) # type: ignore[arg-type] # pyright: ignore[reportCallIssue,reportArgumentType] +np.char.less_equal(AR_U, AR_S) # type: ignore[arg-type] # pyright: ignore[reportCallIssue,reportArgumentType] +np.char.less(AR_U, AR_S) # type: ignore[arg-type] # pyright: ignore[reportCallIssue,reportArgumentType] -np.char.not_equal(AR_U, AR_S) # E: incompatible type +np.char.encode(AR_S) # type: ignore[arg-type] # pyright: ignore[reportArgumentType] +np.char.decode(AR_U) # type: ignore[arg-type] # pyright: ignore[reportArgumentType] -np.char.greater_equal(AR_U, AR_S) # E: incompatible type +np.char.join(AR_U, b"_") # type: ignore[arg-type] # pyright: ignore[reportCallIssue,reportArgumentType] +np.char.join(AR_S, "_") # type: ignore[arg-type] # pyright: ignore[reportCallIssue,reportArgumentType] -np.char.less_equal(AR_U, AR_S) # E: incompatible type +np.char.ljust(AR_U, 5, fillchar=b"a") # type: ignore[arg-type] # pyright: ignore[reportCallIssue,reportArgumentType] +np.char.rjust(AR_U, 5, fillchar=b"a") # type: ignore[arg-type] # pyright: ignore[reportCallIssue,reportArgumentType] -np.char.greater(AR_U, AR_S) # E: incompatible type +np.char.ljust(AR_S, 5, fillchar="a") # type: ignore[arg-type] # pyright: ignore[reportCallIssue,reportArgumentType] +np.char.rjust(AR_S, 5, fillchar="a") # type: ignore[arg-type] # pyright: ignore[reportCallIssue,reportArgumentType] -np.char.less(AR_U, AR_S) # E: incompatible type +np.char.strip(AR_U, chars=b"a") # type: ignore[arg-type] # pyright: ignore[reportCallIssue,reportArgumentType] +np.char.lstrip(AR_U, chars=b"a") # type: ignore[arg-type] # pyright: ignore[reportCallIssue,reportArgumentType] +np.char.rstrip(AR_U, chars=b"a") # type: ignore[arg-type] # pyright: ignore[reportCallIssue,reportArgumentType] -np.char.encode(AR_S) # E: incompatible type -np.char.decode(AR_U) # E: incompatible type +np.char.strip(AR_S, chars="a") # type: ignore[arg-type] # pyright: ignore[reportCallIssue,reportArgumentType] +np.char.lstrip(AR_S, chars="a") # type: ignore[arg-type] # pyright: ignore[reportCallIssue,reportArgumentType] +np.char.rstrip(AR_S, chars="a") # type: ignore[arg-type] # pyright: ignore[reportCallIssue,reportArgumentType] -np.char.join(AR_U, b"_") # E: incompatible type -np.char.join(AR_S, "_") # E: incompatible type +np.char.partition(AR_U, b"a") # type: ignore[arg-type] # pyright: ignore[reportCallIssue,reportArgumentType] +np.char.rpartition(AR_U, b"a") # type: ignore[arg-type] # pyright: ignore[reportCallIssue,reportArgumentType] -np.char.ljust(AR_U, 5, fillchar=b"a") # E: incompatible type -np.char.ljust(AR_S, 5, fillchar="a") # E: incompatible type -np.char.rjust(AR_U, 5, fillchar=b"a") # E: incompatible type -np.char.rjust(AR_S, 5, fillchar="a") # E: incompatible type +np.char.partition(AR_S, "a") # type: ignore[arg-type] # pyright: ignore[reportCallIssue,reportArgumentType] +np.char.rpartition(AR_S, "a") # type: ignore[arg-type] # pyright: ignore[reportCallIssue,reportArgumentType] -np.char.lstrip(AR_U, chars=b"a") # E: incompatible type -np.char.lstrip(AR_S, chars="a") # E: incompatible type -np.char.strip(AR_U, chars=b"a") # E: incompatible type -np.char.strip(AR_S, chars="a") # E: incompatible type -np.char.rstrip(AR_U, chars=b"a") # E: incompatible type -np.char.rstrip(AR_S, chars="a") # E: incompatible type +np.char.replace(AR_U, b"_", b"-") # type: ignore[arg-type] # pyright: ignore[reportCallIssue,reportArgumentType] +np.char.replace(AR_S, "_", "-") # type: ignore[arg-type] # pyright: ignore[reportCallIssue,reportArgumentType] -np.char.partition(AR_U, b"a") # E: incompatible type -np.char.partition(AR_S, "a") # E: incompatible type -np.char.rpartition(AR_U, b"a") # E: incompatible type -np.char.rpartition(AR_S, "a") # E: incompatible type +np.char.split(AR_U, b"_") # type: ignore[arg-type] # pyright: ignore[reportCallIssue,reportArgumentType] +np.char.rsplit(AR_U, b"_") # type: ignore[arg-type] # pyright: ignore[reportCallIssue,reportArgumentType] +np.char.split(AR_S, "_") # type: ignore[arg-type] # pyright: ignore[reportCallIssue,reportArgumentType] +np.char.rsplit(AR_S, "_") # type: ignore[arg-type] # pyright: ignore[reportCallIssue,reportArgumentType] -np.char.replace(AR_U, b"_", b"-") # E: incompatible type -np.char.replace(AR_S, "_", "-") # E: incompatible type +np.char.count(AR_U, b"a", start=[1, 2, 3]) # type: ignore[arg-type] # pyright: ignore[reportCallIssue,reportArgumentType] +np.char.count(AR_S, "a", end=9) # type: ignore[arg-type] # pyright: ignore[reportCallIssue,reportArgumentType] -np.char.split(AR_U, b"_") # E: incompatible type -np.char.split(AR_S, "_") # E: incompatible type -np.char.rsplit(AR_U, b"_") # E: incompatible type -np.char.rsplit(AR_S, "_") # E: incompatible type +np.char.endswith(AR_U, b"a", start=[1, 2, 3]) # type: ignore[arg-type] # pyright: ignore[reportCallIssue,reportArgumentType] +np.char.startswith(AR_U, b"a", start=[1, 2, 3]) # type: ignore[arg-type] # pyright: ignore[reportCallIssue,reportArgumentType] +np.char.endswith(AR_S, "a", end=9) # type: ignore[arg-type] # pyright: ignore[reportCallIssue,reportArgumentType] +np.char.startswith(AR_S, "a", end=9) # type: ignore[arg-type] # pyright: ignore[reportCallIssue,reportArgumentType] -np.char.count(AR_U, b"a", start=[1, 2, 3]) # E: incompatible type -np.char.count(AR_S, "a", end=9) # E: incompatible type +np.char.find(AR_U, b"a", start=[1, 2, 3]) # type: ignore[arg-type] # pyright: ignore[reportCallIssue,reportArgumentType] +np.char.rfind(AR_U, b"a", start=[1, 2, 3]) # type: ignore[arg-type] # pyright: ignore[reportCallIssue,reportArgumentType] +np.char.find(AR_S, "a", end=9) # type: ignore[arg-type] # pyright: ignore[reportCallIssue,reportArgumentType] +np.char.rfind(AR_S, "a", end=9) # type: ignore[arg-type] # pyright: ignore[reportCallIssue,reportArgumentType] -np.char.endswith(AR_U, b"a", start=[1, 2, 3]) # E: incompatible type -np.char.endswith(AR_S, "a", end=9) # E: incompatible type -np.char.startswith(AR_U, b"a", start=[1, 2, 3]) # E: incompatible type -np.char.startswith(AR_S, "a", end=9) # E: incompatible type +np.char.index(AR_U, b"a", start=[1, 2, 3]) # type: ignore[arg-type] # pyright: ignore[reportCallIssue,reportArgumentType] +np.char.rindex(AR_U, b"a", start=[1, 2, 3]) # type: ignore[arg-type] # pyright: ignore[reportCallIssue,reportArgumentType] +np.char.index(AR_S, "a", end=9) # type: ignore[arg-type] # pyright: ignore[reportCallIssue,reportArgumentType] +np.char.rindex(AR_S, "a", end=9) # type: ignore[arg-type] # pyright: ignore[reportCallIssue,reportArgumentType] -np.char.find(AR_U, b"a", start=[1, 2, 3]) # E: incompatible type -np.char.find(AR_S, "a", end=9) # E: incompatible type -np.char.rfind(AR_U, b"a", start=[1, 2, 3]) # E: incompatible type -np.char.rfind(AR_S, "a", end=9) # E: incompatible type - -np.char.index(AR_U, b"a", start=[1, 2, 3]) # E: incompatible type -np.char.index(AR_S, "a", end=9) # E: incompatible type -np.char.rindex(AR_U, b"a", start=[1, 2, 3]) # E: incompatible type -np.char.rindex(AR_S, "a", end=9) # E: incompatible type - -np.char.isdecimal(AR_S) # E: incompatible type -np.char.isnumeric(AR_S) # E: incompatible type +np.char.isdecimal(AR_S) # type: ignore[arg-type] # pyright: ignore[reportArgumentType] +np.char.isnumeric(AR_S) # type: ignore[arg-type] # pyright: ignore[reportArgumentType] diff --git a/test/static/reject/chararray.pyi b/test/static/reject/chararray.pyi index e484b64..25e3894 100644 --- a/test/static/reject/chararray.pyi +++ b/test/static/reject/chararray.pyi @@ -3,59 +3,61 @@ import numpy as np AR_U: np.char.chararray[tuple[int, ...], np.dtype[np.str_]] AR_S: np.char.chararray[tuple[int, ...], np.dtype[np.bytes_]] -AR_S.encode() # E: Invalid self argument -AR_U.decode() # E: Invalid self argument - -AR_U.join(b"_") # E: incompatible type -AR_S.join("_") # E: incompatible type - -AR_U.ljust(5, fillchar=b"a") # E: incompatible type -AR_S.ljust(5, fillchar="a") # E: incompatible type -AR_U.rjust(5, fillchar=b"a") # E: incompatible type -AR_S.rjust(5, fillchar="a") # E: incompatible type - -AR_U.lstrip(chars=b"a") # E: incompatible type -AR_S.lstrip(chars="a") # E: incompatible type -AR_U.strip(chars=b"a") # E: incompatible type -AR_S.strip(chars="a") # E: incompatible type -AR_U.rstrip(chars=b"a") # E: incompatible type -AR_S.rstrip(chars="a") # E: incompatible type - -AR_U.partition(b"a") # E: incompatible type -AR_S.partition("a") # E: incompatible type -AR_U.rpartition(b"a") # E: incompatible type -AR_S.rpartition("a") # E: incompatible type - -AR_U.replace(b"_", b"-") # E: incompatible type -AR_S.replace("_", "-") # E: incompatible type - -AR_U.split(b"_") # E: incompatible type -AR_S.split("_") # E: incompatible type -AR_S.split(1) # E: incompatible type -AR_U.rsplit(b"_") # E: incompatible type -AR_S.rsplit("_") # E: incompatible type - -AR_U.count(b"a", start=[1, 2, 3]) # E: incompatible type -AR_S.count("a", end=9) # E: incompatible type - -AR_U.endswith(b"a", start=[1, 2, 3]) # E: incompatible type -AR_S.endswith("a", end=9) # E: incompatible type -AR_U.startswith(b"a", start=[1, 2, 3]) # E: incompatible type -AR_S.startswith("a", end=9) # E: incompatible type - -AR_U.find(b"a", start=[1, 2, 3]) # E: incompatible type -AR_S.find("a", end=9) # E: incompatible type -AR_U.rfind(b"a", start=[1, 2, 3]) # E: incompatible type -AR_S.rfind("a", end=9) # E: incompatible type - -AR_U.index(b"a", start=[1, 2, 3]) # E: incompatible type -AR_S.index("a", end=9) # E: incompatible type -AR_U.rindex(b"a", start=[1, 2, 3]) # E: incompatible type -AR_S.rindex("a", end=9) # E: incompatible type - -AR_U == AR_S # E: Unsupported operand types -AR_U != AR_S # E: Unsupported operand types -AR_U >= AR_S # E: Unsupported operand types -AR_U <= AR_S # E: Unsupported operand types -AR_U > AR_S # E: Unsupported operand types -AR_U < AR_S # E: Unsupported operand types +### + +AR_S.encode() # type: ignore[misc] # pyright: ignore[reportAttributeAccessIssue] +AR_U.decode() # type: ignore[misc] # pyright: ignore[reportAttributeAccessIssue] + +AR_U.join(b"_") # type: ignore[arg-type] # pyright: ignore[reportArgumentType] +AR_S.join("_") # type: ignore[arg-type] # pyright: ignore[reportArgumentType] + +AR_U.ljust(5, fillchar=b"a") # type: ignore[arg-type] # pyright: ignore[reportArgumentType] +AR_S.ljust(5, fillchar="a") # type: ignore[arg-type] # pyright: ignore[reportArgumentType] +AR_U.rjust(5, fillchar=b"a") # type: ignore[arg-type] # pyright: ignore[reportArgumentType] +AR_S.rjust(5, fillchar="a") # type: ignore[arg-type] # pyright: ignore[reportArgumentType] + +AR_U.lstrip(chars=b"a") # type: ignore[arg-type] # pyright: ignore[reportArgumentType] +AR_S.lstrip(chars="a") # type: ignore[arg-type] # pyright: ignore[reportArgumentType] +AR_U.strip(chars=b"a") # type: ignore[arg-type] # pyright: ignore[reportArgumentType] +AR_S.strip(chars="a") # type: ignore[arg-type] # pyright: ignore[reportArgumentType] +AR_U.rstrip(chars=b"a") # type: ignore[arg-type] # pyright: ignore[reportArgumentType] +AR_S.rstrip(chars="a") # type: ignore[arg-type] # pyright: ignore[reportArgumentType] + +AR_U.partition(b"a") # type: ignore[arg-type] # pyright: ignore[reportArgumentType] +AR_S.partition("a") # type: ignore[arg-type] # pyright: ignore[reportArgumentType] +AR_U.rpartition(b"a") # type: ignore[arg-type] # pyright: ignore[reportArgumentType] +AR_S.rpartition("a") # type: ignore[arg-type] # pyright: ignore[reportArgumentType] + +AR_U.replace(b"_", b"-") # type: ignore[arg-type] # pyright: ignore[reportArgumentType] +AR_S.replace("_", "-") # type: ignore[arg-type] # pyright: ignore[reportArgumentType] + +AR_U.split(b"_") # type: ignore[arg-type] # pyright: ignore[reportArgumentType] +AR_S.split("_") # type: ignore[arg-type] # pyright: ignore[reportArgumentType] +AR_S.split(1) # type: ignore[arg-type] # pyright: ignore[reportArgumentType] +AR_U.rsplit(b"_") # type: ignore[arg-type] # pyright: ignore[reportArgumentType] +AR_S.rsplit("_") # type: ignore[arg-type] # pyright: ignore[reportArgumentType] + +AR_U.count(b"a", start=[1, 2, 3]) # type: ignore[arg-type] # pyright: ignore[reportArgumentType] +AR_S.count("a", end=9) # type: ignore[arg-type] # pyright: ignore[reportArgumentType] + +AR_U.endswith(b"a", start=[1, 2, 3]) # type: ignore[arg-type] # pyright: ignore[reportArgumentType] +AR_S.endswith("a", end=9) # type: ignore[arg-type] # pyright: ignore[reportArgumentType] +AR_U.startswith(b"a", start=[1, 2, 3]) # type: ignore[arg-type] # pyright: ignore[reportArgumentType] +AR_S.startswith("a", end=9) # type: ignore[arg-type] # pyright: ignore[reportArgumentType] + +AR_U.find(b"a", start=[1, 2, 3]) # type: ignore[arg-type] # pyright: ignore[reportArgumentType] +AR_S.find("a", end=9) # type: ignore[arg-type] # pyright: ignore[reportArgumentType] +AR_U.rfind(b"a", start=[1, 2, 3]) # type: ignore[arg-type] # pyright: ignore[reportArgumentType] +AR_S.rfind("a", end=9) # type: ignore[arg-type] # pyright: ignore[reportArgumentType] + +AR_U.index(b"a", start=[1, 2, 3]) # type: ignore[arg-type] # pyright: ignore[reportArgumentType] +AR_S.index("a", end=9) # type: ignore[arg-type] # pyright: ignore[reportArgumentType] +AR_U.rindex(b"a", start=[1, 2, 3]) # type: ignore[arg-type] # pyright: ignore[reportArgumentType] +AR_S.rindex("a", end=9) # type: ignore[arg-type] # pyright: ignore[reportArgumentType] + +AR_U == AR_S # type: ignore[operator] # pyright: ignore[reportOperatorIssue] +AR_U != AR_S # type: ignore[operator] # pyright: ignore[reportOperatorIssue] +AR_U >= AR_S # type: ignore[operator] # pyright: ignore[reportOperatorIssue] +AR_U <= AR_S # type: ignore[operator] # pyright: ignore[reportOperatorIssue] +AR_U > AR_S # type: ignore[operator] # pyright: ignore[reportOperatorIssue] +AR_U < AR_S # type: ignore[operator] # pyright: ignore[reportOperatorIssue] diff --git a/test/static/reject/comparisons.pyi b/test/static/reject/comparisons.pyi index 899b005..fe45b63 100644 --- a/test/static/reject/comparisons.pyi +++ b/test/static/reject/comparisons.pyi @@ -1,27 +1,37 @@ import numpy as np import numpy.typing as npt -AR_i: npt.NDArray[np.int64] +AR_i: npt.NDArray[np.int_] AR_f: npt.NDArray[np.float64] AR_c: npt.NDArray[np.complex128] -AR_m: npt.NDArray[np.timedelta64] AR_M: npt.NDArray[np.datetime64] +AR_m: npt.NDArray[np.timedelta64] + +### -AR_f > AR_m # E: Unsupported operand types -AR_c > AR_m # E: Unsupported operand types +AR_i > AR_M # type: ignore[operator] # pyright: ignore[reportOperatorIssue] +AR_i > "" # type: ignore[operator] # pyright: ignore[reportOperatorIssue] +AR_i > b"" # type: ignore[operator] # pyright: ignore[reportOperatorIssue] -AR_m > AR_f # E: Unsupported operand types -AR_m > AR_c # E: Unsupported operand types +AR_f > AR_M # type: ignore[operator] # pyright: ignore[reportOperatorIssue] +AR_f > AR_m # type: ignore[operator] # pyright: ignore[reportOperatorIssue] +AR_f > "" # type: ignore[operator] # pyright: ignore[reportOperatorIssue] +AR_f > b"" # type: ignore[operator] # pyright: ignore[reportOperatorIssue] -AR_i > AR_M # E: Unsupported operand types -AR_f > AR_M # E: Unsupported operand types -AR_m > AR_M # E: Unsupported operand types +AR_c > AR_m # type: ignore[operator] # pyright: ignore[reportOperatorIssue] +AR_c > AR_M # type: ignore[operator] # pyright: ignore[reportOperatorIssue] +AR_c > "" # type: ignore[operator] # pyright: ignore[reportOperatorIssue] +AR_c > b"" # type: ignore[operator] # pyright: ignore[reportOperatorIssue] -AR_i < AR_M # E: Unsupported operand types -AR_f < AR_M # E: Unsupported operand types -AR_m < AR_M # E: Unsupported operand types +AR_m > AR_f # type: ignore[operator] # pyright: ignore[reportOperatorIssue] +AR_m > AR_c # type: ignore[operator] # pyright: ignore[reportOperatorIssue] +AR_m > AR_M # type: ignore[operator] # pyright: ignore[reportOperatorIssue] +AR_m > "" # type: ignore[operator] # pyright: ignore[reportOperatorIssue] +AR_m > b"" # type: ignore[operator] # pyright: ignore[reportOperatorIssue] -AR_i > "" # E: No overload variant -AR_i > b"" # E: No overload variant -AR_M < "" # E: Unsupported operand types -AR_M < b"" # E: Unsupported operand types +AR_M > AR_i # type: ignore[operator] # pyright: ignore[reportOperatorIssue] +AR_M > AR_f # type: ignore[operator] # pyright: ignore[reportOperatorIssue] +AR_M > AR_c # type: ignore[operator] # pyright: ignore[reportOperatorIssue] +AR_M > AR_m # type: ignore[operator] # pyright: ignore[reportOperatorIssue] +AR_M > "" # type: ignore[operator] # pyright: ignore[reportOperatorIssue] +AR_M > b"" # type: ignore[operator] # pyright: ignore[reportOperatorIssue] diff --git a/test/static/reject/constants.pyi b/test/static/reject/constants.pyi index b5d6d27..6ceeb77 100644 --- a/test/static/reject/constants.pyi +++ b/test/static/reject/constants.pyi @@ -1,3 +1,3 @@ import numpy as np -np.little_endian = np.little_endian # E: Cannot assign to final +np.little_endian = False # type: ignore[misc] diff --git a/test/static/reject/datasource.pyi b/test/static/reject/datasource.pyi index 31cfd58..aa74de3 100644 --- a/test/static/reject/datasource.pyi +++ b/test/static/reject/datasource.pyi @@ -5,12 +5,12 @@ import numpy as np path: Path d1: np.lib.npyio.DataSource -d1.abspath(path) # E: incompatible type -d1.abspath(b"...") # E: incompatible type +d1.abspath(path) # type: ignore[arg-type] # pyright: ignore[reportArgumentType] +d1.abspath(b"...") # type: ignore[arg-type] # pyright: ignore[reportArgumentType] -d1.exists(path) # E: incompatible type -d1.exists(b"...") # E: incompatible type +d1.exists(path) # type: ignore[arg-type] # pyright: ignore[reportArgumentType] +d1.exists(b"...") # type: ignore[arg-type] # pyright: ignore[reportArgumentType] -d1.open(path, "r") # E: incompatible type -d1.open(b"...", encoding="utf8") # E: incompatible type -d1.open(None, newline="/n") # E: incompatible type +d1.open(path, "r") # type: ignore[arg-type] # pyright: ignore[reportArgumentType] +d1.open(b"...", encoding="utf8") # type: ignore[arg-type] # pyright: ignore[reportArgumentType] +d1.open(None, newline="/n") # type: ignore[arg-type] # pyright: ignore[reportArgumentType] diff --git a/test/static/reject/dtype.pyi b/test/static/reject/dtype.pyi index a1af3cd..fc1fdf0 100644 --- a/test/static/reject/dtype.pyi +++ b/test/static/reject/dtype.pyi @@ -1,17 +1,21 @@ import numpy as np +### + class Test1: - not_dtype = np.dtype(float) + not_dtype: np.dtype[np.float64] class Test2: - dtype = float + dtype: type[float] + +### + +t1: Test1 +t2: Test2 +t3: dict[str, tuple[type[int | float], int]] -np.dtype(Test1()) # E: No overload variant of "dtype" matches -np.dtype(Test2()) # E: incompatible type +### -np.dtype( # E: No overload variant of "dtype" matches - { - "field1": (float, 1), - "field2": (int, 3), - } -) +np.dtype(t1) # type: ignore[call-overload] # pyright: ignore[reportCallIssue,reportArgumentType] +np.dtype(t2) # type: ignore[arg-type] # pyright: ignore[reportCallIssue,reportArgumentType] +np.dtype(t3) # type: ignore[call-overload] # pyright: ignore[reportCallIssue,reportArgumentType] diff --git a/test/static/reject/einsumfunc.pyi b/test/static/reject/einsumfunc.pyi index e51f72e..860c9c1 100644 --- a/test/static/reject/einsumfunc.pyi +++ b/test/static/reject/einsumfunc.pyi @@ -1,12 +1,16 @@ import numpy as np import numpy.typing as npt +### + AR_i: npt.NDArray[np.int64] AR_f: npt.NDArray[np.float64] AR_m: npt.NDArray[np.timedelta64] AR_U: npt.NDArray[np.str_] -np.einsum("i,i->i", AR_i, AR_m) # E: incompatible type -np.einsum("i,i->i", AR_f, AR_f, dtype=np.int32) # E: incompatible type -np.einsum("i,i->i", AR_i, AR_i, out=AR_U) # E: Value of type variable "_ArrayType" of "einsum" cannot be -np.einsum("i,i->i", AR_i, AR_i, out=AR_U, casting="unsafe") # E: No overload variant +### + +np.einsum("i,i->i", AR_i, AR_m) # type: ignore[arg-type] # pyright: ignore[reportCallIssue,reportArgumentType] +np.einsum("i,i->i", AR_f, AR_f, dtype=np.int32) # type: ignore[arg-type] # pyright: ignore[reportCallIssue,reportArgumentType] +np.einsum("i,i->i", AR_i, AR_i, out=AR_U) # type: ignore[type-var] # pyright: ignore[reportCallIssue,reportArgumentType] +np.einsum("i,i->i", AR_i, AR_i, out=AR_U, casting="unsafe") # type: ignore[call-overload] # pyright: ignore[reportCallIssue,reportArgumentType] diff --git a/test/static/reject/flatiter.pyi b/test/static/reject/flatiter.pyi index cab16db..3dfd9df 100644 --- a/test/static/reject/flatiter.pyi +++ b/test/static/reject/flatiter.pyi @@ -1,22 +1,21 @@ -from typing import Any - import numpy as np import numpy._typing as npt class Index: def __index__(self) -> int: ... +ix: Index a: np.flatiter[npt.NDArray[np.float64]] supports_array: npt._SupportsArray[np.dtype[np.float64]] -a.base = Any # E: Property "base" defined in "flatiter" is read-only -a.coords = Any # E: Property "coords" defined in "flatiter" is read-only -a.index = Any # E: Property "index" defined in "flatiter" is read-only -a.copy(order="C") # E: Unexpected keyword argument +### + +a.base = int # type: ignore[assignment,misc] # pyright: ignore[reportAttributeAccessIssue] +a.coords = () # type: ignore[misc] # pyright: ignore[reportAttributeAccessIssue] +a.index = 0 # type: ignore[misc] # pyright: ignore[reportAttributeAccessIssue] + +a.copy(order="C") # type: ignore[call-arg] # pyright: ignore[reportCallIssue] -# NOTE: Contrary to `ndarray.__getitem__` its counterpart in `flatiter` -# does not accept objects with the `__array__` or `__index__` protocols; -# boolean indexing is just plain broken (gh-17175) -a[np.bool()] # E: No overload variant of "__getitem__" -a[Index()] # E: No overload variant of "__getitem__" -a[supports_array] # E: No overload variant of "__getitem__" +a[np.True_] # type: ignore[index] # pyright: ignore[reportCallIssue,reportArgumentType] +a[ix] # type: ignore[call-overload] # pyright: ignore[reportCallIssue,reportArgumentType] +a[supports_array] # type: ignore[index] # pyright: ignore[reportCallIssue,reportArgumentType] diff --git a/test/static/reject/fromnumeric.pyi b/test/static/reject/fromnumeric.pyi index d1d265f..b18279b 100644 --- a/test/static/reject/fromnumeric.pyi +++ b/test/static/reject/fromnumeric.pyi @@ -1,172 +1,143 @@ import numpy as np import numpy.typing as npt -A = np.array(True, ndmin=2, dtype=bool) -A.setflags(write=False) +b1: np.bool +AR_b1: npt.NDArray[np.bool] AR_U: npt.NDArray[np.str_] AR_M: npt.NDArray[np.datetime64] -a = np.bool(True) - -np.take(a, None) # E: No overload variant -np.take(a, axis=1.0) # E: No overload variant -np.take(A, out=1) # E: No overload variant -np.take(A, mode="bob") # E: No overload variant - -np.reshape(a, None) # E: No overload variant -np.reshape(A, 1, order="bob") # E: No overload variant - -np.choose(a, None) # E: No overload variant -np.choose(a, out=1.0) # E: No overload variant -np.choose(A, mode="bob") # E: No overload variant - -np.repeat(a, None) # E: No overload variant -np.repeat(A, 1, axis=1.0) # E: No overload variant - -np.swapaxes(A, None, 1) # E: No overload variant -np.swapaxes(A, 1, [0]) # E: No overload variant - -np.transpose(A, axes=1.0) # E: No overload variant - -np.partition(a, None) # E: No overload variant -np.partition( # E: No overload variant - a, 0, axis="bob" -) -np.partition( # E: No overload variant - A, 0, kind="bob" -) -np.partition( - A, - 0, - order=range(5), # E: Argument "order" to "partition" has incompatible type -) - -np.argpartition( - a, - None, # E: incompatible type -) -np.argpartition( - a, - 0, - axis="bob", # E: incompatible type -) -np.argpartition( - A, - 0, - kind="bob", # E: incompatible type -) -np.argpartition( - A, - 0, - order=range(5), # E: Argument "order" to "argpartition" has incompatible type -) - -np.sort(A, axis="bob") # E: No overload variant -np.sort(A, kind="bob") # E: No overload variant -np.sort(A, order=range(5)) # E: Argument "order" to "sort" has incompatible type - -np.argsort(A, axis="bob") # E: Argument "axis" to "argsort" has incompatible type -np.argsort(A, kind="bob") # E: Argument "kind" to "argsort" has incompatible type -np.argsort(A, order=range(5)) # E: Argument "order" to "argsort" has incompatible type - -np.argmax(A, axis="bob") # E: No overload variant of "argmax" matches argument type -np.argmax(A, kind="bob") # E: No overload variant of "argmax" matches argument type - -np.argmin(A, axis="bob") # E: No overload variant of "argmin" matches argument type -np.argmin(A, kind="bob") # E: No overload variant of "argmin" matches argument type - -np.searchsorted( # E: No overload variant of "searchsorted" matches argument type - A[0], 0, side="bob" -) -np.searchsorted( # E: No overload variant of "searchsorted" matches argument type - A[0], 0, sorter=1.0 -) - -np.resize(A, 1.0) # E: No overload variant - -np.squeeze(A, 1.0) # E: No overload variant of "squeeze" matches argument type - -np.diagonal(A, offset=None) # E: No overload variant -np.diagonal(A, axis1="bob") # E: No overload variant -np.diagonal(A, axis2=[]) # E: No overload variant - -np.trace(A, offset=None) # E: No overload variant -np.trace(A, axis1="bob") # E: No overload variant -np.trace(A, axis2=[]) # E: No overload variant - -np.ravel(a, order="bob") # E: No overload variant - -np.nonzero(0) # E: No overload variant - -np.compress( # E: No overload variant - [True], A, axis=1.0 -) - -np.clip(a, 1, 2, out=1) # E: No overload variant of "clip" matches argument type - -np.sum(a, axis=1.0) # E: No overload variant -np.sum(a, keepdims=1.0) # E: No overload variant -np.sum(a, initial=[1]) # E: No overload variant - -np.all(a, axis=1.0) # E: No overload variant -np.all(a, keepdims=1.0) # E: No overload variant -np.all(a, out=1.0) # E: No overload variant - -np.any(a, axis=1.0) # E: No overload variant -np.any(a, keepdims=1.0) # E: No overload variant -np.any(a, out=1.0) # E: No overload variant - -np.cumsum(a, axis=1.0) # E: No overload variant -np.cumsum(a, dtype=1.0) # E: No overload variant -np.cumsum(a, out=1.0) # E: No overload variant - -np.ptp(a, axis=1.0) # E: No overload variant -np.ptp(a, keepdims=1.0) # E: No overload variant -np.ptp(a, out=1.0) # E: No overload variant - -np.amax(a, axis=1.0) # E: No overload variant -np.amax(a, keepdims=1.0) # E: No overload variant -np.amax(a, out=1.0) # E: No overload variant -np.amax(a, initial=[1.0]) # E: No overload variant -np.amax(a, where=[1.0]) # E: incompatible type - -np.amin(a, axis=1.0) # E: No overload variant -np.amin(a, keepdims=1.0) # E: No overload variant -np.amin(a, out=1.0) # E: No overload variant -np.amin(a, initial=[1.0]) # E: No overload variant -np.amin(a, where=[1.0]) # E: incompatible type - -np.prod(a, axis=1.0) # E: No overload variant -np.prod(a, out=False) # E: No overload variant -np.prod(a, keepdims=1.0) # E: No overload variant -np.prod(a, initial=int) # E: No overload variant -np.prod(a, where=1.0) # E: No overload variant -np.prod(AR_U) # E: incompatible type - -np.cumprod(a, axis=1.0) # E: No overload variant -np.cumprod(a, out=False) # E: No overload variant -np.cumprod(AR_U) # E: incompatible type - -np.size(a, axis=1.0) # E: Argument "axis" to "size" has incompatible type - -np.around(a, decimals=1.0) # E: No overload variant -np.around(a, out=type) # E: No overload variant -np.around(AR_U) # E: incompatible type - -np.mean(a, axis=1.0) # E: No overload variant -np.mean(a, out=False) # E: No overload variant -np.mean(a, keepdims=1.0) # E: No overload variant -np.mean(AR_U) # E: incompatible type -np.mean(AR_M) # E: incompatible type - -np.std(a, axis=1.0) # E: No overload variant -np.std(a, out=False) # E: No overload variant -np.std(a, ddof="test") # E: No overload variant -np.std(a, keepdims=1.0) # E: No overload variant -np.std(AR_U) # E: incompatible type +### -np.var(a, axis=1.0) # E: No overload variant -np.var(a, out=False) # E: No overload variant -np.var(a, ddof="test") # E: No overload variant -np.var(a, keepdims=1.0) # E: No overload variant -np.var(AR_U) # E: incompatible type +np.take(b1, None) # type: ignore[call-overload] # pyright: ignore[reportCallIssue,reportArgumentType] +np.take(b1, axis=1.0) # type: ignore[call-overload] # pyright: ignore[reportCallIssue] +np.take(AR_b1, out=1) # type: ignore[call-overload] # pyright: ignore[reportCallIssue] +np.take(AR_b1, mode="bob") # type: ignore[call-overload] # pyright: ignore[reportCallIssue] + +np.reshape(b1, None) # type: ignore[call-overload] # pyright: ignore[reportCallIssue,reportArgumentType] +np.reshape(AR_b1, 1, order="bob") # type: ignore[call-overload] # pyright: ignore[reportCallIssue,reportArgumentType] + +np.choose(b1, None) # type: ignore[call-overload] # pyright: ignore[reportCallIssue,reportArgumentType] +np.choose(b1, out=1.0) # type: ignore[call-overload] # pyright: ignore[reportCallIssue] +np.choose(AR_b1, mode="bob") # type: ignore[call-overload] # pyright: ignore[reportCallIssue] + +np.repeat(b1, None) # type: ignore[call-overload] # pyright: ignore[reportCallIssue,reportArgumentType] +np.repeat(AR_b1, 1, axis=1.0) # type: ignore[call-overload] # pyright: ignore[reportCallIssue,reportArgumentType] + +np.swapaxes(AR_b1, None, 1) # type: ignore[call-overload] # pyright: ignore[reportCallIssue,reportArgumentType] +np.swapaxes(AR_b1, 1, [0]) # type: ignore[call-overload] # pyright: ignore[reportCallIssue,reportArgumentType] + +np.transpose(AR_b1, axes=1.0) # type: ignore[call-overload] # pyright: ignore[reportCallIssue,reportArgumentType] + +np.partition(b1, None) # type: ignore[call-overload] # pyright: ignore[reportCallIssue,reportArgumentType] +np.partition(b1, 0, axis="bob") # type: ignore[call-overload] # pyright: ignore[reportCallIssue,reportArgumentType] +np.partition(AR_b1, 0, kind="bob") # type: ignore[call-overload] # pyright: ignore[reportCallIssue,reportArgumentType] +np.partition(AR_b1, 0, order=range(5)) # type: ignore[arg-type] # pyright: ignore[reportCallIssue,reportArgumentType] + +np.argpartition(b1, None) # type: ignore[arg-type] # pyright: ignore[reportArgumentType] +np.argpartition(b1, 0, axis="bob") # type: ignore[arg-type] # pyright: ignore[reportArgumentType] +np.argpartition(AR_b1, 0, kind="bob") # type: ignore[arg-type] # pyright: ignore[reportArgumentType] +np.argpartition(AR_b1, 0, order=range(5)) # type: ignore[arg-type] # pyright: ignore[reportArgumentType] + +np.sort(AR_b1, axis="bob") # type: ignore[call-overload] # pyright: ignore[reportCallIssue,reportArgumentType] +np.sort(AR_b1, kind="bob") # type: ignore[call-overload] # pyright: ignore[reportCallIssue,reportArgumentType] +np.sort(AR_b1, order=range(5)) # type: ignore[arg-type] # pyright: ignore[reportCallIssue,reportArgumentType] + +np.argsort(AR_b1, axis="bob") # type: ignore[arg-type] # pyright: ignore[reportArgumentType] +np.argsort(AR_b1, kind="bob") # type: ignore[arg-type] # pyright: ignore[reportArgumentType] +np.argsort(AR_b1, order=range(5)) # type: ignore[arg-type] # pyright: ignore[reportArgumentType] + +np.argmax(AR_b1, axis="bob") # type: ignore[call-overload] # pyright: ignore[reportCallIssue,reportArgumentType] +np.argmax(AR_b1, kind="bob") # type: ignore[call-overload] # pyright: ignore[reportCallIssue] + +np.argmin(AR_b1, axis="bob") # type: ignore[call-overload] # pyright: ignore[reportCallIssue,reportArgumentType] +np.argmin(AR_b1, kind="bob") # type: ignore[call-overload] # pyright: ignore[reportCallIssue] + +np.searchsorted(AR_b1[0], 0, side="bob") # type: ignore[call-overload] # pyright: ignore[reportCallIssue,reportArgumentType] +np.searchsorted(AR_b1[0], 0, sorter=1.0) # type: ignore[call-overload] # pyright: ignore[reportCallIssue,reportArgumentType] + +np.resize(AR_b1, 1.0) # type: ignore[call-overload] # pyright: ignore[reportCallIssue,reportArgumentType] + +np.squeeze(AR_b1, 1.0) # type: ignore[call-overload] # pyright: ignore[reportCallIssue,reportArgumentType] + +np.diagonal(AR_b1, offset=None) # type: ignore[call-overload] # pyright: ignore[reportCallIssue,reportArgumentType] +np.diagonal(AR_b1, axis1="bob") # type: ignore[call-overload] # pyright: ignore[reportCallIssue,reportArgumentType] +np.diagonal(AR_b1, axis2=[]) # type: ignore[call-overload] # pyright: ignore[reportCallIssue,reportArgumentType] + +np.trace(AR_b1, offset=None) # type: ignore[call-overload] # pyright: ignore[reportCallIssue,reportArgumentType] +np.trace(AR_b1, axis1="bob") # type: ignore[call-overload] # pyright: ignore[reportCallIssue,reportArgumentType] +np.trace(AR_b1, axis2=[]) # type: ignore[call-overload] # pyright: ignore[reportCallIssue,reportArgumentType] + +np.ravel(b1, order="bob") # type: ignore[call-overload] # pyright: ignore[reportCallIssue,reportArgumentType] + +np.nonzero(0) # type: ignore[call-overload] # pyright: ignore[reportCallIssue,reportArgumentType] + +np.compress([True], AR_b1, axis=1.0) # type: ignore[call-overload] # pyright: ignore[reportCallIssue,reportArgumentType] + +np.clip(b1, 1, 2, out=1) # type: ignore[call-overload] # pyright: ignore[reportCallIssue,reportArgumentType] + +np.sum(b1, axis=1.0) # type: ignore[call-overload] # pyright: ignore[reportCallIssue,reportArgumentType] +np.sum(b1, keepdims=1.0) # type: ignore[call-overload] # pyright: ignore[reportCallIssue,reportArgumentType] +np.sum(b1, initial=[1]) # type: ignore[call-overload] # pyright: ignore[reportCallIssue,reportArgumentType] + +np.all(b1, axis=1.0) # type: ignore[call-overload] # pyright: ignore[reportCallIssue,reportArgumentType] +np.all(b1, keepdims=1.0) # type: ignore[call-overload] # pyright: ignore[reportCallIssue,reportArgumentType] +np.all(b1, out=1.0) # type: ignore[call-overload] # pyright: ignore[reportCallIssue,reportArgumentType] + +np.any(b1, axis=1.0) # type: ignore[call-overload] # pyright: ignore[reportCallIssue,reportArgumentType] +np.any(b1, keepdims=1.0) # type: ignore[call-overload] # pyright: ignore[reportCallIssue,reportArgumentType] +np.any(b1, out=1.0) # type: ignore[call-overload] # pyright: ignore[reportCallIssue,reportArgumentType] + +np.cumsum(b1, axis=1.0) # type: ignore[call-overload] # pyright: ignore[reportCallIssue,reportArgumentType] +np.cumsum(b1, dtype=1.0) # type: ignore[call-overload] # pyright: ignore[reportCallIssue,reportArgumentType] +np.cumsum(b1, out=1.0) # type: ignore[call-overload] # pyright: ignore[reportCallIssue,reportArgumentType] + +np.ptp(b1, axis=1.0) # type: ignore[call-overload] # pyright: ignore[reportCallIssue,reportArgumentType] +np.ptp(b1, keepdims=1.0) # type: ignore[call-overload] # pyright: ignore[reportCallIssue,reportArgumentType] +np.ptp(b1, out=1.0) # type: ignore[call-overload] # pyright: ignore[reportCallIssue,reportArgumentType] + +np.amax(b1, axis=1.0) # type: ignore[call-overload] # pyright: ignore[reportCallIssue,reportArgumentType] +np.amax(b1, keepdims=1.0) # type: ignore[call-overload] # pyright: ignore[reportCallIssue,reportArgumentType] +np.amax(b1, out=1.0) # type: ignore[call-overload] # pyright: ignore[reportCallIssue,reportArgumentType] +np.amax(b1, initial=[1.0]) # type: ignore[call-overload] # pyright: ignore[reportCallIssue,reportArgumentType] +np.amax(b1, where=[1.0]) # type: ignore[arg-type] # pyright: ignore[reportCallIssue,reportArgumentType] + +np.amin(b1, axis=1.0) # type: ignore[call-overload] # pyright: ignore[reportCallIssue,reportArgumentType] +np.amin(b1, keepdims=1.0) # type: ignore[call-overload] # pyright: ignore[reportCallIssue,reportArgumentType] +np.amin(b1, out=1.0) # type: ignore[call-overload] # pyright: ignore[reportCallIssue,reportArgumentType] +np.amin(b1, initial=[1.0]) # type: ignore[call-overload] # pyright: ignore[reportCallIssue,reportArgumentType] +np.amin(b1, where=[1.0]) # type: ignore[arg-type] # pyright: ignore[reportCallIssue,reportArgumentType] + +np.prod(b1, axis=1.0) # type: ignore[call-overload] # pyright: ignore[reportCallIssue,reportArgumentType] +np.prod(b1, out=False) # type: ignore[call-overload] # pyright: ignore[reportCallIssue,reportArgumentType] +np.prod(b1, keepdims=1.0) # type: ignore[call-overload] # pyright: ignore[reportCallIssue,reportArgumentType] +np.prod(b1, initial=int) # type: ignore[call-overload] # pyright: ignore[reportCallIssue,reportArgumentType] +np.prod(b1, where=1.0) # type: ignore[call-overload] # pyright: ignore[reportCallIssue,reportArgumentType] +np.prod(AR_U) # type: ignore[arg-type] # pyright: ignore[reportCallIssue,reportArgumentType] + +np.cumprod(b1, axis=1.0) # type: ignore[call-overload] # pyright: ignore[reportCallIssue,reportArgumentType] +np.cumprod(b1, out=False) # type: ignore[call-overload] # pyright: ignore[reportCallIssue,reportArgumentType] +np.cumprod(AR_U) # type: ignore[arg-type] # pyright: ignore[reportCallIssue,reportArgumentType] + +np.size(b1, axis=1.0) # type: ignore[arg-type] # pyright: ignore[reportArgumentType] + +np.around(b1, decimals=1.0) # type: ignore[call-overload] # pyright: ignore[reportCallIssue,reportArgumentType] +np.around(b1, out=type) # type: ignore[call-overload] # pyright: ignore[reportCallIssue,reportArgumentType] +np.around(AR_U) # type: ignore[arg-type] # pyright: ignore[reportCallIssue,reportArgumentType] + +np.mean(b1, axis=1.0) # type: ignore[call-overload] # pyright: ignore[reportCallIssue,reportArgumentType] +np.mean(b1, out=False) # type: ignore[call-overload] # pyright: ignore[reportCallIssue,reportArgumentType] +np.mean(b1, keepdims=1.0) # type: ignore[call-overload] # pyright: ignore[reportCallIssue,reportArgumentType] +np.mean(AR_U) # type: ignore[arg-type] # pyright: ignore[reportCallIssue,reportArgumentType] +np.mean(AR_M) # type: ignore[arg-type] # pyright: ignore[reportCallIssue,reportArgumentType] + +np.std(b1, axis=1.0) # type: ignore[call-overload] # pyright: ignore[reportCallIssue,reportArgumentType] +np.std(b1, out=False) # type: ignore[call-overload] # pyright: ignore[reportCallIssue,reportArgumentType] +np.std(b1, ddof="test") # type: ignore[call-overload] # pyright: ignore[reportCallIssue,reportArgumentType] +np.std(b1, keepdims=1.0) # type: ignore[call-overload] # pyright: ignore[reportCallIssue,reportArgumentType] +np.std(AR_U) # type: ignore[arg-type] # pyright: ignore[reportCallIssue,reportArgumentType] + +np.var(b1, axis=1.0) # type: ignore[call-overload] # pyright: ignore[reportCallIssue,reportArgumentType] +np.var(b1, out=False) # type: ignore[call-overload] # pyright: ignore[reportCallIssue,reportArgumentType] +np.var(b1, ddof="test") # type: ignore[call-overload] # pyright: ignore[reportCallIssue,reportArgumentType] +np.var(b1, keepdims=1.0) # type: ignore[call-overload] # pyright: ignore[reportCallIssue,reportArgumentType] +np.var(AR_U) # type: ignore[arg-type] # pyright: ignore[reportCallIssue,reportArgumentType] diff --git a/test/static/reject/histograms.pyi b/test/static/reject/histograms.pyi index 22499d3..4d5dc63 100644 --- a/test/static/reject/histograms.pyi +++ b/test/static/reject/histograms.pyi @@ -4,9 +4,9 @@ import numpy.typing as npt AR_i8: npt.NDArray[np.int64] AR_f8: npt.NDArray[np.float64] -np.histogram_bin_edges(AR_i8, range=(0, 1, 2)) # E: incompatible type +np.histogram_bin_edges(AR_i8, range=(0, 1, 2)) # type: ignore[arg-type] # pyright: ignore[reportArgumentType] -np.histogram(AR_i8, range=(0, 1, 2)) # E: incompatible type +np.histogram(AR_i8, range=(0, 1, 2)) # type: ignore[arg-type] # pyright: ignore[reportArgumentType] -np.histogramdd(AR_i8, range=(0, 1)) # E: incompatible type -np.histogramdd(AR_i8, range=[(0, 1, 2)]) # E: incompatible type +np.histogramdd(AR_i8, range=(0, 1)) # type: ignore[arg-type] # pyright: ignore[reportArgumentType] +np.histogramdd(AR_i8, range=[(0, 1, 2)]) # type: ignore[list-item] # pyright: ignore[reportArgumentType] diff --git a/test/static/reject/index_tricks.pyi b/test/static/reject/index_tricks.pyi index 22f6f4a..7330646 100644 --- a/test/static/reject/index_tricks.pyi +++ b/test/static/reject/index_tricks.pyi @@ -3,12 +3,19 @@ import numpy as np AR_LIKE_i: list[int] AR_LIKE_f: list[float] -np.ndindex([1, 2, 3]) # E: No overload variant -np.unravel_index(AR_LIKE_f, (1, 2, 3)) # E: incompatible type -np.ravel_multi_index(AR_LIKE_i, (1, 2, 3), mode="bob") # E: No overload variant -np.mgrid[1] # E: Invalid index type -np.mgrid[...] # E: Invalid index type -np.ogrid[1] # E: Invalid index type -np.ogrid[...] # E: Invalid index type -np.fill_diagonal(AR_LIKE_f, 2) # E: incompatible type -np.diag_indices(1.0) # E: incompatible type +np.fill_diagonal(AR_LIKE_f, 2) # type: ignore[arg-type] # pyright: ignore[reportArgumentType] +np.diag_indices(1.0) # type: ignore[arg-type] # pyright: ignore[reportArgumentType] + +np.ndindex([1, 2, 3]) # type: ignore[call-overload] # pyright: ignore[reportCallIssue,reportArgumentType] +np.unravel_index(AR_LIKE_f, (1, 2, 3)) # type: ignore[arg-type] # pyright: ignore[reportCallIssue,reportArgumentType] +np.ravel_multi_index( # type: ignore[call-overload] # pyright: ignore[reportCallIssue] + AR_LIKE_i, + (1, 2, 3), + mode="bob", # pyright: ignore[reportArgumentType] +) + +np.mgrid[1] # type: ignore[index] # pyright: ignore[reportArgumentType] +np.mgrid[...] # type: ignore[index] # pyright: ignore[reportArgumentType] + +np.ogrid[1] # type: ignore[index] # pyright: ignore[reportArgumentType] +np.ogrid[...] # type: ignore[index] # pyright: ignore[reportArgumentType] diff --git a/test/static/reject/lib_function_base.pyi b/test/static/reject/lib_function_base.pyi index de4e56b..a5ddbde 100644 --- a/test/static/reject/lib_function_base.pyi +++ b/test/static/reject/lib_function_base.pyi @@ -13,50 +13,53 @@ AR_b_list: list[npt.NDArray[np.bool]] def fn_none_i(a: None, /) -> npt.NDArray[Any]: ... def fn_ar_i(a: npt.NDArray[np.float64], posarg: int, /) -> npt.NDArray[Any]: ... -np.average(AR_m) # E: incompatible type -np.select(1, [AR_f8]) # E: incompatible type -np.angle(AR_m) # E: incompatible type -np.unwrap(AR_m) # E: incompatible type -np.unwrap(AR_c16) # E: incompatible type -np.trim_zeros(1) # E: incompatible type -np.place(1, [True], 1.5) # E: incompatible type -np.vectorize(1) # E: incompatible type -np.place(AR_f8, slice(None), 5) # E: incompatible type - -np.piecewise(AR_f8, True, [fn_ar_i], 42) # E: No overload variants -# TODO: enable these once mypy actually supports ParamSpec (released in 2021) -# NOTE: pyright correctly reports errors for these (`reportCallIssue`) -# np.piecewise(AR_f8, AR_b_list, [fn_none_i]) # E: No overload variants -# np.piecewise(AR_f8, AR_b_list, [fn_ar_i]) # E: No overload variant -# np.piecewise(AR_f8, AR_b_list, [fn_ar_i], 3.14) # E: No overload variant -# np.piecewise(AR_f8, AR_b_list, [fn_ar_i], 42, None) # E: No overload variant -# np.piecewise(AR_f8, AR_b_list, [fn_ar_i], 42, _=None) # E: No overload variant - -np.interp(AR_f8, AR_c16, AR_f8) # E: incompatible type -np.interp(AR_c16, AR_f8, AR_f8) # E: incompatible type -np.interp(AR_f8, AR_f8, AR_f8, period=AR_c16) # E: No overload variant -np.interp(AR_f8, AR_f8, AR_O) # E: incompatible type - -np.cov(AR_m) # E: incompatible type -np.cov(AR_O) # E: incompatible type -np.corrcoef(AR_m) # E: incompatible type -np.corrcoef(AR_O) # E: incompatible type -np.corrcoef(AR_f8, bias=True) # E: No overload variant -np.corrcoef(AR_f8, ddof=2) # E: No overload variant -np.blackman(1j) # E: incompatible type -np.bartlett(1j) # E: incompatible type -np.hanning(1j) # E: incompatible type -np.hamming(1j) # E: incompatible type -np.hamming(AR_c16) # E: incompatible type -np.kaiser(1j, 1) # E: incompatible type -np.sinc(AR_O) # E: incompatible type -np.median(AR_M) # E: incompatible type - -np.percentile(AR_f8, 50j) # E: No overload variant -np.percentile(AR_f8, 50, interpolation="bob") # E: No overload variant -np.quantile(AR_f8, 0.5j) # E: No overload variant -np.quantile(AR_f8, 0.5, interpolation="bob") # E: No overload variant -np.meshgrid(AR_f8, AR_f8, indexing="bob") # E: incompatible type -np.delete(AR_f8, AR_f8) # E: incompatible type -np.insert(AR_f8, AR_f8, 1.5) # E: incompatible type -np.digitize(AR_f8, 1j) # E: No overload variant +np.angle(AR_m) # type: ignore[arg-type] # pyright: ignore[reportCallIssue,reportArgumentType] +np.unwrap(AR_m) # type: ignore[arg-type] # pyright: ignore[reportCallIssue,reportArgumentType] +np.unwrap(AR_c16) # type: ignore[arg-type] # pyright: ignore[reportCallIssue,reportArgumentType] +np.trim_zeros(1) # type: ignore[arg-type] # pyright: ignore[reportArgumentType] +np.vectorize(1) # type: ignore[arg-type] # pyright: ignore[reportArgumentType] + +np.piecewise(AR_f8, True, [fn_ar_i], 42) # type: ignore[call-overload] # pyright: ignore[reportCallIssue,reportArgumentType] +# NOTE: mypy still doesn't (fully) support `ParamSpec` (released in 2021...) +np.piecewise(AR_f8, AR_b_list, [fn_none_i]) # pyright: ignore[reportCallIssue] +np.piecewise(AR_f8, AR_b_list, [fn_ar_i]) # pyright: ignore[reportCallIssue] +np.piecewise(AR_f8, AR_b_list, [fn_ar_i], 3.1) # pyright: ignore[reportCallIssue,reportArgumentType] +np.piecewise(AR_f8, AR_b_list, [fn_ar_i], 42, None) # pyright: ignore[reportCallIssue] +np.piecewise(AR_f8, AR_b_list, [fn_ar_i], 42, _=None) # pyright: ignore[reportCallIssue] + +np.interp(AR_f8, AR_c16, AR_f8) # type: ignore[arg-type] # pyright: ignore[reportCallIssue,reportArgumentType] +np.interp(AR_c16, AR_f8, AR_f8) # type: ignore[arg-type] # pyright: ignore[reportCallIssue,reportArgumentType] +np.interp(AR_f8, AR_f8, AR_f8, period=AR_c16) # type: ignore[call-overload] # pyright: ignore[reportCallIssue,reportArgumentType] +np.interp(AR_f8, AR_f8, AR_O) # type: ignore[arg-type] # pyright: ignore[reportCallIssue,reportArgumentType] + +np.average(AR_m) # type: ignore[arg-type] # pyright: ignore[reportCallIssue,reportArgumentType] +np.median(AR_M) # type: ignore[arg-type] # pyright: ignore[reportCallIssue,reportArgumentType] +np.percentile(AR_f8, 50j) # type: ignore[call-overload] # pyright: ignore[reportCallIssue,reportArgumentType] +np.quantile(AR_f8, 0.5j) # type: ignore[call-overload] # pyright: ignore[reportCallIssue,reportArgumentType] +np.percentile(AR_f8, 50, interpolation="bob") # type: ignore[call-overload] # pyright: ignore[reportCallIssue] +np.quantile(AR_f8, 0.5, interpolation="bob") # type: ignore[call-overload] # pyright: ignore[reportCallIssue] + +np.cov(AR_m) # type: ignore[arg-type] # pyright: ignore[reportCallIssue,reportArgumentType] +np.cov(AR_O) # type: ignore[arg-type] # pyright: ignore[reportCallIssue,reportArgumentType] + +np.corrcoef(AR_m) # type: ignore[arg-type] # pyright: ignore[reportCallIssue,reportArgumentType] +np.corrcoef(AR_O) # type: ignore[arg-type] # pyright: ignore[reportCallIssue,reportArgumentType] +np.corrcoef(AR_f8, bias=True) # type: ignore[call-overload] # pyright: ignore[reportCallIssue] +np.corrcoef(AR_f8, ddof=2) # type: ignore[call-overload] # pyright: ignore[reportCallIssue] + +np.blackman(1j) # type: ignore[arg-type] # pyright: ignore[reportArgumentType] +np.bartlett(1j) # type: ignore[arg-type] # pyright: ignore[reportArgumentType] +np.hanning(1j) # type: ignore[arg-type] # pyright: ignore[reportArgumentType] +np.hamming(1j) # type: ignore[arg-type] # pyright: ignore[reportArgumentType] +np.hamming(AR_c16) # type: ignore[arg-type] # pyright: ignore[reportArgumentType] +np.kaiser(1j, 1) # type: ignore[arg-type] # pyright: ignore[reportArgumentType] +np.sinc(AR_O) # type: ignore[arg-type] # pyright: ignore[reportCallIssue,reportArgumentType] + +np.meshgrid(AR_f8, AR_f8, indexing="bob") # type: ignore[arg-type] # pyright: ignore[reportArgumentType] + +np.select(1, [AR_f8]) # type: ignore[arg-type] # pyright: ignore[reportArgumentType] +np.delete(AR_f8, AR_f8) # type: ignore[arg-type] # pyright: ignore[reportCallIssue,reportArgumentType] +np.insert(AR_f8, AR_f8, 1.5) # type: ignore[arg-type] # pyright: ignore[reportCallIssue,reportArgumentType] +np.place(1, [True], 1.5) # type: ignore[arg-type] # pyright: ignore[reportArgumentType] +np.place(AR_f8, slice(None), 5) # type: ignore[arg-type] # pyright: ignore[reportArgumentType] +np.digitize(AR_f8, 1j) # type: ignore[call-overload] # pyright: ignore[reportCallIssue,reportArgumentType] diff --git a/test/static/reject/lib_polynomial.pyi b/test/static/reject/lib_polynomial.pyi index e51b6b5..8682db7 100644 --- a/test/static/reject/lib_polynomial.pyi +++ b/test/static/reject/lib_polynomial.pyi @@ -8,22 +8,24 @@ AR_U: npt.NDArray[np.str_] poly_obj: np.poly1d -np.polymul(AR_f8, AR_U) # E: incompatible type -np.polydiv(AR_f8, AR_U) # E: incompatible type +### -5**poly_obj # E: No overload variant +5**poly_obj # type: ignore[operator] # pyright: ignore[reportOperatorIssue] -np.polyint(AR_U) # E: incompatible type -np.polyint(AR_f8, m=1j) # E: No overload variant +np.polymul(AR_f8, AR_U) # type: ignore[arg-type] # pyright: ignore[reportCallIssue,reportArgumentType] +np.polydiv(AR_f8, AR_U) # type: ignore[arg-type] # pyright: ignore[reportCallIssue,reportArgumentType] -np.polyder(AR_U) # E: incompatible type -np.polyder(AR_f8, m=1j) # E: No overload variant +np.polyint(AR_U) # type: ignore[arg-type] # pyright: ignore[reportCallIssue,reportArgumentType] +np.polyint(AR_f8, m=1j) # type: ignore[call-overload] # pyright: ignore[reportCallIssue,reportArgumentType,reportArgumentType] -np.polyfit(AR_O, AR_f8, 1) # E: incompatible type -np.polyfit(AR_f8, AR_f8, 1, rcond=1j) # E: No overload variant -np.polyfit(AR_f8, AR_f8, 1, w=AR_c16) # E: incompatible type -np.polyfit(AR_f8, AR_f8, 1, cov="bob") # E: No overload variant +np.polyder(AR_U) # type: ignore[arg-type] # pyright: ignore[reportCallIssue,reportArgumentType] +np.polyder(AR_f8, m=1j) # type: ignore[call-overload] # pyright: ignore[reportCallIssue,reportArgumentType] -np.polyval(AR_f8, AR_U) # E: incompatible type -np.polyadd(AR_f8, AR_U) # E: incompatible type -np.polysub(AR_f8, AR_U) # E: incompatible type +np.polyfit(AR_O, AR_f8, 1) # type: ignore[arg-type] # pyright: ignore[reportCallIssue,reportArgumentType] +np.polyfit(AR_f8, AR_f8, 1, rcond=1j) # type: ignore[call-overload] # pyright: ignore[reportCallIssue,reportArgumentType] +np.polyfit(AR_f8, AR_f8, 1, w=AR_c16) # type: ignore[arg-type] # pyright: ignore[reportCallIssue,reportArgumentType] +np.polyfit(AR_f8, AR_f8, 1, cov="bob") # type: ignore[call-overload] # pyright: ignore[reportCallIssue,reportArgumentType] + +np.polyval(AR_f8, AR_U) # type: ignore[arg-type] # pyright: ignore[reportCallIssue,reportArgumentType] +np.polyadd(AR_f8, AR_U) # type: ignore[arg-type] # pyright: ignore[reportCallIssue,reportArgumentType] +np.polysub(AR_f8, AR_U) # type: ignore[arg-type] # pyright: ignore[reportCallIssue,reportArgumentType] diff --git a/test/static/reject/lib_utils.pyi b/test/static/reject/lib_utils.pyi index ca8b2fb..0c3fd05 100644 --- a/test/static/reject/lib_utils.pyi +++ b/test/static/reject/lib_utils.pyi @@ -1,3 +1,3 @@ from numpy.lib import array_utils -array_utils.byte_bounds(1) # E: incompatible type +array_utils.byte_bounds(1) # type: ignore[arg-type] # pyright: ignore[reportArgumentType] diff --git a/test/static/reject/lib_version.pyi b/test/static/reject/lib_version.pyi index 2758cfe..a225fbb 100644 --- a/test/static/reject/lib_version.pyi +++ b/test/static/reject/lib_version.pyi @@ -2,5 +2,5 @@ from numpy.lib import NumpyVersion version: NumpyVersion -NumpyVersion(b"1.8.0") # E: incompatible type -version >= b"1.8.0" # E: Unsupported operand types +version >= b"1.8.0" # type: ignore[operator] # pyright: ignore[reportOperatorIssue] +NumpyVersion(b"1.8.0") # type: ignore[arg-type] # pyright: ignore[reportArgumentType] diff --git a/test/static/reject/linalg.pyi b/test/static/reject/linalg.pyi index da93903..f394946 100644 --- a/test/static/reject/linalg.pyi +++ b/test/static/reject/linalg.pyi @@ -5,44 +5,38 @@ AR_f8: npt.NDArray[np.float64] AR_O: npt.NDArray[np.object_] AR_M: npt.NDArray[np.datetime64] -np.linalg.tensorsolve(AR_O, AR_O) # E: incompatible type +### -np.linalg.solve(AR_O, AR_O) # E: incompatible type +np.linalg.inv(AR_O) # type: ignore[arg-type] # pyright: ignore[reportCallIssue,reportArgumentType] +np.linalg.pinv(AR_O) # type: ignore[arg-type] # pyright: ignore[reportCallIssue,reportArgumentType] +np.linalg.tensorinv(AR_O) # type: ignore[arg-type] # pyright: ignore[reportCallIssue,reportArgumentType] -np.linalg.tensorinv(AR_O) # E: incompatible type +np.linalg.solve(AR_O, AR_O) # type: ignore[arg-type] # pyright: ignore[reportCallIssue,reportArgumentType] +np.linalg.tensorsolve(AR_O, AR_O) # type: ignore[arg-type] # pyright: ignore[reportCallIssue,reportArgumentType] -np.linalg.inv(AR_O) # E: incompatible type +np.linalg.matrix_rank(AR_O) # type: ignore[arg-type] # pyright: ignore[reportArgumentType] +np.linalg.matrix_power(AR_M, 5) # type: ignore[arg-type] # pyright: ignore[reportArgumentType] -np.linalg.matrix_power(AR_M, 5) # E: incompatible type +np.linalg.cholesky(AR_O) # type: ignore[arg-type] # pyright: ignore[reportCallIssue,reportArgumentType] -np.linalg.cholesky(AR_O) # E: incompatible type +np.linalg.qr(AR_O) # type: ignore[arg-type] # pyright: ignore[reportCallIssue,reportArgumentType] +np.linalg.qr(AR_f8, mode="bob") # type: ignore[call-overload] # pyright: ignore[reportCallIssue,reportArgumentType] -np.linalg.qr(AR_O) # E: incompatible type -np.linalg.qr(AR_f8, mode="bob") # E: No overload variant +np.linalg.svd(AR_O) # type: ignore[arg-type] # pyright: ignore[reportCallIssue,reportArgumentType] -np.linalg.eigvals(AR_O) # E: incompatible type +np.linalg.eig(AR_O) # type: ignore[arg-type] # pyright: ignore[reportCallIssue,reportArgumentType] +np.linalg.eigh(AR_O) # type: ignore[arg-type] # pyright: ignore[reportCallIssue,reportArgumentType] +np.linalg.eigh(AR_O, UPLO="bob") # type: ignore[call-overload] # pyright: ignore[reportCallIssue,reportArgumentType] +np.linalg.eigvals(AR_O) # type: ignore[arg-type] # pyright: ignore[reportCallIssue,reportArgumentType] +np.linalg.eigvalsh(AR_O) # type: ignore[arg-type] # pyright: ignore[reportCallIssue,reportArgumentType] +np.linalg.eigvalsh(AR_O, UPLO="bob") # type: ignore[call-overload] # pyright: ignore[reportCallIssue,reportArgumentType] -np.linalg.eigvalsh(AR_O) # E: incompatible type -np.linalg.eigvalsh(AR_O, UPLO="bob") # E: No overload variant +np.linalg.cond(AR_O) # type: ignore[arg-type] # pyright: ignore[reportArgumentType] +np.linalg.cond(AR_f8, p="bob") # type: ignore[arg-type] # pyright: ignore[reportArgumentType] -np.linalg.eig(AR_O) # E: incompatible type +np.linalg.det(AR_O) # type: ignore[arg-type] # pyright: ignore[reportArgumentType] +np.linalg.slogdet(AR_O) # type: ignore[arg-type] # pyright: ignore[reportArgumentType] -np.linalg.eigh(AR_O) # E: incompatible type -np.linalg.eigh(AR_O, UPLO="bob") # E: No overload variant +np.linalg.norm(AR_f8, ord="bob") # type: ignore[call-overload] # pyright: ignore[reportCallIssue,reportArgumentType] -np.linalg.svd(AR_O) # E: incompatible type - -np.linalg.cond(AR_O) # E: incompatible type -np.linalg.cond(AR_f8, p="bob") # E: incompatible type - -np.linalg.matrix_rank(AR_O) # E: incompatible type - -np.linalg.pinv(AR_O) # E: incompatible type - -np.linalg.slogdet(AR_O) # E: incompatible type - -np.linalg.det(AR_O) # E: incompatible type - -np.linalg.norm(AR_f8, ord="bob") # E: No overload variant - -np.linalg.multi_dot([AR_M]) # E: incompatible type +np.linalg.multi_dot([AR_M]) # type: ignore[list-item] # pyright: ignore[reportArgumentType] diff --git a/test/static/reject/memmap.pyi b/test/static/reject/memmap.pyi index 692e712..2bfbe7a 100644 --- a/test/static/reject/memmap.pyi +++ b/test/static/reject/memmap.pyi @@ -1,5 +1,6 @@ import numpy as np with open("file.txt", encoding="utf-8") as f: - np.memmap(f) # E: No overload variant -np.memmap("test.txt", shape=[10, 5]) # E: No overload variant + np.memmap(f) # type: ignore[call-overload] # pyright: ignore[reportArgumentType] + +np.memmap("test.txt", shape=[10, 5]) # type: ignore[call-overload] # pyright: ignore[reportArgumentType] diff --git a/test/static/reject/modules.pyi b/test/static/reject/modules.pyi index 541be15..67001cd 100644 --- a/test/static/reject/modules.pyi +++ b/test/static/reject/modules.pyi @@ -1,17 +1,14 @@ import numpy as np -np.testing.bob # E: Module has no attribute -np.bob # E: Module has no attribute +np.bob # type: ignore[attr-defined] # pyright: ignore[reportAttributeAccessIssue] +np.testing.bob # type: ignore[attr-defined] # pyright: ignore[reportAttributeAccessIssue] # Stdlib modules in the namespace by accident -np.warnings # E: Module has no attribute -np.sys # E: Module has no attribute -np.os # E: Module "numpy" does not explicitly export -np.math # E: Module has no attribute - -# Public sub-modules that are not imported to their parent module by default; -# e.g. one must first execute `import numpy.lib.recfunctions` -np.lib.recfunctions # E: Module has no attribute - -np.__deprecated_attrs__ # E: Module has no attribute -np.__expired_functions__ # E: Module has no attribute +np.warnings # type: ignore[attr-defined] # pyright: ignore[reportAttributeAccessIssue] +np.sys # type: ignore[attr-defined] # pyright: ignore[reportAttributeAccessIssue] +np.os # type: ignore[attr-defined] # pyright: ignore[reportAttributeAccessIssue] +np.math # type: ignore[attr-defined] # pyright: ignore[reportAttributeAccessIssue] +np.lib.recfunctions # type: ignore[attr-defined] # pyright: ignore[reportAttributeAccessIssue] + +np.__deprecated_attrs__ # type: ignore[attr-defined] # pyright: ignore[reportAttributeAccessIssue] +np.__expired_functions__ # type: ignore[attr-defined] # pyright: ignore[reportAttributeAccessIssue] diff --git a/test/static/reject/multiarray.pyi b/test/static/reject/multiarray.pyi index 0ee6c11..e71fda4 100644 --- a/test/static/reject/multiarray.pyi +++ b/test/static/reject/multiarray.pyi @@ -1,7 +1,10 @@ import numpy as np import numpy.typing as npt +AR_LIKE_f: list[float] + i8: np.int64 +M: np.datetime64 AR_b: npt.NDArray[np.bool] AR_u1: npt.NDArray[np.uint8] @@ -9,45 +12,42 @@ AR_i8: npt.NDArray[np.int64] AR_f8: npt.NDArray[np.float64] AR_M: npt.NDArray[np.datetime64] -M: np.datetime64 - -AR_LIKE_f: list[float] - def func(a: int) -> None: ... -np.where(AR_b, 1) # E: No overload variant +### -np.can_cast(AR_f8, 1) # E: incompatible type +np.where(AR_b, 1) # type: ignore[call-overload] # pyright: ignore[reportCallIssue] -np.vdot(AR_M, AR_M) # E: incompatible type +np.can_cast(AR_f8, 1) # type: ignore[arg-type] # pyright: ignore[reportArgumentType] -np.copyto(AR_LIKE_f, AR_f8) # E: incompatible type +np.vdot(AR_M, AR_M) # type: ignore[arg-type] # pyright: ignore[reportCallIssue,reportArgumentType] -np.putmask(AR_LIKE_f, [True, True, False], 1.5) # E: incompatible type +np.copyto(AR_LIKE_f, AR_f8) # type: ignore[arg-type] # pyright: ignore[reportArgumentType] -np.packbits(AR_f8) # E: incompatible type -np.packbits(AR_u1, bitorder=">") # E: incompatible type +np.putmask(AR_LIKE_f, [True, True, False], 1.5) # type: ignore[arg-type] # pyright: ignore[reportArgumentType] -np.unpackbits(AR_i8) # E: incompatible type -np.unpackbits(AR_u1, bitorder=">") # E: incompatible type +np.packbits(AR_f8) # type: ignore[arg-type] # pyright: ignore[reportArgumentType] +np.packbits(AR_u1, bitorder=">") # type: ignore[arg-type] # pyright: ignore[reportArgumentType] -np.shares_memory(1, 1, max_work=i8) # E: incompatible type -np.may_share_memory(1, 1, max_work=i8) # E: incompatible type +np.unpackbits(AR_i8) # type: ignore[arg-type] # pyright: ignore[reportArgumentType] +np.unpackbits(AR_u1, bitorder=">") # type: ignore[arg-type] # pyright: ignore[reportArgumentType] -np.arange(M) # E: No overload variant -np.arange(stop=10) # E: No overload variant +np.shares_memory(1, 1, max_work=i8) # type: ignore[arg-type] # pyright: ignore[reportArgumentType] +np.may_share_memory(1, 1, max_work=i8) # type: ignore[arg-type] # pyright: ignore[reportArgumentType] -np.datetime_data(int) # E: incompatible type +np.arange(M) # type: ignore[call-overload] # pyright: ignore[reportCallIssue,reportArgumentType] +np.arange(stop=10) # type: ignore[call-overload] # pyright: ignore[reportCallIssue] -np.busday_offset("2012", 10) # E: No overload variant +np.datetime_data(int) # type: ignore[arg-type] # pyright: ignore[reportArgumentType] +np.datetime_as_string("2012") # type: ignore[call-overload] # pyright: ignore[reportCallIssue,reportArgumentType] -np.datetime_as_string("2012") # E: No overload variant +np.busday_offset("2012", 10) # type: ignore[call-overload] # pyright: ignore[reportCallIssue,reportArgumentType] -np.char.compare_chararrays("a", b"a", "==", False) # E: No overload variant +np.char.compare_chararrays("a", b"a", "==", False) # type: ignore[call-overload] # pyright: ignore[reportCallIssue,reportArgumentType] -np.nested_iters([AR_i8, AR_i8]) # E: Missing positional argument -np.nested_iters([AR_i8, AR_i8], 0) # E: incompatible type -np.nested_iters([AR_i8, AR_i8], [0]) # E: incompatible type -np.nested_iters([AR_i8, AR_i8], [[0], [1]], flags=["test"]) # E: incompatible type -np.nested_iters([AR_i8, AR_i8], [[0], [1]], op_flags=[["test"]]) # E: incompatible type -np.nested_iters([AR_i8, AR_i8], [[0], [1]], buffersize=1.0) # E: incompatible type +np.nested_iters([AR_i8, AR_i8]) # type: ignore[call-arg] # pyright: ignore[reportCallIssue] +np.nested_iters([AR_i8, AR_i8], 0) # type: ignore[arg-type] # pyright: ignore[reportArgumentType] +np.nested_iters([AR_i8, AR_i8], [0]) # type: ignore[list-item] # pyright: ignore[reportArgumentType] +np.nested_iters([AR_i8, AR_i8], [[0], [1]], flags=["test"]) # type: ignore[list-item] # pyright: ignore[reportArgumentType] +np.nested_iters([AR_i8, AR_i8], [[0], [1]], op_flags=[["test"]]) # type: ignore[list-item] # pyright: ignore[reportArgumentType] +np.nested_iters([AR_i8, AR_i8], [[0], [1]], buffersize=1.0) # type: ignore[arg-type] # pyright: ignore[reportArgumentType] diff --git a/test/static/reject/ndarray.pyi b/test/static/reject/ndarray.pyi index 5ecae02..09f29e8 100644 --- a/test/static/reject/ndarray.pyi +++ b/test/static/reject/ndarray.pyi @@ -1,11 +1,8 @@ import numpy as np +import numpy.typing as npt -# Ban setting dtype since mutating the type of the array in place -# makes having ndarray be generic over dtype impossible. Generally -# users should use `ndarray.view` in this situation anyway. See -# -# https://github.com/numpy/numpy-stubs/issues/7 -# -# for more context. -float_array = np.array([1.0]) -float_array.dtype = np.bool # E: Property "dtype" defined in "ndarray" is read-only +AR_f8: npt.NDArray[np.float64] + +### + +AR_f8.dtype = np.bool # type: ignore[assignment,misc] # pyright: ignore[reportAttributeAccessIssue] diff --git a/test/static/reject/ndarray_misc.pyi b/test/static/reject/ndarray_misc.pyi index aadbb65..5eb841d 100644 --- a/test/static/reject/ndarray_misc.pyi +++ b/test/static/reject/ndarray_misc.pyi @@ -8,28 +8,30 @@ AR_b: npt.NDArray[np.bool] ctypes_obj = AR_f8.ctypes -reveal_type(ctypes_obj.get_data()) # E: has no attribute -reveal_type(ctypes_obj.get_shape()) # E: has no attribute -reveal_type(ctypes_obj.get_strides()) # E: has no attribute -reveal_type(ctypes_obj.get_as_parameter()) # E: has no attribute - -f8.argpartition(0) # E: has no attribute -f8.diagonal() # E: has no attribute -f8.dot(1) # E: has no attribute -f8.nonzero() # E: has no attribute -f8.partition(0) # E: has no attribute -f8.put(0, 2) # E: has no attribute -f8.setfield(2, np.float64) # E: has no attribute -f8.sort() # E: has no attribute -f8.trace() # E: has no attribute - -int(AR_M) # E: Invalid self argument -float(AR_M) # E: Invalid self argument -complex(AR_M) # E: Invalid self argument -AR_b.__index__() # E: Invalid self argument - -AR_f8[1.5] # E: No overload variant -AR_f8["field_a"] # E: No overload variant -AR_f8[["field_a", "field_b"]] # E: Invalid index type - -AR_f8.__array_finalize__(object()) # E: incompatible type +### + +ctypes_obj.get_data() # type: ignore[attr-defined] # pyright: ignore[reportAttributeAccessIssue] +ctypes_obj.get_shape() # type: ignore[attr-defined] # pyright: ignore[reportAttributeAccessIssue] +ctypes_obj.get_strides() # type: ignore[attr-defined] # pyright: ignore[reportAttributeAccessIssue] +ctypes_obj.get_as_parameter() # type: ignore[attr-defined] # pyright: ignore[reportAttributeAccessIssue] + +f8.argpartition(0) # type: ignore[attr-defined] # pyright: ignore[reportAttributeAccessIssue] +f8.diagonal() # type: ignore[attr-defined] # pyright: ignore[reportAttributeAccessIssue] +f8.dot(1) # type: ignore[attr-defined] # pyright: ignore[reportAttributeAccessIssue] +f8.nonzero() # type: ignore[attr-defined] # pyright: ignore[reportAttributeAccessIssue] +f8.partition(0) # type: ignore[attr-defined] # pyright: ignore[reportAttributeAccessIssue] +f8.put(0, 2) # type: ignore[attr-defined] # pyright: ignore[reportAttributeAccessIssue] +f8.setfield(2, np.float64) # type: ignore[attr-defined] # pyright: ignore[reportAttributeAccessIssue] +f8.sort() # type: ignore[attr-defined] # pyright: ignore[reportAttributeAccessIssue] +f8.trace() # type: ignore[attr-defined] # pyright: ignore[reportAttributeAccessIssue] + +int(AR_M) # pyright: ignore[reportArgumentType] +float(AR_M) # pyright: ignore[reportArgumentType] +complex(AR_M) # pyright: ignore[reportCallIssue,reportArgumentType] +AR_b.__index__() # type: ignore[misc] # pyright: ignore[reportAttributeAccessIssue] + +AR_f8[1.5] # type: ignore[call-overload] # pyright: ignore[reportCallIssue,reportArgumentType] +AR_f8["field_a"] # type: ignore[call-overload] # pyright: ignore[reportCallIssue,reportArgumentType] +AR_f8[["field_a", "field_b"]] # type: ignore[index] # pyright: ignore[reportCallIssue,reportArgumentType] + +AR_f8.__array_finalize__(object()) # type: ignore[arg-type] # pyright: ignore[reportArgumentType] diff --git a/test/static/reject/nditer.pyi b/test/static/reject/nditer.pyi index 1e8e37e..4ac7fbc 100644 --- a/test/static/reject/nditer.pyi +++ b/test/static/reject/nditer.pyi @@ -1,8 +1,8 @@ import numpy as np -class Test(np.nditer): ... # E: Cannot inherit from final class +class Test(np.nditer): ... # type: ignore[misc] # pyright: ignore[reportGeneralTypeIssues] -np.nditer([0, 1], flags=["test"]) # E: incompatible type -np.nditer([0, 1], op_flags=[["test"]]) # E: incompatible type -np.nditer([0, 1], itershape=(1.0,)) # E: incompatible type -np.nditer([0, 1], buffersize=1.0) # E: incompatible type +np.nditer([0, 1], flags=["test"]) # type: ignore[list-item] # pyright: ignore[reportArgumentType] +np.nditer([0, 1], op_flags=[["test"]]) # type: ignore[list-item] # pyright: ignore[reportArgumentType] +np.nditer([0, 1], itershape=(1.0,)) # type: ignore[arg-type] # pyright: ignore[reportArgumentType] +np.nditer([0, 1], buffersize=1.0) # type: ignore[arg-type] # pyright: ignore[reportArgumentType] diff --git a/test/static/reject/nested_sequence.pyi b/test/static/reject/nested_sequence.pyi index 8fbdef8..149f58b 100644 --- a/test/static/reject/nested_sequence.pyi +++ b/test/static/reject/nested_sequence.pyi @@ -10,8 +10,8 @@ e: str def func(a: _NestedSequence[int]) -> None: ... -reveal_type(func(a)) # E: incompatible type -reveal_type(func(b)) # E: incompatible type -reveal_type(func(c)) # E: incompatible type -reveal_type(func(d)) # E: incompatible type -reveal_type(func(e)) # E: incompatible type +func(a) # type: ignore[arg-type] # pyright: ignore[reportArgumentType] +func(b) # type: ignore[arg-type] # pyright: ignore[reportArgumentType] +func(c) # type: ignore[arg-type] # pyright: ignore[reportArgumentType] +func(d) # type: ignore[arg-type] # pyright: ignore[reportArgumentType] +func(e) # type: ignore[arg-type] # pyright: ignore[reportArgumentType] diff --git a/test/static/reject/npyio.pyi b/test/static/reject/npyio.pyi index a03f827..358b940 100644 --- a/test/static/reject/npyio.pyi +++ b/test/static/reject/npyio.pyi @@ -10,16 +10,10 @@ pathlib_path: pathlib.Path str_file: IO[str] AR_i8: npt.NDArray[np.int64] -np.load(str_file) # E: incompatible type +np.save(bytes_path, AR_i8) # type: ignore[call-overload] # pyright: ignore[reportArgumentType] +np.savez(bytes_path, AR_i8) # type: ignore[arg-type] # pyright: ignore[reportArgumentType] +np.savez_compressed(bytes_path, AR_i8) # type: ignore[arg-type] # pyright: ignore[reportArgumentType] -np.save(bytes_path, AR_i8) # E: No overload variant -# https://github.com/python/mypy/issues/16111 -# np.save(str_path, AR_i8, fix_imports=True) # W: deprecated - -np.savez(bytes_path, AR_i8) # E: incompatible type - -np.savez_compressed(bytes_path, AR_i8) # E: incompatible type - -np.loadtxt(bytes_path) # E: incompatible type - -np.fromregex(bytes_path, ".", np.int64) # E: No overload variant +np.load(str_file) # type: ignore[arg-type] # pyright: ignore[reportArgumentType] +np.loadtxt(bytes_path) # type: ignore[arg-type] # pyright: ignore[reportArgumentType] +np.fromregex(bytes_path, ".", np.int64) # type: ignore[call-overload] # pyright: ignore[reportCallIssue,reportArgumentType] diff --git a/test/static/reject/numerictypes.pyi b/test/static/reject/numerictypes.pyi index 29a3cf3..8196bd7 100644 --- a/test/static/reject/numerictypes.pyi +++ b/test/static/reject/numerictypes.pyi @@ -1,5 +1,4 @@ import numpy as np -np.isdtype(1, np.int64) # E: incompatible type - -np.issubdtype(1, np.int64) # E: incompatible type +np.isdtype(1, np.int64) # type: ignore[arg-type] # pyright: ignore[reportArgumentType] +np.issubdtype(1, np.int64) # type: ignore[arg-type] # pyright: ignore[reportArgumentType] diff --git a/test/static/reject/rec.pyi b/test/static/reject/rec.pyi index 52ee5db..c10e7f2 100644 --- a/test/static/reject/rec.pyi +++ b/test/static/reject/rec.pyi @@ -3,15 +3,27 @@ import numpy.typing as npt AR_i8: npt.NDArray[np.int64] -np.rec.fromarrays(1) # E: No overload variant -np.rec.fromarrays([1, 2, 3], dtype=[("f8", "f8")], formats=["f8", "f8"]) # E: No overload variant +np.rec.fromarrays(1) # type: ignore[call-overload] # pyright: ignore[reportArgumentType] +np.rec.fromarrays( # type: ignore[call-overload] # pyright: ignore[reportCallIssue] + [1, 2, 3], + dtype=[("f8", "f8")], + formats=["f8", "f8"], # pyright: ignore[reportArgumentType] +) -np.rec.fromrecords(AR_i8) # E: incompatible type -np.rec.fromrecords([(1.5,)], dtype=[("f8", "f8")], formats=["f8", "f8"]) # E: No overload variant +np.rec.fromrecords(AR_i8) # type: ignore[arg-type] # pyright: ignore[reportCallIssue,reportArgumentType] +np.rec.fromrecords( # type: ignore[call-overload] # pyright: ignore[reportCallIssue] + [(1.5,)], + dtype=[("f8", "f8")], + formats=["f8", "f8"], # pyright: ignore[reportArgumentType] +) -np.rec.fromstring("string", dtype=[("f8", "f8")]) # E: No overload variant -np.rec.fromstring(b"bytes") # E: No overload variant -np.rec.fromstring(b"(1.5,)", dtype=[("f8", "f8")], formats=["f8", "f8"]) # E: No overload variant +np.rec.fromstring("string", dtype=[("f8", "f8")]) # type: ignore[call-overload] # pyright: ignore[reportArgumentType] +np.rec.fromstring(b"bytes") # type: ignore[call-overload] # pyright: ignore[reportCallIssue] +np.rec.fromstring( # type: ignore[call-overload] # pyright: ignore[reportCallIssue] + b"(1.5,)", + dtype=[("f8", "f8")], + formats=["f8", "f8"], # pyright: ignore[reportArgumentType] +) with open("test", encoding="utf-8") as f: - np.rec.fromfile(f, dtype=[("f8", "f8")]) # E: No overload variant + np.rec.fromfile(f, dtype=[("f8", "f8")]) # type: ignore[call-overload] # pyright: ignore[reportArgumentType] diff --git a/test/static/reject/ruff.toml b/test/static/reject/ruff.toml index d00c19e..e43eb17 100644 --- a/test/static/reject/ruff.toml +++ b/test/static/reject/ruff.toml @@ -2,4 +2,8 @@ extend = "../ruff.toml" builtins = ["reveal_type"] [lint] -extend-ignore = ["B"] # flake8-bugbear +extend-ignore = [ + "B", # flake8-bugbear + "PYI015", # flake8-pyi: assignment-default-in-stub + "SIM300", # flake8-pyi: yoda-conditions +] diff --git a/test/static/reject/scalars.pyi b/test/static/reject/scalars.pyi index b844fb3..74a9d73 100644 --- a/test/static/reject/scalars.pyi +++ b/test/static/reject/scalars.pyi @@ -4,84 +4,69 @@ f2: np.float16 f8: np.float64 c8: np.complex64 -# Construction - -np.float32(3j) # E: incompatible type - -# Technically the following examples are valid NumPy code. But they -# are not considered a best practice, and people who wish to use the -# stubs should instead do -# -# np.array([1.0, 0.0, 0.0], dtype=np.float32) -# np.array([], dtype=np.complex64) -# -# See e.g. the discussion on the mailing list -# -# https://mail.python.org/pipermail/numpy-discussion/2020-April/080566.html -# -# and the issue -# -# https://github.com/numpy/numpy-stubs/issues/41 -# -# for more context. -np.float32([1.0, 0.0, 0.0]) # E: incompatible type -np.complex64([]) # E: incompatible type - -np.complex64(1, 2) # E: Too many arguments -# TODO: protocols (can't check for non-existent protocols w/ __getattr__) - -np.datetime64(0) # E: No overload variant - class A: def __float__(self) -> float: ... -np.int8(A()) # E: incompatible type -np.int16(A()) # E: incompatible type -np.int32(A()) # E: incompatible type -np.int64(A()) # E: incompatible type -np.uint8(A()) # E: incompatible type -np.uint16(A()) # E: incompatible type -np.uint32(A()) # E: incompatible type -np.uint64(A()) # E: incompatible type - -np.void("test") # E: No overload variant -np.void("test", dtype=None) # E: No overload variant - -np.generic(1) # E: Cannot instantiate abstract class -np.number(1) # E: Cannot instantiate abstract class -np.integer(1) # E: Cannot instantiate abstract class -np.inexact(1) # E: Cannot instantiate abstract class -np.character("test") # E: Cannot instantiate abstract class -np.flexible(b"test") # E: Cannot instantiate abstract class - -np.float64(value=0.0) # E: Unexpected keyword argument -np.int64(value=0) # E: Unexpected keyword argument -np.uint64(value=0) # E: Unexpected keyword argument -np.complex128(value=0.0j) # E: Unexpected keyword argument -np.str_(value="bob") # E: No overload variant -np.bytes_(value=b"test") # E: No overload variant -np.void(value=b"test") # E: No overload variant -np.bool(value=True) # E: Unexpected keyword argument -np.datetime64(value="2019") # E: No overload variant -np.timedelta64(value=0) # E: Unexpected keyword argument - -np.bytes_(b"hello", encoding="utf-8") # E: No overload variant -np.str_("hello", encoding="utf-8") # E: No overload variant - -f8.item(1) # E: incompatible type -f8.item((0, 1)) # E: incompatible type -f8.squeeze(axis=1) # E: incompatible type -f8.squeeze(axis=(0, 1)) # E: incompatible type -f8.transpose(1) # E: incompatible type +### + +# Construction + +np.float32(3j) # type: ignore[arg-type] # pyright: ignore[reportArgumentType] +np.float32([1.0, 0.0, 0.0]) # type: ignore[arg-type] # pyright: ignore[reportArgumentType] + +np.complex64([]) # type: ignore[arg-type] # pyright: ignore[reportArgumentType] +np.complex64(1, 2) # type: ignore[call-arg] # pyright: ignore[reportCallIssue] + +np.datetime64(0) # type: ignore[call-overload] # pyright: ignore[reportCallIssue,reportArgumentType] + +np.int8(A()) # type: ignore[arg-type] # pyright: ignore[reportArgumentType] +np.int16(A()) # type: ignore[arg-type] # pyright: ignore[reportArgumentType] +np.int32(A()) # type: ignore[arg-type] # pyright: ignore[reportArgumentType] +np.int64(A()) # type: ignore[arg-type] # pyright: ignore[reportArgumentType] +np.uint8(A()) # type: ignore[arg-type] # pyright: ignore[reportArgumentType] +np.uint16(A()) # type: ignore[arg-type] # pyright: ignore[reportArgumentType] +np.uint32(A()) # type: ignore[arg-type] # pyright: ignore[reportArgumentType] +np.uint64(A()) # type: ignore[arg-type] # pyright: ignore[reportArgumentType] + +np.void("test") # type: ignore[call-overload] # pyright: ignore[reportArgumentType] +np.void("test", dtype=None) # type: ignore[call-overload] # pyright: ignore[reportCallIssue,reportArgumentType] + +# pyright doesn't care? +np.generic(1) # type: ignore[abstract] +np.number(1) # type: ignore[abstract] +np.integer(1) # type: ignore[abstract] +np.inexact(1) # type: ignore[abstract] +np.character("test") # type: ignore[abstract] +np.flexible(b"test") # type: ignore[abstract] + +np.float64(value=0.0) # type: ignore[call-arg] # pyright: ignore[reportCallIssue] +np.int64(value=0) # type: ignore[call-arg] # pyright: ignore[reportCallIssue] +np.uint64(value=0) # type: ignore[call-arg] # pyright: ignore[reportCallIssue] +np.complex128(value=0.0j) # type: ignore[call-arg] # pyright: ignore[reportCallIssue] +np.str_(value="bob") # type: ignore[call-overload] # pyright: ignore[reportCallIssue] +np.bytes_(value=b"test") # type: ignore[call-overload] # pyright: ignore[reportCallIssue] +np.void(value=b"test") # type: ignore[call-overload] # pyright: ignore[reportCallIssue] +np.bool(value=True) # type: ignore[call-overload] # pyright: ignore[reportCallIssue] +np.datetime64(value="2019") # type: ignore[call-overload] # pyright: ignore[reportCallIssue] +np.timedelta64(value=0) # type: ignore[call-overload] # pyright: ignore[reportCallIssue] + +np.bytes_(b"hello", encoding="utf-8") # type: ignore[call-overload] # pyright: ignore[reportArgumentType] +np.str_("hello", encoding="utf-8") # type: ignore[call-overload] # pyright: ignore[reportArgumentType] + +f8.item(1) # type: ignore[call-overload] # pyright: ignore[reportArgumentType] +f8.item((0, 1)) # type: ignore[arg-type] # pyright: ignore[reportArgumentType] +f8.squeeze(axis=1) # type: ignore[arg-type] # pyright: ignore[reportArgumentType] +f8.squeeze(axis=(0, 1)) # type: ignore[arg-type] # pyright: ignore[reportArgumentType] +f8.transpose(1) # type: ignore[arg-type] # pyright: ignore[reportArgumentType] def func(a: np.float32) -> None: ... -func(f2) # E: incompatible type -func(f8) # E: incompatible type +func(f2) # type: ignore[arg-type] # pyright: ignore[reportArgumentType] +func(f8) # type: ignore[arg-type] # pyright: ignore[reportArgumentType] -c8.__getnewargs__() # E: Invalid self argument -f2.__getnewargs__() # E: Invalid self argument -f2.hex() # E: Invalid self argument -np.float16.fromhex("0x0.0p+0") # E: Invalid self argument -f2.__trunc__() # E: Invalid self argument # noqa: PLC2801 -f2.__getformat__("float") # E: Invalid self argument +c8.__getnewargs__() # type: ignore[attr-defined] # pyright: ignore[reportAttributeAccessIssue] +f2.__getnewargs__() # type: ignore[attr-defined] # pyright: ignore[reportAttributeAccessIssue] +f2.hex() # type: ignore[attr-defined] # pyright: ignore[reportAttributeAccessIssue] +np.float16.fromhex("0x0.0p+0") # type: ignore[attr-defined] # pyright: ignore[reportAttributeAccessIssue] +f2.__trunc__() # type: ignore[attr-defined] # pyright: ignore[reportAttributeAccessIssue] # noqa: PLC2801 +f2.__getformat__("float") # type: ignore[attr-defined] # pyright: ignore[reportAttributeAccessIssue] diff --git a/test/static/reject/shape.pyi b/test/static/reject/shape.pyi index 7368876..294efa1 100644 --- a/test/static/reject/shape.pyi +++ b/test/static/reject/shape.pyi @@ -4,4 +4,4 @@ import numpy as np # test bounds of _ShapeType_co -np.ndarray[tuple[str, str], Any] # E: Value of type variable +np.ndarray[tuple[str, str], Any] # type: ignore[type-var] # pyright: ignore[reportInvalidTypeArguments] diff --git a/test/static/reject/shape_base.pyi b/test/static/reject/shape_base.pyi index e709741..7d9e45d 100644 --- a/test/static/reject/shape_base.pyi +++ b/test/static/reject/shape_base.pyi @@ -5,4 +5,4 @@ class DTypeLike: dtype_like: DTypeLike -np.expand_dims(dtype_like, (5, 10)) # E: No overload variant +np.expand_dims(dtype_like, (5, 10)) # type: ignore[call-overload] # pyright: ignore[reportCallIssue,reportArgumentType] diff --git a/test/static/reject/stride_tricks.pyi b/test/static/reject/stride_tricks.pyi index f2bfba7..5d8f91d 100644 --- a/test/static/reject/stride_tricks.pyi +++ b/test/static/reject/stride_tricks.pyi @@ -1,9 +1,11 @@ import numpy as np import numpy.typing as npt +from numpy.lib import stride_tricks AR_f8: npt.NDArray[np.float64] -np.lib.stride_tricks.as_strided(AR_f8, shape=8) # E: No overload variant -np.lib.stride_tricks.as_strided(AR_f8, strides=8) # E: No overload variant +### -np.lib.stride_tricks.sliding_window_view(AR_f8, axis=(1,)) # E: No overload variant +stride_tricks.as_strided(AR_f8, shape=8) # type: ignore[call-overload] # pyright: ignore[reportCallIssue,reportArgumentType] +stride_tricks.as_strided(AR_f8, strides=8) # type: ignore[call-overload] # pyright: ignore[reportCallIssue,reportArgumentType] +stride_tricks.sliding_window_view(AR_f8, axis=(1,)) # type: ignore[call-overload] # pyright: ignore[reportCallIssue] diff --git a/test/static/reject/strings.pyi b/test/static/reject/strings.pyi index bf50012..e4849bb 100644 --- a/test/static/reject/strings.pyi +++ b/test/static/reject/strings.pyi @@ -4,61 +4,56 @@ import numpy.typing as npt AR_U: npt.NDArray[np.str_] AR_S: npt.NDArray[np.bytes_] -np.strings.equal(AR_U, AR_S) # E: incompatible type - -np.strings.not_equal(AR_U, AR_S) # E: incompatible type - -np.strings.greater_equal(AR_U, AR_S) # E: incompatible type - -np.strings.less_equal(AR_U, AR_S) # E: incompatible type - -np.strings.greater(AR_U, AR_S) # E: incompatible type - -np.strings.less(AR_U, AR_S) # E: incompatible type - -np.strings.encode(AR_S) # E: incompatible type -np.strings.decode(AR_U) # E: incompatible type - -np.strings.join(AR_U, b"_") # E: incompatible type -np.strings.join(AR_S, "_") # E: incompatible type - -np.strings.ljust(AR_U, 5, fillchar=b"a") # E: incompatible type -np.strings.ljust(AR_S, 5, fillchar="a") # E: incompatible type -np.strings.rjust(AR_U, 5, fillchar=b"a") # E: incompatible type -np.strings.rjust(AR_S, 5, fillchar="a") # E: incompatible type - -np.strings.lstrip(AR_U, b"a") # E: incompatible type -np.strings.lstrip(AR_S, "a") # E: incompatible type -np.strings.strip(AR_U, b"a") # E: incompatible type -np.strings.strip(AR_S, "a") # E: incompatible type -np.strings.rstrip(AR_U, b"a") # E: incompatible type -np.strings.rstrip(AR_S, "a") # E: incompatible type - -np.strings.partition(AR_U, b"a") # E: incompatible type -np.strings.partition(AR_S, "a") # E: incompatible type -np.strings.rpartition(AR_U, b"a") # E: incompatible type -np.strings.rpartition(AR_S, "a") # E: incompatible type - -np.strings.count(AR_U, b"a", [1, 2, 3], [1, 2, 3]) # E: incompatible type -np.strings.count(AR_S, "a", 0, 9) # E: incompatible type - -np.strings.endswith(AR_U, b"a", [1, 2, 3], [1, 2, 3]) # E: incompatible type -np.strings.endswith(AR_S, "a", 0, 9) # E: incompatible type -np.strings.startswith(AR_U, b"a", [1, 2, 3], [1, 2, 3]) # E: incompatible type -np.strings.startswith(AR_S, "a", 0, 9) # E: incompatible type - -np.strings.find(AR_U, b"a", [1, 2, 3], [1, 2, 3]) # E: incompatible type -np.strings.find(AR_S, "a", 0, 9) # E: incompatible type -np.strings.rfind(AR_U, b"a", [1, 2, 3], [1, 2, 3]) # E: incompatible type -np.strings.rfind(AR_S, "a", 0, 9) # E: incompatible type - -np.strings.index(AR_U, b"a", start=[1, 2, 3]) # E: incompatible type -np.strings.index(AR_S, "a", end=9) # E: incompatible type -np.strings.rindex(AR_U, b"a", start=[1, 2, 3]) # E: incompatible type -np.strings.rindex(AR_S, "a", end=9) # E: incompatible type - -np.strings.isdecimal(AR_S) # E: incompatible type -np.strings.isnumeric(AR_S) # E: incompatible type - -np.strings.replace(AR_U, b"_", b"-", 10) # E: incompatible type -np.strings.replace(AR_S, "_", "-", 1) # E: incompatible type +np.strings.equal(AR_U, AR_S) # type: ignore[arg-type] # pyright: ignore[reportCallIssue,reportArgumentType] +np.strings.not_equal(AR_U, AR_S) # type: ignore[arg-type] # pyright: ignore[reportCallIssue,reportArgumentType] + +np.strings.greater_equal(AR_U, AR_S) # type: ignore[arg-type] # pyright: ignore[reportCallIssue,reportArgumentType] +np.strings.greater(AR_U, AR_S) # type: ignore[arg-type] # pyright: ignore[reportCallIssue,reportArgumentType] +np.strings.less_equal(AR_U, AR_S) # type: ignore[arg-type] # pyright: ignore[reportCallIssue,reportArgumentType] +np.strings.less(AR_U, AR_S) # type: ignore[arg-type] # pyright: ignore[reportCallIssue,reportArgumentType] + +np.strings.encode(AR_S) # type: ignore[arg-type] # pyright: ignore[reportArgumentType] +np.strings.decode(AR_U) # type: ignore[arg-type] # pyright: ignore[reportArgumentType] + +np.strings.join(AR_U, b"_") # type: ignore[attr-defined] # pyright: ignore[reportAttributeAccessIssue] + +np.strings.ljust(AR_U, 5, fillchar=b"a") # type: ignore[arg-type] # pyright: ignore[reportCallIssue,reportArgumentType] +np.strings.ljust(AR_S, 5, fillchar="a") # type: ignore[arg-type] # pyright: ignore[reportCallIssue,reportArgumentType] +np.strings.rjust(AR_U, 5, fillchar=b"a") # type: ignore[arg-type] # pyright: ignore[reportCallIssue,reportArgumentType] +np.strings.rjust(AR_S, 5, fillchar="a") # type: ignore[arg-type] # pyright: ignore[reportCallIssue,reportArgumentType] + +np.strings.lstrip(AR_U, b"a") # type: ignore[arg-type] # pyright: ignore[reportCallIssue,reportArgumentType] +np.strings.lstrip(AR_S, "a") # type: ignore[arg-type] # pyright: ignore[reportCallIssue,reportArgumentType] +np.strings.strip(AR_U, b"a") # type: ignore[arg-type] # pyright: ignore[reportCallIssue,reportArgumentType] +np.strings.strip(AR_S, "a") # type: ignore[arg-type] # pyright: ignore[reportCallIssue,reportArgumentType] +np.strings.rstrip(AR_U, b"a") # type: ignore[arg-type] # pyright: ignore[reportCallIssue,reportArgumentType] +np.strings.rstrip(AR_S, "a") # type: ignore[arg-type] # pyright: ignore[reportCallIssue,reportArgumentType] + +np.strings.partition(AR_U, b"a") # type: ignore[arg-type] # pyright: ignore[reportCallIssue,reportArgumentType] +np.strings.partition(AR_S, "a") # type: ignore[arg-type] # pyright: ignore[reportCallIssue,reportArgumentType] +np.strings.rpartition(AR_U, b"a") # type: ignore[arg-type] # pyright: ignore[reportCallIssue,reportArgumentType] +np.strings.rpartition(AR_S, "a") # type: ignore[arg-type] # pyright: ignore[reportCallIssue,reportArgumentType] + +np.strings.count(AR_U, b"a", [1, 2, 3], [1, 2, 3]) # type: ignore[arg-type] # pyright: ignore[reportCallIssue,reportArgumentType] +np.strings.count(AR_S, "a", 0, 9) # type: ignore[arg-type] # pyright: ignore[reportCallIssue,reportArgumentType] + +np.strings.endswith(AR_U, b"a", [1, 2, 3], [1, 2, 3]) # type: ignore[arg-type] # pyright: ignore[reportCallIssue,reportArgumentType] +np.strings.endswith(AR_S, "a", 0, 9) # type: ignore[arg-type] # pyright: ignore[reportCallIssue,reportArgumentType] +np.strings.startswith(AR_U, b"a", [1, 2, 3], [1, 2, 3]) # type: ignore[arg-type] # pyright: ignore[reportCallIssue,reportArgumentType] +np.strings.startswith(AR_S, "a", 0, 9) # type: ignore[arg-type] # pyright: ignore[reportCallIssue,reportArgumentType] + +np.strings.find(AR_U, b"a", [1, 2, 3], [1, 2, 3]) # type: ignore[arg-type] # pyright: ignore[reportCallIssue,reportArgumentType] +np.strings.find(AR_S, "a", 0, 9) # type: ignore[arg-type] # pyright: ignore[reportCallIssue,reportArgumentType] +np.strings.rfind(AR_U, b"a", [1, 2, 3], [1, 2, 3]) # type: ignore[arg-type] # pyright: ignore[reportCallIssue,reportArgumentType] +np.strings.rfind(AR_S, "a", 0, 9) # type: ignore[arg-type] # pyright: ignore[reportCallIssue,reportArgumentType] + +np.strings.index(AR_U, b"a", start=[1, 2, 3]) # type: ignore[arg-type] # pyright: ignore[reportCallIssue,reportArgumentType] +np.strings.index(AR_S, "a", end=9) # type: ignore[arg-type] # pyright: ignore[reportCallIssue,reportArgumentType] +np.strings.rindex(AR_U, b"a", start=[1, 2, 3]) # type: ignore[arg-type] # pyright: ignore[reportCallIssue,reportArgumentType] +np.strings.rindex(AR_S, "a", end=9) # type: ignore[arg-type] # pyright: ignore[reportCallIssue,reportArgumentType] + +np.strings.isdecimal(AR_S) # type: ignore[arg-type] # pyright: ignore[reportArgumentType] +np.strings.isnumeric(AR_S) # type: ignore[arg-type] # pyright: ignore[reportArgumentType] + +np.strings.replace(AR_U, b"_", b"-", 10) # type: ignore[arg-type] # pyright: ignore[reportCallIssue,reportArgumentType] +np.strings.replace(AR_S, "_", "-", 1) # type: ignore[arg-type] # pyright: ignore[reportCallIssue,reportArgumentType] diff --git a/test/static/reject/testing.pyi b/test/static/reject/testing.pyi index 785645a..91155f1 100644 --- a/test/static/reject/testing.pyi +++ b/test/static/reject/testing.pyi @@ -5,24 +5,24 @@ AR_U: npt.NDArray[np.str_] def func() -> bool: ... -np.testing.assert_(True, msg=1) # E: incompatible type # noqa: PT009 -np.testing.build_err_msg(1, "test") # E: incompatible type -np.testing.assert_almost_equal(AR_U, AR_U) # E: incompatible type -np.testing.assert_approx_equal([1, 2, 3], [1, 2, 3]) # E: incompatible type -np.testing.assert_array_almost_equal(AR_U, AR_U) # E: incompatible type -np.testing.assert_array_less(AR_U, AR_U) # E: incompatible type -np.testing.assert_string_equal(b"a", b"a") # E: incompatible type +np.testing.assert_(True, msg=1) # type: ignore[arg-type] # pyright: ignore[reportArgumentType] # noqa: PT009 +np.testing.build_err_msg(1, "test") # type: ignore[arg-type] # pyright: ignore[reportArgumentType] +np.testing.assert_almost_equal(AR_U, AR_U) # type: ignore[arg-type] # pyright: ignore[reportArgumentType] +np.testing.assert_approx_equal([1, 2, 3], [1, 2, 3]) # type: ignore[arg-type] # pyright: ignore[reportArgumentType] +np.testing.assert_array_almost_equal(AR_U, AR_U) # type: ignore[arg-type] # pyright: ignore[reportArgumentType] +np.testing.assert_array_less(AR_U, AR_U) # type: ignore[arg-type] # pyright: ignore[reportCallIssue,reportArgumentType] +np.testing.assert_string_equal(b"a", b"a") # type: ignore[arg-type] # pyright: ignore[reportArgumentType] -np.testing.assert_raises(expected_exception=TypeError, callable=func) # E: No overload variant -np.testing.assert_raises_regex(expected_exception=TypeError, expected_regex="T", callable=func) # E: No overload variant +np.testing.assert_raises(expected_exception=TypeError, callable=func) # type: ignore[call-overload] # pyright: ignore[reportCallIssue] +np.testing.assert_raises_regex(expected_exception=TypeError, expected_regex="T", callable=func) # type: ignore[call-overload] # pyright: ignore[reportCallIssue] -np.testing.assert_allclose(AR_U, AR_U) # E: incompatible type -np.testing.assert_array_almost_equal_nulp(AR_U, AR_U) # E: incompatible type -np.testing.assert_array_max_ulp(AR_U, AR_U) # E: incompatible type +np.testing.assert_allclose(AR_U, AR_U) # type: ignore[arg-type] # pyright: ignore[reportCallIssue,reportArgumentType] +np.testing.assert_array_almost_equal_nulp(AR_U, AR_U) # type: ignore[arg-type] # pyright: ignore[reportArgumentType] +np.testing.assert_array_max_ulp(AR_U, AR_U) # type: ignore[arg-type] # pyright: ignore[reportArgumentType] -np.testing.assert_warns(warning_class=RuntimeWarning, func=func) # E: No overload variant -np.testing.assert_no_warnings(func=func) # E: No overload variant -np.testing.assert_no_warnings(func, None) # E: Too many arguments -np.testing.assert_no_warnings(func, test=None) # E: No overload variant +np.testing.assert_warns(warning_class=RuntimeWarning, func=func) # type: ignore[call-overload] # pyright: ignore[reportCallIssue] +np.testing.assert_no_warnings(func=func) # type: ignore[call-overload] # pyright: ignore[reportCallIssue] +np.testing.assert_no_warnings(func, None) # type: ignore[call-overload] # pyright: ignore[reportCallIssue] +np.testing.assert_no_warnings(func, test=None) # type: ignore[call-overload] # pyright: ignore[reportCallIssue] -np.testing.assert_no_gc_cycles(func=func) # E: No overload variant +np.testing.assert_no_gc_cycles(func=func) # type: ignore[call-overload] # pyright: ignore[reportCallIssue] diff --git a/test/static/reject/twodim_base.pyi b/test/static/reject/twodim_base.pyi index dea3888..710e2e8 100644 --- a/test/static/reject/twodim_base.pyi +++ b/test/static/reject/twodim_base.pyi @@ -11,21 +11,21 @@ AR_m: npt.NDArray[np.timedelta64] AR_LIKE_b: list[bool] -np.eye(10, M=20.0) # E: No overload variant -np.eye(10, k=2.5, dtype=int) # E: No overload variant +np.eye(10, M=20.0) # type: ignore[call-overload] # pyright: ignore[reportCallIssue,reportArgumentType] +np.eye(10, k=2.5, dtype=int) # type: ignore[call-overload] # pyright: ignore[reportCallIssue,reportArgumentType] -np.diag(AR_b, k=0.5) # E: No overload variant -np.diagflat(AR_b, k=0.5) # E: No overload variant +np.diag(AR_b, k=0.5) # type: ignore[call-overload] # pyright: ignore[reportCallIssue,reportArgumentType] +np.diagflat(AR_b, k=0.5) # type: ignore[call-overload] # pyright: ignore[reportCallIssue,reportArgumentType] -np.tri(10, M=20.0) # E: No overload variant -np.tri(10, k=2.5, dtype=int) # E: No overload variant +np.tri(10, M=20.0) # type: ignore[call-overload] # pyright: ignore[reportCallIssue,reportArgumentType] +np.tri(10, k=2.5, dtype=int) # type: ignore[call-overload] # pyright: ignore[reportCallIssue,reportArgumentType] -np.tril(AR_b, k=0.5) # E: No overload variant -np.triu(AR_b, k=0.5) # E: No overload variant +np.tril(AR_b, k=0.5) # type: ignore[call-overload] # pyright: ignore[reportCallIssue,reportArgumentType] +np.triu(AR_b, k=0.5) # type: ignore[call-overload] # pyright: ignore[reportCallIssue,reportArgumentType] -np.vander(AR_m) # E: incompatible type +np.vander(AR_m) # type: ignore[arg-type] # pyright: ignore[reportCallIssue,reportArgumentType] -np.histogram2d(AR_m) # E: No overload variant +np.histogram2d(AR_m) # type: ignore[call-overload] # pyright: ignore[reportCallIssue] -np.mask_indices(10, func1) # E: incompatible type -np.mask_indices(10, func2, 10.5) # E: incompatible type +np.mask_indices(10, func1) # type: ignore[arg-type] # pyright: ignore[reportArgumentType] +np.mask_indices(10, func2, 10.5) # type: ignore[arg-type] # pyright: ignore[reportCallIssue,reportArgumentType] diff --git a/test/static/reject/type_check.pyi b/test/static/reject/type_check.pyi index 8e0288d..06c8fe6 100644 --- a/test/static/reject/type_check.pyi +++ b/test/static/reject/type_check.pyi @@ -2,11 +2,11 @@ import numpy as np DTYPE_i8: np.dtype[np.int64] -np.mintypecode(DTYPE_i8) # E: incompatible type -np.iscomplexobj(DTYPE_i8) # E: incompatible type -np.isrealobj(DTYPE_i8) # E: incompatible type +np.mintypecode(DTYPE_i8) # type: ignore[arg-type] # pyright: ignore[reportArgumentType] +np.iscomplexobj(DTYPE_i8) # type: ignore[arg-type] # pyright: ignore[reportArgumentType] +np.isrealobj(DTYPE_i8) # type: ignore[arg-type] # pyright: ignore[reportArgumentType] -np.typename(DTYPE_i8) # E: No overload variant -np.typename("invalid") # E: No overload variant +np.typename(DTYPE_i8) # type: ignore[call-overload] # pyright: ignore[reportCallIssue,reportArgumentType] +np.typename("invalid") # type: ignore[call-overload] # pyright: ignore[reportCallIssue,reportArgumentType] -np.common_type(np.timedelta64()) # E: incompatible type +np.common_type(np.timedelta64()) # type: ignore[arg-type] # pyright: ignore[reportCallIssue,reportArgumentType] diff --git a/test/static/reject/ufunc_config.pyi b/test/static/reject/ufunc_config.pyi index f2804b7..cd96cb7 100644 --- a/test/static/reject/ufunc_config.pyi +++ b/test/static/reject/ufunc_config.pyi @@ -1,8 +1,5 @@ import numpy as np -def func1(a: str, b: int, c: float) -> None: ... -def func2(a: str, *, b: int) -> None: ... - class Write1: def write1(self, a: str) -> None: ... @@ -12,8 +9,13 @@ class Write2: class Write3: def write(self, *, a: str) -> None: ... -np.seterrcall(func1) # E: Argument 1 to "seterrcall" has incompatible type -np.seterrcall(func2) # E: Argument 1 to "seterrcall" has incompatible type -np.seterrcall(Write1()) # E: Argument 1 to "seterrcall" has incompatible type -np.seterrcall(Write2()) # E: Argument 1 to "seterrcall" has incompatible type -np.seterrcall(Write3()) # E: Argument 1 to "seterrcall" has incompatible type +def func1(a: str, b: int, c: float) -> None: ... +def func2(a: str, *, b: int) -> None: ... + +### + +np.seterrcall(func1) # type: ignore[arg-type] # pyright: ignore[reportArgumentType] +np.seterrcall(func2) # type: ignore[arg-type] # pyright: ignore[reportArgumentType] +np.seterrcall(Write1()) # type: ignore[arg-type] # pyright: ignore[reportArgumentType] +np.seterrcall(Write2()) # type: ignore[arg-type] # pyright: ignore[reportArgumentType] +np.seterrcall(Write3()) # type: ignore[arg-type] # pyright: ignore[reportArgumentType] diff --git a/test/static/reject/ufunclike.pyi b/test/static/reject/ufunclike.pyi index be5e6a1..f441493 100644 --- a/test/static/reject/ufunclike.pyi +++ b/test/static/reject/ufunclike.pyi @@ -6,16 +6,16 @@ AR_m: npt.NDArray[np.timedelta64] AR_M: npt.NDArray[np.datetime64] AR_O: npt.NDArray[np.object_] -np.fix(AR_c) # E: incompatible type -np.fix(AR_m) # E: incompatible type -np.fix(AR_M) # E: incompatible type +np.fix(AR_c) # type: ignore[arg-type] # pyright: ignore[reportCallIssue,reportArgumentType] +np.fix(AR_m) # type: ignore[arg-type] # pyright: ignore[reportCallIssue,reportArgumentType] +np.fix(AR_M) # type: ignore[arg-type] # pyright: ignore[reportCallIssue,reportArgumentType] -np.isposinf(AR_c) # E: incompatible type -np.isposinf(AR_m) # E: incompatible type -np.isposinf(AR_M) # E: incompatible type -np.isposinf(AR_O) # E: incompatible type +np.isposinf(AR_c) # type: ignore[arg-type] # pyright: ignore[reportCallIssue,reportArgumentType] +np.isposinf(AR_m) # type: ignore[arg-type] # pyright: ignore[reportCallIssue,reportArgumentType] +np.isposinf(AR_M) # type: ignore[arg-type] # pyright: ignore[reportCallIssue,reportArgumentType] +np.isposinf(AR_O) # type: ignore[arg-type] # pyright: ignore[reportCallIssue,reportArgumentType] -np.isneginf(AR_c) # E: incompatible type -np.isneginf(AR_m) # E: incompatible type -np.isneginf(AR_M) # E: incompatible type -np.isneginf(AR_O) # E: incompatible type +np.isneginf(AR_c) # type: ignore[arg-type] # pyright: ignore[reportCallIssue,reportArgumentType] +np.isneginf(AR_m) # type: ignore[arg-type] # pyright: ignore[reportCallIssue,reportArgumentType] +np.isneginf(AR_M) # type: ignore[arg-type] # pyright: ignore[reportCallIssue,reportArgumentType] +np.isneginf(AR_O) # type: ignore[arg-type] # pyright: ignore[reportCallIssue,reportArgumentType] diff --git a/test/static/reject/ufuncs.pyi b/test/static/reject/ufuncs.pyi index bbab0df..3fd8223 100644 --- a/test/static/reject/ufuncs.pyi +++ b/test/static/reject/ufuncs.pyi @@ -3,15 +3,16 @@ import numpy.typing as npt AR_f8: npt.NDArray[np.float64] -np.sin.nin + "foo" # E: Unsupported operand types -np.sin(1, foo="bar") # E: No overload variant +np.sin.nin + "foo" # type: ignore[operator] # pyright: ignore[reportOperatorIssue] -np.abs(None) # E: No overload variant +np.sin(1, foo="bar") # type: ignore[call-overload] # pyright: ignore[reportCallIssue] -np.add(1, 1, 1) # E: No overload variant -np.add(1, 1, axis=0) # E: No overload variant +np.abs(None) # type: ignore[call-overload] # pyright: ignore[reportCallIssue,reportArgumentType] -np.matmul(AR_f8, AR_f8, where=True) # E: No overload variant +np.add(1, 1, 1) # type: ignore[call-overload] # pyright: ignore[reportCallIssue,reportArgumentType] +np.add(1, 1, axis=0) # type: ignore[call-overload] # pyright: ignore[reportCallIssue] -np.frexp(AR_f8, out=None) # E: No overload variant -np.frexp(AR_f8, out=AR_f8) # E: No overload variant +np.matmul(AR_f8, AR_f8, where=True) # type: ignore[call-overload] # pyright: ignore[reportCallIssue] + +np.frexp(AR_f8, out=None) # type: ignore[call-overload] # pyright: ignore[reportCallIssue,reportArgumentType] +np.frexp(AR_f8, out=AR_f8) # type: ignore[call-overload] # pyright: ignore[reportCallIssue,reportArgumentType] diff --git a/test/static/reject/warnings_and_errors.pyi b/test/static/reject/warnings_and_errors.pyi index fae96d6..e21cca5 100644 --- a/test/static/reject/warnings_and_errors.pyi +++ b/test/static/reject/warnings_and_errors.pyi @@ -1,5 +1,5 @@ import numpy.exceptions as ex -ex.AxisError(1.0) # E: No overload variant -ex.AxisError(1, ndim=2.0) # E: No overload variant -ex.AxisError(2, msg_prefix=404) # E: No overload variant +ex.AxisError(1.0) # type: ignore[call-overload] # pyright: ignore[reportArgumentType] +ex.AxisError(1, ndim=2.0) # type: ignore[call-overload] # pyright: ignore[reportCallIssue,reportArgumentType] +ex.AxisError(2, msg_prefix=404) # type: ignore[call-overload] # pyright: ignore[reportArgumentType] From 88a48eb403d850791f6686dc0d26b994085fb729 Mon Sep 17 00:00:00 2001 From: jorenham Date: Tue, 28 Jan 2025 16:54:17 +0100 Subject: [PATCH 3/3] =?UTF-8?q?=F0=9F=91=B7=20enable=20static=20rejection?= =?UTF-8?q?=20type-testing=20in=20the=20CI?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/ci.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e542475..1cd2528 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,7 +17,7 @@ env: jobs: lint: runs-on: ubuntu-latest - timeout-minutes: 2 + timeout-minutes: 5 steps: - uses: actions/checkout@v4 @@ -35,3 +35,9 @@ jobs: run: | uv run ruff check --output-format=github uv run ruff format --check + + # TODO: static acceptance tests + - name: test static (reject) + run: | + uv run mypy --hide-error-context --hide-error-code-links --no-pretty test/static/reject + uv run basedpyright test/static/reject