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,12 +1,8 @@
# noinspection PyUnresolvedReferences
from django.core.exceptions import (
ObjectDoesNotExist as ObjectDoesNotExist
)
from django.core.exceptions import ObjectDoesNotExist as ObjectDoesNotExist
# noinspection PyUnresolvedReferences
from django.db.models import (
signals as signals
)
from django.db.models import signals as signals
# noinspection PyUnresolvedReferences
from django.db.models.aggregates import * # NOQA
@@ -48,10 +44,7 @@ from django.db.models.expressions import (
from django.db.models.fields import * # NOQA
# noinspection PyUnresolvedReferences
from django.db.models.fields.files import (
FileField as FileField,
ImageField as ImageField
)
from django.db.models.fields.files import FileField as FileField, ImageField as ImageField
# noinspection PyUnresolvedReferences
from django.db.models.fields.proxy import OrderWrt
@@ -59,10 +52,7 @@ from django.db.models.fields.proxy import OrderWrt
# noinspection PyUnresolvedReferences
from django.db.models.indexes import * # NOQA
from django.db.models.lookups import (
Lookup as Lookup,
Transform as Transform
)
from django.db.models.lookups import Lookup as Lookup, Transform as Transform
# noinspection PyUnresolvedReferences
from django.db.models.manager import Manager as Manager
@@ -90,6 +80,5 @@ from django.db.models.fields.related import ( # isort:skip
ManyToManyField as ManyToManyField,
ManyToOneRel as ManyToOneRel,
ManyToManyRel as ManyToManyRel,
OneToOneRel as OneToOneRel
OneToOneRel as OneToOneRel,
)

View File

@@ -9,37 +9,24 @@ from django.db.models.sql.compiler import SQLCompiler
from django.db.models.sql.query import Query
from django.db.models.sql.where import WhereNode
class Aggregate(Func):
contains_aggregate: bool = ...
name: Any = ...
filter_template: str = ...
window_compatible: bool = ...
filter: Any = ...
def __init__(
self, *args: Any, filter: Optional[Any] = ..., **kwargs: Any
) -> None: ...
def __init__(self, *args: Any, filter: Optional[Any] = ..., **kwargs: Any) -> None: ...
def get_source_fields(self) -> Union[List[None], List[Field]]: ...
def get_source_expressions(self) -> List[Union[Combinable, WhereNode]]: ...
def set_source_expressions(
self, exprs: List[Union[Expression, WhereNode]]
) -> None: ...
def set_source_expressions(self, exprs: List[Union[Expression, WhereNode]]) -> None: ...
def resolve_expression(
self,
query: Query = ...,
allow_joins: bool = ...,
reuse: None = ...,
summarize: bool = ...,
for_save: bool = ...,
self, query: Query = ..., allow_joins: bool = ..., reuse: None = ..., summarize: bool = ..., for_save: bool = ...
) -> Aggregate: ...
@property
def default_alias(self) -> str: ...
def get_group_by_cols(self) -> List[Any]: ...
def as_sql(
self,
compiler: SQLCompiler,
connection: DatabaseWrapper,
**extra_context: Any
self, compiler: SQLCompiler, connection: DatabaseWrapper, **extra_context: Any
) -> Tuple[str, Union[List[Decimal], List[int]]]: ...
class Avg(Aggregate):
@@ -55,19 +42,8 @@ class Count(Aggregate):
name: str = ...
template: str = ...
output_field: Any = ...
def __init__(
self,
expression: str,
distinct: bool = ...,
filter: Optional[Q] = ...,
**extra: Any
) -> None: ...
def convert_value(
self,
value: Optional[int],
expression: Count,
connection: DatabaseWrapper,
) -> int: ...
def __init__(self, expression: str, distinct: bool = ..., filter: Optional[Q] = ..., **extra: Any) -> None: ...
def convert_value(self, value: Optional[int], expression: Count, connection: DatabaseWrapper) -> int: ...
class Max(Aggregate):
filter: None
@@ -84,9 +60,7 @@ class StdDev(Aggregate):
name: str = ...
output_field: Any = ...
function: str = ...
def __init__(
self, expression: str, sample: bool = ..., **extra: Any
) -> None: ...
def __init__(self, expression: str, sample: bool = ..., **extra: Any) -> None: ...
class Sum(Aggregate):
filter: None
@@ -100,6 +74,4 @@ class Variance(Aggregate):
name: str = ...
output_field: Any = ...
function: str = ...
def __init__(
self, expression: str, sample: bool = ..., **extra: Any
) -> None: ...
def __init__(self, expression: str, sample: bool = ..., **extra: Any) -> None: ...

View File

@@ -7,32 +7,20 @@ from django.core.checks.messages import Warning
from django.core.exceptions import ValidationError, ObjectDoesNotExist
from django.db.models.fields.related import ForeignKey
class Deferred: ...
DEFERRED: Any
def subclass_exception(
name: str,
bases: Tuple[Type[Exception]],
module: str,
attached_to: Type[Model],
) -> Type[Exception]: ...
def subclass_exception(name: str, bases: Tuple[Type[Exception]], module: str, attached_to: Type[Model]) -> Type[Exception]: ...
class ModelBase(type):
def __new__(
cls: Type[ModelBase],
name: str,
bases: Tuple[Type[Model]],
attrs: Dict[str, Any],
**kwargs: Any
cls: Type[ModelBase], name: str, bases: Tuple[Type[Model]], attrs: Dict[str, Any], **kwargs: Any
) -> Type[Model]: ...
def add_to_class(cls, name: str, value: Any) -> None: ...
class ModelStateFieldsCacheDescriptor:
def __get__(
self, instance: ModelState, cls: Type[ModelState] = ...
) -> Dict[Any, Any]: ...
def __get__(self, instance: ModelState, cls: Type[ModelState] = ...) -> Dict[Any, Any]: ...
class ModelState:
db: Any = ...
@@ -42,7 +30,6 @@ class ModelState:
class Model:
class DoesNotExist(ObjectDoesNotExist):
pass
def __init__(self, *args: Any, **kwargs: Any) -> None: ...
@classmethod
def from_db(
@@ -62,9 +49,7 @@ class Model:
def __reduce__(self): ...
pk: Any = ...
def get_deferred_fields(self) -> Set[str]: ...
def refresh_from_db(
self, using: None = ..., fields: Optional[List[str]] = ...
) -> None: ...
def refresh_from_db(self, using: None = ..., fields: Optional[List[str]] = ...) -> None: ...
def serializable_value(self, field_name: str) -> Union[int, str]: ...
def save(
self,
@@ -81,30 +66,18 @@ class Model:
using: str = ...,
update_fields: Optional[frozenset] = ...,
) -> None: ...
def delete(
self, using: None = ..., keep_parents: bool = ...
) -> Tuple[int, Dict[str, int]]: ...
def delete(self, using: None = ..., keep_parents: bool = ...) -> Tuple[int, Dict[str, int]]: ...
def prepare_database_save(self, field: ForeignKey) -> UUID: ...
def clean(self) -> None: ...
def validate_unique(self, exclude: List[str] = ...) -> None: ...
def date_error_message(
self, lookup_type: Any, field_name: Any, unique_for: Any
): ...
def unique_error_message(
self, model_class: Type[Model], unique_check: Tuple[str, str]
) -> ValidationError: ...
def full_clean(
self, exclude: Optional[List[str]] = ..., validate_unique: bool = ...
) -> None: ...
def date_error_message(self, lookup_type: Any, field_name: Any, unique_for: Any): ...
def unique_error_message(self, model_class: Type[Model], unique_check: Tuple[str, str]) -> ValidationError: ...
def full_clean(self, exclude: Optional[List[str]] = ..., validate_unique: bool = ...) -> None: ...
def clean_fields(self, exclude: List[str] = ...) -> None: ...
@classmethod
def check(cls, **kwargs: Any) -> List[Warning]: ...
def method_set_order(
self, ordered_obj: Any, id_list: Any, using: Optional[Any] = ...
) -> None: ...
def method_set_order(self, ordered_obj: Any, id_list: Any, using: Optional[Any] = ...) -> None: ...
def method_get_order(self, ordered_obj: Any): ...
def make_foreign_order_accessors(
model: Type[Model], related_model: Type[Model]
) -> None: ...
def make_foreign_order_accessors(model: Type[Model], related_model: Type[Model]) -> None: ...
def model_unpickle(model_id: Any): ...

View File

@@ -1,5 +1,4 @@
from typing import (Any, Callable, Dict, Iterator, List, Optional, Tuple, Type,
Union)
from typing import Any, Callable, Dict, Iterator, List, Optional, Tuple, Type, Union
from django.db import IntegrityError
from django.db.models.base import Model
@@ -8,29 +7,16 @@ from django.db.models.fields.reverse_related import ManyToOneRel
from django.db.models.options import Options
from django.db.models.query import QuerySet
class ProtectedError(IntegrityError):
protected_objects: django.db.models.query.QuerySet = ...
def __init__(
self, msg: str, protected_objects: Union[List[Model], QuerySet]
) -> None: ...
def __init__(self, msg: str, protected_objects: Union[List[Model], QuerySet]) -> None: ...
def CASCADE(
collector: Collector, field: ForeignKey, sub_objs: QuerySet, using: str
) -> None: ...
def PROTECT(
collector: Collector, field: ForeignKey, sub_objs: QuerySet, using: str
) -> Any: ...
def CASCADE(collector: Collector, field: ForeignKey, sub_objs: QuerySet, using: str) -> None: ...
def PROTECT(collector: Collector, field: ForeignKey, sub_objs: QuerySet, using: str) -> Any: ...
def SET(value: Callable) -> Callable: ...
def SET_NULL(
collector: Collector, field: ForeignKey, sub_objs: QuerySet, using: str
) -> None: ...
def SET_DEFAULT(
collector: Collector, field: ForeignKey, sub_objs: QuerySet, using: str
) -> None: ...
def DO_NOTHING(
collector: Any, field: Any, sub_objs: Any, using: Any
) -> None: ...
def SET_NULL(collector: Collector, field: ForeignKey, sub_objs: QuerySet, using: str) -> None: ...
def SET_DEFAULT(collector: Collector, field: ForeignKey, sub_objs: QuerySet, using: str) -> None: ...
def DO_NOTHING(collector: Any, field: Any, sub_objs: Any, using: Any) -> None: ...
def get_candidate_relations_to_delete(opts: Options) -> Iterator[Any]: ...
class Collector:
@@ -47,17 +33,9 @@ class Collector:
nullable: bool = ...,
reverse_dependency: bool = ...,
) -> List[Model]: ...
def add_field_update(
self, field: ForeignKey, value: Optional[int], objs: QuerySet
) -> None: ...
def can_fast_delete(
self,
objs: Union[List[Model], QuerySet],
from_field: Optional[ForeignKey] = ...,
) -> bool: ...
def get_del_batches(
self, objs: List[Model], field: ForeignKey
) -> List[List[Model]]: ...
def add_field_update(self, field: ForeignKey, value: Optional[int], objs: QuerySet) -> None: ...
def can_fast_delete(self, objs: Union[List[Model], QuerySet], from_field: Optional[ForeignKey] = ...) -> bool: ...
def get_del_batches(self, objs: List[Model], field: ForeignKey) -> List[List[Model]]: ...
def collect(
self,
objs: Union[List[Model], QuerySet],
@@ -68,9 +46,7 @@ class Collector:
reverse_dependency: bool = ...,
keep_parents: bool = ...,
) -> None: ...
def related_objects(
self, related: ManyToOneRel, objs: List[Model]
) -> QuerySet: ...
def related_objects(self, related: ManyToOneRel, objs: List[Model]) -> QuerySet: ...
def instances_with_model(self) -> Iterator[Tuple[Type[Model], Model]]: ...
def sort(self) -> None: ...
def delete(self) -> Tuple[int, Dict[str, int]]: ...

View File

@@ -1,15 +1,13 @@
from collections import OrderedDict
from datetime import datetime, timedelta
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 django.db.backends.sqlite3.base import DatabaseWrapper
from django.db.models.aggregates import Aggregate, Count
from django.db.models.fields import Field, DurationField
from django.db.models.fields.reverse_related import ForeignObjectRel
from django.db.models.functions.window import DenseRank
from django.db.models.lookups import (FieldGetDbPrepValueMixin, Lookup,
Transform)
from django.db.models.lookups import FieldGetDbPrepValueMixin, Lookup, Transform
from django.db.models.query import QuerySet
from django.db.models.query_utils import Q
from django.db.models.sql.compiler import SQLCompiler
@@ -17,14 +15,8 @@ from django.db.models.sql.query import Query
from django.db.models.sql.where import WhereNode
from django.utils.tree import Node
class SQLiteNumericMixin:
def as_sqlite(
self,
compiler: SQLCompiler,
connection: DatabaseWrapper,
**extra_context: Any
) -> Tuple[str, List[float]]: ...
def as_sqlite(self, compiler: SQLCompiler, connection: DatabaseWrapper, **extra_context: Any) -> Tuple[str, List[float]]: ...
class Combinable:
ADD: str = ...
@@ -38,15 +30,9 @@ class Combinable:
BITLEFTSHIFT: str = ...
BITRIGHTSHIFT: str = ...
def __neg__(self) -> CombinedExpression: ...
def __add__(
self, other: Optional[Union[timedelta, Combinable, float, str]]
) -> CombinedExpression: ...
def __sub__(
self, other: Union[timedelta, Combinable, float]
) -> CombinedExpression: ...
def __mul__(
self, other: Union[timedelta, Combinable, float]
) -> CombinedExpression: ...
def __add__(self, other: Optional[Union[timedelta, Combinable, float, str]]) -> CombinedExpression: ...
def __sub__(self, other: Union[timedelta, Combinable, float]) -> CombinedExpression: ...
def __mul__(self, other: Union[timedelta, Combinable, float]) -> CombinedExpression: ...
def __truediv__(self, other: Union[Count, float]) -> CombinedExpression: ...
def __mod__(self, other: int) -> CombinedExpression: ...
def __pow__(self, other: float) -> CombinedExpression: ...
@@ -56,9 +42,7 @@ class Combinable:
def bitrightshift(self, other: int) -> CombinedExpression: ...
def __or__(self, other: Combinable) -> Any: ...
def bitor(self, other: int) -> CombinedExpression: ...
def __radd__(
self, other: Optional[Union[datetime, float]]
) -> CombinedExpression: ...
def __radd__(self, other: Optional[Union[datetime, float]]) -> CombinedExpression: ...
def __rsub__(self, other: float) -> CombinedExpression: ...
def __rmul__(self, other: float) -> CombinedExpression: ...
def __rtruediv__(self, other: float) -> CombinedExpression: ...
@@ -72,12 +56,8 @@ class BaseExpression:
filterable: bool = ...
window_compatible: bool = ...
output_field: Any = ...
def __init__(
self, output_field: Optional[Union[Field, ForeignObjectRel, str]] = ...
) -> None: ...
def get_db_converters(
self, connection: DatabaseWrapper
) -> List[Callable]: ...
def __init__(self, output_field: Optional[Union[Field, ForeignObjectRel, str]] = ...) -> None: ...
def get_db_converters(self, connection: DatabaseWrapper) -> List[Callable]: ...
def get_source_expressions(self) -> List[Any]: ...
def set_source_expressions(self, exprs: List[Any]) -> None: ...
def as_sql(self, compiler: Any, connection: Any) -> None: ...
@@ -96,13 +76,9 @@ class BaseExpression:
def field(self) -> Field: ...
def output_field(self) -> Field: ...
def convert_value(self) -> Callable: ...
def get_lookup(
self, lookup: str
) -> Optional[Type[Union[FieldGetDbPrepValueMixin, Lookup]]]: ...
def get_lookup(self, lookup: str) -> Optional[Type[Union[FieldGetDbPrepValueMixin, Lookup]]]: ...
def get_transform(self, name: str) -> Optional[Type[Transform]]: ...
def relabeled_clone(
self, change_map: Union[Dict[Optional[str], str], OrderedDict]
) -> Expression: ...
def relabeled_clone(self, change_map: Union[Dict[Optional[str], str], OrderedDict]) -> Expression: ...
def copy(self) -> BaseExpression: ...
def get_group_by_cols(self) -> List[Expression]: ...
def get_source_fields(self) -> List[Optional[Field]]: ...
@@ -119,20 +95,10 @@ class CombinedExpression(SQLiteNumericMixin, Expression):
connector: Any = ...
lhs: Any = ...
rhs: Any = ...
def __init__(
self,
lhs: Combinable,
connector: str,
rhs: Combinable,
output_field: None = ...,
) -> None: ...
def get_source_expressions(
self
) -> Union[List[Combinable], List[SQLiteNumericMixin]]: ...
def __init__(self, lhs: Combinable, connector: str, rhs: Combinable, output_field: None = ...) -> None: ...
def get_source_expressions(self) -> Union[List[Combinable], List[SQLiteNumericMixin]]: ...
def set_source_expressions(self, exprs: List[Combinable]) -> None: ...
def as_sql(
self, compiler: SQLCompiler, connection: DatabaseWrapper
) -> Tuple[str, List[float]]: ...
def as_sql(self, compiler: SQLCompiler, connection: DatabaseWrapper) -> Tuple[str, List[float]]: ...
def resolve_expression(
self,
query: Query = ...,
@@ -144,21 +110,14 @@ class CombinedExpression(SQLiteNumericMixin, Expression):
class DurationExpression(CombinedExpression):
def compile(
self,
side: Expression,
compiler: SQLCompiler,
connection: DatabaseWrapper,
) -> Tuple[str, Union[List[datetime], List[int]]]: ...
def as_sql(
self, compiler: SQLCompiler, connection: DatabaseWrapper
self, side: Expression, compiler: SQLCompiler, connection: DatabaseWrapper
) -> Tuple[str, Union[List[datetime], List[int]]]: ...
def as_sql(self, compiler: SQLCompiler, connection: DatabaseWrapper) -> Tuple[str, Union[List[datetime], List[int]]]: ...
class TemporalSubtraction(CombinedExpression):
output_field: Any = ...
def __init__(self, lhs: Col, rhs: Expression) -> None: ...
def as_sql(
self, compiler: SQLCompiler, connection: DatabaseWrapper
) -> Tuple[str, List[str]]: ...
def as_sql(self, compiler: SQLCompiler, connection: DatabaseWrapper) -> Tuple[str, List[str]]: ...
class F(Combinable):
filterable: bool = ...
@@ -200,9 +159,7 @@ class Func(SQLiteNumericMixin, Expression):
arity: Any = ...
source_expressions: Any = ...
extra: Any = ...
def __init__(
self, *expressions: Any, output_field: Optional[Any] = ..., **extra: Any
) -> None: ...
def __init__(self, *expressions: Any, output_field: Optional[Any] = ..., **extra: Any) -> None: ...
def get_source_expressions(self) -> List[Combinable]: ...
def set_source_expressions(self, exprs: List[Expression]) -> None: ...
def resolve_expression(
@@ -226,12 +183,8 @@ class Func(SQLiteNumericMixin, Expression):
class Value(Expression):
value: Any = ...
def __init__(
self, value: Any, output_field: Optional[Field] = ...
) -> None: ...
def as_sql(
self, compiler: SQLCompiler, connection: DatabaseWrapper
) -> Tuple[str, List[float]]: ...
def __init__(self, value: Any, output_field: Optional[Field] = ...) -> None: ...
def as_sql(self, compiler: SQLCompiler, connection: DatabaseWrapper) -> Tuple[str, List[float]]: ...
def resolve_expression(
self,
query: Query = ...,
@@ -244,30 +197,19 @@ class Value(Expression):
class DurationValue(Value):
output_field: DurationField
def as_sql(
self, compiler: SQLCompiler, connection: DatabaseWrapper
) -> Tuple[str, List[Any]]: ...
def as_sql(self, compiler: SQLCompiler, connection: DatabaseWrapper) -> Tuple[str, List[Any]]: ...
class RawSQL(Expression):
output_field: Field
params: List[Any]
sql: str
def __init__(
self,
sql: str,
params: Union[List[int], List[str], Tuple],
output_field: None = ...,
) -> None: ...
def as_sql(
self, compiler: SQLCompiler, connection: DatabaseWrapper
) -> Tuple[str, List[str]]: ...
def __init__(self, sql: str, params: Union[List[int], List[str], Tuple], output_field: None = ...) -> None: ...
def as_sql(self, compiler: SQLCompiler, connection: DatabaseWrapper) -> Tuple[str, List[str]]: ...
def get_group_by_cols(self) -> List[RawSQL]: ...
def __hash__(self): ...
class Star(Expression):
def as_sql(
self, compiler: SQLCompiler, connection: DatabaseWrapper
) -> Tuple[str, List[Any]]: ...
def as_sql(self, compiler: SQLCompiler, connection: DatabaseWrapper) -> Tuple[str, List[Any]]: ...
class Random(Expression):
output_field: Any = ...
@@ -276,41 +218,21 @@ class Random(Expression):
class Col(Expression):
output_field: Field
contains_column_references: bool = ...
def __init__(
self,
alias: str,
target: Union[Field, str],
output_field: Optional[Field] = ...,
) -> None: ...
def as_sql(
self, compiler: SQLCompiler, connection: DatabaseWrapper
) -> Tuple[str, List[Any]]: ...
def relabeled_clone(
self, relabels: Union[Dict[str, str], OrderedDict]
) -> Col: ...
def __init__(self, alias: str, target: Union[Field, str], output_field: Optional[Field] = ...) -> None: ...
def as_sql(self, compiler: SQLCompiler, connection: DatabaseWrapper) -> Tuple[str, List[Any]]: ...
def relabeled_clone(self, relabels: Union[Dict[str, str], OrderedDict]) -> Col: ...
def get_group_by_cols(self) -> List[Col]: ...
def get_db_converters(
self, connection: DatabaseWrapper
) -> List[Callable]: ...
def get_db_converters(self, connection: DatabaseWrapper) -> List[Callable]: ...
class Ref(Expression):
def __init__(self, refs: str, source: Expression) -> None: ...
def get_source_expressions(
self
) -> Union[List[Expression], List[SQLiteNumericMixin]]: ...
def get_source_expressions(self) -> Union[List[Expression], List[SQLiteNumericMixin]]: ...
def set_source_expressions(self, exprs: Any) -> None: ...
def resolve_expression(
self,
query: Query = ...,
allow_joins: bool = ...,
reuse: None = ...,
summarize: bool = ...,
for_save: bool = ...,
self, query: Query = ..., allow_joins: bool = ..., reuse: None = ..., summarize: bool = ..., for_save: bool = ...
) -> Ref: ...
def relabeled_clone(self, relabels: Dict[Optional[str], str]) -> Ref: ...
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 get_group_by_cols(self): ...
class ExpressionList(Func):
@@ -319,30 +241,18 @@ class ExpressionList(Func):
class ExpressionWrapper(Expression):
expression: Any = ...
def __init__(
self, expression: Union[CombinedExpression, Q], output_field: Field
) -> None: ...
def set_source_expressions(
self, exprs: Union[List[CombinedExpression], List[WhereNode]]
) -> None: ...
def get_source_expressions(
self
) -> Union[List[CombinedExpression], List[Node]]: ...
def as_sql(
self, compiler: SQLCompiler, connection: DatabaseWrapper
) -> Tuple[str, List[Any]]: ...
def __init__(self, expression: Union[CombinedExpression, Q], output_field: Field) -> None: ...
def set_source_expressions(self, exprs: Union[List[CombinedExpression], List[WhereNode]]) -> None: ...
def get_source_expressions(self) -> Union[List[CombinedExpression], List[Node]]: ...
def as_sql(self, compiler: SQLCompiler, connection: DatabaseWrapper) -> Tuple[str, List[Any]]: ...
class When(Expression):
template: str = ...
condition: Any = ...
result: Any = ...
def __init__(
self, condition: Any = ..., then: Any = ..., **lookups: Any
) -> None: ...
def __init__(self, condition: Any = ..., then: Any = ..., **lookups: Any) -> None: ...
def get_source_expressions(self) -> List[Union[Expression, WhereNode]]: ...
def set_source_expressions(
self, exprs: List[Union[Expression, WhereNode]]
) -> None: ...
def set_source_expressions(self, exprs: List[Union[Expression, WhereNode]]) -> None: ...
def get_source_fields(self) -> Union[List[None], List[Field]]: ...
def resolve_expression(
self,
@@ -353,11 +263,7 @@ class When(Expression):
for_save: bool = ...,
) -> When: ...
def as_sql(
self,
compiler: SQLCompiler,
connection: DatabaseWrapper,
template: None = ...,
**extra_context: Any
self, compiler: SQLCompiler, connection: DatabaseWrapper, template: None = ..., **extra_context: Any
) -> Tuple[str, List[Union[int, str]]]: ...
def get_group_by_cols(self) -> List[Col]: ...
@@ -367,13 +273,7 @@ class Case(Expression):
cases: Any = ...
default: Any = ...
extra: Any = ...
def __init__(
self,
*cases: Any,
default: Optional[Any] = ...,
output_field: Optional[Any] = ...,
**extra: Any
) -> None: ...
def __init__(self, *cases: Any, default: Optional[Any] = ..., output_field: Optional[Any] = ..., **extra: Any) -> None: ...
def get_source_expressions(self) -> List[Expression]: ...
def set_source_expressions(self, exprs: List[Expression]) -> None: ...
def resolve_expression(
@@ -398,12 +298,7 @@ class Subquery(Expression):
template: str = ...
queryset: QuerySet = ...
extra: Dict[Any, Any] = ...
def __init__(
self,
queryset: QuerySet,
output_field: Optional[Field] = ...,
**extra: Any
) -> None: ...
def __init__(self, queryset: QuerySet, output_field: Optional[Field] = ..., **extra: Any) -> None: ...
def copy(self) -> Subquery: ...
def resolve_expression(
self,
@@ -416,38 +311,20 @@ class Subquery(Expression):
def get_source_expressions(self) -> List[Col]: ...
def relabeled_clone(self, change_map: OrderedDict) -> Subquery: ...
def as_sql(
self,
compiler: SQLCompiler,
connection: DatabaseWrapper,
template: None = ...,
**extra_context: Any
self, compiler: SQLCompiler, connection: DatabaseWrapper, template: None = ..., **extra_context: Any
) -> Tuple[str, Tuple]: ...
class Exists(Subquery):
extra: Dict[Any, Any]
template: str = ...
negated: bool = ...
def __init__(
self, *args: Any, negated: bool = ..., **kwargs: Any
) -> None: ...
def __init__(self, *args: Any, negated: bool = ..., **kwargs: Any) -> None: ...
def __invert__(self) -> Exists: ...
def resolve_expression(
self, query: Query = ..., *args: Any, **kwargs: Any
) -> Exists: ...
def resolve_expression(self, query: Query = ..., *args: Any, **kwargs: Any) -> Exists: ...
def as_sql(
self,
compiler: SQLCompiler,
connection: DatabaseWrapper,
template: None = ...,
**extra_context: Any
self, compiler: SQLCompiler, connection: DatabaseWrapper, template: None = ..., **extra_context: Any
) -> Tuple[str, Tuple]: ...
def as_oracle(
self,
compiler: Any,
connection: Any,
template: Optional[Any] = ...,
**extra_context: Any
): ...
def as_oracle(self, compiler: Any, connection: Any, template: Optional[Any] = ..., **extra_context: Any): ...
class OrderBy(BaseExpression):
template: str = ...
@@ -456,24 +333,14 @@ class OrderBy(BaseExpression):
descending: bool = ...
expression: Expression = ...
def __init__(
self,
expression: Combinable,
descending: bool = ...,
nulls_first: bool = ...,
nulls_last: bool = ...,
self, expression: Combinable, descending: bool = ..., nulls_first: bool = ..., nulls_last: bool = ...
) -> None: ...
def set_source_expressions(self, exprs: List[Expression]) -> None: ...
def get_source_expressions(self) -> List[Combinable]: ...
def as_sql(
self,
compiler: SQLCompiler,
connection: DatabaseWrapper,
template: Optional[str] = ...,
**extra_context: Any
) -> Tuple[str, List[Union[int, str]]]: ...
def as_sqlite(
self, compiler: SQLCompiler, connection: DatabaseWrapper
self, compiler: SQLCompiler, connection: DatabaseWrapper, template: Optional[str] = ..., **extra_context: Any
) -> Tuple[str, List[Union[int, str]]]: ...
def as_sqlite(self, compiler: SQLCompiler, connection: DatabaseWrapper) -> Tuple[str, List[Union[int, str]]]: ...
def as_mysql(self, compiler: Any, connection: Any): ...
def get_group_by_cols(self): ...
def reverse_ordering(self) -> OrderBy: ...
@@ -498,16 +365,8 @@ class Window(Expression):
output_field: None = ...,
) -> None: ...
def get_source_expressions(self): ...
def set_source_expressions(
self, exprs: List[Optional[DenseRank]]
) -> None: ...
def as_sql(
self,
compiler: Any,
connection: Any,
function: Optional[Any] = ...,
template: Optional[Any] = ...,
): ...
def set_source_expressions(self, exprs: List[Optional[DenseRank]]) -> None: ...
def as_sql(self, compiler: Any, connection: Any, function: Optional[Any] = ..., template: Optional[Any] = ...): ...
def get_group_by_cols(self) -> List[Any]: ...
class WindowFrame(Expression):
@@ -519,9 +378,7 @@ class WindowFrame(Expression):
def get_source_expressions(self): ...
def as_sql(self, compiler: Any, connection: Any): ...
def get_group_by_cols(self) -> List[Any]: ...
def window_frame_start_end(
self, connection: Any, start: Any, end: Any
) -> None: ...
def window_frame_start_end(self, connection: Any, start: Any, end: Any) -> None: ...
class RowRange(WindowFrame):
end: None

View File

@@ -13,11 +13,9 @@ from django.db.models.fields.reverse_related import ForeignObjectRel
from django.db.models.query import QuerySet
from django.db.models.query_utils import RegisterLookupMixin
from django.db.models.sql.compiler import SQLCompiler, SQLInsertCompiler
from django.forms.fields import (BooleanField, DurationField, EmailField,
Field, FloatField, TypedMultipleChoiceField)
from django.forms.fields import BooleanField, DurationField, EmailField, Field, FloatField, TypedMultipleChoiceField
from django.utils.datastructures import DictWrapper
class Empty: ...
class NOT_PROVIDED: ...
@@ -89,22 +87,12 @@ class Field(RegisterLookupMixin):
error_messages: None = ...,
) -> None: ...
def check(self, **kwargs: Any) -> List[Any]: ...
def get_col(
self,
alias: str,
output_field: Optional[
Union[Field, reverse_related.ForeignObjectRel]
] = ...,
) -> Col: ...
def get_col(self, alias: str, output_field: Optional[Union[Field, reverse_related.ForeignObjectRel]] = ...) -> Col: ...
def cached_col(self) -> Col: ...
def select_format(
self, compiler: SQLCompiler, sql: str, params: List[Union[int, str]]
) -> Tuple[str, List[Union[int, str]]]: ...
def deconstruct(
self
) -> Tuple[
Optional[str], str, List[Any], Dict[str, List[Tuple[int, str]]]
]: ...
def deconstruct(self) -> Tuple[Optional[str], str, List[Any], Dict[str, List[Tuple[int, str]]]]: ...
def clone(self) -> Field: ...
def __eq__(self, other: Field) -> bool: ...
def __lt__(self, other: Field) -> bool: ...
@@ -118,20 +106,14 @@ class Field(RegisterLookupMixin):
def run_validators(self, value: Any) -> None: ...
def validate(self, value: Any, model_instance: Optional[Model]) -> None: ...
def clean(self, value: Any, model_instance: Optional[Model]) -> Any: ...
def db_type_parameters(
self, connection: DatabaseWrapper
) -> DictWrapper: ...
def db_type_parameters(self, connection: DatabaseWrapper) -> DictWrapper: ...
def db_check(self, connection: DatabaseWrapper) -> None: ...
def db_type(self, connection: DatabaseWrapper) -> str: ...
def rel_db_type(self, connection: DatabaseWrapper) -> str: ...
def cast_db_type(self, connection: Any): ...
def db_parameters(
self, connection: DatabaseWrapper
) -> Dict[str, Optional[str]]: ...
def db_parameters(self, connection: DatabaseWrapper) -> Dict[str, Optional[str]]: ...
def db_type_suffix(self, connection: DatabaseWrapper) -> Optional[str]: ...
def get_db_converters(
self, connection: DatabaseWrapper
) -> List[Callable]: ...
def get_db_converters(self, connection: DatabaseWrapper) -> List[Callable]: ...
@property
def unique(self) -> bool: ...
@property
@@ -139,9 +121,7 @@ class Field(RegisterLookupMixin):
concrete: Any = ...
def set_attributes_from_name(self, name: str) -> None: ...
model: Any = ...
def contribute_to_class(
self, cls: Type[Model], name: str, private_only: bool = ...
) -> None: ...
def contribute_to_class(self, cls: Type[Model], name: str, private_only: bool = ...) -> None: ...
def get_filter_kwargs_for_object(self, obj: Any): ...
def get_attname(self) -> str: ...
def get_attname_column(self) -> Tuple[str, str]: ...
@@ -151,9 +131,7 @@ class Field(RegisterLookupMixin):
def get_db_prep_value(
self, value: Any, connection: DatabaseWrapper, prepared: bool = ...
) -> Optional[Union[bytes, float, str]]: ...
def get_db_prep_save(
self, value: Any, connection: DatabaseWrapper
) -> Optional[Union[float, str]]: ...
def get_db_prep_save(self, value: Any, connection: DatabaseWrapper) -> Optional[Union[float, str]]: ...
def has_default(self) -> bool: ...
def get_default(self) -> Any: ...
def get_choices(
@@ -161,16 +139,10 @@ class Field(RegisterLookupMixin):
include_blank: bool = ...,
blank_choice: List[Tuple[str, str]] = ...,
limit_choices_to: Optional[Dict[str, QuerySet]] = ...,
) -> List[
Tuple[
Union[int, str], Union[Tuple[Tuple[str, str], Tuple[str, str]], str]
]
]: ...
) -> List[Tuple[Union[int, str], Union[Tuple[Tuple[str, str], Tuple[str, str]], str]]]: ...
def value_to_string(self, obj: Model) -> str: ...
flatchoices: Any = ...
def save_form_data(
self, instance: Model, data: Optional[Union[date, Model, float, str]]
) -> None: ...
def save_form_data(self, instance: Model, data: Optional[Union[date, Model, float, str]]) -> None: ...
def formfield(
self,
form_class: Optional[Type[Field]] = ...,
@@ -185,25 +157,14 @@ class AutoField(Field):
default_error_messages: Any = ...
def __init__(self, *args: Any, **kwargs: Any) -> None: ...
def check(self, **kwargs: Any) -> List[Any]: ...
def deconstruct(
self
) -> Tuple[Optional[str], str, List[Any], Dict[str, Union[bool, str]]]: ...
def deconstruct(self) -> Tuple[Optional[str], str, List[Any], Dict[str, Union[bool, str]]]: ...
def get_internal_type(self) -> str: ...
def to_python(self, value: Union[int, str]) -> int: ...
def rel_db_type(self, connection: DatabaseWrapper) -> str: ...
def validate(self, value: Any, model_instance: Any) -> None: ...
def get_db_prep_value(
self,
value: Union[int, str],
connection: DatabaseWrapper,
prepared: bool = ...,
) -> Union[int, str]: ...
def get_prep_value(
self, value: Optional[Union[int, str]]
) -> Optional[int]: ...
def contribute_to_class(
self, cls: Type[Model], name: str, **kwargs: Any
) -> None: ...
def get_db_prep_value(self, value: Union[int, str], connection: DatabaseWrapper, prepared: bool = ...) -> Union[int, str]: ...
def get_prep_value(self, value: Optional[Union[int, str]]) -> Optional[int]: ...
def contribute_to_class(self, cls: Type[Model], name: str, **kwargs: Any) -> None: ...
def formfield(self, **kwargs: Any) -> None: ...
def __get__(self, instance, owner) -> int: ...
@@ -218,9 +179,7 @@ class BooleanField(Field):
description: Any = ...
def get_internal_type(self) -> str: ...
def to_python(self, value: Optional[Union[bool, str]]) -> bool: ...
def get_prep_value(
self, value: Optional[Union[bool, str]]
) -> Optional[bool]: ...
def get_prep_value(self, value: Optional[Union[bool, str]]) -> Optional[bool]: ...
def formfield(self, **kwargs: Any) -> BooleanField: ...
class CharField(Field):
@@ -229,12 +188,8 @@ class CharField(Field):
def check(self, **kwargs: Any) -> List[Any]: ...
def cast_db_type(self, connection: Any): ...
def get_internal_type(self) -> str: ...
def to_python(
self, value: Optional[Union[Model, int, str]]
) -> Optional[str]: ...
def get_prep_value(
self, value: Optional[Union[Model, str]]
) -> Optional[str]: ...
def to_python(self, value: Optional[Union[Model, int, str]]) -> Optional[str]: ...
def get_prep_value(self, value: Optional[Union[Model, str]]) -> Optional[str]: ...
def formfield(self, **kwargs: Any) -> Field: ...
def __get__(self, instance, owner) -> str: ...
@@ -251,37 +206,15 @@ class DateField(DateTimeCheckMixin, Field):
default_error_messages: Any = ...
description: Any = ...
def __init__(
self,
verbose_name: Optional[str] = ...,
name: None = ...,
auto_now: bool = ...,
auto_now_add: bool = ...,
**kwargs: Any
self, verbose_name: Optional[str] = ..., name: None = ..., auto_now: bool = ..., auto_now_add: bool = ..., **kwargs: Any
) -> None: ...
def deconstruct(
self
) -> Tuple[
Optional[str], str, List[Any], Dict[str, Union[Callable, int, str]]
]: ...
def deconstruct(self) -> Tuple[Optional[str], str, List[Any], Dict[str, Union[Callable, int, str]]]: ...
def get_internal_type(self) -> str: ...
def to_python(
self, value: Optional[Union[date, str]]
) -> Optional[date]: ...
def pre_save(
self, model_instance: Model, add: bool
) -> Optional[Union[date, CombinedExpression]]: ...
def contribute_to_class(
self, cls: Type[Model], name: str, **kwargs: Any
) -> None: ...
def get_prep_value(
self, value: Optional[Union[date, str]]
) -> Optional[date]: ...
def get_db_prep_value(
self,
value: Optional[date],
connection: DatabaseWrapper,
prepared: bool = ...,
) -> Optional[str]: ...
def to_python(self, value: Optional[Union[date, str]]) -> Optional[date]: ...
def pre_save(self, model_instance: Model, add: bool) -> Optional[Union[date, CombinedExpression]]: ...
def contribute_to_class(self, cls: Type[Model], name: str, **kwargs: Any) -> None: ...
def get_prep_value(self, value: Optional[Union[date, str]]) -> Optional[date]: ...
def get_db_prep_value(self, value: Optional[date], connection: DatabaseWrapper, prepared: bool = ...) -> Optional[str]: ...
def value_to_string(self, obj: Model) -> str: ...
def formfield(self, **kwargs: Any) -> Field: ...
@@ -290,20 +223,11 @@ class DateTimeField(DateField):
default_error_messages: Any = ...
description: Any = ...
def get_internal_type(self) -> str: ...
def to_python(
self, value: Optional[Union[datetime, str]]
) -> Optional[datetime]: ...
def pre_save(
self, model_instance: Model, add: bool
) -> Optional[Union[datetime, CombinedExpression]]: ...
def get_prep_value(
self, value: Optional[datetime]
) -> Optional[datetime]: ...
def to_python(self, value: Optional[Union[datetime, str]]) -> Optional[datetime]: ...
def pre_save(self, model_instance: Model, add: bool) -> Optional[Union[datetime, CombinedExpression]]: ...
def get_prep_value(self, value: Optional[datetime]) -> Optional[datetime]: ...
def get_db_prep_value(
self,
value: Optional[datetime],
connection: DatabaseWrapper,
prepared: bool = ...,
self, value: Optional[datetime], connection: DatabaseWrapper, prepared: bool = ...
) -> Optional[str]: ...
def value_to_string(self, obj: Model) -> str: ...
def formfield(self, **kwargs: Any) -> Field: ...
@@ -323,14 +247,10 @@ class DecimalField(Field):
def check(self, **kwargs: Any) -> List[Any]: ...
def validators(self) -> List[DecimalValidator]: ...
def context(self) -> Context: ...
def deconstruct(
self
) -> Tuple[Optional[str], str, List[Any], Dict[str, int]]: ...
def deconstruct(self) -> Tuple[Optional[str], str, List[Any], Dict[str, int]]: ...
def get_internal_type(self) -> str: ...
def to_python(self, value: Optional[str]) -> Optional[Decimal]: ...
def get_db_prep_save(
self, value: Optional[str], connection: DatabaseWrapper
) -> Optional[str]: ...
def get_db_prep_save(self, value: Optional[str], connection: DatabaseWrapper) -> Optional[str]: ...
def get_prep_value(self, value: None) -> None: ...
def formfield(self, **kwargs: Any): ...
@@ -340,9 +260,7 @@ class DurationField(Field):
description: Any = ...
def get_internal_type(self) -> str: ...
def to_python(self, value: str) -> timedelta: ...
def get_db_prep_value(
self, value: Any, connection: Any, prepared: bool = ...
): ...
def get_db_prep_value(self, value: Any, connection: Any, prepared: bool = ...): ...
def get_db_converters(self, connection: Any): ...
def value_to_string(self, obj: Model) -> str: ...
def formfield(self, **kwargs: Any) -> DurationField: ...
@@ -351,9 +269,7 @@ class EmailField(CharField):
default_validators: Any = ...
description: Any = ...
def __init__(self, *args: Any, **kwargs: Any) -> None: ...
def deconstruct(
self
) -> Tuple[Optional[str], str, List[Any], Dict[str, int]]: ...
def deconstruct(self) -> Tuple[Optional[str], str, List[Any], Dict[str, int]]: ...
def formfield(self, **kwargs: Any) -> EmailField: ...
class FilePathField(Field):
@@ -389,9 +305,7 @@ class IntegerField(Field):
description: Any = ...
def check(self, **kwargs: Any) -> List[Any]: ...
def validators(self) -> List[Any]: ...
def get_prep_value(
self, value: Optional[Union[int, str]]
) -> Optional[int]: ...
def get_prep_value(self, value: Optional[Union[int, str]]) -> Optional[int]: ...
def get_internal_type(self) -> str: ...
def to_python(self, value: Union[int, str]) -> int: ...
@@ -429,12 +343,7 @@ class GenericIPAddressField(Field):
def deconstruct(self): ...
def get_internal_type(self): ...
def to_python(self, value: Union[Callable, int, str]) -> str: ...
def get_db_prep_value(
self,
value: Optional[str],
connection: DatabaseWrapper,
prepared: bool = ...,
) -> Optional[str]: ...
def get_db_prep_value(self, value: Optional[str], connection: DatabaseWrapper, prepared: bool = ...) -> Optional[str]: ...
def get_prep_value(self, value: Optional[str]) -> Optional[str]: ...
class NullBooleanField(BooleanField):
@@ -460,16 +369,9 @@ class SlugField(CharField):
description: Any = ...
allow_unicode: Any = ...
def __init__(
self,
*args: Any,
max_length: int = ...,
db_index: bool = ...,
allow_unicode: bool = ...,
**kwargs: Any
self, *args: Any, max_length: int = ..., db_index: bool = ..., allow_unicode: bool = ..., **kwargs: Any
) -> None: ...
def deconstruct(
self
) -> Tuple[Optional[str], str, List[Any], Dict[str, int]]: ...
def deconstruct(self) -> Tuple[Optional[str], str, List[Any], Dict[str, int]]: ...
def get_internal_type(self) -> str: ...
class SmallIntegerField(IntegerField):
@@ -479,75 +381,41 @@ class SmallIntegerField(IntegerField):
class TextField(Field):
description: Any = ...
def get_internal_type(self) -> str: ...
def to_python(
self, value: Optional[Union[Dict[Any, Any], int, str]]
) -> Optional[str]: ...
def get_prep_value(
self, value: Optional[Union[Dict[Any, Any], int, str]]
) -> Optional[str]: ...
def to_python(self, value: Optional[Union[Dict[Any, Any], int, str]]) -> Optional[str]: ...
def get_prep_value(self, value: Optional[Union[Dict[Any, Any], int, str]]) -> Optional[str]: ...
class TimeField(DateTimeCheckMixin, Field):
empty_strings_allowed: bool = ...
default_error_messages: Any = ...
description: Any = ...
def __init__(
self,
verbose_name: None = ...,
name: None = ...,
auto_now: bool = ...,
auto_now_add: bool = ...,
**kwargs: Any
self, verbose_name: None = ..., name: None = ..., auto_now: bool = ..., auto_now_add: bool = ..., **kwargs: Any
) -> None: ...
def deconstruct(
self
) -> Tuple[Optional[str], str, List[Any], Dict[Any, Any]]: ...
def deconstruct(self) -> Tuple[Optional[str], str, List[Any], Dict[Any, Any]]: ...
def get_internal_type(self) -> str: ...
def to_python(
self, value: Optional[Union[datetime, str]]
) -> Optional[time]: ...
def pre_save(
self, model_instance: Model, add: bool
) -> Optional[datetime]: ...
def to_python(self, value: Optional[Union[datetime, str]]) -> Optional[time]: ...
def pre_save(self, model_instance: Model, add: bool) -> Optional[datetime]: ...
def get_prep_value(self, value: Optional[datetime]) -> Optional[time]: ...
def get_db_prep_value(
self,
value: Optional[datetime],
connection: DatabaseWrapper,
prepared: bool = ...,
self, value: Optional[datetime], connection: DatabaseWrapper, prepared: bool = ...
) -> Optional[str]: ...
def value_to_string(self, obj: Any): ...
class URLField(CharField):
default_validators: Any = ...
description: Any = ...
def __init__(
self, verbose_name: None = ..., name: None = ..., **kwargs: Any
) -> None: ...
def deconstruct(
self
) -> Tuple[Optional[str], str, List[Any], Dict[str, int]]: ...
def __init__(self, verbose_name: None = ..., name: None = ..., **kwargs: Any) -> None: ...
def deconstruct(self) -> Tuple[Optional[str], str, List[Any], Dict[str, int]]: ...
class BinaryField(Field):
description: Any = ...
empty_values: Any = ...
def __init__(self, *args: Any, **kwargs: Any) -> None: ...
def deconstruct(
self
) -> Tuple[Optional[str], str, List[Any], Dict[str, bool]]: ...
def deconstruct(self) -> Tuple[Optional[str], str, List[Any], Dict[str, bool]]: ...
def get_internal_type(self) -> str: ...
def get_placeholder(
self,
value: None,
compiler: SQLInsertCompiler,
connection: DatabaseWrapper,
) -> str: ...
def get_placeholder(self, value: None, compiler: SQLInsertCompiler, connection: DatabaseWrapper) -> str: ...
def get_default(self) -> bytes: ...
def get_db_prep_value(
self,
value: Optional[bytes],
connection: DatabaseWrapper,
prepared: bool = ...,
) -> None: ...
def get_db_prep_value(self, value: Optional[bytes], connection: DatabaseWrapper, prepared: bool = ...) -> None: ...
def value_to_string(self, obj: Any): ...
def to_python(self, value: Any): ...
@@ -556,18 +424,9 @@ class UUIDField(Field):
description: str = ...
empty_strings_allowed: bool = ...
def __init__(self, verbose_name: None = ..., **kwargs: Any) -> None: ...
def deconstruct(
self
) -> Tuple[
Optional[str], str, List[Any], Dict[str, Union[Callable, bool]]
]: ...
def deconstruct(self) -> Tuple[Optional[str], str, List[Any], Dict[str, Union[Callable, bool]]]: ...
def get_internal_type(self) -> str: ...
def get_db_prep_value(
self,
value: Optional[Union[Dict[Any, Any], List[Any]]],
connection: DatabaseWrapper,
prepared: bool = ...,
self, value: Optional[Union[Dict[Any, Any], List[Any]]], connection: DatabaseWrapper, prepared: bool = ...
) -> None: ...
def to_python(
self, value: Optional[Union[Dict[Any, Any], List[Any], UUID]]
) -> Optional[UUID]: ...
def to_python(self, value: Optional[Union[Dict[Any, Any], List[Any], UUID]]) -> Optional[UUID]: ...

View File

@@ -8,14 +8,11 @@ from django.db.models.base import Model
from django.db.models.fields import Field
from django.forms.fields import FileField, ImageField
class FieldFile(File):
instance: django.db.models.base.Model = ...
field: django.db.models.fields.files.FileField = ...
storage: django.core.files.storage.FileSystemStorage = ...
def __init__(
self, instance: Model, field: FileField, name: Optional[str]
) -> None: ...
def __init__(self, instance: Model, field: FileField, name: Optional[str]) -> None: ...
def __eq__(self, other: Any) -> bool: ...
def __hash__(self): ...
file: Any = ...
@@ -36,12 +33,8 @@ class FieldFile(File):
class FileDescriptor:
field: django.db.models.fields.files.FileField = ...
def __init__(self, field: FileField) -> None: ...
def __get__(
self, instance: Optional[Model], cls: Type[Model] = ...
) -> Union[FieldFile, FileDescriptor]: ...
def __set__(
self, instance: Model, value: Optional[Union[File, str]]
) -> None: ...
def __get__(self, instance: Optional[Model], cls: Type[Model] = ...) -> Union[FieldFile, FileDescriptor]: ...
def __set__(self, instance: Model, value: Optional[Union[File, str]]) -> None: ...
class FileField(Field):
attr_class: Any = ...
@@ -58,21 +51,13 @@ class FileField(Field):
**kwargs: Any
) -> None: ...
def check(self, **kwargs: Any) -> List[Error]: ...
def deconstruct(
self
) -> Tuple[Optional[str], str, List[Any], Dict[str, Union[bool, str]]]: ...
def deconstruct(self) -> Tuple[Optional[str], str, List[Any], Dict[str, Union[bool, str]]]: ...
def get_internal_type(self) -> str: ...
def get_prep_value(self, value: Union[FieldFile, str]) -> str: ...
def pre_save(self, model_instance: Model, add: bool) -> FieldFile: ...
def contribute_to_class(
self, cls: Type[Model], name: str, **kwargs: Any
) -> None: ...
def generate_filename(
self, instance: Optional[Model], filename: str
) -> str: ...
def save_form_data(
self, instance: Model, data: Optional[Union[bool, File, str]]
) -> None: ...
def contribute_to_class(self, cls: Type[Model], name: str, **kwargs: Any) -> None: ...
def generate_filename(self, instance: Optional[Model], filename: str) -> str: ...
def save_form_data(self, instance: Model, data: Optional[Union[bool, File, str]]) -> None: ...
def formfield(self, **kwargs: Any) -> FileField: ...
class ImageFileDescriptor(FileDescriptor):
@@ -99,18 +84,7 @@ class ImageField(FileField):
**kwargs: Any
) -> None: ...
def check(self, **kwargs: Any) -> List[Any]: ...
def deconstruct(
self
) -> Tuple[
Optional[str],
str,
List[Any],
Dict[str, Union[Callable, bool, FileSystemStorage, str]],
]: ...
def contribute_to_class(
self, cls: Type[Model], name: str, **kwargs: Any
) -> None: ...
def update_dimension_fields(
self, instance: Model, force: bool = ..., *args: Any, **kwargs: Any
) -> None: ...
def deconstruct(self) -> Tuple[Optional[str], str, List[Any], Dict[str, Union[Callable, bool, FileSystemStorage, str]]]: ...
def contribute_to_class(self, cls: Type[Model], name: str, **kwargs: Any) -> None: ...
def update_dimension_fields(self, instance: Model, force: bool = ..., *args: Any, **kwargs: Any) -> None: ...
def formfield(self, **kwargs: Any) -> ImageField: ...

View File

@@ -6,11 +6,7 @@ NOT_PROVIDED: Any
class FieldCacheMixin:
def get_cache_name(self) -> None: ...
def get_cached_value(
self, instance: Model, default: Any = ...
) -> Optional[Model]: ...
def get_cached_value(self, instance: Model, default: Any = ...) -> Optional[Model]: ...
def is_cached(self, instance: Model) -> bool: ...
def set_cached_value(
self, instance: Model, value: Optional[Model]
) -> None: ...
def set_cached_value(self, instance: Model, value: Optional[Model]) -> None: ...
def delete_cached_value(self, instance: Model) -> None: ...

View File

@@ -2,6 +2,5 @@ from typing import Any, Optional
from django.db.models import fields
class OrderWrt(fields.IntegerField):
def __init__(self, *args: Any, **kwargs: Any) -> None: ...

View File

@@ -7,9 +7,7 @@ from django.db.models.base import Model
from django.db.models.expressions import Col
from django.db.models.fields import Field
from django.db.models.fields.related_lookups import RelatedIsNull
from django.db.models.fields.reverse_related import (ForeignObjectRel,
ManyToManyRel,
ManyToOneRel, OneToOneRel)
from django.db.models.fields.reverse_related import ForeignObjectRel, ManyToManyRel, ManyToOneRel, OneToOneRel
from django.db.models.lookups import FieldGetDbPrepValueMixin
from django.db.models.query import QuerySet
from django.db.models.query_utils import PathInfo, Q
@@ -19,26 +17,28 @@ from django.forms.models import ModelChoiceField, ModelMultipleChoiceField
from . import Field
from .mixins import FieldCacheMixin
from .related_descriptors import (ForwardManyToOneDescriptor as ForwardManyToOneDescriptor,
ForwardOneToOneDescriptor as ForwardOneToOneDescriptor,
ManyToManyDescriptor as ManyToManyDescriptor,
ReverseManyToOneDescriptor as ReverseManyToOneDescriptor,
ReverseOneToOneDescriptor as ReverseOneToOneDescriptor)
from .related_lookups import (RelatedExact, RelatedGreaterThan,
RelatedGreaterThanOrEqual, RelatedIn,
RelatedIsNull, RelatedLessThan,
RelatedLessThanOrEqual)
from .reverse_related import (ForeignObjectRel, ManyToManyRel, ManyToOneRel,
OneToOneRel)
from .related_descriptors import (
ForwardManyToOneDescriptor as ForwardManyToOneDescriptor,
ForwardOneToOneDescriptor as ForwardOneToOneDescriptor,
ManyToManyDescriptor as ManyToManyDescriptor,
ReverseManyToOneDescriptor as ReverseManyToOneDescriptor,
ReverseOneToOneDescriptor as ReverseOneToOneDescriptor,
)
from .related_lookups import (
RelatedExact,
RelatedGreaterThan,
RelatedGreaterThanOrEqual,
RelatedIn,
RelatedIsNull,
RelatedLessThan,
RelatedLessThanOrEqual,
)
from .reverse_related import ForeignObjectRel, ManyToManyRel, ManyToOneRel, OneToOneRel
RECURSIVE_RELATIONSHIP_CONSTANT: str
def resolve_relation(
scope_model: Type[Model], relation: Union[Type[Model], str]
) -> Union[Type[Model], str]: ...
def lazy_related_operation(
function: Callable, model: Type[Model], *related_models: Any, **kwargs: Any
) -> None: ...
def resolve_relation(scope_model: Type[Model], relation: Union[Type[Model], str]) -> Union[Type[Model], str]: ...
def lazy_related_operation(function: Callable, model: Type[Model], *related_models: Any, **kwargs: Any) -> None: ...
class RelatedField(FieldCacheMixin, Field):
one_to_many: bool = ...
@@ -49,28 +49,16 @@ class RelatedField(FieldCacheMixin, Field):
def check(self, **kwargs: Any) -> List[Error]: ...
def db_type(self, connection: DatabaseWrapper) -> None: ...
opts: Any = ...
def contribute_to_class(
self,
cls: Type[Model],
name: str,
private_only: bool = ...,
**kwargs: Any
) -> None: ...
def deconstruct(
self
) -> Tuple[Optional[str], str, List[Any], Dict[str, str]]: ...
def get_forward_related_filter(
self, obj: Model
) -> Dict[str, Union[int, UUID]]: ...
def contribute_to_class(self, cls: Type[Model], name: str, private_only: bool = ..., **kwargs: Any) -> None: ...
def deconstruct(self) -> Tuple[Optional[str], str, List[Any], Dict[str, str]]: ...
def get_forward_related_filter(self, obj: Model) -> Dict[str, Union[int, UUID]]: ...
def get_reverse_related_filter(self, obj: Model) -> Q: ...
@property
def swappable_setting(self) -> Optional[str]: ...
name: Any = ...
verbose_name: Any = ...
def set_attributes_from_rel(self) -> None: ...
def do_related_class(
self, other: Type[Model], cls: Type[Model]
) -> None: ...
def do_related_class(self, other: Type[Model], cls: Type[Model]) -> None: ...
def get_limit_choices_to(self) -> Dict[str, int]: ...
def formfield(self, **kwargs: Any) -> Field: ...
def related_query_name(self) -> str: ...
@@ -105,14 +93,7 @@ class ForeignObject(RelatedField):
**kwargs: Any
) -> None: ...
def check(self, **kwargs: Any) -> List[Any]: ...
def deconstruct(
self
) -> Tuple[
Optional[str],
str,
List[Any],
Dict[str, Any],
]: ...
def deconstruct(self) -> Tuple[Optional[str], str, List[Any], Dict[str, Any]]: ...
def resolve_related_fields(self) -> List[Tuple[Field, Field]]: ...
@property
def related_fields(self) -> List[Tuple[Field, Field]]: ...
@@ -122,45 +103,21 @@ class ForeignObject(RelatedField):
def local_related_fields(self) -> Tuple[Field]: ...
@property
def foreign_related_fields(self) -> Tuple[Field]: ...
def get_local_related_value(
self, instance: Model
) -> Tuple[Optional[int]]: ...
def get_foreign_related_value(
self, instance: Model
) -> Tuple[Optional[int]]: ...
def get_local_related_value(self, instance: Model) -> Tuple[Optional[int]]: ...
def get_foreign_related_value(self, instance: Model) -> Tuple[Optional[int]]: ...
@staticmethod
def get_instance_value_for_fields(
instance: Model, fields: Tuple[Field]
) -> Tuple[Optional[int]]: ...
def get_instance_value_for_fields(instance: Model, fields: Tuple[Field]) -> Tuple[Optional[int]]: ...
def get_attname_column(self) -> Tuple[str, None]: ...
def get_joining_columns(
self, reverse_join: bool = ...
) -> Tuple[Tuple[str, str]]: ...
def get_joining_columns(self, reverse_join: bool = ...) -> Tuple[Tuple[str, str]]: ...
def get_reverse_joining_columns(self) -> Tuple: ...
def get_extra_descriptor_filter(
self, instance: Model
) -> Dict[Any, Any]: ...
def get_extra_restriction(
self, where_class: Type[WhereNode], alias: str, related_alias: str
) -> None: ...
def get_path_info(
self, filtered_relation: None = ...
) -> List[PathInfo]: ...
def get_extra_descriptor_filter(self, instance: Model) -> Dict[Any, Any]: ...
def get_extra_restriction(self, where_class: Type[WhereNode], alias: str, related_alias: str) -> None: ...
def get_path_info(self, filtered_relation: None = ...) -> List[PathInfo]: ...
def get_reverse_path_info(self, filtered_relation: Optional[Any] = ...): ...
@classmethod
def get_lookups(
cls
) -> Dict[str, Type[Union[RelatedIsNull, FieldGetDbPrepValueMixin]]]: ...
def contribute_to_class(
self,
cls: Type[Model],
name: str,
private_only: bool = ...,
**kwargs: Any
) -> None: ...
def contribute_to_related_class(
self, cls: Type[Model], related: ForeignObjectRel
) -> None: ...
def get_lookups(cls) -> Dict[str, Type[Union[RelatedIsNull, FieldGetDbPrepValueMixin]]]: ...
def contribute_to_class(self, cls: Type[Model], name: str, private_only: bool = ..., **kwargs: Any) -> None: ...
def contribute_to_related_class(self, cls: Type[Model], related: ForeignObjectRel) -> None: ...
class ForeignKey(ForeignObject):
many_to_many: bool = ...
@@ -178,9 +135,7 @@ class ForeignKey(ForeignObject):
on_delete: Callable,
related_name: Optional[str] = ...,
related_query_name: None = ...,
limit_choices_to: Optional[
Union[Callable, Dict[str, Union[int, str]]]
] = ...,
limit_choices_to: Optional[Union[Callable, Dict[str, Union[int, str]]]] = ...,
parent_link: bool = ...,
to_field: Optional[str] = ...,
db_constraint: bool = ...,
@@ -189,55 +144,29 @@ class ForeignKey(ForeignObject):
def check(self, **kwargs: Any) -> List[Warning]: ...
def deconstruct(
self
) -> Tuple[
Optional[str],
str,
List[Any],
Dict[str, Union[Callable, Dict[str, Union[int, str]], str]],
]: ...
) -> Tuple[Optional[str], str, List[Any], Dict[str, Union[Callable, Dict[str, Union[int, str]], str]]]: ...
def to_python(self, value: Union[int, str]) -> int: ...
@property
def target_field(self) -> Field: ...
def get_reverse_path_info(
self, filtered_relation: None = ...
) -> List[PathInfo]: ...
def validate(
self, value: Union[int, str], model_instance: Model
) -> None: ...
def get_reverse_path_info(self, filtered_relation: None = ...) -> List[PathInfo]: ...
def validate(self, value: Union[int, str], model_instance: Model) -> None: ...
def get_attname(self) -> str: ...
def get_attname_column(self) -> Tuple[str, str]: ...
def get_default(self) -> Optional[int]: ...
def get_db_prep_save(
self,
value: Optional[Union[int, str, UUID]],
connection: DatabaseWrapper,
self, value: Optional[Union[int, str, UUID]], connection: DatabaseWrapper
) -> Optional[Union[int, str]]: ...
def get_db_prep_value(
self,
value: Union[int, str, UUID],
connection: DatabaseWrapper,
prepared: bool = ...,
self, value: Union[int, str, UUID], connection: DatabaseWrapper, prepared: bool = ...
) -> Union[int, str]: ...
def contribute_to_related_class(
self, cls: Type[Model], related: ManyToOneRel
) -> None: ...
def formfield(
self, *, using: Optional[Any] = ..., **kwargs: Any
) -> ModelChoiceField: ...
def contribute_to_related_class(self, cls: Type[Model], related: ManyToOneRel) -> None: ...
def formfield(self, *, using: Optional[Any] = ..., **kwargs: Any) -> ModelChoiceField: ...
def db_check(self, connection: DatabaseWrapper) -> List[Any]: ...
def db_type(self, connection: DatabaseWrapper) -> str: ...
def db_parameters(
self, connection: DatabaseWrapper
) -> Dict[str, Union[List[Any], str]]: ...
def convert_empty_strings(
self, value: Any, expression: Any, connection: Any
): ...
def db_parameters(self, connection: DatabaseWrapper) -> Dict[str, Union[List[Any], str]]: ...
def convert_empty_strings(self, value: Any, expression: Any, connection: Any): ...
def get_db_converters(self, connection: DatabaseWrapper) -> List[Any]: ...
def get_col(
self,
alias: str,
output_field: Optional[Union[Field, OneToOneRel]] = ...,
) -> Col: ...
def get_col(self, alias: str, output_field: Optional[Union[Field, OneToOneRel]] = ...) -> Col: ...
class OneToOneField(ForeignKey):
many_to_many: bool = ...
@@ -249,21 +178,11 @@ class OneToOneField(ForeignKey):
rel_class: Any = ...
description: Any = ...
def __init__(
self,
to: Union[Type[Model], str],
on_delete: Callable,
to_field: Optional[str] = ...,
**kwargs: Any
self, to: Union[Type[Model], str], on_delete: Callable, to_field: Optional[str] = ..., **kwargs: Any
) -> None: ...
def deconstruct(
self
) -> Tuple[
Optional[str], str, List[Any], Dict[str, Union[Callable, bool, str]]
]: ...
def deconstruct(self) -> Tuple[Optional[str], str, List[Any], Dict[str, Union[Callable, bool, str]]]: ...
def formfield(self, **kwargs: Any) -> None: ...
def save_form_data(
self, instance: Model, data: Optional[Model]
) -> None: ...
def save_form_data(self, instance: Model, data: Optional[Model]) -> None: ...
def create_many_to_many_intermediary_model(field: Any, klass: Any): ...
@@ -292,34 +211,22 @@ class ManyToManyField(RelatedField):
**kwargs: Any
) -> None: ...
def check(self, **kwargs: Any) -> List[Any]: ...
def deconstruct(
self
) -> Tuple[Optional[str], str, List[Any], Dict[str, str]]: ...
def get_path_info(
self, filtered_relation: None = ...
) -> List[PathInfo]: ...
def get_reverse_path_info(
self, filtered_relation: None = ...
) -> List[PathInfo]: ...
def deconstruct(self) -> Tuple[Optional[str], str, List[Any], Dict[str, str]]: ...
def get_path_info(self, filtered_relation: None = ...) -> List[PathInfo]: ...
def get_reverse_path_info(self, filtered_relation: None = ...) -> List[PathInfo]: ...
m2m_db_table: Any = ...
def contribute_to_class(
self, cls: Type[Model], name: str, **kwargs: Any
) -> None: ...
def contribute_to_class(self, cls: Type[Model], name: str, **kwargs: Any) -> None: ...
m2m_column_name: Any = ...
m2m_reverse_name: Any = ...
m2m_field_name: Any = ...
m2m_reverse_field_name: Any = ...
m2m_target_field_name: Any = ...
m2m_reverse_target_field_name: Any = ...
def contribute_to_related_class(
self, cls: Type[Model], related: ManyToManyRel
) -> None: ...
def contribute_to_related_class(self, cls: Type[Model], related: ManyToManyRel) -> None: ...
def set_attributes_from_rel(self) -> None: ...
def value_from_object(self, obj: Model) -> List[Model]: ...
def save_form_data(self, instance: Model, data: QuerySet) -> None: ...
def formfield(
self, *, using: Optional[Any] = ..., **kwargs: Any
) -> ModelMultipleChoiceField: ...
def formfield(self, *, using: Optional[Any] = ..., **kwargs: Any) -> ModelMultipleChoiceField: ...
def db_check(self, connection: Any): ...
def db_type(self, connection: Any): ...
def db_parameters(self, connection: DatabaseWrapper) -> Dict[str, None]: ...

