initial commit

This commit is contained in:
Maxim Kurnikov
2018-07-29 18:12:23 +03:00
commit a9f215bf64
311 changed files with 13433 additions and 0 deletions

18
django/db/__init__.pyi Normal file
View File

@@ -0,0 +1,18 @@
from django.db.backends.sqlite3.base import DatabaseWrapper
from typing import (
Any,
Union,
)
from unittest.mock import MagicMock
def close_old_connections(**kwargs) -> None: ...
def reset_queries(**kwargs) -> None: ...
class DefaultConnectionProxy:
def __eq__(self, other: DatabaseWrapper) -> bool: ...
def __getattr__(self, item: str) -> Any: ...
def __setattr__(self, name: str, value: Union[MagicMock, bool]) -> None: ...

View File

@@ -0,0 +1,82 @@
from django.db.backends.sqlite3.base import (
DatabaseWrapper,
SQLiteCursorWrapper,
)
from django.db.backends.sqlite3.schema import DatabaseSchemaEditor
from django.db.backends.utils import (
CursorDebugWrapper,
CursorWrapper,
)
from django.db.utils import DatabaseErrorWrapper
from typing import (
Any,
Callable,
Dict,
Iterator,
List,
)
from unittest.mock import MagicMock
class BaseDatabaseWrapper:
def __init__(
self,
settings_dict: Dict[str, Any],
alias: str = ...,
allow_thread_sharing: bool = ...
) -> None: ...
def _commit(self): ...
def _cursor(self, name: None = ...): ...
def _prepare_cursor(
self,
cursor: SQLiteCursorWrapper
) -> CursorWrapper: ...
def _rollback(self): ...
def _savepoint(self, sid: str) -> None: ...
def _savepoint_commit(self, sid: str) -> None: ...
def _savepoint_rollback(self, sid: str) -> None: ...
def check_settings(self) -> None: ...
def chunked_cursor(self) -> CursorWrapper: ...
def close(self) -> None: ...
def close_if_unusable_or_obsolete(self) -> None: ...
def commit(self) -> None: ...
def connect(self) -> None: ...
def constraint_checks_disabled(self) -> Iterator[None]: ...
def copy(
self,
alias: None = ...,
allow_thread_sharing: None = ...
) -> DatabaseWrapper: ...
def cursor(self) -> CursorWrapper: ...
def ensure_connection(self) -> None: ...
def ensure_timezone(self) -> bool: ...
def execute_wrapper(self, wrapper: MagicMock) -> Iterator[None]: ...
def get_autocommit(self) -> bool: ...
def get_rollback(self) -> bool: ...
def make_cursor(
self,
cursor: SQLiteCursorWrapper
) -> CursorWrapper: ...
def make_debug_cursor(
self,
cursor: SQLiteCursorWrapper
) -> CursorDebugWrapper: ...
def on_commit(self, func: Callable) -> None: ...
def prepare_database(self) -> None: ...
@property
def queries(self) -> List[Dict[str, str]]: ...
@property
def queries_logged(self) -> bool: ...
def rollback(self) -> None: ...
def run_and_clear_commit_hooks(self) -> None: ...
def savepoint(self) -> str: ...
def savepoint_commit(self, sid: str) -> None: ...
def savepoint_rollback(self, sid: str) -> None: ...
def schema_editor(self, *args, **kwargs) -> DatabaseSchemaEditor: ...
def set_autocommit(self, autocommit: bool, force_begin_transaction_with_broken_autocommit: bool = ...) -> None: ...
def set_rollback(self, rollback: bool) -> None: ...
def validate_no_atomic_block(self) -> None: ...
def validate_no_broken_transaction(self) -> None: ...
def validate_thread_sharing(self) -> None: ...
@cached_property
def wrap_database_errors(self) -> DatabaseErrorWrapper: ...

View File

@@ -0,0 +1,5 @@
from django.db.backends.base.base import BaseDatabaseWrapper
class BaseDatabaseClient:
def __init__(self, connection: BaseDatabaseWrapper) -> None: ...

View File

@@ -0,0 +1,31 @@
from django.db.backends.sqlite3.base import DatabaseWrapper
from typing import (
Dict,
Optional,
Tuple,
Union,
)
class BaseDatabaseCreation:
def __init__(self, connection: DatabaseWrapper) -> None: ...
def _get_database_display_str(self, verbosity: int, database_name: str) -> str: ...
def _get_test_db_name(self) -> str: ...
def create_test_db(
self,
verbosity: int = ...,
autoclobber: bool = ...,
serialize: bool = ...,
keepdb: bool = ...
) -> str: ...
def deserialize_db_from_string(self, data: str) -> None: ...
def destroy_test_db(
self,
old_database_name: str = ...,
verbosity: int = ...,
keepdb: bool = ...,
suffix: None = ...
) -> None: ...
def serialize_db_to_string(self) -> str: ...
def set_as_test_mirror(self, primary_settings_dict: Dict[str, Union[str, int, None, Dict[str, None]]]) -> None: ...
def test_db_signature(self) -> Tuple[str, str, str, str]: ...

View File

@@ -0,0 +1,5 @@
from django.db.backends.base.base import BaseDatabaseWrapper
class BaseDatabaseFeatures:
def __init__(self, connection: BaseDatabaseWrapper) -> None: ...

View File

@@ -0,0 +1,26 @@
from django.db.backends.base.base import BaseDatabaseWrapper
from django.db.backends.utils import CursorWrapper
from typing import (
Dict,
List,
Optional,
Tuple,
Union,
)
class BaseDatabaseIntrospection:
def __init__(self, connection: BaseDatabaseWrapper) -> None: ...
def column_name_converter(self, name: str) -> str: ...
def django_table_names(self, only_existing: bool = ..., include_views: bool = ...) -> List[str]: ...
def get_field_type(
self,
data_type: str,
description: FieldInfo
) -> Union[str, Tuple[str, Dict[str, int]]]: ...
def table_name_converter(self, name: str) -> str: ...
def table_names(
self,
cursor: Optional[CursorWrapper] = ...,
include_views: bool = ...
) -> List[str]: ...

View File

@@ -0,0 +1,82 @@
from datetime import (
date,
datetime,
time,
timedelta,
)
from decimal import Decimal
from django.core.management.color import Style
from django.db import DefaultConnectionProxy
from django.db.backends.base.base import BaseDatabaseWrapper
from django.db.backends.sqlite3.base import DatabaseWrapper
from django.db.backends.utils import CursorWrapper
from django.db.models.expressions import Expression
from django.db.models.fields import Field
from typing import (
Any,
List,
Optional,
Tuple,
Union,
)
class BaseDatabaseOperations:
def __init__(
self,
connection: Union[DefaultConnectionProxy, backends.base.base.BaseDatabaseWrapper]
) -> None: ...
def _get_limit_offset_params(self, low_mark: int, high_mark: Optional[int]) -> Tuple[int, int]: ...
def adapt_datefield_value(self, value: Optional[date]) -> Optional[str]: ...
def adapt_decimalfield_value(
self,
value: Optional[Decimal],
max_digits: Optional[int] = ...,
decimal_places: Optional[int] = ...
) -> Optional[str]: ...
def adapt_ipaddressfield_value(self, value: Optional[str]) -> Optional[str]: ...
def adapt_timefield_value(self, value: Optional[Union[time, datetime]]) -> Optional[str]: ...
def adapt_unknown_value(self, value: Union[Decimal, time, date, int]) -> Union[str, int]: ...
def autoinc_sql(self, table: str, column: str) -> None: ...
def binary_placeholder_sql(self, value: Optional[memoryview]) -> str: ...
def combine_expression(self, connector: str, sub_expressions: List[str]) -> str: ...
def compiler(self, compiler_name: str) -> Any: ...
def convert_durationfield_value(
self,
value: Optional[Union[float, int]],
expression: Expression,
connection: DatabaseWrapper
) -> Optional[timedelta]: ...
def date_extract_sql(self, lookup_type: None, field_name: None): ...
def datetime_cast_date_sql(self, field_name: None, tzname: None): ...
def datetime_trunc_sql(self, lookup_type: None, field_name: None, tzname: None): ...
def distinct_sql(self, fields: List[str], params: None) -> Tuple[List[str], List[Any]]: ...
def end_transaction_sql(self, success: bool = ...) -> str: ...
def execute_sql_flush(self, using: str, sql_list: List[str]) -> None: ...
def explain_query_prefix(self, format: None = ..., **options): ...
def field_cast_sql(self, db_type: Optional[str], internal_type: str) -> str: ...
def force_no_ordering(self) -> List[Any]: ...
def get_db_converters(self, expression: Expression) -> List[Any]: ...
def last_insert_id(self, cursor: CursorWrapper, table_name: str, pk_name: str) -> int: ...
def limit_offset_sql(self, low_mark: int, high_mark: Optional[int]) -> str: ...
def lookup_cast(self, lookup_type: str, internal_type: str = ...) -> str: ...
def max_in_list_size(self) -> None: ...
def max_name_length(self) -> None: ...
def modify_insert_params(self, placeholder: str, params: Any) -> Any: ...
def prep_for_like_query(self, x: str) -> str: ...
def process_clob(self, value: str) -> str: ...
def random_function_sql(self) -> str: ...
def savepoint_commit_sql(self, sid: str) -> str: ...
def savepoint_create_sql(self, sid: str) -> str: ...
def savepoint_rollback_sql(self, sid: str) -> str: ...
def sequence_reset_by_name_sql(self, style: None, sequences: List[Any]) -> List[Any]: ...
def sequence_reset_sql(self, style: Style, model_list: Any) -> List[Any]: ...
def set_time_zone_sql(self) -> str: ...
def tablespace_sql(self, tablespace: str, inline: bool = ...) -> str: ...
def time_extract_sql(self, lookup_type: None, field_name: None): ...
def time_trunc_sql(self, lookup_type: None, field_name: None): ...
def unification_cast_sql(self, output_field: Field) -> str: ...
def validate_autopk_value(self, value: int) -> int: ...
def window_frame_rows_start_end(self, start: None = ..., end: None = ...): ...
def year_lookup_bounds_for_date_field(self, value: int) -> List[str]: ...
def year_lookup_bounds_for_datetime_field(self, value: int) -> List[str]: ...

View File

@@ -0,0 +1,69 @@
from django.db.backends.ddl_references import Statement
from django.db.backends.sqlite3.base import DatabaseWrapper
from django.db.backends.sqlite3.schema import DatabaseSchemaEditor
from django.db.models.base import Model
from django.db.models.fields import Field
from typing import (
Any,
Dict,
List,
Optional,
Tuple,
Type,
Union,
)
class BaseDatabaseSchemaEditor:
def __enter__(self) -> DatabaseSchemaEditor: ...
def __exit__(self, exc_type: None, exc_value: None, traceback: None) -> None: ...
def __init__(
self,
connection: DatabaseWrapper,
collect_sql: bool = ...,
atomic: bool = ...
) -> None: ...
def _constraint_names(
self,
model: Type[Model],
column_names: List[str] = ...,
unique: Optional[bool] = ...,
primary_key: None = ...,
index: Optional[bool] = ...,
foreign_key: None = ...,
check: None = ...,
type_: None = ...
) -> List[str]: ...
def _create_index_name(
self,
table_name: str,
column_names: Union[Tuple[str, str, str], Tuple[str], List[str]],
suffix: str = ...
) -> str: ...
def _create_index_sql(
self,
model: Any,
fields: Any,
*,
name = ...,
suffix = ...,
using = ...,
db_tablespace = ...,
col_suffixes = ...,
sql = ...
) -> Statement: ...
def _create_unique_sql(self, model: Any, columns: List[str]) -> Statement: ...
def _delete_composed_index(
self,
model: Type[Model],
fields: Tuple[str, str],
constraint_kwargs: Dict[str, bool],
sql: str
) -> None: ...
@classmethod
def _digest(cls, *args) -> str: ...
def _field_indexes_sql(
self,
model: Any,
field: Field
) -> List[Statement]: ...

View File

@@ -0,0 +1,11 @@
from django.db.backends.base.base import BaseDatabaseWrapper
from django.db.models.fields import Field
from typing import (
Any,
List,
)
class BaseDatabaseValidation:
def __init__(self, connection: BaseDatabaseWrapper) -> None: ...
def check_field(self, field: Field, **kwargs) -> List[Any]: ...

View File

@@ -0,0 +1,59 @@
from typing import (
Callable,
List,
Tuple,
Union,
)
class Columns:
def __init__(
self,
table: str,
columns: List[str],
quote_name: Callable,
col_suffixes: Union[List[str], Tuple] = ...
) -> None: ...
def __str__(self) -> str: ...
class ForeignKeyName:
def __init__(
self,
from_table: str,
from_columns: List[str],
to_table: str,
to_columns: List[str],
suffix_template: str,
create_fk_name: Callable
) -> None: ...
def __str__(self) -> str: ...
def references_column(self, table: str, column: str) -> bool: ...
def references_table(self, table: str) -> bool: ...
def rename_column_references(self, table: str, old_column: str, new_column: str) -> None: ...
class IndexName:
def __init__(self, table: str, columns: List[str], suffix: str, create_index_name: Callable) -> None: ...
def __str__(self) -> str: ...
class Statement:
def __init__(self, template: str, **parts) -> None: ...
def __str__(self) -> str: ...
def references_column(self, table: str, column: str) -> bool: ...
def references_table(self, table: str) -> bool: ...
def rename_table_references(self, old_table: str, new_table: str) -> None: ...
class Table:
def __init__(self, table: str, quote_name: Callable) -> None: ...
def __str__(self) -> str: ...
def references_table(self, table: str) -> bool: ...
def rename_table_references(self, old_table: str, new_table: str) -> None: ...
class TableColumns:
def __init__(self, table: str, columns: List[str]) -> None: ...
def references_column(self, table: str, column: str) -> bool: ...
def rename_column_references(self, table: str, old_column: str, new_column: str) -> None: ...

View File

@@ -0,0 +1,4 @@
def complain(*args, **kwargs): ...
def ignore(*args, **kwargs) -> None: ...

View File

@@ -0,0 +1,10 @@
from typing import (
Dict,
List,
Optional,
)
class DatabaseClient:
@classmethod
def settings_to_cmd_args(cls, settings_dict: Dict[str, Union[str, None]]) -> List[str]: ...

View File

@@ -0,0 +1,9 @@
from typing import Dict
def _escape_pgpass(txt: str) -> str: ...
class DatabaseClient:
@classmethod
def runshell_db(cls, conn_params: Dict[str, str]) -> None: ...

