diff --git a/env-llmeval/lib/python3.10/site-packages/numpy/core/tests/data/numpy_2_0_array.pkl b/env-llmeval/lib/python3.10/site-packages/numpy/core/tests/data/numpy_2_0_array.pkl new file mode 100644 index 0000000000000000000000000000000000000000..661ff83ca3d83da9c3812f0048f0b7d1ba62aa25 --- /dev/null +++ b/env-llmeval/lib/python3.10/site-packages/numpy/core/tests/data/numpy_2_0_array.pkl @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:561d36b5dc82ca96bc35be10cdd5619c30225c43b6590adcc1cbce7430c5179c +size 718 diff --git a/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/__pycache__/__init__.cpython-310.pyc b/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/__pycache__/__init__.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..77e481aa33deda8e3fea2c57d87c993f8a0c5b5d Binary files /dev/null and b/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/__pycache__/__init__.cpython-310.pyc differ diff --git a/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/__pycache__/test_runtime.cpython-310.pyc b/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/__pycache__/test_runtime.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..c8a897924341d848882fb3b6cd798e58df2e0b84 Binary files /dev/null and b/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/__pycache__/test_runtime.cpython-310.pyc differ diff --git a/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/__pycache__/test_typing.cpython-310.pyc b/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/__pycache__/test_typing.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..1a09a708950a9ba5800971b38af73191a2b4d117 Binary files /dev/null and b/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/__pycache__/test_typing.cpython-310.pyc differ diff --git a/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/fail/array_pad.pyi b/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/fail/array_pad.pyi new file mode 100644 index 0000000000000000000000000000000000000000..2be51a87181dcc14068d7036fe44d1d3cc9d9d6f --- /dev/null +++ b/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/fail/array_pad.pyi @@ -0,0 +1,6 @@ +import numpy as np +import numpy.typing as npt + +AR_i8: npt.NDArray[np.int64] + +np.pad(AR_i8, 2, mode="bob") # E: No overload variant diff --git a/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/fail/arrayprint.pyi b/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/fail/arrayprint.pyi new file mode 100644 index 0000000000000000000000000000000000000000..71b921e3a5a3774548a9beab955a3b481d360d21 --- /dev/null +++ b/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/fail/arrayprint.pyi @@ -0,0 +1,14 @@ +from collections.abc import Callable +from typing import Any +import numpy as np + +AR: np.ndarray +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 diff --git a/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/fail/char.pyi b/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/fail/char.pyi new file mode 100644 index 0000000000000000000000000000000000000000..320f05df5228a8802dcd117dea9b8c8185a7a943 --- /dev/null +++ b/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/fail/char.pyi @@ -0,0 +1,66 @@ +import numpy as np +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.not_equal(AR_U, AR_S) # E: incompatible type + +np.char.greater_equal(AR_U, AR_S) # E: incompatible type + +np.char.less_equal(AR_U, AR_S) # E: incompatible type + +np.char.greater(AR_U, AR_S) # E: incompatible type + +np.char.less(AR_U, AR_S) # E: incompatible type + +np.char.encode(AR_S) # E: incompatible type +np.char.decode(AR_U) # E: incompatible type + +np.char.join(AR_U, b"_") # E: incompatible type +np.char.join(AR_S, "_") # E: incompatible type + +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.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.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.replace(AR_U, b"_", b"-") # E: incompatible type +np.char.replace(AR_S, "_", "-") # E: incompatible type + +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.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.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.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 diff --git a/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/fail/chararray.pyi b/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/fail/chararray.pyi new file mode 100644 index 0000000000000000000000000000000000000000..ebc182ec2f0409ddb6218b55b8d8ada528e1ddb9 --- /dev/null +++ b/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/fail/chararray.pyi @@ -0,0 +1,62 @@ +import numpy as np +from typing import Any + +AR_U: np.chararray[Any, np.dtype[np.str_]] +AR_S: np.chararray[Any, 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 diff --git a/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/fail/constants.pyi b/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/fail/constants.pyi new file mode 100644 index 0000000000000000000000000000000000000000..324cbe9fa735c40fb630cab3380d844392aabf92 --- /dev/null +++ b/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/fail/constants.pyi @@ -0,0 +1,7 @@ +import numpy as np + +np.Inf = np.Inf # E: Cannot assign to final +np.ALLOW_THREADS = np.ALLOW_THREADS # E: Cannot assign to final +np.little_endian = np.little_endian # E: Cannot assign to final +np.UFUNC_PYVALS_NAME = "bob" # E: Incompatible types +np.CLIP = 2 # E: Incompatible types diff --git a/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/fail/datasource.pyi b/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/fail/datasource.pyi new file mode 100644 index 0000000000000000000000000000000000000000..345277d45370fe1442f6cf010528a3eefce07f29 --- /dev/null +++ b/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/fail/datasource.pyi @@ -0,0 +1,15 @@ +from pathlib import Path +import numpy as np + +path: Path +d1: np.DataSource + +d1.abspath(path) # E: incompatible type +d1.abspath(b"...") # E: incompatible type + +d1.exists(path) # E: incompatible type +d1.exists(b"...") # E: incompatible type + +d1.open(path, "r") # E: incompatible type +d1.open(b"...", encoding="utf8") # E: incompatible type +d1.open(None, newline="/n") # E: incompatible type diff --git a/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/fail/einsumfunc.pyi b/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/fail/einsumfunc.pyi new file mode 100644 index 0000000000000000000000000000000000000000..2d1f3741851ee0533dcc2b1171a6bf7c98f76c93 --- /dev/null +++ b/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/fail/einsumfunc.pyi @@ -0,0 +1,12 @@ +from typing import Any +import numpy as np + +AR_i: np.ndarray[Any, np.dtype[np.int64]] +AR_f: np.ndarray[Any, np.dtype[np.float64]] +AR_m: np.ndarray[Any, np.dtype[np.timedelta64]] +AR_U: np.ndarray[Any, np.dtype[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 diff --git a/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/fail/false_positives.pyi b/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/fail/false_positives.pyi new file mode 100644 index 0000000000000000000000000000000000000000..7e79230663c2956acdc6addeab8efaca5b44d563 --- /dev/null +++ b/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/fail/false_positives.pyi @@ -0,0 +1,11 @@ +import numpy as np +import numpy.typing as npt + +AR_f8: npt.NDArray[np.float64] + +# NOTE: Mypy bug presumably due to the special-casing of heterogeneous tuples; +# xref numpy/numpy#20901 +# +# The expected output should be no different than, e.g., when using a +# list instead of a tuple +np.concatenate(([1], AR_f8)) # E: Argument 1 to "concatenate" has incompatible type diff --git a/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/fail/fromnumeric.pyi b/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/fail/fromnumeric.pyi new file mode 100644 index 0000000000000000000000000000000000000000..b679703c7dd61ccc0fb5b54a0582a1401095e67d --- /dev/null +++ b/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/fail/fromnumeric.pyi @@ -0,0 +1,161 @@ +"""Tests for :mod:`numpy.core.fromnumeric`.""" + +import numpy as np +import numpy.typing as npt + +A = np.array(True, ndmin=2, dtype=bool) +A.setflags(write=False) +AR_U: npt.NDArray[np.str_] + +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.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.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 diff --git a/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/fail/index_tricks.pyi b/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/fail/index_tricks.pyi new file mode 100644 index 0000000000000000000000000000000000000000..22f6f4a61e8e11079e40d3755b0c01200ffdf762 --- /dev/null +++ b/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/fail/index_tricks.pyi @@ -0,0 +1,14 @@ +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 diff --git a/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/fail/lib_utils.pyi b/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/fail/lib_utils.pyi new file mode 100644 index 0000000000000000000000000000000000000000..e16c926aa6450fc30f72e50b4463f6a0fcd7d9ad --- /dev/null +++ b/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/fail/lib_utils.pyi @@ -0,0 +1,13 @@ +import numpy as np + +np.deprecate(1) # E: No overload variant + +np.deprecate_with_doc(1) # E: incompatible type + +np.byte_bounds(1) # E: incompatible type + +np.who(1) # E: incompatible type + +np.lookfor(None) # E: incompatible type + +np.safe_eval(None) # E: incompatible type diff --git a/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/fail/memmap.pyi b/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/fail/memmap.pyi new file mode 100644 index 0000000000000000000000000000000000000000..434870b60e41948afc6fb3f593742deb2cc11e3e --- /dev/null +++ b/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/fail/memmap.pyi @@ -0,0 +1,5 @@ +import numpy as np + +with open("file.txt", "r") as f: + np.memmap(f) # E: No overload variant +np.memmap("test.txt", shape=[10, 5]) # E: No overload variant diff --git a/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/fail/ndarray.pyi b/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/fail/ndarray.pyi new file mode 100644 index 0000000000000000000000000000000000000000..5a5130d40649087cf8a50e1b9e6cf82837cc349a --- /dev/null +++ b/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/fail/ndarray.pyi @@ -0,0 +1,11 @@ +import numpy as np + +# 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 diff --git a/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/fail/nested_sequence.pyi b/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/fail/nested_sequence.pyi new file mode 100644 index 0000000000000000000000000000000000000000..6301e51769fee30db50bfaf1e2777bf894166de8 --- /dev/null +++ b/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/fail/nested_sequence.pyi @@ -0,0 +1,17 @@ +from collections.abc import Sequence +from numpy._typing import _NestedSequence + +a: Sequence[float] +b: list[complex] +c: tuple[str, ...] +d: int +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 diff --git a/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/fail/numerictypes.pyi b/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/fail/numerictypes.pyi new file mode 100644 index 0000000000000000000000000000000000000000..ce5662d5e66a3c62a12231f90eb1275007b546b6 --- /dev/null +++ b/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/fail/numerictypes.pyi @@ -0,0 +1,11 @@ +import numpy as np + +# Technically this works, but probably shouldn't. See +# +# https://github.com/numpy/numpy/issues/16366 +# +np.maximum_sctype(1) # E: No overload variant + +np.issubsctype(1, np.int64) # E: incompatible type + +np.issubdtype(1, np.int64) # E: incompatible type diff --git a/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/fail/shape_base.pyi b/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/fail/shape_base.pyi new file mode 100644 index 0000000000000000000000000000000000000000..e709741b7935ec7269affd836f5256a0842ddd0a --- /dev/null +++ b/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/fail/shape_base.pyi @@ -0,0 +1,8 @@ +import numpy as np + +class DTypeLike: + dtype: np.dtype[np.int_] + +dtype_like: DTypeLike + +np.expand_dims(dtype_like, (5, 10)) # E: No overload variant diff --git a/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/fail/testing.pyi b/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/fail/testing.pyi new file mode 100644 index 0000000000000000000000000000000000000000..803870e2feadd18815ebc57665aa63d42423c752 --- /dev/null +++ b/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/fail/testing.pyi @@ -0,0 +1,28 @@ +import numpy as np +import numpy.typing as npt + +AR_U: npt.NDArray[np.str_] + +def func() -> bool: ... + +np.testing.assert_(True, msg=1) # E: incompatible type +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_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_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_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: Unexpected keyword argument + +np.testing.assert_no_gc_cycles(func=func) # E: No overload variant diff --git a/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/fail/twodim_base.pyi b/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/fail/twodim_base.pyi new file mode 100644 index 0000000000000000000000000000000000000000..faa430095a5fabbf721732ecec867cac434e9259 --- /dev/null +++ b/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/fail/twodim_base.pyi @@ -0,0 +1,37 @@ +from typing import Any, TypeVar + +import numpy as np +import numpy.typing as npt + + +def func1(ar: npt.NDArray[Any], a: int) -> npt.NDArray[np.str_]: + pass + + +def func2(ar: npt.NDArray[Any], a: float) -> float: + pass + + +AR_b: npt.NDArray[np.bool_] +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.diag(AR_b, k=0.5) # E: No overload variant +np.diagflat(AR_b, k=0.5) # E: No overload variant + +np.tri(10, M=20.0) # E: No overload variant +np.tri(10, k=2.5, dtype=int) # E: No overload variant + +np.tril(AR_b, k=0.5) # E: No overload variant +np.triu(AR_b, k=0.5) # E: No overload variant + +np.vander(AR_m) # E: incompatible type + +np.histogram2d(AR_m) # E: No overload variant + +np.mask_indices(10, func1) # E: incompatible type +np.mask_indices(10, func2, 10.5) # E: incompatible type diff --git a/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/fail/ufunc_config.pyi b/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/fail/ufunc_config.pyi new file mode 100644 index 0000000000000000000000000000000000000000..f547fbb46b85a92c77d81bf287c13a37d6d9e6ad --- /dev/null +++ b/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/fail/ufunc_config.pyi @@ -0,0 +1,21 @@ +"""Typing tests for `numpy.core._ufunc_config`.""" + +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: ... + +class Write2: + def write(self, a: str, b: str) -> None: ... + +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 diff --git a/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/fail/ufunclike.pyi b/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/fail/ufunclike.pyi new file mode 100644 index 0000000000000000000000000000000000000000..2f9fd14c8cf2082bfaf6b4e6a816cafd5299e47f --- /dev/null +++ b/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/fail/ufunclike.pyi @@ -0,0 +1,21 @@ +from typing import Any +import numpy as np + +AR_c: np.ndarray[Any, np.dtype[np.complex128]] +AR_m: np.ndarray[Any, np.dtype[np.timedelta64]] +AR_M: np.ndarray[Any, np.dtype[np.datetime64]] +AR_O: np.ndarray[Any, np.dtype[np.object_]] + +np.fix(AR_c) # E: incompatible type +np.fix(AR_m) # E: incompatible type +np.fix(AR_M) # E: incompatible type + +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.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 diff --git a/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/fail/ufuncs.pyi b/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/fail/ufuncs.pyi new file mode 100644 index 0000000000000000000000000000000000000000..e827267c6072e5ace7862016944e52dfa00ed7a8 --- /dev/null +++ b/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/fail/ufuncs.pyi @@ -0,0 +1,41 @@ +import numpy as np +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.abs(None) # E: No overload variant + +np.add(1, 1, 1) # E: No overload variant +np.add(1, 1, axis=0) # E: No overload variant + +np.matmul(AR_f8, AR_f8, where=True) # E: No overload variant + +np.frexp(AR_f8, out=None) # E: No overload variant +np.frexp(AR_f8, out=AR_f8) # E: No overload variant + +np.absolute.outer() # E: "None" not callable +np.frexp.outer() # E: "None" not callable +np.divmod.outer() # E: "None" not callable +np.matmul.outer() # E: "None" not callable + +np.absolute.reduceat() # E: "None" not callable +np.frexp.reduceat() # E: "None" not callable +np.divmod.reduceat() # E: "None" not callable +np.matmul.reduceat() # E: "None" not callable + +np.absolute.reduce() # E: "None" not callable +np.frexp.reduce() # E: "None" not callable +np.divmod.reduce() # E: "None" not callable +np.matmul.reduce() # E: "None" not callable + +np.absolute.accumulate() # E: "None" not callable +np.frexp.accumulate() # E: "None" not callable +np.divmod.accumulate() # E: "None" not callable +np.matmul.accumulate() # E: "None" not callable + +np.frexp.at() # E: "None" not callable +np.divmod.at() # E: "None" not callable +np.matmul.at() # E: "None" not callable diff --git a/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/fail/warnings_and_errors.pyi b/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/fail/warnings_and_errors.pyi new file mode 100644 index 0000000000000000000000000000000000000000..f4fa38293738a2d1d61d522927aea367e21cb9c6 --- /dev/null +++ b/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/fail/warnings_and_errors.pyi @@ -0,0 +1,5 @@ +import numpy as np + +np.AxisError(1.0) # E: No overload variant +np.AxisError(1, ndim=2.0) # E: No overload variant +np.AxisError(2, msg_prefix=404) # E: No overload variant diff --git a/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/misc/extended_precision.pyi b/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/misc/extended_precision.pyi new file mode 100644 index 0000000000000000000000000000000000000000..78d8d93c6560616c3495dcdf801befce51997c00 --- /dev/null +++ b/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/misc/extended_precision.pyi @@ -0,0 +1,25 @@ +import sys + +import numpy as np +from numpy._typing import _80Bit, _96Bit, _128Bit, _256Bit + +if sys.version_info >= (3, 11): + from typing import assert_type +else: + from typing_extensions import assert_type + +assert_type(np.uint128(), np.unsignedinteger[_128Bit]) +assert_type(np.uint256(), np.unsignedinteger[_256Bit]) + +assert_type(np.int128(), np.signedinteger[_128Bit]) +assert_type(np.int256(), np.signedinteger[_256Bit]) + +assert_type(np.float80(), np.floating[_80Bit]) +assert_type(np.float96(), np.floating[_96Bit]) +assert_type(np.float128(), np.floating[_128Bit]) +assert_type(np.float256(), np.floating[_256Bit]) + +assert_type(np.complex160(), np.complexfloating[_80Bit, _80Bit]) +assert_type(np.complex192(), np.complexfloating[_96Bit, _96Bit]) +assert_type(np.complex256(), np.complexfloating[_128Bit, _128Bit]) +assert_type(np.complex512(), np.complexfloating[_256Bit, _256Bit]) diff --git a/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/mypy.ini b/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/mypy.ini new file mode 100644 index 0000000000000000000000000000000000000000..1cc16e03965d8c2c3206d6a88d85a95c79b81c8e --- /dev/null +++ b/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/mypy.ini @@ -0,0 +1,5 @@ +[mypy] +plugins = numpy.typing.mypy_plugin +show_absolute_path = True +implicit_reexport = False +pretty = True diff --git a/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/pass/__pycache__/arithmetic.cpython-310.pyc b/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/pass/__pycache__/arithmetic.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..bfb84e0a10d3cf1163c8d26fdb1b9393f7402bb2 Binary files /dev/null and b/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/pass/__pycache__/arithmetic.cpython-310.pyc differ diff --git a/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/pass/__pycache__/array_constructors.cpython-310.pyc b/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/pass/__pycache__/array_constructors.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..eadf38045491d2ef3204f6ac58dcf9f49785a0a0 Binary files /dev/null and b/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/pass/__pycache__/array_constructors.cpython-310.pyc differ diff --git a/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/pass/__pycache__/array_like.cpython-310.pyc b/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/pass/__pycache__/array_like.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..0f172455e66ec9ed860faf73c53c1c97c39a0391 Binary files /dev/null and b/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/pass/__pycache__/array_like.cpython-310.pyc differ diff --git a/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/pass/__pycache__/arrayprint.cpython-310.pyc b/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/pass/__pycache__/arrayprint.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..b32e836fd07a1b2e3e486a464d6dce73211395ed Binary files /dev/null and b/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/pass/__pycache__/arrayprint.cpython-310.pyc differ diff --git a/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/pass/__pycache__/arrayterator.cpython-310.pyc b/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/pass/__pycache__/arrayterator.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..2e6e612a8534dff5e0752526017eda9d6172f508 Binary files /dev/null and b/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/pass/__pycache__/arrayterator.cpython-310.pyc differ diff --git a/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/pass/__pycache__/bitwise_ops.cpython-310.pyc b/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/pass/__pycache__/bitwise_ops.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..e9b88b683f669497c2ff5a991cf61e716c9ab508 Binary files /dev/null and b/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/pass/__pycache__/bitwise_ops.cpython-310.pyc differ diff --git a/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/pass/__pycache__/comparisons.cpython-310.pyc b/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/pass/__pycache__/comparisons.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..8115b1dedae93825c38254334cd036ff83149cf0 Binary files /dev/null and b/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/pass/__pycache__/comparisons.cpython-310.pyc differ diff --git a/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/pass/__pycache__/dtype.cpython-310.pyc b/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/pass/__pycache__/dtype.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..567c65272de960d206563931dfaeeeb43d2286ec Binary files /dev/null and b/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/pass/__pycache__/dtype.cpython-310.pyc differ diff --git a/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/pass/__pycache__/einsumfunc.cpython-310.pyc b/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/pass/__pycache__/einsumfunc.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..679a4f840a18851f8f51b5a4c354e8240117c2a3 Binary files /dev/null and b/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/pass/__pycache__/einsumfunc.cpython-310.pyc differ diff --git a/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/pass/__pycache__/flatiter.cpython-310.pyc b/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/pass/__pycache__/flatiter.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..34b00e670c858ef625e566bc9db66a20da098fa8 Binary files /dev/null and b/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/pass/__pycache__/flatiter.cpython-310.pyc differ diff --git a/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/pass/__pycache__/fromnumeric.cpython-310.pyc b/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/pass/__pycache__/fromnumeric.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..ca1ed02e1bbadde56796cc6f11e0cbab4f494713 Binary files /dev/null and b/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/pass/__pycache__/fromnumeric.cpython-310.pyc differ diff --git a/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/pass/__pycache__/index_tricks.cpython-310.pyc b/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/pass/__pycache__/index_tricks.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..e8aed5cb17897dfbbf272758e068ec5c9a50a9cb Binary files /dev/null and b/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/pass/__pycache__/index_tricks.cpython-310.pyc differ diff --git a/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/pass/__pycache__/lib_utils.cpython-310.pyc b/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/pass/__pycache__/lib_utils.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..faccf1c7b43cde4916a6aa3bb06578f15ea6ec0d Binary files /dev/null and b/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/pass/__pycache__/lib_utils.cpython-310.pyc differ diff --git a/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/pass/__pycache__/lib_version.cpython-310.pyc b/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/pass/__pycache__/lib_version.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..caaa8cc1e3a7210b64f8f6649287513f82a56e0f Binary files /dev/null and b/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/pass/__pycache__/lib_version.cpython-310.pyc differ diff --git a/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/pass/__pycache__/literal.cpython-310.pyc b/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/pass/__pycache__/literal.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..3becc9b03ea5dced293d9cf960618bf5ebad1f67 Binary files /dev/null and b/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/pass/__pycache__/literal.cpython-310.pyc differ diff --git a/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/pass/__pycache__/mod.cpython-310.pyc b/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/pass/__pycache__/mod.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..18e5228683e7c20f75408b63fd1121c2e3b7606b Binary files /dev/null and b/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/pass/__pycache__/mod.cpython-310.pyc differ diff --git a/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/pass/__pycache__/modules.cpython-310.pyc b/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/pass/__pycache__/modules.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..dcd404eb5dbbda395f086f06956c149be7e2c450 Binary files /dev/null and b/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/pass/__pycache__/modules.cpython-310.pyc differ diff --git a/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/pass/__pycache__/multiarray.cpython-310.pyc b/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/pass/__pycache__/multiarray.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..926ccf583cc06f016df6434268ee5fbf5b81195e Binary files /dev/null and b/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/pass/__pycache__/multiarray.cpython-310.pyc differ diff --git a/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/pass/__pycache__/ndarray_conversion.cpython-310.pyc b/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/pass/__pycache__/ndarray_conversion.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..67f8538e79a5eb9fbe994296375c407ee55226b3 Binary files /dev/null and b/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/pass/__pycache__/ndarray_conversion.cpython-310.pyc differ diff --git a/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/pass/__pycache__/ndarray_misc.cpython-310.pyc b/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/pass/__pycache__/ndarray_misc.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..50cfdeea58a295bfc87e0313ec4b894fab3159dc Binary files /dev/null and b/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/pass/__pycache__/ndarray_misc.cpython-310.pyc differ diff --git a/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/pass/__pycache__/ndarray_shape_manipulation.cpython-310.pyc b/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/pass/__pycache__/ndarray_shape_manipulation.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..279d5e6fddc1bff4d18aad28ea81f11781631064 Binary files /dev/null and b/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/pass/__pycache__/ndarray_shape_manipulation.cpython-310.pyc differ diff --git a/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/pass/__pycache__/numeric.cpython-310.pyc b/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/pass/__pycache__/numeric.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..e5db4cfb4a4bab4d26c378e46af009da471625c5 Binary files /dev/null and b/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/pass/__pycache__/numeric.cpython-310.pyc differ diff --git a/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/pass/__pycache__/numerictypes.cpython-310.pyc b/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/pass/__pycache__/numerictypes.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..01d933dbf002b7961782edab6de3ed2fb432064e Binary files /dev/null and b/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/pass/__pycache__/numerictypes.cpython-310.pyc differ diff --git a/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/pass/__pycache__/random.cpython-310.pyc b/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/pass/__pycache__/random.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..081174de02a18d8e748b29e1e1281104573d91f7 Binary files /dev/null and b/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/pass/__pycache__/random.cpython-310.pyc differ diff --git a/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/pass/__pycache__/scalars.cpython-310.pyc b/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/pass/__pycache__/scalars.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..1b05a0d00ea2e87f7315de8a8980a29d941d9ef5 Binary files /dev/null and b/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/pass/__pycache__/scalars.cpython-310.pyc differ diff --git a/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/pass/__pycache__/simple.cpython-310.pyc b/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/pass/__pycache__/simple.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..d3a86efff27e1d66ec3ab9039002e8708889f71f Binary files /dev/null and b/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/pass/__pycache__/simple.cpython-310.pyc differ diff --git a/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/pass/__pycache__/simple_py3.cpython-310.pyc b/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/pass/__pycache__/simple_py3.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..22e660eae07e45156f35f3dec3fd4233e79ea1d0 Binary files /dev/null and b/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/pass/__pycache__/simple_py3.cpython-310.pyc differ diff --git a/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/pass/__pycache__/ufunc_config.cpython-310.pyc b/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/pass/__pycache__/ufunc_config.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..93cbfbe048e80b0ddbf98dde9578c913883f3b1e Binary files /dev/null and b/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/pass/__pycache__/ufunc_config.cpython-310.pyc differ diff --git a/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/pass/__pycache__/ufunclike.cpython-310.pyc b/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/pass/__pycache__/ufunclike.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..81cd2961cbf28496445f9d704bdaee2994e68dc6 Binary files /dev/null and b/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/pass/__pycache__/ufunclike.cpython-310.pyc differ diff --git a/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/pass/__pycache__/ufuncs.cpython-310.pyc b/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/pass/__pycache__/ufuncs.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..e2d4c13ff6a08cfe385653fcf6f7a4f956b43f01 Binary files /dev/null and b/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/pass/__pycache__/ufuncs.cpython-310.pyc differ diff --git a/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/pass/__pycache__/warnings_and_errors.cpython-310.pyc b/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/pass/__pycache__/warnings_and_errors.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..8112c9974ed0d8c058f7c1524823bb8838f9528c Binary files /dev/null and b/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/pass/__pycache__/warnings_and_errors.cpython-310.pyc differ diff --git a/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/pass/arithmetic.py b/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/pass/arithmetic.py new file mode 100644 index 0000000000000000000000000000000000000000..07a99012735d4b1161a538c14a6114fccae3a47e --- /dev/null +++ b/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/pass/arithmetic.py @@ -0,0 +1,594 @@ +from __future__ import annotations + +from typing import Any +import numpy as np +import pytest + +c16 = np.complex128(1) +f8 = np.float64(1) +i8 = np.int64(1) +u8 = np.uint64(1) + +c8 = np.complex64(1) +f4 = np.float32(1) +i4 = np.int32(1) +u4 = np.uint32(1) + +dt = np.datetime64(1, "D") +td = np.timedelta64(1, "D") + +b_ = np.bool_(1) + +b = bool(1) +c = complex(1) +f = float(1) +i = int(1) + + +class Object: + def __array__(self) -> np.ndarray[Any, np.dtype[np.object_]]: + ret = np.empty((), dtype=object) + ret[()] = self + return ret + + def __sub__(self, value: Any) -> Object: + return self + + def __rsub__(self, value: Any) -> Object: + return self + + def __floordiv__(self, value: Any) -> Object: + return self + + def __rfloordiv__(self, value: Any) -> Object: + return self + + def __mul__(self, value: Any) -> Object: + return self + + def __rmul__(self, value: Any) -> Object: + return self + + def __pow__(self, value: Any) -> Object: + return self + + def __rpow__(self, value: Any) -> Object: + return self + + +AR_b: np.ndarray[Any, np.dtype[np.bool_]] = np.array([True]) +AR_u: np.ndarray[Any, np.dtype[np.uint32]] = np.array([1], dtype=np.uint32) +AR_i: np.ndarray[Any, np.dtype[np.int64]] = np.array([1]) +AR_f: np.ndarray[Any, np.dtype[np.float64]] = np.array([1.0]) +AR_c: np.ndarray[Any, np.dtype[np.complex128]] = np.array([1j]) +AR_m: np.ndarray[Any, np.dtype[np.timedelta64]] = np.array([np.timedelta64(1, "D")]) +AR_M: np.ndarray[Any, np.dtype[np.datetime64]] = np.array([np.datetime64(1, "D")]) +AR_O: np.ndarray[Any, np.dtype[np.object_]] = np.array([Object()]) + +AR_LIKE_b = [True] +AR_LIKE_u = [np.uint32(1)] +AR_LIKE_i = [1] +AR_LIKE_f = [1.0] +AR_LIKE_c = [1j] +AR_LIKE_m = [np.timedelta64(1, "D")] +AR_LIKE_M = [np.datetime64(1, "D")] +AR_LIKE_O = [Object()] + +# Array subtractions + +AR_b - AR_LIKE_u +AR_b - AR_LIKE_i +AR_b - AR_LIKE_f +AR_b - AR_LIKE_c +AR_b - AR_LIKE_m +AR_b - AR_LIKE_O + +AR_LIKE_u - AR_b +AR_LIKE_i - AR_b +AR_LIKE_f - AR_b +AR_LIKE_c - AR_b +AR_LIKE_m - AR_b +AR_LIKE_M - AR_b +AR_LIKE_O - AR_b + +AR_u - AR_LIKE_b +AR_u - AR_LIKE_u +AR_u - AR_LIKE_i +AR_u - AR_LIKE_f +AR_u - AR_LIKE_c +AR_u - AR_LIKE_m +AR_u - AR_LIKE_O + +AR_LIKE_b - AR_u +AR_LIKE_u - AR_u +AR_LIKE_i - AR_u +AR_LIKE_f - AR_u +AR_LIKE_c - AR_u +AR_LIKE_m - AR_u +AR_LIKE_M - AR_u +AR_LIKE_O - AR_u + +AR_i - AR_LIKE_b +AR_i - AR_LIKE_u +AR_i - AR_LIKE_i +AR_i - AR_LIKE_f +AR_i - AR_LIKE_c +AR_i - AR_LIKE_m +AR_i - AR_LIKE_O + +AR_LIKE_b - AR_i +AR_LIKE_u - AR_i +AR_LIKE_i - AR_i +AR_LIKE_f - AR_i +AR_LIKE_c - AR_i +AR_LIKE_m - AR_i +AR_LIKE_M - AR_i +AR_LIKE_O - AR_i + +AR_f - AR_LIKE_b +AR_f - AR_LIKE_u +AR_f - AR_LIKE_i +AR_f - AR_LIKE_f +AR_f - AR_LIKE_c +AR_f - AR_LIKE_O + +AR_LIKE_b - AR_f +AR_LIKE_u - AR_f +AR_LIKE_i - AR_f +AR_LIKE_f - AR_f +AR_LIKE_c - AR_f +AR_LIKE_O - AR_f + +AR_c - AR_LIKE_b +AR_c - AR_LIKE_u +AR_c - AR_LIKE_i +AR_c - AR_LIKE_f +AR_c - AR_LIKE_c +AR_c - AR_LIKE_O + +AR_LIKE_b - AR_c +AR_LIKE_u - AR_c +AR_LIKE_i - AR_c +AR_LIKE_f - AR_c +AR_LIKE_c - AR_c +AR_LIKE_O - AR_c + +AR_m - AR_LIKE_b +AR_m - AR_LIKE_u +AR_m - AR_LIKE_i +AR_m - AR_LIKE_m + +AR_LIKE_b - AR_m +AR_LIKE_u - AR_m +AR_LIKE_i - AR_m +AR_LIKE_m - AR_m +AR_LIKE_M - AR_m + +AR_M - AR_LIKE_b +AR_M - AR_LIKE_u +AR_M - AR_LIKE_i +AR_M - AR_LIKE_m +AR_M - AR_LIKE_M + +AR_LIKE_M - AR_M + +AR_O - AR_LIKE_b +AR_O - AR_LIKE_u +AR_O - AR_LIKE_i +AR_O - AR_LIKE_f +AR_O - AR_LIKE_c +AR_O - AR_LIKE_O + +AR_LIKE_b - AR_O +AR_LIKE_u - AR_O +AR_LIKE_i - AR_O +AR_LIKE_f - AR_O +AR_LIKE_c - AR_O +AR_LIKE_O - AR_O + +AR_u += AR_b +AR_u += AR_u +AR_u += 1 # Allowed during runtime as long as the object is 0D and >=0 + +# Array floor division + +AR_b // AR_LIKE_b +AR_b // AR_LIKE_u +AR_b // AR_LIKE_i +AR_b // AR_LIKE_f +AR_b // AR_LIKE_O + +AR_LIKE_b // AR_b +AR_LIKE_u // AR_b +AR_LIKE_i // AR_b +AR_LIKE_f // AR_b +AR_LIKE_O // AR_b + +AR_u // AR_LIKE_b +AR_u // AR_LIKE_u +AR_u // AR_LIKE_i +AR_u // AR_LIKE_f +AR_u // AR_LIKE_O + +AR_LIKE_b // AR_u +AR_LIKE_u // AR_u +AR_LIKE_i // AR_u +AR_LIKE_f // AR_u +AR_LIKE_m // AR_u +AR_LIKE_O // AR_u + +AR_i // AR_LIKE_b +AR_i // AR_LIKE_u +AR_i // AR_LIKE_i +AR_i // AR_LIKE_f +AR_i // AR_LIKE_O + +AR_LIKE_b // AR_i +AR_LIKE_u // AR_i +AR_LIKE_i // AR_i +AR_LIKE_f // AR_i +AR_LIKE_m // AR_i +AR_LIKE_O // AR_i + +AR_f // AR_LIKE_b +AR_f // AR_LIKE_u +AR_f // AR_LIKE_i +AR_f // AR_LIKE_f +AR_f // AR_LIKE_O + +AR_LIKE_b // AR_f +AR_LIKE_u // AR_f +AR_LIKE_i // AR_f +AR_LIKE_f // AR_f +AR_LIKE_m // AR_f +AR_LIKE_O // AR_f + +AR_m // AR_LIKE_u +AR_m // AR_LIKE_i +AR_m // AR_LIKE_f +AR_m // AR_LIKE_m + +AR_LIKE_m // AR_m + +AR_O // AR_LIKE_b +AR_O // AR_LIKE_u +AR_O // AR_LIKE_i +AR_O // AR_LIKE_f +AR_O // AR_LIKE_O + +AR_LIKE_b // AR_O +AR_LIKE_u // AR_O +AR_LIKE_i // AR_O +AR_LIKE_f // AR_O +AR_LIKE_O // AR_O + +# Inplace multiplication + +AR_b *= AR_LIKE_b + +AR_u *= AR_LIKE_b +AR_u *= AR_LIKE_u + +AR_i *= AR_LIKE_b +AR_i *= AR_LIKE_u +AR_i *= AR_LIKE_i + +AR_f *= AR_LIKE_b +AR_f *= AR_LIKE_u +AR_f *= AR_LIKE_i +AR_f *= AR_LIKE_f + +AR_c *= AR_LIKE_b +AR_c *= AR_LIKE_u +AR_c *= AR_LIKE_i +AR_c *= AR_LIKE_f +AR_c *= AR_LIKE_c + +AR_m *= AR_LIKE_b +AR_m *= AR_LIKE_u +AR_m *= AR_LIKE_i +AR_m *= AR_LIKE_f + +AR_O *= AR_LIKE_b +AR_O *= AR_LIKE_u +AR_O *= AR_LIKE_i +AR_O *= AR_LIKE_f +AR_O *= AR_LIKE_c +AR_O *= AR_LIKE_O + +# Inplace power + +AR_u **= AR_LIKE_b +AR_u **= AR_LIKE_u + +AR_i **= AR_LIKE_b +AR_i **= AR_LIKE_u +AR_i **= AR_LIKE_i + +AR_f **= AR_LIKE_b +AR_f **= AR_LIKE_u +AR_f **= AR_LIKE_i +AR_f **= AR_LIKE_f + +AR_c **= AR_LIKE_b +AR_c **= AR_LIKE_u +AR_c **= AR_LIKE_i +AR_c **= AR_LIKE_f +AR_c **= AR_LIKE_c + +AR_O **= AR_LIKE_b +AR_O **= AR_LIKE_u +AR_O **= AR_LIKE_i +AR_O **= AR_LIKE_f +AR_O **= AR_LIKE_c +AR_O **= AR_LIKE_O + +# unary ops + +-c16 +-c8 +-f8 +-f4 +-i8 +-i4 +with pytest.warns(RuntimeWarning): + -u8 + -u4 +-td +-AR_f + ++c16 ++c8 ++f8 ++f4 ++i8 ++i4 ++u8 ++u4 ++td ++AR_f + +abs(c16) +abs(c8) +abs(f8) +abs(f4) +abs(i8) +abs(i4) +abs(u8) +abs(u4) +abs(td) +abs(b_) +abs(AR_f) + +# Time structures + +dt + td +dt + i +dt + i4 +dt + i8 +dt - dt +dt - i +dt - i4 +dt - i8 + +td + td +td + i +td + i4 +td + i8 +td - td +td - i +td - i4 +td - i8 +td / f +td / f4 +td / f8 +td / td +td // td +td % td + + +# boolean + +b_ / b +b_ / b_ +b_ / i +b_ / i8 +b_ / i4 +b_ / u8 +b_ / u4 +b_ / f +b_ / f8 +b_ / f4 +b_ / c +b_ / c16 +b_ / c8 + +b / b_ +b_ / b_ +i / b_ +i8 / b_ +i4 / b_ +u8 / b_ +u4 / b_ +f / b_ +f8 / b_ +f4 / b_ +c / b_ +c16 / b_ +c8 / b_ + +# Complex + +c16 + c16 +c16 + f8 +c16 + i8 +c16 + c8 +c16 + f4 +c16 + i4 +c16 + b_ +c16 + b +c16 + c +c16 + f +c16 + i +c16 + AR_f + +c16 + c16 +f8 + c16 +i8 + c16 +c8 + c16 +f4 + c16 +i4 + c16 +b_ + c16 +b + c16 +c + c16 +f + c16 +i + c16 +AR_f + c16 + +c8 + c16 +c8 + f8 +c8 + i8 +c8 + c8 +c8 + f4 +c8 + i4 +c8 + b_ +c8 + b +c8 + c +c8 + f +c8 + i +c8 + AR_f + +c16 + c8 +f8 + c8 +i8 + c8 +c8 + c8 +f4 + c8 +i4 + c8 +b_ + c8 +b + c8 +c + c8 +f + c8 +i + c8 +AR_f + c8 + +# Float + +f8 + f8 +f8 + i8 +f8 + f4 +f8 + i4 +f8 + b_ +f8 + b +f8 + c +f8 + f +f8 + i +f8 + AR_f + +f8 + f8 +i8 + f8 +f4 + f8 +i4 + f8 +b_ + f8 +b + f8 +c + f8 +f + f8 +i + f8 +AR_f + f8 + +f4 + f8 +f4 + i8 +f4 + f4 +f4 + i4 +f4 + b_ +f4 + b +f4 + c +f4 + f +f4 + i +f4 + AR_f + +f8 + f4 +i8 + f4 +f4 + f4 +i4 + f4 +b_ + f4 +b + f4 +c + f4 +f + f4 +i + f4 +AR_f + f4 + +# Int + +i8 + i8 +i8 + u8 +i8 + i4 +i8 + u4 +i8 + b_ +i8 + b +i8 + c +i8 + f +i8 + i +i8 + AR_f + +u8 + u8 +u8 + i4 +u8 + u4 +u8 + b_ +u8 + b +u8 + c +u8 + f +u8 + i +u8 + AR_f + +i8 + i8 +u8 + i8 +i4 + i8 +u4 + i8 +b_ + i8 +b + i8 +c + i8 +f + i8 +i + i8 +AR_f + i8 + +u8 + u8 +i4 + u8 +u4 + u8 +b_ + u8 +b + u8 +c + u8 +f + u8 +i + u8 +AR_f + u8 + +i4 + i8 +i4 + i4 +i4 + i +i4 + b_ +i4 + b +i4 + AR_f + +u4 + i8 +u4 + i4 +u4 + u8 +u4 + u4 +u4 + i +u4 + b_ +u4 + b +u4 + AR_f + +i8 + i4 +i4 + i4 +i + i4 +b_ + i4 +b + i4 +AR_f + i4 + +i8 + u4 +i4 + u4 +u8 + u4 +u4 + u4 +b_ + u4 +b + u4 +i + u4 +AR_f + u4 diff --git a/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/pass/arrayterator.py b/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/pass/arrayterator.py new file mode 100644 index 0000000000000000000000000000000000000000..572be5e2fe29ba978b78c8b65b116b5b54a4d01a --- /dev/null +++ b/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/pass/arrayterator.py @@ -0,0 +1,27 @@ + +from __future__ import annotations + +from typing import Any +import numpy as np + +AR_i8: np.ndarray[Any, np.dtype[np.int_]] = np.arange(10) +ar_iter = np.lib.Arrayterator(AR_i8) + +ar_iter.var +ar_iter.buf_size +ar_iter.start +ar_iter.stop +ar_iter.step +ar_iter.shape +ar_iter.flat + +ar_iter.__array__() + +for i in ar_iter: + pass + +ar_iter[0] +ar_iter[...] +ar_iter[:] +ar_iter[0, 0, 0] +ar_iter[..., 0, :] diff --git a/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/pass/bitwise_ops.py b/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/pass/bitwise_ops.py new file mode 100644 index 0000000000000000000000000000000000000000..67449e2c21d8cc70f85caab5e0b8197aa74822fa --- /dev/null +++ b/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/pass/bitwise_ops.py @@ -0,0 +1,131 @@ +import numpy as np + +i8 = np.int64(1) +u8 = np.uint64(1) + +i4 = np.int32(1) +u4 = np.uint32(1) + +b_ = np.bool_(1) + +b = bool(1) +i = int(1) + +AR = np.array([0, 1, 2], dtype=np.int32) +AR.setflags(write=False) + + +i8 << i8 +i8 >> i8 +i8 | i8 +i8 ^ i8 +i8 & i8 + +i8 << AR +i8 >> AR +i8 | AR +i8 ^ AR +i8 & AR + +i4 << i4 +i4 >> i4 +i4 | i4 +i4 ^ i4 +i4 & i4 + +i8 << i4 +i8 >> i4 +i8 | i4 +i8 ^ i4 +i8 & i4 + +i8 << i +i8 >> i +i8 | i +i8 ^ i +i8 & i + +i8 << b_ +i8 >> b_ +i8 | b_ +i8 ^ b_ +i8 & b_ + +i8 << b +i8 >> b +i8 | b +i8 ^ b +i8 & b + +u8 << u8 +u8 >> u8 +u8 | u8 +u8 ^ u8 +u8 & u8 + +u8 << AR +u8 >> AR +u8 | AR +u8 ^ AR +u8 & AR + +u4 << u4 +u4 >> u4 +u4 | u4 +u4 ^ u4 +u4 & u4 + +u4 << i4 +u4 >> i4 +u4 | i4 +u4 ^ i4 +u4 & i4 + +u4 << i +u4 >> i +u4 | i +u4 ^ i +u4 & i + +u8 << b_ +u8 >> b_ +u8 | b_ +u8 ^ b_ +u8 & b_ + +u8 << b +u8 >> b +u8 | b +u8 ^ b +u8 & b + +b_ << b_ +b_ >> b_ +b_ | b_ +b_ ^ b_ +b_ & b_ + +b_ << AR +b_ >> AR +b_ | AR +b_ ^ AR +b_ & AR + +b_ << b +b_ >> b +b_ | b +b_ ^ b +b_ & b + +b_ << i +b_ >> i +b_ | i +b_ ^ i +b_ & i + +~i8 +~i4 +~u8 +~u4 +~b_ +~AR diff --git a/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/pass/dtype.py b/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/pass/dtype.py new file mode 100644 index 0000000000000000000000000000000000000000..6ec44e6b06cdc443b1dd930d8f06fe70be577e97 --- /dev/null +++ b/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/pass/dtype.py @@ -0,0 +1,57 @@ +import numpy as np + +dtype_obj = np.dtype(np.str_) +void_dtype_obj = np.dtype([("f0", np.float64), ("f1", np.float32)]) + +np.dtype(dtype=np.int64) +np.dtype(int) +np.dtype("int") +np.dtype(None) + +np.dtype((int, 2)) +np.dtype((int, (1,))) + +np.dtype({"names": ["a", "b"], "formats": [int, float]}) +np.dtype({"names": ["a"], "formats": [int], "titles": [object]}) +np.dtype({"names": ["a"], "formats": [int], "titles": [object()]}) + +np.dtype([("name", np.str_, 16), ("grades", np.float64, (2,)), ("age", "int32")]) + +np.dtype( + { + "names": ["a", "b"], + "formats": [int, float], + "itemsize": 9, + "aligned": False, + "titles": ["x", "y"], + "offsets": [0, 1], + } +) + +np.dtype((np.float_, float)) + + +class Test: + dtype = np.dtype(float) + + +np.dtype(Test()) + +# Methods and attributes +dtype_obj.base +dtype_obj.subdtype +dtype_obj.newbyteorder() +dtype_obj.type +dtype_obj.name +dtype_obj.names + +dtype_obj * 0 +dtype_obj * 2 + +0 * dtype_obj +2 * dtype_obj + +void_dtype_obj["f0"] +void_dtype_obj[0] +void_dtype_obj[["f0", "f1"]] +void_dtype_obj[["f0"]] diff --git a/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/pass/flatiter.py b/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/pass/flatiter.py new file mode 100644 index 0000000000000000000000000000000000000000..63c839af4b23f0ba3bea8c56f2bbb7c03e7bc44a --- /dev/null +++ b/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/pass/flatiter.py @@ -0,0 +1,16 @@ +import numpy as np + +a = np.empty((2, 2)).flat + +a.base +a.copy() +a.coords +a.index +iter(a) +next(a) +a[0] +a[[0, 1, 2]] +a[...] +a[:] +a.__array__() +a.__array__(np.dtype(np.float64)) diff --git a/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/pass/fromnumeric.py b/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/pass/fromnumeric.py new file mode 100644 index 0000000000000000000000000000000000000000..9e936e68465a735acc1e61eb91da46e6f40d6d37 --- /dev/null +++ b/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/pass/fromnumeric.py @@ -0,0 +1,260 @@ +"""Tests for :mod:`numpy.core.fromnumeric`.""" + +import numpy as np + +A = np.array(True, ndmin=2, dtype=bool) +B = np.array(1.0, ndmin=2, dtype=np.float32) +A.setflags(write=False) +B.setflags(write=False) + +a = np.bool_(True) +b = np.float32(1.0) +c = 1.0 +d = np.array(1.0, dtype=np.float32) # writeable + +np.take(a, 0) +np.take(b, 0) +np.take(c, 0) +np.take(A, 0) +np.take(B, 0) +np.take(A, [0]) +np.take(B, [0]) + +np.reshape(a, 1) +np.reshape(b, 1) +np.reshape(c, 1) +np.reshape(A, 1) +np.reshape(B, 1) + +np.choose(a, [True, True]) +np.choose(A, [1.0, 1.0]) + +np.repeat(a, 1) +np.repeat(b, 1) +np.repeat(c, 1) +np.repeat(A, 1) +np.repeat(B, 1) + +np.swapaxes(A, 0, 0) +np.swapaxes(B, 0, 0) + +np.transpose(a) +np.transpose(b) +np.transpose(c) +np.transpose(A) +np.transpose(B) + +np.partition(a, 0, axis=None) +np.partition(b, 0, axis=None) +np.partition(c, 0, axis=None) +np.partition(A, 0) +np.partition(B, 0) + +np.argpartition(a, 0) +np.argpartition(b, 0) +np.argpartition(c, 0) +np.argpartition(A, 0) +np.argpartition(B, 0) + +np.sort(A, 0) +np.sort(B, 0) + +np.argsort(A, 0) +np.argsort(B, 0) + +np.argmax(A) +np.argmax(B) +np.argmax(A, axis=0) +np.argmax(B, axis=0) + +np.argmin(A) +np.argmin(B) +np.argmin(A, axis=0) +np.argmin(B, axis=0) + +np.searchsorted(A[0], 0) +np.searchsorted(B[0], 0) +np.searchsorted(A[0], [0]) +np.searchsorted(B[0], [0]) + +np.resize(a, (5, 5)) +np.resize(b, (5, 5)) +np.resize(c, (5, 5)) +np.resize(A, (5, 5)) +np.resize(B, (5, 5)) + +np.squeeze(a) +np.squeeze(b) +np.squeeze(c) +np.squeeze(A) +np.squeeze(B) + +np.diagonal(A) +np.diagonal(B) + +np.trace(A) +np.trace(B) + +np.ravel(a) +np.ravel(b) +np.ravel(c) +np.ravel(A) +np.ravel(B) + +np.nonzero(A) +np.nonzero(B) + +np.shape(a) +np.shape(b) +np.shape(c) +np.shape(A) +np.shape(B) + +np.compress([True], a) +np.compress([True], b) +np.compress([True], c) +np.compress([True], A) +np.compress([True], B) + +np.clip(a, 0, 1.0) +np.clip(b, -1, 1) +np.clip(a, 0, None) +np.clip(b, None, 1) +np.clip(c, 0, 1) +np.clip(A, 0, 1) +np.clip(B, 0, 1) +np.clip(B, [0, 1], [1, 2]) + +np.sum(a) +np.sum(b) +np.sum(c) +np.sum(A) +np.sum(B) +np.sum(A, axis=0) +np.sum(B, axis=0) + +np.all(a) +np.all(b) +np.all(c) +np.all(A) +np.all(B) +np.all(A, axis=0) +np.all(B, axis=0) +np.all(A, keepdims=True) +np.all(B, keepdims=True) + +np.any(a) +np.any(b) +np.any(c) +np.any(A) +np.any(B) +np.any(A, axis=0) +np.any(B, axis=0) +np.any(A, keepdims=True) +np.any(B, keepdims=True) + +np.cumsum(a) +np.cumsum(b) +np.cumsum(c) +np.cumsum(A) +np.cumsum(B) + +np.ptp(b) +np.ptp(c) +np.ptp(B) +np.ptp(B, axis=0) +np.ptp(B, keepdims=True) + +np.amax(a) +np.amax(b) +np.amax(c) +np.amax(A) +np.amax(B) +np.amax(A, axis=0) +np.amax(B, axis=0) +np.amax(A, keepdims=True) +np.amax(B, keepdims=True) + +np.amin(a) +np.amin(b) +np.amin(c) +np.amin(A) +np.amin(B) +np.amin(A, axis=0) +np.amin(B, axis=0) +np.amin(A, keepdims=True) +np.amin(B, keepdims=True) + +np.prod(a) +np.prod(b) +np.prod(c) +np.prod(A) +np.prod(B) +np.prod(a, dtype=None) +np.prod(A, dtype=None) +np.prod(A, axis=0) +np.prod(B, axis=0) +np.prod(A, keepdims=True) +np.prod(B, keepdims=True) +np.prod(b, out=d) +np.prod(B, out=d) + +np.cumprod(a) +np.cumprod(b) +np.cumprod(c) +np.cumprod(A) +np.cumprod(B) + +np.ndim(a) +np.ndim(b) +np.ndim(c) +np.ndim(A) +np.ndim(B) + +np.size(a) +np.size(b) +np.size(c) +np.size(A) +np.size(B) + +np.around(a) +np.around(b) +np.around(c) +np.around(A) +np.around(B) + +np.mean(a) +np.mean(b) +np.mean(c) +np.mean(A) +np.mean(B) +np.mean(A, axis=0) +np.mean(B, axis=0) +np.mean(A, keepdims=True) +np.mean(B, keepdims=True) +np.mean(b, out=d) +np.mean(B, out=d) + +np.std(a) +np.std(b) +np.std(c) +np.std(A) +np.std(B) +np.std(A, axis=0) +np.std(B, axis=0) +np.std(A, keepdims=True) +np.std(B, keepdims=True) +np.std(b, out=d) +np.std(B, out=d) + +np.var(a) +np.var(b) +np.var(c) +np.var(A) +np.var(B) +np.var(A, axis=0) +np.var(B, axis=0) +np.var(A, keepdims=True) +np.var(B, keepdims=True) +np.var(b, out=d) +np.var(B, out=d) diff --git a/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/pass/lib_utils.py b/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/pass/lib_utils.py new file mode 100644 index 0000000000000000000000000000000000000000..53a3e17432e4cfafa29790bccb4aa3fd698a3ee5 --- /dev/null +++ b/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/pass/lib_utils.py @@ -0,0 +1,28 @@ +from __future__ import annotations + +from io import StringIO + +import numpy as np + +FILE = StringIO() +AR = np.arange(10, dtype=np.float64) + + +def func(a: int) -> bool: + return True + + +np.deprecate(func) +np.deprecate() + +np.deprecate_with_doc("test") +np.deprecate_with_doc(None) + +np.byte_bounds(AR) +np.byte_bounds(np.float64()) + +np.info(1, output=FILE) + +np.source(np.interp, output=FILE) + +np.lookfor("binary representation", output=FILE) diff --git a/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/pass/multiarray.py b/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/pass/multiarray.py new file mode 100644 index 0000000000000000000000000000000000000000..26cedfd77566e7b7865345e0775af88153e74ffc --- /dev/null +++ b/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/pass/multiarray.py @@ -0,0 +1,76 @@ +import numpy as np +import numpy.typing as npt + +AR_f8: npt.NDArray[np.float64] = np.array([1.0]) +AR_i4 = np.array([1], dtype=np.int32) +AR_u1 = np.array([1], dtype=np.uint8) + +AR_LIKE_f = [1.5] +AR_LIKE_i = [1] + +b_f8 = np.broadcast(AR_f8) +b_i4_f8_f8 = np.broadcast(AR_i4, AR_f8, AR_f8) + +next(b_f8) +b_f8.reset() +b_f8.index +b_f8.iters +b_f8.nd +b_f8.ndim +b_f8.numiter +b_f8.shape +b_f8.size + +next(b_i4_f8_f8) +b_i4_f8_f8.reset() +b_i4_f8_f8.ndim +b_i4_f8_f8.index +b_i4_f8_f8.iters +b_i4_f8_f8.nd +b_i4_f8_f8.numiter +b_i4_f8_f8.shape +b_i4_f8_f8.size + +np.inner(AR_f8, AR_i4) + +np.where([True, True, False]) +np.where([True, True, False], 1, 0) + +np.lexsort([0, 1, 2]) + +np.can_cast(np.dtype("i8"), int) +np.can_cast(AR_f8, "f8") +np.can_cast(AR_f8, np.complex128, casting="unsafe") + +np.min_scalar_type([1]) +np.min_scalar_type(AR_f8) + +np.result_type(int, AR_i4) +np.result_type(AR_f8, AR_u1) +np.result_type(AR_f8, np.complex128) + +np.dot(AR_LIKE_f, AR_i4) +np.dot(AR_u1, 1) +np.dot(1.5j, 1) +np.dot(AR_u1, 1, out=AR_f8) + +np.vdot(AR_LIKE_f, AR_i4) +np.vdot(AR_u1, 1) +np.vdot(1.5j, 1) + +np.bincount(AR_i4) + +np.copyto(AR_f8, [1.6]) + +np.putmask(AR_f8, [True], 1.5) + +np.packbits(AR_i4) +np.packbits(AR_u1) + +np.unpackbits(AR_u1) + +np.shares_memory(1, 2) +np.shares_memory(AR_f8, AR_f8, max_work=1) + +np.may_share_memory(1, 2) +np.may_share_memory(AR_f8, AR_f8, max_work=1) diff --git a/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/pass/ndarray_misc.py b/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/pass/ndarray_misc.py new file mode 100644 index 0000000000000000000000000000000000000000..6beacc5d7cc9e586f9d6abe5ac5d3a62381ffc59 --- /dev/null +++ b/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/pass/ndarray_misc.py @@ -0,0 +1,185 @@ +""" +Tests for miscellaneous (non-magic) ``np.ndarray``/``np.generic`` methods. + +More extensive tests are performed for the methods' +function-based counterpart in `../from_numeric.py`. + +""" + +from __future__ import annotations + +import operator +from typing import cast, Any + +import numpy as np + +class SubClass(np.ndarray): ... + +i4 = np.int32(1) +A: np.ndarray[Any, np.dtype[np.int32]] = np.array([[1]], dtype=np.int32) +B0 = np.empty((), dtype=np.int32).view(SubClass) +B1 = np.empty((1,), dtype=np.int32).view(SubClass) +B2 = np.empty((1, 1), dtype=np.int32).view(SubClass) +C: np.ndarray[Any, np.dtype[np.int32]] = np.array([0, 1, 2], dtype=np.int32) +D = np.ones(3).view(SubClass) + +i4.all() +A.all() +A.all(axis=0) +A.all(keepdims=True) +A.all(out=B0) + +i4.any() +A.any() +A.any(axis=0) +A.any(keepdims=True) +A.any(out=B0) + +i4.argmax() +A.argmax() +A.argmax(axis=0) +A.argmax(out=B0) + +i4.argmin() +A.argmin() +A.argmin(axis=0) +A.argmin(out=B0) + +i4.argsort() +A.argsort() + +i4.choose([()]) +_choices = np.array([[0, 1, 2], [3, 4, 5], [6, 7, 8]], dtype=np.int32) +C.choose(_choices) +C.choose(_choices, out=D) + +i4.clip(1) +A.clip(1) +A.clip(None, 1) +A.clip(1, out=B2) +A.clip(None, 1, out=B2) + +i4.compress([1]) +A.compress([1]) +A.compress([1], out=B1) + +i4.conj() +A.conj() +B0.conj() + +i4.conjugate() +A.conjugate() +B0.conjugate() + +i4.cumprod() +A.cumprod() +A.cumprod(out=B1) + +i4.cumsum() +A.cumsum() +A.cumsum(out=B1) + +i4.max() +A.max() +A.max(axis=0) +A.max(keepdims=True) +A.max(out=B0) + +i4.mean() +A.mean() +A.mean(axis=0) +A.mean(keepdims=True) +A.mean(out=B0) + +i4.min() +A.min() +A.min(axis=0) +A.min(keepdims=True) +A.min(out=B0) + +i4.newbyteorder() +A.newbyteorder() +B0.newbyteorder('|') + +i4.prod() +A.prod() +A.prod(axis=0) +A.prod(keepdims=True) +A.prod(out=B0) + +i4.ptp() +A.ptp() +A.ptp(axis=0) +A.ptp(keepdims=True) +A.astype(int).ptp(out=B0) + +i4.round() +A.round() +A.round(out=B2) + +i4.repeat(1) +A.repeat(1) +B0.repeat(1) + +i4.std() +A.std() +A.std(axis=0) +A.std(keepdims=True) +A.std(out=B0.astype(np.float64)) + +i4.sum() +A.sum() +A.sum(axis=0) +A.sum(keepdims=True) +A.sum(out=B0) + +i4.take(0) +A.take(0) +A.take([0]) +A.take(0, out=B0) +A.take([0], out=B1) + +i4.var() +A.var() +A.var(axis=0) +A.var(keepdims=True) +A.var(out=B0) + +A.argpartition([0]) + +A.diagonal() + +A.dot(1) +A.dot(1, out=B2) + +A.nonzero() + +C.searchsorted(1) + +A.trace() +A.trace(out=B0) + +void = cast(np.void, np.array(1, dtype=[("f", np.float64)]).take(0)) +void.setfield(10, np.float64) + +A.item(0) +C.item(0) + +A.ravel() +C.ravel() + +A.flatten() +C.flatten() + +A.reshape(1) +C.reshape(3) + +int(np.array(1.0, dtype=np.float64)) +int(np.array("1", dtype=np.str_)) + +float(np.array(1.0, dtype=np.float64)) +float(np.array("1", dtype=np.str_)) + +complex(np.array(1.0, dtype=np.float64)) + +operator.index(np.array(1, dtype=np.int64)) diff --git a/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/pass/ndarray_shape_manipulation.py b/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/pass/ndarray_shape_manipulation.py new file mode 100644 index 0000000000000000000000000000000000000000..0ca3dff392e12a4122740ade2ceb71b3d6e7bb08 --- /dev/null +++ b/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/pass/ndarray_shape_manipulation.py @@ -0,0 +1,47 @@ +import numpy as np + +nd1 = np.array([[1, 2], [3, 4]]) + +# reshape +nd1.reshape(4) +nd1.reshape(2, 2) +nd1.reshape((2, 2)) + +nd1.reshape((2, 2), order="C") +nd1.reshape(4, order="C") + +# resize +nd1.resize() +nd1.resize(4) +nd1.resize(2, 2) +nd1.resize((2, 2)) + +nd1.resize((2, 2), refcheck=True) +nd1.resize(4, refcheck=True) + +nd2 = np.array([[1, 2], [3, 4]]) + +# transpose +nd2.transpose() +nd2.transpose(1, 0) +nd2.transpose((1, 0)) + +# swapaxes +nd2.swapaxes(0, 1) + +# flatten +nd2.flatten() +nd2.flatten("C") + +# ravel +nd2.ravel() +nd2.ravel("C") + +# squeeze +nd2.squeeze() + +nd3 = np.array([[1, 2]]) +nd3.squeeze(0) + +nd4 = np.array([[[1, 2]]]) +nd4.squeeze((0, 1)) diff --git a/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/pass/numerictypes.py b/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/pass/numerictypes.py new file mode 100644 index 0000000000000000000000000000000000000000..63b6ad0e22e221e22ad9eba9b48a526a6c741b5d --- /dev/null +++ b/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/pass/numerictypes.py @@ -0,0 +1,42 @@ +import numpy as np + +np.maximum_sctype("S8") +np.maximum_sctype(object) + +np.issctype(object) +np.issctype("S8") + +np.obj2sctype(list) +np.obj2sctype(list, default=None) +np.obj2sctype(list, default=np.bytes_) + +np.issubclass_(np.int32, int) +np.issubclass_(np.float64, float) +np.issubclass_(np.float64, (int, float)) + +np.issubsctype("int64", int) +np.issubsctype(np.array([1]), np.array([1])) + +np.issubdtype("S1", np.bytes_) +np.issubdtype(np.float64, np.float32) + +np.sctype2char("S1") +np.sctype2char(list) + +np.cast[int] +np.cast["i8"] +np.cast[np.int64] + +np.nbytes[int] +np.nbytes["i8"] +np.nbytes[np.int64] + +np.ScalarType +np.ScalarType[0] +np.ScalarType[3] +np.ScalarType[8] +np.ScalarType[10] + +np.typecodes["Character"] +np.typecodes["Complex"] +np.typecodes["All"] diff --git a/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/pass/scalars.py b/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/pass/scalars.py new file mode 100644 index 0000000000000000000000000000000000000000..a5c6f96e9fa2a8c966bcdd7c7164c6611bfcfe4d --- /dev/null +++ b/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/pass/scalars.py @@ -0,0 +1,248 @@ +import sys +import datetime as dt + +import pytest +import numpy as np + +b = np.bool_() +u8 = np.uint64() +i8 = np.int64() +f8 = np.float64() +c16 = np.complex128() +U = np.str_() +S = np.bytes_() + + +# Construction +class D: + def __index__(self) -> int: + return 0 + + +class C: + def __complex__(self) -> complex: + return 3j + + +class B: + def __int__(self) -> int: + return 4 + + +class A: + def __float__(self) -> float: + return 4.0 + + +np.complex64(3j) +np.complex64(A()) +np.complex64(C()) +np.complex128(3j) +np.complex128(C()) +np.complex128(None) +np.complex64("1.2") +np.complex128(b"2j") + +np.int8(4) +np.int16(3.4) +np.int32(4) +np.int64(-1) +np.uint8(B()) +np.uint32() +np.int32("1") +np.int64(b"2") + +np.float16(A()) +np.float32(16) +np.float64(3.0) +np.float64(None) +np.float32("1") +np.float16(b"2.5") + +np.uint64(D()) +np.float32(D()) +np.complex64(D()) + +np.bytes_(b"hello") +np.bytes_("hello", 'utf-8') +np.bytes_("hello", encoding='utf-8') +np.str_("hello") +np.str_(b"hello", 'utf-8') +np.str_(b"hello", encoding='utf-8') + +# Array-ish semantics +np.int8().real +np.int16().imag +np.int32().data +np.int64().flags + +np.uint8().itemsize * 2 +np.uint16().ndim + 1 +np.uint32().strides +np.uint64().shape + +# Time structures +np.datetime64() +np.datetime64(0, "D") +np.datetime64(0, b"D") +np.datetime64(0, ('ms', 3)) +np.datetime64("2019") +np.datetime64(b"2019") +np.datetime64("2019", "D") +np.datetime64(np.datetime64()) +np.datetime64(dt.datetime(2000, 5, 3)) +np.datetime64(dt.date(2000, 5, 3)) +np.datetime64(None) +np.datetime64(None, "D") + +np.timedelta64() +np.timedelta64(0) +np.timedelta64(0, "D") +np.timedelta64(0, ('ms', 3)) +np.timedelta64(0, b"D") +np.timedelta64("3") +np.timedelta64(b"5") +np.timedelta64(np.timedelta64(2)) +np.timedelta64(dt.timedelta(2)) +np.timedelta64(None) +np.timedelta64(None, "D") + +np.void(1) +np.void(np.int64(1)) +np.void(True) +np.void(np.bool_(True)) +np.void(b"test") +np.void(np.bytes_("test")) +np.void(object(), [("a", "O"), ("b", "O")]) +np.void(object(), dtype=[("a", "O"), ("b", "O")]) + +# Protocols +i8 = np.int64() +u8 = np.uint64() +f8 = np.float64() +c16 = np.complex128() +b_ = np.bool_() +td = np.timedelta64() +U = np.str_("1") +S = np.bytes_("1") +AR = np.array(1, dtype=np.float64) + +int(i8) +int(u8) +int(f8) +int(b_) +int(td) +int(U) +int(S) +int(AR) +with pytest.warns(np.ComplexWarning): + int(c16) + +float(i8) +float(u8) +float(f8) +float(b_) +float(td) +float(U) +float(S) +float(AR) +with pytest.warns(np.ComplexWarning): + float(c16) + +complex(i8) +complex(u8) +complex(f8) +complex(c16) +complex(b_) +complex(td) +complex(U) +complex(AR) + + +# Misc +c16.dtype +c16.real +c16.imag +c16.real.real +c16.real.imag +c16.ndim +c16.size +c16.itemsize +c16.shape +c16.strides +c16.squeeze() +c16.byteswap() +c16.transpose() + +# Aliases +np.string_() + +np.byte() +np.short() +np.intc() +np.intp() +np.int_() +np.longlong() + +np.ubyte() +np.ushort() +np.uintc() +np.uintp() +np.uint() +np.ulonglong() + +np.half() +np.single() +np.double() +np.float_() +np.longdouble() +np.longfloat() + +np.csingle() +np.singlecomplex() +np.cdouble() +np.complex_() +np.cfloat() +np.clongdouble() +np.clongfloat() +np.longcomplex() + +b.item() +i8.item() +u8.item() +f8.item() +c16.item() +U.item() +S.item() + +b.tolist() +i8.tolist() +u8.tolist() +f8.tolist() +c16.tolist() +U.tolist() +S.tolist() + +b.ravel() +i8.ravel() +u8.ravel() +f8.ravel() +c16.ravel() +U.ravel() +S.ravel() + +b.flatten() +i8.flatten() +u8.flatten() +f8.flatten() +c16.flatten() +U.flatten() +S.flatten() + +b.reshape(1) +i8.reshape(1) +u8.reshape(1) +f8.reshape(1) +c16.reshape(1) +U.reshape(1) +S.reshape(1) diff --git a/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/pass/simple.py b/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/pass/simple.py new file mode 100644 index 0000000000000000000000000000000000000000..80116870287e4faa58f1640974536ae0ee6250d0 --- /dev/null +++ b/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/pass/simple.py @@ -0,0 +1,165 @@ +"""Simple expression that should pass with mypy.""" +import operator + +import numpy as np +from collections.abc import Iterable + +# Basic checks +array = np.array([1, 2]) + + +def ndarray_func(x): + # type: (np.ndarray) -> np.ndarray + return x + + +ndarray_func(np.array([1, 2])) +array == 1 +array.dtype == float + +# Dtype construction +np.dtype(float) +np.dtype(np.float64) +np.dtype(None) +np.dtype("float64") +np.dtype(np.dtype(float)) +np.dtype(("U", 10)) +np.dtype((np.int32, (2, 2))) +# Define the arguments on the previous line to prevent bidirectional +# type inference in mypy from broadening the types. +two_tuples_dtype = [("R", "u1"), ("G", "u1"), ("B", "u1")] +np.dtype(two_tuples_dtype) + +three_tuples_dtype = [("R", "u1", 2)] +np.dtype(three_tuples_dtype) + +mixed_tuples_dtype = [("R", "u1"), ("G", np.str_, 1)] +np.dtype(mixed_tuples_dtype) + +shape_tuple_dtype = [("R", "u1", (2, 2))] +np.dtype(shape_tuple_dtype) + +shape_like_dtype = [("R", "u1", (2, 2)), ("G", np.str_, 1)] +np.dtype(shape_like_dtype) + +object_dtype = [("field1", object)] +np.dtype(object_dtype) + +np.dtype((np.int32, (np.int8, 4))) + +# Dtype comparison +np.dtype(float) == float +np.dtype(float) != np.float64 +np.dtype(float) < None +np.dtype(float) <= "float64" +np.dtype(float) > np.dtype(float) +np.dtype(float) >= np.dtype(("U", 10)) + +# Iteration and indexing +def iterable_func(x): + # type: (Iterable) -> Iterable + return x + + +iterable_func(array) +[element for element in array] +iter(array) +zip(array, array) +array[1] +array[:] +array[...] +array[:] = 0 + +array_2d = np.ones((3, 3)) +array_2d[:2, :2] +array_2d[..., 0] +array_2d[:2, :2] = 0 + +# Other special methods +len(array) +str(array) +array_scalar = np.array(1) +int(array_scalar) +float(array_scalar) +# currently does not work due to https://github.com/python/typeshed/issues/1904 +# complex(array_scalar) +bytes(array_scalar) +operator.index(array_scalar) +bool(array_scalar) + +# comparisons +array < 1 +array <= 1 +array == 1 +array != 1 +array > 1 +array >= 1 +1 < array +1 <= array +1 == array +1 != array +1 > array +1 >= array + +# binary arithmetic +array + 1 +1 + array +array += 1 + +array - 1 +1 - array +array -= 1 + +array * 1 +1 * array +array *= 1 + +nonzero_array = np.array([1, 2]) +array / 1 +1 / nonzero_array +float_array = np.array([1.0, 2.0]) +float_array /= 1 + +array // 1 +1 // nonzero_array +array //= 1 + +array % 1 +1 % nonzero_array +array %= 1 + +divmod(array, 1) +divmod(1, nonzero_array) + +array ** 1 +1 ** array +array **= 1 + +array << 1 +1 << array +array <<= 1 + +array >> 1 +1 >> array +array >>= 1 + +array & 1 +1 & array +array &= 1 + +array ^ 1 +1 ^ array +array ^= 1 + +array | 1 +1 | array +array |= 1 + +# unary arithmetic +-array ++array +abs(array) +~array + +# Other methods +np.array([1, 2]).transpose() diff --git a/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/pass/ufunc_config.py b/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/pass/ufunc_config.py new file mode 100644 index 0000000000000000000000000000000000000000..58dd3e550a51984e2d331f9f017ef5651630d749 --- /dev/null +++ b/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/pass/ufunc_config.py @@ -0,0 +1,64 @@ +"""Typing tests for `numpy.core._ufunc_config`.""" + +import numpy as np + + +def func1(a: str, b: int) -> None: + return None + + +def func2(a: str, b: int, c: float = 1.0) -> None: + return None + + +def func3(a: str, b: int) -> int: + return 0 + + +class Write1: + def write(self, a: str) -> None: + return None + + +class Write2: + def write(self, a: str, b: int = 1) -> None: + return None + + +class Write3: + def write(self, a: str) -> int: + return 0 + + +_err_default = np.geterr() +_bufsize_default = np.getbufsize() +_errcall_default = np.geterrcall() + +try: + np.seterr(all=None) + np.seterr(divide="ignore") + np.seterr(over="warn") + np.seterr(under="call") + np.seterr(invalid="raise") + np.geterr() + + np.setbufsize(4096) + np.getbufsize() + + np.seterrcall(func1) + np.seterrcall(func2) + np.seterrcall(func3) + np.seterrcall(Write1()) + np.seterrcall(Write2()) + np.seterrcall(Write3()) + np.geterrcall() + + with np.errstate(call=func1, all="call"): + pass + with np.errstate(call=Write1(), divide="log", over="log"): + pass + +finally: + np.seterr(**_err_default) + np.setbufsize(_bufsize_default) + np.seterrcall(_errcall_default) diff --git a/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/pass/ufunclike.py b/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/pass/ufunclike.py new file mode 100644 index 0000000000000000000000000000000000000000..7eac89e8f9aac8c32c54c9e88183e05721a82325 --- /dev/null +++ b/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/pass/ufunclike.py @@ -0,0 +1,46 @@ +from __future__ import annotations +from typing import Any +import numpy as np + + +class Object: + def __ceil__(self) -> Object: + return self + + def __floor__(self) -> Object: + return self + + def __ge__(self, value: object) -> bool: + return True + + def __array__(self) -> np.ndarray[Any, np.dtype[np.object_]]: + ret = np.empty((), dtype=object) + ret[()] = self + return ret + + +AR_LIKE_b = [True, True, False] +AR_LIKE_u = [np.uint32(1), np.uint32(2), np.uint32(3)] +AR_LIKE_i = [1, 2, 3] +AR_LIKE_f = [1.0, 2.0, 3.0] +AR_LIKE_O = [Object(), Object(), Object()] +AR_U: np.ndarray[Any, np.dtype[np.str_]] = np.zeros(3, dtype="U5") + +np.fix(AR_LIKE_b) +np.fix(AR_LIKE_u) +np.fix(AR_LIKE_i) +np.fix(AR_LIKE_f) +np.fix(AR_LIKE_O) +np.fix(AR_LIKE_f, out=AR_U) + +np.isposinf(AR_LIKE_b) +np.isposinf(AR_LIKE_u) +np.isposinf(AR_LIKE_i) +np.isposinf(AR_LIKE_f) +np.isposinf(AR_LIKE_f, out=AR_U) + +np.isneginf(AR_LIKE_b) +np.isneginf(AR_LIKE_u) +np.isneginf(AR_LIKE_i) +np.isneginf(AR_LIKE_f) +np.isneginf(AR_LIKE_f, out=AR_U) diff --git a/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/pass/ufuncs.py b/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/pass/ufuncs.py new file mode 100644 index 0000000000000000000000000000000000000000..3cc31ae5e30506481192d0e4b2f3df8347af65c8 --- /dev/null +++ b/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/pass/ufuncs.py @@ -0,0 +1,17 @@ +import numpy as np + +np.sin(1) +np.sin([1, 2, 3]) +np.sin(1, out=np.empty(1)) +np.matmul(np.ones((2, 2, 2)), np.ones((2, 2, 2)), axes=[(0, 1), (0, 1), (0, 1)]) +np.sin(1, signature="D->D") +np.sin(1, extobj=[16, 1, lambda: None]) +# NOTE: `np.generic` subclasses are not guaranteed to support addition; +# re-enable this we can infer the exact return type of `np.sin(...)`. +# +# np.sin(1) + np.sin(1) +np.sin.types[0] +np.sin.__name__ +np.sin.__doc__ + +np.abs(np.array([1])) diff --git a/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/pass/warnings_and_errors.py b/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/pass/warnings_and_errors.py new file mode 100644 index 0000000000000000000000000000000000000000..a556bf6bcb35b4b3451b49997bef4c8a10d9995b --- /dev/null +++ b/env-llmeval/lib/python3.10/site-packages/numpy/typing/tests/data/pass/warnings_and_errors.py @@ -0,0 +1,6 @@ +import numpy as np + +np.AxisError("test") +np.AxisError(1, ndim=2) +np.AxisError(1, ndim=2, msg_prefix="error") +np.AxisError(1, ndim=2, msg_prefix=None)