move generated stubs to separate directory, too messty

This commit is contained in:
Maxim Kurnikov
2018-11-10 17:49:18 +03:00
parent 7436d641e3
commit 96cd3ddb27
446 changed files with 58 additions and 71 deletions

View File

@@ -0,0 +1,110 @@
from typing import Any, Callable, Dict, Iterator, List, Optional
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
NO_DB_ALIAS: str
class BaseDatabaseWrapper:
data_types: Any = ...
data_types_suffix: Any = ...
data_type_check_constraints: Any = ...
ops: Any = ...
vendor: str = ...
display_name: str = ...
SchemaEditorClass: Any = ...
client_class: Any = ...
creation_class: Any = ...
features_class: Any = ...
introspection_class: Any = ...
ops_class: Any = ...
validation_class: Any = ...
queries_limit: int = ...
connection: Any = ...
settings_dict: Any = ...
alias: Any = ...
queries_log: Any = ...
force_debug_cursor: bool = ...
autocommit: bool = ...
in_atomic_block: bool = ...
savepoint_state: int = ...
savepoint_ids: Any = ...
commit_on_exit: bool = ...
needs_rollback: bool = ...
close_at: Any = ...
closed_in_transaction: bool = ...
errors_occurred: bool = ...
allow_thread_sharing: Any = ...
run_on_commit: Any = ...
run_commit_hooks_on_set_autocommit_on: bool = ...
execute_wrappers: Any = ...
client: Any = ...
creation: Any = ...
features: Any = ...
introspection: Any = ...
validation: Any = ...
def __init__(
self,
settings_dict: Dict[str, Dict[str, str]],
alias: str = ...,
allow_thread_sharing: bool = ...,
) -> None: ...
def ensure_timezone(self) -> bool: ...
def timezone(self): ...
def timezone_name(self): ...
@property
def queries_logged(self) -> bool: ...
@property
def queries(self) -> List[Dict[str, str]]: ...
def get_connection_params(self) -> None: ...
def get_new_connection(self, conn_params: Any) -> None: ...
def init_connection_state(self) -> None: ...
def create_cursor(self, name: Optional[Any] = ...) -> None: ...
def connect(self) -> None: ...
def check_settings(self) -> None: ...
def ensure_connection(self) -> None: ...
def cursor(self) -> CursorWrapper: ...
def commit(self) -> None: ...
def rollback(self) -> None: ...
def close(self) -> None: ...
def savepoint(self) -> str: ...
def savepoint_rollback(self, sid: str) -> None: ...
def savepoint_commit(self, sid: str) -> None: ...
def clean_savepoints(self) -> None: ...
def get_autocommit(self) -> bool: ...
def set_autocommit(
self,
autocommit: bool,
force_begin_transaction_with_broken_autocommit: bool = ...,
) -> None: ...
def get_rollback(self) -> bool: ...
def set_rollback(self, rollback: bool) -> None: ...
def validate_no_atomic_block(self) -> None: ...
def validate_no_broken_transaction(self) -> None: ...
def constraint_checks_disabled(self) -> Iterator[None]: ...
def disable_constraint_checking(self): ...
def enable_constraint_checking(self) -> None: ...
def check_constraints(self, table_names: Optional[Any] = ...) -> None: ...
def is_usable(self) -> None: ...
def close_if_unusable_or_obsolete(self) -> None: ...
def validate_thread_sharing(self) -> None: ...
def prepare_database(self) -> None: ...
def wrap_database_errors(self) -> DatabaseErrorWrapper: ...
def chunked_cursor(self) -> CursorWrapper: ...
def make_debug_cursor(
self, cursor: SQLiteCursorWrapper
) -> CursorDebugWrapper: ...
def make_cursor(self, cursor: SQLiteCursorWrapper) -> CursorWrapper: ...
def temporary_connection(self) -> None: ...
def schema_editor(
self, *args: Any, **kwargs: Any
) -> DatabaseSchemaEditor: ...
def on_commit(self, func: Callable) -> None: ...
def run_and_clear_commit_hooks(self) -> None: ...
def execute_wrapper(self, wrapper: Callable) -> Iterator[None]: ...
def copy(
self, alias: None = ..., allow_thread_sharing: None = ...
) -> DatabaseWrapper: ...

View File

@@ -0,0 +1,10 @@
from typing import Any, Optional
from django.db.backends.base.base import BaseDatabaseWrapper
class BaseDatabaseClient:
executable_name: Any = ...
connection: Any = ...
def __init__(self, connection: BaseDatabaseWrapper) -> None: ...
def runshell(self) -> None: ...

View File

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

View File

