Skip to content

Commit 410b02c

Browse files
committed
Improved type comments [skip ci]
1 parent d90ad1b commit 410b02c

6 files changed

Lines changed: 16 additions & 16 deletions

File tree

‎pgvector/halfvec.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ def _to_db(cls, value: object) -> str | None:
7676
return value
7777

7878
if not isinstance(value, cls):
79-
value = cls(value) # ty: ignore[invalid-argument-type]
79+
value = cls(value) # type: ignore
8080

8181
return value.to_text()
8282

@@ -86,7 +86,7 @@ def _to_db_binary(cls, value: object) -> bytes | None:
8686
return value
8787

8888
if not isinstance(value, cls):
89-
value = cls(value) # ty: ignore[invalid-argument-type]
89+
value = cls(value) # type: ignore
9090

9191
return value.to_binary()
9292

‎pgvector/vector.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ def _to_db(cls, value: object) -> str | None:
7676
return value
7777

7878
if not isinstance(value, cls):
79-
value = cls(value) # ty: ignore[invalid-argument-type]
79+
value = cls(value) # type: ignore
8080

8181
return value.to_text()
8282

@@ -86,7 +86,7 @@ def _to_db_binary(cls, value: object) -> bytes | None:
8686
return value
8787

8888
if not isinstance(value, cls):
89-
value = cls(value) # ty: ignore[invalid-argument-type]
89+
value = cls(value) # type: ignore
9090

9191
return value.to_binary()
9292

‎tests/test_bit.py‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,17 @@ def test_list(self):
1515

1616
def test_list_none(self):
1717
with pytest.raises(ValueError) as error:
18-
Bit([True, None, True]) # ty: ignore[invalid-argument-type]
18+
Bit([True, None, True]) # type: ignore
1919
assert str(error.value) == 'expected list[bool]'
2020

2121
def test_list_int(self):
2222
with pytest.raises(ValueError) as error:
23-
Bit([254, 7, 0]) # ty: ignore[invalid-argument-type]
23+
Bit([254, 7, 0]) # type: ignore
2424
assert str(error.value) == 'expected list[bool]'
2525

2626
def test_list_list(self):
2727
with pytest.raises(ValueError) as error:
28-
Bit([[True, False], [True, False]]) # ty: ignore[invalid-argument-type]
28+
Bit([[True, False], [True, False]]) # type: ignore
2929
assert str(error.value) == 'expected list[bool]'
3030

3131
def test_str(self):
@@ -67,7 +67,7 @@ def test_ndarray_uint16(self):
6767

6868
def test_bool(self):
6969
with pytest.raises(ValueError) as error:
70-
Bit(True) # ty: ignore[invalid-argument-type]
70+
Bit(True) # type: ignore
7171
assert str(error.value) == 'expected bytes, str, list, or ndarray'
7272

7373
def test_random(self):

‎tests/test_half_vector.py‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,12 @@ def test_list_empty(self):
1818

1919
def test_list_str(self):
2020
with pytest.raises(ValueError) as error:
21-
HalfVector([1, 'two', 3]) # ty: ignore[invalid-argument-type]
21+
HalfVector([1, 'two', 3]) # type: ignore
2222
assert str(error.value) == 'expected list[float]'
2323

2424
def test_list_list(self):
2525
with pytest.raises(ValueError) as error:
26-
HalfVector([[1, 2], [3, 4]]) # ty: ignore[invalid-argument-type]
26+
HalfVector([[1, 2], [3, 4]]) # type: ignore
2727
assert str(error.value) == 'expected list[float]'
2828

2929
@pytest.mark.skipif(not NUMPY_AVAILABLE, reason='NumPy required')
@@ -34,7 +34,7 @@ def test_ndarray(self):
3434

3535
def test_int(self):
3636
with pytest.raises(ValueError) as error:
37-
HalfVector(1) # ty: ignore[invalid-argument-type]
37+
HalfVector(1) # type: ignore
3838
assert str(error.value) == 'expected list or ndarray'
3939

4040
def test_repr(self):

‎tests/test_sparse_vector.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def test_list_empty(self):
2828

2929
def test_list_dimensions(self):
3030
with pytest.raises(ValueError) as error:
31-
SparseVector([1, 0, 2, 0, 3, 0], 6) # ty: ignore[invalid-argument-type]
31+
SparseVector([1, 0, 2, 0, 3, 0], 6) # type: ignore
3232
assert str(error.value) == 'extra argument'
3333

3434
@pytest.mark.skipif(not NUMPY_AVAILABLE, reason='NumPy required')
@@ -60,7 +60,7 @@ def test_coo_array(self):
6060
@pytest.mark.skipif(not SCIPY_AVAILABLE, reason='SciPy required')
6161
def test_coo_array_dimensions(self):
6262
with pytest.raises(ValueError) as error:
63-
SparseVector(coo_array(np.array([1, 0, 2, 0, 3, 0])), 6) # ty: ignore[invalid-argument-type]
63+
SparseVector(coo_array(np.array([1, 0, 2, 0, 3, 0])), 6) # type: ignore
6464
assert str(error.value) == 'extra argument'
6565

6666
@pytest.mark.skipif(not SCIPY_AVAILABLE, reason='SciPy required')

‎tests/test_vector.py‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,12 @@ def test_list_empty(self):
1818

1919
def test_list_str(self):
2020
with pytest.raises(ValueError) as error:
21-
Vector([1, 'two', 3]) # ty: ignore[invalid-argument-type]
21+
Vector([1, 'two', 3]) # type: ignore
2222
assert str(error.value) == 'expected list[float]'
2323

2424
def test_list_list(self):
2525
with pytest.raises(ValueError) as error:
26-
Vector([[1, 2], [3, 4]]) # ty: ignore[invalid-argument-type]
26+
Vector([[1, 2], [3, 4]]) # type: ignore
2727
assert str(error.value) == 'expected list[float]'
2828

2929
@pytest.mark.skipif(not NUMPY_AVAILABLE, reason='NumPy required')
@@ -34,7 +34,7 @@ def test_ndarray(self):
3434

3535
def test_int(self):
3636
with pytest.raises(ValueError) as error:
37-
Vector(1) # ty: ignore[invalid-argument-type]
37+
Vector(1) # type: ignore
3838
assert str(error.value) == 'expected list or ndarray'
3939

4040
def test_repr(self):

0 commit comments

Comments
 (0)