View File

@@ -8,103 +8,63 @@ from django.db.models.fields.related import ForeignObject, RelatedField, OneToOn
from django.db.models.fields.reverse_related import ManyToManyRel, OneToOneRel
from django.db.models.query import QuerySet
_T = TypeVar('_T')
_T = TypeVar("_T")
class ForwardManyToOneDescriptor:
RelatedObjectDoesNotExist: Type[ObjectDoesNotExist]
field: ForeignObject = ...
def __init__(self, field_with_rel: ForeignObject) -> None: ...
def is_cached(self, instance: Model) -> bool: ...
def get_queryset(self, **hints: Any) -> QuerySet: ...
def get_prefetch_queryset(
self, instances: List[Model], queryset: Optional[QuerySet] = ...
self, instances: List[Model], queryset: Optional[QuerySet] = ...
) -> Tuple[QuerySet, Callable, Callable, bool, str, bool]: ...
def get_object(self, instance: Model) -> Model: ...
def __get__(
self, instance: Optional[Model], cls: Type[Model] = ...
self, instance: Optional[Model], cls: Type[Model] = ...
) -> Optional[Union[Model, ForwardManyToOneDescriptor]]: ...
def __set__(
self, instance: Model, value: Optional[Union[Model, F]]
) -> None: ...
def __set__(self, instance: Model, value: Optional[Union[Model, F]]) -> None: ...
def __reduce__(self) -> Tuple[Callable, Tuple[Type[Model], str]]: ...
class ForwardOneToOneDescriptor(ForwardManyToOneDescriptor):
RelatedObjectDoesNotExist: Type[ObjectDoesNotExist]
field: OneToOneField
def get_object(self, instance: Model) -> Model: ...
def __set__(self, instance: Model, value: Optional[Model]) -> None: ...
class ReverseOneToOneDescriptor:
RelatedObjectDoesNotExist: Type[ObjectDoesNotExist]
related: OneToOneRel = ...
def __init__(self, related: OneToOneRel) -> None: ...
def is_cached(self, instance: Model) -> bool: ...
def get_queryset(self, **hints: Any) -> QuerySet: ...
def get_prefetch_queryset(
self, instances: List[Model], queryset: Optional[QuerySet] = ...
self, instances: List[Model], queryset: Optional[QuerySet] = ...
) -> Tuple[QuerySet, Callable, Callable, bool, str, bool]: ...
def __get__(
self, instance: Optional[Model], cls: Type[Model] = ...
) -> Union[Model, ReverseOneToOneDescriptor]: ...
def __get__(self, instance: Optional[Model], cls: Type[Model] = ...) -> Union[Model, ReverseOneToOneDescriptor]: ...
def __set__(self, instance: Model, value: Optional[Model]) -> None: ...
def __reduce__(self) -> Tuple[Callable, Tuple[Type[Model], str]]: ...
class ReverseManyToOneDescriptor:
rel: FieldCacheMixin = ...
field: FieldCacheMixin = ...
def __init__(self, rel: FieldCacheMixin) -> None: ...
def related_manager_cls(self): ...
def __get__(
self, instance: Optional[Model], cls: Type[Model] = ...
) -> ReverseManyToOneDescriptor: ...
def __get__(self, instance: Optional[Model], cls: Type[Model] = ...) -> ReverseManyToOneDescriptor: ...
def __set__(self, instance: Model, value: List[Model]) -> Any: ...
def create_reverse_many_to_one_manager(superclass: Any, rel: Any): ...
class ManyToManyDescriptor(ReverseManyToOneDescriptor):
field: RelatedField
rel: ManyToManyRel
reverse: bool = ...
def __init__(self, rel: ManyToManyRel, reverse: bool = ...) -> None: ...
@property
def through(self) -> Type[Model]: ...
def related_manager_cls(self): ...
class _ForwardManyToManyManager(Generic[_T]):
def all(self) -> QuerySet: ...
def create_forward_many_to_many_manager(
superclass: Any, rel: Any, reverse: Any
) -> _ForwardManyToManyManager: ...
def create_forward_many_to_many_manager(superclass: Any, rel: Any, reverse: Any) -> _ForwardManyToManyManager: ...

