improved version

This commit is contained in:
Maxim Kurnikov
2018-07-29 20:06:41 +03:00
parent c180555415
commit 89bb6eac75
160 changed files with 1007 additions and 607 deletions

View File

@@ -1,3 +1,8 @@
from django.contrib.auth.models import (
Permission,
User,
)
from django.contrib.contenttypes.models import ContentType
from django.db.models.base import Model
from django.db.models.fields.related import ForeignKey
from django.db.models.fields.reverse_related import ManyToOneRel
@@ -11,6 +16,7 @@ from typing import (
List,
Optional,
Tuple,
Type,
Union,
)
@@ -50,7 +56,7 @@ class Collector:
def add(
self,
objs: Any,
source: Any = ...,
source: Optional[Union[Type[Model], Type[ContentType]]] = ...,
nullable: bool = ...,
reverse_dependency: bool = ...
) -> Any: ...
@@ -68,15 +74,19 @@ class Collector:
def collect(
self,
objs: Any,
source: Any = ...,
source: Optional[Union[Type[Model], Type[ContentType]]] = ...,
nullable: bool = ...,
collect_related: bool = ...,
source_attr: Optional[str] = ...,
reverse_dependency: bool = ...,
keep_parents: bool = ...
) -> None: ...
def delete(self) -> Union[Tuple[int, Dict[Any, Any]], Tuple[int, Dict[str, int]]]: ...
def get_del_batches(self, objs: Any, field: ForeignKey) -> Any: ...
def delete(self) -> Union[Tuple[int, Dict[str, int]], Tuple[int, Dict[Any, Any]]]: ...
def get_del_batches(
self,
objs: Union[List[User], List[Model], List[ContentType], List[Permission]],
field: ForeignKey
) -> Union[List[List[Model]], List[List[ContentType]], List[List[User]], List[List[Permission]]]: ...
def instances_with_model(self) -> Iterator[Any]: ...
def related_objects(
self,
@@ -90,5 +100,5 @@ class ProtectedError:
def __init__(
self,
msg: str,
protected_objects: Union[QuerySet, List[Model]]
protected_objects: Union[List[Model], QuerySet]
) -> None: ...

View File

@@ -4,10 +4,19 @@ from datetime import (
timedelta,
)
from django.db.backends.sqlite3.base import DatabaseWrapper
from django.db.models.aggregates import Count
from django.db.models.fields import Field
from django.db.models.aggregates import (
Aggregate,
Count,
)
from django.db.models.fields import (
DateTimeCheckMixin,
Field,
)
from django.db.models.fields.related import ForeignKey
from django.db.models.fields.reverse_related import ForeignObjectRel
from django.db.models.fields.reverse_related import (
ForeignObjectRel,
OneToOneRel,
)
from django.db.models.functions.datetime import Trunc
from django.db.models.functions.text import BytesToCharFieldConversionMixin
from django.db.models.query_utils import Q
@@ -42,10 +51,17 @@ class BaseExpression:
connection: DatabaseWrapper
) -> str: ...
@cached_property
def _output_field_or_none(self) -> Any: ...
def _output_field_or_none(
self
) -> Optional[Union[Field, DateTimeCheckMixin]]: ...
def _parse_expressions(self, *expressions) -> Any: ...
def _prepare(self, field: Any) -> Expression: ...
def _resolve_output_field(self) -> Any: ...
def _prepare(
self,
field: Union[Field, DateTimeCheckMixin, reverse_related.OneToOneRel]
) -> Expression: ...
def _resolve_output_field(
self
) -> Optional[Union[Field, DateTimeCheckMixin]]: ...
def asc(self, **kwargs) -> OrderBy: ...
@cached_property
def contains_aggregate(self) -> bool: ...
@@ -55,21 +71,25 @@ class BaseExpression:
def contains_over_clause(self) -> bool: ...
@cached_property
def convert_value(self) -> Callable: ...
def copy(self) -> BaseExpression: ...
def copy(
self
) -> Union[OrderBy, Expression, SQLiteNumericMixin]: ...
def desc(self, **kwargs) -> OrderBy: ...
@property
def field(self) -> Any: ...
def field(
self
) -> Union[ForeignObjectRel, Field, DateTimeCheckMixin]: ...
def flatten(self) -> Iterator[Union[Value, Func]]: ...
def get_db_converters(self, connection: DatabaseWrapper) -> List[Callable]: ...
def get_group_by_cols(
self
) -> Union[List[CombinedExpression], List[Trunc], List[Col]]: ...
def get_lookup(self, lookup: str) -> Any: ...
def get_lookup(self, lookup: str) -> object: ...
def get_source_expressions(self) -> List[Any]: ...
def get_source_fields(self) -> Any: ...
def get_transform(self, name: str) -> Any: ...
@cached_property
def output_field(self) -> Field: ...
def output_field(self) -> Union[Field, DateTimeCheckMixin]: ...
def relabeled_clone(
self,
change_map: Union[OrderedDict, Dict[Union[str, None], str]]
@@ -81,7 +101,7 @@ class BaseExpression:
reuse: Optional[Set[str]] = ...,
summarize: bool = ...,
for_save: bool = ...
) -> BaseExpression: ...
) -> Union[OrderBy, Expression]: ...
def set_source_expressions(self, exprs: List[Any]) -> None: ...
@@ -110,7 +130,12 @@ class Case:
class Col:
def __init__(self, alias: str, target: Field, output_field: Any = ...) -> None: ...
def __init__(
self,
alias: str,
target: Union[Field, DateTimeCheckMixin],
output_field: Optional[Union[reverse_related.ForeignObjectRel, Field]] = ...
) -> None: ...
def __repr__(self) -> str: ...
def as_sql(
self,
@@ -126,7 +151,10 @@ class Col:
class Combinable:
def __add__(self, other: Any) -> CombinedExpression: ...
def __add__(
self,
other: Union[float, timedelta, F, Aggregate]
) -> CombinedExpression: ...
def __mod__(self, other: int) -> CombinedExpression: ...
def __mul__(
self,
@@ -134,16 +162,16 @@ class Combinable:
) -> CombinedExpression: ...
def __radd__(
self,
other: Optional[Union[float, int, timedelta]]
other: Optional[Union[float, timedelta]]
) -> CombinedExpression: ...
def __rand__(self, other: object): ...
def __rmul__(self, other: float) -> CombinedExpression: ...
def __ror__(self, other: object): ...
def __rsub__(self, other: Union[float, int]) -> CombinedExpression: ...
def __rsub__(self, other: float) -> CombinedExpression: ...
def __rtruediv__(self, other: int) -> CombinedExpression: ...
def __sub__(
self,
other: Union[float, timedelta, int, F]
other: Union[float, timedelta, F]
) -> CombinedExpression: ...
def __truediv__(
self,
@@ -158,7 +186,7 @@ class CombinedExpression:
self,
lhs: Combinable,
connector: str,
rhs: Combinable,
rhs: Union[F, Expression],
output_field: None = ...
) -> None: ...
def __str__(self) -> str: ...
@@ -166,7 +194,7 @@ class CombinedExpression:
self,
compiler: SQLCompiler,
connection: DatabaseWrapper
) -> Union[Tuple[str, List[datetime]], Tuple[str, List[int]], Tuple[str, List[Any]], Tuple[str, List[float]]]: ...
) -> Union[Tuple[str, List[int]], Tuple[str, List[float]], Tuple[str, List[Any]], Tuple[str, List[datetime]]]: ...
def get_source_expressions(self) -> Any: ...
def resolve_expression(
self,
@@ -209,7 +237,7 @@ class Exists:
connection: DatabaseWrapper,
template: None = ...,
**extra_context
) -> Union[Tuple[str, Tuple[int]], Tuple[str, Tuple]]: ...
) -> Union[Tuple[str, Tuple], Tuple[str, Tuple[int]]]: ...
def resolve_expression(
self,
query: Query = ...,
@@ -236,10 +264,10 @@ class ExpressionWrapper:
) -> Union[Tuple[str, List[int]], Tuple[str, List[Any]]]: ...
def get_source_expressions(
self
) -> Union[List[Q], List[CombinedExpression], List[WhereNode]]: ...
) -> Union[List[CombinedExpression], List[Q], List[WhereNode]]: ...
def set_source_expressions(
self,
exprs: Union[List[WhereNode], List[CombinedExpression]]
exprs: Union[List[CombinedExpression], List[WhereNode]]
) -> None: ...
@@ -289,7 +317,7 @@ class Func:
class OrderBy:
def __init__(
self,
expression: Combinable,
expression: Union[F, Expression],
descending: bool = ...,
nulls_first: bool = ...,
nulls_last: bool = ...

View File

@@ -19,6 +19,7 @@ from typing import (
Any,
List,
Optional,
Type,
Union,
)
@@ -27,7 +28,7 @@ class AutoField:
def __init__(self, *args, **kwargs) -> None: ...
def _check_primary_key(self) -> List[Any]: ...
def check(self, **kwargs) -> List[Any]: ...
def contribute_to_class(self, cls: Any, name: str, **kwargs) -> None: ...
def contribute_to_class(self, cls: Type[Model], name: str, **kwargs) -> None: ...
def deconstruct(self) -> Any: ...
def formfield(self, **kwargs) -> None: ...
def get_db_prep_value(
@@ -86,7 +87,7 @@ class CharField:
def check(self, **kwargs) -> List[Error]: ...
def formfield(self, **kwargs) -> Union[CharField, TypedChoiceField]: ...
def get_internal_type(self) -> str: ...
def get_prep_value(self, value: Any) -> object: ...
def get_prep_value(self, value: object) -> object: ...
def to_python(self, value: Optional[Union[int, str, Model]]) -> Optional[str]: ...
@@ -100,15 +101,15 @@ class DateField:
**kwargs
) -> None: ...
def _check_fix_default_value(self) -> List[Warning]: ...
def contribute_to_class(self, cls: Any, name: str, **kwargs) -> None: ...
def contribute_to_class(self, cls: Type[Model], name: str, **kwargs) -> None: ...
def deconstruct(self) -> Any: ...
def formfield(
self,
**kwargs
) -> Union[SplitDateTimeField, BaseTemporalField]: ...
) -> Union[BaseTemporalField, SplitDateTimeField]: ...
def get_db_prep_value(
self,
value: Optional[Union[date, str]],
value: Optional[Union[str, date]],
connection: DatabaseWrapper,
prepared: bool = ...
) -> Optional[str]: ...

