Skip to content

Commit c708d8f

Browse files
committed
Updated function name [skip ci]
1 parent 999af56 commit c708d8f

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

pgvector/utils/sparsevec.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ def __repr__(self):
1313
return f'SparseVector({self._dim}, {self._indices}, {self._values})'
1414

1515
@classmethod
16-
def from_coordinates(cls, coordinates, dim):
17-
elements = [(i, v) for i, v in coordinates.items()]
16+
def from_dict(cls, d, dim):
17+
elements = [(i, v) for i, v in d.items()]
1818
elements.sort()
1919
indices = [int(v[0]) for v in elements]
2020
values = [float(v[1]) for v in elements]

tests/test_sparse_vector.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ def test_from_dense(self):
1010
assert SparseVector.from_dense(np.array([1, 0, 2, 0, 3, 0])).to_list() == [1, 0, 2, 0, 3, 0]
1111

1212
def test_from_coordinates(self):
13-
assert SparseVector.from_coordinates({0: 1, 2: 2, 4: 3}, 6).to_list() == [1, 0, 2, 0, 3, 0]
13+
assert SparseVector.from_dict({0: 1, 2: 2, 4: 3}, 6).to_list() == [1, 0, 2, 0, 3, 0]
1414

1515
def test_repr(self):
1616
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)