diff options
| author | Aaron Meurer <asmeurer@gmail.com> | 2021-07-09 13:57:01 -0600 |
|---|---|---|
| committer | Aaron Meurer <asmeurer@gmail.com> | 2021-07-09 13:57:01 -0600 |
| commit | 29b7a69a39ac66ebd8f61c6c9c65e7e60b40b4a0 (patch) | |
| tree | d3b39d89e9dc8de8f2be4c43f050419105e6e173 /numpy/_array_api | |
| parent | 5780a9bb5f662891da39eae80961455aaba0f6ac (diff) | |
| download | numpy-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.py | 17 |
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 |
