-
Notifications
You must be signed in to change notification settings - Fork 53
PR: Transform sorting functions from md to rst file #333
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 4 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
b8a3ff1
Transform sorting functions from md to rst file
steff456 61836cb
Fix the warning message
steff456 96e2c37
Add autosummary with signatures for the sorting functions
steff456 58f3984
Bump CI python to 3.8
steff456 31d01f0
Complete signatures and add types files
steff456 2bb72cc
Remove module names and add autodoc typehints
steff456 bdf41eb
Bump Sphinx version
steff456 3bd71a9
Remove module import from signature and return annonation
steff456 7c80b2c
Add jinja template for autosummary
steff456 5b1ec76
Put return section style as parameters and remove return type section
steff456 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,5 @@ spec/_build/ | |
build/ | ||
.vscode/ | ||
node_modules/ | ||
__pycache__/ | ||
*.pyc |
Empty file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
def argsort(x, /, *, axis:int = -1, descending:bool = False, stable:bool = True): | ||
""" | ||
Returns the indices that sort an array ``x`` along a specified axis. | ||
|
||
Parameters | ||
---------- | ||
x : array | ||
input array. | ||
axis: int | ||
axis along which to sort. If set to ``-1``, the function must sort along the last axis. Default: ``-1``. | ||
descending: bool | ||
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``. | ||
stable: bool | ||
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``. | ||
|
||
Returns | ||
------- | ||
out: array | ||
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. | ||
""" | ||
pass | ||
steff456 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
def sort(x, /, *, axis:int = -1, descending:bool = False, stable: bool = True): | ||
""" | ||
Returns a sorted copy of an input array ``x``. | ||
|
||
Parameters | ||
---------- | ||
x: array | ||
input array. | ||
axis: int | ||
axis along which to sort. If set to ``-1``, the function must sort along the last axis. Default: ``-1``. | ||
descending: bool | ||
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``. | ||
stable: bool | ||
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``. | ||
|
||
Returns | ||
------- | ||
out: array | ||
a sorted array. The returned array must have the same data type and shape as ``x``. | ||
""" | ||
pass |
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
Sorting Functions | ||
================= | ||
|
||
Array API specification for sorting functions. | ||
|
||
A conforming implementation of the array API standard must provide and support the following functions adhering to the following conventions. | ||
|
||
* Positional parameters must be `positional-only <https://www.python.org/dev/peps/pep-0570/>`_ parameters. Positional-only parameters have no externally-usable name. When a function accepting positional-only parameters is called, positional arguments are mapped to these parameters based solely on their order. | ||
* Optional parameters must be `keyword-only <https://www.python.org/dev/peps/pep-3102/>`_ arguments. | ||
* Unless stated otherwise, functions must support the data types defined in :ref:`data-types`. | ||
|
||
.. note:: | ||
|
||
For floating-point input arrays, the sort order of NaNs and signed zeros is unspecified and thus implementation-dependent. | ||
|
||
Implementations may choose to sort signed zeros (``-0 < +0``) or may choose to rely solely on value equality (``==``). | ||
|
||
Implementations may choose to sort NaNs (e.g., to the end or to the beginning of a returned array) or leave them in-place. Should an implementation sort NaNs, the sorting convention should be clearly documented in the conforming implementation's documentation. | ||
|
||
While defining a sort order for IEEE 754 floating-point numbers is recommended in order to facilitate reproducible and consistent sort results, doing so is not currently required by this specification. | ||
|
||
.. currentmodule:: signatures._sorting_functions | ||
|
||
Objects in API | ||
-------------- | ||
.. | ||
NOTE: please keep the functions in alphabetical order | ||
|
||
.. autosummary:: | ||
:toctree: generated | ||
|
||
argsort | ||
sort |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.