1
1
import json
2
- from collections .abc import Iterable , Sequence
2
+ from collections .abc import Callable , Sequence
3
3
from datetime import date , time , timedelta
4
4
from datetime import datetime as real_datetime
5
5
from decimal import Decimal
@@ -13,6 +13,9 @@ from django.db.models.constants import OnConflict
13
13
from django .db .models .expressions import Case , Col , Expression
14
14
from django .db .models .fields import Field
15
15
from django .db .models .sql .compiler import SQLCompiler
16
+ from typing_extensions import TypeAlias
17
+
18
+ _Converter : TypeAlias = Callable [[Any , Expression , BaseDatabaseWrapper ], Any ]
16
19
17
20
class BaseDatabaseOperations :
18
21
compiler_module : str
@@ -57,7 +60,7 @@ class BaseDatabaseOperations:
57
60
def pk_default_value (self ) -> str : ...
58
61
def prepare_sql_script (self , sql : Any ) -> list [str ]: ...
59
62
def process_clob (self , value : str ) -> str : ...
60
- def return_insert_columns (self , fields : Any ) -> Any : ...
63
+ def return_insert_columns (self , fields : list [ Field [ Any , Any ]] ) -> tuple [ str , list [ Any ]] : ...
61
64
def compiler (self , compiler_name : str ) -> type [SQLCompiler ]: ...
62
65
def quote_name (self , name : str ) -> str : ...
63
66
def regex_lookup (self , lookup_type : str ) -> str : ...
@@ -68,14 +71,14 @@ class BaseDatabaseOperations:
68
71
def sql_flush (
69
72
self , style : Style , tables : Sequence [str ], * , reset_sequences : bool = ..., allow_cascade : bool = ...
70
73
) -> list [str ]: ...
71
- def execute_sql_flush (self , sql_list : Iterable [str ]) -> None : ...
72
- def sequence_reset_by_name_sql (self , style : Style | None , sequences : list [Any ] ) -> list [Any ]: ...
73
- def sequence_reset_sql (self , style : Style , model_list : Sequence [type [Model ]]) -> list [Any ]: ...
74
+ def execute_sql_flush (self , sql_list : list [str ]) -> None : ...
75
+ def sequence_reset_by_name_sql (self , style : Style , sequences : list [dict [ str , str | None ]] ) -> list [str ]: ...
76
+ def sequence_reset_sql (self , style : Style , model_list : list [type [Model ]]) -> list [str ]: ...
74
77
def start_transaction_sql (self ) -> str : ...
75
78
def end_transaction_sql (self , success : bool = ...) -> str : ...
76
- def tablespace_sql (self , tablespace : str | None , inline : bool = ...) -> str : ...
77
- def prep_for_like_query (self , x : str ) -> str : ...
78
- prep_for_iexact_query : Any
79
+ def tablespace_sql (self , tablespace : str , inline : bool = ...) -> str : ...
80
+ def prep_for_like_query (self , x : object ) -> str : ...
81
+ def prep_for_iexact_query ( self , x : object ) -> str : ...
79
82
def validate_autopk_value (self , value : int ) -> int : ...
80
83
def adapt_unknown_value (self , value : Any ) -> Any : ...
81
84
def adapt_datefield_value (self , value : date | None ) -> str | None : ...
@@ -89,14 +92,14 @@ class BaseDatabaseOperations:
89
92
def adapt_integerfield_value (self , value : Any , internal_type : Any ) -> Any : ...
90
93
def year_lookup_bounds_for_date_field (self , value : int , iso_year : bool = ...) -> list [str ]: ...
91
94
def year_lookup_bounds_for_datetime_field (self , value : int , iso_year : bool = ...) -> list [str ]: ...
92
- def get_db_converters (self , expression : Expression ) -> list [Any ]: ...
95
+ def get_db_converters (self , expression : Expression ) -> list [_Converter ]: ...
93
96
def convert_durationfield_value (
94
97
self , value : float | None , expression : Expression , connection : BaseDatabaseWrapper
95
98
) -> timedelta | None : ...
96
- def check_expression_support (self , expression : Any ) -> None : ...
97
- def conditional_expression_supported_in_where_clause (self , expression : Any ) -> bool : ...
99
+ def check_expression_support (self , expression : Expression ) -> None : ...
100
+ def conditional_expression_supported_in_where_clause (self , expression : Expression ) -> bool : ...
98
101
def combine_expression (self , connector : str , sub_expressions : list [str ]) -> str : ...
99
- def combine_duration_expression (self , connector : Any , sub_expressions : Any ) -> str : ...
102
+ def combine_duration_expression (self , connector : str , sub_expressions : list [ str ] ) -> str : ...
100
103
def binary_placeholder_sql (self , value : Case | None ) -> str : ...
101
104
def modify_insert_params (self , placeholder : str , params : Any ) -> Any : ...
102
105
def integer_field_range (self , internal_type : Any ) -> tuple [int , int ]: ...
0 commit comments