Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Aug 19, 2024
1 parent 45591ac commit d579050
Show file tree
Hide file tree
Showing 9 changed files with 31 additions and 171 deletions.
39 changes: 26 additions & 13 deletions xarray/namedarray/_array_api/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@

__all__ += ["__array_api_version__"]

from .array_object import Array
from xarray.namedarray._array_api.array_object import Array

__all__ += ["Array"]

from .constants import e, inf, nan, newaxis, pi
from xarray.namedarray._array_api.constants import e, inf, nan, newaxis, pi

__all__ += ["e", "inf", "nan", "newaxis", "pi"]

from .creation_functions import (
from xarray.namedarray._array_api.creation_functions import (
arange,
asarray,
empty,
Expand Down Expand Up @@ -48,11 +48,18 @@
"zeros_like",
]

from .data_type_functions import astype, can_cast, finfo, iinfo, isdtype, result_type
from xarray.namedarray._array_api.data_type_functions import (
astype,
can_cast,
finfo,
iinfo,
isdtype,
result_type,
)

__all__ += ["astype", "can_cast", "finfo", "iinfo", "isdtype", "result_type"]

from .dtypes import (
from xarray.namedarray._array_api.dtypes import (
bool,
complex64,
complex128,
Expand Down Expand Up @@ -84,7 +91,7 @@
"uint64",
]

from .elementwise_functions import (
from xarray.namedarray._array_api.elementwise_functions import (
abs,
acos,
acosh,
Expand Down Expand Up @@ -208,15 +215,21 @@
"trunc",
]

from .indexing_functions import take
from xarray.namedarray._array_api.indexing_functions import take

__all__ += ["take"]

from .linear_algebra_functions import matmul, matrix_transpose, outer, tensordot, vecdot
from xarray.namedarray._array_api.linear_algebra_functions import (
matmul,
matrix_transpose,
outer,
tensordot,
vecdot,
)

__all__ += ["matmul", "matrix_transpose", "outer", "tensordot", "vecdot"]

from .manipulation_functions import (
from xarray.namedarray._array_api.manipulation_functions import (
broadcast_arrays,
broadcast_to,
concat,
Expand Down Expand Up @@ -244,14 +257,14 @@
"stack",
]

from .searching_functions import argmax, argmin, where
from xarray.namedarray._array_api.searching_functions import argmax, argmin, where

__all__ += ["argmax", "argmin", "where"]

from .statistical_functions import max, mean, min, prod, sum
from xarray.namedarray._array_api.statistical_functions import max, mean, min, prod, sum

__all__ += ["max", "mean", "min", "prod", "sum"]

from .utility_functions import all, any
from xarray.namedarray._array_api.utility_functions import all, any

__all__ += ["all", "any"]
__all__ += ["all", "any"]
3 changes: 1 addition & 2 deletions xarray/namedarray/_array_api/_utils.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
from typing import Any, ModuleType, TYPE_CHECKING
from typing import TYPE_CHECKING, Any, ModuleType

import numpy as np

from xarray.namedarray._typing import _arrayapi, _dtype


if TYPE_CHECKING:
from xarray.namedarray.core import NamedArray

Expand Down
13 changes: 0 additions & 13 deletions xarray/namedarray/_array_api/creation_functions.py
Original file line number Diff line number Diff line change
@@ -1,36 +1,23 @@
from __future__ import annotations

from types import ModuleType
from typing import Any, overload

import numpy as np

from xarray.namedarray._array_api._utils import _maybe_default_namespace
from xarray.namedarray._typing import (
Default,
_arrayapi,
_arrayfunction_or_api,
_ArrayLike,
_Axes,
_Axis,
_AxisLike,
_default,
_Dim,
_Dims,
_DimsLike,
_DType,
_dtype,
_ScalarType,
_Shape,
_ShapeType,
_SupportsImag,
_SupportsReal,
duckarray,
)
from xarray.namedarray.core import (
NamedArray,
_dims_to_axis,
_get_remaining_dims,
)
from xarray.namedarray.utils import (
to_0d_object_array,
Expand Down
25 changes: 1 addition & 24 deletions xarray/namedarray/_array_api/data_type_functions.py
Original file line number Diff line number Diff line change
@@ -1,42 +1,19 @@
from __future__ import annotations

from types import ModuleType
from typing import Any, overload

import numpy as np
from typing import Any

from xarray.namedarray._array_api._utils import (
_get_data_namespace,
_get_namespace_dtype,
)
from xarray.namedarray._typing import (
Default,
_arrayapi,
_arrayfunction_or_api,
_ArrayLike,
_Axes,
_Axis,
_AxisLike,
_default,
_Dim,
_Dims,
_DimsLike,
_DType,
_dtype,
_ScalarType,
_Shape,
_ShapeType,
_SupportsImag,
_SupportsReal,
duckarray,
)
from xarray.namedarray.core import (
NamedArray,
_dims_to_axis,
_get_remaining_dims,
)
from xarray.namedarray.utils import (
to_0d_object_array,
)


Expand Down
34 changes: 0 additions & 34 deletions xarray/namedarray/_array_api/dtypes.py
Original file line number Diff line number Diff line change
@@ -1,40 +1,6 @@
from __future__ import annotations

from types import ModuleType
from typing import Any, overload

import numpy as np

from xarray.namedarray._array_api._utils import _maybe_default_namespace
from xarray.namedarray._typing import (
Default,
_arrayapi,
_arrayfunction_or_api,
_ArrayLike,
_Axes,
_Axis,
_AxisLike,
_default,
_Dim,
_Dims,
_DimsLike,
_DType,
_dtype,
_ScalarType,
_Shape,
_ShapeType,
_SupportsImag,
_SupportsReal,
duckarray,
)
from xarray.namedarray.core import (
NamedArray,
_dims_to_axis,
_get_remaining_dims,
)
from xarray.namedarray.utils import (
to_0d_object_array,
)

_xp = _maybe_default_namespace()
int8 = _xp.int8
Expand Down
23 changes: 0 additions & 23 deletions xarray/namedarray/_array_api/elementwise_functions.py
Original file line number Diff line number Diff line change
@@ -1,39 +1,16 @@
from __future__ import annotations

from types import ModuleType
from typing import Any, overload

import numpy as np

from xarray.namedarray._array_api._utils import _get_data_namespace
from xarray.namedarray._typing import (
Default,
_arrayapi,
_arrayfunction_or_api,
_ArrayLike,
_Axes,
_Axis,
_AxisLike,
_default,
_Dim,
_Dims,
_DimsLike,
_DType,
_dtype,
_ScalarType,
_Shape,
_ShapeType,
_SupportsImag,
_SupportsReal,
duckarray,
)
from xarray.namedarray.core import (
NamedArray,
_dims_to_axis,
_get_remaining_dims,
)
from xarray.namedarray.utils import (
to_0d_object_array,
)


Expand Down
21 changes: 1 addition & 20 deletions xarray/namedarray/_array_api/manipulation_functions.py
Original file line number Diff line number Diff line change
@@ -1,38 +1,19 @@
from __future__ import annotations

from types import ModuleType
from typing import Any, overload

import numpy as np
from typing import Any

from xarray.namedarray._typing import (
Default,
_arrayapi,
_arrayfunction_or_api,
_ArrayLike,
_Axes,
_Axis,
_AxisLike,
_default,
_Dim,
_Dims,
_DimsLike,
_DType,
_dtype,
_ScalarType,
_Shape,
_ShapeType,
_SupportsImag,
_SupportsReal,
duckarray,
)
from xarray.namedarray.core import (
NamedArray,
_dims_to_axis,
_get_remaining_dims,
)
from xarray.namedarray.utils import (
to_0d_object_array,
)


Expand Down
22 changes: 1 addition & 21 deletions xarray/namedarray/_array_api/statistical_functions.py
Original file line number Diff line number Diff line change
@@ -1,40 +1,20 @@
from __future__ import annotations

from types import ModuleType
from typing import Any, overload

import numpy as np
from typing import Any

from xarray.namedarray._array_api._utils import _get_data_namespace
from xarray.namedarray._typing import (
Default,
_arrayapi,
_arrayfunction_or_api,
_ArrayLike,
_Axes,
_Axis,
_AxisLike,
_default,
_Dim,
_Dims,
_DimsLike,
_DType,
_dtype,
_ScalarType,
_Shape,
_ShapeType,
_SupportsImag,
_SupportsReal,
duckarray,
)
from xarray.namedarray.core import (
NamedArray,
_dims_to_axis,
_get_remaining_dims,
)
from xarray.namedarray.utils import (
to_0d_object_array,
)


def mean(
Expand Down
22 changes: 1 addition & 21 deletions xarray/namedarray/_array_api/utility_functions.py
Original file line number Diff line number Diff line change
@@ -1,40 +1,20 @@
from __future__ import annotations

from types import ModuleType
from typing import Any, overload

import numpy as np
from typing import Any

from xarray.namedarray._array_api._utils import _get_data_namespace
from xarray.namedarray._typing import (
Default,
_arrayapi,
_arrayfunction_or_api,
_ArrayLike,
_Axes,
_Axis,
_AxisLike,
_default,
_Dim,
_Dims,
_DimsLike,
_DType,
_dtype,
_ScalarType,
_Shape,
_ShapeType,
_SupportsImag,
_SupportsReal,
duckarray,
)
from xarray.namedarray.core import (
NamedArray,
_dims_to_axis,
_get_remaining_dims,
)
from xarray.namedarray.utils import (
to_0d_object_array,
)


def all(
Expand Down

0 comments on commit d579050

Please sign in to comment.