Skip to content

Commit ca9cda0

Browse files
committed
update testing.integrate_kernel type hints
1 parent 5ea7043 commit ca9cda0

1 file changed

Lines changed: 9 additions & 6 deletions

File tree

yt/testing.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
import numpy as np
1818
from more_itertools import always_iterable
1919
from numpy.random import RandomState
20+
from numpy.typing import NDArray
2021
from unyt.exceptions import UnitOperationError
2122

2223
from yt._maintenance.deprecation import issue_deprecation_warning
@@ -91,7 +92,7 @@ def assert_rel_equal(a1, a2, decimals, err_msg="", verbose=True):
9192

9293
# tested: volume integral is 1.
9394
def cubicspline_python(
94-
x: float | np.ndarray,
95+
x: float | NDArray[np.floating],
9596
) -> np.ndarray:
9697
"""
9798
cubic spline SPH kernel function for testing against more
@@ -118,7 +119,9 @@ def cubicspline_python(
118119

119120

120121
def integrate_kernel(
121-
kernelfunc: Callable[[float], float], b: float, hsml: float
122+
kernelfunc: Callable[[float | NDArray[np.floating]], float | NDArray[np.floating]],
123+
b: float,
124+
hsml: float,
122125
) -> float:
123126
"""
124127
integrates a kernel function over a line passing entirely
@@ -154,11 +157,11 @@ def integrate_kernel(
154157

155158

156159
def distancematrix(
157-
pos3_i0: np.ndarray,
158-
pos3_i1: np.ndarray,
160+
pos3_i0: NDArray[np.floating],
161+
pos3_i1: NDArray[np.floating],
159162
periodic: tuple[bool, bool, bool] = (True,) * 3,
160-
periods: np.ndarray = _zeroperiods,
161-
) -> np.ndarray:
163+
periods: NDArray[np.floating] = _zeroperiods,
164+
) -> NDArray[np.floating]:
162165
"""
163166
Calculates the distances between two arrays of points.
164167

0 commit comments

Comments
 (0)