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,116 @@
from django.db.backends.sqlite3.base import DatabaseWrapper
from django.db.backends.utils import CursorWrapper
from django.db.models.expressions import (
Col,
CombinedExpression,
Expression,
OrderBy,
)
from django.db.models.functions.datetime import Trunc
from django.db.models.options import Options
from django.db.models.sql.query import (
Query,
RawQuery,
)
from itertools import chain
from typing import (
Any,
Dict,
Iterator,
List,
Optional,
Set,
Tuple,
Union,
)
class SQLAggregateCompiler:
def as_sql(self) -> Any: ...
class SQLCompiler:
def __init__(
self,
query: Union[Query, RawQuery],
connection: DatabaseWrapper,
using: Optional[str]
) -> None: ...
def _setup_joins(self, pieces: List[str], opts: Options, alias: Optional[str]) -> Any: ...
def apply_converters(self, rows: chain, converters: Dict[int, Any]) -> Iterator[Any]: ...
def as_sql(self, with_limits: bool = ..., with_col_aliases: bool = ...): ...
def as_subquery_condition(
self,
alias: str,
columns: List[str],
compiler: SQLCompiler
) -> Union[Tuple[str, Tuple[str]], Tuple[str, Tuple]]: ...
def collapse_group_by(
self,
expressions: Union[List[Col], List[Union[Col, Trunc]], List[Expression], List[Union[Col, CombinedExpression]]],
having: Union[List[Col], Tuple, List[CombinedExpression]]
) -> Union[List[Col], List[Union[Col, Trunc]], List[Expression], List[Union[Col, CombinedExpression]]]: ...
def compile(self, node: Any, select_format: object = ...) -> Any: ...
def deferred_to_columns(self) -> Any: ...
def execute_sql(
self,
result_type: str = ...,
chunked_fetch: bool = ...,
chunk_size: int = ...
) -> Optional[CursorWrapper]: ...
def explain_query(self) -> Iterator[str]: ...
def find_ordering_name(
self,
name: str,
opts: Options,
alias: Optional[str] = ...,
default_order: str = ...,
already_seen: Optional[Union[Set[Tuple[None, Tuple[Tuple[str, str]]]], Set[Tuple[None, Tuple[Tuple[str, str]], Tuple[Tuple[str, str]], Tuple[Tuple[str, str]]]], Set[Union[Tuple[None, Tuple[Tuple[str, str]]], Tuple[Tuple[Tuple[str, str]], Tuple[Tuple[str, str]]]]]]] = ...
) -> List[Tuple[OrderBy, bool]]: ...
def get_combinator_sql(
self,
combinator: str,
all: bool
) -> Union[Tuple[List[str], List[Any]], Tuple[List[str], List[int]], Tuple[List[str], List[str]]]: ...
def get_converters(self, expressions: Any) -> Dict[int, Any]: ...
def get_default_columns(
self,
start_alias: Optional[str] = ...,
opts: Optional[Options] = ...,
from_parent: Any = ...
) -> List[Col]: ...
def get_distinct(self) -> Tuple[List[Any], List[Any]]: ...
def get_extra_select(
self,
order_by: Union[List[Tuple[OrderBy, Tuple[str, List[Any], bool]]], List[Union[Tuple[OrderBy, Tuple[str, List[int], bool]], Tuple[OrderBy, Tuple[str, List[Any], bool]]]], List[Tuple[OrderBy, Tuple[str, Tuple, bool]]]],
select: Any
) -> List[Tuple[OrderBy, Tuple[str, List[Any]], None]]: ...
def get_from_clause(
self
) -> Union[Tuple[List[str], List[Union[int, str]]], Tuple[List[str], List[Any]], Tuple[List[str], List[int]], Tuple[List[str], List[str]]]: ...
def get_group_by(
self,
select: Any,
order_by: Any
) -> Union[List[Union[Tuple[str, List[Any]], Tuple[str, List[str]]]], List[Tuple[str, List[Any]]], List[Union[Tuple[str, List[Any]], Tuple[str, List[int]]]]]: ...
def get_order_by(self) -> Any: ...
def get_related_selections(
self,
select: Any,
opts: Optional[Options] = ...,
root_alias: Optional[str] = ...,
cur_depth: int = ...,
requested: Any = ...,
restricted: Optional[bool] = ...
) -> Any: ...
def get_select(self) -> Any: ...
def has_results(self) -> bool: ...
def pre_sql_setup(self) -> Any: ...
def quote_name_unless_alias(self, name: str) -> str: ...
def results_iter(
self,
results: Any = ...,
tuple_expected: bool = ...,
chunked_fetch: bool = ...,
chunk_size: int = ...
) -> chain: ...

View File

@@ -0,0 +1,69 @@
from collections import OrderedDict
from django.db.backends.sqlite3.base import DatabaseWrapper
from django.db.models.fields.related import ForeignObject
from django.db.models.fields.reverse_related import ForeignObjectRel
from django.db.models.query_utils import (
FilteredRelation,
PathInfo,
)
from django.db.models.sql.compiler import SQLCompiler
from typing import (
Any,
Dict,
List,
Optional,
Tuple,
Union,
)
class BaseTable:
def __init__(self, table_name: str, alias: Optional[str]) -> None: ...
def as_sql(
self,
compiler: SQLCompiler,
connection: DatabaseWrapper
) -> Tuple[str, List[Any]]: ...
def equals(self, other: Join, with_filtered_relation: bool) -> bool: ...
def relabeled_clone(self, change_map: OrderedDict) -> BaseTable: ...
class Join:
def __eq__(
self,
other: Union[Join, BaseTable]
) -> bool: ...
def __init__(
self,
table_name: str,
parent_alias: str,
table_alias: Optional[str],
join_type: str,
join_field: Union[ForeignObjectRel, ForeignObject],
nullable: bool,
filtered_relation: Optional[FilteredRelation] = ...
) -> None: ...
def as_sql(
self,
compiler: SQLCompiler,
connection: DatabaseWrapper
) -> Union[Tuple[str, List[int]], Tuple[str, List[Any]], Tuple[str, List[str]]]: ...
def demote(self) -> Join: ...
def equals(
self,
other: Union[Join, BaseTable],
with_filtered_relation: bool
) -> bool: ...
def promote(self) -> Join: ...
def relabeled_clone(
self,
change_map: Union[Dict[str, str], OrderedDict]
) -> Join: ...
class MultiJoin:
def __init__(
self,
names_pos: int,
path_with_names: List[Tuple[str, List[PathInfo]]]
) -> None: ...

