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,15 +1,13 @@
from datetime import date, datetime
from decimal import Decimal
from itertools import chain
from typing import (Any, Callable, Dict, Iterator, List, Optional, Set, Tuple,
Type, Union)
from typing import Any, Callable, Dict, Iterator, List, Optional, Set, Tuple, Type, Union
from uuid import UUID
from django.db.backends.sqlite3.base import DatabaseWrapper
from django.db.backends.utils import CursorWrapper
from django.db.models.base import Model
from django.db.models.expressions import (BaseExpression, Col, Expression,
OrderBy, RawSQL, SQLiteNumericMixin)
from django.db.models.expressions import BaseExpression, Col, Expression, OrderBy, RawSQL, SQLiteNumericMixin
from django.db.models.fields import DateTimeCheckMixin, Field
from django.db.models.functions.text import Lower
from django.db.models.options import Options
@@ -18,7 +16,6 @@ from django.utils.datastructures import ImmutableList
FORCE: Any
class SQLCompiler:
query: Any = ...
connection: Any = ...
@@ -28,144 +25,69 @@ class SQLCompiler:
annotation_col_map: Any = ...
klass_info: Any = ...
ordering_parts: Any = ...
def __init__(
self,
query: Union[Query, RawQuery],
connection: DatabaseWrapper,
using: Optional[str],
) -> None: ...
def __init__(self, query: Union[Query, RawQuery], connection: DatabaseWrapper, using: Optional[str]) -> None: ...
col_count: Any = ...
def setup_query(self) -> None: ...
has_extra_select: Any = ...
def pre_sql_setup(
self
self
) -> Tuple[
List[
Tuple[OrderBy, Tuple[str, Union[List[Any], Tuple[str, str]]], None]
],
List[Tuple[OrderBy, Tuple[str, Union[List[Any], Tuple[str, str]]], None]],
List[Tuple[OrderBy, Tuple[str, List[Union[int, str]], bool]]],
List[Tuple[str, List[float]]],
]: ...
def get_group_by(
self,
select: List[
Tuple[
Union[BaseExpression, SQLiteNumericMixin],
Tuple[str, List[float]],
Optional[str],
]
],
order_by: List[Tuple[OrderBy, Tuple[str, List[Union[int, str]], bool]]],
self,
select: List[Tuple[Union[BaseExpression, SQLiteNumericMixin], Tuple[str, List[float]], Optional[str]]],
order_by: List[Tuple[OrderBy, Tuple[str, List[Union[int, str]], bool]]],
) -> List[Tuple[str, List[float]]]: ...
def collapse_group_by(
self,
expressions: List[Expression],
having: Union[List[Expression], Tuple],
) -> List[Expression]: ...
def collapse_group_by(self, expressions: List[Expression], having: Union[List[Expression], Tuple]) -> List[Expression]: ...
def get_select(
self
self
) -> Tuple[
List[
Tuple[
Union[Expression, SQLiteNumericMixin],
Tuple[str, List[Union[int, str]]],
Optional[str],
]
],
Optional[
Dict[str, Any]
],
List[Tuple[Union[Expression, SQLiteNumericMixin], Tuple[str, List[Union[int, str]]], Optional[str]]],
Optional[Dict[str, Any]],
Dict[str, int],
]: ...
def get_order_by(
self
) -> List[Tuple[OrderBy, Tuple[str, List[Any], bool]]]: ...
def get_order_by(self) -> List[Tuple[OrderBy, Tuple[str, List[Any], bool]]]: ...
def get_extra_select(
self,
order_by: List[Tuple[OrderBy, Tuple[str, List[Any], bool]]],
select: List[
Tuple[
Union[Expression, SQLiteNumericMixin],
Tuple[str, List[float]],
Optional[str],
]
],
self,
order_by: List[Tuple[OrderBy, Tuple[str, List[Any], bool]]],
select: List[Tuple[Union[Expression, SQLiteNumericMixin], Tuple[str, List[float]], Optional[str]]],
) -> List[Tuple[OrderBy, Tuple[str, List[Any]], None]]: ...
def quote_name_unless_alias(self, name: str) -> str: ...
def compile(
self, node: Any, select_format: Any = ...
) -> Tuple[str, Union[List[Optional[int]], Tuple[int, int]]]: ...
def get_combinator_sql(
self, combinator: str, all: bool
) -> Tuple[List[str], Union[List[int], List[str]]]: ...
def as_sql(
self, with_limits: bool = ..., with_col_aliases: bool = ...
) -> Any: ...
def compile(self, node: Any, select_format: Any = ...) -> Tuple[str, Union[List[Optional[int]], Tuple[int, int]]]: ...
def get_combinator_sql(self, combinator: str, all: bool) -> Tuple[List[str], Union[List[int], List[str]]]: ...
def as_sql(self, with_limits: bool = ..., with_col_aliases: bool = ...) -> Any: ...
def get_default_columns(
self,
start_alias: Optional[str] = ...,
opts: Optional[Options] = ...,
from_parent: Optional[Type[Model]] = ...,
self, start_alias: Optional[str] = ..., opts: Optional[Options] = ..., from_parent: Optional[Type[Model]] = ...
) -> List[Col]: ...
def get_distinct(self) -> Tuple[List[Any], List[Any]]: ...
def find_ordering_name(
self,
name: str,
opts: Options,
alias: Optional[str] = ...,
default_order: str = ...,
already_seen: Optional[
Set[Tuple[Optional[Tuple[Tuple[str, str]]], Tuple[Tuple[str, str]]]]
] = ...,
self,
name: str,
opts: Options,
alias: Optional[str] = ...,
default_order: str = ...,
already_seen: Optional[Set[Tuple[Optional[Tuple[Tuple[str, str]]], Tuple[Tuple[str, str]]]]] = ...,
) -> List[Tuple[OrderBy, bool]]: ...
def get_from_clause(self) -> Tuple[List[str], List[Union[int, str]]]: ...
def get_related_selections(
self,
select: List[Tuple[Expression, Optional[str]]],
opts: Optional[Options] = ...,
root_alias: Optional[str] = ...,
cur_depth: int = ...,
requested: Optional[
Union[Dict[str, Dict[str, Dict[str, Dict[Any, Any]]]], bool]
] = ...,
restricted: Optional[bool] = ...,
self,
select: List[Tuple[Expression, Optional[str]]],
opts: Optional[Options] = ...,
root_alias: Optional[str] = ...,
cur_depth: int = ...,
requested: Optional[Union[Dict[str, Dict[str, Dict[str, Dict[Any, Any]]]], bool]] = ...,
restricted: Optional[bool] = ...,
) -> List[Dict[str, Any]]: ...
def get_select_for_update_of_arguments(self): ...
def deferred_to_columns(self) -> Dict[Type[Model], Set[str]]: ...
def get_converters(
self, expressions: Union[List[RawSQL], List[SQLiteNumericMixin]]
) -> Dict[
int, Tuple[List[Callable], Union[Expression, SQLiteNumericMixin]]
]: ...
self, expressions: Union[List[RawSQL], List[SQLiteNumericMixin]]
) -> Dict[int, Tuple[List[Callable], Union[Expression, SQLiteNumericMixin]]]: ...
def apply_converters(
self,
rows: chain,
converters: Dict[
int, Tuple[List[Callable], Union[Expression, SQLiteNumericMixin]]
],
self, rows: chain, converters: Dict[int, Tuple[List[Callable], Union[Expression, SQLiteNumericMixin]]]
) -> Iterator[
Union[
List[Optional[Union[bytes, datetime, int, str]]],
@@ -173,82 +95,47 @@ class SQLCompiler:
List[Optional[Union[datetime, float, str, UUID]]],
]
]: ...
def results_iter(
self,
results: Optional[
Union[Iterator[Any], List[List[Tuple[Union[int, str]]]]]
] = ...,
tuple_expected: bool = ...,
chunked_fetch: bool = ...,
chunk_size: int = ...,
self,
results: Optional[Union[Iterator[Any], List[List[Tuple[Union[int, str]]]]]] = ...,
tuple_expected: bool = ...,
chunked_fetch: bool = ...,
chunk_size: int = ...,
) -> Union[Iterator[Any], chain, map]: ...
def has_results(self) -> bool: ...
def execute_sql(
self,
result_type: str = ...,
chunked_fetch: bool = ...,
chunk_size: int = ...,
self, result_type: str = ..., chunked_fetch: bool = ..., chunk_size: int = ...
) -> Optional[Union[Iterator[Any], CursorWrapper]]: ...
def as_subquery_condition(
self, alias: str, columns: List[str], compiler: SQLCompiler
) -> Tuple[str, Tuple]: ...
def as_subquery_condition(self, alias: str, columns: List[str], compiler: SQLCompiler) -> Tuple[str, Tuple]: ...
def explain_query(self) -> Iterator[str]: ...
class SQLInsertCompiler(SQLCompiler):
return_id: bool = ...
def field_as_sql(
self, field: Optional[Field], val: Optional[Union[Lower, float, str]]
self, field: Optional[Field], val: Optional[Union[Lower, float, str]]
) -> Tuple[str, Union[List[int], List[str]]]: ...
def prepare_value(
self, field: Field, value: Any
) -> Optional[Union[Lower, float, str]]: ...
def prepare_value(self, field: Field, value: Any) -> Optional[Union[Lower, float, str]]: ...
def pre_save_val(self, field: Field, obj: Model) -> Any: ...
def assemble_as_sql(
self,
fields: Union[
List[None], List[DateTimeCheckMixin], List[Field], ImmutableList
],
value_rows: Union[
List[List[Optional[Union[Lower, int]]]], List[List[Union[int, str]]]
],
self,
fields: Union[List[None], List[DateTimeCheckMixin], List[Field], ImmutableList],
value_rows: Union[List[List[Optional[Union[Lower, int]]]], List[List[Union[int, str]]]],
) -> Tuple[Tuple[Tuple[str]], List[List[Optional[Union[int, str]]]]]: ...
def as_sql(self) -> List[Tuple[str, Tuple[Union[float, str]]]]: ...
def execute_sql(self, return_id: Optional[bool] = ...) -> Any: ...
class SQLDeleteCompiler(SQLCompiler):
def as_sql(self) -> Tuple[str, Tuple]: ...
class SQLUpdateCompiler(SQLCompiler):
def as_sql(self) -> Tuple[str, Tuple]: ...
def execute_sql(self, result_type: str) -> int: ...
def pre_sql_setup(self) -> None: ...
class SQLAggregateCompiler(SQLCompiler):
col_count: Any = ...
def as_sql(self) -> Tuple[str, Tuple]: ...
def cursor_iter(
cursor: CursorWrapper,
sentinel: List[Any],
col_count: Optional[int],
itersize: int,
cursor: CursorWrapper, sentinel: List[Any], col_count: Optional[int], itersize: int
) -> Iterator[List[Tuple[Union[date, int]]]]: ...

