Skip to content

Commit 037d510

Browse files
committed
apply_lazy -> lazy_apply
1 parent e1831be commit 037d510

File tree

3 files changed

+13
-13
lines changed

3 files changed

+13
-13
lines changed

docs/api-reference.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@
66
:nosignatures:
77
:toctree: generated
88
9-
apply_lazy
109
at
1110
atleast_nd
1211
cov
1312
create_diagonal
1413
expand_dims
1514
kron
15+
lazy_apply
1616
nunique
1717
pad
1818
setdiff1d

src/array_api_extra/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
"""Extra array functions built on top of the array API standard."""
22

33
from ._delegation import pad
4-
from ._lib._apply import apply_lazy
54
from ._lib._funcs import (
65
at,
76
atleast_nd,
@@ -13,19 +12,20 @@
1312
setdiff1d,
1413
sinc,
1514
)
15+
from ._lib._lazy import lazy_apply
1616

1717
__version__ = "0.6.1.dev0"
1818

1919
# pylint: disable=duplicate-code
2020
__all__ = [
2121
"__version__",
22-
"apply_lazy",
2322
"at",
2423
"atleast_nd",
2524
"cov",
2625
"create_diagonal",
2726
"expand_dims",
2827
"kron",
28+
"lazy_apply",
2929
"nunique",
3030
"pad",
3131
"setdiff1d",

src/array_api_extra/_lib/_apply.py renamed to src/array_api_extra/_lib/_lazy.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class P: # pylint: disable=missing-class-docstring
3333

3434

3535
@overload
36-
def apply_lazy( # type: ignore[valid-type]
36+
def lazy_apply( # type: ignore[valid-type]
3737
func: Callable[P, ArrayLike],
3838
*args: Array,
3939
shape: tuple[int | None, ...] | None = None,
@@ -45,7 +45,7 @@ def apply_lazy( # type: ignore[valid-type]
4545

4646

4747
@overload
48-
def apply_lazy( # type: ignore[valid-type]
48+
def lazy_apply( # type: ignore[valid-type]
4949
func: Callable[P, Sequence[ArrayLike]],
5050
*args: Array,
5151
shape: Sequence[tuple[int | None, ...]],
@@ -56,7 +56,7 @@ def apply_lazy( # type: ignore[valid-type]
5656
) -> tuple[Array, ...]: ... # numpydoc ignore=GL08
5757

5858

59-
def apply_lazy( # type: ignore[valid-type] # numpydoc ignore=GL07,SA04
59+
def lazy_apply( # type: ignore[valid-type] # numpydoc ignore=GL07,SA04
6060
func: Callable[P, Array | Sequence[ArrayLike]],
6161
*args: Array,
6262
shape: tuple[int | None, ...] | Sequence[tuple[int | None, ...]] | None = None,
@@ -142,7 +142,7 @@ def apply_lazy( # type: ignore[valid-type] # numpydoc ignore=GL07,SA04
142142
This allows applying eager functions to dask arrays.
143143
The dask graph won't be computed.
144144
145-
`apply_lazy` doesn't know if `func` reduces along any axes; also, shape
145+
`lazy_apply` doesn't know if `func` reduces along any axes; also, shape
146146
changes are non-trivial in chunked Dask arrays. For these reasons, all inputs
147147
will be rechunked into a single chunk.
148148
@@ -156,7 +156,7 @@ def apply_lazy( # type: ignore[valid-type] # numpydoc ignore=GL07,SA04
156156
If you want to distribute the calculation across multiple workers, you
157157
should use :func:`dask.array.map_blocks`, :func:`dask.array.map_overlap`,
158158
:func:`dask.array.blockwise`, or a native Dask wrapper instead of
159-
`apply_lazy`.
159+
`lazy_apply`.
160160
161161
Dask wrapping around other backends
162162
If `as_numpy=False`, `func` will receive in input eager arrays of the meta
@@ -229,7 +229,7 @@ def apply_lazy( # type: ignore[valid-type] # numpydoc ignore=GL07,SA04
229229
meta_xp = array_namespace(*metas)
230230

231231
wrapped = dask.delayed(
232-
_apply_lazy_wrapper(func, as_numpy, multi_output, meta_xp),
232+
_lazy_apply_wrapper(func, as_numpy, multi_output, meta_xp),
233233
pure=True,
234234
)
235235
# This finalizes each arg, which is the same as arg.rechunk(-1).
@@ -256,7 +256,7 @@ def apply_lazy( # type: ignore[valid-type] # numpydoc ignore=GL07,SA04
256256

257257
import jax # type: ignore[import-not-found] # pylint: disable=import-outside-toplevel,import-error # pyright: ignore[reportMissingImports]
258258

259-
wrapped = _apply_lazy_wrapper(func, as_numpy, multi_output, xp)
259+
wrapped = _lazy_apply_wrapper(func, as_numpy, multi_output, xp)
260260

261261
if any(s is None for shape in shapes for s in shape):
262262
# Unknown output shape. Won't work with jax.jit, but it
@@ -280,20 +280,20 @@ def apply_lazy( # type: ignore[valid-type] # numpydoc ignore=GL07,SA04
280280

281281
else:
282282
# Eager backends
283-
wrapped = _apply_lazy_wrapper(func, as_numpy, multi_output, xp)
283+
wrapped = _lazy_apply_wrapper(func, as_numpy, multi_output, xp)
284284
out = wrapped(*args, **kwargs)
285285

286286
return out if multi_output else out[0]
287287

288288

289-
def _apply_lazy_wrapper( # type: ignore[no-any-explicit] # numpydoc ignore=PR01,RT01
289+
def _lazy_apply_wrapper( # type: ignore[no-any-explicit] # numpydoc ignore=PR01,RT01
290290
func: Callable[..., ArrayLike | Sequence[ArrayLike]],
291291
as_numpy: bool,
292292
multi_output: bool,
293293
xp: ModuleType,
294294
) -> Callable[..., tuple[Array, ...]]:
295295
"""
296-
Helper of `apply_lazy`.
296+
Helper of `lazy_apply`.
297297
298298
Given a function that accepts one or more arrays as positional arguments and returns
299299
a single array-like or a sequence of array-likes, return a function that accepts the

0 commit comments

Comments
 (0)