View File

@@ -0,0 +1,18 @@
from django.db.models.sql.where import WhereNode
from typing import (
Any,
Set,
Tuple,
Type,
Union,
)
class JoinPromoter:
def __init__(self, connector: str, num_children: int, negated: bool) -> None: ...
def add_votes(self, votes: Union[Tuple, Set[str]]) -> None: ...
def update_join_types(self, query: Query) -> Set[str]: ...
class Query:
def __init__(self, model: Any, where: Type[WhereNode] = ...) -> None: ...

View File

@@ -0,0 +1,44 @@
from django.db.models.base import Model
from django.db.models.fields import CharField
from django.db.models.query import QuerySet
from django.db.models.sql.query import Query
from django.db.models.sql.where import WhereNode
from typing import (
Any,
Dict,
List,
Optional,
Type,
Union,
)
class AggregateQuery:
def add_subquery(self, query: Query, using: str) -> None: ...
class DeleteQuery:
def delete_batch(self, pk_list: Union[List[int], List[str]], using: str) -> int: ...
def delete_qs(self, query: QuerySet, using: str) -> int: ...
def do_query(self, table: str, where: WhereNode, using: str) -> int: ...
class InsertQuery:
def __init__(self, *args, **kwargs) -> None: ...
def insert_values(self, fields: Any, objs: Any, raw: bool = ...) -> None: ...
class UpdateQuery:
def __init__(self, *args, **kwargs) -> None: ...
def _setup_query(self) -> None: ...
def add_related_update(
self,
model: Type[Model],
field: CharField,
value: str
) -> None: ...
def add_update_fields(self, values_seq: Any) -> None: ...
def add_update_values(self, values: Dict[str, Any]) -> None: ...
def clone(self) -> UpdateQuery: ...
def get_related_updates(self) -> List[UpdateQuery]: ...
def update_batch(self, pk_list: List[int], values: Dict[str, Union[None, int]], using: str) -> None: ...

View File

@@ -0,0 +1,99 @@
from collections import OrderedDict
from django.db import DefaultConnectionProxy
from django.db.backends.sqlite3.base import DatabaseWrapper
from django.db.models.expressions import (
Col,
CombinedExpression,
)
from django.db.models.lookups import (
Exact,
FieldGetDbPrepValueMixin,
GreaterThan,
IntegerLessThan,
LessThanOrEqual,
)
from django.db.models.sql.compiler import SQLCompiler
from django.db.models.sql.query import Query
from typing import (
Any,
Dict,
List,
Optional,
Tuple,
Union,
)
class ExtraWhere:
def __init__(self, sqls: List[str], params: Optional[List[int]]) -> None: ...
def as_sql(
self,
compiler: SQLCompiler = ...,
connection: DatabaseWrapper = ...
) -> Union[Tuple[str, List[int]], Tuple[str, List[Any]]]: ...
class NothingNode:
def as_sql(
self,
compiler: object = ...,
connection: Union[DefaultConnectionProxy, backends.sqlite3.base.DatabaseWrapper] = ...
): ...
class SubqueryConstraint:
def __init__(
self,
alias: str,
columns: List[str],
targets: List[str],
query_object: Query
) -> None: ...
def as_sql(
self,
compiler: SQLCompiler,
connection: DatabaseWrapper
) -> Tuple[str, Tuple]: ...
class WhereNode:
@classmethod
def _contains_aggregate(cls, obj: Any) -> bool: ...
@classmethod
def _contains_over_clause(
cls,
obj: Union[WhereNode, FieldGetDbPrepValueMixin]
) -> bool: ...
def as_sql(
self,
compiler: object,
connection: Union[DefaultConnectionProxy, backends.sqlite3.base.DatabaseWrapper]
) -> Any: ...
def clone(self) -> WhereNode: ...
@cached_property
def contains_aggregate(self) -> bool: ...
@cached_property
def contains_over_clause(self) -> bool: ...
def get_group_by_cols(
self
) -> Union[List[CombinedExpression], List[Col]]: ...
def get_source_expressions(
self
) -> Union[List[GreaterThan], List[IntegerLessThan], List[Exact], List[LessThanOrEqual]]: ...
def relabel_aliases(
self,
change_map: Union[OrderedDict, Dict[str, str], Dict[Union[str, None], str]]
) -> None: ...
def relabeled_clone(
self,
change_map: Union[OrderedDict, Dict[Union[str, None], str]]
) -> WhereNode: ...
def resolve_expression(self, *args, **kwargs) -> WhereNode: ...
def set_source_expressions(
self,
children: Union[List[GreaterThan], List[IntegerLessThan], List[Exact]]
) -> None: ...
def split_having(
self,
negated: bool = ...
) -> Union[Tuple[WhereNode, None], Tuple[None, WhereNode], Tuple[WhereNode, WhereNode]]: ...