View 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: ...

View 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]: ...

View File

@@ -0,0 +1,3 @@
class DatabaseFeatures:
@cached_property
def supports_stddev(self) -> bool: ...

View 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]]]: ...

View 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: ...

View 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: ...

View File

@@ -0,0 +1,78 @@
from datetime import (
date,
time,
)
from decimal import Decimal
from django.db.backends.sqlite3.base import (
DatabaseWrapper,
SQLiteCursorWrapper,
)
from typing import (
Any,
Callable,
Dict,
List,
Optional,
Tuple,
Union,
)
def format_number(
value: Optional[Decimal],
max_digits: Optional[int],
decimal_places: Optional[int]
) -> Optional[str]: ...
def rev_typecast_decimal(d: Decimal) -> str: ...
def split_identifier(identifier: str) -> Tuple[str, str]: ...
def strip_quotes(table_name: str) -> str: ...
def truncate_name(identifier: str, length: Optional[int] = ..., hash_len: int = ...) -> str: ...
def typecast_date(s: str) -> date: ...
def typecast_time(s: str) -> Optional[time]: ...
def typecast_timestamp(s: str) -> date: ...
class CursorDebugWrapper:
def execute(self, sql: str, params: Optional[Union[Tuple, List[str]]] = ...): ...
class CursorWrapper:
def __enter__(self) -> CursorWrapper: ...
def __exit__(self, type: None, value: None, traceback: None) -> None: ...
def __getattr__(self, attr: str) -> Any: ...
def __init__(
self,
cursor: SQLiteCursorWrapper,
db: DatabaseWrapper
) -> None: ...
def __iter__(self) -> None: ...
def _execute(self, sql: str, params: Any, *ignored_wrapper_args): ...
def _execute_with_wrappers(
self,
sql: str,
params: Any,
many: bool,
executor: Callable
) -> Optional[SQLiteCursorWrapper]: ...
def _executemany(
self,
sql: str,
param_list: Union[List[Tuple[int]], List[Tuple[int, int, int]]],
*ignored_wrapper_args
): ...
def callproc(self, procname: str, params: List[Any] = ..., kparams: Dict[str, int] = ...): ...
def execute(self, sql: str, params: Any = ...) -> SQLiteCursorWrapper: ...

View File

@@ -0,0 +1,114 @@
from django.db.migrations.graph import MigrationGraph
from django.db.migrations.migration import Migration
from django.db.migrations.operations.base import Operation
from django.db.migrations.operations.fields import FieldOperation
from django.db.migrations.operations.models import (
CreateModel,
DeleteModel,
FieldRelatedOptionOperation,
ModelOperation,
)
from django.db.migrations.questioner import MigrationQuestioner
from django.db.migrations.state import ProjectState
from django.db.models.fields.related import (
ForeignKey,
ManyToManyField,
)
from django.db.models.fields.reverse_related import ManyToOneRel
from typing import (
Any,
Dict,
List,
Optional,
Set,
Tuple,
Type,
Union,
)
class MigrationAutodetector:
def __init__(
self,
from_state: ProjectState,
to_state: ProjectState,
questioner: Optional[MigrationQuestioner] = ...
) -> None: ...
def _build_migration_list(self, graph: Optional[MigrationGraph] = ...) -> None: ...
def _detect_changes(
self,
convert_apps: Optional[Set[str]] = ...,
graph: Optional[MigrationGraph] = ...
) -> Dict[str, List[Migration]]: ...
def _generate_added_field(self, app_label: str, model_name: str, field_name: str) -> None: ...
def _generate_altered_foo_together(
self,
operation: Type[FieldRelatedOptionOperation]
) -> None: ...
def _generate_removed_field(self, app_label: str, model_name: str, field_name: str) -> None: ...
def _generate_through_model_map(self) -> None: ...
def _get_dependencies_for_foreign_key(
self,
field: Union[ManyToOneRel, ManyToManyField, ForeignKey]
) -> List[Tuple[str, str, None, bool]]: ...
def _optimize_migrations(self) -> None: ...
def _prepare_field_lists(self) -> None: ...
def _sort_migrations(self) -> None: ...
def _trim_to_apps(
self,
changes: Dict[str, List[Migration]],
app_labels: Set[str]
) -> Dict[str, List[Migration]]: ...
def add_operation(
self,
app_label: str,
operation: Operation,
dependencies: Any = ...,
beginning: bool = ...
) -> None: ...
def arrange_for_graph(
self,
changes: Dict[str, List[Migration]],
graph: MigrationGraph,
migration_name: Optional[str] = ...
) -> Dict[str, List[Migration]]: ...
def changes(
self,
graph: MigrationGraph,
trim_to_apps: Optional[Set[str]] = ...,
convert_apps: Optional[Set[str]] = ...,
migration_name: None = ...
) -> Dict[str, List[Migration]]: ...
def check_dependency(
self,
operation: Operation,
dependency: Union[Tuple[str, str, str, str], Tuple[str, str, str, bool], Tuple[str, str, None, bool]]
) -> bool: ...
def create_altered_indexes(self) -> None: ...
def deep_deconstruct(self, obj: Any) -> Any: ...
def generate_added_fields(self) -> None: ...
def generate_added_indexes(self) -> None: ...
def generate_altered_db_table(self) -> None: ...
def generate_altered_fields(self) -> None: ...
def generate_altered_index_together(self) -> None: ...
def generate_altered_managers(self) -> None: ...
def generate_altered_options(self) -> None: ...
def generate_altered_order_with_respect_to(self) -> None: ...
def generate_altered_unique_together(self) -> None: ...
def generate_created_models(self) -> None: ...
def generate_created_proxies(self) -> None: ...
def generate_deleted_models(self) -> None: ...
def generate_deleted_proxies(self) -> None: ...
def generate_removed_fields(self) -> None: ...
def generate_removed_indexes(self) -> None: ...
def generate_renamed_fields(self) -> None: ...
def generate_renamed_models(self) -> None: ...
def only_relation_agnostic_fields(self, fields: Any) -> Any: ...
@classmethod
def parse_number(cls, name: str) -> int: ...
@classmethod
def suggest_name(
cls,
ops: Union[List[Union[CreateModel, FieldOperation]], List[CreateModel], List[ModelOperation], List[DeleteModel]]
) -> str: ...
def swappable_first_key(self, item: Tuple[str, str]) -> Tuple[str, str]: ...

View File

@@ -0,0 +1,16 @@
from django.db.migrations.migration import Migration
from typing import (
Optional,
Tuple,
Union,
)
class NodeNotFoundError:
def __init__(
self,
message: str,
node: Tuple[str, str],
origin: Optional[Union[str, Migration]] = ...
) -> None: ...
def __str__(self) -> str: ...

View File

@@ -0,0 +1,63 @@
from django.db import DefaultConnectionProxy
from django.db.backends.base.base import BaseDatabaseWrapper
from django.db.migrations.migration import Migration
from django.db.migrations.state import ProjectState
from typing import (
Any,
Callable,
List,
Optional,
Set,
Tuple,
Union,
)
class MigrationExecutor:
def __init__(
self,
connection: Optional[Union[DefaultConnectionProxy, backends.base.base.BaseDatabaseWrapper]],
progress_callback: Optional[Callable] = ...
) -> None: ...
def _create_project_state(self, with_applied_migrations: bool = ...) -> ProjectState: ...
def _migrate_all_backwards(self, plan: Any, full_plan: Any, fake: bool) -> ProjectState: ...
def _migrate_all_forwards(
self,
state: ProjectState,
plan: Any,
full_plan: Any,
fake: bool,
fake_initial: bool
) -> ProjectState: ...
def apply_migration(
self,
state: ProjectState,
migration: Migration,
fake: bool = ...,
fake_initial: bool = ...
) -> ProjectState: ...
def check_replacements(self) -> None: ...
def detect_soft_applied(
self,
project_state: None,
migration: Migration
) -> Tuple[bool, ProjectState]: ...
def migrate(
self,
targets: Optional[Union[List[Tuple[str, str]], List[Tuple[str, None]]]],
plan: Any = ...,
state: Optional[ProjectState] = ...,
fake: bool = ...,
fake_initial: bool = ...
) -> ProjectState: ...
def migration_plan(
self,
targets: Union[Set[Tuple[str, str]], List[Tuple[str, str]], List[Tuple[str, None]]],
clean_start: bool = ...
) -> Any: ...
def unapply_migration(
self,
state: ProjectState,
migration: Migration,
fake: bool = ...
) -> ProjectState: ...

View File

@@ -0,0 +1,65 @@
from django.db.migrations.migration import SwappableTuple
from django.db.migrations.state import ProjectState
from typing import (
Any,
Callable,
List,
Optional,
Tuple,
Union,
)
class DummyNode:
def __init__(self, key: Tuple[str, str], origin: Any, error_message: str) -> None: ...
def promote(self) -> None: ...
def raise_error(self): ...
class MigrationGraph:
def __contains__(self, node: Union[SwappableTuple, Tuple[str, str]]) -> bool: ...
def __init__(self) -> None: ...
def __repr__(self) -> str: ...
def __str__(self) -> str: ...
def _generate_plan(self, nodes: List[Tuple[str, str]], at_end: bool) -> List[Tuple[str, str]]: ...
def _nodes_and_edges(self) -> Tuple[int, int]: ...
def add_dependency(
self,
migration: Any,
child: Tuple[str, str],
parent: Tuple[str, str],
skip_validation: bool = ...
) -> None: ...
def add_dummy_node(self, key: Tuple[str, str], origin: Any, error_message: str) -> None: ...
def add_node(self, key: Tuple[str, str], migration: Any) -> None: ...
def backwards_plan(self, target: Union[Tuple[str, str], Node]) -> List[Tuple[str, str]]: ...
def clear_cache(self) -> None: ...
def ensure_not_cyclic(
self,
start: Union[Node, Tuple[str, str]],
get_children: Callable
) -> None: ...
def forwards_plan(self, target: Tuple[str, str]) -> List[Tuple[str, str]]: ...
def leaf_nodes(self, app: Optional[str] = ...) -> List[Tuple[str, str]]: ...
def make_state(
self,
nodes: Optional[Tuple[str, str]] = ...,
at_end: bool = ...,
real_apps: List[str] = ...
) -> ProjectState: ...
def remove_replaced_nodes(self, replacement: Tuple[str, str], replaced: List[Tuple[str, str]]) -> None: ...
def remove_replacement_node(self, replacement: Tuple[str, str], replaced: List[Tuple[str, str]]) -> None: ...
def root_nodes(self, app: Optional[str] = ...) -> List[Tuple[str, str]]: ...
def validate_consistency(self) -> None: ...
class Node:
def __eq__(self, other: Tuple[str, str]) -> bool: ...
def __getitem__(self, item: int) -> str: ...
def __hash__(self) -> int: ...
def __init__(self, key: Tuple[str, str]) -> None: ...
def __lt__(self, other: Union[Node, Tuple[str, str]]) -> bool: ...
def add_child(self, child: Node) -> None: ...
def add_parent(self, parent: Node) -> None: ...
def ancestors(self) -> List[Tuple[str, str]]: ...
def descendants(self) -> List[Tuple[str, str]]: ...

View File

@@ -0,0 +1,54 @@
from django.db import DefaultConnectionProxy
from django.db.backends.sqlite3.base import DatabaseWrapper
from django.db.migrations.migration import (
Migration,
SwappableTuple,
)
from django.db.migrations.state import ProjectState
from typing import (
Dict,
Optional,
Set,
Tuple,
Union,
)
class MigrationLoader:
def __init__(
self,
connection: Optional[Union[DefaultConnectionProxy, backends.sqlite3.base.DatabaseWrapper]],
load: bool = ...,
ignore_no_migrations: bool = ...
) -> None: ...
def add_external_dependencies(
self,
key: Tuple[str, str],
migration: Migration
) -> None: ...
def add_internal_dependencies(
self,
key: Tuple[str, str],
migration: Migration
) -> None: ...
def build_graph(self) -> None: ...
def check_consistent_history(
self,
connection: Union[DefaultConnectionProxy, backends.sqlite3.base.DatabaseWrapper]
) -> None: ...
def check_key(
self,
key: Union[SwappableTuple, Tuple[str, str]],
current_app: str
) -> Optional[Tuple[str, str]]: ...
def detect_conflicts(self) -> Dict[str, Set[str]]: ...
def get_migration(self, app_label: str, name_prefix: str) -> Migration: ...
def get_migration_by_prefix(self, app_label: str, name_prefix: str) -> Migration: ...
def load_disk(self) -> None: ...
@classmethod
def migrations_module(cls, app_label: str) -> Union[Tuple[None, bool], Tuple[str, bool]]: ...
def project_state(
self,
nodes: Optional[Tuple[str, str]] = ...,
at_end: bool = ...
) -> ProjectState: ...

View File

@@ -0,0 +1,43 @@
from django.db.backends.sqlite3.schema import DatabaseSchemaEditor
from django.db.migrations.state import ProjectState
from typing import (
Tuple,
Type,
)
def swappable_dependency(value: str) -> SwappableTuple: ...
class Migration:
def __eq__(self, other: Migration) -> bool: ...
def __hash__(self) -> int: ...
def __init__(self, name: str, app_label: str) -> None: ...
def __repr__(self) -> str: ...
def __str__(self) -> str: ...
def apply(
self,
project_state: ProjectState,
schema_editor: DatabaseSchemaEditor,
collect_sql: bool = ...
) -> ProjectState: ...
def mutate_state(
self,
project_state: ProjectState,
preserve: bool = ...
) -> ProjectState: ...
def unapply(
self,
project_state: ProjectState,
schema_editor: DatabaseSchemaEditor,
collect_sql: bool = ...
) -> ProjectState: ...
class SwappableTuple:
@staticmethod
def __new__(
cls: Type[SwappableTuple],
value: Tuple[str, str],
setting: str
) -> SwappableTuple: ...

View File

@@ -0,0 +1,22 @@
from django.db.migrations.operations.models import CreateModel
from typing import (
Any,
List,
Optional,
Tuple,
Union,
)
class Operation:
@staticmethod
def __new__(cls: Any, *args, **kwargs) -> Operation: ...
def _get_model_tuple(self, remote_model: str, app_label: str, model_name: str) -> Tuple[str, str]: ...
def reduce(
self,
operation: Operation,
in_between: Any,
app_label: Optional[str] = ...
) -> Union[bool, List[CreateModel]]: ...
def references_field(self, model_name: str, name: str, app_label: str = ...) -> bool: ...
def references_model(self, name: str, app_label: str = ...) -> bool: ...

