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

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