View File

@@ -7,13 +7,10 @@ from django.db.models.base import Model
from django.db.models.expressions import Col
from django.db.models.fields import Field
from django.db.models.fields.related import ForeignObject
from django.db.models.lookups import (BuiltinLookup, Exact, GreaterThan,
GreaterThanOrEqual, In, IsNull, LessThan,
LessThanOrEqual)
from django.db.models.lookups import BuiltinLookup, Exact, GreaterThan, GreaterThanOrEqual, In, IsNull, LessThan, LessThanOrEqual
from django.db.models.sql.compiler import SQLCompiler
from django.db.models.sql.query import Query
class MultiColSource:
alias: str
field: django.db.models.fields.related.ForeignObject
@@ -22,26 +19,17 @@ class MultiColSource:
contains_aggregate: bool = ...
output_field: django.db.models.fields.related.ForeignObject = ...
def __init__(
self,
alias: str,
targets: Tuple[Field, Field],
sources: Tuple[Field, Field],
field: related.ForeignObject,
self, alias: str, targets: Tuple[Field, Field], sources: Tuple[Field, Field], field: related.ForeignObject
) -> None: ...
def relabeled_clone(self, relabels: OrderedDict) -> MultiColSource: ...
def get_lookup(self, lookup: str) -> Type[BuiltinLookup]: ...
def get_normalized_value(
value: Any, lhs: Union[Col, MultiColSource]
) -> Tuple[None]: ...
def get_normalized_value(value: Any, lhs: Union[Col, MultiColSource]) -> Tuple[None]: ...
class RelatedIn(In):
bilateral_transforms: List[Any]
contains_aggregate: bool
lhs: Union[
django.db.models.expressions.Col,
django.db.models.fields.related_lookups.MultiColSource,
]
lhs: Union[django.db.models.expressions.Col, django.db.models.fields.related_lookups.MultiColSource]
rhs: Union[
List[django.db.models.base.Model],
List[int],
@@ -52,19 +40,13 @@ class RelatedIn(In):
Set[uuid.UUID],
django.db.models.sql.query.Query,
] = ...
def get_prep_lookup(
self
) -> Union[List[Model], List[int], List[str], List[UUID], Query]: ...
def as_sql(
self, compiler: SQLCompiler, connection: DatabaseWrapper
) -> Tuple[str, List[Any]]: ...
def get_prep_lookup(self) -> Union[List[Model], List[int], List[str], List[UUID], Query]: ...
def as_sql(self, compiler: SQLCompiler, connection: DatabaseWrapper) -> Tuple[str, List[Any]]: ...
class RelatedLookupMixin:
rhs: Any = ...
def get_prep_lookup(self) -> Any: ...
def as_sql(
self, compiler: SQLCompiler, connection: DatabaseWrapper
) -> Tuple[str, List[Union[int, str]]]: ...
def as_sql(self, compiler: SQLCompiler, connection: DatabaseWrapper) -> Tuple[str, List[Union[int, str]]]: ...
class RelatedExact(RelatedLookupMixin, Exact): ...
class RelatedLessThan(RelatedLookupMixin, LessThan): ...