@@ -0,0 +1,101 @@
from typing import Any, Optional
from django.db.backends.base.base import BaseDatabaseWrapper
class BaseDatabaseFeatures:
gis_enabled: bool = ...
allows_group_by_pk: bool = ...
allows_group_by_selected_pks: bool = ...
empty_fetchmany_value: Any = ...
update_can_self_select: bool = ...
interprets_empty_strings_as_nulls: bool = ...
supports_nullable_unique_constraints: bool = ...
supports_partially_nullable_unique_constraints: bool = ...
can_use_chunked_reads: bool = ...
can_return_id_from_insert: bool = ...
can_return_ids_from_bulk_insert: bool = ...
has_bulk_insert: bool = ...
uses_savepoints: bool = ...
can_release_savepoints: bool = ...
related_fields_match_type: bool = ...
allow_sliced_subqueries_with_in: bool = ...
has_select_for_update: bool = ...
has_select_for_update_nowait: bool = ...
has_select_for_update_skip_locked: bool = ...
has_select_for_update_of: bool = ...
select_for_update_of_column: bool = ...
test_db_allows_multiple_connections: bool = ...
supports_unspecified_pk: bool = ...
supports_forward_references: bool = ...
truncates_names: bool = ...
has_real_datatype: bool = ...
supports_subqueries_in_group_by: bool = ...
has_native_uuid_field: bool = ...
has_native_duration_field: bool = ...
supports_temporal_subtraction: bool = ...
supports_regex_backreferencing: bool = ...
supports_date_lookup_using_string: bool = ...
supports_timezones: bool = ...
has_zoneinfo_database: bool = ...
requires_explicit_null_ordering_when_grouping: bool = ...
nulls_order_largest: bool = ...
max_query_params: Any = ...
allows_auto_pk_0: bool = ...
can_defer_constraint_checks: bool = ...
supports_mixed_date_datetime_comparisons: bool = ...
supports_tablespaces: bool = ...
supports_sequence_reset: bool = ...
can_introspect_default: bool = ...
can_introspect_foreign_keys: bool = ...
can_introspect_autofield: bool = ...
can_introspect_big_integer_field: bool = ...
can_introspect_binary_field: bool = ...
can_introspect_decimal_field: bool = ...
can_introspect_ip_address_field: bool = ...
can_introspect_positive_integer_field: bool = ...
can_introspect_small_integer_field: bool = ...
can_introspect_time_field: bool = ...
introspected_boolean_field_type: str = ...
supports_index_column_ordering: bool = ...
can_distinct_on_fields: bool = ...
autocommits_when_autocommit_is_off: bool = ...
atomic_transactions: bool = ...
can_rollback_ddl: bool = ...
supports_atomic_references_rename: bool = ...
supports_combined_alters: bool = ...
supports_foreign_keys: bool = ...
supports_column_check_constraints: bool = ...
supports_paramstyle_pyformat: bool = ...
requires_literal_defaults: bool = ...
connection_persists_old_columns: bool = ...
closed_cursor_error_class: Any = ...
has_case_insensitive_like: bool = ...
requires_sqlparse_for_splitting: bool = ...
bare_select_suffix: str = ...
implied_column_null: bool = ...
uppercases_column_names: bool = ...
supports_select_for_update_with_limit: bool = ...
greatest_least_ignores_nulls: bool = ...
can_clone_databases: bool = ...
ignores_table_name_case: bool = ...
for_update_after_from: bool = ...
supports_select_union: bool = ...
supports_select_intersection: bool = ...
supports_select_difference: bool = ...
supports_slicing_ordering_in_compound: bool = ...
supports_aggregate_filter_clause: bool = ...
supports_index_on_text_field: bool = ...
supports_over_clause: bool = ...
supports_cast_with_precision: bool = ...
create_test_procedure_without_params_sql: Any = ...
create_test_procedure_with_int_param_sql: Any = ...
supports_callproc_kwargs: bool = ...
db_functions_convert_bytes_to_str: bool = ...
supported_explain_formats: Any = ...
validates_explain_options: bool = ...
connection: Any = ...
def __init__(self, connection: BaseDatabaseWrapper) -> None: ...
def supports_explaining_query_execution(self) -> bool: ...
def supports_transactions(self): ...
def supports_stddev(self): ...

View File