View File

@@ -0,0 +1,141 @@
from django.db.backends.sqlite3.schema import DatabaseSchemaEditor
from django.db.migrations.operations.base import Operation
from django.db.migrations.operations.models import (
AlterUniqueTogether,
DeleteModel,
)
from django.db.migrations.state import ProjectState
from django.db.models.fields import (
CharField,
Field,
IntegerField,
SlugField,
)
from typing import (
Any,
Dict,
List,
Optional,
Tuple,
Union,
)
class AddField:
def __init__(
self,
model_name: str,
name: str,
field: Field,
preserve_default: bool = ...
) -> None: ...
def database_backwards(
self,
app_label: str,
schema_editor: DatabaseSchemaEditor,
from_state: ProjectState,
to_state: ProjectState
) -> None: ...
def database_forwards(
self,
app_label: str,
schema_editor: DatabaseSchemaEditor,
from_state: ProjectState,
to_state: ProjectState
) -> None: ...
def deconstruct(self) -> Any: ...
def describe(self) -> str: ...
def reduce(
self,
operation: Operation,
in_between: List[AddField],
app_label: Optional[str] = ...
) -> Union[bool, List[AddField]]: ...
def state_forwards(self, app_label: str, state: ProjectState) -> None: ...
class AlterField:
def __init__(
self,
model_name: str,
name: str,
field: Field,
preserve_default: bool = ...
) -> None: ...
def database_backwards(
self,
app_label: str,
schema_editor: DatabaseSchemaEditor,
from_state: ProjectState,
to_state: ProjectState
) -> None: ...
def database_forwards(
self,
app_label: str,
schema_editor: DatabaseSchemaEditor,
from_state: ProjectState,
to_state: ProjectState
) -> None: ...
def deconstruct(
self
) -> Union[Tuple[str, List[Any], Dict[str, Union[str, SlugField]]], Tuple[str, List[Any], Dict[str, Union[str, CharField]]], Tuple[str, List[Any], Dict[str, Union[str, IntegerField]]]]: ...
def describe(self) -> str: ...
def reduce(
self,
operation: Union[DeleteModel, AlterField, AlterUniqueTogether],
in_between: List[Any],
app_label: str = ...
) -> bool: ...
def state_forwards(self, app_label: str, state: ProjectState) -> None: ...
class FieldOperation:
def __init__(self, model_name: str, name: str) -> None: ...
def is_same_field_operation(self, operation: FieldOperation) -> bool: ...
def is_same_model_operation(self, operation: FieldOperation) -> bool: ...
@cached_property
def model_name_lower(self) -> str: ...
@cached_property
def name_lower(self) -> str: ...
def reduce(
self,
operation: Operation,
in_between: Any,
app_label: str = ...
) -> bool: ...
def references_field(self, model_name: str, name: str, app_label: Optional[str] = ...) -> bool: ...
def references_model(self, name: str, app_label: Optional[str] = ...) -> bool: ...
class RemoveField:
def database_backwards(
self,
app_label: str,
schema_editor: DatabaseSchemaEditor,
from_state: ProjectState,
to_state: ProjectState
) -> None: ...
def database_forwards(
self,
app_label: str,
schema_editor: DatabaseSchemaEditor,
from_state: ProjectState,
to_state: ProjectState
) -> None: ...
def deconstruct(self) -> Tuple[str, List[Any], Dict[str, str]]: ...
def describe(self) -> str: ...
def state_forwards(self, app_label: str, state: ProjectState) -> None: ...
class RenameField:
def __init__(self, model_name: str, old_name: str, new_name: str) -> None: ...
def deconstruct(self) -> Tuple[str, List[Any], Dict[str, str]]: ...
@cached_property
def old_name_lower(self) -> str: ...
def reduce(
self,
operation: Union[FieldOperation, AlterUniqueTogether],
in_between: List[Any],
app_label: Optional[str] = ...
) -> Union[bool, List[RenameField]]: ...
def state_forwards(self, app_label: str, state: ProjectState) -> None: ...

View File

@@ -0,0 +1,258 @@
from django.db.backends.sqlite3.schema import DatabaseSchemaEditor
from django.db.migrations.operations.base import Operation
from django.db.migrations.state import ProjectState
from django.db.models.indexes import Index
from typing import (
Any,
Dict,
Iterator,
List,
Optional,
Set,
Tuple,
Union,
)
def _check_for_duplicates(arg_name: str, objs: Iterator[Any]) -> None: ...
class AddIndex:
def __init__(self, model_name: str, index: Index) -> None: ...
def database_backwards(
self,
app_label: str,
schema_editor: DatabaseSchemaEditor,
from_state: ProjectState,
to_state: ProjectState
) -> None: ...
def database_forwards(
self,
app_label: str,
schema_editor: DatabaseSchemaEditor,
from_state: ProjectState,
to_state: ProjectState
) -> None: ...
def describe(self) -> str: ...
def state_forwards(self, app_label: str, state: ProjectState) -> None: ...
class AlterIndexTogether:
def __init__(
self,
name: str,
index_together: Optional[Union[List[List[str]], List[Tuple[str, str]], Set[Tuple[str, str]]]]
) -> None: ...
def database_forwards(
self,
app_label: str,
schema_editor: DatabaseSchemaEditor,
from_state: ProjectState,
to_state: ProjectState
) -> None: ...
def deconstruct(self) -> Tuple[str, List[Any], Dict[str, Union[str, Set[Tuple[str, str]]]]]: ...
def references_field(self, model_name: str, name: str, app_label: None = ...) -> bool: ...
class AlterModelManagers:
def __init__(self, name: str, managers: List[Any]) -> None: ...
def describe(self) -> str: ...
class AlterModelOptions:
def __init__(self, name: str, options: Dict[str, Union[List[Tuple[str, str]], str]]) -> None: ...
def deconstruct(self) -> Tuple[str, List[Any], Dict[str, Union[str, Dict[str, List[Tuple[str, str]]]]]]: ...
class AlterModelTable:
def __init__(self, name: str, table: str) -> None: ...
def database_forwards(
self,
app_label: str,
schema_editor: DatabaseSchemaEditor,
from_state: ProjectState,
to_state: ProjectState
) -> None: ...
def deconstruct(self) -> Tuple[str, List[Any], Dict[str, str]]: ...
def describe(self) -> str: ...
def reduce(
self,
operation: DeleteModel,
in_between: List[Any],
app_label: None = ...
) -> List[DeleteModel]: ...
def state_forwards(self, app_label: str, state: ProjectState) -> None: ...
class AlterOrderWithRespectTo:
def __init__(self, name: str, order_with_respect_to: str) -> None: ...
def database_backwards(
self,
app_label: str,
schema_editor: DatabaseSchemaEditor,
from_state: ProjectState,
to_state: ProjectState
) -> None: ...
def deconstruct(self) -> Tuple[str, List[Any], Dict[str, str]]: ...
def describe(self) -> str: ...
def references_field(self, model_name: str, name: str, app_label: None = ...) -> bool: ...
class AlterUniqueTogether:
def __init__(
self,
name: str,
unique_together: Optional[Union[List[List[str]], Set[Tuple[str, str]], List[Tuple[str, str]]]]
) -> None: ...
def database_backwards(
self,
app_label: str,
schema_editor: DatabaseSchemaEditor,
from_state: ProjectState,
to_state: ProjectState
) -> None: ...
def database_forwards(
self,
app_label: str,
schema_editor: DatabaseSchemaEditor,
from_state: ProjectState,
to_state: ProjectState
) -> None: ...
def deconstruct(self) -> Tuple[str, List[Any], Dict[str, Union[str, Set[Tuple[str, str]]]]]: ...
def describe(self) -> str: ...
def references_field(self, model_name: str, name: str, app_label: Optional[str] = ...) -> bool: ...
def state_forwards(self, app_label: str, state: ProjectState) -> None: ...
class CreateModel:
def __init__(
self,
name: str,
fields: Any,
options: Any = ...,
bases: Any = ...,
managers: Any = ...
) -> None: ...
def database_backwards(
self,
app_label: str,
schema_editor: DatabaseSchemaEditor,
from_state: ProjectState,
to_state: ProjectState
) -> None: ...
def database_forwards(
self,
app_label: str,
schema_editor: DatabaseSchemaEditor,
from_state: ProjectState,
to_state: ProjectState
) -> None: ...
def deconstruct(self) -> Any: ...
def describe(self) -> str: ...
def model_to_key(self, model: str) -> List[str]: ...
def reduce(
self,
operation: Operation,
in_between: Any,
app_label: Optional[str] = ...
) -> Union[bool, List[CreateModel]]: ...
def references_model(self, name: str, app_label: Optional[str] = ...) -> bool: ...
def state_forwards(self, app_label: str, state: ProjectState) -> None: ...
class DeleteModel:
def database_backwards(
self,
app_label: str,
schema_editor: DatabaseSchemaEditor,
from_state: ProjectState,
to_state: ProjectState
) -> None: ...
def database_forwards(
self,
app_label: str,
schema_editor: DatabaseSchemaEditor,
from_state: ProjectState,
to_state: ProjectState
) -> None: ...
def deconstruct(self) -> Tuple[str, List[Any], Dict[str, str]]: ...
def describe(self) -> str: ...
def state_forwards(self, app_label: str, state: ProjectState) -> None: ...
class FieldRelatedOptionOperation:
def reduce(
self,
operation: Operation,
in_between: List[DeleteModel],
app_label: Optional[str] = ...
) -> Any: ...
class IndexOperation:
@cached_property
def model_name_lower(self) -> str: ...
class ModelOperation:
def __init__(self, name: str) -> None: ...
@cached_property
def name_lower(self) -> str: ...
def reduce(
self,
operation: Operation,
in_between: Any,
app_label: Optional[str] = ...
) -> bool: ...
def references_model(self, name: str, app_label: Optional[str] = ...) -> bool: ...
class ModelOptionOperation:
def reduce(
self,
operation: Operation,
in_between: List[DeleteModel],
app_label: Optional[str] = ...
) -> Union[bool, List[AlterUniqueTogether]]: ...
class RemoveIndex:
def __init__(self, model_name: str, name: str) -> None: ...
def database_backwards(
self,
app_label: str,
schema_editor: DatabaseSchemaEditor,
from_state: ProjectState,
to_state: ProjectState
) -> None: ...
def state_forwards(self, app_label: str, state: ProjectState) -> None: ...
class RenameModel:
def __init__(self, old_name: str, new_name: str) -> None: ...
def database_backwards(
self,
app_label: str,
schema_editor: DatabaseSchemaEditor,
from_state: ProjectState,
to_state: ProjectState
) -> None: ...
def database_forwards(
self,
app_label: str,
schema_editor: DatabaseSchemaEditor,
from_state: ProjectState,
to_state: ProjectState
) -> None: ...
def deconstruct(self) -> Tuple[str, List[Any], Dict[str, str]]: ...
@cached_property
def new_name_lower(self) -> str: ...
@cached_property
def old_name_lower(self) -> str: ...
def reduce(
self,
operation: AlterModelTable,
in_between: List[Any],
app_label: str = ...
) -> bool: ...
def state_forwards(self, app_label: str, state: ProjectState) -> None: ...

View File

@@ -0,0 +1,89 @@
from django.db.backends.sqlite3.schema import DatabaseSchemaEditor
from django.db.migrations.operations.fields import AddField
from django.db.migrations.operations.models import (
CreateModel,
ModelOperation,
)
from django.db.migrations.state import (
ProjectState,
StateApps,
)
from typing import (
Callable,
Dict,
List,
Optional,
Union,
)
class RunPython:
def __init__(
self,
code: Union[str, Callable],
reverse_code: Optional[Callable] = ...,
atomic: None = ...,
hints: Optional[Dict[str, str]] = ...,
elidable: bool = ...
) -> None: ...
def database_backwards(
self,
app_label: str,
schema_editor: DatabaseSchemaEditor,
from_state: ProjectState,
to_state: ProjectState
) -> None: ...
def database_forwards(
self,
app_label: str,
schema_editor: DatabaseSchemaEditor,
from_state: ProjectState,
to_state: ProjectState
) -> None: ...
def describe(self) -> str: ...
@staticmethod
def noop(
apps: StateApps,
schema_editor: DatabaseSchemaEditor
) -> None: ...
@property
def reversible(self) -> bool: ...
def state_forwards(self, app_label: str, state: ProjectState) -> None: ...
class RunSQL:
def _run_sql(
self,
schema_editor: DatabaseSchemaEditor,
sqls: Union[str, List[str]]
) -> None: ...
def database_backwards(
self,
app_label: str,
schema_editor: DatabaseSchemaEditor,
from_state: ProjectState,
to_state: ProjectState
) -> None: ...
def database_forwards(
self,
app_label: str,
schema_editor: DatabaseSchemaEditor,
from_state: ProjectState,
to_state: ProjectState
) -> None: ...
class SeparateDatabaseAndState:
def __init__(
self,
database_operations: List[ModelOperation] = ...,
state_operations: Union[List[AddField], List[CreateModel], List[ModelOperation]] = ...
) -> None: ...
def database_forwards(
self,
app_label: str,
schema_editor: DatabaseSchemaEditor,
from_state: ProjectState,
to_state: ProjectState
) -> None: ...
def state_forwards(self, app_label: str, state: ProjectState) -> None: ...

View File

@@ -0,0 +1,10 @@
from django.db.migrations.state import ProjectState
from django.db.models.fields import Field
def is_referenced_by_foreign_key(
state: ProjectState,
model_name_lower: str,
field: Field,
field_name: str
) -> bool: ...

View File

@@ -0,0 +1,9 @@
from typing import (
Any,
Optional,
)
class MigrationOptimizer:
def optimize(self, operations: Any, app_label: Optional[str] = ...) -> Any: ...
def optimize_inner(self, operations: Any, app_label: Optional[str] = ...) -> Any: ...

View File