View File

@@ -6,15 +6,10 @@ from django.db.models.fields.mixins import FieldCacheMixin
from django.db.models.query_utils import FilteredRelation, PathInfo
from django.db.models.sql.compiler import SQLCompiler
class MultiJoin(Exception):
level: int = ...
names_with_path: List[
Tuple[str, List[django.db.models.query_utils.PathInfo]]
] = ...
def __init__(
self, names_pos: int, path_with_names: List[Tuple[str, List[PathInfo]]]
) -> None: ...
names_with_path: List[Tuple[str, List[django.db.models.query_utils.PathInfo]]] = ...
def __init__(self, names_pos: int, path_with_names: List[Tuple[str, List[PathInfo]]]) -> None: ...
class Empty: ...
@@ -26,9 +21,7 @@ class Join:
join_cols: Tuple = ...
join_field: django.db.models.fields.mixins.FieldCacheMixin = ...
nullable: bool = ...
filtered_relation: Optional[
django.db.models.query_utils.FilteredRelation
] = ...
filtered_relation: Optional[django.db.models.query_utils.FilteredRelation] = ...
def __init__(
self,
table_name: str,
@@ -39,15 +32,9 @@ class Join:
nullable: bool,
filtered_relation: Optional[FilteredRelation] = ...,
) -> None: ...
def as_sql(
self, compiler: SQLCompiler, connection: DatabaseWrapper
) -> Tuple[str, List[Union[int, str]]]: ...
def relabeled_clone(
self, change_map: Union[Dict[str, str], OrderedDict]
) -> Join: ...
def equals(
self, other: Union[BaseTable, Join], with_filtered_relation: bool
) -> bool: ...
def as_sql(self, compiler: SQLCompiler, connection: DatabaseWrapper) -> Tuple[str, List[Union[int, str]]]: ...
def relabeled_clone(self, change_map: Union[Dict[str, str], OrderedDict]) -> Join: ...
def equals(self, other: Union[BaseTable, Join], with_filtered_relation: bool) -> bool: ...
def __eq__(self, other: Union[BaseTable, Join]) -> bool: ...
def demote(self) -> Join: ...
def promote(self) -> Join: ...
@@ -59,8 +46,6 @@ class BaseTable:
table_name: str = ...
table_alias: Optional[str] = ...
def __init__(self, table_name: str, alias: Optional[str]) -> None: ...
def as_sql(
self, compiler: SQLCompiler, connection: DatabaseWrapper
) -> Tuple[str, List[Any]]: ...
def as_sql(self, compiler: SQLCompiler, connection: DatabaseWrapper) -> Tuple[str, List[Any]]: ...
def relabeled_clone(self, change_map: OrderedDict) -> BaseTable: ...
def equals(self, other: Join, with_filtered_relation: bool) -> bool: ...