@@ -0,0 +1,38 @@
from collections import namedtuple
from typing import Any, Dict, List, Optional, Set, Tuple, Type, Union
from django.db.backends.base.base import BaseDatabaseWrapper
from django.db.backends.utils import CursorWrapper
from django.db.models.base import Model
TableInfo = namedtuple("TableInfo", ["name", "type"])
FieldInfo = namedtuple(
"FieldInfo",
"name type_code display_size internal_size precision scale null_ok default",
)
class BaseDatabaseIntrospection:
data_types_reverse: Any = ...
connection: Any = ...
def __init__(self, connection: BaseDatabaseWrapper) -> None: ...
def get_field_type(
self, data_type: str, description: FieldInfo
) -> Union[Tuple[str, Dict[str, int]], str]: ...
def table_name_converter(self, name: str) -> str: ...
def column_name_converter(self, name: str) -> str: ...
def table_names(
self, cursor: Optional[CursorWrapper] = ..., include_views: bool = ...
) -> List[str]: ...
def get_table_list(self, cursor: Any) -> None: ...
def django_table_names(
self, only_existing: bool = ..., include_views: bool = ...
) -> List[str]: ...
def installed_models(self, tables: List[str]) -> Set[Type[Model]]: ...
def sequence_list(self) -> List[Dict[str, str]]: ...
def get_sequences(
self, cursor: Any, table_name: Any, table_fields: Any = ...
) -> None: ...
def get_key_columns(self, cursor: Any, table_name: Any) -> None: ...
def get_primary_key_column(self, cursor: Any, table_name: Any): ...
def get_constraints(self, cursor: Any, table_name: Any) -> None: ...

View File

@@ -0,0 +1,163 @@
from datetime import date, datetime, timedelta
from decimal import Decimal
from typing import Any, List, Optional, Set, Tuple, Type, Union, Sequence
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.base import Model
from django.db.models.expressions import Case, Expression
from django.db.models.fields import Field
from django.db.models.sql.compiler import SQLCompiler
class BaseDatabaseOperations:
compiler_module: str = ...
integer_field_ranges: Any = ...
set_operators: Any = ...
cast_data_types: Any = ...
cast_char_field_without_max_length: Any = ...
PRECEDING: str = ...
FOLLOWING: str = ...
UNBOUNDED_PRECEDING: Any = ...
UNBOUNDED_FOLLOWING: Any = ...
CURRENT_ROW: str = ...
explain_prefix: Any = ...
connection: django.db.DefaultConnectionProxy = ...
def __init__(
self, connection: Union[DefaultConnectionProxy, BaseDatabaseWrapper]
) -> None: ...
def autoinc_sql(self, table: str, column: str) -> None: ...
def bulk_batch_size(self, fields: Any, objs: Any): ...
def cache_key_culling_sql(self) -> str: ...
def unification_cast_sql(self, output_field: Field) -> str: ...
def date_extract_sql(self, lookup_type: None, field_name: None) -> Any: ...
def date_interval_sql(self, timedelta: None) -> Any: ...
def date_trunc_sql(self, lookup_type: None, field_name: None) -> Any: ...
def datetime_cast_date_sql(self, field_name: None, tzname: None) -> Any: ...
def datetime_cast_time_sql(self, field_name: None, tzname: None) -> Any: ...
def datetime_extract_sql(
self, lookup_type: None, field_name: None, tzname: None
) -> Any: ...
def datetime_trunc_sql(
self, lookup_type: None, field_name: None, tzname: None
) -> Any: ...
def time_trunc_sql(self, lookup_type: None, field_name: None) -> Any: ...
def time_extract_sql(self, lookup_type: None, field_name: None) -> Any: ...
def deferrable_sql(self) -> str: ...
def distinct_sql(
self, fields: List[str], params: Optional[List[Any]]
) -> Tuple[List[str], List[Any]]: ...
def fetch_returned_insert_id(self, cursor: Any): ...
def field_cast_sql(
self, db_type: Optional[str], internal_type: str
) -> str: ...
def force_no_ordering(self) -> List[Any]: ...
def for_update_sql(
self, nowait: bool = ..., skip_locked: bool = ..., of: Any = ...
): ...
def limit_offset_sql(
self, low_mark: int, high_mark: Optional[int]
) -> str: ...
def last_executed_query(self, cursor: Any, sql: Any, params: Any): ...
def last_insert_id(
self, cursor: CursorWrapper, table_name: str, pk_name: str
) -> int: ...
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 no_limit_value(self) -> Any: ...
def pk_default_value(self) -> str: ...
def prepare_sql_script(self, sql: Any): ...
def process_clob(self, value: str) -> str: ...
def return_insert_id(self) -> None: ...
def compiler(self, compiler_name: str) -> Type[SQLCompiler]: ...
def quote_name(self, name: str) -> Any: ...
def random_function_sql(self): ...
def regex_lookup(self, lookup_type: str) -> Any: ...
def savepoint_create_sql(self, sid: str) -> str: ...
def savepoint_commit_sql(self, sid: str) -> str: ...
def savepoint_rollback_sql(self, sid: str) -> str: ...
def set_time_zone_sql(self) -> str: ...
def sql_flush(
self,
style: None,
tables: None,
sequences: None,
allow_cascade: bool = ...,
) -> Any: ...
def execute_sql_flush(self, using: str, sql_list: List[str]) -> None: ...
def sequence_reset_by_name_sql(
self, style: None, sequences: List[Any]
) -> List[Any]: ...
def sequence_reset_sql(
self,
style: Style,
model_list: Sequence[Type[Model]],
) -> List[Any]: ...
def start_transaction_sql(self) -> str: ...
def end_transaction_sql(self, success: bool = ...) -> str: ...
def tablespace_sql(
self, tablespace: Optional[str], inline: bool = ...
) -> str: ...
def prep_for_like_query(self, x: str) -> str: ...
prep_for_iexact_query: Any = ...
def validate_autopk_value(self, value: int) -> int: ...
def adapt_unknown_value(
self, value: Union[datetime, Decimal, int, str]
) -> Union[int, str]: ...
def adapt_datefield_value(self, value: Optional[date]) -> Optional[str]: ...
def adapt_datetimefield_value(self, value: None) -> None: ...
def adapt_timefield_value(
self, value: Optional[datetime]
) -> 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 year_lookup_bounds_for_date_field(self, value: int) -> List[str]: ...
def year_lookup_bounds_for_datetime_field(
self, value: int
) -> List[str]: ...
def get_db_converters(self, expression: Expression) -> List[Any]: ...
def convert_durationfield_value(
self,
value: Optional[float],
expression: Expression,
connection: DatabaseWrapper,
) -> Optional[timedelta]: ...
def check_expression_support(self, expression: Any) -> None: ...
def combine_expression(
self, connector: str, sub_expressions: List[str]
) -> str: ...
def combine_duration_expression(
self, connector: Any, sub_expressions: Any
): ...
def binary_placeholder_sql(self, value: Optional[Case]) -> str: ...
def modify_insert_params(
self,
placeholder: str,
params: Union[List[None], List[bool], List[float], List[str]],
) -> Union[List[None], List[bool], List[float], List[str]]: ...
def integer_field_range(self, internal_type: Any): ...
def subtract_temporals(self, internal_type: Any, lhs: Any, rhs: Any): ...
def window_frame_start(self, start: Any): ...
def window_frame_end(self, end: Any): ...
def window_frame_rows_start_end(
self, start: None = ..., end: None = ...
) -> Any: ...
def window_frame_range_start_end(
self, start: Optional[Any] = ..., end: Optional[Any] = ...
): ...
def explain_query_prefix(
self, format: Optional[str] = ..., **options: Any
) -> str: ...

