mirror of
https://github.com/davidhalter/django-stubs.git
synced 2026-05-11 09:08:28 +08:00
run black over stubs, add checking to travis
This commit is contained in:
@@ -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]: ...
|
||||
|
||||
@@ -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: ...
|
||||
|
||||
@@ -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: ...
|
||||
|
||||
@@ -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: ...
|
||||
|
||||
@@ -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]: ...
|
||||
|
||||
@@ -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: ...
|
||||
|
||||
@@ -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): ...
|
||||
|
||||
@@ -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: ...
|
||||
|
||||
Reference in New Issue
Block a user