third iteration of stubs

This commit is contained in:
Maxim Kurnikov
2018-08-11 00:19:50 +03:00
parent fa718b8e55
commit c6bceb19f4
216 changed files with 16306 additions and 3006 deletions

View File

@@ -1,17 +1,26 @@
from typing import Any, Callable, Dict, List, Optional, Tuple, Type, Union
from uuid import UUID
from django.core.checks.messages import Error, Warning
from django.db.backends.sqlite3.base import DatabaseWrapper
from django.db.models.base import Model
from django.db.models.fields import AutoField
from django.db.models.fields.related_lookups import (RelatedExact,
RelatedGreaterThan,
from django.db.models.expressions import Col
from django.db.models.fields import Field
from django.db.models.fields.mixins import FieldCacheMixin
from django.db.models.fields.related_lookups import (RelatedGreaterThan,
RelatedGreaterThanOrEqual,
RelatedIn, RelatedIsNull,
RelatedLessThan,
RelatedLessThanOrEqual)
from django.db.models.fields.reverse_related import ManyToManyRel, ManyToOneRel
from django.db.models.query_utils import Q
from django.db.models.fields.reverse_related import (ForeignObjectRel,
ManyToManyRel,
ManyToOneRel)
from django.db.models.lookups import Exact
from django.db.models.query import QuerySet
from django.db.models.query_utils import PathInfo, Q
from django.db.models.sql.where import WhereNode
from django.forms.fields import Field
from django.forms.models import ModelChoiceField, ModelMultipleChoiceField
from . import Field
from .mixins import FieldCacheMixin
@@ -41,9 +50,9 @@ class RelatedField(FieldCacheMixin, Field):
one_to_one: bool = ...
many_to_many: bool = ...
many_to_one: bool = ...
def related_model(self) -> str: ...
def check(self, **kwargs: Any): ...
def db_type(self, connection: Any): ...
def related_model(self) -> Union[Type[Model], str]: ...
def check(self, **kwargs: Any) -> List[Error]: ...
def db_type(self, connection: DatabaseWrapper) -> None: ...
opts: Any = ...
def contribute_to_class(
self,
@@ -54,8 +63,32 @@ class RelatedField(FieldCacheMixin, Field):
) -> None: ...
def deconstruct(
self
) -> Tuple[None, str, List[Any], Dict[str, Union[str, bool]]]: ...
def get_forward_related_filter(self, obj: Any): ...
) -> Union[
Tuple[
str,
List[Any],
Dict[str, Union[Dict[str, Union[int, str]], bool]],
Dict[str, Union[Dict[str, Union[int, str]], bool]],
],
Tuple[
str,
List[Any],
Union[
Dict[str, Union[Callable, bool, str]],
Dict[str, Union[Dict[str, bool], bool, str]],
],
Union[
Dict[str, Union[Callable, bool, str]],
Dict[str, Union[Dict[str, bool], bool, str]],
],
],
Tuple[
str, str, List[Any], Dict[str, Union[Dict[str, bool], bool, str]]
],
]: ...
def get_forward_related_filter(
self, obj: Model
) -> Union[Dict[str, int], Dict[str, UUID]]: ...
def get_reverse_related_filter(self, obj: Model) -> Q: ...
@property
def swappable_setting(self) -> Optional[str]: ...
@@ -65,12 +98,12 @@ class RelatedField(FieldCacheMixin, Field):
def do_related_class(
self, other: Type[Model], cls: Type[Model]
) -> None: ...
def get_limit_choices_to(self): ...
def formfield(self, **kwargs: Any): ...
def related_query_name(self): ...
def get_limit_choices_to(self) -> Dict[str, int]: ...
def formfield(self, **kwargs: Any) -> Field: ...
def related_query_name(self) -> str: ...
@property
def target_field(self): ...
def get_cache_name(self): ...
def target_field(self) -> Field: ...
def get_cache_name(self) -> str: ...
class ForeignObject(RelatedField):
many_to_many: bool = ...
@@ -88,9 +121,9 @@ class ForeignObject(RelatedField):
self,
to: Union[Type[Model], str],
on_delete: Callable,
from_fields: List[str],
to_fields: Union[List[None], List[str]],
rel: ManyToOneRel = ...,
from_fields: Union[List[str], Tuple[str, str]],
to_fields: Union[List[None], List[str], Tuple[str, str]],
rel: Optional[ForeignObjectRel] = ...,
related_name: None = ...,
related_query_name: None = ...,
limit_choices_to: None = ...,
@@ -98,34 +131,68 @@ class ForeignObject(RelatedField):
swappable: bool = ...,
**kwargs: Any
) -> None: ...
def check(self, **kwargs: Any): ...
def check(self, **kwargs: Any) -> List[Any]: ...
def deconstruct(
self
) -> Tuple[
None,
str,
List[Any],
Dict[str, Union[str, bool, Callable, List[str], List[None]]],
) -> Union[
Tuple[
None,
str,
List[Any],
Dict[
str,
Union[
Callable,
Dict[str, Union[int, str]],
List[None],
List[str],
bool,
str,
],
],
],
Tuple[
str,
str,
List[Any],
Union[
Dict[
str,
Union[
Callable,
Dict[str, Union[int, str]],
List[str],
bool,
str,
],
],
Dict[str, Union[Callable, List[None], List[str], bool, str]],
],
],
]: ...
def resolve_related_fields(self) -> List[Tuple[ForeignKey, AutoField]]: ...
def resolve_related_fields(self) -> List[Tuple[Field, Field]]: ...
@property
def related_fields(self) -> List[Tuple[ForeignKey, AutoField]]: ...
def related_fields(self) -> List[Tuple[Field, Field]]: ...
@property
def reverse_related_fields(self): ...
def reverse_related_fields(self) -> List[Tuple[Field, Field]]: ...
@property
def local_related_fields(self): ...
def local_related_fields(self) -> Tuple[Field]: ...
@property
def foreign_related_fields(self) -> Tuple[AutoField]: ...
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: Any): ...
) -> Tuple[Optional[Union[int, str, UUID]]]: ...
def get_foreign_related_value(
self, instance: Model
) -> Tuple[Optional[Union[int, str, UUID]]]: ...
@staticmethod
def get_instance_value_for_fields(
instance: Model, fields: Tuple[ForeignKey]
) -> Tuple[Optional[int]]: ...
def get_attname_column(self): ...
def get_joining_columns(self, reverse_join: bool = ...): ...
instance: Model, fields: Tuple[Field]
) -> Tuple[Optional[Union[int, str, UUID]]]: ...
def get_attname_column(self) -> Tuple[str, None]: ...
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
@@ -133,7 +200,9 @@ class ForeignObject(RelatedField):
def get_extra_restriction(
self, where_class: Type[WhereNode], alias: str, related_alias: str
) -> None: ...
def get_path_info(self, filtered_relation: Optional[Any] = ...): ...
def get_path_info(
self, filtered_relation: None = ...
) -> List[PathInfo]: ...
def get_reverse_path_info(self, filtered_relation: Optional[Any] = ...): ...
@classmethod
def get_lookups(
@@ -142,13 +211,13 @@ class ForeignObject(RelatedField):
str,
Type[
Union[
RelatedIn,
RelatedExact,
RelatedLessThan,
RelatedGreaterThan,
RelatedGreaterThanOrEqual,
RelatedLessThanOrEqual,
RelatedIn,
RelatedIsNull,
RelatedLessThan,
RelatedLessThanOrEqual,
Exact,
]
],
]: ...
@@ -160,7 +229,7 @@ class ForeignObject(RelatedField):
**kwargs: Any
) -> None: ...
def contribute_to_related_class(
self, cls: Type[Model], related: ManyToOneRel
self, cls: Type[Model], related: ForeignObjectRel
) -> None: ...
class ForeignKey(ForeignObject):
@@ -179,42 +248,80 @@ class ForeignKey(ForeignObject):
on_delete: Callable,
related_name: Optional[str] = ...,
related_query_name: None = ...,
limit_choices_to: Optional[Callable] = ...,
limit_choices_to: Optional[
Union[Callable, Dict[str, Union[int, str]]]
] = ...,
parent_link: bool = ...,
to_field: Optional[str] = ...,
db_constraint: bool = ...,
**kwargs: Any
) -> None: ...
def check(self, **kwargs: Any): ...
def check(self, **kwargs: Any) -> List[Warning]: ...
def deconstruct(
self
) -> Tuple[None, str, List[Any], Dict[str, Union[str, bool, Callable]]]: ...
def to_python(self, value: str) -> int: ...
) -> Union[
Tuple[
str,
List[Any],
Dict[str, Union[Callable, Dict[str, Union[int, str]], str]],
Dict[str, Union[Callable, Dict[str, Union[int, str]], str]],
],
Tuple[
str,
List[Any],
Union[
Dict[str, Union[Callable, Dict[str, bool], str]],
Dict[str, Union[Callable, bool, str]],
],
Union[
Dict[str, Union[Callable, Dict[str, bool], str]],
Dict[str, Union[Callable, bool, str]],
],
],
]: ...
def to_python(self, value: Union[int, str]) -> int: ...
@property
def target_field(self) -> AutoField: ...
def get_reverse_path_info(self, filtered_relation: Optional[Any] = ...): ...
def validate(self, value: Any, model_instance: Any): ...
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_attname(self) -> str: ...
def get_attname_column(self) -> Tuple[str, str]: ...
def get_default(self): ...
def get_db_prep_save(self, value: Any, connection: Any): ...
def get_default(self) -> Optional[int]: ...
def get_db_prep_save(
self,
value: Optional[Union[int, str, UUID]],
connection: DatabaseWrapper,
) -> Optional[Union[int, str]]: ...
def get_db_prep_value(
self, value: Any, connection: Any, 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): ...
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[str, List[Any]]]: ...
) -> Dict[str, Union[List[Any], str]]: ...
def convert_empty_strings(
self, value: Any, expression: Any, connection: Any
): ...
def get_db_converters(self, connection: Any): ...
def get_col(self, alias: Any, output_field: Optional[Any] = ...): ...
def get_db_converters(self, connection: DatabaseWrapper) -> List[Any]: ...
def get_col(
self,
alias: str,
output_field: Optional[Union[Field, mixins.FieldCacheMixin]] = ...,
) -> Col: ...
class OneToOneField(ForeignKey):
many_to_many: bool = ...
@@ -227,14 +334,26 @@ class OneToOneField(ForeignKey):
description: Any = ...
def __init__(
self,
to: Type[Model],
to: Union[Type[Model], str],
on_delete: Callable,
to_field: None = ...,
to_field: Optional[str] = ...,
**kwargs: Any
) -> None: ...
def deconstruct(self): ...
def deconstruct(
self
) -> Union[
Tuple[
str,
List[Any],
Dict[str, Union[Callable, bool, str]],
Dict[str, Union[Callable, bool, str]],
],
Tuple[str, str, List[Any], Dict[str, Union[Callable, str]]],
]: ...
def formfield(self, **kwargs: Any) -> None: ...
def save_form_data(self, instance: Any, data: Any) -> None: ...
def save_form_data(
self, instance: Model, data: Optional[Model]
) -> None: ...
def create_many_to_many_intermediary_model(field: Any, klass: Any): ...
@@ -250,22 +369,41 @@ class ManyToManyField(RelatedField):
swappable: Any = ...
def __init__(
self,
to: Type[Model],
to: Union[Type[Model], str],
related_name: Optional[str] = ...,
related_query_name: Optional[str] = ...,
limit_choices_to: Optional[Callable] = ...,
symmetrical: None = ...,
through: None = ...,
through_fields: None = ...,
symmetrical: Optional[bool] = ...,
through: Optional[str] = ...,
through_fields: Optional[Tuple[str, str]] = ...,
db_constraint: bool = ...,
db_table: None = ...,
swappable: bool = ...,
**kwargs: Any
) -> None: ...
def check(self, **kwargs: Any): ...
def deconstruct(self): ...
def get_path_info(self, filtered_relation: Optional[Any] = ...): ...
def get_reverse_path_info(self, filtered_relation: Optional[Any] = ...): ...
def check(self, **kwargs: Any) -> List[Any]: ...
def deconstruct(
self
) -> Union[
Tuple[
str,
List[Any],
Dict[str, Union[Callable, str]],
Dict[str, Union[Callable, str]],
],
Tuple[
str,
List[Any],
Dict[str, Union[bool, str]],
Dict[str, Union[bool, 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
@@ -280,9 +418,11 @@ class ManyToManyField(RelatedField):
self, cls: Type[Model], related: ManyToManyRel
) -> None: ...
def set_attributes_from_rel(self) -> None: ...
def value_from_object(self, obj: Any): ...
def save_form_data(self, instance: Any, data: Any) -> None: ...
def formfield(self, *, using: Optional[Any] = ..., **kwargs: Any): ...
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 db_check(self, connection: Any): ...
def db_type(self, connection: Any): ...
def db_parameters(self, connection: Any): ...
def db_parameters(self, connection: DatabaseWrapper) -> Dict[str, None]: ...