Skip to content

Commit ae0f549

Browse files
committed
Improved type hints [skip ci]
1 parent c4c46ab commit ae0f549

3 files changed

Lines changed: 3 additions & 3 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: bytes | str | list[bool] | np.ndarray) -> None:
8+
def __init__(self, value: bytes | str | list[bool] | np.ndarray[tuple[int], np.dtype[np.bool | np.uint8]]) -> None:
99
if isinstance(value, bytes):
1010
self._len = 8 * len(value)
1111
self._data = value

pgvector/halfvec.py

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

55

66
class HalfVector:
7-
def __init__(self, value: list[float] | np.ndarray) -> None:
7+
def __init__(self, value: list[float] | np.ndarray[tuple[int], np.dtype[np.floating]]) -> None:
88
# asarray still copies if same dtype
99
if not isinstance(value, np.ndarray) or value.dtype != '>f2':
1010
value = np.asarray(value, dtype='>f2')

pgvector/vector.py

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

55

66
class Vector:
7-
def __init__(self, value: list[float] | np.ndarray) -> None:
7+
def __init__(self, value: list[float] | np.ndarray[tuple[int], np.dtype[np.floating]]) -> None:
88
# asarray still copies if same dtype
99
if not isinstance(value, np.ndarray) or value.dtype != '>f4':
1010
value = np.asarray(value, dtype='>f4')

0 commit comments

Comments
 (0)