Skip to content

Commit 40ef30f

Browse files
committed
Revert "Fixed typing"
This reverts commit 57b8e24.
1 parent 57b8e24 commit 40ef30f

4 files changed

Lines changed: 12 additions & 4 deletions

File tree

‎pgvector/sqlalchemy/bit.py‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,11 @@ def process_bind_param(self, value: Any, dialect: Any) -> Any:
1414
return asyncpg.BitString(value) # type: ignore
1515
return value
1616

17-
class comparator_factory(TypeDecorator.Comparator[Any]):
17+
class Comparator(TypeDecorator.Comparator[Any]):
1818
def hamming_distance(self, other: object, /) -> Operators:
1919
return self.op('<~>', return_type=Float)(other)
2020

2121
def jaccard_distance(self, other: object, /) -> Operators:
2222
return self.op('<%>', return_type=Float)(other)
23+
24+
comparator_factory = Comparator # type: ignore

‎pgvector/sqlalchemy/halfvec.py‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ def process(value: Any) -> list[float] | None:
3535
return HalfVector._from_db(value)
3636
return process
3737

38-
class comparator_factory(TypeEngine.Comparator[Any]):
38+
class Comparator(TypeEngine.Comparator[Any]):
3939
def l2_distance(self, other: object, /) -> Operators:
4040
return self.op('<->', return_type=Float)(other)
4141

@@ -48,6 +48,8 @@ def cosine_distance(self, other: object, /) -> Operators:
4848
def l1_distance(self, other: object, /) -> Operators:
4949
return self.op('<+>', return_type=Float)(other)
5050

51+
comparator_factory = Comparator
52+
5153

5254
# for reflection
5355
ischema_names['halfvec'] = HALFVEC # type: ignore

‎pgvector/sqlalchemy/sparsevec.py‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ def process(value: Any) -> SparseVector | None:
3535
return SparseVector._from_db(value)
3636
return process
3737

38-
class comparator_factory(TypeEngine.Comparator[Any]):
38+
class Comparator(TypeEngine.Comparator[Any]):
3939
def l2_distance(self, other: object, /) -> Operators:
4040
return self.op('<->', return_type=Float)(other)
4141

@@ -48,6 +48,8 @@ def cosine_distance(self, other: object, /) -> Operators:
4848
def l1_distance(self, other: object, /) -> Operators:
4949
return self.op('<+>', return_type=Float)(other)
5050

51+
comparator_factory = Comparator
52+
5153

5254
# for reflection
5355
ischema_names['sparsevec'] = SPARSEVEC # type: ignore

‎pgvector/sqlalchemy/vector.py‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ def process(value: Any) -> list[float] | None:
3535
return Vector._from_db(value)
3636
return process
3737

38-
class comparator_factory(TypeEngine.Comparator[Any]):
38+
class Comparator(TypeEngine.Comparator[Any]):
3939
def l2_distance(self, other: object, /) -> Operators:
4040
return self.op('<->', return_type=Float)(other)
4141

@@ -48,6 +48,8 @@ def cosine_distance(self, other: object, /) -> Operators:
4848
def l1_distance(self, other: object, /) -> Operators:
4949
return self.op('<+>', return_type=Float)(other)
5050

51+
comparator_factory = Comparator
52+
5153

5254
# for reflection
5355
ischema_names['vector'] = VECTOR # type: ignore

0 commit comments

Comments
 (0)