View File

@@ -1,21 +1,17 @@
from collections import OrderedDict, namedtuple
from datetime import datetime
from decimal import Decimal
from typing import (Any, Callable, Dict, Iterator, List, Optional, Set, Tuple,
Type, Union)
from typing import Any, Callable, Dict, Iterator, List, Optional, Set, Tuple, Type, Union
from uuid import UUID
from django.db.backends.sqlite3.base import DatabaseWrapper
from django.db.models.base import Model, ModelState
from django.db.models.expressions import (Combinable, Expression,
SQLiteNumericMixin)
from django.db.models.expressions import Combinable, Expression, SQLiteNumericMixin
from django.db.models.fields import Field, TextField
from django.db.models.fields.mixins import FieldCacheMixin
from django.db.models.fields.related_lookups import MultiColSource
from django.db.models.fields.reverse_related import (ForeignObjectRel,
ManyToOneRel)
from django.db.models.lookups import (FieldGetDbPrepValueMixin,
IntegerLessThan, Lookup, Transform)
from django.db.models.fields.reverse_related import ForeignObjectRel, ManyToOneRel
from django.db.models.lookups import FieldGetDbPrepValueMixin, IntegerLessThan, Lookup, Transform
from django.db.models.options import Options
from django.db.models.query import QuerySet
from django.db.models.query_utils import FilteredRelation, PathInfo, Q
@@ -23,22 +19,12 @@ from django.db.models.sql.compiler import SQLCompiler
from django.db.models.sql.datastructures import BaseTable, Join
from django.db.models.sql.where import WhereNode
JoinInfo = namedtuple(
"JoinInfo",
["final_field", "targets", "opts", "joins", "path", "transform_function"],
)
JoinInfo = namedtuple("JoinInfo", ["final_field", "targets", "opts", "joins", "path", "transform_function"])
class RawQuery:
high_mark: None
low_mark: int
params: Union[
Dict[str, str],
List[datetime.datetime],
List[decimal.Decimal],
List[str],
Set[str],
Tuple,
] = ...
params: Union[Dict[str, str], List[datetime.datetime], List[decimal.Decimal], List[str], Set[str], Tuple] = ...
sql: str = ...
using: str = ...
cursor: Optional[django.db.backends.utils.CursorWrapper] = ...
@@ -48,16 +34,7 @@ class RawQuery:
self,
sql: str,
using: str,
params: Optional[
Union[
Dict[str, str],
List[datetime],
List[Decimal],
List[str],
Set[str],
Tuple[int],
]
] = ...,
params: Optional[Union[Dict[str, str], List[datetime], List[Decimal], List[str], Set[str], Tuple[int]]] = ...,
) -> None: ...
def chain(self, using: str) -> RawQuery: ...
def clone(self, using: str) -> RawQuery: ...
@@ -69,16 +46,9 @@ class RawQuery:
class Query:
base_table: str
related_ids: None
related_updates: Dict[
Type[django.db.models.base.Model],
List[Tuple[django.db.models.fields.Field, None, Union[int, str]]],
]
related_updates: Dict[Type[django.db.models.base.Model], List[Tuple[django.db.models.fields.Field, None, Union[int, str]]]]
values: List[
Tuple[
django.db.models.fields.Field,
Optional[Type[django.db.models.base.Model]],
django.db.models.aggregates.Max,
]
Tuple[django.db.models.fields.Field, Optional[Type[django.db.models.base.Model]], django.db.models.aggregates.Max]
]
alias_prefix: str = ...
subq_aliases: frozenset = ...
@@ -105,19 +75,7 @@ class Query:
select_for_update_nowait: bool = ...
select_for_update_skip_locked: bool = ...
select_for_update_of: Tuple = ...
select_related: Union[
Dict[
str,
Dict[
str,
Dict[
str,
Dict[str, Dict[str, Dict[str, Dict[str, Dict[Any, Any]]]]],
],
],
],
bool,
] = ...
select_related: Union[Dict[str, Dict[str, Dict[str, Dict[str, Dict[str, Dict[str, Dict[str, Dict[Any, Any]]]]]]]], bool] = ...
max_depth: int = ...
values_select: Tuple = ...
annotation_select_mask: Optional[Set[str]] = ...
@@ -131,9 +89,7 @@ class Query:
explain_query: bool = ...
explain_format: Optional[str] = ...
explain_options: Dict[str, int] = ...
def __init__(
self, model: Optional[Type[Model]], where: Type[WhereNode] = ...
) -> None: ...
def __init__(self, model: Optional[Type[Model]], where: Type[WhereNode] = ...) -> None: ...
@property
def extra(self) -> OrderedDict: ...
@property
@@ -147,109 +103,53 @@ class Query:
memo: Dict[
int,
Union[
Dict[str, Union[ModelState, int, str]],
List[Union[Dict[str, Union[bool, str]], ModelState]],
Model,
ModelState,
Dict[str, Union[ModelState, int, str]], List[Union[Dict[str, Union[bool, str]], ModelState]], Model, ModelState
],
],
) -> Query: ...
def get_compiler(
self,
using: Optional[str] = ...,
connection: Optional[DatabaseWrapper] = ...,
) -> SQLCompiler: ...
def get_compiler(self, using: Optional[str] = ..., connection: Optional[DatabaseWrapper] = ...) -> SQLCompiler: ...
def get_meta(self) -> Options: ...
def clone(self) -> Query: ...
def chain(self, klass: Optional[Type[Query]] = ...) -> Query: ...
def relabeled_clone(
self, change_map: Union[Dict[Any, Any], OrderedDict]
) -> Query: ...
def relabeled_clone(self, change_map: Union[Dict[Any, Any], OrderedDict]) -> Query: ...
def rewrite_cols(
self,
annotation: Union[Expression, FieldGetDbPrepValueMixin, WhereNode],
col_cnt: int,
self, annotation: Union[Expression, FieldGetDbPrepValueMixin, WhereNode], col_cnt: int
) -> Tuple[Union[Expression, IntegerLessThan], int]: ...
def get_aggregation(
self,
using: str,
added_aggregate_names: Union[Dict[str, SQLiteNumericMixin], List[str]],
self, using: str, added_aggregate_names: Union[Dict[str, SQLiteNumericMixin], List[str]]
) -> Dict[str, Optional[Union[datetime, Decimal, float]]]: ...
def get_count(self, using: str) -> int: ...
def has_filters(self) -> WhereNode: ...
def has_results(self, using: str) -> bool: ...
def explain(
self, using: str, format: Optional[str] = ..., **options: Any
) -> str: ...
def explain(self, using: str, format: Optional[str] = ..., **options: Any) -> str: ...
def combine(self, rhs: Query, connector: str) -> None: ...
def deferred_to_data(
self, target: Dict[Any, Any], callback: Callable
) -> None: ...
def deferred_to_data(self, target: Dict[Any, Any], callback: Callable) -> None: ...
def table_alias(
self,
table_name: str,
create: bool = ...,
filtered_relation: Optional[FilteredRelation] = ...,
self, table_name: str, create: bool = ..., filtered_relation: Optional[FilteredRelation] = ...
) -> Tuple[str, bool]: ...
def ref_alias(self, alias: str) -> None: ...
def unref_alias(self, alias: str, amount: int = ...) -> None: ...
def promote_joins(self, aliases: Set[str]) -> None: ...
def demote_joins(self, aliases: Set[str]) -> None: ...
def reset_refcounts(self, to_counts: Dict[str, int]) -> None: ...
def change_aliases(
self, change_map: Union[Dict[Any, Any], OrderedDict]
) -> None: ...
def change_aliases(self, change_map: Union[Dict[Any, Any], OrderedDict]) -> None: ...
def bump_prefix(self, outer_query: Query) -> None: ...
def get_initial_alias(self) -> str: ...
def count_active_tables(self) -> int: ...
def join(
self,
join: Union[BaseTable, Join],
reuse: Optional[Set[str]] = ...,
reuse_with_filtered_relation: bool = ...,
self, join: Union[BaseTable, Join], reuse: Optional[Set[str]] = ..., reuse_with_filtered_relation: bool = ...
) -> str: ...
def join_parent_model(
self,
opts: Options,
model: Optional[Type[Model]],
alias: str,
seen: Dict[Optional[Type[Model]], str],
self, opts: Options, model: Optional[Type[Model]], alias: str, seen: Dict[Optional[Type[Model]], str]
) -> str: ...
def add_annotation(
self, annotation: Combinable, alias: str, is_summary: bool = ...
) -> None: ...
def resolve_expression(
self, query: Query, *args: Any, **kwargs: Any
) -> Query: ...
def as_sql(
self, compiler: SQLCompiler, connection: DatabaseWrapper
) -> Tuple[str, Tuple]: ...
def resolve_lookup_value(
self, value: Any, can_reuse: Optional[Set[str]], allow_joins: bool
) -> Any: ...
def solve_lookup_type(
self, lookup: str
) -> Union[
Tuple[List[str], List[str], bool], Tuple[List[str], Tuple, Expression]
]: ...
def check_query_object_type(
self,
value: Union[Model, int, str, UUID],
opts: Options,
field: FieldCacheMixin,
) -> None: ...
def check_related_objects(
self,
field: Union[Field, reverse_related.ForeignObjectRel],
value: Any,
opts: Options,
) -> None: ...
def build_lookup(
self,
lookups: List[str],
lhs: Union[Expression, TextField, MultiColSource],
rhs: Any,
) -> Lookup: ...
def add_annotation(self, annotation: Combinable, alias: str, is_summary: bool = ...) -> None: ...
def resolve_expression(self, query: Query, *args: Any, **kwargs: Any) -> Query: ...
def as_sql(self, compiler: SQLCompiler, connection: DatabaseWrapper) -> Tuple[str, Tuple]: ...
def resolve_lookup_value(self, value: Any, can_reuse: Optional[Set[str]], allow_joins: bool) -> Any: ...
def solve_lookup_type(self, lookup: str) -> Union[Tuple[List[str], List[str], bool], Tuple[List[str], Tuple, Expression]]: ...
def check_query_object_type(self, value: Union[Model, int, str, UUID], opts: Options, field: FieldCacheMixin) -> None: ...
def check_related_objects(self, field: Union[Field, reverse_related.ForeignObjectRel], value: Any, opts: Options) -> None: ...
def build_lookup(self, lookups: List[str], lhs: Union[Expression, TextField, MultiColSource], rhs: Any) -> Lookup: ...
def try_transform(self, lhs: Expression, name: str) -> Transform: ...
def build_filter(
self,
@@ -261,32 +161,15 @@ class Query:
split_subq: bool = ...,
reuse_with_filtered_relation: bool = ...,
) -> Tuple[WhereNode, List[Any]]: ...
def add_filter(
self, filter_clause: Tuple[str, Union[List[int], List[str]]]
) -> None: ...
def add_filter(self, filter_clause: Tuple[str, Union[List[int], List[str]]]) -> None: ...
def add_q(self, q_object: Q) -> None: ...
def build_filtered_relation_q(
self,
q_object: Q,
reuse: Set[str],
branch_negated: bool = ...,
current_negated: bool = ...,
self, q_object: Q, reuse: Set[str], branch_negated: bool = ..., current_negated: bool = ...
) -> WhereNode: ...
def add_filtered_relation(
self, filtered_relation: FilteredRelation, alias: str
) -> None: ...
def add_filtered_relation(self, filtered_relation: FilteredRelation, alias: str) -> None: ...
def names_to_path(
self,
names: List[str],
opts: Options,
allow_many: bool = ...,
fail_on_missing: bool = ...,
) -> Tuple[
List[PathInfo],
Union[Field, reverse_related.ForeignObjectRel],
Tuple[Field],
List[str],
]: ...
self, names: List[str], opts: Options, allow_many: bool = ..., fail_on_missing: bool = ...
) -> Tuple[List[PathInfo], Union[Field, reverse_related.ForeignObjectRel], Tuple[Field], List[str]]: ...
def setup_joins(
self,
names: List[str],
@@ -300,11 +183,7 @@ class Query:
self, targets: Tuple[Field], joins: List[str], path: List[PathInfo]
) -> Tuple[Tuple[Field], str, List[str]]: ...
def resolve_ref(
self,
name: str,
allow_joins: bool = ...,
reuse: Optional[Set[str]] = ...,
summarize: bool = ...,
self, name: str, allow_joins: bool = ..., reuse: Optional[Set[str]] = ..., summarize: bool = ...
) -> Expression: ...
def split_exclude(
self,
@@ -316,9 +195,7 @@ class Query:
def is_empty(self) -> bool: ...
high_mark: Optional[int] = ...
low_mark: int = ...
def set_limits(
self, low: Optional[int] = ..., high: Optional[int] = ...
) -> None: ...
def set_limits(self, low: Optional[int] = ..., high: Optional[int] = ...) -> None: ...
def clear_limits(self) -> None: ...
def has_limit_one(self) -> bool: ...
def can_filter(self) -> bool: ...
@@ -326,11 +203,7 @@ class Query:
def clear_select_fields(self) -> None: ...
def set_select(self, cols: List[Expression]) -> None: ...
def add_distinct_fields(self, *field_names: Any) -> None: ...
def add_fields(
self,
field_names: Union[Iterator[Any], List[str]],
allow_m2m: bool = ...,
) -> None: ...
def add_fields(self, field_names: Union[Iterator[Any], List[str]], allow_m2m: bool = ...) -> None: ...
def add_ordering(self, *ordering: Any) -> None: ...
def clear_ordering(self, force_empty: bool) -> None: ...
def set_group_by(self) -> None: ...
@@ -354,9 +227,7 @@ class Query:
model: Type[Model],
fields: Union[Set[Field], Set[reverse_related.ManyToOneRel]],
) -> None: ...
def set_annotation_mask(
self, names: Optional[Union[List[str], Set[str], Tuple]]
) -> None: ...
def set_annotation_mask(self, names: Optional[Union[List[str], Set[str], Tuple]]) -> None: ...
def append_annotation_mask(self, names: List[str]) -> None: ...
def set_extra_mask(self, names: Union[List[str], Tuple]) -> None: ...
def set_values(self, fields: Union[List[str], Tuple]) -> None: ...
@@ -364,9 +235,7 @@ class Query:
def annotation_select(self) -> Union[Dict[Any, Any], OrderedDict]: ...
@property
def extra_select(self) -> Union[Dict[Any, Any], OrderedDict]: ...
def trim_start(
self, names_with_path: List[Tuple[str, List[PathInfo]]]
) -> Tuple[str, bool]: ...
def trim_start(self, names_with_path: List[Tuple[str, List[PathInfo]]]) -> Tuple[str, bool]: ...
def is_nullable(self, field: Field) -> bool: ...
class JoinPromoter:
@@ -375,10 +244,6 @@ class JoinPromoter:
effective_connector: str = ...
num_children: int = ...
votes: collections.Counter = ...
def __init__(
self, connector: str, num_children: int, negated: bool
) -> None: ...
def add_votes(
self, votes: Union[Iterator[Any], List[Any], Set[str], Tuple]
) -> None: ...
def __init__(self, connector: str, num_children: int, negated: bool) -> None: ...
def add_votes(self, votes: Union[Iterator[Any], List[Any], Set[str], Tuple]) -> None: ...
def update_join_types(self, query: Query) -> Set[str]: ...

