mirror of
https://github.com/davidhalter/django-stubs.git
synced 2025-12-17 17:35:59 +08:00
initial commit
This commit is contained in:
82
django/db/backends/sqlite3/base.pyi
Normal file
82
django/db/backends/sqlite3/base.pyi
Normal file
@@ -0,0 +1,82 @@
|
||||
from datetime import datetime
|
||||
from sqlite3 import Connection
|
||||
from typing import (
|
||||
Any,
|
||||
Callable,
|
||||
Dict,
|
||||
List,
|
||||
Optional,
|
||||
Tuple,
|
||||
Union,
|
||||
)
|
||||
|
||||
|
||||
def _sqlite_date_extract(lookup_type: str, dt: str) -> int: ...
|
||||
|
||||
|
||||
def _sqlite_date_trunc(lookup_type: str, dt: str) -> str: ...
|
||||
|
||||
|
||||
def _sqlite_datetime_cast_date(dt: str, tzname: Optional[str]) -> str: ...
|
||||
|
||||
|
||||
def _sqlite_datetime_cast_time(dt: str, tzname: Optional[str]) -> str: ...
|
||||
|
||||
|
||||
def _sqlite_datetime_extract(lookup_type: str, dt: str, tzname: Optional[str]) -> int: ...
|
||||
|
||||
|
||||
def _sqlite_datetime_parse(dt: str, tzname: Optional[str]) -> datetime: ...
|
||||
|
||||
|
||||
def _sqlite_datetime_trunc(lookup_type: str, dt: str, tzname: Optional[str]) -> str: ...
|
||||
|
||||
|
||||
def _sqlite_format_dtdelta(conn: str, lhs: Union[str, int], rhs: Union[str, int]) -> str: ...
|
||||
|
||||
|
||||
def _sqlite_lpad(text: str, length: int, fill_text: str) -> str: ...
|
||||
|
||||
|
||||
def _sqlite_regexp(re_pattern: str, re_string: Optional[str]) -> bool: ...
|
||||
|
||||
|
||||
def _sqlite_rpad(text: str, length: int, fill_text: str) -> str: ...
|
||||
|
||||
|
||||
def _sqlite_time_extract(lookup_type: str, dt: str) -> int: ...
|
||||
|
||||
|
||||
def _sqlite_time_trunc(lookup_type: str, dt: str) -> str: ...
|
||||
|
||||
|
||||
def _sqlite_timestamp_diff(lhs: str, rhs: str) -> int: ...
|
||||
|
||||
|
||||
def decoder(conv_func: Callable) -> Callable: ...
|
||||
|
||||
|
||||
class DatabaseWrapper:
|
||||
def _savepoint_allowed(self) -> bool: ...
|
||||
def _set_autocommit(self, autocommit: bool) -> None: ...
|
||||
def _start_transaction_under_autocommit(self) -> None: ...
|
||||
def check_constraints(self, table_names: List[str] = ...) -> None: ...
|
||||
def close(self) -> None: ...
|
||||
def create_cursor(self, name: None = ...) -> SQLiteCursorWrapper: ...
|
||||
def disable_constraint_checking(self) -> bool: ...
|
||||
def enable_constraint_checking(self) -> None: ...
|
||||
def get_connection_params(self) -> Dict[str, Union[int, str]]: ...
|
||||
def get_new_connection(self, conn_params: Dict[str, Union[int, str]]) -> Connection: ...
|
||||
def init_connection_state(self) -> None: ...
|
||||
def is_in_memory_db(self) -> bool: ...
|
||||
def is_usable(self) -> bool: ...
|
||||
|
||||
|
||||
class SQLiteCursorWrapper:
|
||||
def convert_query(self, query: str) -> str: ...
|
||||
def execute(self, query: str, params: Any = ...) -> SQLiteCursorWrapper: ...
|
||||
def executemany(
|
||||
self,
|
||||
query: str,
|
||||
param_list: Union[List[Tuple[int]], List[Tuple[int, int]]]
|
||||
) -> SQLiteCursorWrapper: ...
|
||||
10
django/db/backends/sqlite3/creation.pyi
Normal file
10
django/db/backends/sqlite3/creation.pyi
Normal file
@@ -0,0 +1,10 @@
|
||||
from typing import Tuple
|
||||
|
||||
|
||||
class DatabaseCreation:
|
||||
def _create_test_db(self, verbosity: int, autoclobber: bool, keepdb: bool = ...) -> str: ...
|
||||
def _destroy_test_db(self, test_database_name: str, verbosity: int) -> None: ...
|
||||
def _get_test_db_name(self) -> str: ...
|
||||
@staticmethod
|
||||
def is_in_memory_db(database_name: str) -> bool: ...
|
||||
def test_db_signature(self) -> Tuple[str, str]: ...
|
||||
3
django/db/backends/sqlite3/features.pyi
Normal file
3
django/db/backends/sqlite3/features.pyi
Normal file
@@ -0,0 +1,3 @@
|
||||
class DatabaseFeatures:
|
||||
@cached_property
|
||||
def supports_stddev(self) -> bool: ...
|
||||
65
django/db/backends/sqlite3/introspection.pyi
Normal file
65
django/db/backends/sqlite3/introspection.pyi
Normal file
@@ -0,0 +1,65 @@
|
||||
from django.db.backends.base.introspection import (
|
||||
FieldInfo,
|
||||
TableInfo,
|
||||
)
|
||||
from django.db.backends.utils import CursorWrapper
|
||||
from django.db.models.fields import CharField
|
||||
from django.db.models.fields.related import ForeignKey
|
||||
from typing import (
|
||||
Dict,
|
||||
List,
|
||||
Optional,
|
||||
Tuple,
|
||||
Union,
|
||||
)
|
||||
|
||||
|
||||
def get_field_size(name: str) -> Optional[int]: ...
|
||||
|
||||
|
||||
class DatabaseIntrospection:
|
||||
def _get_foreign_key_constraints(
|
||||
self,
|
||||
cursor: CursorWrapper,
|
||||
table_name: str
|
||||
) -> Dict[str, Dict[str, Union[List[str], bool, Tuple[str, str]]]]: ...
|
||||
def _table_info(
|
||||
self,
|
||||
cursor: CursorWrapper,
|
||||
name: str
|
||||
) -> List[Dict[str, Union[str, None, int]]]: ...
|
||||
def get_constraints(
|
||||
self,
|
||||
cursor: CursorWrapper,
|
||||
table_name: str
|
||||
) -> Dict[str, Dict[str, Union[List[str], bool, str, Tuple[str, str]]]]: ...
|
||||
def get_key_columns(
|
||||
self,
|
||||
cursor: CursorWrapper,
|
||||
table_name: str
|
||||
) -> List[Tuple[str, str, str]]: ...
|
||||
def get_primary_key_column(self, cursor: CursorWrapper, table_name: str) -> str: ...
|
||||
def get_relations(
|
||||
self,
|
||||
cursor: CursorWrapper,
|
||||
table_name: str
|
||||
) -> Dict[str, Tuple[str, str]]: ...
|
||||
def get_sequences(
|
||||
self,
|
||||
cursor: CursorWrapper,
|
||||
table_name: str,
|
||||
table_fields: List[Union[ForeignKey, CharField]] = ...
|
||||
) -> List[Dict[str, str]]: ...
|
||||
def get_table_description(
|
||||
self,
|
||||
cursor: CursorWrapper,
|
||||
table_name: str
|
||||
) -> List[FieldInfo]: ...
|
||||
def get_table_list(
|
||||
self,
|
||||
cursor: CursorWrapper
|
||||
) -> List[TableInfo]: ...
|
||||
|
||||
|
||||
class FlexibleFieldLookupDict:
|
||||
def __getitem__(self, key: str) -> Union[str, Tuple[str, Dict[str, int]]]: ...
|
||||
114
django/db/backends/sqlite3/operations.pyi
Normal file
114
django/db/backends/sqlite3/operations.pyi
Normal file
@@ -0,0 +1,114 @@
|
||||
from datetime import (
|
||||
date,
|
||||
datetime,
|
||||
time,
|
||||
timedelta,
|
||||
)
|
||||
from django.core.management.color import Style
|
||||
from django.db.backends.sqlite3.base import (
|
||||
DatabaseWrapper,
|
||||
SQLiteCursorWrapper,
|
||||
)
|
||||
from django.db.backends.utils import CursorDebugWrapper
|
||||
from django.db.models.aggregates import Aggregate
|
||||
from django.db.models.expressions import (
|
||||
BaseExpression,
|
||||
Col,
|
||||
CombinedExpression,
|
||||
Expression,
|
||||
F,
|
||||
)
|
||||
from typing import (
|
||||
Any,
|
||||
Callable,
|
||||
Dict,
|
||||
List,
|
||||
Optional,
|
||||
Tuple,
|
||||
Union,
|
||||
)
|
||||
from uuid import UUID
|
||||
|
||||
|
||||
class DatabaseOperations:
|
||||
def _convert_tzname_to_sql(self, tzname: Optional[str]) -> str: ...
|
||||
def _quote_params_for_last_executed_query(self, params: Any): ...
|
||||
def adapt_datetimefield_value(
|
||||
self,
|
||||
value: Optional[Union[datetime, F]]
|
||||
) -> Optional[Union[str, F]]: ...
|
||||
def adapt_timefield_value(self, value: Optional[time]) -> Optional[str]: ...
|
||||
def bulk_batch_size(self, fields: Any, objs: Any) -> int: ...
|
||||
def bulk_insert_sql(self, fields: Any, placeholder_rows: Any) -> str: ...
|
||||
def check_expression_support(self, expression: BaseExpression) -> None: ...
|
||||
def combine_duration_expression(self, connector: str, sub_expressions: List[str]) -> str: ...
|
||||
def combine_expression(self, connector: str, sub_expressions: List[str]) -> str: ...
|
||||
def convert_booleanfield_value(
|
||||
self,
|
||||
value: Optional[int],
|
||||
expression: Expression,
|
||||
connection: DatabaseWrapper
|
||||
) -> Optional[bool]: ...
|
||||
def convert_datefield_value(
|
||||
self,
|
||||
value: Optional[Union[str, date]],
|
||||
expression: Expression,
|
||||
connection: DatabaseWrapper
|
||||
) -> Optional[date]: ...
|
||||
def convert_datetimefield_value(
|
||||
self,
|
||||
value: Optional[Union[str, datetime]],
|
||||
expression: Expression,
|
||||
connection: DatabaseWrapper
|
||||
) -> Optional[datetime]: ...
|
||||
def convert_timefield_value(
|
||||
self,
|
||||
value: Optional[Union[str, time]],
|
||||
expression: Expression,
|
||||
connection: DatabaseWrapper
|
||||
) -> Optional[time]: ...
|
||||
def convert_uuidfield_value(
|
||||
self,
|
||||
value: Optional[str],
|
||||
expression: Col,
|
||||
connection: DatabaseWrapper
|
||||
) -> Optional[UUID]: ...
|
||||
def date_extract_sql(self, lookup_type: str, field_name: str) -> str: ...
|
||||
def date_interval_sql(self, timedelta: timedelta) -> str: ...
|
||||
def date_trunc_sql(self, lookup_type: str, field_name: str) -> str: ...
|
||||
def datetime_cast_date_sql(self, field_name: str, tzname: str) -> str: ...
|
||||
def datetime_cast_time_sql(self, field_name: str, tzname: str) -> str: ...
|
||||
def datetime_extract_sql(self, lookup_type: str, field_name: str, tzname: Optional[str]) -> str: ...
|
||||
def datetime_trunc_sql(self, lookup_type: str, field_name: str, tzname: Optional[str]) -> str: ...
|
||||
def execute_sql_flush(self, using: str, sql_list: List[str]) -> None: ...
|
||||
def format_for_duration_arithmetic(self, sql: str) -> str: ...
|
||||
def get_db_converters(self, expression: Expression) -> List[Callable]: ...
|
||||
def get_decimalfield_converter(
|
||||
self,
|
||||
expression: Union[Col, CombinedExpression, Aggregate]
|
||||
) -> Callable: ...
|
||||
def integer_field_range(self, internal_type: str) -> Tuple[None, None]: ...
|
||||
def last_executed_query(
|
||||
self,
|
||||
cursor: Union[SQLiteCursorWrapper, CursorDebugWrapper],
|
||||
sql: str,
|
||||
params: Optional[Union[Tuple, List[str]]]
|
||||
) -> str: ...
|
||||
def no_limit_value(self) -> int: ...
|
||||
def pk_default_value(self) -> str: ...
|
||||
def quote_name(self, name: str) -> str: ...
|
||||
def sql_flush(
|
||||
self,
|
||||
style: Style,
|
||||
tables: List[str],
|
||||
sequences: Union[List[Dict[str, str]], Tuple],
|
||||
allow_cascade: bool = ...
|
||||
) -> List[str]: ...
|
||||
def subtract_temporals(
|
||||
self,
|
||||
internal_type: str,
|
||||
lhs: Tuple[str, List[Any]],
|
||||
rhs: Union[Tuple[str, List[Any]], Tuple[str, List[str]]]
|
||||
) -> Union[Tuple[str, List[Any]], Tuple[str, List[str]]]: ...
|
||||
def time_extract_sql(self, lookup_type: str, field_name: str) -> str: ...
|
||||
def time_trunc_sql(self, lookup_type: str, field_name: str) -> str: ...
|
||||
62
django/db/backends/sqlite3/schema.pyi
Normal file
62
django/db/backends/sqlite3/schema.pyi
Normal file
@@ -0,0 +1,62 @@
|
||||
from django.db.models.base import Model
|
||||
from django.db.models.fields import (
|
||||
AutoField,
|
||||
Field,
|
||||
IntegerField,
|
||||
SlugField,
|
||||
TimeField,
|
||||
)
|
||||
from typing import (
|
||||
Any,
|
||||
Dict,
|
||||
Optional,
|
||||
Type,
|
||||
Union,
|
||||
)
|
||||
|
||||
|
||||
class DatabaseSchemaEditor:
|
||||
def __enter__(self) -> DatabaseSchemaEditor: ...
|
||||
def __exit__(self, exc_type: None, exc_value: None, traceback: None) -> None: ...
|
||||
def _alter_field(
|
||||
self,
|
||||
model: Any,
|
||||
old_field: Field,
|
||||
new_field: Field,
|
||||
old_type: str,
|
||||
new_type: str,
|
||||
old_db_params: Dict[str, Union[str, None]],
|
||||
new_db_params: Dict[str, Union[str, None]],
|
||||
strict: bool = ...
|
||||
) -> None: ...
|
||||
def _is_referenced_by_fk_constraint(
|
||||
self,
|
||||
table_name: str,
|
||||
column_name: Optional[str] = ...,
|
||||
ignore_self: bool = ...
|
||||
) -> bool: ...
|
||||
def _remake_table(
|
||||
self,
|
||||
model: Any,
|
||||
create_field: Optional[Union[IntegerField, TimeField]] = ...,
|
||||
delete_field: Optional[Union[AutoField, SlugField]] = ...,
|
||||
alter_field: Any = ...
|
||||
) -> None: ...
|
||||
def add_field(self, model: Type[Model], field: Field) -> None: ...
|
||||
def alter_db_table(
|
||||
self,
|
||||
model: Any,
|
||||
old_db_table: str,
|
||||
new_db_table: str,
|
||||
disable_constraints: bool = ...
|
||||
) -> None: ...
|
||||
def alter_field(
|
||||
self,
|
||||
model: Any,
|
||||
old_field: Field,
|
||||
new_field: Field,
|
||||
strict: bool = ...
|
||||
) -> None: ...
|
||||
def delete_model(self, model: Any, handle_autom2m: bool = ...) -> None: ...
|
||||
def quote_value(self, value: Optional[Union[int, memoryview, str]]) -> str: ...
|
||||
def remove_field(self, model: Type[Model], field: Field) -> None: ...
|
||||
Reference in New Issue
Block a user