@@ -0,0 +1,40 @@
from django.db.migrations.state import ModelState
from django.db.models.fields import IntegerField
from django.db.models.fields.related import ForeignKey
from typing import (
Dict,
Optional,
Set,
Union,
)
class InteractiveMigrationQuestioner:
def _ask_default(self, default: str = ...) -> int: ...
def _boolean_input(self, question: str, default: bool = ...) -> bool: ...
def ask_auto_now_add_addition(self, field_name: str, model_name: str) -> int: ...
def ask_not_null_addition(self, field_name: str, model_name: str) -> None: ...
class MigrationQuestioner:
def __init__(
self,
defaults: Optional[Dict[str, bool]] = ...,
specified_apps: Optional[Set[str]] = ...,
dry_run: Optional[bool] = ...
) -> None: ...
def ask_auto_now_add_addition(self, field_name: str, model_name: str) -> None: ...
def ask_initial(self, app_label: str) -> bool: ...
def ask_not_null_addition(self, field_name: str, model_name: str) -> None: ...
def ask_rename(
self,
model_name: str,
old_name: str,
new_name: str,
field_instance: Union[IntegerField, related.ForeignKey]
) -> bool: ...
def ask_rename_model(
self,
old_model_state: ModelState,
new_model_state: ModelState
) -> bool: ...

View File

@@ -0,0 +1,24 @@
from django.db import DefaultConnectionProxy
from django.db.backends.base.base import BaseDatabaseWrapper
from django.db.models.query import QuerySet
from typing import (
Optional,
Set,
Tuple,
Union,
)
class MigrationRecorder:
def __init__(
self,
connection: Optional[Union[DefaultConnectionProxy, backends.base.base.BaseDatabaseWrapper]]
) -> None: ...
def applied_migrations(self) -> Set[Tuple[str, str]]: ...
def ensure_schema(self) -> None: ...
def flush(self) -> None: ...
def has_table(self) -> bool: ...
@property
def migration_qs(self) -> QuerySet: ...
def record_applied(self, app: str, name: str) -> None: ...
def record_unapplied(self, app: str, name: str) -> None: ...

View File

@@ -0,0 +1,103 @@
from typing import (
Any,
Dict,
List,
Set,
Tuple,
Union,
)
def serializer_factory(value: Any) -> BaseSerializer: ...
class BaseSequenceSerializer:
def serialize(self) -> Union[Tuple[str, Set[Any]], Tuple[str, Set[str]]]: ...
class BaseSerializer:
def __init__(self, value: Any) -> None: ...
class BaseSimpleSerializer:
def serialize(self) -> Tuple[str, Set[Any]]: ...
class DateSerializer:
def serialize(self) -> Tuple[str, Set[str]]: ...
class DatetimeSerializer:
def serialize(self) -> Tuple[str, Set[str]]: ...
class DeconstructableSerializer:
@staticmethod
def _serialize_path(path: str) -> Tuple[str, Set[str]]: ...
def serialize(self) -> Tuple[str, Set[str]]: ...
@staticmethod
def serialize_deconstructed(
path: str,
args: Union[Tuple, List[str]],
kwargs: Dict[str, Any]
) -> Tuple[str, Set[str]]: ...
class DictionarySerializer:
def serialize(self) -> Tuple[str, Set[Any]]: ...
class EnumSerializer:
def serialize(self) -> Tuple[str, Set[str]]: ...
class FloatSerializer:
def serialize(self) -> Tuple[str, Set[Any]]: ...
class FrozensetSerializer:
def _format(self) -> str: ...
class FunctionTypeSerializer:
def serialize(self) -> Tuple[str, Set[str]]: ...
class ModelFieldSerializer:
def serialize(self) -> Tuple[str, Set[str]]: ...
class ModelManagerSerializer:
def serialize(self) -> Tuple[str, Set[str]]: ...
class OperationSerializer:
def serialize(self) -> Tuple[str, Set[str]]: ...
class RegexSerializer:
def serialize(self) -> Tuple[str, Set[str]]: ...
class SequenceSerializer:
def _format(self) -> str: ...
class SetSerializer:
def _format(self) -> str: ...
class TimedeltaSerializer:
def serialize(self) -> Tuple[str, Set[str]]: ...
class TupleSerializer:
def _format(self) -> str: ...
class TypeSerializer:
def serialize(self) -> Union[Tuple[str, Set[Any]], Tuple[str, Set[str]]]: ...
class UUIDSerializer:
def serialize(self) -> Tuple[str, Set[str]]: ...

View File

@@ -0,0 +1,35 @@
from django.apps.registry import Apps
from django.db.models.fields import Field
from django.db.models.indexes import Index
from typing import (
Any,
Iterator,
)
class AppConfigStub:
def __init__(self, label: str) -> None: ...
def import_models(self) -> None: ...
class ModelState:
def __eq__(self, other: ModelState) -> bool: ...
def __init__(
self,
app_label: str,
name: str,
fields: Any,
options: Any = ...,
bases: Any = ...,
managers: Any = ...
) -> None: ...
def __repr__(self) -> str: ...
def clone(self) -> ModelState: ...
def construct_managers(self) -> Iterator[Any]: ...
@classmethod
def from_model(cls, model: Any, exclude_rels: bool = ...) -> ModelState: ...
def get_field_by_name(self, name: str) -> Field: ...
def get_index_by_name(self, name: str) -> Index: ...
@cached_property
def name_lower(self) -> str: ...
def render(self, apps: Apps): ...

View File

@@ -0,0 +1,10 @@
from typing import (
Any,
Iterator,
)
def stable_topological_sort(l: Any, dependency_graph: Any) -> Any: ...
def topological_sort_as_sets(dependency_graph: Any) -> Iterator[Any]: ...

View File

@@ -0,0 +1,9 @@
from django.utils.functional import SimpleLazyObject
def get_migration_name_timestamp() -> str: ...
class RegexObject:
def __eq__(self, other: RegexObject) -> bool: ...
def __init__(self, obj: SimpleLazyObject) -> None: ...

View File

@@ -0,0 +1,41 @@
from django.db.migrations.migration import Migration
from django.db.migrations.operations.base import Operation
from typing import (
Any,
Set,
Tuple,
Type,
Union,
)
class MigrationWriter:
def __init__(self, migration: Migration) -> None: ...
def as_string(self) -> str: ...
@property
def basedir(self) -> str: ...
@property
def filename(self) -> str: ...
@property
def path(self) -> str: ...
@classmethod
def serialize(cls, value: Any) -> Union[Tuple[str, Set[Any]], Tuple[str, Set[str]]]: ...
class OperationWriter:
def __init__(self, operation: Operation, indentation: int = ...) -> None: ...
def feed(self, line: str) -> None: ...
def indent(self) -> None: ...
def render(self) -> str: ...
def serialize(self) -> Union[Tuple[str, Set[Any]], Tuple[str, Set[str]]]: ...
def unindent(self) -> None: ...
class SettingsReference:
def __init__(self, value: str, setting_name: str) -> None: ...
@staticmethod
def __new__(
self: Type[SettingsReference],
value: str,
setting_name: str
) -> SettingsReference: ...

View File

@@ -0,0 +1,66 @@
from django.db.backends.sqlite3.base import DatabaseWrapper
from django.db.models.fields import Field
from django.db.models.query_utils import Q
from django.db.models.sql.compiler import SQLCompiler
from django.db.models.sql.query import Query
from typing import (
Any,
Dict,
List,
Optional,
)
class Aggregate:
def __init__(self, *args, filter = ..., **kwargs) -> None: ...
def _get_repr_options(self) -> Dict[str, Q]: ...
def as_sql(
self,
compiler: SQLCompiler,
connection: DatabaseWrapper,
**extra_context
) -> Any: ...
@property
def default_alias(self) -> str: ...
def get_group_by_cols(self) -> List[Any]: ...
def get_source_expressions(self) -> Any: ...
def get_source_fields(self) -> Any: ...
def resolve_expression(
self,
query: Query = ...,
allow_joins: bool = ...,
reuse: None = ...,
summarize: bool = ...,
for_save: bool = ...
) -> Aggregate: ...
def set_source_expressions(self, exprs: Any) -> None: ...
class Avg:
def _resolve_output_field(self) -> Field: ...
class Count:
def __init__(
self,
expression: str,
distinct: bool = ...,
filter: Optional[Q] = ...,
**extra
) -> None: ...
def _get_repr_options(self) -> Dict[str, bool]: ...
def convert_value(
self,
value: Optional[int],
expression: Count,
connection: DatabaseWrapper
) -> int: ...
class StdDev:
def __init__(self, expression: str, sample: bool = ..., **extra) -> None: ...
class Variance:
def __init__(self, expression: str, sample: bool = ..., **extra) -> None: ...
def _get_repr_options(self) -> Dict[str, bool]: ...

18
django/db/models/base.pyi Normal file
View File

@@ -0,0 +1,18 @@
from typing import (
Any,
Dict,
List,
)
class Model:
def __eq__(self, other: object) -> bool: ...
def __getstate__(self) -> Dict[str, Any]: ...
def __hash__(self) -> int: ...
def __init__(self, *args, **kwargs) -> None: ...
def __reduce__(self) -> Any: ...
def __repr__(self) -> str: ...
def __setstate__(self, state: Dict[str, Any]) -> None: ...
def __str__(self) -> str: ...
@classmethod
def _check_column_name_clashes(cls) -> List[Any]: ...

View File

@@ -0,0 +1,94 @@
from django.db.models.base import Model
from django.db.models.fields.related import ForeignKey
from django.db.models.fields.reverse_related import ManyToOneRel
from django.db.models.options import Options
from django.db.models.query import QuerySet
from typing import (
Any,
Callable,
Dict,
Iterator,
List,
Optional,
Tuple,
Union,
)
def CASCADE(
collector: Collector,
field: ForeignKey,
sub_objs: QuerySet,
using: str
) -> None: ...
def SET(value: int) -> Callable: ...
def SET_DEFAULT(
collector: Collector,
field: ForeignKey,
sub_objs: QuerySet,
using: str
) -> None: ...
def SET_NULL(
collector: Collector,
field: ForeignKey,
sub_objs: QuerySet,
using: str
) -> None: ...
def get_candidate_relations_to_delete(opts: Options) -> Iterator[Any]: ...
class Collector:
def __init__(self, using: str) -> None: ...
def add(
self,
objs: Any,
source: Any = ...,
nullable: bool = ...,
reverse_dependency: bool = ...
) -> Any: ...
def add_field_update(
self,
field: ForeignKey,
value: Optional[int],
objs: QuerySet
) -> None: ...
def can_fast_delete(
self,
objs: Any,
from_field: Optional[ForeignKey] = ...
) -> bool: ...
def collect(
self,
objs: Any,
source: Any = ...,
nullable: bool = ...,
collect_related: bool = ...,
source_attr: Optional[str] = ...,
reverse_dependency: bool = ...,
keep_parents: bool = ...
) -> None: ...
def delete(self) -> Union[Tuple[int, Dict[Any, Any]], Tuple[int, Dict[str, int]]]: ...
def get_del_batches(self, objs: Any, field: ForeignKey) -> Any: ...
def instances_with_model(self) -> Iterator[Any]: ...
def related_objects(
self,
related: ManyToOneRel,
objs: Any
) -> QuerySet: ...
def sort(self) -> None: ...
class ProtectedError:
def __init__(
self,
msg: str,
protected_objects: Union[QuerySet, List[Model]]
) -> None: ...

View File

