Skip to content

Commit 850369f

Browse files
committed
Fix some as_sql() signatures
1 parent f48605a commit 850369f

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

src/django_mysql/models/lookups.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
from collections.abc import Iterable
44
from typing import Any
5-
from typing import Callable
5+
from typing import Iterable
66

77
from django.db.backends.base.base import BaseDatabaseWrapper
88
from django.db.models import CharField
@@ -24,11 +24,11 @@ class SoundsLike(Lookup):
2424

2525
def as_sql(
2626
self,
27-
qn: Callable[[str], str],
27+
compiler: SQLCompiler,
2828
connection: BaseDatabaseWrapper,
2929
) -> tuple[str, Iterable[Any]]:
30-
lhs, lhs_params = self.process_lhs(qn, connection)
31-
rhs, rhs_params = self.process_rhs(qn, connection)
30+
lhs, lhs_params = self.process_lhs(compiler, connection)
31+
rhs, rhs_params = self.process_rhs(compiler, connection)
3232
params = tuple(lhs_params) + tuple(rhs_params)
3333
return f"{lhs} SOUNDS LIKE {rhs}", params
3434

@@ -66,10 +66,10 @@ def get_prep_lookup(self) -> Any:
6666
return super().get_prep_lookup()
6767

6868
def as_sql(
69-
self, qn: Callable[[str], str], connection: BaseDatabaseWrapper
69+
self, compiler: SQLCompiler, connection: BaseDatabaseWrapper
7070
) -> tuple[str, Iterable[Any]]:
71-
lhs, lhs_params = self.process_lhs(qn, connection)
72-
rhs, rhs_params = self.process_rhs(qn, connection)
71+
lhs, lhs_params = self.process_lhs(compiler, connection)
72+
rhs, rhs_params = self.process_rhs(compiler, connection)
7373
# Put rhs (and params) on the left since that's the order FIND_IN_SET uses
7474
params = tuple(rhs_params) + tuple(lhs_params)
7575
return f"FIND_IN_SET({rhs}, {lhs})", params
@@ -86,9 +86,9 @@ class DynColHasKey(Lookup):
8686
lookup_name = "has_key"
8787

8888
def as_sql(
89-
self, qn: Callable[[str], str], connection: BaseDatabaseWrapper
89+
self, compiler: SQLCompiler, connection: BaseDatabaseWrapper
9090
) -> tuple[str, Iterable[Any]]:
91-
lhs, lhs_params = self.process_lhs(qn, connection)
92-
rhs, rhs_params = self.process_rhs(qn, connection)
91+
lhs, lhs_params = self.process_lhs(compiler, connection)
92+
rhs, rhs_params = self.process_rhs(compiler, connection)
9393
params = tuple(lhs_params) + tuple(rhs_params)
9494
return f"COLUMN_EXISTS({lhs}, {rhs})", params

0 commit comments

Comments
 (0)