Skip to content

Commit af51eb5

Browse files
committed
Move from_binsparse to sparse submodule.
1 parent e0d4d28 commit af51eb5

File tree

4 files changed

+31
-26
lines changed

4 files changed

+31
-26
lines changed

spec/draft/extensions/sparse_interchange.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Extension name and usage
1010

1111
If implemented, this extension must be retrievable via::
1212

13-
>>> if hasattr(x, '__dlpack__'):
13+
>>> if hasattr(x, 'sparse'):
1414
>>> # Use the extension
1515

1616
Objects in API
@@ -28,7 +28,7 @@ functions/methods.
2828
:toctree: generated
2929
:template: method.rst
3030

31-
from_binsparse
31+
sparse.from_binsparse
3232

3333

3434
.. autosummary::

src/array_api_stubs/_draft/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
from .utility_functions import *
1717
from . import linalg
1818
from . import fft
19+
from . import sparse
1920
from .info import __array_namespace_info__
2021

2122

src/array_api_stubs/_draft/creation_functions.py

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
"empty",
55
"empty_like",
66
"eye",
7-
"from_binsparse",
87
"from_dlpack",
98
"full",
109
"full_like",
@@ -646,26 +645,3 @@ def zeros_like(
646645
out: array
647646
an array having the same shape as ``x`` and filled with zeros.
648647
"""
649-
650-
651-
def from_binsparse(arrays: dict[str, array], descriptor: dict, /) -> array:
652-
"""
653-
Returns a new array containing the data from another (array) object with a ``__binsparse__`` method.
654-
655-
Parameters
656-
----------
657-
arrays: dict[str, array]
658-
input constituent arrays.
659-
descriptor: dict
660-
the parsed binsparse descriptor of the array.
661-
662-
Returns
663-
-------
664-
out: array
665-
an array containing the data in `arrays` with a format specified by `descriptor`.
666-
667-
.. admonition:: Note
668-
:class: note
669-
670-
The returned array may be either a copy or a view. See :ref:`data-interchange` for details.
671-
"""
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
from __future__ import annotations
2+
3+
from ._types import array
4+
5+
__all__ = ["from_binsparse"]
6+
7+
8+
def from_binsparse(arrays: dict[str, array], descriptor: dict, /) -> array:
9+
"""
10+
Returns a new array containing the data from another (array) object with a ``__binsparse__`` method.
11+
12+
Parameters
13+
----------
14+
arrays: dict[str, array]
15+
input constituent arrays.
16+
descriptor: dict
17+
The parsed binsparse descriptor of the array.
18+
19+
Returns
20+
-------
21+
out: array
22+
an array containing the data in `arrays` with a format specified by `descriptor`.
23+
24+
.. admonition:: Note
25+
:class: note
26+
27+
The returned array may be either a copy or a view. See :ref:`data-interchange` for details.
28+
"""

0 commit comments

Comments
 (0)