Skip to content

Commit 08a73cd

Browse files
committed
Removed support for array from from_coordinates [skip ci]
1 parent df3427d commit 08a73cd

File tree

2 files changed

+1
-4
lines changed

2 files changed

+1
-4
lines changed

pgvector/utils/sparsevec.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,7 @@ def __repr__(self):
1414

1515
@classmethod
1616
def from_coordinates(cls, coordinates, dim):
17-
if isinstance(coordinates, dict):
18-
coordinates = coordinates.items()
19-
elements = [(i, v) for i, v in coordinates]
17+
elements = [(i, v) for i, v in coordinates.items()]
2018
elements.sort()
2119
indices = [int(v[0]) for v in elements]
2220
values = [float(v[1]) for v in elements]

tests/test_sparse_vector.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ def test_from_dense(self):
1010

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

1514
def test_repr(self):
1615
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)