View File

@@ -0,0 +1,101 @@
from typing import Any, List, Optional, Tuple, Type, Union
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 django.db.models.indexes import Index
logger: Any
class BaseDatabaseSchemaEditor:
sql_create_table: str = ...
sql_rename_table: str = ...
sql_retablespace_table: str = ...
sql_delete_table: str = ...
sql_create_column: str = ...
sql_alter_column: str = ...
sql_alter_column_type: str = ...
sql_alter_column_null: str = ...
sql_alter_column_not_null: str = ...
sql_alter_column_default: str = ...
sql_alter_column_no_default: str = ...
sql_delete_column: str = ...
sql_rename_column: str = ...
sql_update_with_default: str = ...
sql_create_check: str = ...
sql_delete_check: str = ...
sql_create_unique: str = ...
sql_delete_unique: str = ...
sql_create_fk: str = ...
sql_create_inline_fk: Any = ...
sql_delete_fk: str = ...
sql_create_index: str = ...
sql_delete_index: str = ...
sql_create_pk: str = ...
sql_delete_pk: str = ...
sql_delete_procedure: str = ...
connection: Any = ...
collect_sql: Any = ...
collected_sql: Any = ...
atomic_migration: Any = ...
def __init__(
self,
connection: DatabaseWrapper,
collect_sql: bool = ...,
atomic: bool = ...,
) -> None: ...
deferred_sql: Any = ...
atomic: Any = ...
def __enter__(self) -> DatabaseSchemaEditor: ...
def __exit__(
self, exc_type: None, exc_value: None, traceback: None
) -> None: ...
def execute(
self,
sql: Union[Statement, str],
params: Optional[Union[List[int], Tuple]] = ...,
) -> None: ...
def quote_name(self, name: str) -> str: ...
def column_sql(
self, model: Type[Model], field: Field, include_default: bool = ...
) -> Union[Tuple[None, None], Tuple[str, List[Any]]]: ...
def skip_default(self, field: Any): ...
def prepare_default(self, value: Any) -> None: ...
def effective_default(self, field: Field) -> Optional[Union[int, str]]: ...
def quote_value(self, value: Any) -> None: ...
def create_model(self, model: Type[Model]) -> None: ...
def delete_model(self, model: Type[Model]) -> None: ...
def add_index(self, model: Type[Model], index: Index) -> None: ...
def remove_index(self, model: Type[Model], index: Index) -> None: ...
def alter_unique_together(
self,
model: Type[Model],
old_unique_together: Union[List[List[str]], Tuple[Tuple[str, str]]],
new_unique_together: Union[List[List[str]], Tuple[Tuple[str, str]]],
) -> None: ...
def alter_index_together(
self,
model: Type[Model],
old_index_together: Union[List[List[str]], List[Tuple[str, str]]],
new_index_together: Union[List[List[str]], List[Tuple[str, str]]],
) -> None: ...
def alter_db_table(
self, model: Type[Model], old_db_table: str, new_db_table: str
) -> None: ...
def alter_db_tablespace(
self, model: Any, old_db_tablespace: Any, new_db_tablespace: Any
) -> None: ...
def add_field(self, model: Any, field: Any): ...
def remove_field(self, model: Any, field: Any): ...
def alter_field(
self,
model: Type[Model],
old_field: Field,
new_field: Field,
strict: bool = ...,
) -> None: ...
def remove_procedure(
self, procedure_name: Any, param_types: Any = ...
) -> None: ...

