Skip to content

Commit a15f88b

Browse files
committed
chore: wip
1 parent 16c4241 commit a15f88b

File tree

9 files changed

+455
-386
lines changed

9 files changed

+455
-386
lines changed

pyproject.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ dev = [
4343
"pytest>=8,<9",
4444
"pytest-cov>=6,<7",
4545
"ruff>=0.11.13",
46-
"ssort>=0.14.0",
4746
]
4847
docs = [
4948
"furo>=2023.5.20; python_version>='3.11'",

src/array_api/_2022_12.py

Lines changed: 97 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,35 @@
1515
inf = float("inf")
1616

1717

18+
@runtime_checkable
19+
class NestedSequence[T_t_co](Protocol):
20+
def __getitem__(self, key: int, /) -> "Union[T_t_co, NestedSequence[T_t_co]]": ...
21+
22+
def __len__(self, /) -> int: ...
23+
24+
25+
@runtime_checkable
26+
class iinfo_object[TDtype](Protocol):
27+
"""Dataclass returned by `iinfo`."""
28+
29+
bits: int
30+
max: int
31+
min: int
32+
dtype: TDtype
33+
34+
35+
@runtime_checkable
36+
class finfo_object[TDtype](Protocol):
37+
"""Dataclass returned by `finfo`."""
38+
39+
bits: int
40+
eps: float
41+
max: float
42+
min: float
43+
smallest_normal: float
44+
dtype: TDtype
45+
46+
1847
@runtime_checkable
1948
class Array[TPycapsule, TArray: Array, TDevice, TDtype, TEllipsis](Protocol):
2049
def __init__(self: TArray) -> None:
@@ -1195,18 +1224,6 @@ class can_cast[TArray: Array, TDtype](Protocol):
11951224
def __call__(self, from_: Union[TDtype, TArray], to: TDtype, /) -> bool: ...
11961225

11971226

1198-
@runtime_checkable
1199-
class finfo_object[TDtype](Protocol):
1200-
"""Dataclass returned by `finfo`."""
1201-
1202-
bits: int
1203-
eps: float
1204-
max: float
1205-
min: float
1206-
smallest_normal: float
1207-
dtype: TDtype
1208-
1209-
12101227
@runtime_checkable
12111228
class finfo[TArray: Array, TDtype](Protocol):
12121229
"""
@@ -1263,16 +1280,6 @@ class finfo[TArray: Array, TDtype](Protocol):
12631280
def __call__(self, type: Union[TDtype, TArray], /) -> finfo_object: ...
12641281

12651282

1266-
@runtime_checkable
1267-
class iinfo_object[TDtype](Protocol):
1268-
"""Dataclass returned by `iinfo`."""
1269-
1270-
bits: int
1271-
max: int
1272-
min: int
1273-
dtype: TDtype
1274-
1275-
12761283
@runtime_checkable
12771284
class iinfo[TArray: Array, TDtype](Protocol):
12781285
"""
@@ -1713,13 +1720,6 @@ class arange[TArray: Array, TDevice, TDtype](Protocol):
17131720
def __call__(self, start: Union[int, float], /, stop: Optional[Union[int, float]] = None, step: Union[int, float] = 1, *, dtype: Optional[TDtype] = None, device: Optional[TDevice] = None) -> TArray: ...
17141721

17151722

1716-
@runtime_checkable
1717-
class NestedSequence[T_t_co](Protocol):
1718-
def __getitem__(self, key: int, /) -> "Union[T_t_co, NestedSequence[T_t_co]]": ...
1719-
1720-
def __len__(self, /) -> int: ...
1721-
1722-
17231723
@runtime_checkable
17241724
class asarray[TSupportsbufferprotocol, TArray: Array, TDevice, TDtype](Protocol):
17251725
r"""
@@ -7383,51 +7383,6 @@ class unique_values[TArray: Array](Protocol):
73837383
def __call__(self, x: TArray, /) -> TArray: ...
73847384

73857385

7386-
@runtime_checkable
7387-
class LinalgNamespace[TArray: Array, TDtype](Protocol):
7388-
cholesky: cholesky[TArray,]
7389-
cross: cross[TArray,]
7390-
det: det[TArray,]
7391-
diagonal: diagonal[TArray,]
7392-
eigh: eigh[TArray,]
7393-
eigvalsh: eigvalsh[TArray,]
7394-
inv: inv[TArray,]
7395-
matmul: matmul[TArray,]
7396-
matrix_norm: matrix_norm[TArray,]
7397-
matrix_power: matrix_power[TArray,]
7398-
matrix_rank: matrix_rank[TArray,]
7399-
matrix_transpose: matrix_transpose[TArray,]
7400-
outer: outer[TArray,]
7401-
pinv: pinv[TArray,]
7402-
qr: qr[TArray,]
7403-
slogdet: slogdet[TArray,]
7404-
solve: solve[TArray,]
7405-
svd: svd[TArray,]
7406-
svdvals: svdvals[TArray,]
7407-
tensordot: tensordot[TArray,]
7408-
trace: trace[TArray, TDtype]
7409-
vecdot: vecdot[TArray,]
7410-
vector_norm: vector_norm[TArray,]
7411-
7412-
7413-
@runtime_checkable
7414-
class FftNamespace[TArray: Array, TDevice](Protocol):
7415-
fft: fft[TArray,]
7416-
ifft: ifft[TArray,]
7417-
fftn: fftn[TArray,]
7418-
ifftn: ifftn[TArray,]
7419-
rfft: rfft[TArray,]
7420-
irfft: irfft[TArray,]
7421-
rfftn: rfftn[TArray,]
7422-
irfftn: irfftn[TArray,]
7423-
hfft: hfft[TArray,]
7424-
ihfft: ihfft[TArray,]
7425-
fftfreq: fftfreq[TArray, TDevice]
7426-
rfftfreq: rfftfreq[TArray, TDevice]
7427-
fftshift: fftshift[TArray,]
7428-
ifftshift: ifftshift[TArray,]
7429-
7430-
74317386
@runtime_checkable
74327387
class ArrayNamespace[TSupportsbufferprotocol, TArray: Array, TDevice, TDtype](Protocol):
74337388
astype: astype[TArray, TDtype]
@@ -7542,18 +7497,81 @@ class ArrayNamespace[TSupportsbufferprotocol, TArray: Array, TDevice, TDtype](Pr
75427497
squeeze: squeeze[TArray,]
75437498
stack: stack[TArray,]
75447499
e: float
7500+
"\nIEEE 754 floating-point representation of Euler's constant.\n\n``e = 2.71828182845904523536028747135266249775724709369995...``\n"
75457501
inf: float
7502+
"\nIEEE 754 floating-point representation of (positive) infinity.\n"
75467503
nan: float
7504+
"\nIEEE 754 floating-point representation of Not a Number (``NaN``).\n"
75477505
newaxis: float
7506+
"\nAn alias for ``None`` which is useful for indexing arrays.\n"
75487507
pi: float
7508+
"\nIEEE 754 floating-point representation of the mathematical constant ``π``.\n\n``pi = 3.1415926535897932384626433...``\n"
75497509
unique_all: unique_all[TArray,]
75507510
unique_counts: unique_counts[TArray,]
75517511
unique_inverse: unique_inverse[TArray,]
75527512
unique_values: unique_values[TArray,]
7513+
bool: float
7514+
complex128: float
7515+
complex64: float
7516+
float32: float
7517+
float64: float
7518+
int16: float
7519+
int32: float
7520+
int64: float
7521+
int8: float
7522+
uint16: float
7523+
uint32: float
7524+
uint64: float
7525+
uint8: float
7526+
Device: TDevice
7527+
7528+
7529+
@runtime_checkable
7530+
class LinalgNamespace[TArray: Array, TDtype](Protocol):
7531+
cholesky: cholesky[TArray,]
7532+
cross: cross[TArray,]
7533+
det: det[TArray,]
7534+
diagonal: diagonal[TArray,]
7535+
eigh: eigh[TArray,]
7536+
eigvalsh: eigvalsh[TArray,]
7537+
inv: inv[TArray,]
7538+
matmul: matmul[TArray,]
7539+
matrix_norm: matrix_norm[TArray,]
7540+
matrix_power: matrix_power[TArray,]
7541+
matrix_rank: matrix_rank[TArray,]
7542+
matrix_transpose: matrix_transpose[TArray,]
7543+
outer: outer[TArray,]
7544+
pinv: pinv[TArray,]
7545+
qr: qr[TArray,]
7546+
slogdet: slogdet[TArray,]
7547+
solve: solve[TArray,]
7548+
svd: svd[TArray,]
7549+
svdvals: svdvals[TArray,]
7550+
tensordot: tensordot[TArray,]
7551+
trace: trace[TArray, TDtype]
7552+
vecdot: vecdot[TArray,]
7553+
vector_norm: vector_norm[TArray,]
7554+
7555+
7556+
@runtime_checkable
7557+
class FftNamespace[TArray: Array, TDevice](Protocol):
7558+
fft: fft[TArray,]
7559+
ifft: ifft[TArray,]
7560+
fftn: fftn[TArray,]
7561+
ifftn: ifftn[TArray,]
7562+
rfft: rfft[TArray,]
7563+
irfft: irfft[TArray,]
7564+
rfftn: rfftn[TArray,]
7565+
irfftn: irfftn[TArray,]
7566+
hfft: hfft[TArray,]
7567+
ihfft: ihfft[TArray,]
7568+
fftfreq: fftfreq[TArray, TDevice]
7569+
rfftfreq: rfftfreq[TArray, TDevice]
7570+
fftshift: fftshift[TArray,]
7571+
ifftshift: ifftshift[TArray,]
7572+
7573+
7574+
@runtime_checkable
7575+
class ArrayNamespaceFull[TSupportsbufferprotocol, TArray: Array, TDevice, TDtype](ArrayNamespace[TSupportsbufferprotocol, TArray, TDevice, TDtype], Protocol):
75537576
linalg: LinalgNamespace[TArray, TDtype]
75547577
fft: FftNamespace[TArray, TDevice]
7555-
"\nIEEE 754 floating-point representation of Euler's constant.\n\n``e = 2.71828182845904523536028747135266249775724709369995...``\n"
7556-
"\nIEEE 754 floating-point representation of (positive) infinity.\n"
7557-
"\nIEEE 754 floating-point representation of Not a Number (``NaN``).\n"
7558-
"\nAn alias for ``None`` which is useful for indexing arrays.\n"
7559-
"\nIEEE 754 floating-point representation of the mathematical constant ``π``.\n\n``pi = 3.1415926535897932384626433...``\n"

0 commit comments

Comments
 (0)