mirror of
https://github.com/davidhalter/django-stubs.git
synced 2025-12-20 19:01:16 +08:00
* Annotate the return type of as_sql for SpatialOperator. Its subclasses inherits the type annotation from `SpatialOperator`, so copying `as_sql` over is unnecessary. Signed-off-by: Zixuan James Li <p359101898@gmail.com> * Remove unnecessary as_sql definition. `Query` inherits `as_sql` from `BaseExpression`, `GISLookup` inherits `as_sql` from `Lookup`, and `BuiltinLookup` inherits `as_sql` from `Lookup[_T]`. None is required to be redefined. Signed-off-by: Zixuan James Li <p359101898@gmail.com> * Unify return types of as_sql and friends as _AsSqlType. `Tuple[str, _ParamsT]`, `Tuple[str, List[Union[str, int]]]` and other similar type annotations are all replaced with the `_AsSqlType` alias. Any as_sql definition that annotate the return type as `Any` is also updated to use `_AsSqlType`. Signed-off-by: Zixuan James Li <p359101898@gmail.com>
16 lines
580 B
Python
16 lines
580 B
Python
from typing import Any
|
|
|
|
from django.db.models.sql import compiler as compiler
|
|
from django.db.models.sql.compiler import _AsSqlType
|
|
|
|
class SQLCompiler(compiler.SQLCompiler):
|
|
def as_subquery_condition(self, alias: Any, columns: Any, compiler: Any): ...
|
|
|
|
class SQLInsertCompiler(compiler.SQLInsertCompiler, SQLCompiler): ...
|
|
|
|
class SQLDeleteCompiler(compiler.SQLDeleteCompiler, SQLCompiler):
|
|
def as_sql(self) -> _AsSqlType: ...
|
|
|
|
class SQLUpdateCompiler(compiler.SQLUpdateCompiler, SQLCompiler): ...
|
|
class SQLAggregateCompiler(compiler.SQLAggregateCompiler, SQLCompiler): ...
|