Skip to content

Commit 86a7503

Browse files
committed
Merge branch 'array-api-implementation' of https://github.com/amalia-k510/fast-array-utils into array-api-implementation
2 parents 9c8466a + 63c5e16 commit 86a7503

4 files changed

Lines changed: 5 additions & 7 deletions

File tree

pyproject.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ envs.docs.dependency-groups = [ "doc" ]
6666
envs.docs.scripts.build = "sphinx-build -M html docs docs/_build"
6767
envs.docs.scripts.clean = "git clean -fdX docs"
6868
envs.docs.scripts.open = "python -m webbrowser -t docs/_build/html/index.html"
69-
envs.hatch-test.default-args = [ ]
69+
envs.hatch-test.default-args = []
7070
envs.hatch-test.dependency-groups = [ "test-min" ]
7171
# TODO: remove scipy once https://github.com/pypa/hatch/pull/2127 is released
7272
envs.hatch-test.extra-dependencies = [ "ipykernel", "ipycytoscape", "scipy" ]
@@ -91,7 +91,7 @@ metadata.hooks.docstring-description = {}
9191
metadata.hooks.fancy-pypi-readme.content-type = "text/x-rst"
9292
metadata.hooks.fancy-pypi-readme.fragments = [ { path = "README.rst", start-after = ".. begin" } ]
9393
version.source = "vcs"
94-
version.raw-options = { local_scheme = "no-local-version" } # be able to publish dev version
94+
version.raw-options = { local_scheme = "no-local-version" } # be able to publish dev version
9595

9696
[tool.uv]
9797
override-dependencies = [ "sphinx>=9.0.1" ]
@@ -132,7 +132,7 @@ lint.per-file-ignores."typings/**/*.pyi" = [ "A002", "F403", "F405", "N801" ]
132132
lint.allowed-confusables = [ "×", "" ]
133133
lint.flake8-bugbear.extend-immutable-calls = [ "testing.fast_array_utils.Flags" ]
134134
lint.flake8-copyright.notice-rgx = "SPDX-License-Identifier: MPL-2\\.0"
135-
lint.flake8-type-checking.exempt-modules = [ ]
135+
lint.flake8-type-checking.exempt-modules = []
136136
lint.flake8-type-checking.strict = true
137137
lint.isort.known-first-party = [ "fast_array_utils" ]
138138
lint.isort.lines-after-imports = 2

src/fast_array_utils/stats/_generic_ops.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
from functools import singledispatch
55
from typing import TYPE_CHECKING, cast, get_args
66

7+
import array_api_compat
78
import numpy as np
89

910
from .. import types
@@ -72,8 +73,6 @@ def _generic_op_array_api(
7273
"""Handle arrays with native array API support."""
7374
del keep_cupy_as_array
7475

75-
import array_api_compat
76-
7776
xp = array_api_compat.array_namespace(x)
7877
return getattr(xp, op)(x, axis=axis, **_dtype_kw(dtype, op))
7978

src/fast_array_utils/stats/_is_constant.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ def is_constant_(
2929
@is_constant_.register(np.ndarray | types.CupyArray | types.HasArrayNamespace)
3030
def _is_constant_ndarray(a: NDArray[Any] | types.CupyArray, /, *, axis: Literal[0, 1] | None = None) -> bool | NDArray[np.bool] | types.CupyArray:
3131
# Should eventually support nd, not now.
32-
3332
match axis:
3433
case None:
3534
return bool((a == a.reshape(-1)[0]).all())

src/fast_array_utils/stats/_power.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
from functools import singledispatch
55
from typing import TYPE_CHECKING
66

7+
import array_api_compat
78
import numpy as np
89

910
from .. import types
@@ -39,7 +40,6 @@ def _power_numpy(x: np.ndarray, n: int, /, dtype: DTypeLike | None = None) -> np
3940

4041
@_power.register(types.HasArrayNamespace)
4142
def _power_array_api(x: types.HasArrayNamespace, n: int, /, dtype: DTypeLike | None = None) -> types.HasArrayNamespace:
42-
import array_api_compat
4343

4444
xp = array_api_compat.array_namespace(x)
4545
return xp.pow(x, n) if dtype is None else xp.pow(xp.astype(x, dtype), n)

0 commit comments

Comments
 (0)