View File

@@ -2,15 +2,13 @@ from typing import Any, Callable, Dict, List, Optional, Tuple, Type, Union
from django.db.models.base import Model
from django.db.models.fields import AutoField, Field
from django.db.models.fields.related import (ForeignKey, OneToOneField,
RelatedField)
from django.db.models.fields.related import ForeignKey, OneToOneField, RelatedField
from django.db.models.lookups import BuiltinLookup, StartsWith
from django.db.models.query_utils import FilteredRelation, PathInfo, Q
from django.db.models.sql.where import WhereNode
from .mixins import FieldCacheMixin
class ForeignObjectRel(FieldCacheMixin):
hidden: bool
many_to_many: bool
@@ -39,9 +37,7 @@ class ForeignObjectRel(FieldCacheMixin):
to: Union[Type[Model], str],
related_name: Optional[str] = ...,
related_query_name: Optional[str] = ...,
limit_choices_to: Optional[
Union[Callable, Dict[str, Union[int, str]], Q]
] = ...,
limit_choices_to: Optional[Union[Callable, Dict[str, Union[int, str]], Q]] = ...,
parent_link: bool = ...,
on_delete: Optional[Callable] = ...,
) -> None: ...
@@ -60,11 +56,7 @@ class ForeignObjectRel(FieldCacheMixin):
def get_internal_type(self) -> str: ...
@property
def db_type(self) -> Callable: ...
def get_choices(
self,
include_blank: bool = ...,
blank_choice: List[Tuple[str, str]] = ...,
) -> List[Tuple[int, str]]: ...
def get_choices(self, include_blank: bool = ..., blank_choice: List[Tuple[str, str]] = ...) -> List[Tuple[int, str]]: ...
def is_hidden(self) -> bool: ...
def get_joining_columns(self) -> Tuple: ...
def get_extra_restriction(
@@ -72,20 +64,14 @@ class ForeignObjectRel(FieldCacheMixin):
) -> Optional[Union[StartsWith, WhereNode]]: ...
field_name: None = ...
def set_field_name(self) -> None: ...
def get_accessor_name(
self, model: Optional[Type[Model]] = ...
) -> Optional[str]: ...
def get_path_info(
self, filtered_relation: Optional[FilteredRelation] = ...
) -> List[PathInfo]: ...
def get_accessor_name(self, model: Optional[Type[Model]] = ...) -> Optional[str]: ...
def get_path_info(self, filtered_relation: Optional[FilteredRelation] = ...) -> List[PathInfo]: ...
def get_cache_name(self) -> str: ...
class ManyToOneRel(ForeignObjectRel):
field: django.db.models.fields.related.ForeignKey
hidden: bool
limit_choices_to: Union[
Callable, Dict[str, Union[int, str]], django.db.models.query_utils.Q
]
limit_choices_to: Union[Callable, Dict[str, Union[int, str]], django.db.models.query_utils.Q]
many_to_many: bool
many_to_one: bool
model: Union[Type[django.db.models.base.Model], str]
@@ -107,9 +93,7 @@ class ManyToOneRel(ForeignObjectRel):
field_name: Optional[str],
related_name: Optional[str] = ...,
related_query_name: Optional[str] = ...,
limit_choices_to: Optional[
Union[Callable, Dict[str, Union[int, str]], Q]
] = ...,
limit_choices_to: Optional[Union[Callable, Dict[str, Union[int, str]], Q]] = ...,
parent_link: bool = ...,
on_delete: Callable = ...,
) -> None: ...

