Skip to content

Commit 012f9c1

Browse files
committed
Dtype -> DType
1 parent 21bbf5d commit 012f9c1

File tree

12 files changed

+57
-57
lines changed

12 files changed

+57
-57
lines changed

array_api_compat/common/_aliases.py

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
from typing import Any, NamedTuple, Optional, Sequence, Tuple, Union
99

1010
from ._helpers import array_namespace, _check_device, device, is_torch_array, is_cupy_namespace
11-
from ._typing import Array, Device, Dtype, Namespace
11+
from ._typing import Array, Device, DType, Namespace
1212

1313
# These functions are modified from the NumPy versions.
1414

@@ -21,7 +21,7 @@ def arange(
2121
step: Union[int, float] = 1,
2222
*,
2323
xp: Namespace,
24-
dtype: Optional[Dtype] = None,
24+
dtype: Optional[DType] = None,
2525
device: Optional[Device] = None,
2626
**kwargs,
2727
) -> Array:
@@ -32,7 +32,7 @@ def empty(
3232
shape: Union[int, Tuple[int, ...]],
3333
xp: Namespace,
3434
*,
35-
dtype: Optional[Dtype] = None,
35+
dtype: Optional[DType] = None,
3636
device: Optional[Device] = None,
3737
**kwargs,
3838
) -> Array:
@@ -44,7 +44,7 @@ def empty_like(
4444
/,
4545
xp: Namespace,
4646
*,
47-
dtype: Optional[Dtype] = None,
47+
dtype: Optional[DType] = None,
4848
device: Optional[Device] = None,
4949
**kwargs,
5050
) -> Array:
@@ -58,7 +58,7 @@ def eye(
5858
*,
5959
xp: Namespace,
6060
k: int = 0,
61-
dtype: Optional[Dtype] = None,
61+
dtype: Optional[DType] = None,
6262
device: Optional[Device] = None,
6363
**kwargs,
6464
) -> Array:
@@ -70,7 +70,7 @@ def full(
7070
fill_value: Union[int, float],
7171
xp: Namespace,
7272
*,
73-
dtype: Optional[Dtype] = None,
73+
dtype: Optional[DType] = None,
7474
device: Optional[Device] = None,
7575
**kwargs,
7676
) -> Array:
@@ -83,7 +83,7 @@ def full_like(
8383
fill_value: Union[int, float],
8484
*,
8585
xp: Namespace,
86-
dtype: Optional[Dtype] = None,
86+
dtype: Optional[DType] = None,
8787
device: Optional[Device] = None,
8888
**kwargs,
8989
) -> Array:
@@ -97,7 +97,7 @@ def linspace(
9797
num: int,
9898
*,
9999
xp: Namespace,
100-
dtype: Optional[Dtype] = None,
100+
dtype: Optional[DType] = None,
101101
device: Optional[Device] = None,
102102
endpoint: bool = True,
103103
**kwargs,
@@ -109,7 +109,7 @@ def ones(
109109
shape: Union[int, Tuple[int, ...]],
110110
xp: Namespace,
111111
*,
112-
dtype: Optional[Dtype] = None,
112+
dtype: Optional[DType] = None,
113113
device: Optional[Device] = None,
114114
**kwargs,
115115
) -> Array:
@@ -121,7 +121,7 @@ def ones_like(
121121
/,
122122
xp: Namespace,
123123
*,
124-
dtype: Optional[Dtype] = None,
124+
dtype: Optional[DType] = None,
125125
device: Optional[Device] = None,
126126
**kwargs,
127127
) -> Array:
@@ -132,7 +132,7 @@ def zeros(
132132
shape: Union[int, Tuple[int, ...]],
133133
xp: Namespace,
134134
*,
135-
dtype: Optional[Dtype] = None,
135+
dtype: Optional[DType] = None,
136136
device: Optional[Device] = None,
137137
**kwargs,
138138
) -> Array:
@@ -144,7 +144,7 @@ def zeros_like(
144144
/,
145145
xp: Namespace,
146146
*,
147-
dtype: Optional[Dtype] = None,
147+
dtype: Optional[DType] = None,
148148
device: Optional[Device] = None,
149149
**kwargs,
150150
) -> Array:
@@ -279,7 +279,7 @@ def cumulative_sum(
279279
xp: Namespace,
280280
*,
281281
axis: Optional[int] = None,
282-
dtype: Optional[Dtype] = None,
282+
dtype: Optional[DType] = None,
283283
include_initial: bool = False,
284284
**kwargs,
285285
) -> Array:
@@ -310,7 +310,7 @@ def cumulative_prod(
310310
xp: Namespace,
311311
*,
312312
axis: Optional[int] = None,
313-
dtype: Optional[Dtype] = None,
313+
dtype: Optional[DType] = None,
314314
include_initial: bool = False,
315315
**kwargs,
316316
) -> Array:
@@ -537,8 +537,8 @@ def vecdot(x1: Array, x2: Array, /, xp: Namespace, *, axis: int = -1) -> Array:
537537
# isdtype is a new function in the 2022.12 array API specification.
538538

539539
def isdtype(
540-
dtype: Dtype,
541-
kind: Union[Dtype, str, Tuple[Union[Dtype, str], ...]],
540+
dtype: DType,
541+
kind: Union[DType, str, Tuple[Union[DType, str], ...]],
542542
xp: Namespace,
543543
*,
544544
_tuple: bool = True, # Disallow nested tuples

array_api_compat/common/_fft.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from collections.abc import Sequence
44
from typing import Union, Optional, Literal
55

6-
from ._typing import Device, Array, Dtype, Namespace
6+
from ._typing import Device, Array, DType, Namespace
77

88
# Note: NumPy fft functions improperly upcast float32 and complex64 to
99
# complex128, which is why we require wrapping them all here.
@@ -154,7 +154,7 @@ def fftfreq(
154154
xp: Namespace,
155155
*,
156156
d: float = 1.0,
157-
dtype: Optional[Dtype] = None,
157+
dtype: Optional[DType] = None,
158158
device: Optional[Device] = None,
159159
) -> Array:
160160
if device not in ["cpu", None]:
@@ -170,7 +170,7 @@ def rfftfreq(
170170
xp: Namespace,
171171
*,
172172
d: float = 1.0,
173-
dtype: Optional[Dtype] = None,
173+
dtype: Optional[DType] = None,
174174
device: Optional[Device] = None,
175175
) -> Array:
176176
if device not in ["cpu", None]:

array_api_compat/common/_typing.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44

55
__all__ = [
66
"Array",
7+
"DType",
78
"Device",
8-
"Dtype",
99
"Namespace",
1010
"NestedSequence",
1111
"SupportsBufferProtocol",
@@ -22,5 +22,5 @@ def __len__(self, /) -> int: ...
2222

2323
Array = Any
2424
Device = Any
25-
Dtype = Any
25+
DType = Any
2626
Namespace = ModuleType

array_api_compat/cupy/_aliases.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
from ..common._typing import NestedSequence, SupportsBufferProtocol
99
from .._internal import get_xp
1010
from ._info import __array_namespace_info__
11-
from ._typing import Array, Device, Dtype
11+
from ._typing import Array, Device, DType
1212

1313
bool = cp.bool_
1414

@@ -77,7 +77,7 @@ def asarray(
7777
],
7878
/,
7979
*,
80-
dtype: Optional[Dtype] = None,
80+
dtype: Optional[DType] = None,
8181
device: Optional[Device] = None,
8282
copy: Optional[bool] = _copy_default,
8383
**kwargs,
@@ -112,7 +112,7 @@ def asarray(
112112

113113
def astype(
114114
x: Array,
115-
dtype: Dtype,
115+
dtype: DType,
116116
/,
117117
*,
118118
copy: bool = True,

array_api_compat/cupy/_typing.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from __future__ import annotations
22

3-
__all__ = ["Array", "Device", "Dtype"]
3+
__all__ = ["Array", "DType", "Device"]
44
_all_ignore = ["cp"]
55

66
from typing import Union
@@ -10,7 +10,7 @@
1010
from cupy.cuda.device import Device
1111

1212
try:
13-
Dtype = cp.dtype[
13+
DType = cp.dtype[
1414
Union[
1515
cp.intp,
1616
cp.int8,
@@ -30,4 +30,4 @@
3030
]
3131
except TypeError:
3232
# NumPy 1.x on Python 3.9 and 3.10
33-
Dtype = cp.dtype
33+
DType = cp.dtype

array_api_compat/dask/array/_aliases.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
import numpy as np
66
from numpy import (
7-
# Dtypes
7+
# dtypes
88
iinfo,
99
finfo,
1010
bool_ as bool,
@@ -29,7 +29,7 @@
2929
from ...common._typing import (
3030
Array,
3131
Device,
32-
Dtype,
32+
DType,
3333
NestedSequence,
3434
SupportsBufferProtocol,
3535
)
@@ -43,7 +43,7 @@
4343
# da.astype doesn't respect copy=True
4444
def astype(
4545
x: Array,
46-
dtype: Dtype,
46+
dtype: DType,
4747
/,
4848
*,
4949
copy: bool = True,
@@ -75,7 +75,7 @@ def arange(
7575
stop: Optional[Union[int, float]] = None,
7676
step: Union[int, float] = 1,
7777
*,
78-
dtype: Optional[Dtype] = None,
78+
dtype: Optional[DType] = None,
7979
device: Optional[Device] = None,
8080
**kwargs,
8181
) -> Array:
@@ -146,7 +146,7 @@ def asarray(
146146
],
147147
/,
148148
*,
149-
dtype: Optional[Dtype] = None,
149+
dtype: Optional[DType] = None,
150150
device: Optional[Device] = None,
151151
copy: Optional[Union[bool, np._CopyMode]] = None,
152152
**kwargs,

array_api_compat/numpy/_aliases.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from ..common import _aliases
77
from ..common._typing import NestedSequence, SupportsBufferProtocol
88
from ._info import __array_namespace_info__
9-
from ._typing import Array, Device, Dtype
9+
from ._typing import Array, Device, DType
1010

1111
import numpy as np
1212
bool = np.bool_
@@ -84,7 +84,7 @@ def asarray(
8484
],
8585
/,
8686
*,
87-
dtype: Optional[Dtype] = None,
87+
dtype: Optional[DType] = None,
8888
device: Optional[Device] = None,
8989
copy: "Optional[Union[bool, np._CopyMode]]" = None,
9090
**kwargs,
@@ -116,7 +116,7 @@ def asarray(
116116

117117
def astype(
118118
x: Array,
119-
dtype: Dtype,
119+
dtype: DType,
120120
/,
121121
*,
122122
copy: bool = True,

array_api_compat/numpy/_typing.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from __future__ import annotations
22

3-
__all__ = ["Array", "Device", "Dtype"]
3+
__all__ = ["Array", "DType", "Device"]
44
_all_ignore = ["np"]
55

66
from typing import Literal, Union
@@ -10,7 +10,7 @@
1010

1111
Device = Literal["cpu"]
1212
try:
13-
Dtype = np.dtype[
13+
DType = np.dtype[
1414
Union[
1515
np.intp,
1616
np.int8,
@@ -30,4 +30,4 @@
3030
]
3131
except TypeError:
3232
# NumPy 1.x on Python 3.9 and 3.10
33-
Dtype = np.dtype
33+
DType = np.dtype

0 commit comments

Comments
 (0)