@@ -0,0 +1,335 @@
from collections import OrderedDict
from datetime import (
datetime,
timedelta,
)
from django.db.backends.sqlite3.base import DatabaseWrapper
from django.db.models.aggregates import Count
from django.db.models.fields import Field
from django.db.models.fields.related import ForeignKey
from django.db.models.fields.reverse_related import ForeignObjectRel
from django.db.models.functions.datetime import Trunc
from django.db.models.functions.text import BytesToCharFieldConversionMixin
from django.db.models.query_utils import Q
from django.db.models.sql.compiler import SQLCompiler
from django.db.models.sql.query import Query
from django.db.models.sql.where import WhereNode
from typing import (
Any,
Callable,
Dict,
Iterator,
List,
Optional,
Set,
Tuple,
Union,
)
class BaseExpression:
def __eq__(self, other: Expression) -> bool: ...
def __getstate__(self) -> Dict[str, Any]: ...
def __hash__(self) -> int: ...
def __init__(
self,
output_field: Optional[Union[str, ForeignObjectRel, Field]] = ...
) -> None: ...
@staticmethod
def _convert_value_noop(
value: str,
expression: BytesToCharFieldConversionMixin,
connection: DatabaseWrapper
) -> str: ...
@cached_property
def _output_field_or_none(self) -> Any: ...
def _parse_expressions(self, *expressions) -> Any: ...
def _prepare(self, field: Any) -> Expression: ...
def _resolve_output_field(self) -> Any: ...
def asc(self, **kwargs) -> OrderBy: ...
@cached_property
def contains_aggregate(self) -> bool: ...
@cached_property
def contains_column_references(self) -> bool: ...
@cached_property
def contains_over_clause(self) -> bool: ...
@cached_property
def convert_value(self) -> Callable: ...
def copy(self) -> BaseExpression: ...
def desc(self, **kwargs) -> OrderBy: ...
@property
def field(self) -> Any: ...
def flatten(self) -> Iterator[Union[Value, Func]]: ...
def get_db_converters(self, connection: DatabaseWrapper) -> List[Callable]: ...
def get_group_by_cols(
self
) -> Union[List[CombinedExpression], List[Trunc], List[Col]]: ...
def get_lookup(self, lookup: str) -> Any: ...
def get_source_expressions(self) -> List[Any]: ...
def get_source_fields(self) -> Any: ...
def get_transform(self, name: str) -> Any: ...
@cached_property
def output_field(self) -> Field: ...
def relabeled_clone(
self,
change_map: Union[OrderedDict, Dict[Union[str, None], str]]
) -> Expression: ...
def resolve_expression(
self,
query: Query = ...,
allow_joins: bool = ...,
reuse: Optional[Set[str]] = ...,
summarize: bool = ...,
for_save: bool = ...
) -> BaseExpression: ...
def set_source_expressions(self, exprs: List[Any]) -> None: ...
class Case:
def __init__(self, *cases, default = ..., output_field = ..., **extra) -> None: ...
def __repr__(self) -> str: ...
def as_sql(
self,
compiler: SQLCompiler,
connection: DatabaseWrapper,
template: None = ...,
case_joiner: None = ...,
**extra_context
) -> Any: ...
def copy(self) -> Case: ...
def get_source_expressions(self) -> List[Expression]: ...
def resolve_expression(
self,
query: Query = ...,
allow_joins: bool = ...,
reuse: None = ...,
summarize: bool = ...,
for_save: bool = ...
) -> Case: ...
def set_source_expressions(self, exprs: List[Expression]) -> None: ...
class Col:
def __init__(self, alias: str, target: Field, output_field: Any = ...) -> None: ...
def __repr__(self) -> str: ...
def as_sql(
self,
compiler: SQLCompiler,
connection: DatabaseWrapper
) -> Tuple[str, List[Any]]: ...
def get_db_converters(self, connection: DatabaseWrapper) -> List[Callable]: ...
def get_group_by_cols(self) -> List[Col]: ...
def relabeled_clone(
self,
relabels: Union[OrderedDict, Dict[str, str]]
) -> Col: ...
class Combinable:
def __add__(self, other: Any) -> CombinedExpression: ...
def __mod__(self, other: int) -> CombinedExpression: ...
def __mul__(
self,
other: Union[int, F, Value]
) -> CombinedExpression: ...
def __radd__(
self,
other: Optional[Union[float, int, timedelta]]
) -> CombinedExpression: ...
def __rand__(self, other: object): ...
def __rmul__(self, other: float) -> CombinedExpression: ...
def __ror__(self, other: object): ...
def __rsub__(self, other: Union[float, int]) -> CombinedExpression: ...
def __rtruediv__(self, other: int) -> CombinedExpression: ...
def __sub__(
self,
other: Union[float, timedelta, int, F]
) -> CombinedExpression: ...
def __truediv__(
self,
other: Union[int, Count]
) -> CombinedExpression: ...
def _combine(self, other: Any, connector: str, reversed: bool) -> CombinedExpression: ...
def bitleftshift(self, other: int) -> CombinedExpression: ...
class CombinedExpression:
def __init__(
self,
lhs: Combinable,
connector: str,
rhs: Combinable,
output_field: None = ...
) -> None: ...
def __str__(self) -> str: ...
def as_sql(
self,
compiler: SQLCompiler,
connection: DatabaseWrapper
) -> Union[Tuple[str, List[datetime]], Tuple[str, List[int]], Tuple[str, List[Any]], Tuple[str, List[float]]]: ...
def get_source_expressions(self) -> Any: ...
def resolve_expression(
self,
query: Query = ...,
allow_joins: bool = ...,
reuse: Optional[Set[str]] = ...,
summarize: bool = ...,
for_save: bool = ...
) -> CombinedExpression: ...
def set_source_expressions(self, exprs: Any) -> None: ...
class DurationExpression:
def as_sql(
self,
compiler: SQLCompiler,
connection: DatabaseWrapper
) -> Tuple[str, List[Any]]: ...
def compile(
self,
side: Expression,
compiler: SQLCompiler,
connection: DatabaseWrapper
) -> Union[Tuple[str, List[datetime]], Tuple[str, List[Any]]]: ...
class DurationValue:
def as_sql(
self,
compiler: SQLCompiler,
connection: DatabaseWrapper
) -> Tuple[str, List[Any]]: ...
class Exists:
def __init__(self, *args, negated = ..., **kwargs) -> None: ...
def as_sql(
self,
compiler: SQLCompiler,
connection: DatabaseWrapper,
template: None = ...,
**extra_context
) -> Union[Tuple[str, Tuple[int]], Tuple[str, Tuple]]: ...
def resolve_expression(
self,
query: Query = ...,
*args,
**kwargs
) -> Exists: ...
class ExpressionList:
def __init__(self, *expressions, **extra): ...
class ExpressionWrapper:
def __init__(
self,
expression: Union[Q, CombinedExpression],
output_field: Field
) -> None: ...
def __repr__(self) -> str: ...
def as_sql(
self,
compiler: SQLCompiler,
connection: DatabaseWrapper
) -> Union[Tuple[str, List[int]], Tuple[str, List[Any]]]: ...
def get_source_expressions(
self
) -> Union[List[Q], List[CombinedExpression], List[WhereNode]]: ...
def set_source_expressions(
self,
exprs: Union[List[WhereNode], List[CombinedExpression]]
) -> None: ...
class F:
def __eq__(self, other: F) -> bool: ...
def __hash__(self) -> int: ...
def __init__(self, name: Union[str, OuterRef]) -> None: ...
def __repr__(self) -> str: ...
def asc(self, **kwargs) -> OrderBy: ...
def desc(self, **kwargs) -> OrderBy: ...
def resolve_expression(
self,
query: Query = ...,
allow_joins: bool = ...,
reuse: Optional[Set[str]] = ...,
summarize: bool = ...,
for_save: bool = ...
) -> Expression: ...
class Func:
def __init__(self, *expressions, output_field = ..., **extra) -> None: ...
def __repr__(self) -> str: ...
def _get_repr_options(self) -> Dict[Any, Any]: ...
def as_sql(
self,
compiler: SQLCompiler,
connection: DatabaseWrapper,
function: Optional[str] = ...,
template: Optional[str] = ...,
arg_joiner: Optional[str] = ...,
**extra_context
) -> Any: ...
def copy(self) -> Func: ...
def get_source_expressions(self) -> Any: ...
def resolve_expression(
self,
query: Query = ...,
allow_joins: bool = ...,
reuse: None = ...,
summarize: bool = ...,
for_save: bool = ...
) -> Func: ...
def set_source_expressions(self, exprs: Any) -> None: ...
class OrderBy:
def __init__(
self,
expression: Combinable,
descending: bool = ...,
nulls_first: bool = ...,
nulls_last: bool = ...
) -> None: ...
def __repr__(self) -> str: ...
def as_sql(
self,
compiler: SQLCompiler,
connection: DatabaseWrapper,
template: Optional[str] = ...,
**extra_context
) -> Union[Tuple[str, List[int]], Tuple[str, Tuple], Tuple[str, List[Any]]]: ...
def as_sqlite(
self,
compiler: SQLCompiler,
connection: DatabaseWrapper
) -> Any: ...
def get_source_expressions(self) -> Any: ...
def reverse_ordering(self) -> OrderBy: ...
def set_source_expressions(self, exprs: Any) -> None: ...
class OuterRef:
def _prepare(
self,
output_field: ForeignKey = ...
) -> OuterRef: ...
def resolve_expression(
self,
query: Query = ...,
allow_joins: bool = ...,
reuse: None = ...,
summarize: bool = ...,
for_save: bool = ...
) -> F: ...
class Random:
def __repr__(self) -> str: ...
class RawSQL:
def __init__(self, sql: str, params: List[int], output_field: None = ...) -> None: ...

View File

@@ -0,0 +1,117 @@
from datetime import date
from django.core.checks.messages import (
Error,
Warning,
)
from django.db.backends.sqlite3.base import DatabaseWrapper
from django.db.models.base import Model
from django.db.models.expressions import OuterRef
from django.db.models.sql.compiler import SQLCompiler
from django.forms.fields import (
BaseTemporalField,
BooleanField,
CharField,
IntegerField,
SplitDateTimeField,
TypedChoiceField,
)
from typing import (
Any,
List,
Optional,
Union,
)
class AutoField:
def __init__(self, *args, **kwargs) -> None: ...
def _check_primary_key(self) -> List[Any]: ...
def check(self, **kwargs) -> List[Any]: ...
def contribute_to_class(self, cls: Any, name: str, **kwargs) -> None: ...
def deconstruct(self) -> Any: ...
def formfield(self, **kwargs) -> None: ...
def get_db_prep_value(
self,
value: Union[str, int],
connection: DatabaseWrapper,
prepared: bool = ...
) -> Union[str, int]: ...
def get_internal_type(self) -> str: ...
def get_prep_value(self, value: Any) -> Optional[Union[int, OuterRef]]: ...
def rel_db_type(self, connection: DatabaseWrapper) -> str: ...
def to_python(self, value: Optional[Union[str, int]]) -> Optional[int]: ...
def validate(self, value: int, model_instance: Model) -> None: ...
class BigAutoField:
def get_internal_type(self) -> str: ...
def rel_db_type(self, connection: DatabaseWrapper) -> str: ...
class BigIntegerField:
def formfield(self, **kwargs) -> IntegerField: ...
def get_internal_type(self) -> str: ...
class BinaryField:
def __init__(self, *args, **kwargs) -> None: ...
def deconstruct(self) -> Any: ...
def get_db_prep_value(
self,
value: Optional[Union[bytes, memoryview]],
connection: DatabaseWrapper,
prepared: bool = ...
) -> Optional[memoryview]: ...
def get_default(self) -> Optional[bytes]: ...
def get_internal_type(self) -> str: ...
def get_placeholder(
self,
value: Optional[memoryview],
compiler: SQLCompiler,
connection: DatabaseWrapper
) -> str: ...
def to_python(self, value: Optional[Union[str, bytes]]) -> Optional[Union[bytes, memoryview]]: ...
class BooleanField:
def formfield(self, **kwargs) -> BooleanField: ...
def get_internal_type(self) -> str: ...
def get_prep_value(self, value: Optional[Union[str, int]]) -> Optional[bool]: ...
def to_python(self, value: Optional[Union[str, int]]) -> bool: ...
class CharField:
def __init__(self, *args, **kwargs) -> None: ...
def _check_max_length_attribute(self, **kwargs) -> List[Error]: ...
def check(self, **kwargs) -> List[Error]: ...
def formfield(self, **kwargs) -> Union[CharField, TypedChoiceField]: ...
def get_internal_type(self) -> str: ...
def get_prep_value(self, value: Any) -> object: ...
def to_python(self, value: Optional[Union[int, str, Model]]) -> Optional[str]: ...
class DateField:
def __init__(
self,
verbose_name: Optional[str] = ...,
name: Optional[str] = ...,
auto_now: bool = ...,
auto_now_add: bool = ...,
**kwargs
) -> None: ...
def _check_fix_default_value(self) -> List[Warning]: ...
def contribute_to_class(self, cls: Any, name: str, **kwargs) -> None: ...
def deconstruct(self) -> Any: ...
def formfield(
self,
**kwargs
) -> Union[SplitDateTimeField, BaseTemporalField]: ...
def get_db_prep_value(
self,
value: Optional[Union[date, str]],
connection: DatabaseWrapper,
prepared: bool = ...
) -> Optional[str]: ...
def get_internal_type(self) -> str: ...
def get_prep_value(self, value: Optional[Union[str, date]]) -> Optional[date]: ...
def pre_save(self, model_instance: Model, add: bool) -> Optional[date]: ...

View File

@@ -0,0 +1,92 @@
from django.core.checks.messages import Error
from django.core.files.base import (
ContentFile,
File,
)
from django.core.files.storage import Storage
from django.core.files.uploadedfile import (
InMemoryUploadedFile,
SimpleUploadedFile,
UploadedFile,
)
from django.db.models.base import Model
from django.forms.fields import FileField
from typing import (
Any,
Callable,
Dict,
List,
Optional,
Tuple,
Union,
)
class FieldFile:
def __eq__(self, other: Optional[Union[Tuple, str, FieldFile]]) -> bool: ...
def __getstate__(self) -> Dict[str, Union[str, bool, None]]: ...
def __init__(
self,
instance: Model,
field: FileField,
name: Optional[str]
) -> None: ...
def _del_file(self) -> None: ...
def _get_file(self) -> File: ...
def _require_file(self) -> None: ...
def _set_file(self, file: Optional[File]) -> None: ...
def close(self) -> None: ...
def delete(self, save: bool = ...) -> None: ...
def open(self, mode: str = ...) -> FieldFile: ...
def save(
self,
name: str,
content: Union[ContentFile, UploadedFile],
save: bool = ...
) -> None: ...
@property
def url(self) -> str: ...
class FileDescriptor:
def __get__(
self,
instance: Any,
cls: Any = ...
) -> Union[FileDescriptor, FieldFile]: ...
def __init__(self, field: FileField) -> None: ...
def __set__(
self,
instance: Model,
value: Optional[Union[str, FieldFile, InMemoryUploadedFile]]
) -> None: ...
class FileField:
def __init__(
self,
verbose_name: Optional[str] = ...,
name: None = ...,
upload_to: Union[str, Callable] = ...,
storage: Optional[Storage] = ...,
**kwargs
) -> None: ...
def _check_primary_key(self) -> List[Error]: ...
def _check_upload_to(self) -> List[Any]: ...
def check(self, **kwargs) -> List[Any]: ...
def contribute_to_class(self, cls: Any, name: str, **kwargs) -> None: ...
def deconstruct(self) -> Any: ...
def formfield(self, **kwargs) -> FileField: ...
def generate_filename(self, instance: Any, filename: str) -> str: ...
def get_internal_type(self) -> str: ...
def get_prep_value(self, value: FieldFile) -> str: ...
def pre_save(
self,
model_instance: Model,
add: bool
) -> FieldFile: ...
def save_form_data(
self,
instance: Model,
data: Optional[Union[bool, FieldFile, SimpleUploadedFile]]
) -> None: ...

View File

@@ -0,0 +1,9 @@
from django.db.models.base import Model
from typing import Any
class FieldCacheMixin:
def delete_cached_value(self, instance: Model) -> None: ...
def get_cached_value(self, instance: Model, default: object = ...) -> Any: ...
def is_cached(self, instance: Model) -> bool: ...
def set_cached_value(self, instance: Model, value: Any) -> None: ...

View File

@@ -0,0 +1,2 @@
class OrderWrt:
def __init__(self, *args, **kwargs) -> None: ...

View File

