Skip to content

Commit 33ec0f2

Browse files
committed
Removed from_binary path from Bit constructor [skip ci]
1 parent db122fe commit 33ec0f2

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

pgvector/utils/bit.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,7 @@
44

55
class Bit:
66
def __init__(self, value):
7-
if isinstance(value, bytes):
8-
self._value = __class__.from_binary(value)._value
9-
elif isinstance(value, str):
7+
if isinstance(value, str):
108
self._value = __class__.from_text(value)._value
119
else:
1210
value = np.asarray(value, dtype=bool)

tests/test_psycopg.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,8 @@ def test_bit(self):
9191
def test_bit_binary_format(self):
9292
embedding = Bit([False, True, False, True, False, False, False, False, True])
9393
res = conn.execute('SELECT %b::bit(9)', (embedding,), binary=True).fetchone()[0]
94-
assert str(Bit(res)) == '010100001'
95-
assert repr(Bit(res)) == 'Bit(010100001)'
94+
assert str(Bit.from_binary(res)) == '010100001'
95+
assert repr(Bit.from_binary(res)) == 'Bit(010100001)'
9696

9797
def test_bit_text_format(self):
9898
embedding = Bit([False, True, False, True, False, False, False, False, True])

0 commit comments

Comments
 (0)