Skip to content

Commit fbea9d7

Browse files
committed
Improved type hints [skip ci]
1 parent 03dd0e0 commit fbea9d7

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

pgvector/bit.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66

77
class Bit:
8-
def __init__(self, value: object) -> None:
8+
def __init__(self, value: bytes | str | list[bool] | tuple[bool, ...] | np.ndarray) -> None:
99
if isinstance(value, bytes):
1010
self._len = 8 * len(value)
1111
self._data = value

tests/test_bit.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@ def test_list(self):
99

1010
def test_list_none(self):
1111
with pytest.warns(UserWarning, match='expected elements to be boolean'):
12-
assert Bit([True, None, True]).to_text() == '101'
12+
assert Bit([True, None, True]).to_text() == '101' # ty: ignore[invalid-argument-type]
1313

1414
def test_list_int(self):
1515
with pytest.warns(UserWarning, match='expected elements to be boolean'):
16-
assert Bit([254, 7, 0]).to_text() == '110'
16+
assert Bit([254, 7, 0]).to_text() == '110' # ty: ignore[invalid-argument-type]
1717

1818
def test_tuple(self):
1919
assert Bit((True, False, True)).to_list() == [True, False, True]
@@ -46,12 +46,12 @@ def test_ndarray_uint16(self):
4646

4747
def test_ndim_two(self):
4848
with pytest.raises(ValueError) as error:
49-
Bit([[True, False], [True, False]])
49+
Bit([[True, False], [True, False]]) # ty: ignore[invalid-argument-type]
5050
assert str(error.value) == 'expected ndim to be 1'
5151

5252
def test_ndim_zero(self):
5353
with pytest.raises(ValueError) as error:
54-
Bit(True)
54+
Bit(True) # ty: ignore[invalid-argument-type]
5555
assert str(error.value) == 'expected ndim to be 1'
5656

5757
def test_repr(self):

0 commit comments

Comments
 (0)