View File

@@ -18,13 +18,14 @@ from typing import (
List,
Optional,
Tuple,
Type,
Union,
)
class FieldFile:
def __eq__(self, other: Optional[Union[Tuple, str, FieldFile]]) -> bool: ...
def __getstate__(self) -> Dict[str, Union[str, bool, None]]: ...
def __eq__(self, other: Optional[Union[str, Tuple, FieldFile]]) -> bool: ...
def __getstate__(self) -> Dict[str, Optional[Union[str, bool]]]: ...
def __init__(
self,
instance: Model,
@@ -51,8 +52,8 @@ class FieldFile:
class FileDescriptor:
def __get__(
self,
instance: Any,
cls: Any = ...
instance: Optional[Model],
cls: Type[Model] = ...
) -> Union[FileDescriptor, FieldFile]: ...
def __init__(self, field: FileField) -> None: ...
def __set__(
@@ -74,10 +75,10 @@ class FileField:
def _check_primary_key(self) -> List[Error]: ...
def _check_upload_to(self) -> List[Any]: ...
def check(self, **kwargs) -> List[Any]: ...
def contribute_to_class(self, cls: Any, name: str, **kwargs) -> None: ...
def contribute_to_class(self, cls: Type[Model], name: str, **kwargs) -> None: ...
def deconstruct(self) -> Any: ...
def formfield(self, **kwargs) -> FileField: ...
def generate_filename(self, instance: Any, filename: str) -> str: ...
def generate_filename(self, instance: Optional[Model], filename: str) -> str: ...
def get_internal_type(self) -> str: ...
def get_prep_value(self, value: FieldFile) -> str: ...
def pre_save(

View File

@@ -1,9 +1,17 @@
from django.db.models.base import Model
from typing import Any
from typing import Optional
class FieldCacheMixin:
def delete_cached_value(self, instance: Model) -> None: ...
def get_cached_value(self, instance: Model, default: object = ...) -> Any: ...
def get_cached_value(
self,
instance: Model,
default: object = ...
) -> Optional[Model]: ...
def is_cached(self, instance: Model) -> bool: ...
def set_cached_value(self, instance: Model, value: Any) -> None: ...
def set_cached_value(
self,
instance: Model,
value: Optional[Model]
) -> None: ...

View File

@@ -3,11 +3,13 @@ from django.core.checks.messages import (
Warning,
)
from django.db.backends.sqlite3.base import DatabaseWrapper
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.reverse_related import (
ForeignObjectRel,
ManyToOneRel,
OneToOneRel,
)
from django.db.models.query_utils import (
FilteredRelation,
@@ -21,6 +23,7 @@ from typing import (
List,
Optional,
Tuple,
Type,
Union,
)
from uuid import UUID
@@ -44,10 +47,10 @@ class ForeignKey:
def check(
self,
**kwargs
) -> Union[List[Error], List[Warning]]: ...
) -> Union[List[Warning], List[Error]]: ...
def contribute_to_related_class(
self,
cls: Any,
cls: Type[Model],
related: ManyToOneRel
) -> None: ...
def db_check(self, connection: DatabaseWrapper) -> List[Any]: ...
@@ -57,16 +60,20 @@ class ForeignKey:
def formfield(self, *, using = ..., **kwargs) -> ModelChoiceField: ...
def get_attname(self) -> str: ...
def get_attname_column(self) -> Tuple[str, str]: ...
def get_col(self, alias: str, output_field: Any = ...) -> Col: ...
def get_col(
self,
alias: str,
output_field: Optional[Union[Field, reverse_related.OneToOneRel]] = ...
) -> Col: ...
def get_db_converters(self, connection: DatabaseWrapper) -> List[Any]: ...
def get_db_prep_save(
self,
value: Any,
value: object,
connection: DatabaseWrapper
) -> Optional[Union[str, int]]: ...
def get_db_prep_value(
self,
value: Union[str, UUID, int],
value: Union[str, int, UUID],
connection: DatabaseWrapper,
prepared: bool = ...
) -> Union[str, int]: ...
@@ -78,7 +85,7 @@ class ForeignKey:
@property
def target_field(self) -> Field: ...
def to_python(self, value: Union[str, int]) -> Union[str, int]: ...
def validate(self, value: int, model_instance: Any) -> None: ...
def validate(self, value: int, model_instance: Optional[Model]) -> None: ...
class ForeignObject:
@@ -86,8 +93,8 @@ class ForeignObject:
self,
to: Any,
on_delete: Callable,
from_fields: Union[Tuple[str, str], List[str]],
to_fields: Union[List[str], List[None], Tuple[str, str]],
from_fields: Union[List[str], Tuple[str, str]],
to_fields: Union[List[None], List[str], Tuple[str, str]],
rel: Optional[ForeignObjectRel] = ...,
related_name: Optional[str] = ...,
related_query_name: None = ...,

View File

@@ -1,5 +1,6 @@
from django.core.exceptions import ObjectDoesNotExist
from django.db.models.base import Model
from django.db.models.expressions import F
from django.db.models.fields.related import ForeignObject
from django.db.models.fields.reverse_related import (
ForeignObjectRel,
@@ -8,24 +9,33 @@ from django.db.models.fields.reverse_related import (
)
from django.db.models.query import QuerySet
from typing import (
Any,
Callable,
List,
Optional,
Tuple,
Type,
Union,
)
class ForwardManyToOneDescriptor:
@cached_property
def RelatedObjectDoesNotExist(self) -> Type[ObjectDoesNotExist]: ...
def __get__(self, instance: Any, cls: Any = ...) -> Any: ...
def __get__(
self,
instance: Optional[Model],
cls: Type[Model] = ...
) -> Optional[Union[Model, ForwardManyToOneDescriptor]]: ...
def __init__(self, field_with_rel: ForeignObject) -> None: ...
def __set__(self, instance: Model, value: Any) -> None: ...
def __set__(
self,
instance: Model,
value: Optional[Union[Model, F]]
) -> None: ...
def get_object(self, instance: Model) -> Model: ...
def get_prefetch_queryset(
self,
instances: Any,
instances: List[Model],
queryset: Optional[QuerySet] = ...
) -> Tuple[QuerySet, Callable, Callable, bool, str, bool]: ...
def get_queryset(self, **hints) -> QuerySet: ...
@@ -33,7 +43,7 @@ class ForwardManyToOneDescriptor:
class ForwardOneToOneDescriptor:
def __set__(self, instance: Model, value: Any) -> None: ...
def __set__(self, instance: Model, value: Optional[Model]) -> None: ...
def get_object(self, instance: Model) -> Model: ...
@@ -45,7 +55,7 @@ class ReverseManyToOneDescriptor:
def __get__(
self,
instance: Optional[Model],
cls: Any = ...
cls: Type[Model] = ...
) -> ReverseManyToOneDescriptor: ...
def __init__(self, rel: ForeignObjectRel) -> None: ...
def _get_set_deprecation_msg_params(self) -> Tuple[str, str]: ...
@@ -54,7 +64,11 @@ class ReverseManyToOneDescriptor:
class ReverseOneToOneDescriptor:
@cached_property
def RelatedObjectDoesNotExist(self) -> Type[ObjectDoesNotExist]: ...
def __get__(self, instance: Any, cls: Any = ...) -> Any: ...
def __get__(
self,
instance: Optional[Model],
cls: Type[Model] = ...
) -> Union[Model, ReverseOneToOneDescriptor]: ...
def __init__(self, related: OneToOneRel) -> None: ...
def __set__(self, instance: Model, value: Optional[Model]) -> None: ...
def get_queryset(self, **hints) -> QuerySet: ...

View File

@@ -32,13 +32,13 @@ class MultiColSource:
self,
alias: str,
targets: Union[Tuple[IntegerField, related.ForeignKey], Tuple[IntegerField, IntegerField]],
sources: Union[Tuple[AutoField, IntegerField], Tuple[IntegerField, AutoField]],
sources: Union[Tuple[IntegerField, AutoField], Tuple[AutoField, IntegerField]],
field: related.ForeignObject
) -> None: ...
def get_lookup(
self,
lookup: str
) -> Type[Union[RelatedIn, RelatedExact]]: ...
) -> Type[Union[RelatedExact, RelatedIn]]: ...
def relabeled_clone(
self,
relabels: OrderedDict
@@ -50,8 +50,8 @@ class RelatedIn:
self,
compiler: SQLCompiler,
connection: DatabaseWrapper
) -> Union[Tuple[str, List[int]], Tuple[str, List[Any]], Tuple[str, List[str]]]: ...
def get_prep_lookup(self) -> Union[List[UUID], Query, List[int], List[str]]: ...
) -> Union[Tuple[str, List[int]], Tuple[str, List[str]], Tuple[str, List[Any]]]: ...
def get_prep_lookup(self) -> Union[Query, List[int], List[UUID], List[str]]: ...
class RelatedLookupMixin:
@@ -59,5 +59,5 @@ class RelatedLookupMixin:
self,
compiler: SQLCompiler,
connection: DatabaseWrapper
) -> Union[Tuple[str, List[int]], Tuple[str, List[Any]], Tuple[str, List[str]]]: ...
) -> Union[Tuple[str, List[int]], Tuple[str, List[str]], Tuple[str, List[Any]]]: ...
def get_prep_lookup(self) -> Any: ...