View File

@@ -8,7 +8,6 @@ from django.db.models.expressions import Value
from django.db.models.fields import Field
from django.db.models.sql.compiler import SQLCompiler
class Cast(Func):
contains_aggregate: bool
convert_value: Callable
@@ -18,14 +17,9 @@ class Cast(Func):
source_expressions: List[django.db.models.expressions.Combinable]
function: str = ...
template: str = ...
def __init__(
self, expression: Union[date, Decimal, Value, str], output_field: Field
) -> None: ...
def __init__(self, expression: Union[date, Decimal, Value, str], output_field: Field) -> None: ...
def as_sql(
self,
compiler: SQLCompiler,
connection: DatabaseWrapper,
**extra_context: Any
self, compiler: SQLCompiler, connection: DatabaseWrapper, **extra_context: Any
) -> Tuple[str, Union[List[date], List[Decimal]]]: ...
def as_mysql(self, compiler: Any, connection: Any): ...
def as_postgresql(self, compiler: Any, connection: Any): ...
@@ -51,9 +45,7 @@ class Greatest(Func):
source_expressions: List[django.db.models.expressions.Combinable]
function: str = ...
def __init__(self, *expressions: Any, **extra: Any) -> None: ...
def as_sqlite(
self, compiler: SQLCompiler, connection: DatabaseWrapper
) -> Tuple[str, List[datetime]]: ...
def as_sqlite(self, compiler: SQLCompiler, connection: DatabaseWrapper) -> Tuple[str, List[datetime]]: ...
class Least(Func):
contains_aggregate: bool
@@ -65,6 +57,4 @@ class Least(Func):
source_expressions: List[django.db.models.expressions.Combinable]
function: str = ...
def __init__(self, *expressions: Any, **extra: Any) -> None: ...
def as_sqlite(
self, compiler: SQLCompiler, connection: DatabaseWrapper
) -> Tuple[str, List[datetime]]: ...
def as_sqlite(self, compiler: SQLCompiler, connection: DatabaseWrapper) -> Tuple[str, List[datetime]]: ...

View File

@@ -9,7 +9,6 @@ from django.db.models.fields import Field
from django.db.models.sql.compiler import SQLCompiler
from django.db.models.sql.query import Query
class TimezoneMixin:
tzinfo: Any = ...
def get_tzname(self) -> Optional[str]: ...
@@ -24,15 +23,9 @@ class Extract(TimezoneMixin, Transform):
output_field: Any = ...
tzinfo: None = ...
def __init__(
self,
expression: Union[Expression, str],
lookup_name: Optional[str] = ...,
tzinfo: None = ...,
**extra: Any
self, expression: Union[Expression, str], lookup_name: Optional[str] = ..., tzinfo: None = ..., **extra: Any
) -> 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 resolve_expression(
self,
query: Query = ...,
@@ -137,15 +130,9 @@ class TruncBase(TimezoneMixin, Transform):
kind: Any = ...
tzinfo: Any = ...
def __init__(
self,
expression: Union[Col, str],
output_field: Optional[Field] = ...,
tzinfo: None = ...,
**extra: Any
self, expression: Union[Col, str], output_field: Optional[Field] = ..., tzinfo: None = ..., **extra: Any
) -> 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 resolve_expression(
self,
query: Query = ...,
@@ -154,31 +141,18 @@ class TruncBase(TimezoneMixin, Transform):
summarize: bool = ...,
for_save: bool = ...,
) -> TruncBase: ...
def convert_value(
self,
value: datetime,
expression: models.functions.TruncBase,
connection: DatabaseWrapper,
) -> datetime: ...
def convert_value(self, value: datetime, expression: models.functions.TruncBase, connection: DatabaseWrapper) -> datetime: ...
class Trunc(TruncBase):
contains_aggregate: bool
extra: Dict[Any, Any]
is_summary: bool
output_field: Union[
models.fields.DateTimeCheckMixin,
models.fields.IntegerField,
]
output_field: Union[models.fields.DateTimeCheckMixin, models.fields.IntegerField]
source_expressions: List[Combinable]
tzinfo: None
kind: str = ...
def __init__(
self,
expression: str,
kind: str,
output_field: Optional[Field] = ...,
tzinfo: None = ...,
**extra: Any
self, expression: str, kind: str, output_field: Optional[Field] = ..., tzinfo: None = ..., **extra: Any
) -> None: ...
class TruncYear(TruncBase):
@@ -235,9 +209,7 @@ class TruncDate(TruncBase):
kind: str = ...
lookup_name: str = ...
output_field: models.fields.TimeField = ...
def as_sql(
self, compiler: SQLCompiler, connection: DatabaseWrapper
) -> Tuple[str, List[Any]]: ...
def as_sql(self, compiler: SQLCompiler, connection: DatabaseWrapper) -> Tuple[str, List[Any]]: ...
class TruncTime(TruncBase):
contains_aggregate: bool
@@ -248,9 +220,7 @@ class TruncTime(TruncBase):
kind: str = ...
lookup_name: str = ...
output_field: models.fields.DateField = ...
def as_sql(
self, compiler: SQLCompiler, connection: DatabaseWrapper
) -> Tuple[str, List[Any]]: ...
def as_sql(self, compiler: SQLCompiler, connection: DatabaseWrapper) -> Tuple[str, List[Any]]: ...
class TruncHour(TruncBase):
contains_aggregate: bool

View File

@@ -5,14 +5,8 @@ from django.db.models import Func, Transform
from django.db.models.expressions import Combinable, Expression, Value
from django.db.models.sql.compiler import SQLCompiler
class BytesToCharFieldConversionMixin:
def convert_value(
self,
value: str,
expression: BytesToCharFieldConversionMixin,
connection: DatabaseWrapper,
) -> str: ...
def convert_value(self, value: str, expression: BytesToCharFieldConversionMixin, connection: DatabaseWrapper) -> str: ...
class Chr(Transform):
contains_aggregate: bool
@@ -24,12 +18,7 @@ class Chr(Transform):
lookup_name: str = ...
def as_mysql(self, compiler: Any, connection: Any): ...
def as_oracle(self, compiler: Any, connection: Any): ...
def as_sqlite(
self,
compiler: SQLCompiler,
connection: DatabaseWrapper,
**extra_context: Any
) -> Tuple[str, List[int]]: ...
def as_sqlite(self, compiler: SQLCompiler, connection: DatabaseWrapper, **extra_context: Any) -> Tuple[str, List[int]]: ...
class ConcatPair(Func):
contains_aggregate: bool
@@ -38,9 +27,7 @@ class ConcatPair(Func):
output_field: django.db.models.fields.CharField
source_expressions: List[django.db.models.expressions.Combinable]
function: str = ...
def as_sqlite(
self, compiler: SQLCompiler, connection: DatabaseWrapper
) -> Tuple[str, List[str]]: ...
def as_sqlite(self, compiler: SQLCompiler, connection: DatabaseWrapper) -> Tuple[str, List[str]]: ...
def as_mysql(self, compiler: Any, connection: Any): ...
def coalesce(self) -> ConcatPair: ...
@@ -65,16 +52,9 @@ class Left(Func):
source_expressions: List[django.db.models.expressions.Combinable]
function: str = ...
arity: int = ...
def __init__(
self, expression: str, length: Union[Value, int], **extra: Any
) -> None: ...
def __init__(self, expression: str, length: Union[Value, int], **extra: Any) -> None: ...
def get_substr(self) -> Substr: ...
def use_substr(
self,
compiler: SQLCompiler,
connection: DatabaseWrapper,
**extra_context: Any
) -> Tuple[str, List[int]]: ...
def use_substr(self, compiler: SQLCompiler, connection: DatabaseWrapper, **extra_context: Any) -> Tuple[str, List[int]]: ...
as_oracle: Any = ...
as_sqlite: Any = ...
@@ -109,13 +89,7 @@ class LPad(BytesToCharFieldConversionMixin, Func):
output_field: django.db.models.fields.CharField
source_expressions: List[django.db.models.expressions.Combinable]
function: str = ...
def __init__(
self,
expression: str,
length: Union[Length, int],
fill_text: Value = ...,
**extra: Any
) -> None: ...
def __init__(self, expression: str, length: Union[Length, int], fill_text: Value = ..., **extra: Any) -> None: ...
class LTrim(Transform):
contains_aggregate: bool
@@ -136,15 +110,8 @@ class Ord(Transform):
function: str = ...
lookup_name: str = ...
output_field: Any = ...
def as_mysql(
self, compiler: Any, connection: Any, **extra_context: Any
): ...
def as_sqlite(
self,
compiler: SQLCompiler,
connection: DatabaseWrapper,
**extra_context: Any
) -> Tuple[str, List[Any]]: ...
def as_mysql(self, compiler: Any, connection: Any, **extra_context: Any): ...
def as_sqlite(self, compiler: SQLCompiler, connection: DatabaseWrapper, **extra_context: Any) -> Tuple[str, List[Any]]: ...
class Repeat(BytesToCharFieldConversionMixin, Func):
contains_aggregate: bool
@@ -154,15 +121,8 @@ class Repeat(BytesToCharFieldConversionMixin, Func):
output_field: django.db.models.fields.CharField
source_expressions: List[django.db.models.expressions.Combinable]
function: str = ...
def __init__(
self,
expression: Union[Value, str],
number: Union[Length, int],
**extra: Any
) -> None: ...
def as_oracle(
self, compiler: Any, connection: Any, **extra_context: Any
): ...
def __init__(self, expression: Union[Value, str], number: Union[Length, int], **extra: Any) -> None: ...
def as_oracle(self, compiler: Any, connection: Any, **extra_context: Any): ...
class Replace(Func):
contains_aggregate: bool
@@ -173,13 +133,7 @@ class Replace(Func):
output_field: django.db.models.fields.CharField
source_expressions: List[django.db.models.expressions.Combinable]
function: str = ...
def __init__(
self,
expression: Combinable,
text: Value,
replacement: Value = ...,
**extra: Any
) -> None: ...
def __init__(self, expression: Combinable, text: Value, replacement: Value = ..., **extra: Any) -> None: ...
class Right(Left):
contains_aggregate: bool
@@ -238,12 +192,8 @@ class Substr(Func):
length: Optional[Union[Value, int]] = ...,
**extra: Any
) -> None: ...
def as_sqlite(
self, compiler: SQLCompiler, connection: DatabaseWrapper
) -> Tuple[str, List[Union[int, str]]]: ...
def as_oracle(
self, compiler: SQLCompiler, connection: DatabaseWrapper
) -> Tuple[str, List[int]]: ...
def as_sqlite(self, compiler: SQLCompiler, connection: DatabaseWrapper) -> Tuple[str, List[Union[int, str]]]: ...
def as_oracle(self, compiler: SQLCompiler, connection: DatabaseWrapper) -> Tuple[str, List[int]]: ...
class Trim(Transform):
contains_aggregate: bool

View File

@@ -2,7 +2,6 @@ from typing import Any, Optional, Dict, List
from django.db.models import Func
class CumeDist(Func):
function: str = ...
name: str = ...
@@ -25,13 +24,7 @@ class FirstValue(Func):
class LagLeadFunction(Func):
window_compatible: bool = ...
def __init__(
self,
expression: Optional[str],
offset: int = ...,
default: None = ...,
**extra: Any
) -> Any: ...
def __init__(self, expression: Optional[str], offset: int = ..., default: None = ..., **extra: Any) -> Any: ...
class Lag(LagLeadFunction):
function: str = ...
@@ -51,9 +44,7 @@ class NthValue(Func):
function: str = ...
name: str = ...
window_compatible: bool = ...
def __init__(
self, expression: Optional[str], nth: int = ..., **extra: Any
) -> Any: ...
def __init__(self, expression: Optional[str], nth: int = ..., **extra: Any) -> Any: ...
class Ntile(Func):
function: str = ...

View File

@@ -4,7 +4,6 @@ from django.db.backends.ddl_references import Statement
from django.db.backends.sqlite3.schema import DatabaseSchemaEditor
from django.db.models.base import Model
class Index:
model: Type[django.db.models.base.Model]
suffix: str = ...
@@ -13,26 +12,11 @@ class Index:
fields_orders: List[Tuple[str, str]] = ...
name: str = ...
db_tablespace: Optional[str] = ...
def __init__(
self,
*,
fields: Any = ...,
name: Optional[Any] = ...,
db_tablespace: Optional[Any] = ...
) -> None: ...
def __init__(self, *, fields: Any = ..., name: Optional[Any] = ..., db_tablespace: Optional[Any] = ...) -> None: ...
def check_name(self) -> List[str]: ...
def create_sql(
self,
model: Type[Model],
schema_editor: DatabaseSchemaEditor,
using: str = ...,
) -> Statement: ...
def remove_sql(
self, model: Type[Model], schema_editor: DatabaseSchemaEditor
) -> str: ...
def deconstruct(
self
) -> Tuple[str, Tuple, Dict[str, Union[List[str], str]]]: ...
def create_sql(self, model: Type[Model], schema_editor: DatabaseSchemaEditor, using: str = ...) -> Statement: ...
def remove_sql(self, model: Type[Model], schema_editor: DatabaseSchemaEditor) -> str: ...
def deconstruct(self) -> Tuple[str, Tuple, Dict[str, Union[List[str], str]]]: ...
def clone(self) -> Index: ...
def set_name_with_model(self, model: Type[Model]) -> None: ...
def __eq__(self, other: Index) -> bool: ...

View File

