Skip to content

Commit 1e3598a

Browse files
committed
Fix some as_sql() signatures
1 parent df32338 commit 1e3598a

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

src/django_mysql/models/lookups.py

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
from __future__ import annotations
22

33
from typing import Any
4-
from typing import Callable
54
from typing import Iterable
65

76
from django.db.backends.base.base import BaseDatabaseWrapper
@@ -24,11 +23,11 @@ class SoundsLike(Lookup):
2423

2524
def as_sql(
2625
self,
27-
qn: Callable[[str], str],
26+
compiler: SQLCompiler,
2827
connection: BaseDatabaseWrapper,
2928
) -> tuple[str, Iterable[Any]]:
30-
lhs, lhs_params = self.process_lhs(qn, connection)
31-
rhs, rhs_params = self.process_rhs(qn, connection)
29+
lhs, lhs_params = self.process_lhs(compiler, connection)
30+
rhs, rhs_params = self.process_rhs(compiler, connection)
3231
params = tuple(lhs_params) + tuple(rhs_params)
3332
return f"{lhs} SOUNDS LIKE {rhs}", params
3433

@@ -66,10 +65,10 @@ def get_prep_lookup(self) -> Any:
6665
return super().get_prep_lookup()
6766

6867
def as_sql(
69-
self, qn: Callable[[str], str], connection: BaseDatabaseWrapper
68+
self, compiler: SQLCompiler, connection: BaseDatabaseWrapper
7069
) -> tuple[str, Iterable[Any]]:
71-
lhs, lhs_params = self.process_lhs(qn, connection)
72-
rhs, rhs_params = self.process_rhs(qn, connection)
70+
lhs, lhs_params = self.process_lhs(compiler, connection)
71+
rhs, rhs_params = self.process_rhs(compiler, connection)
7372
# Put rhs (and params) on the left since that's the order FIND_IN_SET uses
7473
params = tuple(rhs_params) + tuple(lhs_params)
7574
return f"FIND_IN_SET({rhs}, {lhs})", params
@@ -86,9 +85,9 @@ class DynColHasKey(Lookup):
8685
lookup_name = "has_key"
8786

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

0 commit comments

Comments
 (0)