Skip to content

Commit e52f6ba

Browse files
authored
docs: move notes below the fold and highlight RFC 2119 keywords
PR-URL: #939 Ref: #397
1 parent c1e18bb commit e52f6ba

File tree

1 file changed

+23
-19
lines changed

1 file changed

+23
-19
lines changed

src/array_api_stubs/_draft/sorting_functions.py

Lines changed: 23 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -10,24 +10,26 @@ def argsort(
1010
"""
1111
Returns the indices that sort an array ``x`` along a specified axis.
1212
13-
.. note::
14-
For backward compatibility, conforming implementations may support complex numbers; however, inequality comparison of complex numbers is unspecified and thus implementation-dependent (see :ref:`complex-number-ordering`).
15-
1613
Parameters
1714
----------
18-
x : array
19-
input array. Should have a real-valued data type.
15+
x: array
16+
input array. **Should** have a real-valued data type.
2017
axis: int
21-
axis along which to sort. If set to ``-1``, the function must sort along the last axis. Default: ``-1``.
18+
axis along which to sort. A valid axis **must** be an integer on the interval ``[-N, N)``, where ``N`` is the number of axes in ``x``. If an axis is specified as a negative integer, the function **must** determine the axis along which to perform the operation by counting backward from the last axis (where ``-1`` refers to the last axis). If provided an invalid axis, the function **must** raise an exception. Default: ``-1``.
2219
descending: bool
23-
sort order. If ``True``, the returned indices sort ``x`` in descending order (by value). If ``False``, the returned indices sort ``x`` in ascending order (by value). Default: ``False``.
20+
sort order. If ``True``, the returned indices **must** sort ``x`` in descending order (by value). If ``False``, the returned indices **must** sort ``x`` in ascending order (by value). Default: ``False``.
2421
stable: bool
25-
sort stability. If ``True``, the returned indices must maintain the relative order of ``x`` values which compare as equal. If ``False``, the returned indices may or may not maintain the relative order of ``x`` values which compare as equal (i.e., the relative order of ``x`` values which compare as equal is implementation-dependent). Default: ``True``.
22+
sort stability. If ``True``, the returned indices **must** maintain the relative order of ``x`` values which compare as equal. If ``False``, the returned indices **may** maintain the relative order of ``x`` values which compare as equal (i.e., the relative order of ``x`` values which compare as equal is implementation-dependent). Default: ``True``.
2623
2724
Returns
2825
-------
29-
out : array
30-
an array of indices. The returned array must have the same shape as ``x``. The returned array must have the default array index data type.
26+
out: array
27+
an array of indices. The returned array **must** have the same shape as ``x``. The returned array **must** have the default array index data type.
28+
29+
Notes
30+
-----
31+
32+
- For backward compatibility, conforming implementations **may** support complex numbers; however, inequality comparison of complex numbers is unspecified and thus implementation-dependent (see :ref:`complex-number-ordering`).
3133
"""
3234

3335

@@ -37,22 +39,24 @@ def sort(
3739
"""
3840
Returns a sorted copy of an input array ``x``.
3941
40-
.. note::
41-
For backward compatibility, conforming implementations may support complex numbers; however, inequality comparison of complex numbers is unspecified and thus implementation-dependent (see :ref:`complex-number-ordering`).
42-
4342
Parameters
4443
----------
4544
x: array
46-
input array. Should have a real-valued data type.
45+
input array. **Should** have a real-valued data type.
4746
axis: int
48-
axis along which to sort. If set to ``-1``, the function must sort along the last axis. Default: ``-1``.
47+
axis along which to sort. A valid axis **must** be an integer on the interval ``[-N, N)``, where ``N`` is the number of axes in ``x``. If an axis is specified as a negative integer, the function **must** determine the axis along which to perform the operation by counting backward from the last axis (where ``-1`` refers to the last axis). If provided an invalid axis, the function **must** raise an exception. Default: ``-1``.
4948
descending: bool
50-
sort order. If ``True``, the array must be sorted in descending order (by value). If ``False``, the array must be sorted in ascending order (by value). Default: ``False``.
49+
sort order. If ``True``, the array **must** be sorted in descending order (by value). If ``False``, the array **must** be sorted in ascending order (by value). Default: ``False``.
5150
stable: bool
52-
sort stability. If ``True``, the returned array must maintain the relative order of ``x`` values which compare as equal. If ``False``, the returned array may or may not maintain the relative order of ``x`` values which compare as equal (i.e., the relative order of ``x`` values which compare as equal is implementation-dependent). Default: ``True``.
51+
sort stability. If ``True``, the returned array **must** maintain the relative order of ``x`` values which compare as equal. If ``False``, the returned array **may** maintain the relative order of ``x`` values which compare as equal (i.e., the relative order of ``x`` values which compare as equal is implementation-dependent). Default: ``True``.
5352
5453
Returns
5554
-------
56-
out : array
57-
a sorted array. The returned array must have the same data type and shape as ``x``.
55+
out: array
56+
a sorted array. The returned array **must** have the same data type and shape as ``x``.
57+
58+
Notes
59+
-----
60+
61+
- For backward compatibility, conforming implementations **may** support complex numbers; however, inequality comparison of complex numbers is unspecified and thus implementation-dependent (see :ref:`complex-number-ordering`).
5862
"""

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy