Skip to content

Commit 1b056ad

Browse files
committed
improve formatting
1 parent d4450b3 commit 1b056ad

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/array_api_stubs/_draft/data_type_functions.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,10 @@ def astype(
4747
array to cast.
4848
dtype: Union[dtype, str]
4949
desired data type or kind of data type. Supported kinds are:
50+
5051
- ``'signed integer'``: signed integer data types (e.g., ``int8``, ``int16``, ``int32``, ``int64``).
5152
- ``'complex floating'``: complex floating-point data types (e.g., ``complex64``, ``complex128``).
53+
5254
copy: bool
5355
specifies whether to copy an array when the specified ``dtype`` matches the data type of the input array ``x``. If ``True``, a newly allocated array must always be returned. If ``False`` and the specified ``dtype`` matches the data type of the input array, the input array must be returned; otherwise, a newly allocated array must be returned. Default: ``True``.
5456
device: Optional[device]
@@ -59,11 +61,11 @@ def astype(
5961
out: array
6062
For ``dtype`` a data type, an array having the specified data type.
6163
For ``dtype`` a kind of data type:
64+
6265
- If ``x.dtype`` is already of that kind, the data type must be maintained.
6366
- Otherwise, ``x`` should be cast to a data type of that kind, according to the type promotion rules (see :ref:`type-promotion`) and the above notes.
64-
65-
- Kinds must be interpreted as the lowest-precision standard data type of that kind for the purposes of type promotion. For example, ``astype(x, 'complex floating')`` will return an array with the data type ``complex64`` when ``x.dtype`` is ``float32``, since ``complex64`` is the result of promoting ``float32`` with the lowest-precision standard complex data type, ``complex64``.
66-
- Where type promotion is unspecified and thus implementation-specific, the result is also unspecified. For example, ``astype(x, 'complex floating')``, where ``x`` has data type ``int32``.
67+
- Kinds must be interpreted as the lowest-precision standard data type of that kind for the purposes of type promotion. For example, ``astype(x, 'complex floating')`` will return an array with the data type ``complex64`` when ``x.dtype`` is ``float32``, since ``complex64`` is the result of promoting ``float32`` with the lowest-precision standard complex data type, ``complex64``.
68+
- Where type promotion is unspecified and thus implementation-specific, the result is also unspecified. For example, ``astype(x, 'complex floating')``, where ``x`` has data type ``int32``.
6769
6870
The returned array must have the same shape as ``x``.
6971

0 commit comments

Comments
 (0)