Skip to content

Commit 161abd2

Browse files
committed
Allow passing kwargs to ne.evaluate() more transparently
1 parent a3c273b commit 161abd2

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

src/blosc2/lazyexpr.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3018,7 +3018,7 @@ def evaluate(
30183018
local_dict: dict | None = None,
30193019
global_dict: dict | None = None,
30203020
out: np.ndarray | blosc2.NDArray = None,
3021-
kwargs: dict | None = None,
3021+
**kwargs: Any,
30223022
) -> np.ndarray | blosc2.NDArray:
30233023
"""
30243024
Evaluate a string expression using the Blosc2 compute engine.
@@ -3027,7 +3027,8 @@ def evaluate(
30273027
Blosc2 compute engine. This allows for:
30283028
30293029
1) Use more functionality (e.g. reductions) than numexpr.
3030-
2) Use both NumPy arrays and Blosc2 NDArrays in the same expression.
3030+
2) Follow casting rules of NumPy more closely.
3031+
3) Use both NumPy arrays and Blosc2 NDArrays in the same expression.
30313032
30323033
As NDArrays can be on-disk, the expression can be evaluated without loading
30333034
the whole array into memory (i.e. using an out-of-core approach).
@@ -3045,7 +3046,7 @@ def evaluate(
30453046
out: NDArray or NumPy array, optional
30463047
The output array where the result will be stored. If not provided,
30473048
a new NumPy array will be created and returned.
3048-
kwargs: dict, optional
3049+
kwargs: Any, optional
30493050
Additional arguments to be passed to `numexpr.evaluate()` function.
30503051
30513052
Returns

tests/ndarray/test_evaluate.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ def test_expr_out(sample_data):
5151

5252
def test_expr_optimization(sample_data):
5353
a, b, c, shape = sample_data
54-
d_blosc2 = blosc2.evaluate("((a**3 + sin(a * 2)) < c) & (b > 0)", kwargs={"optimization": "none"})
54+
d_blosc2 = blosc2.evaluate("((a**3 + sin(a * 2)) < c) & (b > 0)", optimization="none")
5555
d_numexpr = ne.evaluate("((a**3 + sin(a * 2)) < c) & (b > 0)", optimization="none")
5656
np.testing.assert_equal(d_blosc2, d_numexpr)
5757

0 commit comments

Comments
 (0)