@@ -4,8 +4,7 @@ from typing import Any, Dict, List, Optional, Tuple, Type, Union, Iterable
from django.db.backends.sqlite3.base import DatabaseWrapper
from django.db.models import expressions, lookups
from django.db.models.expressions import (Col, Combinable, Expression, Func,
Ref)
from django.db.models.expressions import Col, Combinable, Expression, Func, Ref
from django.db.models.fields import TextField, related_lookups
from django.db.models.query_utils import RegisterLookupMixin
from django.db.models.sql.compiler import SQLCompiler
@@ -13,37 +12,24 @@ from django.db.models.sql.query import Query
from django.utils.datastructures import OrderedSet
from django.utils.safestring import SafeText
class Lookup:
lookup_name: Any = ...
prepare_rhs: bool = ...
can_use_none_as_rhs: bool = ...
rhs: Any = ...
bilateral_transforms: Any = ...
def __init__(
self,
lhs: Union[Expression, TextField, related_lookups.MultiColSource],
rhs: Any,
) -> None: ...
def __init__(self, lhs: Union[Expression, TextField, related_lookups.MultiColSource], rhs: Any) -> None: ...
def apply_bilateral_transforms(self, value: Expression) -> Transform: ...
def batch_process_rhs(
self,
compiler: SQLCompiler,
connection: DatabaseWrapper,
rhs: Optional[OrderedSet] = ...,
self, compiler: SQLCompiler, connection: DatabaseWrapper, rhs: Optional[OrderedSet] = ...
) -> Tuple[List[str], List[str]]: ...
def get_source_expressions(self) -> List[Expression]: ...
lhs: Any = ...
def set_source_expressions(self, new_exprs: List[Ref]) -> None: ...
def get_prep_lookup(self) -> Any: ...
def get_db_prep_lookup(
self, value: Union[int, str], connection: DatabaseWrapper
) -> Tuple[str, List[SafeText]]: ...
def get_db_prep_lookup(self, value: Union[int, str], connection: DatabaseWrapper) -> Tuple[str, List[SafeText]]: ...
def process_lhs(
self,
compiler: SQLCompiler,
connection: DatabaseWrapper,
lhs: Optional[Col] = ...,
self, compiler: SQLCompiler, connection: DatabaseWrapper, lhs: Optional[Col] = ...
) -> Tuple[str, List[Union[int, str]]]: ...
def process_rhs(
self, compiler: SQLCompiler, connection: DatabaseWrapper
@@ -68,42 +54,24 @@ class Transform(RegisterLookupMixin, Func):
class BuiltinLookup(Lookup):
def process_lhs(
self,
compiler: SQLCompiler,
connection: DatabaseWrapper,
lhs: Optional[Col] = ...,
self, compiler: SQLCompiler, connection: DatabaseWrapper, lhs: Optional[Col] = ...
) -> Tuple[str, List[Union[int, str]]]: ...
def as_sql(
self, compiler: SQLCompiler, connection: DatabaseWrapper
) -> Tuple[str, List[float]]: ...
def as_sql(self, compiler: SQLCompiler, connection: DatabaseWrapper) -> Tuple[str, List[float]]: ...
def get_rhs_op(self, connection: DatabaseWrapper, rhs: str) -> str: ...
class FieldGetDbPrepValueMixin:
get_db_prep_lookup_value_is_iterable: bool = ...
def get_db_prep_lookup(
self, value: Any, connection: DatabaseWrapper
) -> Tuple[str, List[float]]: ...
def get_db_prep_lookup(self, value: Any, connection: DatabaseWrapper) -> Tuple[str, List[float]]: ...
class FieldGetDbPrepValueIterableMixin(FieldGetDbPrepValueMixin):
get_db_prep_lookup_value_is_iterable: bool = ...
def get_prep_lookup(
self
) -> Iterable[Any]: ...
def process_rhs(
self, compiler: SQLCompiler, connection: DatabaseWrapper
) -> Tuple[Union[Tuple[str, str], str], Tuple]: ...
def get_prep_lookup(self) -> Iterable[Any]: ...
def process_rhs(self, compiler: SQLCompiler, connection: DatabaseWrapper) -> Tuple[Union[Tuple[str, str], str], Tuple]: ...
def resolve_expression_parameter(
self,
compiler: SQLCompiler,
connection: DatabaseWrapper,
sql: str,
param: Optional[Union[Combinable, int, str]],
self, compiler: SQLCompiler, connection: DatabaseWrapper, sql: str, param: Optional[Union[Combinable, int, str]]
) -> Tuple[str, List[None]]: ...
def batch_process_rhs(
self,
compiler: SQLCompiler,
connection: DatabaseWrapper,
rhs: Optional[OrderedSet] = ...,
self, compiler: SQLCompiler, connection: DatabaseWrapper, rhs: Optional[OrderedSet] = ...
) -> Tuple[Tuple[str], Tuple]: ...
class Exact(FieldGetDbPrepValueMixin, BuiltinLookup):
@@ -124,9 +92,7 @@ class IExact(BuiltinLookup):
rhs: Optional[Union[expressions.Col, str]]
lookup_name: str = ...
prepare_rhs: bool = ...
def process_rhs(
self, qn: SQLCompiler, connection: DatabaseWrapper
) -> Tuple[str, List[str]]: ...
def process_rhs(self, qn: SQLCompiler, connection: DatabaseWrapper) -> Tuple[str, List[str]]: ...
class GreaterThan(FieldGetDbPrepValueMixin, BuiltinLookup):
bilateral_transforms: List[Any]
@@ -161,9 +127,7 @@ class IntegerFieldFloatRounding:
rhs: Any = ...
def get_prep_lookup(self) -> Union[Combinable, Query, int]: ...
class IntegerGreaterThanOrEqual(
IntegerFieldFloatRounding, GreaterThanOrEqual
): ...
class IntegerGreaterThanOrEqual(IntegerFieldFloatRounding, GreaterThanOrEqual): ...
class IntegerLessThan(IntegerFieldFloatRounding, LessThan): ...
class In(FieldGetDbPrepValueIterableMixin, BuiltinLookup):
@@ -172,22 +136,16 @@ class In(FieldGetDbPrepValueIterableMixin, BuiltinLookup):
lhs: Expression
rhs: Any
lookup_name: str = ...
def process_rhs(
self, compiler: SQLCompiler, connection: DatabaseWrapper
) -> Tuple[str, Tuple]: ...
def process_rhs(self, compiler: SQLCompiler, connection: DatabaseWrapper) -> Tuple[str, Tuple]: ...
def get_rhs_op(self, connection: DatabaseWrapper, rhs: str) -> str: ...
def as_sql(
self, compiler: SQLCompiler, connection: DatabaseWrapper
) -> Tuple[str, List[Union[int, str]]]: ...
def as_sql(self, compiler: SQLCompiler, connection: DatabaseWrapper) -> Tuple[str, List[Union[int, str]]]: ...
def split_parameter_list_as_sql(self, compiler: Any, connection: Any): ...
class PatternLookup(BuiltinLookup):
param_pattern: str = ...
prepare_rhs: bool = ...
def get_rhs_op(self, connection: DatabaseWrapper, rhs: str) -> str: ...
def process_rhs(
self, qn: SQLCompiler, connection: DatabaseWrapper
) -> Tuple[str, List[Any]]: ...
def process_rhs(self, qn: SQLCompiler, connection: DatabaseWrapper) -> Tuple[str, List[Any]]: ...
class Contains(PatternLookup):
bilateral_transforms: List[Type[lookups.Transform]]
@@ -237,17 +195,9 @@ class Range(FieldGetDbPrepValueIterableMixin, BuiltinLookup):
bilateral_transforms: List[Type[lookups.Transform]]
contains_aggregate: bool
lhs: Expression
rhs: Union[
List[datetime.datetime],
Tuple[
Union[expressions.F, int],
Union[datetime.datetime, int],
],
]
rhs: Union[List[datetime.datetime], Tuple[Union[expressions.F, int], Union[datetime.datetime, int]]]
lookup_name: str = ...
def get_rhs_op(
self, connection: DatabaseWrapper, rhs: Tuple[str, str]
) -> str: ...
def get_rhs_op(self, connection: DatabaseWrapper, rhs: Tuple[str, str]) -> str: ...
class IsNull(BuiltinLookup):
bilateral_transforms: List[Any]
@@ -256,9 +206,7 @@ class IsNull(BuiltinLookup):
rhs: bool
lookup_name: str = ...
prepare_rhs: bool = ...
def as_sql(
self, compiler: SQLCompiler, connection: DatabaseWrapper
) -> Tuple[str, List[Any]]: ...
def as_sql(self, compiler: SQLCompiler, connection: DatabaseWrapper) -> Tuple[str, List[Any]]: ...
class Regex(BuiltinLookup):
bilateral_transforms: List[Any]
@@ -267,9 +215,7 @@ class Regex(BuiltinLookup):
rhs: str
lookup_name: str = ...
prepare_rhs: bool = ...
def as_sql(
self, compiler: SQLCompiler, connection: DatabaseWrapper
) -> Tuple[str, List[str]]: ...
def as_sql(self, compiler: SQLCompiler, connection: DatabaseWrapper) -> Tuple[str, List[str]]: ...
class IRegex(Regex):
bilateral_transforms: List[Any]
@@ -279,17 +225,13 @@ class IRegex(Regex):
lookup_name: str = ...
class YearLookup(Lookup):
def year_lookup_bounds(
self, connection: DatabaseWrapper, year: int
) -> List[str]: ...
def year_lookup_bounds(self, connection: DatabaseWrapper, year: int) -> List[str]: ...
class YearComparisonLookup(YearLookup):
bilateral_transforms: List[Any]
lhs: expressions.Value
rhs: expressions.Value
def as_sql(
self, compiler: SQLCompiler, connection: DatabaseWrapper
) -> Tuple[str, List[str]]: ...
def as_sql(self, compiler: SQLCompiler, connection: DatabaseWrapper) -> Tuple[str, List[str]]: ...
def get_rhs_op(self, connection: DatabaseWrapper, rhs: str) -> str: ...
def get_bound(self, start: datetime, finish: datetime) -> Any: ...
@@ -299,9 +241,7 @@ class YearExact(YearLookup, Exact):
lhs: django.db.models.functions.datetime.ExtractYear
rhs: Union[django.db.models.functions.datetime.Extract, int, str]
lookup_name: str = ...
def as_sql(
self, compiler: SQLCompiler, connection: DatabaseWrapper
) -> Tuple[str, List[str]]: ...
def as_sql(self, compiler: SQLCompiler, connection: DatabaseWrapper) -> Tuple[str, List[str]]: ...
class YearGt(YearComparisonLookup):
bilateral_transforms: List[Any]

View File

@@ -9,8 +9,7 @@ from django.db.models import Q
from django.db.models.base import Model
from django.db.models.query import QuerySet, RawQuerySet
_T = TypeVar('_T', bound=Model)
_T = TypeVar("_T", bound=Model)
class BaseManager:
creation_counter: int = ...
@@ -23,15 +22,9 @@ class BaseManager:
def deconstruct(self) -> Tuple[bool, str, None, Tuple, Dict[str, int]]: ...
def check(self, **kwargs: Any) -> List[Any]: ...
@classmethod
def from_queryset(
cls, queryset_class: Any, class_name: Optional[Any] = ...
): ...
def from_queryset(cls, queryset_class: Any, class_name: Optional[Any] = ...): ...
def contribute_to_class(self, model: Type[Model], name: str) -> None: ...
def db_manager(
self,
using: Optional[str] = ...,
hints: Optional[Dict[str, Model]] = ...,
) -> Manager: ...
def db_manager(self, using: Optional[str] = ..., hints: Optional[Dict[str, Model]] = ...) -> Manager: ...
@property
def db(self) -> str: ...
def get_queryset(self) -> QuerySet: ...
@@ -41,110 +34,51 @@ class BaseManager:
class Manager(Generic[_T]):
def exists(self) -> bool: ...
def explain(
self, *, format: Optional[Any] = ..., **options: Any
) -> str: ...
def explain(self, *, format: Optional[Any] = ..., **options: Any) -> str: ...
def raw(
self,
raw_query: str,
params: Optional[
Union[
Dict[str, str],
List[datetime],
List[Decimal],
List[str],
Set[str],
Tuple[int],
]
] = ...,
translations: Optional[Dict[str, str]] = ...,
using: None = ...,
self,
raw_query: str,
params: Optional[Union[Dict[str, str], List[datetime], List[Decimal], List[str], Set[str], Tuple[int]]] = ...,
translations: Optional[Dict[str, str]] = ...,
using: None = ...,
) -> RawQuerySet: ...
def values(self, *fields: Any, **expressions: Any) -> QuerySet: ...
def values_list(
self, *fields: Any, flat: bool = ..., named: bool = ...
) -> QuerySet: ...
def dates(
self, field_name: str, kind: str, order: str = ...
) -> QuerySet: ...
def datetimes(
self, field_name: str, kind: str, order: str = ..., tzinfo: None = ...
) -> QuerySet: ...
def values_list(self, *fields: Any, flat: bool = ..., named: bool = ...) -> QuerySet: ...
def dates(self, field_name: str, kind: str, order: str = ...) -> QuerySet: ...
def datetimes(self, field_name: str, kind: str, order: str = ..., tzinfo: None = ...) -> QuerySet: ...
def none(self) -> QuerySet[_T]: ...
def all(self) -> QuerySet[_T]: ...
def filter(self, *args: Any, **kwargs: Any) -> QuerySet[_T]: ...
def exclude(self, *args: Any, **kwargs: Any) -> QuerySet[_T]: ...
def complex_filter(
self,
filter_obj: Union[
Dict[str, datetime], Dict[str, QuerySet], Q, MagicMock
],
) -> QuerySet[_T]: ...
def complex_filter(self, filter_obj: Union[Dict[str, datetime], Dict[str, QuerySet], Q, MagicMock]) -> QuerySet[_T]: ...
def union(self, *other_qs: Any, all: bool = ...) -> QuerySet[_T]: ...
def intersection(self, *other_qs: Any) -> QuerySet[_T]: ...
def difference(self, *other_qs: Any) -> QuerySet[_T]: ...
def select_for_update(
self, nowait: bool = ..., skip_locked: bool = ..., of: Tuple = ...
) -> QuerySet: ...
def select_for_update(self, nowait: bool = ..., skip_locked: bool = ..., of: Tuple = ...) -> QuerySet: ...
def select_related(self, *fields: Any) -> QuerySet[_T]: ...
def prefetch_related(self, *lookups: Any) -> QuerySet[_T]: ...
def annotate(self, *args: Any, **kwargs: Any) -> QuerySet[_T]: ...
def order_by(self, *field_names: Any) -> QuerySet[_T]: ...
def distinct(self, *field_names: Any) -> QuerySet[_T]: ...
def extra(
self,
select: Optional[
Union[Dict[str, int], Dict[str, str], OrderedDict]
] = ...,
where: Optional[List[str]] = ...,
params: Optional[Union[List[int], List[str]]] = ...,
tables: Optional[List[str]] = ...,
order_by: Optional[Union[List[str], Tuple[str]]] = ...,
select_params: Optional[Union[List[int], List[str], Tuple[int]]] = ...,
self,
select: Optional[Union[Dict[str, int], Dict[str, str], OrderedDict]] = ...,
where: Optional[List[str]] = ...,
params: Optional[Union[List[int], List[str]]] = ...,
tables: Optional[List[str]] = ...,
order_by: Optional[Union[List[str], Tuple[str]]] = ...,
select_params: Optional[Union[List[int], List[str], Tuple[int]]] = ...,
) -> QuerySet[_T]: ...
def iterator(self, chunk_size: int = ...) -> Iterator[_T]: ...
def aggregate(
self, *args: Any, **kwargs: Any
) -> Dict[str, Optional[Union[datetime, float]]]: ...
def aggregate(self, *args: Any, **kwargs: Any) -> Dict[str, Optional[Union[datetime, float]]]: ...
def count(self) -> int: ...
def get(
self, *args: Any, **kwargs: Any
) -> _T: ...
def get(self, *args: Any, **kwargs: Any) -> _T: ...
def create(self, **kwargs: Any) -> _T: ...
class ManagerDescriptor:
manager: Manager = ...
def __init__(self, manager: Manager) -> None: ...
def __get__(
self, instance: Optional[Model], cls: Type[Model] = ...
) -> Manager: ...
def __get__(self, instance: Optional[Model], cls: Type[Model] = ...) -> Manager: ...
class EmptyManager(Manager):
creation_counter: int

View File

@@ -1,5 +1,4 @@
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 django.apps.config import AppConfig
from django.contrib.auth.base_user import AbstractBaseUser
@@ -25,16 +24,9 @@ DEFAULT_NAMES: Any
def normalize_together(
option_together: Any
) -> Union[
List[Union[Tuple[str, str], int]], Set[Tuple[str, str]], Tuple, int, str
]: ...
) -> Union[List[Union[Tuple[str, str], int]], Set[Tuple[str, str]], Tuple, int, str]: ...
def make_immutable_fields_list(
name: str,
data: Union[
Iterator[Any],
List[Union[ArrayField, CIText]],
List[Union[Field, FieldCacheMixin]],
],
name: str, data: Union[Iterator[Any], List[Union[ArrayField, CIText]], List[Union[Field, FieldCacheMixin]]]
) -> ImmutableList: ...
class Options:
@@ -50,9 +42,7 @@ class Options:
REVERSE_PROPERTIES: Any = ...
default_apps: Any = ...
local_fields: List[django.db.models.fields.Field] = ...
local_many_to_many: List[
django.db.models.fields.related.ManyToManyField
] = ...
local_many_to_many: List[django.db.models.fields.related.ManyToManyField] = ...
private_fields: List[Any] = ...
local_managers: List[django.db.models.manager.Manager] = ...
base_manager_name: None = ...
@@ -100,16 +90,7 @@ class Options:
default_related_name: None = ...
def __init__(
self,
meta: Optional[
Type[
Union[
AbstractBaseUser.Meta,
AbstractUser.Meta,
PermissionsMixin.Meta,
AbstractBaseSession.Meta,
]
]
],
meta: Optional[Type[Union[AbstractBaseUser.Meta, AbstractUser.Meta, PermissionsMixin.Meta, AbstractBaseSession.Meta]]],
app_label: Optional[str] = ...,
) -> None: ...
@property
@@ -121,14 +102,10 @@ class Options:
@property
def installed(self): ...
model: Type[django.db.models.base.Model] = ...
original_attrs: Dict[
str, Union[List[str], django.apps.registry.Apps, str]
] = ...
original_attrs: Dict[str, Union[List[str], django.apps.registry.Apps, str]] = ...
def contribute_to_class(self, cls: Type[Model], name: str) -> None: ...
def add_manager(self, manager: Manager) -> None: ...
def add_field(
self, field: Union[GenericForeignKey, Field], private: bool = ...
) -> None: ...
def add_field(self, field: Union[GenericForeignKey, Field], private: bool = ...) -> None: ...
def setup_pk(self, field: Field) -> None: ...
def setup_proxy(self, target: Type[Model]) -> None: ...
def can_migrate(self, connection: Union[DatabaseWrapper, str]) -> bool: ...
@@ -146,16 +123,10 @@ class Options:
def many_to_many(self) -> ImmutableList: ...
def related_objects(self) -> ImmutableList: ...
def fields_map(self) -> Dict[str, ForeignObjectRel]: ...
def get_field(
self, field_name: Union[Callable, str]
) -> Union[Field, mixins.FieldCacheMixin]: ...
def get_field(self, field_name: Union[Callable, str]) -> Union[Field, mixins.FieldCacheMixin]: ...
def get_base_chain(self, model: Type[Model]) -> List[Type[Model]]: ...
def get_parent_list(self) -> List[Type[Model]]: ...
def get_ancestor_link(
self, ancestor: Type[Model]
) -> Optional[OneToOneField]: ...
def get_ancestor_link(self, ancestor: Type[Model]) -> Optional[OneToOneField]: ...
def get_path_to_parent(self, parent: Type[Model]) -> List[PathInfo]: ...
def get_path_from_parent(self, parent: Type[Model]) -> List[PathInfo]: ...
def get_fields(
self, include_parents: bool = ..., include_hidden: bool = ...
) -> ImmutableList: ...
def get_fields(self, include_parents: bool = ..., include_hidden: bool = ...) -> ImmutableList: ...

View File