View File

@@ -44,7 +44,7 @@ class ForeignObjectRel:
def __repr__(self) -> str: ...
@property
def db_type(self) -> Callable: ...
def get_accessor_name(self, model: Any = ...) -> Optional[str]: ...
def get_accessor_name(self, model: Optional[Type[Model]] = ...) -> Optional[str]: ...
def get_cache_name(self) -> str: ...
def get_choices(
self,
@@ -62,7 +62,7 @@ class ForeignObjectRel:
def get_lookup(
self,
lookup_name: str
) -> Type[Union[RelatedIsNull, RelatedIn, RelatedExact]]: ...
) -> Type[Union[RelatedIsNull, RelatedExact, RelatedIn]]: ...
def get_path_info(
self,
filtered_relation: Optional[FilteredRelation] = ...
@@ -81,7 +81,7 @@ class ForeignObjectRel:
@cached_property
def one_to_one(self) -> bool: ...
@cached_property
def related_model(self) -> Any: ...
def related_model(self) -> Type[Model]: ...
@property
def remote_field(
self

View File

@@ -35,7 +35,7 @@ class Concat:
def __init__(self, *expressions, **extra) -> None: ...
def _paired(
self,
expressions: Union[Tuple[Value, str], Tuple[str, str], Tuple[Value, str, Value]]
expressions: Union[Tuple[Value, str, Value], Tuple[Value, str], Tuple[str, str]]
) -> ConcatPair: ...
@@ -75,7 +75,7 @@ class Ord:
compiler: SQLCompiler,
connection: DatabaseWrapper,
**extra_context
) -> Union[Tuple[str, List[Any]], Tuple[str, List[str]]]: ...
) -> Union[Tuple[str, List[str]], Tuple[str, List[Any]]]: ...
class Replace:

