Skip to content

Commit 4d74ba2

Browse files
committed
clean up
1 parent abf8275 commit 4d74ba2

5 files changed

Lines changed: 2 additions & 52 deletions

File tree

array_api_strict/_array_object.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,6 @@
4545
from ._typing import PyCapsule
4646

4747

48-
49-
5048
class Array:
5149
"""
5250
n-d array object for the array API namespace.

array_api_strict/_creation_functions.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ class Undef(Enum):
2727

2828
def _check_valid_dtype(dtype: DType | None, device: Device | None = None) -> None:
2929
# Note: Only spelling dtypes as the dtype objects is supported.
30-
3130
if dtype is not None:
3231
if dtype not in _all_dtypes:
3332
raise ValueError(f"dtype must be one of the supported dtypes, got {dtype!r}")
@@ -37,11 +36,9 @@ def _check_valid_dtype(dtype: DType | None, device: Device | None = None) -> Non
3736
raise ValueError(f"Device {device!r} does not support dtype={dtype!r}.")
3837
return dtype
3938
else:
40-
# if dtype=None, return the default for the device
39+
# TODO if dtype=None, return the default for the device
4140
_device = CPU_DEVICE if device is None else device
42-
43-
return
44-
41+
return dtype # FIXME
4542

4643
def _supports_buffer_protocol(obj: object) -> TypeIs[SupportsBufferProtocol]:
4744
try:

array_api_strict/_devices.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
from ._dtypes import DType, float64, complex128
44
from ._dtypes import (
5-
# _kind_to_dtypes,
65
_all_dtypes, _boolean_dtypes, _signed_integer_dtypes,
76
_unsigned_integer_dtypes, _integer_dtypes, _real_floating_dtypes,
87
_complex_floating_dtypes, _numeric_dtypes
@@ -94,7 +93,6 @@ def _map_helper(dtypes: list[DType], device: Device) -> dict[str, DType]:
9493
}
9594
_device_dtype_maps[device] = _map
9695

97-
###breakpoint()
9896

9997

10098
'''

array_api_strict/_dtypes.py

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -141,48 +141,6 @@ def _np_dtype(dtype: DType | None) -> np.dtype[Any] | None:
141141

142142
_real_to_complex_map = {float32: complex64, float64: complex128}
143143

144-
145-
146-
147-
'''
148-
_kind_to_dtypes = {
149-
None: {x._canonic_name:x for x in _all_dtypes},
150-
"bool": {"bool": bool},
151-
"signed integer": {x._canonic_name: x for x in _signed_integer_dtypes},
152-
"unsigned integer": {x._canonic_name: x for x in _unsigned_integer_dtypes},
153-
"integral": {x._canonic_name: x for x in _integer_dtypes},
154-
"real floating": {x._canonic_name: x for x in _real_floating_dtypes},
155-
"complex floating": {x._canonic_name: x for x in _complex_floating_dtypes},
156-
"numeric": {x._canonic_name: x for x in _numeric_dtypes}
157-
}
158-
'''
159-
160-
'''
161-
def _kind_to_dtypes(kind : str | None = None) -> dict[str, ...]:
162-
"""A helper for Device / _info.dtypes().
163-
164-
The `kind`s here are those _info.dtypes() accepts. Which differs from
165-
"categories" above, yes.
166-
"""
167-
if kind is None:
168-
return {x._canonic_name:x for x in dt._all_dtypes}
169-
if kind == "bool":
170-
return {"bool": dt.bool}
171-
if kind == "signed integer":
172-
return {x._canonic_name: x for x in dt._signed_integer_dtypes}
173-
if kind == "unsigned integer":
174-
return {x._canonic_name: x for x in dt._unsigned_integer_dtypes}
175-
if kind == "integral":
176-
return {x._canonic_name: x for x in dt._integer_dtypes}
177-
if kind == "real floating":
178-
return {x._canonic_name: x for x in dt._real_floating_dtypes}
179-
if kind == "complex floating":
180-
return {x._canonic_name: x for x in dt._complex_floating_dtypes}
181-
if kind == "numeric":
182-
return {x._canonic_name: x for x in dt._numeric_dtypes}
183-
raise ValueError(f"unsupported kind: {kind!r}")
184-
'''
185-
186144
# Note: the spec defines a restricted type promotion table compared to NumPy.
187145
# In particular, cross-kind promotions like integer + float or boolean +
188146
# integer are not allowed, even for functions that accept both kinds.

array_api_strict/_info.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ def default_dtypes(
5050

5151
@requires_api_version('2023.12')
5252
def dtypes(
53-
5453
self,
5554
*,
5655
device: Device | None = None,

0 commit comments

Comments
 (0)