View File

@@ -8,7 +8,6 @@ from django.db.models.sql.query import Query
from django.db.models.sql.where import WhereNode
from django.utils.datastructures import ImmutableList
class DeleteQuery(Query):
alias_refcount: Dict[str, int]
annotation_select_mask: None
@@ -49,15 +48,10 @@ class DeleteQuery(Query):
values_select: Tuple
where_class: Type[django.db.models.sql.where.WhereNode]
compiler: str = ...
alias_map: Union[
Dict[str, django.db.models.sql.datastructures.BaseTable],
collections.OrderedDict,
] = ...
alias_map: Union[Dict[str, django.db.models.sql.datastructures.BaseTable], collections.OrderedDict] = ...
where: django.db.models.sql.where.WhereNode = ...
def do_query(self, table: str, where: WhereNode, using: str) -> int: ...
def delete_batch(
self, pk_list: Union[List[int], List[str]], using: str
) -> int: ...
def delete_batch(self, pk_list: Union[List[int], List[str]], using: str) -> int: ...
def delete_qs(self, query: QuerySet, using: str) -> int: ...
class UpdateQuery(Query):
@@ -88,10 +82,7 @@ class UpdateQuery(Query):
model: Type[django.db.models.base.Model]
order_by: Tuple
related_ids: Optional[List[int]]
related_updates: Dict[
Type[django.db.models.base.Model],
List[Tuple[django.db.models.fields.Field, None, Union[int, str]]],
]
related_updates: Dict[Type[django.db.models.base.Model], List[Tuple[django.db.models.fields.Field, None, Union[int, str]]]]
select: Tuple
select_for_update: bool
select_for_update_nowait: bool
@@ -116,16 +107,10 @@ class UpdateQuery(Query):
def __init__(self, *args: Any, **kwargs: Any) -> None: ...
def clone(self) -> UpdateQuery: ...
where: django.db.models.sql.where.WhereNode = ...
def update_batch(
self, pk_list: List[int], values: Dict[str, Optional[int]], using: str
) -> None: ...
def update_batch(self, pk_list: List[int], values: Dict[str, Optional[int]], using: str) -> None: ...
def add_update_values(self, values: Dict[str, Any]) -> None: ...
def add_update_fields(
self, values_seq: List[Tuple[Field, Optional[Type[Model]], Case]]
) -> None: ...
def add_related_update(
self, model: Type[Model], field: Field, value: Union[int, str]
) -> None: ...
def add_update_fields(self, values_seq: List[Tuple[Field, Optional[Type[Model]], Case]]) -> None: ...
def add_related_update(self, model: Type[Model], field: Field, value: Union[int, str]) -> None: ...
def get_related_updates(self) -> List[UpdateQuery]: ...
class InsertQuery(Query):
@@ -177,10 +162,7 @@ class InsertQuery(Query):
def __init__(self, *args: Any, **kwargs: Any) -> None: ...
raw: bool = ...
def insert_values(
self,
fields: Union[List[DateTimeCheckMixin], List[Field], ImmutableList],
objs: List[Model],
raw: bool = ...,
self, fields: Union[List[DateTimeCheckMixin], List[Field], ImmutableList], objs: List[Model], raw: bool = ...
) -> None: ...
class AggregateQuery(Query):