View File

@@ -7,6 +7,7 @@ from django.db.models.expressions import (
Expression,
Ref,
)
from django.db.models.fields.related_lookups import MultiColSource
from django.db.models.sql.compiler import SQLCompiler
from django.db.models.sql.query import Query
from django.utils.datastructures import OrderedSet
@@ -34,7 +35,7 @@ class BuiltinLookup:
compiler: SQLCompiler,
connection: DatabaseWrapper,
lhs: Optional[Col] = ...
) -> Union[Tuple[str, List[str]], Tuple[str, List[int]], Tuple[str, List[Union[str, int]]], Tuple[str, List[Any]]]: ...
) -> Union[Tuple[str, List[int]], Tuple[str, List[Union[str, int]]], Tuple[str, List[Any]], Tuple[str, List[str]]]: ...
class Exact:
@@ -64,11 +65,11 @@ class FieldGetDbPrepValueIterableMixin:
connection: DatabaseWrapper,
sql: str,
param: Any
) -> Union[Tuple[str, List[None]], Tuple[str, List[int]], Tuple[str, List[Any]], Tuple[str, List[str]]]: ...
) -> Union[Tuple[str, List[None]], Tuple[str, List[int]], Tuple[str, List[str]], Tuple[str, List[Any]]]: ...
class FieldGetDbPrepValueMixin:
def get_db_prep_lookup(self, value: Any, connection: DatabaseWrapper) -> Any: ...
def get_db_prep_lookup(self, value: object, connection: DatabaseWrapper) -> Any: ...
class IExact:
@@ -76,7 +77,7 @@ class IExact:
self,
qn: SQLCompiler,
connection: DatabaseWrapper
) -> Union[Tuple[str, List[Any]], Tuple[str, List[str]]]: ...
) -> Union[Tuple[str, List[str]], Tuple[str, List[Any]]]: ...
class In:
@@ -108,7 +109,11 @@ class IsNull:
class Lookup:
def __init__(self, lhs: Any, rhs: Any) -> None: ...
def __init__(
self,
lhs: Union[MultiColSource, Expression],
rhs: object
) -> None: ...
def apply_bilateral_transforms(
self,
value: Expression
@@ -130,7 +135,7 @@ class Lookup:
) -> Union[Tuple[str, List[int]], Tuple[str, List[SafeText]], Tuple[str, List[str]]]: ...
def get_group_by_cols(
self
) -> Union[List[Col], List[CombinedExpression]]: ...
) -> Union[List[CombinedExpression], List[Col]]: ...
def get_prep_lookup(self) -> Any: ...
def get_source_expressions(self) -> List[Col]: ...
def process_lhs(
@@ -147,7 +152,7 @@ class Lookup:
def relabeled_clone(
self,
relabels: Union[OrderedDict, Dict[str, str], Dict[Union[str, None], str]]
) -> BuiltinLookup: ...
) -> Union[IsNull, StartsWith, FieldGetDbPrepValueMixin, IContains]: ...
def rhs_is_direct_value(self) -> bool: ...
def set_source_expressions(self, new_exprs: List[Ref]) -> None: ...
@@ -158,7 +163,7 @@ class PatternLookup:
self,
qn: SQLCompiler,
connection: DatabaseWrapper
) -> Union[Tuple[str, List[str]], Tuple[str, List[int]], Tuple[str, List[Any]]]: ...
) -> Union[Tuple[str, List[int]], Tuple[str, List[str]], Tuple[str, List[Any]]]: ...
class Range:
@@ -194,7 +199,7 @@ class YearExact:
self,
compiler: SQLCompiler,
connection: DatabaseWrapper
) -> Union[Tuple[str, List[Any]], Tuple[str, List[str]]]: ...
) -> Union[Tuple[str, List[str]], Tuple[str, List[Any]]]: ...
class YearGt:

View File

@@ -1,3 +1,5 @@
from django.contrib.admin.models import LogEntry
from django.contrib.auth.models import Permission
from django.db.models.base import Model
from django.db.models.query import QuerySet
from typing import (
@@ -16,16 +18,20 @@ class BaseManager:
def __eq__(self, other: Optional[Manager]) -> bool: ...
def __init__(self) -> None: ...
@staticmethod
def __new__(cls: Any, *args, **kwargs) -> Manager: ...
def __new__(cls: Type[Manager], *args, **kwargs) -> Manager: ...
@classmethod
def _get_queryset_methods(cls, queryset_class: Any) -> Dict[str, Callable]: ...
def _get_queryset_methods(cls, queryset_class: Type[QuerySet]) -> Dict[str, Callable]: ...
def _set_creation_counter(self) -> None: ...
def all(self) -> QuerySet: ...
def check(self, **kwargs) -> List[Any]: ...
def contribute_to_class(self, model: Any, name: str) -> None: ...
def contribute_to_class(self, model: Type[Model], name: str) -> None: ...
@property
def db(self) -> str: ...
def db_manager(self, using: Optional[str] = ..., hints: Any = ...) -> Manager: ...
def db_manager(
self,
using: Optional[str] = ...,
hints: Optional[Union[Dict[str, Model], Dict[str, LogEntry], Dict[str, Permission]]] = ...
) -> Manager: ...
def deconstruct(
self
) -> Union[Tuple[bool, str, None, Tuple[str, str, int, int], Dict[Any, Any]], Tuple[bool, str, None, Tuple, Dict[Any, Any]]]: ...

View File

@@ -1,7 +1,17 @@
from django.contrib.contenttypes.fields import GenericForeignKey
from django.db.models.base import Model
from django.db.models.fields import (
DateTimeCheckMixin,
Field,
)
from django.utils.datastructures import ImmutableList
from typing import (
Any,
Dict,
Optional,
Set,
Type,
Union,
)
@@ -11,14 +21,16 @@ class Options:
def __str__(self) -> str: ...
def _expire_cache(self, forward: bool = ..., reverse: bool = ...) -> None: ...
@cached_property
def _forward_fields_map(self) -> Dict[str, Any]: ...
def _forward_fields_map(
self
) -> Dict[str, Union[GenericForeignKey, Field, DateTimeCheckMixin]]: ...
def _get_fields(
self,
forward: bool = ...,
reverse: bool = ...,
include_parents: object = ...,
include_hidden: bool = ...,
seen_models: Any = ...
seen_models: Optional[Set[Type[Model]]] = ...
) -> ImmutableList: ...
def _populate_directed_relation_graph(self) -> Any: ...
def _prepare(self, model: Any) -> None: ...
def _prepare(self, model: Type[Model]) -> None: ...

View File

@@ -6,6 +6,7 @@ from typing import (
Iterator,
Optional,
Tuple,
Type,
Union,
)
@@ -37,7 +38,7 @@ class NamedValuesListIterable:
class Prefetch:
def __eq__(self, other: None) -> bool: ...
def __getstate__(self) -> Dict[str, Union[str, QuerySet, None]]: ...
def __getstate__(self) -> Dict[str, Optional[Union[str, QuerySet]]]: ...
def __hash__(self) -> int: ...
def __init__(
self,
@@ -58,7 +59,7 @@ class QuerySet:
def __getstate__(self) -> Dict[str, Any]: ...
def __init__(
self,
model: Any = ...,
model: Type[Model] = ...,
query: Optional[Query] = ...,
using: Optional[str] = ...,
hints: Dict[str, Model] = ...

View File

@@ -2,9 +2,16 @@ from collections import OrderedDict
from django.db.backends.sqlite3.base import DatabaseWrapper
from django.db.models.base import Model
from django.db.models.expressions import F
from django.db.models.fields import Field
from django.db.models.fields import (
DateTimeCheckMixin,
Field,
)
from django.db.models.fields.related import ForeignKey
from django.db.models.fields.reverse_related import ManyToOneRel
from django.db.models.lookups import (
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
@@ -17,12 +24,13 @@ from typing import (
Optional,
Set,
Tuple,
Type,
Union,
)
def check_rel_lookup_compatibility(
model: Any,
model: Type[Model],
target_opts: Options,
field: Union[ManyToOneRel, ForeignKey]
) -> bool: ...
@@ -32,7 +40,7 @@ def refs_expression(lookup_parts: List[str], annotations: OrderedDict) -> Any: .
def select_related_descend(
field: Field,
field: Union[Field, DateTimeCheckMixin],
restricted: bool,
requested: Any,
load_fields: Optional[Set[str]],
@@ -40,15 +48,17 @@ def select_related_descend(
) -> bool: ...
def subclasses(cls: Any) -> Iterator[Any]: ...
def subclasses(
cls: Type[Union[Field, Transform]]
) -> Iterator[Type[Union[Field, Transform]]]: ...
class DeferredAttribute:
def __get__(
self,
instance: Any,
cls: Any = ...
) -> Optional[Union[DeferredAttribute, str, int]]: ...
instance: Optional[Model],
cls: Type[Model] = ...
) -> Optional[Union[str, int, DeferredAttribute]]: ...
def __init__(self, field_name: str) -> None: ...
def _check_parent_chain(self, instance: Model, name: str) -> None: ...
@@ -60,7 +70,7 @@ class FilteredRelation:
self,
compiler: SQLCompiler,
connection: DatabaseWrapper
) -> Union[Tuple[str, List[str]], Tuple[str, List[int]], Tuple[str, List[Union[int, str]]], Tuple[str, List[Any]]]: ...
) -> Union[Tuple[str, List[int]], Tuple[str, List[str]], Tuple[str, List[Any]], Tuple[str, List[Union[int, str]]]]: ...
def clone(self) -> FilteredRelation: ...
@@ -72,7 +82,7 @@ class Q:
def _combine(self, other: Q, conn: str) -> Q: ...
def deconstruct(
self
) -> Union[Tuple[str, Tuple, Dict[str, F]], Tuple[str, Tuple[Tuple[str, F], Tuple[str, F]], Dict[Any, Any]], Tuple[str, Tuple[Q], Dict[Any, Any]]]: ...
) -> Union[Tuple[str, Tuple[Tuple[str, F], Tuple[str, F]], Dict[Any, Any]], Tuple[str, Tuple, Dict[str, F]], Tuple[str, Tuple[Q], Dict[Any, Any]]]: ...
def resolve_expression(
self,
query: Query = ...,
@@ -98,12 +108,22 @@ class RegisterLookupMixin:
@classmethod
def _get_lookup(cls, lookup_name: str) -> Any: ...
@classmethod
def _unregister_lookup(cls, lookup: Any, lookup_name: Optional[str] = ...) -> None: ...
def _unregister_lookup(
cls,
lookup: Type[Union[Lookup, Transform]],
lookup_name: Optional[str] = ...
) -> None: ...
def get_lookup(self, lookup_name: str) -> Any: ...
@classmethod
def get_lookups(cls) -> Dict[str, Any]: ...
def get_transform(self, lookup_name: str) -> Any: ...
def get_lookups(cls) -> Dict[str, Type[Union[Lookup, Transform]]]: ...
def get_transform(self, lookup_name: str) -> object: ...
@staticmethod
def merge_dicts(dicts: Any) -> Dict[str, Any]: ...
def merge_dicts(
dicts: Any
) -> Dict[str, Type[Union[Lookup, Transform]]]: ...
@classmethod
def register_lookup(cls, lookup: Any, lookup_name: Optional[str] = ...) -> Any: ...
def register_lookup(
cls,
lookup: Type[Union[Lookup, Transform]],
lookup_name: Optional[str] = ...
) -> Type[Union[Lookup, Transform]]: ...

View File

@@ -1,8 +1,12 @@
from django.apps.registry import Apps
from django.contrib.sites.models import Site
from django.db.models.base import Model
from typing import (
Any,
Callable,
Optional,
Type,
Union,
)
@@ -18,7 +22,7 @@ class ModelSignal:
def connect(
self,
receiver: Callable,
sender: Any = ...,
sender: Optional[Union[Type[Site], Type[Model]]] = ...,
weak: bool = ...,
dispatch_uid: None = ...,
apps: None = ...
@@ -26,7 +30,7 @@ class ModelSignal:
def disconnect(
self,
receiver: Callable = ...,
sender: Any = ...,
sender: Optional[Type[Model]] = ...,
dispatch_uid: None = ...,
apps: None = ...
) -> bool: ...

View File

@@ -1,5 +1,6 @@
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 (
Col,
CombinedExpression,
@@ -21,6 +22,7 @@ from typing import (
Optional,
Set,
Tuple,
Type,
Union,
)
@@ -44,14 +46,14 @@ class SQLCompiler:
alias: str,
columns: List[str],
compiler: SQLCompiler
) -> Union[Tuple[str, Tuple[str]], Tuple[str, Tuple]]: ...
) -> Union[Tuple[str, Tuple], Tuple[str, Tuple[str]]]: ...
def collapse_group_by(
self,
expressions: Union[List[Col], List[Union[Col, Trunc]], List[Expression], List[Union[Col, CombinedExpression]]],
having: Union[List[Col], Tuple, List[CombinedExpression]]
) -> Union[List[Col], List[Union[Col, Trunc]], List[Expression], List[Union[Col, CombinedExpression]]]: ...
expressions: Union[List[Union[Col, CombinedExpression]], List[Expression], List[Col], List[Union[Col, Trunc]]],
having: Union[List[CombinedExpression], List[Col], Tuple]
) -> Union[List[Union[Col, CombinedExpression]], List[Expression], List[Col], List[Union[Col, Trunc]]]: ...
def compile(self, node: Any, select_format: object = ...) -> Any: ...
def deferred_to_columns(self) -> Any: ...
def deferred_to_columns(self) -> Dict[Type[Model], Set[str]]: ...
def execute_sql(
self,
result_type: str = ...,
@@ -65,7 +67,7 @@ class SQLCompiler:
opts: Options,
alias: Optional[str] = ...,
default_order: str = ...,
already_seen: Optional[Union[Set[Tuple[None, Tuple[Tuple[str, str]]]], Set[Tuple[None, Tuple[Tuple[str, str]], Tuple[Tuple[str, str]], Tuple[Tuple[str, str]]]], Set[Union[Tuple[None, Tuple[Tuple[str, str]]], Tuple[Tuple[Tuple[str, str]], Tuple[Tuple[str, str]]]]]]] = ...
already_seen: Optional[Union[Set[Tuple[None, Tuple[Tuple[str, str]]]], Set[Union[Tuple[None, Tuple[Tuple[str, str]]], Tuple[Tuple[Tuple[str, str]], Tuple[Tuple[str, str]]]]], Set[Tuple[None, Tuple[Tuple[str, str]], Tuple[Tuple[str, str]], Tuple[Tuple[str, str]]]]]] = ...
) -> List[Tuple[OrderBy, bool]]: ...
def get_combinator_sql(
self,
@@ -77,22 +79,22 @@ class SQLCompiler:
self,
start_alias: Optional[str] = ...,
opts: Optional[Options] = ...,
from_parent: Any = ...
from_parent: Optional[Type[Model]] = ...
) -> List[Col]: ...
def get_distinct(self) -> Tuple[List[Any], List[Any]]: ...
def get_extra_select(
self,
order_by: Union[List[Tuple[OrderBy, Tuple[str, List[Any], bool]]], List[Union[Tuple[OrderBy, Tuple[str, List[int], bool]], Tuple[OrderBy, Tuple[str, List[Any], bool]]]], List[Tuple[OrderBy, Tuple[str, Tuple, bool]]]],
order_by: Union[List[Tuple[OrderBy, Tuple[str, List[Any], bool]]], List[Tuple[OrderBy, Tuple[str, Tuple, bool]]], List[Union[Tuple[OrderBy, Tuple[str, List[int], bool]], Tuple[OrderBy, Tuple[str, List[Any], bool]]]]],
select: Any
) -> List[Tuple[OrderBy, Tuple[str, List[Any]], None]]: ...
def get_from_clause(
self
) -> Union[Tuple[List[str], List[Union[int, str]]], Tuple[List[str], List[Any]], Tuple[List[str], List[int]], Tuple[List[str], List[str]]]: ...
) -> Union[Tuple[List[str], List[Any]], Tuple[List[str], List[Union[int, str]]], Tuple[List[str], List[int]], Tuple[List[str], List[str]]]: ...
def get_group_by(
self,
select: Any,
order_by: Any
) -> Union[List[Union[Tuple[str, List[Any]], Tuple[str, List[str]]]], List[Tuple[str, List[Any]]], List[Union[Tuple[str, List[Any]], Tuple[str, List[int]]]]]: ...
) -> Union[List[Tuple[str, List[Any]]], List[Union[Tuple[str, List[Any]], Tuple[str, List[str]]]], List[Union[Tuple[str, List[Any]], Tuple[str, List[int]]]]]: ...
def get_order_by(self) -> Any: ...
def get_related_selections(
self,
@@ -102,7 +104,7 @@ class SQLCompiler:
cur_depth: int = ...,
requested: Any = ...,
restricted: Optional[bool] = ...
) -> Any: ...
) -> List[Dict[str, Any]]: ...
def get_select(self) -> Any: ...
def has_results(self) -> bool: ...
def pre_sql_setup(self) -> Any: ...

