mirror of
https://github.com/davidhalter/django-stubs.git
synced 2025-12-09 13:35:01 +08:00
run black over stubs, add checking to travis
This commit is contained in:
@@ -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: ...
|
||||
|
||||
@@ -2,7 +2,6 @@ from typing import Any, Optional
|
||||
|
||||
from django.db.backends.base.base import BaseDatabaseWrapper
|
||||
|
||||
|
||||
class BaseDatabaseClient:
|
||||
executable_name: Any = ...
|
||||
connection: Any = ...
|
||||
|
||||
@@ -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]: ...
|
||||
|
||||
@@ -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 = ...
|
||||
|
||||
@@ -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: ...
|
||||
|
||||
@@ -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: ...
|
||||
|
||||
@@ -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: ...
|
||||
|
||||
@@ -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: ...
|
||||
|
||||
Reference in New Issue
Block a user