View File

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

View File

@@ -0,0 +1,93 @@
from typing import Any, Callable, List, Tuple, Union, Dict
class Reference:
def references_table(self, table: Any): ...
def references_column(self, table: Any, column: Any): ...
def rename_table_references(
self, old_table: Any, new_table: Any
) -> None: ...
def rename_column_references(
self, table: Any, old_column: Any, new_column: Any
) -> None: ...
class Table(Reference):
table: str = ...
quote_name: Callable = ...
def __init__(self, table: str, quote_name: Callable) -> None: ...
def references_table(self, table: str) -> bool: ...
def rename_table_references(
self, old_table: str, new_table: str
) -> None: ...
class TableColumns(Table):
table: str = ...
columns: List[str] = ...
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: ...
class Columns(TableColumns):
columns: List[str]
table: str
quote_name: Callable = ...
col_suffixes: Tuple = ...
def __init__(
self,
table: str,
columns: List[str],
quote_name: Callable,
col_suffixes: Union[List[str], Tuple] = ...,
) -> None: ...
class IndexName(TableColumns):
columns: List[str]
table: str
suffix: str = ...
create_index_name: Callable = ...
def __init__(
self,
table: str,
columns: List[str],
suffix: str,
create_index_name: Callable,
) -> None: ...
class ForeignKeyName(TableColumns):
columns: List[str]
table: str
to_reference: TableColumns = ...
suffix_template: str = ...
create_fk_name: Callable = ...
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 references_table(self, table: str) -> bool: ...
def references_column(self, table: str, column: str) -> bool: ...
def rename_table_references(
self, old_table: str, new_table: str
) -> None: ...
def rename_column_references(
self, table: str, old_column: str, new_column: str
) -> None: ...
class Statement(Reference):
template: str = ...
parts: Dict[str, Table] = ...
def __init__(self, template: str, **parts: Any) -> None: ...
def references_table(self, table: str) -> bool: ...
def references_column(self, table: str, column: str) -> bool: ...
def rename_table_references(
self, old_table: str, new_table: str
) -> None: ...
def rename_column_references(
self, table: str, old_column: str, new_column: str
) -> None: ...

View File

