summaryrefslogtreecommitdiff
path: root/numpy/_array_api
diff options
context:
space:
mode:
authorAaron Meurer <asmeurer@gmail.com>2021-07-09 13:57:01 -0600
committerAaron Meurer <asmeurer@gmail.com>2021-07-09 13:57:01 -0600
commit29b7a69a39ac66ebd8f61c6c9c65e7e60b40b4a0 (patch)
treed3b39d89e9dc8de8f2be4c43f050419105e6e173 /numpy/_array_api
parent5780a9bb5f662891da39eae80961455aaba0f6ac (diff)
downloadnumpy-29b7a69a39ac66ebd8f61c6c9c65e7e60b40b4a0.tar.gz
Use better type definitions for the array API custom types
Diffstat (limited to 'numpy/_array_api')
-rw-r--r--numpy/_array_api/_types.py17
1 files changed, 10 insertions, 7 deletions
diff --git a/numpy/_array_api/_types.py b/numpy/_array_api/_types.py
index 050ad4031..4ff718205 100644
--- a/numpy/_array_api/_types.py
+++ b/numpy/_array_api/_types.py
@@ -14,10 +14,13 @@ from typing import Any, Sequence, Type, Union
from . import (Array, int8, int16, int32, int64, uint8, uint16, uint32,
uint64, float32, float64)
-Array = ndarray
-Device = TypeVar('device')
-Dtype = Literal[int8, int16, int32, int64, uint8, uint16,
- uint32, uint64, float32, float64]
-SupportsDLPack = TypeVar('SupportsDLPack')
-SupportsBufferProtocol = TypeVar('SupportsBufferProtocol')
-PyCapsule = TypeVar('PyCapsule')
+# This should really be recursive, but that isn't supported yet. See the
+# similar comment in numpy/typing/_array_like.py
+NestedSequence = Sequence[Sequence[Any]]
+
+Device = Any
+Dtype = Type[Union[[int8, int16, int32, int64, uint8, uint16,
+ uint32, uint64, float32, float64]]]
+SupportsDLPack = Any
+SupportsBufferProtocol = Any
+PyCapsule = Any