@@ -6,13 +6,14 @@ from typing_extensions import TypeVar
6
6
import numpy as np
7
7
import optype as op
8
8
import optype .numpy as onp
9
+ import optype .numpy .compat as npc
9
10
10
11
from ._util import _RichResult
11
12
from scipy ._typing import Falsy
12
13
13
14
###
14
15
15
- _FloatT = TypeVar ("_FloatT" , bound = np .floating [ Any ] , default = np .float64 )
16
+ _FloatT = TypeVar ("_FloatT" , bound = npc .floating , default = np .float64 )
16
17
_ShapeT = TypeVar ("_ShapeT" , bound = onp .AtLeast1D , default = onp .AtLeast0D [Any ])
17
18
_FuncRealT = TypeVar ("_FuncRealT" , bound = Callable [Concatenate [onp .ArrayND [np .float64 ], ...], object ])
18
19
_ModuleT = TypeVar ("_ModuleT" , bound = ModuleType , default = ModuleType )
@@ -44,7 +45,7 @@ def _initialize(
44
45
_FuncRealT , # func
45
46
list [onp .Array1D [_FloatT ]], # xs
46
47
list [onp .Array1D [_FloatT ]], # fs
47
- list [onp .Array1D [np .floating [ Any ] ]], # args
48
+ list [onp .Array1D [npc .floating ]], # args
48
49
onp .AtLeast1D , # shape
49
50
_FloatT , # xfat
50
51
_ModuleT , # xp
@@ -57,10 +58,10 @@ def _loop(
57
58
shape : Sequence [op .CanIndex ],
58
59
maxiter : int ,
59
60
func : Callable [[onp .Array [_ShapeT , _FloatT ]], onp .ToComplexND ],
60
- args : tuple [onp .ArrayND [np .floating [ Any ] ], ...],
61
- dtype : np .inexact [ Any ] ,
61
+ args : tuple [onp .ArrayND [npc .floating ], ...],
62
+ dtype : npc .inexact ,
62
63
pre_func_eval : Callable [[_ResT ], onp .Array [_ShapeT , _FloatT ]],
63
- post_func_eval : Callable [[onp .Array [_ShapeT , _FloatT ], onp .Array [_ShapeT , np .floating [ Any ] ], _ResT ], _Ignored ],
64
+ post_func_eval : Callable [[onp .Array [_ShapeT , _FloatT ], onp .Array [_ShapeT , npc .floating ], _ResT ], _Ignored ],
64
65
check_termination : Callable [[_ResT ], onp .Array [_ShapeT , np .bool_ ]],
65
66
post_termination_check : Callable [[_ResT ], _Ignored ],
66
67
customize_result : Callable [[_ResT , _ToShapeT ], tuple [int , ...]],
@@ -74,7 +75,7 @@ def _check_termination(
74
75
work : _WorkT ,
75
76
res : Mapping [str , onp .Array [_ShapeT , _FloatT ]],
76
77
res_work_pairs : Iterable [tuple [str , str ]],
77
- active : onp .Array [_ShapeT , np .integer [ Any ] ],
78
+ active : onp .Array [_ShapeT , npc .integer ],
78
79
check_termination : Callable [[_WorkT ], onp .Array [_ShapeT , np .bool_ ]],
79
80
preserve_shape : bool | None ,
80
81
xp : ModuleType ,
@@ -85,7 +86,7 @@ def _update_active(
85
86
work : Mapping [str , onp .Array [_ShapeT , _FloatT ]],
86
87
res : Mapping [str , onp .Array [_ShapeT , _FloatT ]],
87
88
res_work_pairs : Iterable [tuple [str , str ]],
88
- active : onp .Array [_ShapeT , np .integer [ Any ] ],
89
+ active : onp .Array [_ShapeT , npc .integer ],
89
90
mask : onp .Array [_ShapeT , np .bool_ ] | None ,
90
91
preserve_shape : bool | None ,
91
92
xp : ModuleType ,
@@ -96,7 +97,7 @@ def _prepare_result(
96
97
work : Mapping [str , onp .Array [_ShapeT , _FloatT ]],
97
98
res : _ResT ,
98
99
res_work_pairs : Iterable [tuple [str , str ]],
99
- active : onp .Array [_ShapeT , np .integer [ Any ] ],
100
+ active : onp .Array [_ShapeT , npc .integer ],
100
101
shape : _ToShapeT ,
101
102
customize_result : Callable [[_ResT , _ToShapeT ], tuple [int , ...]],
102
103
preserve_shape : bool | None ,
0 commit comments