@@ -0,0 +1,101 @@
from django.core.checks.messages import (
Error,
Warning,
)
from django.db.backends.sqlite3.base import DatabaseWrapper
from django.db.models.expressions import Col
from django.db.models.fields import Field
from django.db.models.fields.reverse_related import (
ForeignObjectRel,
ManyToOneRel,
)
from django.db.models.query_utils import (
FilteredRelation,
PathInfo,
)
from django.forms.models import ModelChoiceField
from typing import (
Any,
Callable,
Dict,
List,
Optional,
Tuple,
Union,
)
from uuid import UUID
class ForeignKey:
def __init__(
self,
to: Any,
on_delete: Callable,
related_name: Optional[str] = ...,
related_query_name: Optional[str] = ...,
limit_choices_to: Any = ...,
parent_link: bool = ...,
to_field: Optional[str] = ...,
db_constraint: bool = ...,
**kwargs
) -> None: ...
def _check_on_delete(self) -> List[Any]: ...
def _check_unique(self, **kwargs) -> List[Warning]: ...
def check(
self,
**kwargs
) -> Union[List[Error], List[Warning]]: ...
def contribute_to_related_class(
self,
cls: Any,
related: ManyToOneRel
) -> None: ...
def db_check(self, connection: DatabaseWrapper) -> List[Any]: ...
def db_parameters(self, connection: DatabaseWrapper) -> Dict[str, str]: ...
def db_type(self, connection: DatabaseWrapper) -> str: ...
def deconstruct(self) -> Any: ...
def formfield(self, *, using = ..., **kwargs) -> ModelChoiceField: ...
def get_attname(self) -> str: ...
def get_attname_column(self) -> Tuple[str, str]: ...
def get_col(self, alias: str, output_field: Any = ...) -> Col: ...
def get_db_converters(self, connection: DatabaseWrapper) -> List[Any]: ...
def get_db_prep_save(
self,
value: Any,
connection: DatabaseWrapper
) -> Optional[Union[str, int]]: ...
def get_db_prep_value(
self,
value: Union[str, UUID, int],
connection: DatabaseWrapper,
prepared: bool = ...
) -> Union[str, int]: ...
def get_default(self) -> Optional[int]: ...
def get_reverse_path_info(
self,
filtered_relation: Optional[FilteredRelation] = ...
) -> List[PathInfo]: ...
@property
def target_field(self) -> Field: ...
def to_python(self, value: Union[str, int]) -> Union[str, int]: ...
def validate(self, value: int, model_instance: Any) -> None: ...
class ForeignObject:
def __init__(
self,
to: Any,
on_delete: Callable,
from_fields: Union[Tuple[str, str], List[str]],
to_fields: Union[List[str], List[None], Tuple[str, str]],
rel: Optional[ForeignObjectRel] = ...,
related_name: Optional[str] = ...,
related_query_name: None = ...,
limit_choices_to: None = ...,
parent_link: bool = ...,
swappable: bool = ...,
**kwargs
) -> None: ...
def _check_to_fields_exist(self) -> List[Error]: ...
def _check_unique_target(self) -> List[Error]: ...
def check(self, **kwargs) -> List[Error]: ...

View File

@@ -0,0 +1,61 @@
from django.core.exceptions import ObjectDoesNotExist
from django.db.models.base import Model
from django.db.models.fields.related import ForeignObject
from django.db.models.fields.reverse_related import (
ForeignObjectRel,
ManyToManyRel,
OneToOneRel,
)
from django.db.models.query import QuerySet
from typing import (
Any,
Callable,
Optional,
Tuple,
Type,
)
class ForwardManyToOneDescriptor:
@cached_property
def RelatedObjectDoesNotExist(self) -> Type[ObjectDoesNotExist]: ...
def __get__(self, instance: Any, cls: Any = ...) -> Any: ...
def __init__(self, field_with_rel: ForeignObject) -> None: ...
def __set__(self, instance: Model, value: Any) -> None: ...
def get_object(self, instance: Model) -> Model: ...
def get_prefetch_queryset(
self,
instances: Any,
queryset: Optional[QuerySet] = ...
) -> Tuple[QuerySet, Callable, Callable, bool, str, bool]: ...
def get_queryset(self, **hints) -> QuerySet: ...
def is_cached(self, instance: Model) -> bool: ...
class ForwardOneToOneDescriptor:
def __set__(self, instance: Model, value: Any) -> None: ...
def get_object(self, instance: Model) -> Model: ...
class ManyToManyDescriptor:
def __init__(self, rel: ManyToManyRel, reverse: bool = ...) -> None: ...
class ReverseManyToOneDescriptor:
def __get__(
self,
instance: Optional[Model],
cls: Any = ...
) -> ReverseManyToOneDescriptor: ...
def __init__(self, rel: ForeignObjectRel) -> None: ...
def _get_set_deprecation_msg_params(self) -> Tuple[str, str]: ...
class ReverseOneToOneDescriptor:
@cached_property
def RelatedObjectDoesNotExist(self) -> Type[ObjectDoesNotExist]: ...
def __get__(self, instance: Any, cls: Any = ...) -> Any: ...
def __init__(self, related: OneToOneRel) -> None: ...
def __set__(self, instance: Model, value: Optional[Model]) -> None: ...
def get_queryset(self, **hints) -> QuerySet: ...
def is_cached(self, instance: Model) -> bool: ...

View File

@@ -0,0 +1,63 @@
from collections import OrderedDict
from django.db.backends.sqlite3.base import DatabaseWrapper
from django.db.models.expressions import Col
from django.db.models.fields import (
AutoField,
IntegerField,
)
from django.db.models.fields.related import (
ForeignKey,
ForeignObject,
)
from django.db.models.sql.compiler import SQLCompiler
from django.db.models.sql.query import Query
from typing import (
Any,
List,
Tuple,
Type,
Union,
)
from uuid import UUID
def get_normalized_value(
value: Any,
lhs: Union[MultiColSource, Col]
) -> Any: ...
class MultiColSource:
def __init__(
self,
alias: str,
targets: Union[Tuple[IntegerField, related.ForeignKey], Tuple[IntegerField, IntegerField]],
sources: Union[Tuple[AutoField, IntegerField], Tuple[IntegerField, AutoField]],
field: related.ForeignObject
) -> None: ...
def get_lookup(
self,
lookup: str
) -> Type[Union[RelatedIn, RelatedExact]]: ...
def relabeled_clone(
self,
relabels: OrderedDict
) -> MultiColSource: ...
class RelatedIn:
def as_sql(
self,
compiler: SQLCompiler,
connection: DatabaseWrapper
) -> Union[Tuple[str, List[int]], Tuple[str, List[Any]], Tuple[str, List[str]]]: ...
def get_prep_lookup(self) -> Union[List[UUID], Query, List[int], List[str]]: ...
class RelatedLookupMixin:
def as_sql(
self,
compiler: SQLCompiler,
connection: DatabaseWrapper
) -> Union[Tuple[str, List[int]], Tuple[str, List[Any]], Tuple[str, List[str]]]: ...
def get_prep_lookup(self) -> Any: ...

View File

@@ -0,0 +1,122 @@
from django.db.models.base import Model
from django.db.models.fields import (
AutoField,
Field,
)
from django.db.models.fields.related import (
ForeignKey,
ManyToManyField,
RelatedField,
)
from django.db.models.fields.related_lookups import (
RelatedExact,
RelatedIn,
RelatedIsNull,
)
from django.db.models.query_utils import (
FilteredRelation,
PathInfo,
)
from django.db.models.sql.where import WhereNode
from typing import (
Any,
Callable,
Dict,
List,
Optional,
Tuple,
Type,
Union,
)
class ForeignObjectRel:
def __init__(
self,
field: RelatedField,
to: Any,
related_name: Optional[str] = ...,
related_query_name: Optional[str] = ...,
limit_choices_to: Any = ...,
parent_link: bool = ...,
on_delete: Optional[Callable] = ...
) -> None: ...
def __repr__(self) -> str: ...
@property
def db_type(self) -> Callable: ...
def get_accessor_name(self, model: Any = ...) -> Optional[str]: ...
def get_cache_name(self) -> str: ...
def get_choices(
self,
include_blank: bool = ...,
blank_choice: List[Tuple[str, str]] = ...
) -> List[Tuple[int, str]]: ...
def get_extra_restriction(
self,
where_class: Type[WhereNode],
alias: str,
related_alias: str
) -> Optional[WhereNode]: ...
def get_internal_type(self) -> str: ...
def get_joining_columns(self) -> Union[Tuple[Tuple[str, str]], Tuple[Tuple[str, str], Tuple[str, str]]]: ...
def get_lookup(
self,
lookup_name: str
) -> Type[Union[RelatedIsNull, RelatedIn, RelatedExact]]: ...
def get_path_info(
self,
filtered_relation: Optional[FilteredRelation] = ...
) -> List[PathInfo]: ...
@cached_property
def hidden(self) -> bool: ...
def is_hidden(self) -> bool: ...
@cached_property
def many_to_many(self) -> bool: ...
@cached_property
def many_to_one(self) -> bool: ...
@cached_property
def name(self) -> str: ...
@cached_property
def one_to_many(self) -> bool: ...
@cached_property
def one_to_one(self) -> bool: ...
@cached_property
def related_model(self) -> Any: ...
@property
def remote_field(
self
) -> Union[ManyToManyField, ForeignKey]: ...
def set_field_name(self) -> None: ...
@property
def target_field(self) -> AutoField: ...
class ManyToManyRel:
def __init__(
self,
field: RelatedField,
to: Any,
related_name: Optional[str] = ...,
related_query_name: Optional[str] = ...,
limit_choices_to: Optional[Callable] = ...,
symmetrical: bool = ...,
through: Optional[Union[str, Type[Model]]] = ...,
through_fields: Optional[Tuple[str, str]] = ...,
db_constraint: bool = ...
) -> None: ...
def get_related_field(self) -> Field: ...
class ManyToOneRel:
def __getstate__(self) -> Dict[str, Any]: ...
def __init__(
self,
field: ForeignKey,
to: Any,
field_name: Optional[str],
related_name: Optional[str] = ...,
related_query_name: Optional[str] = ...,
limit_choices_to: Any = ...,
parent_link: bool = ...,
on_delete: Callable = ...
) -> None: ...

View File

@@ -0,0 +1,50 @@
from datetime import (
date,
datetime,
)
from decimal import Decimal
from django.db.backends.sqlite3.base import DatabaseWrapper
from django.db.models.fields import Field
from django.db.models.sql.compiler import SQLCompiler
from typing import (
Any,
List,
Tuple,
Union,
)
class Cast:
def __init__(
self,
expression: Union[str, date, Decimal],
output_field: Field
) -> None: ...
def as_sql(
self,
compiler: SQLCompiler,
connection: DatabaseWrapper,
**extra_context
) -> Union[Tuple[str, List[datetime]], Tuple[str, List[Any]]]: ...
class Coalesce:
def __init__(self, *expressions, **extra) -> None: ...
class Greatest:
def __init__(self, *expressions, **extra) -> None: ...
def as_sqlite(
self,
compiler: SQLCompiler,
connection: DatabaseWrapper
) -> Tuple[str, List[Any]]: ...
class Least:
def __init__(self, *expressions, **extra) -> None: ...
def as_sqlite(
self,
compiler: SQLCompiler,
connection: DatabaseWrapper
) -> Union[Tuple[str, List[datetime]], Tuple[str, List[Any]]]: ...

View File

@@ -0,0 +1,102 @@
from datetime import (
date,
time,
)
from django.db.backends.sqlite3.base import DatabaseWrapper
from django.db.models.expressions import Col
from django.db.models.fields import (
DateTimeCheckMixin,
IntegerField,
)
from django.db.models.sql.compiler import SQLCompiler
from django.db.models.sql.query import Query
from typing import (
Any,
List,
Optional,
Tuple,
Union,
)
class Extract:
def __init__(
self,
expression: Union[str, Col, TruncDate],
lookup_name: Optional[str] = ...,
tzinfo: None = ...,
**extra
) -> None: ...
def as_sql(
self,
compiler: SQLCompiler,
connection: DatabaseWrapper
) -> Tuple[str, List[Any]]: ...
def resolve_expression(
self,
query: Query = ...,
allow_joins: bool = ...,
reuse: None = ...,
summarize: bool = ...,
for_save: bool = ...
) -> Extract: ...
class TimezoneMixin:
def get_tzname(self) -> Optional[str]: ...
class Trunc:
def __init__(
self,
expression: str,
kind: str,
output_field: Optional[Union[IntegerField, DateTimeCheckMixin]] = ...,
tzinfo: None = ...,
**extra
) -> None: ...
class TruncBase:
def __init__(
self,
expression: Union[str, Col],
output_field: Optional[DateTimeCheckMixin] = ...,
tzinfo: None = ...,
**extra
) -> None: ...
def as_sql(
self,
compiler: SQLCompiler,
connection: DatabaseWrapper
) -> Tuple[str, List[Any]]: ...
def convert_value(
self,
value: Union[date, time],
expression: django.db.models.functions.TruncBase,
connection: DatabaseWrapper
) -> Union[date, time]: ...
def resolve_expression(
self,
query: Query = ...,
allow_joins: bool = ...,
reuse: None = ...,
summarize: bool = ...,
for_save: bool = ...
) -> TruncBase: ...
class TruncDate:
def as_sql(
self,
compiler: SQLCompiler,
connection: DatabaseWrapper
) -> Tuple[str, List[Any]]: ...
class TruncTime:
def as_sql(
self,
compiler: SQLCompiler,
connection: DatabaseWrapper
) -> Tuple[str, List[Any]]: ...

View File

@@ -0,0 +1,112 @@
from django.db.backends.sqlite3.base import DatabaseWrapper
from django.db.models.expressions import (
Col,
F,
Value,
)
from django.db.models.sql.compiler import SQLCompiler
from typing import (
Any,
List,
Tuple,
Union,
)
class BytesToCharFieldConversionMixin:
def convert_value(
self,
value: str,
expression: LPad,
connection: DatabaseWrapper
) -> str: ...
class Chr:
def as_sqlite(
self,
compiler: SQLCompiler,
connection: DatabaseWrapper,
**extra_context
) -> Union[Tuple[str, List[int]], Tuple[str, List[Any]]]: ...
class Concat:
def __init__(self, *expressions, **extra) -> None: ...
def _paired(
self,
expressions: Union[Tuple[Value, str], Tuple[str, str], Tuple[Value, str, Value]]
) -> ConcatPair: ...
class ConcatPair:
def as_sqlite(
self,
compiler: SQLCompiler,
connection: DatabaseWrapper
) -> Tuple[str, List[str]]: ...
def coalesce(self) -> ConcatPair: ...
class LPad:
def __init__(
self,
expression: str,
length: Union[int, Length],
fill_text: Value = ...,
**extra
) -> None: ...
class Left:
def __init__(self, expression: str, length: int, **extra) -> None: ...
def get_substr(self) -> Substr: ...
def use_substr(
self,
compiler: SQLCompiler,
connection: DatabaseWrapper,
**extra_context
) -> Tuple[str, List[int]]: ...
class Ord:
def as_sqlite(
self,
compiler: SQLCompiler,
connection: DatabaseWrapper,
**extra_context
) -> Union[Tuple[str, List[Any]], Tuple[str, List[str]]]: ...
class Replace:
def __init__(
self,
expression: F,
text: Value,
replacement: Value = ...,
**extra
) -> None: ...
class Right:
def get_substr(self) -> Substr: ...
class Substr:
def __init__(
self,
expression: Union[str, Col],
pos: Union[int, Value],
length: Union[int, Value] = ...,
**extra
) -> None: ...
def as_oracle(
self,
compiler: SQLCompiler,
connection: DatabaseWrapper
) -> Tuple[str, List[int]]: ...
def as_sqlite(
self,
compiler: SQLCompiler,
connection: DatabaseWrapper
) -> Union[Tuple[str, List[int]], Tuple[str, List[Union[str, int]]]]: ...

