ZTWHHH commited on
Commit
df08e6f
·
verified ·
1 Parent(s): aa586d5

Add files using upload-large-folder tool

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. valley/lib/python3.10/site-packages/numpy/typing/tests/__pycache__/__init__.cpython-310.pyc +0 -0
  2. valley/lib/python3.10/site-packages/numpy/typing/tests/__pycache__/test_isfile.cpython-310.pyc +0 -0
  3. valley/lib/python3.10/site-packages/numpy/typing/tests/__pycache__/test_runtime.cpython-310.pyc +0 -0
  4. valley/lib/python3.10/site-packages/numpy/typing/tests/__pycache__/test_typing.cpython-310.pyc +0 -0
  5. valley/lib/python3.10/site-packages/numpy/typing/tests/data/fail/arithmetic.pyi +123 -0
  6. valley/lib/python3.10/site-packages/numpy/typing/tests/data/fail/array_constructors.pyi +34 -0
  7. valley/lib/python3.10/site-packages/numpy/typing/tests/data/fail/array_like.pyi +16 -0
  8. valley/lib/python3.10/site-packages/numpy/typing/tests/data/fail/array_pad.pyi +6 -0
  9. valley/lib/python3.10/site-packages/numpy/typing/tests/data/fail/arrayprint.pyi +16 -0
  10. valley/lib/python3.10/site-packages/numpy/typing/tests/data/fail/arrayterator.pyi +14 -0
  11. valley/lib/python3.10/site-packages/numpy/typing/tests/data/fail/bitwise_ops.pyi +21 -0
  12. valley/lib/python3.10/site-packages/numpy/typing/tests/data/fail/char.pyi +69 -0
  13. valley/lib/python3.10/site-packages/numpy/typing/tests/data/fail/chararray.pyi +62 -0
  14. valley/lib/python3.10/site-packages/numpy/typing/tests/data/fail/comparisons.pyi +27 -0
  15. valley/lib/python3.10/site-packages/numpy/typing/tests/data/fail/constants.pyi +3 -0
  16. valley/lib/python3.10/site-packages/numpy/typing/tests/data/fail/datasource.pyi +15 -0
  17. valley/lib/python3.10/site-packages/numpy/typing/tests/data/fail/dtype.pyi +20 -0
  18. valley/lib/python3.10/site-packages/numpy/typing/tests/data/fail/einsumfunc.pyi +12 -0
  19. valley/lib/python3.10/site-packages/numpy/typing/tests/data/fail/false_positives.pyi +11 -0
  20. valley/lib/python3.10/site-packages/numpy/typing/tests/data/fail/flatiter.pyi +25 -0
  21. valley/lib/python3.10/site-packages/numpy/typing/tests/data/fail/fromnumeric.pyi +161 -0
  22. valley/lib/python3.10/site-packages/numpy/typing/tests/data/fail/histograms.pyi +12 -0
  23. valley/lib/python3.10/site-packages/numpy/typing/tests/data/fail/index_tricks.pyi +14 -0
  24. valley/lib/python3.10/site-packages/numpy/typing/tests/data/fail/lib_function_base.pyi +51 -0
  25. valley/lib/python3.10/site-packages/numpy/typing/tests/data/fail/lib_polynomial.pyi +29 -0
  26. valley/lib/python3.10/site-packages/numpy/typing/tests/data/fail/lib_utils.pyi +3 -0
  27. valley/lib/python3.10/site-packages/numpy/typing/tests/data/fail/lib_version.pyi +6 -0
  28. valley/lib/python3.10/site-packages/numpy/typing/tests/data/fail/linalg.pyi +48 -0
  29. valley/lib/python3.10/site-packages/numpy/typing/tests/data/fail/memmap.pyi +5 -0
  30. valley/lib/python3.10/site-packages/numpy/typing/tests/data/fail/modules.pyi +18 -0
  31. valley/lib/python3.10/site-packages/numpy/typing/tests/data/fail/multiarray.pyi +53 -0
  32. valley/lib/python3.10/site-packages/numpy/typing/tests/data/fail/ndarray.pyi +11 -0
  33. valley/lib/python3.10/site-packages/numpy/typing/tests/data/fail/ndarray_misc.pyi +43 -0
  34. valley/lib/python3.10/site-packages/numpy/typing/tests/data/fail/nditer.pyi +8 -0
  35. valley/lib/python3.10/site-packages/numpy/typing/tests/data/fail/nested_sequence.pyi +17 -0
  36. valley/lib/python3.10/site-packages/numpy/typing/tests/data/fail/npyio.pyi +23 -0
  37. valley/lib/python3.10/site-packages/numpy/typing/tests/data/fail/numerictypes.pyi +5 -0
  38. valley/lib/python3.10/site-packages/numpy/typing/tests/data/fail/random.pyi +62 -0
  39. valley/lib/python3.10/site-packages/numpy/typing/tests/data/fail/rec.pyi +17 -0
  40. valley/lib/python3.10/site-packages/numpy/typing/tests/data/fail/scalars.pyi +92 -0
  41. valley/lib/python3.10/site-packages/numpy/typing/tests/data/fail/shape.pyi +6 -0
  42. valley/lib/python3.10/site-packages/numpy/typing/tests/data/fail/shape_base.pyi +8 -0
  43. valley/lib/python3.10/site-packages/numpy/typing/tests/data/fail/stride_tricks.pyi +9 -0
  44. valley/lib/python3.10/site-packages/numpy/typing/tests/data/fail/strings.pyi +69 -0
  45. valley/lib/python3.10/site-packages/numpy/typing/tests/data/fail/testing.pyi +28 -0
  46. valley/lib/python3.10/site-packages/numpy/typing/tests/data/fail/twodim_base.pyi +37 -0
  47. valley/lib/python3.10/site-packages/numpy/typing/tests/data/fail/type_check.pyi +13 -0
  48. valley/lib/python3.10/site-packages/numpy/typing/tests/data/fail/ufunc_config.pyi +21 -0
  49. valley/lib/python3.10/site-packages/numpy/typing/tests/data/fail/ufunclike.pyi +21 -0
  50. valley/lib/python3.10/site-packages/numpy/typing/tests/data/fail/ufuncs.pyi +17 -0
valley/lib/python3.10/site-packages/numpy/typing/tests/__pycache__/__init__.cpython-310.pyc ADDED
Binary file (170 Bytes). View file
 
valley/lib/python3.10/site-packages/numpy/typing/tests/__pycache__/test_isfile.cpython-310.pyc ADDED
Binary file (1.09 kB). View file
 
valley/lib/python3.10/site-packages/numpy/typing/tests/__pycache__/test_runtime.cpython-310.pyc ADDED
Binary file (3.65 kB). View file
 
valley/lib/python3.10/site-packages/numpy/typing/tests/__pycache__/test_typing.cpython-310.pyc ADDED
Binary file (7.29 kB). View file
 