@@ -4,8 +4,7 @@ from collections import OrderedDict
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, Generic, TypeVar, overload)
from typing import Any, Callable, Dict, Iterator, List, Optional, Set, Tuple, Type, Union, Generic, TypeVar, overload
from unittest.mock import MagicMock
from uuid import UUID
@@ -14,405 +13,213 @@ from django.db import models
from django.db.models.base import Model, ModelState
from django.db.models.expressions import Expression
from django.db.models.fields import Field
from django.db.models.fields.related_descriptors import (ForwardManyToOneDescriptor,
ReverseOneToOneDescriptor)
from django.db.models.fields.related_descriptors import ForwardManyToOneDescriptor, ReverseOneToOneDescriptor
from django.db.models.query_utils import Q
from django.db.models.sql.query import Query, RawQuery
REPR_OUTPUT_SIZE: int
EmptyResultSet: Any
class BaseIterable:
queryset: Any = ...
chunked_fetch: Any = ...
chunk_size: Any = ...
def __init__(
self,
queryset: QuerySet,
chunked_fetch: bool = ...,
chunk_size: int = ...,
) -> None: ...
def __init__(self, queryset: QuerySet, chunked_fetch: bool = ..., chunk_size: int = ...) -> None: ...
class ModelIterable(BaseIterable):
chunk_size: int
chunked_fetch: bool
queryset: QuerySet
def __iter__(self) -> Iterator[Model]: ...
class ValuesIterable(BaseIterable):
chunk_size: int
chunked_fetch: bool
queryset: QuerySet
def __iter__(self) -> Iterator[Dict[str, Optional[Union[int, str]]]]: ...
class ValuesListIterable(BaseIterable):
chunk_size: int
chunked_fetch: bool
queryset: QuerySet
def __iter__(self) -> Union[chain, map]: ...
class NamedValuesListIterable(ValuesListIterable):
chunk_size: int
chunked_fetch: bool
queryset: QuerySet
@staticmethod
def create_namedtuple_class(*names: Any) -> Any: ...
def __iter__(self) -> Any: ...
class FlatValuesListIterable(BaseIterable):
chunk_size: int
chunked_fetch: bool
queryset: QuerySet
def __iter__(self) -> Iterator[Any]: ...
_T = TypeVar('_T', bound=models.Model)
_T = TypeVar("_T", bound=models.Model)
class QuerySet(Generic[_T]):
model: Optional[Type[models.Model]] = ...
query: models.sql.Query = ...
def __init__(
self,
model: Optional[Type[Model]] = ...,
query: Optional[Query] = ...,
using: Optional[str] = ...,
hints: Optional[Dict[str, Model]] = ...,
self,
model: Optional[Type[Model]] = ...,
query: Optional[Query] = ...,
using: Optional[str] = ...,
hints: Optional[Dict[str, Model]] = ...,
) -> None: ...
def as_manager(cls): ...
def __deepcopy__(
self,
memo: Dict[
int,
Union[
Dict[str, Union[ModelState, int, str]],
List[Union[Dict[str, Union[bool, str]], ModelState]],
Model,
ModelState,
],
self,
memo: Dict[
int,
Union[
Dict[str, Union[ModelState, int, str]], List[Union[Dict[str, Union[bool, str]], ModelState]], Model, ModelState
],
],
) -> QuerySet[_T]: ...
def __len__(self) -> int: ...
def __iter__(self) -> Iterator[_T]: ...
def __bool__(self) -> bool: ...
@overload
def __getitem__(self, k: slice) -> QuerySet[_T]: ...
@overload
def __getitem__(self, k: int) -> _T: ...
@overload
def __getitem__(self, k: str) -> Any: ...
def __and__(self, other: QuerySet) -> QuerySet: ...
def __or__(self, other: QuerySet) -> QuerySet: ...
def iterator(self, chunk_size: int = ...) -> Iterator[_T]: ...
def aggregate(
self, *args: Any, **kwargs: Any
) -> Dict[str, Optional[Union[datetime, float]]]: ...
def aggregate(self, *args: Any, **kwargs: Any) -> Dict[str, Optional[Union[datetime, float]]]: ...
def count(self) -> int: ...
def get(
self, *args: Any, **kwargs: Any
) -> _T: ...
def get(self, *args: Any, **kwargs: Any) -> _T: ...
def create(self, **kwargs: Any) -> _T: ...
def bulk_create(
self,
objs: Union[Iterator[Any], List[Model]],
batch_size: Optional[int] = ...,
) -> List[_T]: ...
def bulk_create(self, objs: Union[Iterator[Any], List[Model]], batch_size: Optional[int] = ...) -> List[_T]: ...
def get_or_create(
self,
defaults: Optional[Union[Dict[str, date], Dict[str, Model]]] = ...,
**kwargs: Any
self, defaults: Optional[Union[Dict[str, date], Dict[str, Model]]] = ..., **kwargs: Any
) -> Tuple[_T, bool]: ...
def update_or_create(
self,
defaults: Optional[
Union[
Dict[str, Callable],
Dict[str, date],
Dict[str, Model],
Dict[str, str],
]
] = ...,
**kwargs: Any
self,
defaults: Optional[Union[Dict[str, Callable], Dict[str, date], Dict[str, Model], Dict[str, str]]] = ...,
**kwargs: Any
) -> Tuple[_T, bool]: ...
def earliest(
self, *fields: Any, field_name: Optional[Any] = ...
) -> _T: ...
def latest(
self, *fields: Any, field_name: Optional[Any] = ...
) -> _T: ...
def earliest(self, *fields: Any, field_name: Optional[Any] = ...) -> _T: ...
def latest(self, *fields: Any, field_name: Optional[Any] = ...) -> _T: ...
def first(self) -> Optional[Union[Dict[str, int], _T]]: ...
def last(self) -> Optional[_T]: ...
def in_bulk(
self, id_list: Any = ..., *, field_name: str = ...
) -> Union[Dict[int, Model], Dict[str, Model]]: ...
def in_bulk(self, id_list: Any = ..., *, field_name: str = ...) -> Union[Dict[int, Model], Dict[str, Model]]: ...
def delete(self) -> Tuple[int, Dict[str, int]]: ...
def update(self, **kwargs: Any) -> int: ...
def exists(self) -> bool: ...
def explain(
self, *, format: Optional[Any] = ..., **options: Any
) -> str: ...
def explain(self, *, format: Optional[Any] = ..., **options: Any) -> str: ...
def raw(
self,
raw_query: str,
params: Optional[
Union[
Dict[str, str],
List[datetime],
List[Decimal],
List[str],
Set[str],
Tuple[int],
]
] = ...,
translations: Optional[Dict[str, str]] = ...,
using: None = ...,
self,
raw_query: str,
params: Optional[Union[Dict[str, str], List[datetime], List[Decimal], List[str], Set[str], Tuple[int]]] = ...,
translations: Optional[Dict[str, str]] = ...,
using: None = ...,
) -> RawQuerySet: ...
def values(self, *fields: Any, **expressions: Any) -> QuerySet: ...
def values_list(
self, *fields: Any, flat: bool = ..., named: bool = ...
) -> QuerySet: ...
def dates(
self, field_name: str, kind: str, order: str = ...
) -> QuerySet: ...
def datetimes(
self, field_name: str, kind: str, order: str = ..., tzinfo: None = ...
) -> QuerySet: ...
def values_list(self, *fields: Any, flat: bool = ..., named: bool = ...) -> QuerySet: ...
def dates(self, field_name: str, kind: str, order: str = ...) -> QuerySet: ...
def datetimes(self, field_name: str, kind: str, order: str = ..., tzinfo: None = ...) -> QuerySet: ...
def none(self) -> QuerySet[_T]: ...
def all(self) -> QuerySet[_T]: ...
def filter(self, *args: Any, **kwargs: Any) -> QuerySet[_T]: ...
def exclude(self, *args: Any, **kwargs: Any) -> QuerySet[_T]: ...
def complex_filter(
self,
filter_obj: Union[
Dict[str, datetime], Dict[str, QuerySet], Q, MagicMock
],
) -> QuerySet[_T]: ...
def complex_filter(self, filter_obj: Union[Dict[str, datetime], Dict[str, QuerySet], Q, MagicMock]) -> QuerySet[_T]: ...
def union(self, *other_qs: Any, all: bool = ...) -> QuerySet[_T]: ...
def intersection(self, *other_qs: Any) -> QuerySet[_T]: ...
def difference(self, *other_qs: Any) -> QuerySet[_T]: ...
def select_for_update(
self, nowait: bool = ..., skip_locked: bool = ..., of: Tuple = ...
) -> QuerySet: ...
def select_for_update(self, nowait: bool = ..., skip_locked: bool = ..., of: Tuple = ...) -> QuerySet: ...
def select_related(self, *fields: Any) -> QuerySet[_T]: ...
def prefetch_related(self, *lookups: Any) -> QuerySet[_T]: ...
def annotate(self, *args: Any, **kwargs: Any) -> QuerySet[_T]: ...
def order_by(self, *field_names: Any) -> QuerySet[_T]: ...
def distinct(self, *field_names: Any) -> QuerySet[_T]: ...
def extra(
self,
select: Optional[
Union[Dict[str, int], Dict[str, str], OrderedDict]
] = ...,
where: Optional[List[str]] = ...,
params: Optional[Union[List[int], List[str]]] = ...,
tables: Optional[List[str]] = ...,
order_by: Optional[Union[List[str], Tuple[str]]] = ...,
select_params: Optional[Union[List[int], List[str], Tuple[int]]] = ...,
self,
select: Optional[Union[Dict[str, int], Dict[str, str], OrderedDict]] = ...,
where: Optional[List[str]] = ...,
params: Optional[Union[List[int], List[str]]] = ...,
tables: Optional[List[str]] = ...,
order_by: Optional[Union[List[str], Tuple[str]]] = ...,
select_params: Optional[Union[List[int], List[str], Tuple[int]]] = ...,
) -> QuerySet[_T]: ...
def reverse(self) -> QuerySet[_T]: ...
def defer(self, *fields: Any) -> QuerySet[_T]: ...
def only(self, *fields: Any) -> QuerySet[_T]: ...
def using(self, alias: Optional[str]) -> QuerySet[_T]: ...
@property
def ordered(self) -> bool: ...
@property
def db(self) -> str: ...
def resolve_expression(self, *args: Any, **kwargs: Any) -> Query: ...
class InstanceCheckMeta(type):
def __instancecheck__(self, instance: Union[QuerySet, str]) -> bool: ...
class EmptyQuerySet:
def __init__(self, *args: Any, **kwargs: Any) -> Any: ...
class RawQuerySet:
columns: List[str]
model_fields: Dict[str, models.Field]
raw_query: str = ...
model: Optional[Type[models.Model]] = ...
query: models.sql.RawQuery = ...
params: Union[
Dict[str, str],
List[datetime],
List[decimal.Decimal],
List[str],
Set[str],
Tuple,
] = ...
params: Union[Dict[str, str], List[datetime], List[decimal.Decimal], List[str], Set[str], Tuple] = ...
translations: Dict[str, str] = ...
def __init__(
self,
raw_query: str,
model: Optional[Type[Model]] = ...,
query: Optional[RawQuery] = ...,
params: Optional[
Union[
Dict[str, str],
List[datetime],
List[Decimal],
List[str],
Set[str],
Tuple,
]
] = ...,
translations: Optional[Dict[str, str]] = ...,
using: Optional[str] = ...,
hints: Optional[Dict[Any, Any]] = ...,
self,
raw_query: str,
model: Optional[Type[Model]] = ...,
query: Optional[RawQuery] = ...,
params: Optional[Union[Dict[str, str], List[datetime], List[Decimal], List[str], Set[str], Tuple]] = ...,
translations: Optional[Dict[str, str]] = ...,
using: Optional[str] = ...,
hints: Optional[Dict[Any, Any]] = ...,
) -> None: ...
def resolve_model_init_order(
self
) -> Tuple[List[str], List[int], List[Tuple[str, int]]]: ...
def resolve_model_init_order(self) -> Tuple[List[str], List[int], List[Tuple[str, int]]]: ...
def prefetch_related(self, *lookups: Any) -> RawQuerySet: ...
def __len__(self) -> int: ...
def __bool__(self) -> bool: ...
def __iter__(self) -> Any: ...
def iterator(self) -> Iterator[Model]: ...
def __getitem__(
self, k: Union[int, slice, str]
) -> Union[List[Model], Model]: ...
def __getitem__(self, k: Union[int, slice, str]) -> Union[List[Model], Model]: ...
@property
def db(self) -> str: ...
def using(self, alias: Any): ...
def columns(self) -> List[str]: ...
def model_fields(self) -> Dict[str, Field]: ...
class Prefetch:
prefetch_through: str = ...
prefetch_to: str = ...
queryset: Optional[QuerySet] = ...
to_attr: Optional[str] = ...
def __init__(
self,
lookup: str,
queryset: Optional[QuerySet] = ...,
to_attr: Optional[str] = ...,
) -> None: ...
def __init__(self, lookup: str, queryset: Optional[QuerySet] = ..., to_attr: Optional[str] = ...) -> None: ...
def add_prefix(self, prefix: str) -> None: ...
def get_current_prefetch_to(self, level: int) -> str: ...
def get_current_to_attr(self, level: int) -> Tuple[str, Optional[bool]]: ...
def get_current_queryset(self, level: int) -> Optional[QuerySet]: ...
def __eq__(self, other: None) -> bool: ...
def __hash__(self) -> int: ...
def normalize_prefetch_lookups(
lookups: reversed, prefix: None = ...
) -> List[Prefetch]: ...
def prefetch_related_objects(
model_instances: Union[List[Model], List[UUID]], *related_lookups: Any
) -> None: ...
def normalize_prefetch_lookups(lookups: reversed, prefix: None = ...) -> List[Prefetch]: ...
def prefetch_related_objects(model_instances: Union[List[Model], List[UUID]], *related_lookups: Any) -> None: ...
def get_prefetcher(
instance: Model, through_attr: str, to_attr: str
) -> Tuple[
GenericForeignKey, Union[GenericForeignKey, property], bool, bool
]: ...
instance: Model, through_attr: str, to_attr: str
) -> Tuple[GenericForeignKey, Union[GenericForeignKey, property], bool, bool]: ...
def prefetch_one_level(
instances: List[Model],
prefetcher: Union[
GenericForeignKey, ForwardManyToOneDescriptor, ReverseOneToOneDescriptor
],
lookup: Prefetch,
level: int,
instances: List[Model],
prefetcher: Union[GenericForeignKey, ForwardManyToOneDescriptor, ReverseOneToOneDescriptor],
lookup: Prefetch,
level: int,
) -> Tuple[List[Model], List[Prefetch]]: ...
class RelatedPopulator:
db: str = ...
cols_start: int = ...
@@ -424,27 +231,17 @@ class RelatedPopulator:
related_populators: List[models.query.RelatedPopulator] = ...
local_setter: Callable = ...
remote_setter: Callable = ...
def __init__(
self,
klass_info: Dict[str, Any],
select: List[Tuple[Expression, Tuple[str, List[int]], Optional[str]]],
db: str,
self, klass_info: Dict[str, Any], select: List[Tuple[Expression, Tuple[str, List[int]], Optional[str]]], db: str
) -> None: ...
def populate(
self,
row: Union[
List[Optional[Union[date, int, str]]],
List[Union[date, Decimal, float, str]],
Tuple[Union[int, str], str, int],
],
from_obj: Model,
self,
row: Union[
List[Optional[Union[date, int, str]]], List[Union[date, Decimal, float, str]], Tuple[Union[int, str], str, int]
],
from_obj: Model,
) -> None: ...
def get_related_populators(
klass_info: Dict[str, Any],
select: List[Tuple[Expression, Tuple[str, List[bool]], Optional[str]]],
db: str,
klass_info: Dict[str, Any], select: List[Tuple[Expression, Tuple[str, List[bool]], Optional[str]]], db: str
) -> List[RelatedPopulator]: ...

View File

@@ -7,40 +7,27 @@ from django.db.models.expressions import Expression
from django.db.models.fields import Field
from django.db.models.fields.mixins import FieldCacheMixin
from django.db.models.functions.datetime import TimezoneMixin
from django.db.models.lookups import (FieldGetDbPrepValueMixin,
IntegerFieldFloatRounding, Lookup,
Transform)
from django.db.models.lookups import FieldGetDbPrepValueMixin, IntegerFieldFloatRounding, Lookup, Transform
from django.db.models.options import Options
from django.db.models.sql.compiler import SQLCompiler
from django.db.models.sql.query import Query
from django.db.models.sql.where import WhereNode
from django.utils import tree
PathInfo = namedtuple(
"PathInfo",
"from_opts to_opts target_fields join_field m2m direct filtered_relation",
)
PathInfo = namedtuple("PathInfo", "from_opts to_opts target_fields join_field m2m direct filtered_relation")
class InvalidQuery(Exception): ...
def subclasses(
cls: Type[RegisterLookupMixin]
) -> Iterator[Type[RegisterLookupMixin]]: ...
def subclasses(cls: Type[RegisterLookupMixin]) -> Iterator[Type[RegisterLookupMixin]]: ...
class QueryWrapper:
contains_aggregate: bool = ...
data: Tuple[str, List[Any]] = ...
def __init__(self, sql: str, params: List[Any]) -> 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]]: ...
class Q(tree.Node):
children: Union[
List[Dict[str, str]],
List[Tuple[str, Any]],
List[django.db.models.query_utils.Q],
]
children: Union[List[Dict[str, str]], List[Tuple[str, Any]], List[django.db.models.query_utils.Q]]
connector: str
negated: bool
AND: str = ...
@@ -64,75 +51,33 @@ class Q(tree.Node):
class DeferredAttribute:
field_name: str = ...
def __init__(self, field_name: str) -> None: ...
def __get__(
self, instance: Optional[Model], cls: Type[Model] = ...
) -> Any: ...
def __get__(self, instance: Optional[Model], cls: Type[Model] = ...) -> Any: ...
class RegisterLookupMixin:
@classmethod
def get_lookups(
cls
) -> Dict[str, Type[Union[TimezoneMixin, Lookup, Transform]]]: ...
def get_lookup(
self, lookup_name: str
) -> Optional[Type[Union[FieldGetDbPrepValueMixin, Lookup]]]: ...
def get_lookups(cls) -> Dict[str, Type[Union[TimezoneMixin, Lookup, Transform]]]: ...
def get_lookup(self, lookup_name: str) -> Optional[Type[Union[FieldGetDbPrepValueMixin, Lookup]]]: ...
def get_transform(self, lookup_name: str) -> Optional[Type[Transform]]: ...
@staticmethod
def merge_dicts(
dicts: List[
Dict[
str,
Type[
Union[
TimezoneMixin,
FieldGetDbPrepValueMixin,
IntegerFieldFloatRounding,
Lookup,
Transform,
]
],
]
]
) -> Dict[
str,
Type[Union[TimezoneMixin, FieldGetDbPrepValueMixin, Lookup, Transform]],
]: ...
dicts: List[Dict[str, Type[Union[TimezoneMixin, FieldGetDbPrepValueMixin, IntegerFieldFloatRounding, Lookup, Transform]]]]
) -> Dict[str, Type[Union[TimezoneMixin, FieldGetDbPrepValueMixin, Lookup, Transform]]]: ...
@classmethod
def register_lookup(
cls,
lookup: Type[Union[Lookup, Transform]],
lookup_name: Optional[str] = ...,
cls, lookup: Type[Union[Lookup, Transform]], lookup_name: Optional[str] = ...
) -> Type[Union[Lookup, Transform]]: ...
def select_related_descend(
field: Field,
restricted: bool,
requested: Optional[
Union[
Dict[
str,
Dict[
str,
Dict[
str,
Dict[
str, Dict[str, Dict[str, Dict[str, Dict[Any, Any]]]]
],
],
],
],
bool,
]
],
requested: Optional[Union[Dict[str, Dict[str, Dict[str, Dict[str, Dict[str, Dict[str, Dict[str, Dict[Any, Any]]]]]]]], bool]],
load_fields: Optional[Set[str]],
reverse: bool = ...,
) -> bool: ...
def refs_expression(
lookup_parts: List[str], annotations: OrderedDict
) -> Union[Tuple[bool, Tuple], Tuple[Expression, List[str]]]: ...
def check_rel_lookup_compatibility(
model: Type[Model], target_opts: Options, field: FieldCacheMixin
) -> bool: ...
def check_rel_lookup_compatibility(model: Type[Model], target_opts: Options, field: FieldCacheMixin) -> bool: ...
class FilteredRelation:
relation_name: str = ...
@@ -143,6 +88,4 @@ class FilteredRelation:
def __eq__(self, other: FilteredRelation) -> bool: ...
def clone(self) -> FilteredRelation: ...
def resolve_expression(self, *args: Any, **kwargs: Any) -> None: ...
def as_sql(
self, compiler: SQLCompiler, connection: DatabaseWrapper
) -> Tuple[str, List[Union[int, str]]]: ...
def as_sql(self, compiler: SQLCompiler, connection: DatabaseWrapper) -> Tuple[str, List[Union[int, str]]]: ...

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

View File

@@ -2,5 +2,4 @@ from typing import Any, Optional, Tuple, Type, Union
from django.db.models.base import Model
def make_model_tuple(model: Union[Type[Model], str]) -> Tuple[str, str]: ...