View File

@@ -20,32 +20,17 @@ class WhereNode(tree.Node):
default: Any = ...
resolved: bool = ...
conditional: bool = ...
def split_having(
self, negated: bool = ...
) -> Tuple[Optional[WhereNode], Optional[WhereNode]]: ...
def split_having(self, negated: bool = ...) -> Tuple[Optional[WhereNode], Optional[WhereNode]]: ...
def as_sql(
self,
compiler: SQLCompiler,
connection: Union[DefaultConnectionProxy, DatabaseWrapper],
self, compiler: SQLCompiler, connection: Union[DefaultConnectionProxy, DatabaseWrapper]
) -> Tuple[str, List[Union[int, str]]]: ...
def get_group_by_cols(self) -> List[Expression]: ...
def get_source_expressions(self) -> List[FieldGetDbPrepValueMixin]: ...
children: List[
Union[
django.db.models.lookups.BuiltinLookup,
django.db.models.sql.where.WhereNode,
]
] = ...
def set_source_expressions(
self, children: List[FieldGetDbPrepValueMixin]
) -> None: ...
def relabel_aliases(
self, change_map: Union[Dict[Optional[str], str], OrderedDict]
) -> None: ...
children: List[Union[django.db.models.lookups.BuiltinLookup, django.db.models.sql.where.WhereNode]] = ...
def set_source_expressions(self, children: List[FieldGetDbPrepValueMixin]) -> None: ...
def relabel_aliases(self, change_map: Union[Dict[Optional[str], str], OrderedDict]) -> None: ...
def clone(self) -> WhereNode: ...
def relabeled_clone(
self, change_map: Union[Dict[Optional[str], str], OrderedDict]
) -> WhereNode: ...
def relabeled_clone(self, change_map: Union[Dict[Optional[str], str], OrderedDict]) -> WhereNode: ...
def contains_aggregate(self) -> bool: ...
def contains_over_clause(self) -> bool: ...
@property
@@ -54,19 +39,13 @@ class WhereNode(tree.Node):
class NothingNode:
contains_aggregate: bool = ...
def as_sql(
self,
compiler: SQLCompiler = ...,
connection: Union[DefaultConnectionProxy, DatabaseWrapper] = ...,
) -> Any: ...
def as_sql(self, compiler: SQLCompiler = ..., connection: Union[DefaultConnectionProxy, DatabaseWrapper] = ...) -> Any: ...
class ExtraWhere:
contains_aggregate: bool = ...
sqls: List[str] = ...
params: Optional[Union[List[int], List[str]]] = ...
def __init__(
self, sqls: List[str], params: Optional[Union[List[int], List[str]]]
) -> None: ...
def __init__(self, sqls: List[str], params: Optional[Union[List[int], List[str]]]) -> None: ...
def as_sql(
self, compiler: SQLCompiler = ..., connection: DatabaseWrapper = ...
) -> Tuple[str, Union[List[int], List[str]]]: ...
@@ -77,13 +56,5 @@ class SubqueryConstraint:
columns: List[str] = ...
targets: List[str] = ...
query_object: django.db.models.sql.query.Query = ...
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]: ...
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]: ...