better stubs

This commit is contained in:
Maxim Kurnikov
2018-08-05 03:13:19 +03:00
parent 4013fe4d03
commit fa718b8e55
380 changed files with 11805 additions and 8503 deletions

View File

@@ -1,26 +1,14 @@
# Stubs for django.db.models.fields (Python 3.6)
#
# NOTE: This dynamically typed stub was automatically generated by stubgen.
from typing import Any, Callable, Dict, List, Optional, Tuple, Type, Union
from django.core.exceptions import FieldDoesNotExist as FieldDoesNotExist
from django.db.models.query_utils import RegisterLookupMixin
from typing import Any, Optional
from datetime import date
from django.core.checks.messages import Error, Warning
from django.core.validators import EmailValidator, RegexValidator
from django.db.backends.sqlite3.base import DatabaseWrapper
from django.db.models.base import Model
from django.db.models.expressions import OuterRef
from django.db.models.sql.compiler import SQLCompiler
from django.forms.fields import (
BaseTemporalField,
BooleanField,
CharField,
IntegerField,
SplitDateTimeField,
TypedChoiceField,
)
from typing import Any, List, Optional, Type, Union
from django.db.models.fields.reverse_related import ManyToOneRel
from django.db.models.query_utils import RegisterLookupMixin
from django.forms.fields import (DecimalField, Field, ImageField, IntegerField,
TypedChoiceField, URLField)
class Empty: ...
class NOT_PROVIDED: ...
@@ -42,11 +30,9 @@ class Field(RegisterLookupMixin):
one_to_many: Any = ...
one_to_one: Any = ...
related_model: Any = ...
def _description(self): ...
description: Any = ...
name: Any = ...
verbose_name: Any = ...
_verbose_name: Any = ...
primary_key: Any = ...
remote_field: Any = ...
is_relation: Any = ...
@@ -60,60 +46,91 @@ class Field(RegisterLookupMixin):
help_text: Any = ...
db_index: Any = ...
db_column: Any = ...
_db_tablespace: Any = ...
auto_created: Any = ...
_validators: Any = ...
_error_messages: Any = ...
error_messages: Any = ...
def __init__(
self,
verbose_name: Optional[Any] = ...,
name: Optional[Any] = ...,
verbose_name: Optional[str] = ...,
name: None = ...,
primary_key: bool = ...,
max_length: Optional[Any] = ...,
max_length: Optional[int] = ...,
unique: bool = ...,
blank: bool = ...,
null: bool = ...,
db_index: bool = ...,
rel: Optional[Any] = ...,
default: Any = ...,
rel: Optional[ManyToOneRel] = ...,
default: Union[Callable, Type[NOT_PROVIDED]] = ...,
editable: bool = ...,
serialize: bool = ...,
unique_for_date: Optional[Any] = ...,
unique_for_month: Optional[Any] = ...,
unique_for_year: Optional[Any] = ...,
choices: Optional[Any] = ...,
unique_for_date: Optional[str] = ...,
unique_for_month: Optional[str] = ...,
unique_for_year: Optional[str] = ...,
choices: Optional[
Union[
List[Tuple[str, str]],
List[Tuple[int, str]],
Tuple[Tuple[int, str], Tuple[int, str], Tuple[int, str]],
Tuple[Tuple[str, str], Tuple[str, str]],
]
] = ...,
help_text: str = ...,
db_column: Optional[Any] = ...,
db_tablespace: Optional[Any] = ...,
db_column: None = ...,
db_tablespace: Optional[str] = ...,
auto_created: bool = ...,
validators: Any = ...,
error_messages: Optional[Any] = ...,
validators: Union[List[RegexValidator], Tuple] = ...,
error_messages: Optional[Dict[str, str]] = ...,
) -> None: ...
def __str__(self): ...
def __repr__(self): ...
def check(self, **kwargs: Any): ...
def _check_field_name(self): ...
def _check_choices(self): ...
def _check_db_index(self): ...
def _check_null_allowed_for_primary_keys(self): ...
def _check_backend_specific_checks(self, **kwargs: Any): ...
def _check_validators(self): ...
def _check_deprecation_details(self): ...
def get_col(self, alias: Any, output_field: Optional[Any] = ...): ...
def cached_col(self): ...
def select_format(self, compiler: Any, sql: Any, params: Any): ...
def deconstruct(self): ...
def clone(self): ...
def __eq__(self, other: Any): ...
def __lt__(self, other: Any): ...
def deconstruct(
self
) -> Union[
Tuple[
str,
List[Any],
Union[
Dict[str, Union[int, List[RegexValidator], Dict[str, str]]],
Dict[str, Union[bool, List[Tuple[int, str]]]],
Dict[str, Union[Callable, List[Tuple[int, str]]]],
Dict[str, int],
],
Union[
Dict[str, Union[int, List[RegexValidator], Dict[str, str]]],
Dict[str, Union[bool, List[Tuple[int, str]]]],
Dict[str, Union[Callable, List[Tuple[int, str]]]],
Dict[str, int],
Dict[Any, Any],
],
],
Tuple[
str,
List[Any],
Union[
Dict[str, Union[int, Callable, List[Tuple[str, str]]]],
Dict[str, Union[Callable, List[Tuple[int, str]]]],
Dict[str, Union[int, List[RegexValidator], Dict[str, str]]],
],
Union[
Dict[str, Union[int, Callable, List[Tuple[str, str]]]],
Dict[str, Union[Callable, List[Tuple[int, str]]]],
Dict[str, Union[int, List[RegexValidator], Dict[str, str]]],
],
],
]: ...
def clone(self) -> Field: ...
def __eq__(self, other: CharField) -> bool: ...
def __lt__(self, other: Field) -> bool: ...
def __hash__(self): ...
def __deepcopy__(self, memodict: Any): ...
def __copy__(self): ...
def __deepcopy__(self, memodict: Dict[Any, Any]) -> Field: ...
def __copy__(self) -> Field: ...
def __reduce__(self): ...
def get_pk_value_on_save(self, instance: Any): ...
def get_pk_value_on_save(self, instance: Model) -> None: ...
def to_python(self, value: Any): ...
def validators(self): ...
def validators(
self
) -> Union[List[RegexValidator], List[EmailValidator]]: ...
def run_validators(self, value: Any): ...
def validate(self, value: Any, model_instance: Any): ...
def clean(self, value: Any, model_instance: Any): ...
@@ -128,40 +145,40 @@ class Field(RegisterLookupMixin):
@property
def unique(self): ...
@property
def db_tablespace(self): ...
def db_tablespace(self) -> str: ...
concrete: Any = ...
def set_attributes_from_name(self, name: Any) -> None: ...
def set_attributes_from_name(self, name: str) -> None: ...
model: Any = ...
def contribute_to_class(
self, cls: Any, name: Any, private_only: bool = ...
self, cls: Type[Model], name: str, private_only: bool = ...
) -> None: ...
def get_filter_kwargs_for_object(self, obj: Any): ...
def get_attname(self): ...
def get_attname_column(self): ...
def get_attname(self) -> str: ...
def get_attname_column(self) -> Tuple[str, str]: ...
def get_internal_type(self): ...
def pre_save(self, model_instance: Any, add: Any): ...
def pre_save(self, model_instance: Model, add: bool) -> Union[str, int]: ...
def get_prep_value(self, value: Any): ...
def get_db_prep_value(self, value: Any, connection: Any, prepared: bool = ...): ...
def get_db_prep_value(
self, value: int, connection: DatabaseWrapper, prepared: bool = ...
) -> int: ...
def get_db_prep_save(self, value: Any, connection: Any): ...
def has_default(self): ...
def has_default(self) -> bool: ...
def get_default(self): ...
def _get_default(self): ...
def get_choices(
self,
include_blank: bool = ...,
blank_choice: Any = ...,
limit_choices_to: Optional[Any] = ...,
): ...
blank_choice: List[Tuple[str, str]] = ...,
limit_choices_to: None = ...,
) -> List[Tuple[str, str]]: ...
def value_to_string(self, obj: Any): ...
def _get_flatchoices(self): ...
flatchoices: Any = ...
def save_form_data(self, instance: Any, data: Any) -> None: ...
def formfield(
self,
form_class: Optional[Any] = ...,
choices_form_class: Optional[Any] = ...,
**kwargs: Any,
): ...
form_class: Type[Union[IntegerField, URLField, ImageField]] = ...,
choices_form_class: None = ...,
**kwargs: Any
) -> Field: ...
def value_from_object(self, obj: Any): ...
class AutoField(Field):
@@ -169,44 +186,44 @@ class AutoField(Field):
empty_strings_allowed: bool = ...
default_error_messages: Any = ...
def __init__(self, *args: Any, **kwargs: Any) -> None: ...
def check(self, **kwargs: Any) -> List[Any]: ...
def _check_primary_key(self) -> List[Any]: ...
def deconstruct(self) -> Any: ...
def get_internal_type(self) -> str: ...
def to_python(self, value: Optional[Union[str, int]]) -> Optional[int]: ...
def rel_db_type(self, connection: DatabaseWrapper) -> str: ...
def validate(self, value: int, model_instance: Model) -> None: ...
def check(self, **kwargs: Any): ...
def deconstruct(self): ...
def get_internal_type(self): ...
def to_python(self, value: Any): ...
def rel_db_type(self, connection: Any): ...
def validate(self, value: Any, model_instance: Any) -> None: ...
def get_db_prep_value(
self, value: Union[str, int], connection: DatabaseWrapper, prepared: bool = ...
) -> Union[str, int]: ...
def get_prep_value(self, value: Any) -> Optional[Union[int, OuterRef]]: ...
def contribute_to_class(self, cls: Type[Model], name: str, **kwargs: Any) -> None: ...
def formfield(self, **kwargs: Any) -> None: ...
self, value: Any, connection: Any, prepared: bool = ...
): ...
def get_prep_value(self, value: Any): ...
def contribute_to_class(
self, cls: Type[Model], name: str, **kwargs: Any
) -> None: ...
def formfield(self, **kwargs: Any): ...
class BigAutoField(AutoField):
description: Any = ...
def get_internal_type(self) -> str: ...
def rel_db_type(self, connection: DatabaseWrapper) -> str: ...
def get_internal_type(self): ...
def rel_db_type(self, connection: Any): ...
class BooleanField(Field):
empty_strings_allowed: bool = ...
default_error_messages: Any = ...
description: Any = ...
def get_internal_type(self) -> str: ...
def to_python(self, value: Optional[Union[str, int]]) -> bool: ...
def get_prep_value(self, value: Optional[Union[str, int]]) -> Optional[bool]: ...
def formfield(self, **kwargs: Any) -> BooleanField: ...
def get_internal_type(self): ...
def to_python(self, value: Any): ...
def get_prep_value(self, value: Any): ...
def formfield(self, **kwargs: Any): ...
class CharField(Field):
description: Any = ...
def __init__(self, *args: Any, **kwargs: Any) -> None: ...
def check(self, **kwargs: Any) -> List[Error]: ...
def _check_max_length_attribute(self, **kwargs: Any) -> List[Error]: ...
def check(self, **kwargs: Any): ...
def cast_db_type(self, connection: Any): ...
def get_internal_type(self) -> str: ...
def to_python(self, value: Optional[Union[int, str, Model]]) -> Optional[str]: ...
def get_prep_value(self, value: object) -> object: ...
def formfield(self, **kwargs: Any) -> Union[CharField, TypedChoiceField]: ...
def get_internal_type(self): ...
def to_python(self, value: Any): ...
def get_prep_value(self, value: Any): ...
def formfield(self, **kwargs: Any) -> URLField: ...
class CommaSeparatedIntegerField(CharField):
default_validators: Any = ...
@@ -215,8 +232,6 @@ class CommaSeparatedIntegerField(CharField):
class DateTimeCheckMixin:
def check(self, **kwargs: Any): ...
def _check_mutually_exclusive_options(self): ...
def _check_fix_default_value(self): ...
class DateField(DateTimeCheckMixin, Field):
empty_strings_allowed: bool = ...
@@ -224,38 +239,37 @@ class DateField(DateTimeCheckMixin, Field):
description: Any = ...
def __init__(
self,
verbose_name: Optional[str] = ...,
name: Optional[str] = ...,
verbose_name: Optional[Any] = ...,
name: Optional[Any] = ...,
auto_now: bool = ...,
auto_now_add: bool = ...,
**kwargs: Any,
**kwargs: Any
) -> None: ...
def _check_fix_default_value(self) -> List[Warning]: ...
def deconstruct(self) -> Any: ...
def get_internal_type(self) -> str: ...
def deconstruct(self): ...
def get_internal_type(self): ...
def to_python(self, value: Any): ...
def pre_save(self, model_instance: Model, add: bool) -> Optional[date]: ...
def contribute_to_class(self, cls: Type[Model], name: str, **kwargs: Any) -> None: ...
def get_prep_value(self, value: Optional[Union[str, date]]) -> Optional[date]: ...
def pre_save(self, model_instance: Any, add: Any): ...
def contribute_to_class(
self, cls: Type[Model], name: str, **kwargs: Any
) -> None: ...
def get_prep_value(self, value: Any): ...
def get_db_prep_value(
self,
value: Optional[Union[str, date]],
connection: DatabaseWrapper,
prepared: bool = ...,
) -> Optional[str]: ...
self, value: Any, connection: Any, prepared: bool = ...
): ...
def value_to_string(self, obj: Any): ...
def formfield(self, **kwargs: Any) -> Union[BaseTemporalField, SplitDateTimeField]: ...
def formfield(self, **kwargs: Any): ...
class DateTimeField(DateField):
empty_strings_allowed: bool = ...
default_error_messages: Any = ...
description: Any = ...
def _check_fix_default_value(self): ...
def get_internal_type(self): ...
def to_python(self, value: Any): ...
def pre_save(self, model_instance: Any, add: Any): ...
def get_prep_value(self, value: Any): ...
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 value_to_string(self, obj: Any): ...
def formfield(self, **kwargs: Any): ...
@@ -269,12 +283,9 @@ class DecimalField(Field):
name: Optional[Any] = ...,
max_digits: Optional[Any] = ...,
decimal_places: Optional[Any] = ...,
**kwargs: Any,
**kwargs: Any
) -> None: ...
def check(self, **kwargs: Any): ...
def _check_decimal_places(self): ...
def _check_max_digits(self): ...
def _check_decimal_places_and_max_digits(self, **kwargs: Any): ...
def validators(self): ...
def context(self): ...
def deconstruct(self): ...
@@ -282,7 +293,7 @@ class DecimalField(Field):
def to_python(self, value: Any): ...
def get_db_prep_save(self, value: Any, connection: Any): ...
def get_prep_value(self, value: Any): ...
def formfield(self, **kwargs: Any): ...
def formfield(self, **kwargs: Any) -> DecimalField: ...
class DurationField(Field):
empty_strings_allowed: bool = ...
@@ -290,7 +301,9 @@ class DurationField(Field):
description: Any = ...
def get_internal_type(self): ...
def to_python(self, value: Any): ...
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: Any): ...
def formfield(self, **kwargs: Any): ...
@@ -306,18 +319,21 @@ class FilePathField(Field):
description: Any = ...
def __init__(
self,
verbose_name: Optional[Any] = ...,
name: Optional[Any] = ...,
verbose_name: None = ...,
name: None = ...,
path: str = ...,
match: Optional[Any] = ...,
match: str = ...,
recursive: bool = ...,
allow_files: bool = ...,
allow_folders: bool = ...,
**kwargs: Any,
**kwargs: Any
) -> None: ...
def check(self, **kwargs: Any): ...
def _check_allowing_files_or_folders(self, **kwargs: Any): ...
def deconstruct(self): ...
def deconstruct(
self
) -> Tuple[
str, List[Any], Dict[str, Union[str, bool]], Dict[str, Union[str, bool]]
]: ...
def get_prep_value(self, value: Any): ...
def formfield(self, **kwargs: Any): ...
def get_internal_type(self): ...
@@ -336,18 +352,17 @@ class IntegerField(Field):
default_error_messages: Any = ...
description: Any = ...
def check(self, **kwargs: Any): ...
def _check_max_length_warning(self): ...
def validators(self): ...
def get_prep_value(self, value: Any): ...
def get_internal_type(self): ...
def to_python(self, value: Any): ...
def formfield(self, **kwargs: Any): ...
def formfield(self, **kwargs: Any) -> Field: ...
class BigIntegerField(IntegerField):
empty_strings_allowed: bool = ...
description: Any = ...
MAX_BIGINT: int = ...
def get_internal_type(self) -> str: ...
def get_internal_type(self): ...
def formfield(self, **kwargs: Any) -> IntegerField: ...
class IPAddressField(Field):
@@ -372,14 +387,15 @@ class GenericIPAddressField(Field):
protocol: str = ...,
unpack_ipv4: bool = ...,
*args: Any,
**kwargs: Any,
**kwargs: Any
) -> None: ...
def check(self, **kwargs: Any): ...
def _check_blank_and_null_values(self, **kwargs: Any): ...
def deconstruct(self): ...
def get_internal_type(self): ...
def to_python(self, value: Any): ...
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_prep_value(self, value: Any): ...
def formfield(self, **kwargs: Any): ...
@@ -396,7 +412,7 @@ class PositiveIntegerRelDbTypeMixin:
class PositiveIntegerField(PositiveIntegerRelDbTypeMixin, IntegerField):
description: Any = ...
def get_internal_type(self): ...
def formfield(self, **kwargs: Any): ...
def formfield(self, **kwargs: Any) -> TypedChoiceField: ...
class PositiveSmallIntegerField(PositiveIntegerRelDbTypeMixin, IntegerField):
description: Any = ...
@@ -413,7 +429,7 @@ class SlugField(CharField):
max_length: int = ...,
db_index: bool = ...,
allow_unicode: bool = ...,
**kwargs: Any,
**kwargs: Any
) -> None: ...
def deconstruct(self): ...
def get_internal_type(self): ...
@@ -440,15 +456,16 @@ class TimeField(DateTimeCheckMixin, Field):
name: Optional[Any] = ...,
auto_now: bool = ...,
auto_now_add: bool = ...,
**kwargs: Any,
**kwargs: Any
) -> None: ...
def _check_fix_default_value(self): ...
def deconstruct(self): ...
def get_internal_type(self): ...
def to_python(self, value: Any): ...
def pre_save(self, model_instance: Any, add: Any): ...
def get_prep_value(self, value: Any): ...
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 value_to_string(self, obj: Any): ...
def formfield(self, **kwargs: Any): ...
@@ -456,7 +473,10 @@ class URLField(CharField):
default_validators: Any = ...
description: Any = ...
def __init__(
self, verbose_name: Optional[Any] = ..., name: Optional[Any] = ..., **kwargs: Any
self,
verbose_name: Optional[Any] = ...,
name: Optional[Any] = ...,
**kwargs: Any
) -> None: ...
def deconstruct(self): ...
def formfield(self, **kwargs: Any): ...
@@ -465,33 +485,27 @@ class BinaryField(Field):
description: Any = ...
empty_values: Any = ...
def __init__(self, *args: Any, **kwargs: Any) -> None: ...
def deconstruct(self) -> Any: ...
def get_internal_type(self) -> str: ...
def get_placeholder(
self,
value: Optional[memoryview],
compiler: SQLCompiler,
connection: DatabaseWrapper,
) -> str: ...
def get_default(self) -> Optional[bytes]: ...
def deconstruct(self): ...
def get_internal_type(self): ...
def get_placeholder(self, value: Any, compiler: Any, connection: Any): ...
def get_default(self): ...
def get_db_prep_value(
self,
value: Optional[Union[bytes, memoryview]],
connection: DatabaseWrapper,
prepared: bool = ...,
) -> Optional[memoryview]: ...
self, value: Any, connection: Any, prepared: bool = ...
): ...
def value_to_string(self, obj: Any): ...
def to_python(
self, value: Optional[Union[str, bytes]]
) -> Optional[Union[bytes, memoryview]]: ...
def to_python(self, value: Any): ...
class UUIDField(Field):
default_error_messages: Any = ...
description: str = ...
empty_strings_allowed: bool = ...
def __init__(self, verbose_name: Optional[Any] = ..., **kwargs: Any) -> None: ...
def __init__(
self, verbose_name: Optional[Any] = ..., **kwargs: Any
) -> None: ...
def deconstruct(self): ...
def get_internal_type(self): ...
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 to_python(self, value: Any): ...
def formfield(self, **kwargs: Any): ...