Skip to content

Commit 246e2c8

Browse files
committed
API: remove dependency on array-api-compat
1 parent 60efb68 commit 246e2c8

File tree

3 files changed

+9
-34
lines changed

3 files changed

+9
-34
lines changed

pixi.lock

+1-26
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

+1-3
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,7 @@ classifiers = [
2828
"Typing :: Typed",
2929
]
3030
dynamic = ["version"]
31-
dependencies = [
32-
"array-api-compat",
33-
]
31+
dependencies = []
3432

3533
[project.optional-dependencies]
3634
test = [

src/array_api_extra/_funcs.py

+7-5
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,13 @@
22

33
from typing import TYPE_CHECKING
44

5-
from array_api_compat import array_namespace # type: ignore[import-not-found]
6-
75
if TYPE_CHECKING:
86
from ._typing import Array, ModuleType
97

108
__all__ = ["atleast_nd"]
119

1210

13-
def atleast_nd(x: Array, *, ndim: int, xp: ModuleType | None = None) -> Array:
11+
def atleast_nd(x: Array, *, ndim: int, xp: ModuleType) -> Array:
1412
"""
1513
Recursively expand the dimension of an array to have at least `ndim`.
1614
@@ -19,15 +17,19 @@ def atleast_nd(x: Array, *, ndim: int, xp: ModuleType | None = None) -> Array:
1917
x: array
2018
An array.
2119
20+
ndim: int
21+
The minimum number of dimensions for the result.
22+
23+
xp: array_namespace
24+
The array namespace for `x`.
25+
2226
Returns
2327
-------
2428
res: array
2529
An array with ``res.ndim`` >= `ndim`.
2630
If ``x.ndim`` >= `ndim`, `x` is returned.
2731
If ``x.ndim`` < `ndim`, ``res.ndim`` will equal `ndim`.
2832
"""
29-
xp = array_namespace(x) if xp is None else xp
30-
3133
x = xp.asarray(x)
3234
if x.ndim < ndim:
3335
x = xp.expand_dims(x, axis=0)

0 commit comments

Comments
 (0)