View File

@@ -31,7 +31,7 @@ class BaseTable:
class Join:
def __eq__(
self,
other: Union[Join, BaseTable]
other: Union[BaseTable, Join]
) -> bool: ...
def __init__(
self,
@@ -47,17 +47,17 @@ class Join:
self,
compiler: SQLCompiler,
connection: DatabaseWrapper
) -> Union[Tuple[str, List[int]], Tuple[str, List[Any]], Tuple[str, List[str]]]: ...
) -> Union[Tuple[str, List[int]], Tuple[str, List[str]], Tuple[str, List[Any]]]: ...
def demote(self) -> Join: ...
def equals(
self,
other: Union[Join, BaseTable],
other: Union[BaseTable, Join],
with_filtered_relation: bool
) -> bool: ...
def promote(self) -> Join: ...
def relabeled_clone(
self,
change_map: Union[Dict[str, str], OrderedDict]
change_map: Union[OrderedDict, Dict[str, str]]
) -> Join: ...

View File

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

View File

@@ -41,4 +41,4 @@ class UpdateQuery:
def add_update_values(self, values: Dict[str, Any]) -> None: ...
def clone(self) -> UpdateQuery: ...
def get_related_updates(self) -> List[UpdateQuery]: ...
def update_batch(self, pk_list: List[int], values: Dict[str, Union[None, int]], using: str) -> None: ...
def update_batch(self, pk_list: List[int], values: Dict[str, Optional[int]], using: str) -> None: ...

View File

@@ -79,7 +79,7 @@ class WhereNode:
) -> Union[List[CombinedExpression], List[Col]]: ...
def get_source_expressions(
self
) -> Union[List[GreaterThan], List[IntegerLessThan], List[Exact], List[LessThanOrEqual]]: ...
) -> Union[List[GreaterThan], List[LessThanOrEqual], List[Exact], List[IntegerLessThan]]: ...
def relabel_aliases(
self,
change_map: Union[OrderedDict, Dict[str, str], Dict[Union[str, None], str]]
@@ -96,4 +96,4 @@ class WhereNode:
def split_having(
self,
negated: bool = ...
) -> Union[Tuple[WhereNode, None], Tuple[None, WhereNode], Tuple[WhereNode, WhereNode]]: ...
) -> Union[Tuple[None, WhereNode], Tuple[WhereNode, WhereNode], Tuple[WhereNode, None]]: ...