Skip to content

Commit 550aa64

Browse files
committed
Renamed from_scipy method to from_sparse [skip ci]
1 parent 1b5dc44 commit 550aa64

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

pgvector/utils/sparsevec.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ def from_dict(cls, d, dim):
2121
return cls(dim, indices, values)
2222

2323
@classmethod
24-
def from_scipy(cls, value):
24+
def from_sparse(cls, value):
2525
value = value.tocoo()
2626

2727
if value.ndim != 1:

tests/test_sparse_vector.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ def test_from_dense(self):
1313
def test_from_coordinates(self):
1414
assert SparseVector.from_dict({0: 1, 2: 2, 4: 3}, 6).to_list() == [1, 0, 2, 0, 3, 0]
1515

16-
def test_from_scipy(self):
16+
def test_from_sparse(self):
1717
arr = coo_array(np.array([1, 0, 2, 0, 3, 0]))
18-
assert SparseVector.from_scipy(arr).to_list() == [1, 0, 2, 0, 3, 0]
19-
assert SparseVector.from_scipy(arr.todok()).to_list() == [1, 0, 2, 0, 3, 0]
18+
assert SparseVector.from_sparse(arr).to_list() == [1, 0, 2, 0, 3, 0]
19+
assert SparseVector.from_sparse(arr.todok()).to_list() == [1, 0, 2, 0, 3, 0]
2020

2121
def test_repr(self):
2222
assert repr(SparseVector.from_dense([1, 0, 2, 0, 3, 0])) == 'SparseVector(6, [0, 2, 4], [1.0, 2.0, 3.0])'

0 commit comments

Comments
 (0)