@@ -0,0 +1,66 @@
from typing import Any, Optional
from django.db.backends.base.base import BaseDatabaseWrapper
from django.db.backends.base.client import BaseDatabaseClient
from django.db.backends.base.creation import BaseDatabaseCreation
from django.db.backends.base.introspection import BaseDatabaseIntrospection
from django.db.backends.base.operations import BaseDatabaseOperations
def complain(*args: Any, **kwargs: Any) -> Any: ...
def ignore(*args: Any, **kwargs: Any) -> None: ...
class DatabaseOperations(BaseDatabaseOperations):
connection: django.db.backends.dummy.base.DatabaseWrapper
quote_name: Any = ...
class DatabaseClient(BaseDatabaseClient):
connection: django.db.backends.dummy.base.DatabaseWrapper
runshell: Any = ...
class DatabaseCreation(BaseDatabaseCreation):
connection: django.db.backends.dummy.base.DatabaseWrapper
create_test_db: Any = ...
destroy_test_db: Any = ...
class DatabaseIntrospection(BaseDatabaseIntrospection):
connection: django.db.backends.dummy.base.DatabaseWrapper
get_table_list: Any = ...
get_table_description: Any = ...
get_relations: Any = ...
get_indexes: Any = ...
get_key_columns: Any = ...
class DatabaseWrapper(BaseDatabaseWrapper):
alias: str
allow_thread_sharing: bool
autocommit: bool
client: django.db.backends.dummy.base.DatabaseClient
close_at: None
closed_in_transaction: bool
commit_on_exit: bool
connection: None
creation: django.db.backends.dummy.base.DatabaseCreation
errors_occurred: bool
execute_wrappers: List[Any]
features: django.db.backends.dummy.features.DummyDatabaseFeatures
force_debug_cursor: bool
in_atomic_block: bool
introspection: django.db.backends.dummy.base.DatabaseIntrospection
needs_rollback: bool
ops: django.db.backends.dummy.base.DatabaseOperations
queries_log: collections.deque
run_commit_hooks_on_set_autocommit_on: bool
run_on_commit: List[Any]
savepoint_ids: List[Any]
savepoint_state: int
settings_dict: Dict[str, Optional[Union[Dict[str, None], int, str]]]
validation: django.db.backends.base.validation.BaseDatabaseValidation
operators: Any = ...
ensure_connection: Any = ...
client_class: Any = ...
creation_class: Any = ...
features_class: Any = ...
introspection_class: Any = ...
ops_class: Any = ...
def is_usable(self): ...

View File

@@ -0,0 +1,18 @@
from typing import Any, Dict, List, Optional, Union
from django.db.backends.base.client import BaseDatabaseClient
class DatabaseClient(BaseDatabaseClient):
executable_name: str = ...
@classmethod
def settings_to_cmd_args(
cls,
settings_dict: Dict[
str,
Optional[
Union[Dict[str, Dict[str, str]], int, str]
],
],
) -> List[str]: ...
def runshell(self) -> None: ...

View File

@@ -0,0 +1,10 @@
from typing import Any, Dict, Optional
from django.db.backends.base.client import BaseDatabaseClient
class DatabaseClient(BaseDatabaseClient):
executable_name: str = ...
@classmethod
def runshell_db(cls, conn_params: Dict[str, str]) -> None: ...
def runshell(self) -> None: ...

View File

@@ -0,0 +1,86 @@
import collections
from datetime import datetime
from sqlite3 import Connection
from sqlite3 import dbapi2 as Database
from typing import Any, Callable, Dict, Iterator, List, Optional, Tuple, Union
from django.db.backends.base.base import BaseDatabaseWrapper
from django.db.backends.base.validation import BaseDatabaseValidation
from django.db.backends.sqlite3.client import DatabaseClient
from .creation import DatabaseCreation
from .features import DatabaseFeatures
from .introspection import DatabaseIntrospection
from .operations import DatabaseOperations
def decoder(conv_func: Callable) -> Callable: ...
class DatabaseWrapper(BaseDatabaseWrapper):
alias: str
allow_thread_sharing: bool
autocommit: bool
client: DatabaseClient
close_at: None
closed_in_transaction: bool
commit_on_exit: bool
connection: None
creation: DatabaseCreation
errors_occurred: bool
execute_wrappers: List[Any]
features: DatabaseFeatures
force_debug_cursor: bool
in_atomic_block: bool
introspection: DatabaseIntrospection
needs_rollback: bool
ops: DatabaseOperations
queries_log: collections.deque
run_commit_hooks_on_set_autocommit_on: bool
run_on_commit: List[Any]
savepoint_ids: List[Any]
savepoint_state: int
settings_dict: Dict[str, Optional[Union[Dict[str, None], int, str]]]
validation: BaseDatabaseValidation
vendor: str = ...
display_name: str = ...
data_types: Any = ...
data_types_suffix: Any = ...
operators: Any = ...
pattern_esc: str = ...
pattern_ops: Any = ...
Database: Any = ...
SchemaEditorClass: Any = ...
client_class: Any = ...
creation_class: Any = ...
features_class: Any = ...
introspection_class: Any = ...
ops_class: Any = ...
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 create_cursor(self, name: None = ...) -> SQLiteCursorWrapper: ...
def close(self) -> None: ...
def disable_constraint_checking(self) -> bool: ...
def enable_constraint_checking(self) -> None: ...
def check_constraints(
self, table_names: Optional[List[str]] = ...
) -> None: ...
def is_usable(self): ...
def is_in_memory_db(self) -> bool: ...
FORMAT_QMARK_REGEX: Any
class SQLiteCursorWrapper(Database.Cursor):
def execute(
self,
query: str,
params: Optional[
Union[List[bool], List[datetime], List[float], Tuple]
] = ...,
) -> SQLiteCursorWrapper: ...
def executemany(
self, query: str, param_list: Union[Iterator[Any], List[Tuple[int]]]
) -> SQLiteCursorWrapper: ...
def convert_query(self, query: str) -> str: ...

