run black over stubs, add checking to travis

This commit is contained in:
Maxim Kurnikov
2018-12-03 18:52:44 +03:00
parent d5bc7d4ab2
commit cf6119bf9b
420 changed files with 2295 additions and 8384 deletions

View File

@@ -1,7 +1,6 @@
from typing import Any, Callable, Dict, Iterator, List, Optional
from django.db.backends.sqlite3.base import (DatabaseWrapper,
SQLiteCursorWrapper)
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
@@ -46,12 +45,7 @@ class BaseDatabaseWrapper:
features: Any = ...
introspection: Any = ...
validation: Any = ...
def __init__(
self,
settings_dict: Dict[str, Dict[str, str]],
alias: str = ...,
allow_thread_sharing: bool = ...,
) -> None: ...
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): ...
@@ -75,11 +69,7 @@ class BaseDatabaseWrapper:
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 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: ...
@@ -94,17 +84,11 @@ class BaseDatabaseWrapper:
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_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 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: ...
def copy(self, alias: None = ..., allow_thread_sharing: None = ...) -> DatabaseWrapper: ...

View File

@@ -2,7 +2,6 @@ from typing import Any, Optional
from django.db.backends.base.base import BaseDatabaseWrapper
class BaseDatabaseClient:
executable_name: Any = ...
connection: Any = ...

View File

@@ -7,35 +7,14 @@ 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 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 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 = ...,
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

@@ -2,7 +2,6 @@ from typing import Any, Optional
from django.db.backends.base.base import BaseDatabaseWrapper
class BaseDatabaseFeatures:
gis_enabled: bool = ...
allows_group_by_pk: bool = ...

View File

@@ -7,32 +7,21 @@ 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",
)
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 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 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 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_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

@@ -12,7 +12,6 @@ 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 = ...
@@ -26,9 +25,7 @@ class BaseDatabaseOperations:
CURRENT_ROW: str = ...
explain_prefix: Any = ...
connection: django.db.DefaultConnectionProxy = ...
def __init__(
self, connection: Union[DefaultConnectionProxy, BaseDatabaseWrapper]
) -> None: ...
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: ...
@@ -38,36 +35,20 @@ class BaseDatabaseOperations:
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 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 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 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 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 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: ...
@@ -83,81 +64,41 @@ class BaseDatabaseOperations:
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 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 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 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_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_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]
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 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,
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 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]],
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: ...
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

@@ -40,23 +40,12 @@ class BaseDatabaseSchemaEditor:
collect_sql: Any = ...
collected_sql: Any = ...
atomic_migration: Any = ...
def __init__(
self,
connection: DatabaseWrapper,
collect_sql: bool = ...,
atomic: bool = ...,
) -> None: ...
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 __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 = ...
@@ -81,21 +70,9 @@ class BaseDatabaseSchemaEditor:
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 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: ...
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

@@ -3,7 +3,6 @@ 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: ...

View File

@@ -1,33 +1,24 @@
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: ...
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: ...
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: ...
def rename_column_references(self, table: str, old_column: str, new_column: str) -> None: ...
class Columns(TableColumns):
columns: List[str]
@@ -35,11 +26,7 @@ class Columns(TableColumns):
quote_name: Callable = ...
col_suffixes: Tuple = ...
def __init__(
self,
table: str,
columns: List[str],
quote_name: Callable,
col_suffixes: Union[List[str], Tuple] = ...,
self, table: str, columns: List[str], quote_name: Callable, col_suffixes: Union[List[str], Tuple] = ...
) -> None: ...
class IndexName(TableColumns):
@@ -47,13 +34,7 @@ class IndexName(TableColumns):
table: str
suffix: str = ...
create_index_name: Callable = ...
def __init__(
self,
table: str,
columns: List[str],
suffix: str,
create_index_name: Callable,
) -> None: ...
def __init__(self, table: str, columns: List[str], suffix: str, create_index_name: Callable) -> None: ...
class ForeignKeyName(TableColumns):
columns: List[str]
@@ -72,12 +53,8 @@ class ForeignKeyName(TableColumns):
) -> 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: ...
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 = ...
@@ -85,9 +62,5 @@ class Statement(Reference):
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: ...
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

@@ -6,7 +6,6 @@ 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: ...

View File

@@ -2,17 +2,10 @@ 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]
],
],
cls, settings_dict: Dict[str, Optional[Union[Dict[str, Dict[str, str]], int, str]]]
) -> List[str]: ...
def runshell(self) -> None: ...

View File

@@ -2,7 +2,6 @@ from typing import Any, Dict, Optional
from django.db.backends.base.client import BaseDatabaseClient
class DatabaseClient(BaseDatabaseClient):
executable_name: str = ...
@classmethod

View File

@@ -13,7 +13,6 @@ from .features import DatabaseFeatures
from .introspection import DatabaseIntrospection
from .operations import DatabaseOperations
def decoder(conv_func: Callable) -> Callable: ...
class DatabaseWrapper(BaseDatabaseWrapper):
@@ -56,17 +55,13 @@ class DatabaseWrapper(BaseDatabaseWrapper):
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 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 check_constraints(self, table_names: Optional[List[str]] = ...) -> None: ...
def is_usable(self): ...
def is_in_memory_db(self) -> bool: ...
@@ -74,13 +69,7 @@ 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]]]
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

@@ -2,7 +2,6 @@ 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

View File

@@ -2,7 +2,6 @@ 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 = ...

View File

@@ -1,7 +1,6 @@
from typing import Any, Dict, List, Optional, Tuple, Union
from django.db.backends.base.introspection import (BaseDatabaseIntrospection,
FieldInfo, TableInfo)
from django.db.backends.base.introspection import BaseDatabaseIntrospection, FieldInfo, TableInfo
from django.db.backends.utils import CursorWrapper
from django.db.models.fields import Field
@@ -11,32 +10,15 @@ 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]: ...
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]]]: ...
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

@@ -4,46 +4,29 @@ 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.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.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 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 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(
@@ -55,65 +38,32 @@ class DatabaseOperations(BaseDatabaseOperations):
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 = ...,
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 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,
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,
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,
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 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,
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]
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]],
self, internal_type: str, lhs: Tuple[str, List[Any]], rhs: Tuple[str, List[str]]
) -> Tuple[str, List[str]]: ...

View File

@@ -4,7 +4,6 @@ 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
@@ -15,26 +14,12 @@ class DatabaseSchemaEditor(BaseDatabaseSchemaEditor):
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 __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 = ...
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

@@ -2,51 +2,31 @@ 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)
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: ...
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 __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 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]
] = ...,
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]]]],
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 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]: ...
@@ -54,12 +34,6 @@ 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 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: ...