initial commit

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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