View File

@@ -0,0 +1,11 @@
from typing import Any, Optional, Tuple
from django.db.backends.base.creation import BaseDatabaseCreation
class DatabaseCreation(BaseDatabaseCreation):
connection: django.db.backends.sqlite3.base.DatabaseWrapper
@staticmethod
def is_in_memory_db(database_name: str) -> bool: ...
def get_test_db_clone_settings(self, suffix: Any): ...
def test_db_signature(self) -> Tuple[str, str]: ...

View File

@@ -0,0 +1,31 @@
from typing import Optional
from django.db.backends.base.features import BaseDatabaseFeatures
class DatabaseFeatures(BaseDatabaseFeatures):
connection: django.db.backends.sqlite3.base.DatabaseWrapper
can_use_chunked_reads: bool = ...
test_db_allows_multiple_connections: bool = ...
supports_unspecified_pk: bool = ...
supports_timezones: bool = ...
max_query_params: int = ...
supports_mixed_date_datetime_comparisons: bool = ...
supports_column_check_constraints: bool = ...
autocommits_when_autocommit_is_off: bool = ...
can_introspect_decimal_field: bool = ...
can_introspect_positive_integer_field: bool = ...
can_introspect_small_integer_field: bool = ...
supports_transactions: bool = ...
atomic_transactions: bool = ...
can_rollback_ddl: bool = ...
supports_atomic_references_rename: bool = ...
supports_paramstyle_pyformat: bool = ...
supports_sequence_reset: bool = ...
can_clone_databases: bool = ...
supports_temporal_subtraction: bool = ...
ignores_table_name_case: bool = ...
supports_cast_with_precision: bool = ...
uses_savepoints: bool = ...
can_release_savepoints: bool = ...
def supports_stddev(self) -> bool: ...

View File

@@ -0,0 +1,42 @@
from typing import Any, Dict, List, Optional, Tuple, Union
from django.db.backends.base.introspection import (BaseDatabaseIntrospection,
FieldInfo, TableInfo)
from django.db.backends.utils import CursorWrapper
from django.db.models.fields import Field
field_size_re: Any
def get_field_size(name: str) -> Optional[int]: ...
class FlexibleFieldLookupDict:
base_data_types_reverse: Any = ...
def __getitem__(
self, key: str
) -> Union[Tuple[str, Dict[str, int]], str]: ...
class DatabaseIntrospection(BaseDatabaseIntrospection):
connection: django.db.backends.sqlite3.base.DatabaseWrapper
data_types_reverse: Any = ...
def get_table_list(self, cursor: CursorWrapper) -> List[TableInfo]: ...
def get_table_description(
self, cursor: CursorWrapper, table_name: str
) -> List[FieldInfo]: ...
def get_sequences(
self,
cursor: CursorWrapper,
table_name: str,
table_fields: List[Field] = ...,
) -> List[Dict[str, str]]: ...
def get_relations(
self, cursor: CursorWrapper, table_name: str
) -> Dict[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
) -> Optional[str]: ...
def get_constraints(
self, cursor: CursorWrapper, table_name: str
) -> Dict[str, Dict[str, Union[List[str], bool]]]: ...

View File

