Skip to content

Commit 9da6bdf

Browse files
authored
💥 interpolate: consistent RBFInterpolator generic type parameter ordering (#685)
2 parents 12e1b1b + e32b3f3 commit 9da6bdf

File tree

2 files changed

+37
-37
lines changed

2 files changed

+37
-37
lines changed

‎README.md

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -160,23 +160,23 @@ All generic type parameters are optional and can be omitted if not needed.
160160

161161
### `scipy.interpolate`
162162

163-
| generic type | |
164-
| ---------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- |
165-
| `AAA[T: inexact]` | [docs](https://docs.scipy.org/doc/scipy/reference/generated/scipy.interpolate.AAA.html) |
166-
| `BarycentricInterpolator[T: float64 \| complex128]` | [docs](https://docs.scipy.org/doc/scipy/reference/generated/scipy.interpolate.BarycentricInterpolator.html) |
167-
| `BPoly[T: float64 \| complex128]` | [docs](https://docs.scipy.org/doc/scipy/reference/generated/scipy.interpolate.BPoly.html) |
168-
| `BSpline[T: float64 \| complex128]` | [docs](https://docs.scipy.org/doc/scipy/reference/generated/scipy.interpolate.BSpline.html) |
169-
| `CubicHermiteSpline[T: float64 \| complex128]` | [docs](https://docs.scipy.org/doc/scipy/reference/generated/scipy.interpolate.CubicHermiteSpline.html) |
170-
| `CubicSpline[T: float64 \| complex128]` | [docs](https://docs.scipy.org/doc/scipy/reference/generated/scipy.interpolate.CubicSpline.html) |
171-
| `FloaterHormannInterpolator[T: float64 \| complex128]` | [docs](https://docs.scipy.org/doc/scipy/reference/generated/scipy.interpolate.FloaterHormannInterpolator.html) |
172-
| `KroghInterpolator[T: float64 \| complex128]` | [docs](https://docs.scipy.org/doc/scipy/reference/generated/scipy.interpolate.KroghInterpolator.html) |
173-
| `LinearNDInterpolator[T: float64 \| complex128]` | [docs](https://docs.scipy.org/doc/scipy/reference/generated/scipy.interpolate.LinearNDInterpolator.html) |
174-
| `NdBSpline[T: float64 \| complex128]` | [docs](https://docs.scipy.org/doc/scipy/reference/generated/scipy.interpolate.NdBSpline.html) |
175-
| `NdPPoly[T: float64 \| complex128]` | [docs](https://docs.scipy.org/doc/scipy/reference/generated/scipy.interpolate.NdPPoly.html) |
176-
| `NearestNDInterpolator[T: float64 \| complex128]` | [docs](https://docs.scipy.org/doc/scipy/reference/generated/scipy.interpolate.NearestNDInterpolator.html) |
177-
| `PPoly[T: float64 \| complex128]` | [docs](https://docs.scipy.org/doc/scipy/reference/generated/scipy.interpolate.PPoly.html) |
178-
| `RBFInterpolator[S: (int, ...), T: float64 \| complex128]` | [docs](https://docs.scipy.org/doc/scipy/reference/generated/scipy.interpolate.RBFInterpolator.html) |
179-
| `RegularGridInterpolator[T: float64 \| complex128]` | [docs](https://docs.scipy.org/doc/scipy/reference/generated/scipy.interpolate.RegularGridInterpolator.html) |
163+
| generic type | |
164+
| ------------------------------------------------------------ | -------------------------------------------------------------------------------------------------------------- |
165+
| `AAA[T: inexact]` | [docs](https://docs.scipy.org/doc/scipy/reference/generated/scipy.interpolate.AAA.html) |
166+
| `BarycentricInterpolator[T: float64 \| complex128]` | [docs](https://docs.scipy.org/doc/scipy/reference/generated/scipy.interpolate.BarycentricInterpolator.html) |
167+
| `BPoly[T: float64 \| complex128]` | [docs](https://docs.scipy.org/doc/scipy/reference/generated/scipy.interpolate.BPoly.html) |
168+
| `BSpline[T: float64 \| complex128]` | [docs](https://docs.scipy.org/doc/scipy/reference/generated/scipy.interpolate.BSpline.html) |
169+
| `CubicHermiteSpline[T: float64 \| complex128]` | [docs](https://docs.scipy.org/doc/scipy/reference/generated/scipy.interpolate.CubicHermiteSpline.html) |
170+
| `CubicSpline[T: float64 \| complex128]` | [docs](https://docs.scipy.org/doc/scipy/reference/generated/scipy.interpolate.CubicSpline.html) |
171+
| `FloaterHormannInterpolator[T: float64 \| complex128]` | [docs](https://docs.scipy.org/doc/scipy/reference/generated/scipy.interpolate.FloaterHormannInterpolator.html) |
172+
| `KroghInterpolator[T: float64 \| complex128, S: (int, ...)]` | [docs](https://docs.scipy.org/doc/scipy/reference/generated/scipy.interpolate.KroghInterpolator.html) |
173+
| `LinearNDInterpolator[T: float64 \| complex128]` | [docs](https://docs.scipy.org/doc/scipy/reference/generated/scipy.interpolate.LinearNDInterpolator.html) |
174+
| `NdBSpline[T: float64 \| complex128]` | [docs](https://docs.scipy.org/doc/scipy/reference/generated/scipy.interpolate.NdBSpline.html) |
175+
| `NdPPoly[T: float64 \| complex128]` | [docs](https://docs.scipy.org/doc/scipy/reference/generated/scipy.interpolate.NdPPoly.html) |
176+
| `NearestNDInterpolator[T: float64 \| complex128]` | [docs](https://docs.scipy.org/doc/scipy/reference/generated/scipy.interpolate.NearestNDInterpolator.html) |
177+
| `PPoly[T: float64 \| complex128]` | [docs](https://docs.scipy.org/doc/scipy/reference/generated/scipy.interpolate.PPoly.html) |
178+
| `RBFInterpolator[T: float64 \| complex128, S: (int, ...)]` | [docs](https://docs.scipy.org/doc/scipy/reference/generated/scipy.interpolate.RBFInterpolator.html) |
179+
| `RegularGridInterpolator[T: float64 \| complex128]` | [docs](https://docs.scipy.org/doc/scipy/reference/generated/scipy.interpolate.RegularGridInterpolator.html) |
180180

181181
### `scipy.optimize`
182182

@@ -221,11 +221,11 @@ All generic type parameters are optional and can be omitted if not needed.
221221

222222
#### `scipy.sparse.linalg`
223223

224-
| generic type | |
225-
| ----------------------------------- | ---------------------------------------------------------------------------------------------------- |
226-
| `LaplacianNd[T: real]` | [docs](https://docs.scipy.org/doc/scipy/reference/generated/scipy.sparse.linalg.LaplacianNd.html) |
227-
| `LinearOperator[T: scalar]` | [docs](https://docs.scipy.org/doc/scipy/reference/generated/scipy.sparse.linalg.LinearOperator.html) |
228-
| `SuperLU[T: inexact]` | [docs](https://docs.scipy.org/doc/scipy/reference/generated/scipy.sparse.linalg.SuperLU.html) |
224+
| generic type | |
225+
| --------------------------- | ---------------------------------------------------------------------------------------------------- |
226+
| `LaplacianNd[T: real]` | [docs](https://docs.scipy.org/doc/scipy/reference/generated/scipy.sparse.linalg.LaplacianNd.html) |
227+
| `LinearOperator[T: scalar]` | [docs](https://docs.scipy.org/doc/scipy/reference/generated/scipy.sparse.linalg.LinearOperator.html) |
228+
| `SuperLU[T: inexact]` | [docs](https://docs.scipy.org/doc/scipy/reference/generated/scipy.sparse.linalg.SuperLU.html) |
229229

230230
### `scipy.stats`
231231

‎scipy-stubs/interpolate/_rbfinterp.pyi

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@ _Kernel: TypeAlias = Literal[
1717
"gaussian",
1818
] # fmt: skip
1919

20+
_Inexact64T_co = TypeVar("_Inexact64T_co", bound=np.float64 | np.complex128, default=np.float64, covariant=True)
2021
_ShapeT_co = TypeVar("_ShapeT_co", bound=onp.AtLeast0D, default=onp.AtLeast0D[Any], covariant=True)
21-
_SCT_co = TypeVar("_SCT_co", bound=np.float64 | np.complex128, default=np.float64, covariant=True)
2222

2323
###
2424

25-
class RBFInterpolator(Generic[_ShapeT_co, _SCT_co]):
25+
class RBFInterpolator(Generic[_Inexact64T_co, _ShapeT_co]):
2626
y: onp.Array2D[np.float64]
2727
d: onp.Array[_ShapeT_co, np.float64]
2828
d_shape: _ShapeT_co
@@ -35,7 +35,7 @@ class RBFInterpolator(Generic[_ShapeT_co, _SCT_co]):
3535

3636
@overload
3737
def __init__(
38-
self: RBFInterpolator[tuple[int], np.float64],
38+
self: RBFInterpolator[np.float64, tuple[int]],
3939
/,
4040
y: onp.ToFloat2D,
4141
d: onp.ToFloatStrict1D,
@@ -47,7 +47,7 @@ class RBFInterpolator(Generic[_ShapeT_co, _SCT_co]):
4747
) -> None: ...
4848
@overload
4949
def __init__(
50-
self: RBFInterpolator[tuple[int], np.complex128],
50+
self: RBFInterpolator[np.complex128, tuple[int]],
5151
/,
5252
y: onp.ToFloat2D,
5353
d: onp.ToJustComplexStrict1D,
@@ -59,7 +59,7 @@ class RBFInterpolator(Generic[_ShapeT_co, _SCT_co]):
5959
) -> None: ...
6060
@overload
6161
def __init__(
62-
self: RBFInterpolator[tuple[int], Any],
62+
self: RBFInterpolator[Any, tuple[int]],
6363
/,
6464
y: onp.ToFloat2D,
6565
d: onp.ToComplexStrict1D,
@@ -71,7 +71,7 @@ class RBFInterpolator(Generic[_ShapeT_co, _SCT_co]):
7171
) -> None: ...
7272
@overload
7373
def __init__(
74-
self: RBFInterpolator[tuple[int, int], np.float64],
74+
self: RBFInterpolator[np.float64, tuple[int, int]],
7575
/,
7676
y: onp.ToFloat2D,
7777
d: onp.ToFloatStrict2D,
@@ -83,7 +83,7 @@ class RBFInterpolator(Generic[_ShapeT_co, _SCT_co]):
8383
) -> None: ...
8484
@overload
8585
def __init__(
86-
self: RBFInterpolator[tuple[int, int], np.complex128],
86+
self: RBFInterpolator[np.complex128, tuple[int, int]],
8787
/,
8888
y: onp.ToFloat2D,
8989
d: onp.ToJustComplexStrict2D,
@@ -95,7 +95,7 @@ class RBFInterpolator(Generic[_ShapeT_co, _SCT_co]):
9595
) -> None: ...
9696
@overload
9797
def __init__(
98-
self: RBFInterpolator[tuple[int, int], Any],
98+
self: RBFInterpolator[Any, tuple[int, int]],
9999
/,
100100
y: onp.ToFloat2D,
101101
d: onp.ToComplexStrict2D,
@@ -107,7 +107,7 @@ class RBFInterpolator(Generic[_ShapeT_co, _SCT_co]):
107107
) -> None: ...
108108
@overload
109109
def __init__(
110-
self: RBFInterpolator[tuple[int, int, int], np.float64],
110+
self: RBFInterpolator[np.float64, tuple[int, int, int]],
111111
/,
112112
y: onp.ToFloat2D,
113113
d: onp.ToFloatStrict3D,
@@ -119,7 +119,7 @@ class RBFInterpolator(Generic[_ShapeT_co, _SCT_co]):
119119
) -> None: ...
120120
@overload
121121
def __init__(
122-
self: RBFInterpolator[tuple[int, int, int], np.complex128],
122+
self: RBFInterpolator[np.complex128, tuple[int, int, int]],
123123
/,
124124
y: onp.ToFloat2D,
125125
d: onp.ToJustComplexStrict3D,
@@ -131,7 +131,7 @@ class RBFInterpolator(Generic[_ShapeT_co, _SCT_co]):
131131
) -> None: ...
132132
@overload
133133
def __init__(
134-
self: RBFInterpolator[tuple[int, int, int], Any],
134+
self: RBFInterpolator[Any, tuple[int, int, int]],
135135
/,
136136
y: onp.ToFloat2D,
137137
d: onp.ToComplexStrict3D,
@@ -143,7 +143,7 @@ class RBFInterpolator(Generic[_ShapeT_co, _SCT_co]):
143143
) -> None: ...
144144
@overload
145145
def __init__(
146-
self: RBFInterpolator[onp.AtLeast1D, np.float64],
146+
self: RBFInterpolator[np.float64],
147147
/,
148148
y: onp.ToFloat2D,
149149
d: onp.ToFloatND,
@@ -155,7 +155,7 @@ class RBFInterpolator(Generic[_ShapeT_co, _SCT_co]):
155155
) -> None: ...
156156
@overload
157157
def __init__(
158-
self: RBFInterpolator[onp.AtLeast1D, np.complex128],
158+
self: RBFInterpolator[np.complex128],
159159
/,
160160
y: onp.ToFloat2D,
161161
d: onp.ToJustComplexND,
@@ -167,7 +167,7 @@ class RBFInterpolator(Generic[_ShapeT_co, _SCT_co]):
167167
) -> None: ...
168168
@overload
169169
def __init__(
170-
self: RBFInterpolator[onp.AtLeast1D, Any],
170+
self: RBFInterpolator[Any],
171171
/,
172172
y: onp.ToFloat2D,
173173
d: onp.ToComplexND,
@@ -179,4 +179,4 @@ class RBFInterpolator(Generic[_ShapeT_co, _SCT_co]):
179179
) -> None: ...
180180

181181
# TODO(jorenham): Return `onp.Array[tuple[int, Unpack[_ShapeT_co]], _SCT_co]` once mypy supports it (if ever)
182-
def __call__(self, /, x: onp.ToFloat2D) -> onp.ArrayND[_SCT_co]: ...
182+
def __call__(self, /, x: onp.ToFloat2D) -> onp.ArrayND[_Inexact64T_co]: ...

0 commit comments

Comments
 (0)