-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathtyping.py
More file actions
29 lines (17 loc) · 825 Bytes
/
typing.py
File metadata and controls
29 lines (17 loc) · 825 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# SPDX-License-Identifier: MPL-2.0
"""Type categories to be used in type annotations."""
from __future__ import annotations
from typing import TYPE_CHECKING, Any
from numpy.typing import NDArray
from . import types
if TYPE_CHECKING:
from typing import TypeAlias
__all__ = ["CpuArray", "DiskArray", "GpuArray"]
# change to `type` syntax once this is released: https://github.com/sphinx-doc/sphinx/pull/13508
CpuArray: TypeAlias = NDArray[Any] | types.CSBase # noqa: UP040
"""Arrays and matrices stored in CPU memory."""
GpuArray: TypeAlias = types.CupyArray | types.CupyCSMatrix # noqa: UP040
"""Arrays and matrices stored in GPU memory."""
# TODO(flying-sheep): types.CSDataset # noqa: TD003
DiskArray: TypeAlias = types.H5Dataset | types.ZarrArray # noqa: UP040
"""Arrays and matrices stored on disk."""