@@ -0,0 +1,119 @@
from datetime import date, datetime, time, timedelta
from typing import Any, Callable, Dict, List, Optional, Tuple, Union
from uuid import UUID
from django.core.management.color import Style
from django.db.backends.base.operations import BaseDatabaseOperations
from django.db.backends.sqlite3.base import (DatabaseWrapper,
SQLiteCursorWrapper)
from django.db.backends.utils import CursorDebugWrapper
from django.db.models.base import Model
from django.db.models.expressions import (BaseExpression, Col, Expression, F,
SQLiteNumericMixin)
from django.db.models.fields import Field
from django.utils.datastructures import ImmutableList
class DatabaseOperations(BaseDatabaseOperations):
connection: django.db.backends.sqlite3.base.DatabaseWrapper
cast_char_field_without_max_length: str = ...
cast_data_types: Any = ...
explain_prefix: str = ...
def bulk_batch_size(
self,
fields: Union[List[Field], List[str], ImmutableList],
objs: Union[List[Model], range],
) -> int: ...
def check_expression_support(
self, expression: Union[BaseExpression, SQLiteNumericMixin]
) -> None: ...
def date_extract_sql(self, lookup_type: str, field_name: str) -> str: ...
def date_interval_sql(self, timedelta: timedelta) -> str: ...
def format_for_duration_arithmetic(self, sql: str) -> str: ...
def date_trunc_sql(self, lookup_type: str, field_name: str) -> str: ...
def time_trunc_sql(self, lookup_type: str, field_name: str) -> str: ...
def datetime_cast_date_sql(
self, field_name: str, tzname: Optional[str]
) -> str: ...
def datetime_cast_time_sql(
self, field_name: str, tzname: Optional[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 time_extract_sql(self, lookup_type: str, field_name: str) -> str: ...
def pk_default_value(self) -> str: ...
def last_executed_query(
self,
cursor: Union[SQLiteCursorWrapper, CursorDebugWrapper],
sql: str,
params: Optional[Union[List[int], List[str], Tuple]],
) -> str: ...
def quote_name(self, name: str) -> str: ...
def no_limit_value(self) -> int: ...
def sql_flush(
self,
style: Style,
tables: List[str],
sequences: Union[List[Dict[str, str]], Tuple],
allow_cascade: bool = ...,
) -> List[str]: ...
def execute_sql_flush(self, using: str, sql_list: List[str]) -> None: ...
def adapt_datetimefield_value(
self, value: Optional[Union[datetime, F]]
) -> Optional[Union[F, str]]: ...
def adapt_timefield_value(
self, value: Optional[Union[time, F]]
) -> Optional[Union[F, str]]: ...
def get_db_converters(self, expression: Expression) -> List[Callable]: ...
def convert_datetimefield_value(
self,
value: Optional[Union[datetime, str]],
expression: Expression,
connection: DatabaseWrapper,
) -> Optional[datetime]: ...
def convert_datefield_value(
self,
value: Optional[Union[date, str]],
expression: Expression,
connection: DatabaseWrapper,
) -> Optional[date]: ...
def convert_timefield_value(
self,
value: Optional[Union[time, str]],
expression: Expression,
connection: DatabaseWrapper,
) -> Optional[time]: ...
def get_decimalfield_converter(
self, expression: Expression
) -> Callable: ...
def convert_uuidfield_value(
self, value: Optional[str], expression: Col, connection: DatabaseWrapper
) -> Optional[UUID]: ...
def convert_booleanfield_value(
self,
value: Optional[int],
expression: Expression,
connection: DatabaseWrapper,
) -> Optional[bool]: ...
def bulk_insert_sql(
self,
fields: Union[List[None], List[Field], ImmutableList],
placeholder_rows: Union[List[Any], Tuple[Tuple[str]]],
) -> str: ...
def combine_expression(
self, connector: str, sub_expressions: List[str]
) -> str: ...
def combine_duration_expression(
self, connector: str, sub_expressions: List[str]
) -> str: ...
def integer_field_range(self, internal_type: str) -> Tuple[None, None]: ...
def subtract_temporals(
self,
internal_type: str,
lhs: Tuple[str, List[Any]],
rhs: Tuple[str, List[str]],
) -> Tuple[str, List[str]]: ...

View File

@@ -0,0 +1,40 @@
from typing import Any, Optional, Type, Union
from django.db.backends.base.schema import BaseDatabaseSchemaEditor
from django.db.models.base import Model
from django.db.models.fields import Field
class DatabaseSchemaEditor(BaseDatabaseSchemaEditor):
atomic_migration: bool
collect_sql: bool
connection: django.db.backends.sqlite3.base.DatabaseWrapper
sql_delete_table: str = ...
sql_create_fk: Any = ...
sql_create_inline_fk: str = ...
sql_create_unique: str = ...
sql_delete_unique: str = ...
def __enter__(self) -> DatabaseSchemaEditor: ...
def __exit__(
self, exc_type: None, exc_value: None, traceback: None
) -> None: ...
def quote_value(self, value: Optional[Union[int, str]]) -> str: ...
def alter_db_table(
self,
model: Type[Model],
old_db_table: str,
new_db_table: str,
disable_constraints: bool = ...,
) -> None: ...
def alter_field(
self,
model: Type[Model],
old_field: Field,
new_field: Field,
strict: bool = ...,
) -> None: ...
def delete_model(
self, model: Type[Model], handle_autom2m: bool = ...
) -> None: ...
def add_field(self, model: Type[Model], field: Field) -> None: ...
def remove_field(self, model: Type[Model], field: Field) -> None: ...

View File

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