View File

@@ -0,0 +1,5 @@
from typing import Optional
class LagLeadFunction:
def __init__(self, expression: Optional[str], offset: int = ..., default: None = ..., **extra): ...

View File

@@ -0,0 +1,28 @@
from django.db.backends.ddl_references import Statement
from django.db.backends.sqlite3.schema import DatabaseSchemaEditor
from django.db.models.base import Model
from typing import (
Any,
Dict,
List,
Tuple,
Type,
Union,
)
class Index:
def __eq__(self, other: Index) -> bool: ...
def __init__(self, *, fields = ..., name = ..., db_tablespace = ...) -> None: ...
@staticmethod
def _hash_generator(*args) -> str: ...
def check_name(self) -> List[Any]: ...
def clone(self) -> Index: ...
def create_sql(
self,
model: Type[Model],
schema_editor: DatabaseSchemaEditor,
using: str = ...
) -> Statement: ...
def deconstruct(self) -> Tuple[str, Tuple, Dict[str, Union[List[str], str]]]: ...
def set_name_with_model(self, model: Type[Model]) -> None: ...

View File

@@ -0,0 +1,217 @@
from collections import OrderedDict
from datetime import datetime
from django.db.backends.sqlite3.base import DatabaseWrapper
from django.db.models.expressions import (
Col,
CombinedExpression,
Expression,
Ref,
)
from django.db.models.sql.compiler import SQLCompiler
from django.db.models.sql.query import Query
from django.utils.datastructures import OrderedSet
from django.utils.safestring import SafeText
from typing import (
Any,
Dict,
List,
Optional,
Tuple,
Type,
Union,
)
class BuiltinLookup:
def as_sql(
self,
compiler: SQLCompiler,
connection: DatabaseWrapper
) -> Any: ...
def get_rhs_op(self, connection: DatabaseWrapper, rhs: str) -> str: ...
def process_lhs(
self,
compiler: SQLCompiler,
connection: DatabaseWrapper,
lhs: Optional[Col] = ...
) -> Union[Tuple[str, List[str]], Tuple[str, List[int]], Tuple[str, List[Union[str, int]]], Tuple[str, List[Any]]]: ...
class Exact:
def process_rhs(
self,
compiler: SQLCompiler,
connection: DatabaseWrapper
) -> Any: ...
class FieldGetDbPrepValueIterableMixin:
def batch_process_rhs(
self,
compiler: SQLCompiler,
connection: DatabaseWrapper,
rhs: Optional[OrderedSet] = ...
) -> Any: ...
def get_prep_lookup(self) -> Any: ...
def process_rhs(
self,
compiler: SQLCompiler,
connection: DatabaseWrapper
) -> Any: ...
def resolve_expression_parameter(
self,
compiler: SQLCompiler,
connection: DatabaseWrapper,
sql: str,
param: Any
) -> Union[Tuple[str, List[None]], Tuple[str, List[int]], Tuple[str, List[Any]], Tuple[str, List[str]]]: ...
class FieldGetDbPrepValueMixin:
def get_db_prep_lookup(self, value: Any, connection: DatabaseWrapper) -> Any: ...
class IExact:
def process_rhs(
self,
qn: SQLCompiler,
connection: DatabaseWrapper
) -> Union[Tuple[str, List[Any]], Tuple[str, List[str]]]: ...
class In:
def as_sql(
self,
compiler: SQLCompiler,
connection: DatabaseWrapper
) -> Any: ...
def get_rhs_op(self, connection: DatabaseWrapper, rhs: str) -> str: ...
def process_rhs(
self,
compiler: SQLCompiler,
connection: DatabaseWrapper
) -> Any: ...
class IntegerFieldFloatRounding:
def get_prep_lookup(
self
) -> Union[Query, int, CombinedExpression]: ...
class IsNull:
def as_sql(
self,
compiler: SQLCompiler,
connection: DatabaseWrapper
) -> Tuple[str, List[Any]]: ...
class Lookup:
def __init__(self, lhs: Any, rhs: Any) -> None: ...
def apply_bilateral_transforms(
self,
value: Expression
) -> Transform: ...
def batch_process_rhs(
self,
compiler: SQLCompiler,
connection: DatabaseWrapper,
rhs: Optional[OrderedSet] = ...
) -> Any: ...
@cached_property
def contains_aggregate(self) -> bool: ...
@cached_property
def contains_over_clause(self) -> bool: ...
def get_db_prep_lookup(
self,
value: Union[str, int],
connection: DatabaseWrapper
) -> Union[Tuple[str, List[int]], Tuple[str, List[SafeText]], Tuple[str, List[str]]]: ...
def get_group_by_cols(
self
) -> Union[List[Col], List[CombinedExpression]]: ...
def get_prep_lookup(self) -> Any: ...
def get_source_expressions(self) -> List[Col]: ...
def process_lhs(
self,
compiler: SQLCompiler,
connection: DatabaseWrapper,
lhs: Optional[Col] = ...
) -> Any: ...
def process_rhs(
self,
compiler: SQLCompiler,
connection: DatabaseWrapper
) -> Any: ...
def relabeled_clone(
self,
relabels: Union[OrderedDict, Dict[str, str], Dict[Union[str, None], str]]
) -> BuiltinLookup: ...
def rhs_is_direct_value(self) -> bool: ...
def set_source_expressions(self, new_exprs: List[Ref]) -> None: ...
class PatternLookup:
def get_rhs_op(self, connection: DatabaseWrapper, rhs: str) -> str: ...
def process_rhs(
self,
qn: SQLCompiler,
connection: DatabaseWrapper
) -> Union[Tuple[str, List[str]], Tuple[str, List[int]], Tuple[str, List[Any]]]: ...
class Range:
def get_rhs_op(self, connection: DatabaseWrapper, rhs: Tuple[str, str]) -> str: ...
class Regex:
def as_sql(
self,
compiler: SQLCompiler,
connection: DatabaseWrapper
) -> Tuple[str, List[str]]: ...
class Transform:
def get_bilateral_transforms(self) -> List[Type[Transform]]: ...
@property
def lhs(self) -> Expression: ...
class YearComparisonLookup:
def as_sql(
self,
compiler: SQLCompiler,
connection: DatabaseWrapper
) -> Tuple[str, List[str]]: ...
def get_bound(self, start: datetime, finish: datetime): ...
def get_rhs_op(self, connection: DatabaseWrapper, rhs: str) -> str: ...
class YearExact:
def as_sql(
self,
compiler: SQLCompiler,
connection: DatabaseWrapper
) -> Union[Tuple[str, List[Any]], Tuple[str, List[str]]]: ...
class YearGt:
def get_bound(self, start: str, finish: str) -> str: ...
class YearGte:
def get_bound(self, start: str, finish: str) -> str: ...
class YearLookup:
def year_lookup_bounds(self, connection: DatabaseWrapper, year: int) -> List[str]: ...
class YearLt:
def get_bound(self, start: str, finish: str) -> str: ...
class YearLte:
def get_bound(self, start: str, finish: str) -> str: ...

View File

@@ -0,0 +1,36 @@
from django.db.models.base import Model
from django.db.models.query import QuerySet
from typing import (
Any,
Callable,
Dict,
List,
Optional,
Tuple,
Type,
Union,
)
class BaseManager:
def __eq__(self, other: Optional[Manager]) -> bool: ...
def __init__(self) -> None: ...
@staticmethod
def __new__(cls: Any, *args, **kwargs) -> Manager: ...
@classmethod
def _get_queryset_methods(cls, queryset_class: Any) -> Dict[str, Callable]: ...
def _set_creation_counter(self) -> None: ...
def all(self) -> QuerySet: ...
def check(self, **kwargs) -> List[Any]: ...
def contribute_to_class(self, model: Any, name: str) -> None: ...
@property
def db(self) -> str: ...
def db_manager(self, using: Optional[str] = ..., hints: Any = ...) -> Manager: ...
def deconstruct(
self
) -> Union[Tuple[bool, str, None, Tuple[str, str, int, int], Dict[Any, Any]], Tuple[bool, str, None, Tuple, Dict[Any, Any]]]: ...
def get_queryset(self) -> QuerySet: ...
class EmptyManager:
def __init__(self, model: Type[Model]) -> None: ...

View File

@@ -0,0 +1,24 @@
from django.utils.datastructures import ImmutableList
from typing import (
Any,
Dict,
)
class Options:
def __init__(self, meta: Any, app_label: str = ...) -> None: ...
def __repr__(self) -> str: ...
def __str__(self) -> str: ...
def _expire_cache(self, forward: bool = ..., reverse: bool = ...) -> None: ...
@cached_property
def _forward_fields_map(self) -> Dict[str, Any]: ...
def _get_fields(
self,
forward: bool = ...,
reverse: bool = ...,
include_parents: object = ...,
include_hidden: bool = ...,
seen_models: Any = ...
) -> ImmutableList: ...
def _populate_directed_relation_graph(self) -> Any: ...
def _prepare(self, model: Any) -> None: ...

View File

@@ -0,0 +1,65 @@
from django.db.models.base import Model
from django.db.models.sql.query import Query
from typing import (
Any,
Dict,
Iterator,
Optional,
Tuple,
Union,
)
class BaseIterable:
def __init__(
self,
queryset: QuerySet,
chunked_fetch: bool = ...,
chunk_size: int = ...
) -> None: ...
class FlatValuesListIterable:
def __iter__(self) -> Iterator[Any]: ...
class InstanceCheckMeta:
def __instancecheck__(self, instance: Union[str, QuerySet]) -> bool: ...
class ModelIterable:
def __iter__(self) -> Iterator[Model]: ...
class NamedValuesListIterable:
def __iter__(self): ...
class Prefetch:
def __eq__(self, other: None) -> bool: ...
def __getstate__(self) -> Dict[str, Union[str, QuerySet, None]]: ...
def __hash__(self) -> int: ...
def __init__(
self,
lookup: str,
queryset: Optional[QuerySet] = ...,
to_attr: Optional[str] = ...
) -> None: ...
def add_prefix(self, prefix: str) -> None: ...
def get_current_prefetch_to(self, level: int) -> str: ...
def get_current_queryset(self, level: int) -> Optional[QuerySet]: ...
def get_current_to_attr(self, level: int) -> Union[Tuple[str, None], Tuple[str, bool]]: ...
class QuerySet:
def __and__(self, other: QuerySet) -> QuerySet: ...
def __bool__(self) -> bool: ...
def __getitem__(self, k: Union[slice, int]) -> Any: ...
def __getstate__(self) -> Dict[str, Any]: ...
def __init__(
self,
model: Any = ...,
query: Optional[Query] = ...,
using: Optional[str] = ...,
hints: Dict[str, Model] = ...
) -> None: ...

View File

@@ -0,0 +1,109 @@
from collections import OrderedDict
from django.db.backends.sqlite3.base import DatabaseWrapper
from django.db.models.base import Model
from django.db.models.expressions import F
from django.db.models.fields import Field
from django.db.models.fields.related import ForeignKey
from django.db.models.fields.reverse_related import ManyToOneRel
from django.db.models.options import Options
from django.db.models.sql.compiler import SQLCompiler
from django.db.models.sql.query import Query
from django.db.models.sql.where import WhereNode
from typing import (
Any,
Dict,
Iterator,
List,
Optional,
Set,
Tuple,
Union,
)
def check_rel_lookup_compatibility(
model: Any,
target_opts: Options,
field: Union[ManyToOneRel, ForeignKey]
) -> bool: ...
def refs_expression(lookup_parts: List[str], annotations: OrderedDict) -> Any: ...
def select_related_descend(
field: Field,
restricted: bool,
requested: Any,
load_fields: Optional[Set[str]],
reverse: bool = ...
) -> bool: ...
def subclasses(cls: Any) -> Iterator[Any]: ...
class DeferredAttribute:
def __get__(
self,
instance: Any,
cls: Any = ...
) -> Optional[Union[DeferredAttribute, str, int]]: ...
def __init__(self, field_name: str) -> None: ...
def _check_parent_chain(self, instance: Model, name: str) -> None: ...
class FilteredRelation:
def __eq__(self, other: FilteredRelation) -> bool: ...
def __init__(self, relation_name: str, *, condition = ...) -> None: ...
def as_sql(
self,
compiler: SQLCompiler,
connection: DatabaseWrapper
) -> Union[Tuple[str, List[str]], Tuple[str, List[int]], Tuple[str, List[Union[int, str]]], Tuple[str, List[Any]]]: ...
def clone(self) -> FilteredRelation: ...
class Q:
def __and__(self, other: Q) -> Q: ...
def __init__(self, *args, **kwargs) -> None: ...
def __invert__(self) -> Q: ...
def __or__(self, other: Q) -> Q: ...
def _combine(self, other: Q, conn: str) -> Q: ...
def deconstruct(
self
) -> Union[Tuple[str, Tuple, Dict[str, F]], Tuple[str, Tuple[Tuple[str, F], Tuple[str, F]], Dict[Any, Any]], Tuple[str, Tuple[Q], Dict[Any, Any]]]: ...
def resolve_expression(
self,
query: Query = ...,
allow_joins: bool = ...,
reuse: Optional[Set[str]] = ...,
summarize: bool = ...,
for_save: bool = ...
) -> WhereNode: ...
class QueryWrapper:
def __init__(self, sql: str, params: List[Any]) -> None: ...
def as_sql(
self,
compiler: SQLCompiler = ...,
connection: DatabaseWrapper = ...
) -> Tuple[str, List[Any]]: ...
class RegisterLookupMixin:
@classmethod
def _clear_cached_lookups(cls) -> None: ...
@classmethod
def _get_lookup(cls, lookup_name: str) -> Any: ...
@classmethod
def _unregister_lookup(cls, lookup: Any, lookup_name: Optional[str] = ...) -> None: ...
def get_lookup(self, lookup_name: str) -> Any: ...
@classmethod
def get_lookups(cls) -> Dict[str, Any]: ...
def get_transform(self, lookup_name: str) -> Any: ...
@staticmethod
def merge_dicts(dicts: Any) -> Dict[str, Any]: ...
@classmethod
def register_lookup(cls, lookup: Any, lookup_name: Optional[str] = ...) -> Any: ...

View File

