8000 ENH: Make numpy.array_api more portable by asmeurer · Pull Request #25370 · numpy/numpy · GitHub
[go: up one dir, main page]

Skip to content

ENH: Make numpy.array_api more portable #25370

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 12 commits into from
Jan 21, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix some type hint aliases for numpy.array_api
  • Loading branch information
asmeurer committed Dec 13, 2023
commit 700ded88944ed876e7453159d8441c14516727d5
31 changes: 4 additions & 27 deletions numpy/array_api/_typing.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,41 +29,18 @@
Protocol,
)

from ._array_object import Array, CPU_DEVICE
from numpy import (
dtype,
int8,
int16,
int32,
int64,
uint8,
uint16,
uint32,
uint64,
float32,
float64,
)
from ._array_object import Array, _cpu_device
from ._dtypes import _DType

_T_co = TypeVar("_T_co", covariant=True)

class NestedSequence(Protocol[_T_co]):
def __getitem__(self, key: int, /) -> _T_co | NestedSequence[_T_co]: ...
def __len__(self, /) -> int: ...

Device = type(CPU_DEVICE)
Device = _cpu_device

Dtype = dtype[Union[
int8,
int16,
int32,
int64,
uint8,
uint16,
uint32,
uint64,
float32,
float64,
]]
Dtype =_DType

if sys.version_info >= (3, 12):
from collections.abc import Buffer as SupportsBufferProtocol
Expand Down
0