valley/lib/python3.10/site-packages/numpy/typing/tests/data/fail/arithmetic.pyi ADDED
@@ -0,0 +1,123 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from typing import Any
2
+
3
+ import numpy as np
4
+ import numpy.typing as npt
5
+
6
+ b_ = np.bool()
7
+ dt = np.datetime64(0, "D")
8
+ td = np.timedelta64(0, "D")
9
+
10
+ AR_b: npt.NDArray[np.bool]
11
+ AR_u: npt.NDArray[np.uint32]
12
+ AR_i: npt.NDArray[np.int64]
13
+ AR_f: npt.NDArray[np.float64]
14
+ AR_c: npt.NDArray[np.complex128]
15
+ AR_m: npt.NDArray[np.timedelta64]
16
+ AR_M: npt.NDArray[np.datetime64]
17
+
18
+ ANY: Any
19
+
20
+ AR_LIKE_b: list[bool]
21
+ AR_LIKE_u: list[np.uint32]
22
+ AR_LIKE_i: list[int]
23
+ AR_LIKE_f: list[float]
24
+ AR_LIKE_c: list[complex]
25
+ AR_LIKE_m: list[np.timedelta64]
26
+ AR_LIKE_M: list[np.datetime64]
27
+
28
+ # Array subtraction
29
+
30
+ # NOTE: mypys `NoReturn` errors are, unfortunately, not that great
31
+ _1 = AR_b - AR_LIKE_b # E: Need type annotation
32
+ _2 = AR_LIKE_b - AR_b # E: Need type annotation
33
+ AR_i - bytes() # E: No overload variant
34
+
35
+ AR_f - AR_LIKE_m # E: Unsupported operand types
36
+ AR_f - AR_LIKE_M # E: Unsupported operand types
37
+ AR_c - AR_LIKE_m # E: Unsupported operand types
38
+ AR_c - AR_LIKE_M # E: Unsupported operand types
39
+
40
+ AR_m - AR_LIKE_f # E: Unsupported operand types
41
+ AR_M - AR_LIKE_f # E: Unsupported operand types
42
+ AR_m - AR_LIKE_c # E: Unsupported operand types
43
+ AR_M - AR_LIKE_c # E: Unsupported operand types
44
+
45
+ AR_m - AR_LIKE_M # E: Unsupported operand types
46
+ AR_LIKE_m - AR_M # E: Unsupported operand types
47
+
48
+ # array floor division
49
+
50
+ AR_M // AR_LIKE_b # E: Unsupported operand types
51
+ AR_M // AR_LIKE_u # E: Unsupported operand types
52
+ AR_M // AR_LIKE_i # E: Unsupported operand types
53
+ AR_M // AR_LIKE_f # E: Unsupported operand types
54
+ AR_M // AR_LIKE_c # E: Unsupported operand types
55
+ AR_M // AR_LIKE_m # E: Unsupported operand types
56
+ AR_M // AR_LIKE_M # E: Unsupported operand types
57
+
58
+ AR_b // AR_LIKE_M # E: Unsupported operand types
59
+ AR_u // AR_LIKE_M # E: Unsupported operand types
60
+ AR_i // AR_LIKE_M # E: Unsupported operand types
61
+ AR_f // AR_LIKE_M # E: Unsupported operand types
62
+ AR_c // AR_LIKE_M # E: Unsupported operand types
63
+ AR_m // AR_LIKE_M # E: Unsupported operand types
64
+ AR_M // AR_LIKE_M # E: Unsupported operand types
65
+
66
+ _3 = AR_m // AR_LIKE_b # E: Need type annotation
67
+ AR_m // AR_LIKE_c # E: Unsupported operand types
68
+
69
+ AR_b // AR_LIKE_m # E: Unsupported operand types
70
+ AR_u // AR_LIKE_m # E: Unsupported operand types
71
+ AR_i // AR_LIKE_m # E: Unsupported operand types
72
+ AR_f // AR_LIKE_m # E: Unsupported operand types
73
+ AR_c // AR_LIKE_m # E: Unsupported operand types
74
+
75
+ # Array multiplication
76
+
77
+ AR_b *= AR_LIKE_u # E: incompatible type
78
+ AR_b *= AR_LIKE_i # E: incompatible type
79
+ AR_b *= AR_LIKE_f # E: incompatible type
80
+ AR_b *= AR_LIKE_c # E: incompatible type
81
+ AR_b *= AR_LIKE_m # E: incompatible type
82
+
83
+ AR_u *= AR_LIKE_i # E: incompatible type
84
+ AR_u *= AR_LIKE_f # E: incompatible type
85
+ AR_u *= AR_LIKE_c # E: incompatible type
86
+ AR_u *= AR_LIKE_m # E: incompatible type
87
+
88
+ AR_i *= AR_LIKE_f # E: incompatible type
89
+ AR_i *= AR_LIKE_c # E: incompatible type
90
+ AR_i *= AR_LIKE_m # E: incompatible type
91
+
92
+ AR_f *= AR_LIKE_c # E: incompatible type
93
+ AR_f *= AR_LIKE_m # E: incompatible type
94
+
95
+ # Array power
96
+
97
+ AR_b **= AR_LIKE_b # E: Invalid self argument
98
+ AR_b **= AR_LIKE_u # E: Invalid self argument
99
+ AR_b **= AR_LIKE_i # E: Invalid self argument
100
+ AR_b **= AR_LIKE_f # E: Invalid self argument
101
+ AR_b **= AR_LIKE_c # E: Invalid self argument
102
+
103
+ AR_u **= AR_LIKE_i # E: incompatible type
104
+ AR_u **= AR_LIKE_f # E: incompatible type
105
+ AR_u **= AR_LIKE_c # E: incompatible type
106
+
107
+ AR_i **= AR_LIKE_f # E: incompatible type
108
+ AR_i **= AR_LIKE_c # E: incompatible type
109
+
110
+ AR_f **= AR_LIKE_c # E: incompatible type
111
+
112
+ # Scalars
113
+
114
+ b_ - b_ # E: No overload variant
115
+
116
+ dt + dt # E: Unsupported operand types
117
+ td - dt # E: Unsupported operand types
118
+ td % 1 # E: Unsupported operand types
119
+ td / dt # E: No overload
120
+ td % dt # E: Unsupported operand types
121
+
122
+ -b_ # E: Unsupported operand type
123
+ +b_ # E: Unsupported operand type
valley/lib/python3.10/site-packages/numpy/typing/tests/data/fail/array_constructors.pyi ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import numpy as np
2
+ import numpy.typing as npt
3
+
4
+ a: npt.NDArray[np.float64]
5
+ generator = (i for i in range(10))
6
+
7
+ np.require(a, requirements=1) # E: No overload variant
8
+ np.require(a, requirements="TEST") # E: incompatible type
9
+
10
+ np.zeros("test") # E: incompatible type
11
+ np.zeros() # E: require at least one argument
12
+
13
+ np.ones("test") # E: incompatible type
14
+ np.ones() # E: require at least one argument
15
+
16
+ np.array(0, float, True) # E: No overload variant
17
+
18
+ np.linspace(None, 'bob') # E: No overload variant
19
+ np.linspace(0, 2, num=10.0) # E: No overload variant
20
+ np.linspace(0, 2, endpoint='True') # E: No overload variant
21
+ np.linspace(0, 2, retstep=b'False') # E: No overload variant
22
+ np.linspace(0, 2, dtype=0) # E: No overload variant
23
+ np.linspace(0, 2, axis=None) # E: No overload variant
24
+
25
+ np.logspace(None, 'bob') # E: No overload variant
26
+ np.logspace(0, 2, base=None) # E: No overload variant
27
+
28
+ np.geomspace(None, 'bob') # E: No overload variant
29
+
30
+ np.stack(generator) # E: No overload variant
31
+ np.hstack({1, 2}) # E: No overload variant
32
+ np.vstack(1) # E: No overload variant
33
+
34
+ np.array([1], like=1) # E: No overload variant
valley/lib/python3.10/site-packages/numpy/typing/tests/data/fail/array_like.pyi ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import numpy as np
2
+ from numpy._typing import ArrayLike
3
+
4
+
5
+ class A:
6
+ pass
7
+
8
+
9
+ x1: ArrayLike = (i for i in range(10)) # E: Incompatible types in assignment
10
+ x2: ArrayLike = A() # E: Incompatible types in assignment
11
+ x3: ArrayLike = {1: "foo", 2: "bar"} # E: Incompatible types in assignment
12
+
13
+ scalar = np.int64(1)
14
+ scalar.__array__(dtype=np.float64) # E: No overload variant
15
+ array = np.array([1])
16
+ array.__array__(dtype=np.float64) # E: No overload variant
valley/lib/python3.10/site-packages/numpy/typing/tests/data/fail/array_pad.pyi ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ import numpy as np
2
+ import numpy.typing as npt
3
+
4
+ AR_i8: npt.NDArray[np.int64]
5
+
6
+ np.pad(AR_i8, 2, mode="bob") # E: No overload variant
valley/lib/python3.10/site-packages/numpy/typing/tests/data/fail/arrayprint.pyi ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from collections.abc import Callable
2
+ from typing import Any
3
+
4
+ import numpy as np
5
+ import numpy.typing as npt
6
+
7
+ AR: npt.NDArray[np.float64]
8
+ func1: Callable[[Any], str]
9
+ func2: Callable[[np.integer[Any]], str]
10
+
11
+ np.array2string(AR, style=None) # E: Unexpected keyword argument
12
+ np.array2string(AR, legacy="1.14") # E: incompatible type
13
+ np.array2string(AR, sign="*") # E: incompatible type
14
+ np.array2string(AR, floatmode="default") # E: incompatible type
15
+ np.array2string(AR, formatter={"A": func1}) # E: incompatible type
16
+ np.array2string(AR, formatter={"float": func2}) # E: Incompatible types
valley/lib/python3.10/site-packages/numpy/typing/tests/data/fail/arrayterator.pyi ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import numpy as np
2
+ import numpy.typing as npt
3
+
4
+ AR_i8: npt.NDArray[np.int64]
5
+ ar_iter = np.lib.Arrayterator(AR_i8)
6
+
7
+ np.lib.Arrayterator(np.int64()) # E: incompatible type
8
+ ar_iter.shape = (10, 5) # E: is read-only
9
+ ar_iter[None] # E: Invalid index type
10
+ ar_iter[None, 1] # E: Invalid index type
11
+ ar_iter[np.intp()] # E: Invalid index type
12
+ ar_iter[np.intp(), ...] # E: Invalid index type
13
+ ar_iter[AR_i8] # E: Invalid index type
14
+ ar_iter[AR_i8, :] # E: Invalid index type
valley/lib/python3.10/site-packages/numpy/typing/tests/data/fail/bitwise_ops.pyi ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import numpy as np
2
+
3
+ i8 = np.int64()
4
+ i4 = np.int32()
5
+ u8 = np.uint64()
6
+ b_ = np.bool()
7
+ i = int()
8
+
9
+ f8 = np.float64()
10
+
11
+ b_ >> f8 # E: No overload variant
12
+ i8 << f8 # E: No overload variant
13
+ i | f8 # E: Unsupported operand types
14
+ i8 ^ f8 # E: No overload variant
15
+ u8 & f8 # E: No overload variant
16
+ ~f8 # E: Unsupported operand type
17
+ # TODO: Certain mixes like i4 << u8 go to float and thus should fail
18
+
19
+ # mypys' error message for `NoReturn` is unfortunately pretty bad
20
+ # TODO: Re-enable this once we add support for numerical precision for `number`s
21
+ # a = u8 | 0 # E: Need type annotation
valley/lib/python3.10/site-packages/numpy/typing/tests/data/fail/char.pyi ADDED
@@ -0,0 +1,69 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import numpy as np
2
+ import numpy.typing as npt
3
+
4
+ AR_U: npt.NDArray[np.str_]
5
+ AR_S: npt.NDArray[np.bytes_]
6
+
7
+ np.char.equal(AR_U, AR_S) # E: incompatible type
8
+
9
+ np.char.not_equal(AR_U, AR_S) # E: incompatible type
10
+
11
+ np.char.greater_equal(AR_U, AR_S) # E: incompatible type
12
+
13
+ np.char.less_equal(AR_U, AR_S) # E: incompatible type
14
+
15
+ np.char.greater(AR_U, AR_S) # E: incompatible type
16
+
17
+ np.char.less(AR_U, AR_S) # E: incompatible type
18
+
19
+ np.char.encode(AR_S) # E: incompatible type
20
+ np.char.decode(AR_U) # E: incompatible type
21
+
22
+ np.char.join(AR_U, b"_") # E: incompatible type
23
+ np.char.join(AR_S, "_") # E: incompatible type
24
+
25
+ np.char.ljust(AR_U, 5, fillchar=b"a") # E: incompatible type
26
+ np.char.ljust(AR_S, 5, fillchar="a") # E: incompatible type
27
+ np.char.rjust(AR_U, 5, fillchar=b"a") # E: incompatible type
28
+ np.char.rjust(AR_S, 5, fillchar="a") # E: incompatible type
29
+
30
+ np.char.lstrip(AR_U, chars=b"a") # E: incompatible type
31
+ np.char.lstrip(AR_S, chars="a") # E: incompatible type
32
+ np.char.strip(AR_U, chars=b"a") # E: incompatible type
33
+ np.char.strip(AR_S, chars="a") # E: incompatible type
34
+ np.char.rstrip(AR_U, chars=b"a") # E: incompatible type
35
+ np.char.rstrip(AR_S, chars="a") # E: incompatible type
36
+
37
+ np.char.partition(AR_U, b"a") # E: incompatible type
38
+ np.char.partition(AR_S, "a") # E: incompatible type
39
+ np.char.rpartition(AR_U, b"a") # E: incompatible type
40
+ np.char.rpartition(AR_S, "a") # E: incompatible type
41
+
42
+ np.char.replace(AR_U, b"_", b"-") # E: incompatible type
43
+ np.char.replace(AR_S, "_", "-") # E: incompatible type
44
+
45
+ np.char.split(AR_U, b"_") # E: incompatible type
46
+ np.char.split(AR_S, "_") # E: incompatible type
47
+ np.char.rsplit(AR_U, b"_") # E: incompatible type
48
+ np.char.rsplit(AR_S, "_") # E: incompatible type
49
+
50
+ np.char.count(AR_U, b"a", start=[1, 2, 3]) # E: incompatible type
51
+ np.char.count(AR_S, "a", end=9) # E: incompatible type
52
+
53
+ np.char.endswith(AR_U, b"a", start=[1, 2, 3]) # E: incompatible type
54
+ np.char.endswith(AR_S, "a", end=9) # E: incompatible type
55
+ np.char.startswith(AR_U, b"a", start=[1, 2, 3]) # E: incompatible type
56
+ np.char.startswith(AR_S, "a", end=9) # E: incompatible type
57
+
58
+ np.char.find(AR_U, b"a", start=[1, 2, 3]) # E: incompatible type
59
+ np.char.find(AR_S, "a", end=9) # E: incompatible type
60
+ np.char.rfind(AR_U, b"a", start=[1, 2, 3]) # E: incompatible type
61
+ np.char.rfind(AR_S, "a", end=9) # E: incompatible type
62
+
63
+ np.char.index(AR_U, b"a", start=[1, 2, 3]) # E: incompatible type
64
+ np.char.index(AR_S, "a", end=9) # E: incompatible type
65
+ np.char.rindex(AR_U, b"a", start=[1, 2, 3]) # E: incompatible type
66
+ np.char.rindex(AR_S, "a", end=9) # E: incompatible type
67
+
68
+ np.char.isdecimal(AR_S) # E: incompatible type
69
+ np.char.isnumeric(AR_S) # E: incompatible type
valley/lib/python3.10/site-packages/numpy/typing/tests/data/fail/chararray.pyi ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import numpy as np
2
+ from typing import Any
3
+
4
+ AR_U: np.char.chararray[Any, np.dtype[np.str_]]
5
+ AR_S: np.char.chararray[Any, np.dtype[np.bytes_]]
6
+
7
+ AR_S.encode() # E: Invalid self argument
8
+ AR_U.decode() # E: Invalid self argument
9
+
10
+ AR_U.join(b"_") # E: incompatible type
11
+ AR_S.join("_") # E: incompatible type
12
+
13
+ AR_U.ljust(5, fillchar=b"a") # E: incompatible type
14
+ AR_S.ljust(5, fillchar="a") # E: incompatible type
15
+ AR_U.rjust(5, fillchar=b"a") # E: incompatible type
16
+ AR_S.rjust(5, fillchar="a") # E: incompatible type
17
+
18
+ AR_U.lstrip(chars=b"a") # E: incompatible type
19
+ AR_S.lstrip(chars="a") # E: incompatible type
20
+ AR_U.strip(chars=b"a") # E: incompatible type
21
+ AR_S.strip(chars="a") # E: incompatible type
22
+ AR_U.rstrip(chars=b"a") # E: incompatible type
23
+ AR_S.rstrip(chars="a") # E: incompatible type
24
+
25
+ AR_U.partition(b"a") # E: incompatible type
26
+ AR_S.partition("a") # E: incompatible type
27
+ AR_U.rpartition(b"a") # E: incompatible type
28
+ AR_S.rpartition("a") # E: incompatible type
29
+
30
+ AR_U.replace(b"_", b"-") # E: incompatible type
31
+ AR_S.replace("_", "-") # E: incompatible type
32
+
33
+ AR_U.split(b"_") # E: incompatible type
34
+ AR_S.split("_") # E: incompatible type
35
+ AR_S.split(1) # E: incompatible type
36
+ AR_U.rsplit(b"_") # E: incompatible type
37
+ AR_S.rsplit("_") # E: incompatible type
38
+
39
+ AR_U.count(b"a", start=[1, 2, 3]) # E: incompatible type
40
+ AR_S.count("a", end=9) # E: incompatible type
41
+
42
+ AR_U.endswith(b"a", start=[1, 2, 3]) # E: incompatible type
43
+ AR_S.endswith("a", end=9) # E: incompatible type
44
+ AR_U.startswith(b"a", start=[1, 2, 3]) # E: incompatible type
45
+ AR_S.startswith("a", end=9) # E: incompatible type
46
+
47
+ AR_U.find(b"a", start=[1, 2, 3]) # E: incompatible type
48
+ AR_S.find("a", end=9) # E: incompatible type
49
+ AR_U.rfind(b"a", start=[1, 2, 3]) # E: incompatible type
50
+ AR_S.rfind("a", end=9) # E: incompatible type
51
+
52
+ AR_U.index(b"a", start=[1, 2, 3]) # E: incompatible type
53
+ AR_S.index("a", end=9) # E: incompatible type
54
+ AR_U.rindex(b"a", start=[1, 2, 3]) # E: incompatible type
55
+ AR_S.rindex("a", end=9) # E: incompatible type
56
+
57
+ AR_U == AR_S # E: Unsupported operand types
58
+ AR_U != AR_S # E: Unsupported operand types
59
+ AR_U >= AR_S # E: Unsupported operand types
60
+ AR_U <= AR_S # E: Unsupported operand types
61
+ AR_U > AR_S # E: Unsupported operand types
62
+ AR_U < AR_S # E: Unsupported operand types
valley/lib/python3.10/site-packages/numpy/typing/tests/data/fail/comparisons.pyi ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import numpy as np
2
+ import numpy.typing as npt
3
+
4
+ AR_i: npt.NDArray[np.int64]
5
+ AR_f: npt.NDArray[np.float64]
6
+ AR_c: npt.NDArray[np.complex128]
7
+ AR_m: npt.NDArray[np.timedelta64]
8
+ AR_M: npt.NDArray[np.datetime64]
9
+
10
+ AR_f > AR_m # E: Unsupported operand types
11
+ AR_c > AR_m # E: Unsupported operand types
12
+
13
+ AR_m > AR_f # E: Unsupported operand types
14
+ AR_m > AR_c # E: Unsupported operand types
15
+
16
+ AR_i > AR_M # E: Unsupported operand types
17
+ AR_f > AR_M # E: Unsupported operand types
18
+ AR_m > AR_M # E: Unsupported operand types
19
+
20
+ AR_M > AR_i # E: Unsupported operand types
21
+ AR_M > AR_f # E: Unsupported operand types
22
+ AR_M > AR_m # E: Unsupported operand types
23
+
24
+ AR_i > str() # E: No overload variant
25
+ AR_i > bytes() # E: No overload variant
26
+ str() > AR_M # E: Unsupported operand types
27
+ bytes() > AR_M # E: Unsupported operand types
valley/lib/python3.10/site-packages/numpy/typing/tests/data/fail/constants.pyi ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ import numpy as np
2
+
3
+ np.little_endian = np.little_endian # E: Cannot assign to final
valley/lib/python3.10/site-packages/numpy/typing/tests/data/fail/datasource.pyi ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from pathlib import Path
2
+ import numpy as np
3
+
4
+ path: Path
5
+ d1: np.lib.npyio.DataSource
6
+
7
+ d1.abspath(path) # E: incompatible type
8
+ d1.abspath(b"...") # E: incompatible type
9
+
10
+ d1.exists(path) # E: incompatible type
11
+ d1.exists(b"...") # E: incompatible type
12
+
13
+ d1.open(path, "r") # E: incompatible type
14
+ d1.open(b"...", encoding="utf8") # E: incompatible type
15
+ d1.open(None, newline="/n") # E: incompatible type
valley/lib/python3.10/site-packages/numpy/typing/tests/data/fail/dtype.pyi ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import numpy as np
2
+
3
+
4
+ class Test1:
5
+ not_dtype = np.dtype(float)
6
+
7
+
8
+ class Test2:
9
+ dtype = float
10
+
11
+
12
+ np.dtype(Test1()) # E: No overload variant of "dtype" matches
13
+ np.dtype(Test2()) # E: incompatible type
14
+
15
+ np.dtype( # E: No overload variant of "dtype" matches
16
+ {
17
+ "field1": (float, 1),
18
+ "field2": (int, 3),
19
+ }
20
+ )
valley/lib/python3.10/site-packages/numpy/typing/tests/data/fail/einsumfunc.pyi ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import numpy as np
2
+ import numpy.typing as npt
3
+
4
+ AR_i: npt.NDArray[np.int64]
5
+ AR_f: npt.NDArray[np.float64]
6
+ AR_m: npt.NDArray[np.timedelta64]
7
+ AR_U: npt.NDArray[np.str_]
8
+
9
+ np.einsum("i,i->i", AR_i, AR_m) # E: incompatible type
10
+ np.einsum("i,i->i", AR_f, AR_f, dtype=np.int32) # E: incompatible type
11
+ np.einsum("i,i->i", AR_i, AR_i, out=AR_U) # E: Value of type variable "_ArrayType" of "einsum" cannot be
12
+ np.einsum("i,i->i", AR_i, AR_i, out=AR_U, casting="unsafe") # E: No overload variant
valley/lib/python3.10/site-packages/numpy/typing/tests/data/fail/false_positives.pyi ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import numpy as np
2
+ import numpy.typing as npt
3
+
4
+ AR_f8: npt.NDArray[np.float64]
5
+
6
+ # NOTE: Mypy bug presumably due to the special-casing of heterogeneous tuples;
7
+ # xref numpy/numpy#20901
8
+ #
9
+ # The expected output should be no different than, e.g., when using a
10
+ # list instead of a tuple
11
+ np.concatenate(([1], AR_f8)) # E: Argument 1 to "concatenate" has incompatible type
valley/lib/python3.10/site-packages/numpy/typing/tests/data/fail/flatiter.pyi ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from typing import Any
2
+
3
+ import numpy as np
4
+ import numpy._typing as npt
5
+
6
+
7
+ class Index:
8
+ def __index__(self) -> int:
9
+ ...
10
+
11
+
12
+ a: np.flatiter[npt.NDArray[np.float64]]
13
+ supports_array: npt._SupportsArray[np.dtype[np.float64]]
14
+
15
+ a.base = Any # E: Property "base" defined in "flatiter" is read-only
16
+ a.coords = Any # E: Property "coords" defined in "flatiter" is read-only
17
+ a.index = Any # E: Property "index" defined in "flatiter" is read-only
18
+ a.copy(order='C') # E: Unexpected keyword argument
19
+
20
+ # NOTE: Contrary to `ndarray.__getitem__` its counterpart in `flatiter`
21
+ # does not accept objects with the `__array__` or `__index__` protocols;
22
+ # boolean indexing is just plain broken (gh-17175)
23
+ a[np.bool()] # E: No overload variant of "__getitem__"
24
+ a[Index()] # E: No overload variant of "__getitem__"
25
+ a[supports_array] # E: No overload variant of "__getitem__"
valley/lib/python3.10/site-packages/numpy/typing/tests/data/fail/fromnumeric.pyi ADDED
@@ -0,0 +1,161 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Tests for :mod:`numpy._core.fromnumeric`."""
2
+
3
+ import numpy as np
4
+ import numpy.typing as npt
5
+
6
+ A = np.array(True, ndmin=2, dtype=bool)
7
+ A.setflags(write=False)
8
+ AR_U: npt.NDArray[np.str_]
9
+
10
+ a = np.bool(True)
11
+
12
+ np.take(a, None) # E: No overload variant
13
+ np.take(a, axis=1.0) # E: No overload variant
14
+ np.take(A, out=1) # E: No overload variant
15
+ np.take(A, mode="bob") # E: No overload variant
16
+
17
+ np.reshape(a, None) # E: No overload variant
18
+ np.reshape(A, 1, order="bob") # E: No overload variant
19
+
20
+ np.choose(a, None) # E: No overload variant
21
+ np.choose(a, out=1.0) # E: No overload variant
22
+ np.choose(A, mode="bob") # E: No overload variant
23
+
24
+ np.repeat(a, None) # E: No overload variant
25
+ np.repeat(A, 1, axis=1.0) # E: No overload variant
26
+
27
+ np.swapaxes(A, None, 1) # E: No overload variant
28
+ np.swapaxes(A, 1, [0]) # E: No overload variant
29
+
30
+ np.transpose(A, axes=1.0) # E: No overload variant
31
+
32
+ np.partition(a, None) # E: No overload variant
33
+ np.partition( # E: No overload variant
34
+ a, 0, axis="bob"
35
+ )
36
+ np.partition( # E: No overload variant
37
+ A, 0, kind="bob"
38
+ )
39
+ np.partition(
40
+ A, 0, order=range(5) # E: Argument "order" to "partition" has incompatible type
41
+ )
42
+
43
+ np.argpartition(
44
+ a, None # E: incompatible type
45
+ )
46
+ np.argpartition(
47
+ a, 0, axis="bob" # E: incompatible type
48
+ )
49
+ np.argpartition(
50
+ A, 0, kind="bob" # E: incompatible type
51
+ )
52
+ np.argpartition(
53
+ A, 0, order=range(5) # E: Argument "order" to "argpartition" has incompatible type
54
+ )
55
+
56
+ np.sort(A, axis="bob") # E: No overload variant
57
+ np.sort(A, kind="bob") # E: No overload variant
58
+ np.sort(A, order=range(5)) # E: Argument "order" to "sort" has incompatible type
59
+
60
+ np.argsort(A, axis="bob") # E: Argument "axis" to "argsort" has incompatible type
61
+ np.argsort(A, kind="bob") # E: Argument "kind" to "argsort" has incompatible type
62
+ np.argsort(A, order=range(5)) # E: Argument "order" to "argsort" has incompatible type
63
+
64
+ np.argmax(A, axis="bob") # E: No overload variant of "argmax" matches argument type
65
+ np.argmax(A, kind="bob") # E: No overload variant of "argmax" matches argument type
66
+
67
+ np.argmin(A, axis="bob") # E: No overload variant of "argmin" matches argument type
68
+ np.argmin(A, kind="bob") # E: No overload variant of "argmin" matches argument type
69
+
70
+ np.searchsorted( # E: No overload variant of "searchsorted" matches argument type
71
+ A[0], 0, side="bob"
72
+ )
73
+ np.searchsorted( # E: No overload variant of "searchsorted" matches argument type
74
+ A[0], 0, sorter=1.0
75
+ )
76
+
77
+ np.resize(A, 1.0) # E: No overload variant
78
+
79
+ np.squeeze(A, 1.0) # E: No overload variant of "squeeze" matches argument type
80
+
81
+ np.diagonal(A, offset=None) # E: No overload variant
82
+ np.diagonal(A, axis1="bob") # E: No overload variant
83
+ np.diagonal(A, axis2=[]) # E: No overload variant
84
+
85
+ np.trace(A, offset=None) # E: No overload variant
86
+ np.trace(A, axis1="bob") # E: No overload variant
87
+ np.trace(A, axis2=[]) # E: No overload variant
88
+
89
+ np.ravel(a, order="bob") # E: No overload variant
90
+
91
+ np.compress( # E: No overload variant
92
+ [True], A, axis=1.0
93
+ )
94
+
95
+ np.clip(a, 1, 2, out=1) # E: No overload variant of "clip" matches argument type
96
+
97
+ np.sum(a, axis=1.0) # E: No overload variant
98
+ np.sum(a, keepdims=1.0) # E: No overload variant
99
+ np.sum(a, initial=[1]) # E: No overload variant
100
+
101
+ np.all(a, axis=1.0) # E: No overload variant
102
+ np.all(a, keepdims=1.0) # E: No overload variant
103
+ np.all(a, out=1.0) # E: No overload variant
104
+
105
+ np.any(a, axis=1.0) # E: No overload variant
106
+ np.any(a, keepdims=1.0) # E: No overload variant
107
+ np.any(a, out=1.0) # E: No overload variant
108
+
109
+ np.cumsum(a, axis=1.0) # E: No overload variant
110
+ np.cumsum(a, dtype=1.0) # E: No overload variant
111
+ np.cumsum(a, out=1.0) # E: No overload variant
112
+
113
+ np.ptp(a, axis=1.0) # E: No overload variant
114
+ np.ptp(a, keepdims=1.0) # E: No overload variant
115
+ np.ptp(a, out=1.0) # E: No overload variant
116
+
117
+ np.amax(a, axis=1.0) # E: No overload variant
118
+ np.amax(a, keepdims=1.0) # E: No overload variant
119
+ np.amax(a, out=1.0) # E: No overload variant
120
+ np.amax(a, initial=[1.0]) # E: No overload variant
121
+ np.amax(a, where=[1.0]) # E: incompatible type
122
+
123
+ np.amin(a, axis=1.0) # E: No overload variant
124
+ np.amin(a, keepdims=1.0) # E: No overload variant
125
+ np.amin(a, out=1.0) # E: No overload variant
126
+ np.amin(a, initial=[1.0]) # E: No overload variant
127
+ np.amin(a, where=[1.0]) # E: incompatible type
128
+
129
+ np.prod(a, axis=1.0) # E: No overload variant
130
+ np.prod(a, out=False) # E: No overload variant
131
+ np.prod(a, keepdims=1.0) # E: No overload variant
132
+ np.prod(a, initial=int) # E: No overload variant
133
+ np.prod(a, where=1.0) # E: No overload variant
134
+ np.prod(AR_U) # E: incompatible type
135
+
136
+ np.cumprod(a, axis=1.0) # E: No overload variant
137
+ np.cumprod(a, out=False) # E: No overload variant
138
+ np.cumprod(AR_U) # E: incompatible type
139
+
140
+ np.size(a, axis=1.0) # E: Argument "axis" to "size" has incompatible type
141
+
142
+ np.around(a, decimals=1.0) # E: No overload variant
143
+ np.around(a, out=type) # E: No overload variant
144
+ np.around(AR_U) # E: incompatible type
145
+
146
+ np.mean(a, axis=1.0) # E: No overload variant
147
+ np.mean(a, out=False) # E: No overload variant
148
+ np.mean(a, keepdims=1.0) # E: No overload variant
149
+ np.mean(AR_U) # E: incompatible type
150
+
151
+ np.std(a, axis=1.0) # E: No overload variant
152
+ np.std(a, out=False) # E: No overload variant
153
+ np.std(a, ddof='test') # E: No overload variant
154
+ np.std(a, keepdims=1.0) # E: No overload variant
155
+ np.std(AR_U) # E: incompatible type
156
+
157
+ np.var(a, axis=1.0) # E: No overload variant
158
+ np.var(a, out=False) # E: No overload variant
159
+ np.var(a, ddof='test') # E: No overload variant
160
+ np.var(a, keepdims=1.0) # E: No overload variant
161
+ np.var(AR_U) # E: incompatible type
valley/lib/python3.10/site-packages/numpy/typing/tests/data/fail/histograms.pyi ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import numpy as np
2
+ import numpy.typing as npt
3
+
4
+ AR_i8: npt.NDArray[np.int64]
5
+ AR_f8: npt.NDArray[np.float64]
6
+
7
+ np.histogram_bin_edges(AR_i8, range=(0, 1, 2)) # E: incompatible type
8
+
9
+ np.histogram(AR_i8, range=(0, 1, 2)) # E: incompatible type
10
+
11
+ np.histogramdd(AR_i8, range=(0, 1)) # E: incompatible type
12
+ np.histogramdd(AR_i8, range=[(0, 1, 2)]) # E: incompatible type
valley/lib/python3.10/site-packages/numpy/typing/tests/data/fail/index_tricks.pyi ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import numpy as np
2
+
3
+ AR_LIKE_i: list[int]
4
+ AR_LIKE_f: list[float]
5
+
6
+ np.ndindex([1, 2, 3]) # E: No overload variant
7
+ np.unravel_index(AR_LIKE_f, (1, 2, 3)) # E: incompatible type
8
+ np.ravel_multi_index(AR_LIKE_i, (1, 2, 3), mode="bob") # E: No overload variant
9
+ np.mgrid[1] # E: Invalid index type
10
+ np.mgrid[...] # E: Invalid index type
11
+ np.ogrid[1] # E: Invalid index type
12
+ np.ogrid[...] # E: Invalid index type
13
+ np.fill_diagonal(AR_LIKE_f, 2) # E: incompatible type
14
+ np.diag_indices(1.0) # E: incompatible type
valley/lib/python3.10/site-packages/numpy/typing/tests/data/fail/lib_function_base.pyi ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from typing import Any
2
+
3
+ import numpy as np
4
+ import numpy.typing as npt
5
+
6
+ AR_f8: npt.NDArray[np.float64]
7
+ AR_c16: npt.NDArray[np.complex128]
8
+ AR_m: npt.NDArray[np.timedelta64]
9
+ AR_M: npt.NDArray[np.datetime64]
10
+ AR_O: npt.NDArray[np.object_]
11
+
12
+ def func(a: int) -> None: ...
13
+
14
+ np.average(AR_m) # E: incompatible type
15
+ np.select(1, [AR_f8]) # E: incompatible type
16
+ np.angle(AR_m) # E: incompatible type
17
+ np.unwrap(AR_m) # E: incompatible type
18
+ np.unwrap(AR_c16) # E: incompatible type
19
+ np.trim_zeros(1) # E: incompatible type
20
+ np.place(1, [True], 1.5) # E: incompatible type
21
+ np.vectorize(1) # E: incompatible type
22
+ np.place(AR_f8, slice(None), 5) # E: incompatible type
23
+
24
+ np.interp(AR_f8, AR_c16, AR_f8) # E: incompatible type
25
+ np.interp(AR_c16, AR_f8, AR_f8) # E: incompatible type
26
+ np.interp(AR_f8, AR_f8, AR_f8, period=AR_c16) # E: No overload variant
27
+ np.interp(AR_f8, AR_f8, AR_O) # E: incompatible type
28
+
29
+ np.cov(AR_m) # E: incompatible type
30
+ np.cov(AR_O) # E: incompatible type
31
+ np.corrcoef(AR_m) # E: incompatible type
32
+ np.corrcoef(AR_O) # E: incompatible type
33
+ np.corrcoef(AR_f8, bias=True) # E: No overload variant
34
+ np.corrcoef(AR_f8, ddof=2) # E: No overload variant
35
+ np.blackman(1j) # E: incompatible type
36
+ np.bartlett(1j) # E: incompatible type
37
+ np.hanning(1j) # E: incompatible type
38
+ np.hamming(1j) # E: incompatible type
39
+ np.hamming(AR_c16) # E: incompatible type
40
+ np.kaiser(1j, 1) # E: incompatible type
41
+ np.sinc(AR_O) # E: incompatible type
42
+ np.median(AR_M) # E: incompatible type
43
+
44
+ np.percentile(AR_f8, 50j) # E: No overload variant
45
+ np.percentile(AR_f8, 50, interpolation="bob") # E: No overload variant
46
+ np.quantile(AR_f8, 0.5j) # E: No overload variant
47
+ np.quantile(AR_f8, 0.5, interpolation="bob") # E: No overload variant
48
+ np.meshgrid(AR_f8, AR_f8, indexing="bob") # E: incompatible type
49
+ np.delete(AR_f8, AR_f8) # E: incompatible type
50
+ np.insert(AR_f8, AR_f8, 1.5) # E: incompatible type
51
+ np.digitize(AR_f8, 1j) # E: No overload variant
valley/lib/python3.10/site-packages/numpy/typing/tests/data/fail/lib_polynomial.pyi ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import numpy as np
2
+ import numpy.typing as npt
3
+
4
+ AR_f8: npt.NDArray[np.float64]
5
+ AR_c16: npt.NDArray[np.complex128]
6
+ AR_O: npt.NDArray[np.object_]
7
+ AR_U: npt.NDArray[np.str_]
8
+
9
+ poly_obj: np.poly1d
10
+
11
+ np.polymul(AR_f8, AR_U) # E: incompatible type
12
+ np.polydiv(AR_f8, AR_U) # E: incompatible type
13
+
14
+ 5**poly_obj # E: No overload variant
15
+
16
+ np.polyint(AR_U) # E: incompatible type
17
+ np.polyint(AR_f8, m=1j) # E: No overload variant
18
+
19
+ np.polyder(AR_U) # E: incompatible type
20
+ np.polyder(AR_f8, m=1j) # E: No overload variant
21
+
22
+ np.polyfit(AR_O, AR_f8, 1) # E: incompatible type
23
+ np.polyfit(AR_f8, AR_f8, 1, rcond=1j) # E: No overload variant
24
+ np.polyfit(AR_f8, AR_f8, 1, w=AR_c16) # E: incompatible type
25
+ np.polyfit(AR_f8, AR_f8, 1, cov="bob") # E: No overload variant
26
+
27
+ np.polyval(AR_f8, AR_U) # E: incompatible type
28
+ np.polyadd(AR_f8, AR_U) # E: incompatible type
29
+ np.polysub(AR_f8, AR_U) # E: incompatible type
valley/lib/python3.10/site-packages/numpy/typing/tests/data/fail/lib_utils.pyi ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ import numpy.lib.array_utils as array_utils
2
+
3
+ array_utils.byte_bounds(1) # E: incompatible type
valley/lib/python3.10/site-packages/numpy/typing/tests/data/fail/lib_version.pyi ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ from numpy.lib import NumpyVersion
2
+
3
+ version: NumpyVersion
4
+
5
+ NumpyVersion(b"1.8.0") # E: incompatible type
6
+ version >= b"1.8.0" # E: Unsupported operand types
valley/lib/python3.10/site-packages/numpy/typing/tests/data/fail/linalg.pyi ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import numpy as np
2
+ import numpy.typing as npt
3
+
4
+ AR_f8: npt.NDArray[np.float64]
5
+ AR_O: npt.NDArray[np.object_]
6
+ AR_M: npt.NDArray[np.datetime64]
7
+
8
+ np.linalg.tensorsolve(AR_O, AR_O) # E: incompatible type
9
+
10
+ np.linalg.solve(AR_O, AR_O) # E: incompatible type
11
+
12
+ np.linalg.tensorinv(AR_O) # E: incompatible type
13
+
14
+ np.linalg.inv(AR_O) # E: incompatible type
15
+
16
+ np.linalg.matrix_power(AR_M, 5) # E: incompatible type
17
+
18
+ np.linalg.cholesky(AR_O) # E: incompatible type
19
+
20
+ np.linalg.qr(AR_O) # E: incompatible type
21
+ np.linalg.qr(AR_f8, mode="bob") # E: No overload variant
22
+
23
+ np.linalg.eigvals(AR_O) # E: incompatible type
24
+
25
+ np.linalg.eigvalsh(AR_O) # E: incompatible type
26
+ np.linalg.eigvalsh(AR_O, UPLO="bob") # E: No overload variant
27
+
28
+ np.linalg.eig(AR_O) # E: incompatible type
29
+
30
+ np.linalg.eigh(AR_O) # E: incompatible type
31
+ np.linalg.eigh(AR_O, UPLO="bob") # E: No overload variant
32
+
33
+ np.linalg.svd(AR_O) # E: incompatible type
34
+
35
+ np.linalg.cond(AR_O) # E: incompatible type
36
+ np.linalg.cond(AR_f8, p="bob") # E: incompatible type
37
+
38
+ np.linalg.matrix_rank(AR_O) # E: incompatible type
39
+
40
+ np.linalg.pinv(AR_O) # E: incompatible type
41
+
42
+ np.linalg.slogdet(AR_O) # E: incompatible type
43
+
44
+ np.linalg.det(AR_O) # E: incompatible type
45
+
46
+ np.linalg.norm(AR_f8, ord="bob") # E: No overload variant
47
+
48
+ np.linalg.multi_dot([AR_M]) # E: incompatible type
valley/lib/python3.10/site-packages/numpy/typing/tests/data/fail/memmap.pyi ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ import numpy as np
2
+
3
+ with open("file.txt", "r") as f:
4
+ np.memmap(f) # E: No overload variant
5
+ np.memmap("test.txt", shape=[10, 5]) # E: No overload variant
valley/lib/python3.10/site-packages/numpy/typing/tests/data/fail/modules.pyi ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import numpy as np
2
+
3
+ np.testing.bob # E: Module has no attribute
4
+ np.bob # E: Module has no attribute
5
+
6
+ # Stdlib modules in the namespace by accident
7
+ np.warnings # E: Module has no attribute
8
+ np.sys # E: Module has no attribute
9
+ np.os # E: Module "numpy" does not explicitly export
10
+ np.math # E: Module has no attribute
11
+
12
+ # Public sub-modules that are not imported to their parent module by default;
13
+ # e.g. one must first execute `import numpy.lib.recfunctions`
14
+ np.lib.recfunctions # E: Module has no attribute
15
+
16
+ np.__NUMPY_SETUP__ # E: Module has no attribute
17
+ np.__deprecated_attrs__ # E: Module has no attribute
18
+ np.__expired_functions__ # E: Module has no attribute
valley/lib/python3.10/site-packages/numpy/typing/tests/data/fail/multiarray.pyi ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import numpy as np
2
+ import numpy.typing as npt
3
+
4
+ i8: np.int64
5
+
6
+ AR_b: npt.NDArray[np.bool]
7
+ AR_u1: npt.NDArray[np.uint8]
8
+ AR_i8: npt.NDArray[np.int64]
9
+ AR_f8: npt.NDArray[np.float64]
10
+ AR_M: npt.NDArray[np.datetime64]
11
+
12
+ M: np.datetime64
13
+
14
+ AR_LIKE_f: list[float]
15
+
16
+ def func(a: int) -> None: ...
17
+
18
+ np.where(AR_b, 1) # E: No overload variant
19
+
20
+ np.can_cast(AR_f8, 1) # E: incompatible type
21
+
22
+ np.vdot(AR_M, AR_M) # E: incompatible type
23
+
24
+ np.copyto(AR_LIKE_f, AR_f8) # E: incompatible type
25
+
26
+ np.putmask(AR_LIKE_f, [True, True, False], 1.5) # E: incompatible type
27
+
28
+ np.packbits(AR_f8) # E: incompatible type
29
+ np.packbits(AR_u1, bitorder=">") # E: incompatible type
30
+
31
+ np.unpackbits(AR_i8) # E: incompatible type
32
+ np.unpackbits(AR_u1, bitorder=">") # E: incompatible type
33
+
34
+ np.shares_memory(1, 1, max_work=i8) # E: incompatible type
35
+ np.may_share_memory(1, 1, max_work=i8) # E: incompatible type
36
+
37
+ np.arange(M) # E: No overload variant
38
+ np.arange(stop=10) # E: No overload variant
39
+
40
+ np.datetime_data(int) # E: incompatible type
41
+
42
+ np.busday_offset("2012", 10) # E: No overload variant
43
+
44
+ np.datetime_as_string("2012") # E: No overload variant
45
+
46
+ np.char.compare_chararrays("a", b"a", "==", False) # E: No overload variant
47
+
48
+ np.nested_iters([AR_i8, AR_i8]) # E: Missing positional argument
49
+ np.nested_iters([AR_i8, AR_i8], 0) # E: incompatible type
50
+ np.nested_iters([AR_i8, AR_i8], [0]) # E: incompatible type
51
+ np.nested_iters([AR_i8, AR_i8], [[0], [1]], flags=["test"]) # E: incompatible type
52
+ np.nested_iters([AR_i8, AR_i8], [[0], [1]], op_flags=[["test"]]) # E: incompatible type
53
+ np.nested_iters([AR_i8, AR_i8], [[0], [1]], buffersize=1.0) # E: incompatible type
valley/lib/python3.10/site-packages/numpy/typing/tests/data/fail/ndarray.pyi ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import numpy as np
2
+
3
+ # Ban setting dtype since mutating the type of the array in place
4
+ # makes having ndarray be generic over dtype impossible. Generally
5
+ # users should use `ndarray.view` in this situation anyway. See
6
+ #
7
+ # https://github.com/numpy/numpy-stubs/issues/7
8
+ #
9
+ # for more context.
10
+ float_array = np.array([1.0])
11
+ float_array.dtype = np.bool # E: Property "dtype" defined in "ndarray" is read-only
valley/lib/python3.10/site-packages/numpy/typing/tests/data/fail/ndarray_misc.pyi ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ Tests for miscellaneous (non-magic) ``np.ndarray``/``np.generic`` methods.
3
+
4
+ More extensive tests are performed for the methods'
5
+ function-based counterpart in `../from_numeric.py`.
6
+
7
+ """
8
+
9
+ import numpy as np
10
+ import numpy.typing as npt
11
+
12
+ f8: np.float64
13
+ AR_f8: npt.NDArray[np.float64]
14
+ AR_M: npt.NDArray[np.datetime64]
15
+ AR_b: npt.NDArray[np.bool]
16
+
17
+ ctypes_obj = AR_f8.ctypes
18
+
19
+ reveal_type(ctypes_obj.get_data()) # E: has no attribute
20
+ reveal_type(ctypes_obj.get_shape()) # E: has no attribute
21
+ reveal_type(ctypes_obj.get_strides()) # E: has no attribute
22
+ reveal_type(ctypes_obj.get_as_parameter()) # E: has no attribute
23
+
24
+ f8.argpartition(0) # E: has no attribute
25
+ f8.diagonal() # E: has no attribute
26
+ f8.dot(1) # E: has no attribute
27
+ f8.nonzero() # E: has no attribute
28
+ f8.partition(0) # E: has no attribute
29
+ f8.put(0, 2) # E: has no attribute
30
+ f8.setfield(2, np.float64) # E: has no attribute
31
+ f8.sort() # E: has no attribute
32
+ f8.trace() # E: has no attribute
33
+
34
+ AR_M.__int__() # E: Invalid self argument
35
+ AR_M.__float__() # E: Invalid self argument
36
+ AR_M.__complex__() # E: Invalid self argument
37
+ AR_b.__index__() # E: Invalid self argument
38
+
39
+ AR_f8[1.5] # E: No overload variant
40
+ AR_f8["field_a"] # E: No overload variant
41
+ AR_f8[["field_a", "field_b"]] # E: Invalid index type
42
+
43
+ AR_f8.__array_finalize__(object()) # E: incompatible type
valley/lib/python3.10/site-packages/numpy/typing/tests/data/fail/nditer.pyi ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ import numpy as np
2
+
3
+ class Test(np.nditer): ... # E: Cannot inherit from final class
4
+
5
+ np.nditer([0, 1], flags=["test"]) # E: incompatible type
6
+ np.nditer([0, 1], op_flags=[["test"]]) # E: incompatible type
7
+ np.nditer([0, 1], itershape=(1.0,)) # E: incompatible type
8
+ np.nditer([0, 1], buffersize=1.0) # E: incompatible type
valley/lib/python3.10/site-packages/numpy/typing/tests/data/fail/nested_sequence.pyi ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from collections.abc import Sequence
2
+ from numpy._typing import _NestedSequence
3
+
4
+ a: Sequence[float]
5
+ b: list[complex]
6
+ c: tuple[str, ...]
7
+ d: int
8
+ e: str
9
+
10
+ def func(a: _NestedSequence[int]) -> None:
11
+ ...
12
+
13
+ reveal_type(func(a)) # E: incompatible type
14
+ reveal_type(func(b)) # E: incompatible type
15
+ reveal_type(func(c)) # E: incompatible type
16
+ reveal_type(func(d)) # E: incompatible type
17
+ reveal_type(func(e)) # E: incompatible type
valley/lib/python3.10/site-packages/numpy/typing/tests/data/fail/npyio.pyi ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import pathlib
2
+ from typing import IO
3
+
4
+ import numpy.typing as npt
5
+ import numpy as np
6
+
7
+ str_path: str
8
+ bytes_path: bytes
9
+ pathlib_path: pathlib.Path
10
+ str_file: IO[str]
11
+ AR_i8: npt.NDArray[np.int64]
12
+
13
+ np.load(str_file) # E: incompatible type
14
+
15
+ np.save(bytes_path, AR_i8) # E: incompatible type
16
+
17
+ np.savez(bytes_path, AR_i8) # E: incompatible type
18
+
19
+ np.savez_compressed(bytes_path, AR_i8) # E: incompatible type
20
+
21
+ np.loadtxt(bytes_path) # E: incompatible type
22
+
23
+ np.fromregex(bytes_path, ".", np.int64) # E: No overload variant
valley/lib/python3.10/site-packages/numpy/typing/tests/data/fail/numerictypes.pyi ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ import numpy as np
2
+
3
+ np.isdtype(1, np.int64) # E: incompatible type
4
+
5
+ np.issubdtype(1, np.int64) # E: incompatible type
valley/lib/python3.10/site-packages/numpy/typing/tests/data/fail/random.pyi ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import numpy as np
2
+ import numpy.typing as npt
3
+
4
+ SEED_FLOAT: float = 457.3
5
+ SEED_ARR_FLOAT: npt.NDArray[np.float64] = np.array([1.0, 2, 3, 4])
6
+ SEED_ARRLIKE_FLOAT: list[float] = [1.0, 2.0, 3.0, 4.0]
7
+ SEED_SEED_SEQ: np.random.SeedSequence = np.random.SeedSequence(0)
8
+ SEED_STR: str = "String seeding not allowed"
9
+
10
+ # default rng
11
+ np.random.default_rng(SEED_FLOAT) # E: incompatible type
12
+ np.random.default_rng(SEED_ARR_FLOAT) # E: incompatible type
13
+ np.random.default_rng(SEED_ARRLIKE_FLOAT) # E: incompatible type
14
+ np.random.default_rng(SEED_STR) # E: incompatible type
15
+
16
+ # Seed Sequence
17
+ np.random.SeedSequence(SEED_FLOAT) # E: incompatible type
18
+ np.random.SeedSequence(SEED_ARR_FLOAT) # E: incompatible type
19
+ np.random.SeedSequence(SEED_ARRLIKE_FLOAT) # E: incompatible type
20
+ np.random.SeedSequence(SEED_SEED_SEQ) # E: incompatible type
21
+ np.random.SeedSequence(SEED_STR) # E: incompatible type
22
+
23
+ seed_seq: np.random.bit_generator.SeedSequence = np.random.SeedSequence()
24
+ seed_seq.spawn(11.5) # E: incompatible type
25
+ seed_seq.generate_state(3.14) # E: incompatible type
26
+ seed_seq.generate_state(3, np.uint8) # E: incompatible type
27
+ seed_seq.generate_state(3, "uint8") # E: incompatible type
28
+ seed_seq.generate_state(3, "u1") # E: incompatible type
29
+ seed_seq.generate_state(3, np.uint16) # E: incompatible type
30
+ seed_seq.generate_state(3, "uint16") # E: incompatible type
31
+ seed_seq.generate_state(3, "u2") # E: incompatible type
32
+ seed_seq.generate_state(3, np.int32) # E: incompatible type
33
+ seed_seq.generate_state(3, "int32") # E: incompatible type
34
+ seed_seq.generate_state(3, "i4") # E: incompatible type
35
+
36
+ # Bit Generators
37
+ np.random.MT19937(SEED_FLOAT) # E: incompatible type
38
+ np.random.MT19937(SEED_ARR_FLOAT) # E: incompatible type
39
+ np.random.MT19937(SEED_ARRLIKE_FLOAT) # E: incompatible type
40
+ np.random.MT19937(SEED_STR) # E: incompatible type
41
+
42
+ np.random.PCG64(SEED_FLOAT) # E: incompatible type
43
+ np.random.PCG64(SEED_ARR_FLOAT) # E: incompatible type
44
+ np.random.PCG64(SEED_ARRLIKE_FLOAT) # E: incompatible type
45
+ np.random.PCG64(SEED_STR) # E: incompatible type
46
+
47
+ np.random.Philox(SEED_FLOAT) # E: incompatible type
48
+ np.random.Philox(SEED_ARR_FLOAT) # E: incompatible type
49
+ np.random.Philox(SEED_ARRLIKE_FLOAT) # E: incompatible type
50
+ np.random.Philox(SEED_STR) # E: incompatible type
51
+
52
+ np.random.SFC64(SEED_FLOAT) # E: incompatible type
53
+ np.random.SFC64(SEED_ARR_FLOAT) # E: incompatible type
54
+ np.random.SFC64(SEED_ARRLIKE_FLOAT) # E: incompatible type
55
+ np.random.SFC64(SEED_STR) # E: incompatible type
56
+
57
+ # Generator
58
+ np.random.Generator(None) # E: incompatible type
59
+ np.random.Generator(12333283902830213) # E: incompatible type
60
+ np.random.Generator("OxFEEDF00D") # E: incompatible type
61
+ np.random.Generator([123, 234]) # E: incompatible type
62
+ np.random.Generator(np.array([123, 234], dtype="u4")) # E: incompatible type
valley/lib/python3.10/site-packages/numpy/typing/tests/data/fail/rec.pyi ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import numpy as np
2
+ import numpy.typing as npt
3
+
4
+ AR_i8: npt.NDArray[np.int64]
5
+
6
+ np.rec.fromarrays(1) # E: No overload variant
7
+ np.rec.fromarrays([1, 2, 3], dtype=[("f8", "f8")], formats=["f8", "f8"]) # E: No overload variant
8
+
9
+ np.rec.fromrecords(AR_i8) # E: incompatible type
10
+ np.rec.fromrecords([(1.5,)], dtype=[("f8", "f8")], formats=["f8", "f8"]) # E: No overload variant
11
+
12
+ np.rec.fromstring("string", dtype=[("f8", "f8")]) # E: No overload variant
13
+ np.rec.fromstring(b"bytes") # E: No overload variant
14
+ np.rec.fromstring(b"(1.5,)", dtype=[("f8", "f8")], formats=["f8", "f8"]) # E: No overload variant
15
+
16
+ with open("test", "r") as f:
17
+ np.rec.fromfile(f, dtype=[("f8", "f8")]) # E: No overload variant
valley/lib/python3.10/site-packages/numpy/typing/tests/data/fail/scalars.pyi ADDED
@@ -0,0 +1,92 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import sys
2
+ import numpy as np
3
+
4
+ f2: np.float16
5
+ f8: np.float64
6
+ c8: np.complex64
7
+
8
+ # Construction
9
+
10
+ np.float32(3j) # E: incompatible type
11
+
12
+ # Technically the following examples are valid NumPy code. But they
13
+ # are not considered a best practice, and people who wish to use the
14
+ # stubs should instead do
15
+ #
16
+ # np.array([1.0, 0.0, 0.0], dtype=np.float32)
17
+ # np.array([], dtype=np.complex64)
18
+ #
19
+ # See e.g. the discussion on the mailing list
20
+ #
21
+ # https://mail.python.org/pipermail/numpy-discussion/2020-April/080566.html
22
+ #
23
+ # and the issue
24
+ #
25
+ # https://github.com/numpy/numpy-stubs/issues/41
26
+ #
27
+ # for more context.
28
+ np.float32([1.0, 0.0, 0.0]) # E: incompatible type
29
+ np.complex64([]) # E: incompatible type
30
+
31
+ np.complex64(1, 2) # E: Too many arguments
32
+ # TODO: protocols (can't check for non-existent protocols w/ __getattr__)
33
+
34
+ np.datetime64(0) # E: No overload variant
35
+
36
+ class A:
37
+ def __float__(self):
38
+ return 1.0
39
+
40
+
41
+ np.int8(A()) # E: incompatible type
42
+ np.int16(A()) # E: incompatible type
43
+ np.int32(A()) # E: incompatible type
44
+ np.int64(A()) # E: incompatible type
45
+ np.uint8(A()) # E: incompatible type
46
+ np.uint16(A()) # E: incompatible type
47
+ np.uint32(A()) # E: incompatible type
48
+ np.uint64(A()) # E: incompatible type
49
+
50
+ np.void("test") # E: No overload variant
51
+ np.void("test", dtype=None) # E: No overload variant
52
+
53
+ np.generic(1) # E: Cannot instantiate abstract class
54
+ np.number(1) # E: Cannot instantiate abstract class
55
+ np.integer(1) # E: Cannot instantiate abstract class
56
+ np.inexact(1) # E: Cannot instantiate abstract class
57
+ np.character("test") # E: Cannot instantiate abstract class
58
+ np.flexible(b"test") # E: Cannot instantiate abstract class
59
+
60
+ np.float64(value=0.0) # E: Unexpected keyword argument
61
+ np.int64(value=0) # E: Unexpected keyword argument
62
+ np.uint64(value=0) # E: Unexpected keyword argument
63
+ np.complex128(value=0.0j) # E: Unexpected keyword argument
64
+ np.str_(value='bob') # E: No overload variant
65
+ np.bytes_(value=b'test') # E: No overload variant
66
+ np.void(value=b'test') # E: No overload variant
67
+ np.bool(value=True) # E: Unexpected keyword argument
68
+ np.datetime64(value="2019") # E: No overload variant
69
+ np.timedelta64(value=0) # E: Unexpected keyword argument
70
+
71
+ np.bytes_(b"hello", encoding='utf-8') # E: No overload variant
72
+ np.str_("hello", encoding='utf-8') # E: No overload variant
73
+
74
+ f8.item(1) # E: incompatible type
75
+ f8.item((0, 1)) # E: incompatible type
76
+ f8.squeeze(axis=1) # E: incompatible type
77
+ f8.squeeze(axis=(0, 1)) # E: incompatible type
78
+ f8.transpose(1) # E: incompatible type
79
+
80
+ def func(a: np.float32) -> None: ...
81
+
82
+ func(f2) # E: incompatible type
83
+ func(f8) # E: incompatible type
84
+
85
+ round(c8) # E: No overload variant
86
+
87
+ c8.__getnewargs__() # E: Invalid self argument
88
+ f2.__getnewargs__() # E: Invalid self argument
89
+ f2.hex() # E: Invalid self argument
90
+ np.float16.fromhex("0x0.0p+0") # E: Invalid self argument
91
+ f2.__trunc__() # E: Invalid self argument
92
+ f2.__getformat__("float") # E: Invalid self argument
valley/lib/python3.10/site-packages/numpy/typing/tests/data/fail/shape.pyi ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ from typing import Any
2
+ import numpy as np
3
+
4
+ # test bounds of _ShapeType_co
5
+
6
+ np.ndarray[tuple[str, str], Any] # E: Value of type variable
valley/lib/python3.10/site-packages/numpy/typing/tests/data/fail/shape_base.pyi ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ import numpy as np
2
+
3
+ class DTypeLike:
4
+ dtype: np.dtype[np.int_]
5
+
6
+ dtype_like: DTypeLike
7
+
8
+ np.expand_dims(dtype_like, (5, 10)) # E: No overload variant
valley/lib/python3.10/site-packages/numpy/typing/tests/data/fail/stride_tricks.pyi ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ import numpy as np
2
+ import numpy.typing as npt
3
+
4
+ AR_f8: npt.NDArray[np.float64]
5
+
6
+ np.lib.stride_tricks.as_strided(AR_f8, shape=8) # E: No overload variant
7
+ np.lib.stride_tricks.as_strided(AR_f8, strides=8) # E: No overload variant
8
+
9
+ np.lib.stride_tricks.sliding_window_view(AR_f8, axis=(1,)) # E: No overload variant
valley/lib/python3.10/site-packages/numpy/typing/tests/data/fail/strings.pyi ADDED
@@ -0,0 +1,69 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import numpy as np
2
+ import numpy.typing as npt
3
+
4
+ AR_U: npt.NDArray[np.str_]
5
+ AR_S: npt.NDArray[np.bytes_]
6
+
7
+ np.strings.equal(AR_U, AR_S) # E: incompatible type
8
+
9
+ np.strings.not_equal(AR_U, AR_S) # E: incompatible type
10
+
11
+ np.strings.greater_equal(AR_U, AR_S) # E: incompatible type
12
+
13
+ np.strings.less_equal(AR_U, AR_S) # E: incompatible type
14
+
15
+ np.strings.greater(AR_U, AR_S) # E: incompatible type
16
+
17
+ np.strings.less(AR_U, AR_S) # E: incompatible type
18
+
19
+ np.strings.encode(AR_S) # E: incompatible type
20
+ np.strings.decode(AR_U) # E: incompatible type
21
+
22
+ np.strings.join(AR_U, b"_") # E: incompatible type
23
+ np.strings.join(AR_S, "_") # E: incompatible type
24
+
25
+ np.strings.ljust(AR_U, 5, fillchar=b"a") # E: incompatible type
26
+ np.strings.ljust(AR_S, 5, fillchar="a") # E: incompatible type
27
+ np.strings.rjust(AR_U, 5, fillchar=b"a") # E: incompatible type
28
+ np.strings.rjust(AR_S, 5, fillchar="a") # E: incompatible type
29
+
30
+ np.strings.lstrip(AR_U, b"a") # E: incompatible type
31
+ np.strings.lstrip(AR_S, "a") # E: incompatible type
32
+ np.strings.strip(AR_U, b"a") # E: incompatible type
33
+ np.strings.strip(AR_S, "a") # E: incompatible type
34
+ np.strings.rstrip(AR_U, b"a") # E: incompatible type
35
+ np.strings.rstrip(AR_S, "a") # E: incompatible type
36
+
37
+ np.strings.partition(AR_U, b"a") # E: incompatible type
38
+ np.strings.partition(AR_S, "a") # E: incompatible type
39
+ np.strings.rpartition(AR_U, b"a") # E: incompatible type
40
+ np.strings.rpartition(AR_S, "a") # E: incompatible type
41
+
42
+ np.strings.split(AR_U, b"_") # E: incompatible type
43
+ np.strings.split(AR_S, "_") # E: incompatible type
44
+ np.strings.rsplit(AR_U, b"_") # E: incompatible type
45
+ np.strings.rsplit(AR_S, "_") # E: incompatible type
46
+
47
+ np.strings.count(AR_U, b"a", [1, 2, 3], [1, 2, 3]) # E: incompatible type
48
+ np.strings.count(AR_S, "a", 0, 9) # E: incompatible type
49
+
50
+ np.strings.endswith(AR_U, b"a", [1, 2, 3], [1, 2, 3]) # E: incompatible type
51
+ np.strings.endswith(AR_S, "a", 0, 9) # E: incompatible type
52
+ np.strings.startswith(AR_U, b"a", [1, 2, 3], [1, 2, 3]) # E: incompatible type
53
+ np.strings.startswith(AR_S, "a", 0, 9) # E: incompatible type
54
+
55
+ np.strings.find(AR_U, b"a", [1, 2, 3], [1, 2, 3]) # E: incompatible type
56
+ np.strings.find(AR_S, "a", 0, 9) # E: incompatible type
57
+ np.strings.rfind(AR_U, b"a", [1, 2, 3], [1, 2 , 3]) # E: incompatible type
58
+ np.strings.rfind(AR_S, "a", 0, 9) # E: incompatible type
59
+
60
+ np.strings.index(AR_U, b"a", start=[1, 2, 3]) # E: incompatible type
61
+ np.strings.index(AR_S, "a", end=9) # E: incompatible type
62
+ np.strings.rindex(AR_U, b"a", start=[1, 2, 3]) # E: incompatible type
63
+ np.strings.rindex(AR_S, "a", end=9) # E: incompatible type
64
+
65
+ np.strings.isdecimal(AR_S) # E: incompatible type
66
+ np.strings.isnumeric(AR_S) # E: incompatible type
67
+
68
+ np.strings.replace(AR_U, b"_", b"-", 10) # E: incompatible type
69
+ np.strings.replace(AR_S, "_", "-", 1) # E: incompatible type
valley/lib/python3.10/site-packages/numpy/typing/tests/data/fail/testing.pyi ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import numpy as np
2
+ import numpy.typing as npt
3
+
4
+ AR_U: npt.NDArray[np.str_]
5
+
6
+ def func() -> bool: ...
7
+
8
+ np.testing.assert_(True, msg=1) # E: incompatible type
9
+ np.testing.build_err_msg(1, "test") # E: incompatible type
10
+ np.testing.assert_almost_equal(AR_U, AR_U) # E: incompatible type
11
+ np.testing.assert_approx_equal([1, 2, 3], [1, 2, 3]) # E: incompatible type
12
+ np.testing.assert_array_almost_equal(AR_U, AR_U) # E: incompatible type
13
+ np.testing.assert_array_less(AR_U, AR_U) # E: incompatible type
14
+ np.testing.assert_string_equal(b"a", b"a") # E: incompatible type
15
+
16
+ np.testing.assert_raises(expected_exception=TypeError, callable=func) # E: No overload variant
17
+ np.testing.assert_raises_regex(expected_exception=TypeError, expected_regex="T", callable=func) # E: No overload variant
18
+
19
+ np.testing.assert_allclose(AR_U, AR_U) # E: incompatible type
20
+ np.testing.assert_array_almost_equal_nulp(AR_U, AR_U) # E: incompatible type
21
+ np.testing.assert_array_max_ulp(AR_U, AR_U) # E: incompatible type
22
+
23
+ np.testing.assert_warns(warning_class=RuntimeWarning, func=func) # E: No overload variant
24
+ np.testing.assert_no_warnings(func=func) # E: No overload variant
25
+ np.testing.assert_no_warnings(func, None) # E: Too many arguments
26
+ np.testing.assert_no_warnings(func, test=None) # E: Unexpected keyword argument
27
+
28
+ np.testing.assert_no_gc_cycles(func=func) # E: No overload variant
valley/lib/python3.10/site-packages/numpy/typing/tests/data/fail/twodim_base.pyi ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from typing import Any, TypeVar
2
+
3
+ import numpy as np
4
+ import numpy.typing as npt
5
+
6
+
7
+ def func1(ar: npt.NDArray[Any], a: int) -> npt.NDArray[np.str_]:
8
+ pass
9
+
10
+
11
+ def func2(ar: npt.NDArray[Any], a: float) -> float:
12
+ pass
13
+
14
+
15
+ AR_b: npt.NDArray[np.bool]
16
+ AR_m: npt.NDArray[np.timedelta64]
17
+
18
+ AR_LIKE_b: list[bool]
19
+
20
+ np.eye(10, M=20.0) # E: No overload variant
21
+ np.eye(10, k=2.5, dtype=int) # E: No overload variant
22
+
23
+ np.diag(AR_b, k=0.5) # E: No overload variant
24
+ np.diagflat(AR_b, k=0.5) # E: No overload variant
25
+
26
+ np.tri(10, M=20.0) # E: No overload variant
27
+ np.tri(10, k=2.5, dtype=int) # E: No overload variant
28
+
29
+ np.tril(AR_b, k=0.5) # E: No overload variant
30
+ np.triu(AR_b, k=0.5) # E: No overload variant
31
+
32
+ np.vander(AR_m) # E: incompatible type
33
+
34
+ np.histogram2d(AR_m) # E: No overload variant
35
+
36
+ np.mask_indices(10, func1) # E: incompatible type
37
+ np.mask_indices(10, func2, 10.5) # E: incompatible type
valley/lib/python3.10/site-packages/numpy/typing/tests/data/fail/type_check.pyi ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import numpy as np
2
+ import numpy.typing as npt
3
+
4
+ DTYPE_i8: np.dtype[np.int64]
5
+
6
+ np.mintypecode(DTYPE_i8) # E: incompatible type
7
+ np.iscomplexobj(DTYPE_i8) # E: incompatible type
8
+ np.isrealobj(DTYPE_i8) # E: incompatible type
9
+
10
+ np.typename(DTYPE_i8) # E: No overload variant
11
+ np.typename("invalid") # E: No overload variant
12
+
13
+ np.common_type(np.timedelta64()) # E: incompatible type
valley/lib/python3.10/site-packages/numpy/typing/tests/data/fail/ufunc_config.pyi ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Typing tests for `numpy._core._ufunc_config`."""
2
+
3
+ import numpy as np
4
+
5
+ def func1(a: str, b: int, c: float) -> None: ...
6
+ def func2(a: str, *, b: int) -> None: ...
7
+
8
+ class Write1:
9
+ def write1(self, a: str) -> None: ...
10
+
11
+ class Write2:
12
+ def write(self, a: str, b: str) -> None: ...
13
+
14
+ class Write3:
15
+ def write(self, *, a: str) -> None: ...
16
+
17
+ np.seterrcall(func1) # E: Argument 1 to "seterrcall" has incompatible type
18
+ np.seterrcall(func2) # E: Argument 1 to "seterrcall" has incompatible type
19
+ np.seterrcall(Write1()) # E: Argument 1 to "seterrcall" has incompatible type
20
+ np.seterrcall(Write2()) # E: Argument 1 to "seterrcall" has incompatible type
21
+ np.seterrcall(Write3()) # E: Argument 1 to "seterrcall" has incompatible type
valley/lib/python3.10/site-packages/numpy/typing/tests/data/fail/ufunclike.pyi ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import numpy as np
2
+ import numpy.typing as npt
3
+
4
+ AR_c: npt.NDArray[np.complex128]
5
+ AR_m: npt.NDArray[np.timedelta64]
6
+ AR_M: npt.NDArray[np.datetime64]
7
+ AR_O: npt.NDArray[np.object_]
8
+
9
+ np.fix(AR_c) # E: incompatible type
10
+ np.fix(AR_m) # E: incompatible type
11
+ np.fix(AR_M) # E: incompatible type
12
+
13
+ np.isposinf(AR_c) # E: incompatible type
14
+ np.isposinf(AR_m) # E: incompatible type
15
+ np.isposinf(AR_M) # E: incompatible type
16
+ np.isposinf(AR_O) # E: incompatible type
17
+
18
+ np.isneginf(AR_c) # E: incompatible type
19
+ np.isneginf(AR_m) # E: incompatible type
20
+ np.isneginf(AR_M) # E: incompatible type
21
+ np.isneginf(AR_O) # E: incompatible type
valley/lib/python3.10/site-packages/numpy/typing/tests/data/fail/ufuncs.pyi ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import numpy as np
2
+ import numpy.typing as npt
3
+
4
+ AR_f8: npt.NDArray[np.float64]
5
+
6
+ np.sin.nin + "foo" # E: Unsupported operand types
7
+ np.sin(1, foo="bar") # E: No overload variant
8
+
9
+ np.abs(None) # E: No overload variant
10
+
11
+ np.add(1, 1, 1) # E: No overload variant
12
+ np.add(1, 1, axis=0) # E: No overload variant
13
+
14
+ np.matmul(AR_f8, AR_f8, where=True) # E: No overload variant
15
+
16
+ np.frexp(AR_f8, out=None) # E: No overload variant
17
+ np.frexp(AR_f8, out=AR_f8) # E: No overload variant