@@ -0,0 +1,32 @@
from django.apps.registry import Apps
from typing import (
Any,
Callable,
Optional,
)
class ModelSignal:
def _lazy_method(
self,
method: Callable,
apps: Optional[Apps],
receiver: Callable,
sender: Any,
**kwargs
) -> Optional[bool]: ...
def connect(
self,
receiver: Callable,
sender: Any = ...,
weak: bool = ...,
dispatch_uid: None = ...,
apps: None = ...
) -> None: ...
def disconnect(
self,
receiver: Callable = ...,
sender: Any = ...,
dispatch_uid: None = ...,
apps: None = ...
) -> bool: ...

View File

@@ -0,0 +1,116 @@
from django.db.backends.sqlite3.base import DatabaseWrapper
from django.db.backends.utils import CursorWrapper
from django.db.models.expressions import (
Col,
CombinedExpression,
Expression,
OrderBy,
)
from django.db.models.functions.datetime import Trunc
from django.db.models.options import Options
from django.db.models.sql.query import (
Query,
RawQuery,
)
from itertools import chain
from typing import (
Any,
Dict,
Iterator,
List,
Optional,
Set,
Tuple,
Union,
)
class SQLAggregateCompiler:
def as_sql(self) -> Any: ...
class SQLCompiler:
def __init__(
self,
query: Union[Query, RawQuery],
connection: DatabaseWrapper,
using: Optional[str]
) -> None: ...
def _setup_joins(self, pieces: List[str], opts: Options, alias: Optional[str]) -> Any: ...
def apply_converters(self, rows: chain, converters: Dict[int, Any]) -> Iterator[Any]: ...
def as_sql(self, with_limits: bool = ..., with_col_aliases: bool = ...): ...
def as_subquery_condition(
self,
alias: str,
columns: List[str],
compiler: SQLCompiler
) -> Union[Tuple[str, Tuple[str]], Tuple[str, Tuple]]: ...
def collapse_group_by(
self,
expressions: Union[List[Col], List[Union[Col, Trunc]], List[Expression], List[Union[Col, CombinedExpression]]],
having: Union[List[Col], Tuple, List[CombinedExpression]]
) -> Union[List[Col], List[Union[Col, Trunc]], List[Expression], List[Union[Col, CombinedExpression]]]: ...
def compile(self, node: Any, select_format: object = ...) -> Any: ...
def deferred_to_columns(self) -> Any: ...
def execute_sql(
self,
result_type: str = ...,
chunked_fetch: bool = ...,
chunk_size: int = ...
) -> Optional[CursorWrapper]: ...
def explain_query(self) -> Iterator[str]: ...
def find_ordering_name(
self,
name: str,
opts: Options,
alias: Optional[str] = ...,
default_order: str = ...,
already_seen: Optional[Union[Set[Tuple[None, Tuple[Tuple[str, str]]]], Set[Tuple[None, Tuple[Tuple[str, str]], Tuple[Tuple[str, str]], Tuple[Tuple[str, str]]]], Set[Union[Tuple[None, Tuple[Tuple[str, str]]], Tuple[Tuple[Tuple[str, str]], Tuple[Tuple[str, str]]]]]]] = ...
) -> List[Tuple[OrderBy, bool]]: ...
def get_combinator_sql(
self,
combinator: str,
all: bool
) -> Union[Tuple[List[str], List[Any]], Tuple[List[str], List[int]], Tuple[List[str], List[str]]]: ...
def get_converters(self, expressions: Any) -> Dict[int, Any]: ...
def get_default_columns(
self,
start_alias: Optional[str] = ...,
opts: Optional[Options] = ...,
from_parent: Any = ...
) -> List[Col]: ...
def get_distinct(self) -> Tuple[List[Any], List[Any]]: ...
def get_extra_select(
self,
order_by: Union[List[Tuple[OrderBy, Tuple[str, List[Any], bool]]], List[Union[Tuple[OrderBy, Tuple[str, List[int], bool]], Tuple[OrderBy, Tuple[str, List[Any], bool]]]], List[Tuple[OrderBy, Tuple[str, Tuple, bool]]]],
select: Any
) -> List[Tuple[OrderBy, Tuple[str, List[Any]], None]]: ...
def get_from_clause(
self
) -> Union[Tuple[List[str], List[Union[int, str]]], Tuple[List[str], List[Any]], Tuple[List[str], List[int]], Tuple[List[str], List[str]]]: ...
def get_group_by(
self,
select: Any,
order_by: Any
) -> Union[List[Union[Tuple[str, List[Any]], Tuple[str, List[str]]]], List[Tuple[str, List[Any]]], List[Union[Tuple[str, List[Any]], Tuple[str, List[int]]]]]: ...
def get_order_by(self) -> Any: ...
def get_related_selections(
self,
select: Any,
opts: Optional[Options] = ...,
root_alias: Optional[str] = ...,
cur_depth: int = ...,
requested: Any = ...,
restricted: Optional[bool] = ...
) -> Any: ...
def get_select(self) -> Any: ...
def has_results(self) -> bool: ...
def pre_sql_setup(self) -> Any: ...
def quote_name_unless_alias(self, name: str) -> str: ...
def results_iter(
self,
results: Any = ...,
tuple_expected: bool = ...,
chunked_fetch: bool = ...,
chunk_size: int = ...
) -> chain: ...

View File

@@ -0,0 +1,69 @@
from collections import OrderedDict
from django.db.backends.sqlite3.base import DatabaseWrapper
from django.db.models.fields.related import ForeignObject
from django.db.models.fields.reverse_related import ForeignObjectRel
from django.db.models.query_utils import (
FilteredRelation,
PathInfo,
)
from django.db.models.sql.compiler import SQLCompiler
from typing import (
Any,
Dict,
List,
Optional,
Tuple,
Union,
)
class BaseTable:
def __init__(self, table_name: str, alias: Optional[str]) -> None: ...
def as_sql(
self,
compiler: SQLCompiler,
connection: DatabaseWrapper
) -> Tuple[str, List[Any]]: ...
def equals(self, other: Join, with_filtered_relation: bool) -> bool: ...
def relabeled_clone(self, change_map: OrderedDict) -> BaseTable: ...
class Join:
def __eq__(
self,
other: Union[Join, BaseTable]
) -> bool: ...
def __init__(
self,
table_name: str,
parent_alias: str,
table_alias: Optional[str],
join_type: str,
join_field: Union[ForeignObjectRel, ForeignObject],
nullable: bool,
filtered_relation: Optional[FilteredRelation] = ...
) -> None: ...
def as_sql(
self,
compiler: SQLCompiler,
connection: DatabaseWrapper
) -> Union[Tuple[str, List[int]], Tuple[str, List[Any]], Tuple[str, List[str]]]: ...
def demote(self) -> Join: ...
def equals(
self,
other: Union[Join, BaseTable],
with_filtered_relation: bool
) -> bool: ...
def promote(self) -> Join: ...
def relabeled_clone(
self,
change_map: Union[Dict[str, str], OrderedDict]
) -> Join: ...
class MultiJoin:
def __init__(
self,
names_pos: int,
path_with_names: List[Tuple[str, List[PathInfo]]]
) -> None: ...

View File

@@ -0,0 +1,18 @@
from django.db.models.sql.where import WhereNode
from typing import (
Any,
Set,
Tuple,
Type,
Union,
)
class JoinPromoter:
def __init__(self, connector: str, num_children: int, negated: bool) -> None: ...
def add_votes(self, votes: Union[Tuple, Set[str]]) -> None: ...
def update_join_types(self, query: Query) -> Set[str]: ...
class Query:
def __init__(self, model: Any, where: Type[WhereNode] = ...) -> None: ...

View File

@@ -0,0 +1,44 @@
from django.db.models.base import Model
from django.db.models.fields import CharField
from django.db.models.query import QuerySet
from django.db.models.sql.query import Query
from django.db.models.sql.where import WhereNode
from typing import (
Any,
Dict,
List,
Optional,
Type,
Union,
)
class AggregateQuery:
def add_subquery(self, query: Query, using: str) -> None: ...
class DeleteQuery:
def delete_batch(self, pk_list: Union[List[int], List[str]], using: str) -> int: ...
def delete_qs(self, query: QuerySet, using: str) -> int: ...
def do_query(self, table: str, where: WhereNode, using: str) -> int: ...
class InsertQuery:
def __init__(self, *args, **kwargs) -> None: ...
def insert_values(self, fields: Any, objs: Any, raw: bool = ...) -> None: ...
class UpdateQuery:
def __init__(self, *args, **kwargs) -> None: ...
def _setup_query(self) -> None: ...
def add_related_update(
self,
model: Type[Model],
field: CharField,
value: str
) -> None: ...
def add_update_fields(self, values_seq: Any) -> None: ...
def add_update_values(self, values: Dict[str, Any]) -> None: ...
def clone(self) -> UpdateQuery: ...
def get_related_updates(self) -> List[UpdateQuery]: ...
def update_batch(self, pk_list: List[int], values: Dict[str, Union[None, int]], using: str) -> None: ...

View File

@@ -0,0 +1,99 @@
from collections import OrderedDict
from django.db import DefaultConnectionProxy
from django.db.backends.sqlite3.base import DatabaseWrapper
from django.db.models.expressions import (
Col,
CombinedExpression,
)
from django.db.models.lookups import (
Exact,
FieldGetDbPrepValueMixin,
GreaterThan,
IntegerLessThan,
LessThanOrEqual,
)
from django.db.models.sql.compiler import SQLCompiler
from django.db.models.sql.query import Query
from typing import (
Any,
Dict,
List,
Optional,
Tuple,
Union,
)
class ExtraWhere:
def __init__(self, sqls: List[str], params: Optional[List[int]]) -> None: ...
def as_sql(
self,
compiler: SQLCompiler = ...,
connection: DatabaseWrapper = ...
) -> Union[Tuple[str, List[int]], Tuple[str, List[Any]]]: ...
class NothingNode:
def as_sql(
self,
compiler: object = ...,
connection: Union[DefaultConnectionProxy, backends.sqlite3.base.DatabaseWrapper] = ...
): ...
class SubqueryConstraint:
def __init__(
self,
alias: str,
columns: List[str],
targets: List[str],
query_object: Query
) -> None: ...
def as_sql(
self,
compiler: SQLCompiler,
connection: DatabaseWrapper
) -> Tuple[str, Tuple]: ...
class WhereNode:
@classmethod
def _contains_aggregate(cls, obj: Any) -> bool: ...
@classmethod
def _contains_over_clause(
cls,
obj: Union[WhereNode, FieldGetDbPrepValueMixin]
) -> bool: ...
def as_sql(
self,
compiler: object,
connection: Union[DefaultConnectionProxy, backends.sqlite3.base.DatabaseWrapper]
) -> Any: ...
def clone(self) -> WhereNode: ...
@cached_property
def contains_aggregate(self) -> bool: ...
@cached_property
def contains_over_clause(self) -> bool: ...
def get_group_by_cols(
self
) -> Union[List[CombinedExpression], List[Col]]: ...
def get_source_expressions(
self
) -> Union[List[GreaterThan], List[IntegerLessThan], List[Exact], List[LessThanOrEqual]]: ...
def relabel_aliases(
self,
change_map: Union[OrderedDict, Dict[str, str], Dict[Union[str, None], str]]
) -> None: ...
def relabeled_clone(
self,
change_map: Union[OrderedDict, Dict[Union[str, None], str]]
) -> WhereNode: ...
def resolve_expression(self, *args, **kwargs) -> WhereNode: ...
def set_source_expressions(
self,
children: Union[List[GreaterThan], List[IntegerLessThan], List[Exact]]
) -> None: ...
def split_having(
self,
negated: bool = ...
) -> Union[Tuple[WhereNode, None], Tuple[None, WhereNode], Tuple[WhereNode, WhereNode]]: ...

View File

@@ -0,0 +1,7 @@
from typing import (
Any,
Tuple,
)
def make_model_tuple(model: Any) -> Tuple[str, str]: ...

39
django/db/transaction.pyi Normal file
View File

@@ -0,0 +1,39 @@
from django.db.backends.sqlite3.base import DatabaseWrapper
from typing import (
Callable,
Optional,
Union,
)
def atomic(using: Optional[Union[str, Callable]] = ..., savepoint: bool = ...) -> Callable: ...
def commit(using: None = ...): ...
def get_autocommit(using: str = ...) -> bool: ...
def get_connection(using: Optional[str] = ...) -> DatabaseWrapper: ...
def get_rollback(using: None = ...) -> bool: ...
def non_atomic_requests(using: Callable = ...) -> Callable: ...
def on_commit(func: Callable, using: None = ...) -> None: ...
def savepoint_rollback(sid: str, using: None = ...) -> None: ...
def set_rollback(rollback: bool, using: Optional[str] = ...) -> None: ...
class Atomic:
def __enter__(self) -> None: ...
def __exit__(self, exc_type: None, exc_value: None, traceback: None) -> None: ...
def __init__(self, using: Optional[str], savepoint: bool) -> None: ...

46
django/db/utils.pyi Normal file
View File

@@ -0,0 +1,46 @@
from django.apps.config import AppConfig
from django.db.backends.base.base import BaseDatabaseWrapper
from django.db.backends.sqlite3.base import DatabaseWrapper
from django.db.models.base import Model
from typing import (
Any,
Callable,
Dict,
List,
)
def load_backend(backend_name: str) -> Any: ...
class ConnectionHandler:
def __getitem__(self, alias: str) -> BaseDatabaseWrapper: ...
def __init__(self, databases: Dict[str, Dict[str, str]] = ...) -> None: ...
def all(self) -> List[DatabaseWrapper]: ...
def close_all(self) -> None: ...
@cached_property
def databases(self) -> Dict[str, Dict[str, str]]: ...
def ensure_defaults(self, alias: str) -> None: ...
def prepare_test_settings(self, alias: str) -> None: ...
class ConnectionRouter:
def __init__(self, routers: None = ...) -> None: ...
def allow_migrate(self, db: str, app_label: str, **hints) -> bool: ...
def allow_migrate_model(self, db: str, model: Any) -> bool: ...
def allow_relation(self, obj1: Model, obj2: Model, **hints) -> bool: ...
def get_migratable_models(
self,
app_config: AppConfig,
db: str,
include_auto_created: bool = ...
) -> Any: ...
@cached_property
def routers(self) -> Any: ...
class DatabaseErrorWrapper:
def __call__(self, func: Callable) -> Callable: ...
def __enter__(self) -> None: ...
def __exit__(self, exc_type: None, exc_value: None, traceback: None) -> None: ...
def __init__(self, wrapper: DatabaseWrapper) -> None: ...