Skip to content

Commit 2f9a279

Browse files
committed
fix ruff lints
1 parent ae0be8e commit 2f9a279

3 files changed

Lines changed: 6 additions & 11 deletions

File tree

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
## 0.6.0 2025-10-05
44

55
Combine python bindings project into rust crate to streamline development process.
6-
Implement PGO (profile-guided optimization) for python releases.
6+
Implement PGO (profile-guided optimization) for python releases, giving a 1.2-5x speedup for
7+
dimensions 1-4 at the expense of a ~2x slowdown for higher dimensions.
78

89
### Changed
910

src/interpn/multilinear_rectilinear.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
from __future__ import annotations
22

3-
from typing import Optional
43
from functools import reduce
54

65
import numpy as np
@@ -95,7 +94,7 @@ def ndims(self) -> int:
9594
def dims(self) -> list[int]:
9695
return [x.data.size for x in self.grids]
9796

98-
def eval(self, obs: list[NDArray], out: Optional[NDArray] = None) -> NDArray:
97+
def eval(self, obs: list[NDArray], out: NDArray | None = None) -> NDArray:
9998
"""Evaluate the interpolator at a set of observation points,
10099
optionally writing the output into a preallocated array.
101100
@@ -120,9 +119,7 @@ def eval(self, obs: list[NDArray], out: Optional[NDArray] = None) -> NDArray:
120119

121120
return out_inner
122121

123-
def eval_unchecked(
124-
self, obs: list[NDArray], out: Optional[NDArray] = None
125-
) -> NDArray:
122+
def eval_unchecked(self, obs: list[NDArray], out: NDArray | None = None) -> NDArray:
126123
"""Evaluate the interpolator at a set of observation points,
127124
optionally writing the output into a preallocated array,
128125
and skipping checks on the dimensionality and contiguousness

src/interpn/multilinear_regular.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
from __future__ import annotations
22

3-
from typing import Optional
43
from functools import reduce
54

65
import numpy as np
@@ -99,7 +98,7 @@ def _validate_model(self):
9998
def ndims(self) -> int:
10099
return len(self.dims)
101100

102-
def eval(self, obs: list[NDArray], out: Optional[NDArray] = None) -> NDArray:
101+
def eval(self, obs: list[NDArray], out: NDArray | None = None) -> NDArray:
103102
"""Evaluate the interpolator at a set of observation points,
104103
optionally writing the output into a preallocated array.
105104
@@ -123,9 +122,7 @@ def eval(self, obs: list[NDArray], out: Optional[NDArray] = None) -> NDArray:
123122

124123
return out_inner
125124

126-
def eval_unchecked(
127-
self, obs: list[NDArray], out: Optional[NDArray] = None
128-
) -> NDArray:
125+
def eval_unchecked(self, obs: list[NDArray], out: NDArray | None = None) -> NDArray:
129126
"""Evaluate the interpolator at a set of observation points,
130127
optionally writing the output into a preallocated array,
131128
and skipping checks on the dimensionality and contiguousness

0 commit comments

Comments
 (0)