Skip to content

Commit c532a35

Browse files
authored
Remove backend kwarg from asarray. (#655)
1 parent 8593034 commit c532a35

File tree

2 files changed

+1
-19
lines changed

2 files changed

+1
-19
lines changed

sparse/pydata_backend/_common.py

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2004,7 +2004,7 @@ def format_to_string(format):
20042004
raise ValueError(f"invalid format: {format}")
20052005

20062006

2007-
def asarray(obj, /, *, dtype=None, format="coo", backend="pydata", device=None, copy=False):
2007+
def asarray(obj, /, *, dtype=None, format="coo", device=None, copy=False):
20082008
"""
20092009
Convert the input to a sparse array.
20102010
@@ -2016,8 +2016,6 @@ def asarray(obj, /, *, dtype=None, format="coo", backend="pydata", device=None,
20162016
Output array data type.
20172017
format : str, optional
20182018
Output array sparse format.
2019-
backend : str, optional
2020-
Backend for the output array.
20212019
device : str, optional
20222020
Device on which to place the created array.
20232021
copy : bool, optional
@@ -2038,18 +2036,12 @@ def asarray(obj, /, *, dtype=None, format="coo", backend="pydata", device=None,
20382036
if format not in {"coo", "dok", "gcxs"}:
20392037
raise ValueError(f"{format} format not supported.")
20402038

2041-
if backend not in {"pydata", "taco"}:
2042-
raise ValueError(f"{backend} backend not supported.")
2043-
20442039
from ._compressed import GCXS
20452040
from ._coo import COO
20462041
from ._dok import DOK
20472042

20482043
format_dict = {"coo": COO, "dok": DOK, "gcxs": GCXS}
20492044

2050-
if backend == "taco":
2051-
raise ValueError("Taco not yet supported.")
2052-
20532045
if isinstance(obj, (COO, DOK, GCXS)):
20542046
return obj.asformat(format)
20552047

sparse/pydata_backend/tests/test_array_function.py

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -132,13 +132,3 @@ def test_asarray(self, input, dtype, format):
132132
expected = input.todense() if hasattr(input, "todense") else np.asarray(input)
133133

134134
np.testing.assert_equal(actual, expected)
135-
136-
def test_asarray_special_cases(self):
137-
with pytest.raises(ValueError, match="Taco not yet supported."):
138-
sparse.asarray(self.np_eye, backend="taco")
139-
140-
with pytest.raises(ValueError, match="any backend not supported."):
141-
sparse.asarray(self.np_eye, backend="any")
142-
143-
with pytest.raises(ValueError, match="any format not supported."):
144-
sparse.asarray(self.np_eye, format="any")

0 commit comments

Comments
 (0)