mirror of
https://github.com/davidhalter/django-stubs.git
synced 2025-12-10 22:11:54 +08:00
various fixes
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
from typing import Any
|
from typing import Any, Dict
|
||||||
|
|
||||||
from django.contrib.auth.forms import AuthenticationForm, PasswordChangeForm
|
from django.contrib.auth.forms import AuthenticationForm, PasswordChangeForm
|
||||||
from django.contrib.auth.models import User
|
from django.contrib.auth.models import User
|
||||||
@@ -7,8 +7,8 @@ class AdminAuthenticationForm(AuthenticationForm):
|
|||||||
auto_id: str
|
auto_id: str
|
||||||
data: Dict[str, str]
|
data: Dict[str, str]
|
||||||
empty_permitted: bool
|
empty_permitted: bool
|
||||||
error_class: Type[django.forms.utils.ErrorList]
|
error_class: type
|
||||||
fields: collections.OrderedDict
|
fields: Dict[Any, Any]
|
||||||
files: Dict[Any, Any]
|
files: Dict[Any, Any]
|
||||||
initial: Dict[Any, Any]
|
initial: Dict[Any, Any]
|
||||||
is_bound: bool
|
is_bound: bool
|
||||||
@@ -23,11 +23,11 @@ class AdminPasswordChangeForm(PasswordChangeForm):
|
|||||||
auto_id: str
|
auto_id: str
|
||||||
data: Dict[Any, Any]
|
data: Dict[Any, Any]
|
||||||
empty_permitted: bool
|
empty_permitted: bool
|
||||||
error_class: Type[django.forms.utils.ErrorList]
|
error_class: type
|
||||||
fields: collections.OrderedDict
|
fields: Dict[Any, Any]
|
||||||
files: Dict[Any, Any]
|
files: Dict[Any, Any]
|
||||||
initial: Dict[Any, Any]
|
initial: Dict[Any, Any]
|
||||||
is_bound: bool
|
is_bound: bool
|
||||||
label_suffix: str
|
label_suffix: str
|
||||||
user: django.utils.functional.SimpleLazyObject
|
user: Any
|
||||||
required_css_class: str = ...
|
required_css_class: str = ...
|
||||||
|
|||||||
@@ -1,21 +1,18 @@
|
|||||||
from typing import Any, Optional, Tuple, Union
|
from typing import Any, Optional, Tuple, List
|
||||||
|
|
||||||
from django.db import models
|
from django.db import models
|
||||||
|
|
||||||
class BaseUserManager(models.Manager):
|
class BaseUserManager(models.Manager):
|
||||||
creation_counter: int
|
|
||||||
model: None
|
|
||||||
name: None
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def normalize_email(cls, email: Optional[str]) -> str: ...
|
def normalize_email(cls, email: Optional[str]) -> str: ...
|
||||||
def make_random_password(self, length: int = ..., allowed_chars: str = ...) -> str: ...
|
def make_random_password(self, length: int = ..., allowed_chars: str = ...) -> str: ...
|
||||||
def get_by_natural_key(self, username: Optional[str]) -> AbstractBaseUser: ...
|
def get_by_natural_key(self, username: Optional[str]) -> AbstractBaseUser: ...
|
||||||
|
|
||||||
class AbstractBaseUser(models.Model):
|
class AbstractBaseUser(models.Model):
|
||||||
password: str = ...
|
password: models.CharField = ...
|
||||||
last_login: None = ...
|
last_login: Optional[models.DateTimeField] = ...
|
||||||
is_active: bool = ...
|
is_active: bool = ...
|
||||||
REQUIRED_FIELDS: Any = ...
|
REQUIRED_FIELDS: List[str] = ...
|
||||||
class Meta:
|
class Meta:
|
||||||
abstract: bool = ...
|
abstract: bool = ...
|
||||||
def get_username(self) -> str: ...
|
def get_username(self) -> str: ...
|
||||||
@@ -34,4 +31,4 @@ class AbstractBaseUser(models.Model):
|
|||||||
@classmethod
|
@classmethod
|
||||||
def get_email_field_name(cls) -> str: ...
|
def get_email_field_name(cls) -> str: ...
|
||||||
@classmethod
|
@classmethod
|
||||||
def normalize_username(cls, username: Union[int, str]) -> Union[int, str]: ...
|
def normalize_username(cls, username: str) -> str: ...
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
|
import datetime
|
||||||
from typing import Any, List, Optional, Set, Tuple, Type, Union
|
from typing import Any, List, Optional, Set, Tuple, Type, Union
|
||||||
|
|
||||||
from django.contrib.auth.base_user import AbstractBaseUser, BaseUserManager
|
from django.contrib.auth.base_user import AbstractBaseUser as AbstractBaseUser, BaseUserManager as BaseUserManager
|
||||||
from django.db import models
|
|
||||||
from django.db.models.manager import EmptyManager
|
from django.db.models.manager import EmptyManager
|
||||||
|
|
||||||
from .validators import UnicodeUsernameValidator
|
from django.db import models
|
||||||
|
|
||||||
def update_last_login(sender: Type[AbstractBaseUser], user: AbstractBaseUser, **kwargs: Any) -> None: ...
|
def update_last_login(sender: Type[AbstractBaseUser], user: AbstractBaseUser, **kwargs: Any) -> None: ...
|
||||||
|
|
||||||
@@ -72,20 +72,16 @@ class PermissionsMixin(models.Model):
|
|||||||
|
|
||||||
class AbstractUser(AbstractBaseUser, PermissionsMixin):
|
class AbstractUser(AbstractBaseUser, PermissionsMixin):
|
||||||
is_superuser: bool
|
is_superuser: bool
|
||||||
last_login: None
|
|
||||||
password: str
|
|
||||||
username_validator: Any = ...
|
username_validator: Any = ...
|
||||||
username: str = ...
|
username: str = ...
|
||||||
first_name: str = ...
|
first_name: str = ...
|
||||||
last_name: str = ...
|
last_name: str = ...
|
||||||
email: str = ...
|
email: str = ...
|
||||||
is_staff: bool = ...
|
is_staff: bool = ...
|
||||||
is_active: bool = ...
|
|
||||||
date_joined: datetime.datetime = ...
|
date_joined: datetime.datetime = ...
|
||||||
objects: Any = ...
|
objects: Any = ...
|
||||||
EMAIL_FIELD: str = ...
|
EMAIL_FIELD: str = ...
|
||||||
USERNAME_FIELD: str = ...
|
USERNAME_FIELD: str = ...
|
||||||
REQUIRED_FIELDS: Any = ...
|
|
||||||
class Meta:
|
class Meta:
|
||||||
verbose_name: Any = ...
|
verbose_name: Any = ...
|
||||||
verbose_name_plural: Any = ...
|
verbose_name_plural: Any = ...
|
||||||
@@ -96,17 +92,6 @@ class AbstractUser(AbstractBaseUser, PermissionsMixin):
|
|||||||
def email_user(self, subject: str, message: str, from_email: str = ..., **kwargs: Any) -> None: ...
|
def email_user(self, subject: str, message: str, from_email: str = ..., **kwargs: Any) -> None: ...
|
||||||
|
|
||||||
class User(AbstractUser):
|
class User(AbstractUser):
|
||||||
date_joined: datetime.datetime
|
|
||||||
email: str
|
|
||||||
first_name: str
|
|
||||||
id: None
|
|
||||||
is_active: bool
|
|
||||||
is_staff: bool
|
|
||||||
is_superuser: bool
|
|
||||||
last_login: None
|
|
||||||
last_name: str
|
|
||||||
password: str
|
|
||||||
username: str
|
|
||||||
class Meta(AbstractUser.Meta):
|
class Meta(AbstractUser.Meta):
|
||||||
swappable: str = ...
|
swappable: str = ...
|
||||||
|
|
||||||
|
|||||||
@@ -33,14 +33,7 @@ class ValidationError(Exception):
|
|||||||
params: Any = ...
|
params: Any = ...
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
message: Union[
|
message: Any,
|
||||||
Dict[str, List[ValidationError]],
|
|
||||||
Dict[str, ErrorList],
|
|
||||||
List[Union[ValidationError, str]],
|
|
||||||
ValidationError,
|
|
||||||
ErrorList,
|
|
||||||
str,
|
|
||||||
],
|
|
||||||
code: Optional[str] = ...,
|
code: Optional[str] = ...,
|
||||||
params: Optional[
|
params: Optional[
|
||||||
Union[Dict[str, Union[Tuple[str], Type[Model], Model, str]], Dict[str, Union[int, str]]]
|
Union[Dict[str, Union[Tuple[str], Type[Model], Model, str]], Dict[str, Union[int, str]]]
|
||||||
|
|||||||
@@ -9,24 +9,25 @@ from django.utils.functional import SimpleLazyObject
|
|||||||
|
|
||||||
EMPTY_VALUES: Any
|
EMPTY_VALUES: Any
|
||||||
|
|
||||||
def _lazy_re_compile(regex: Union[str, Pattern], flags: int = ...): ...
|
_Regex = Union[str, Pattern[str]]
|
||||||
|
|
||||||
|
def _lazy_re_compile(regex: _Regex, flags: int = ...): ...
|
||||||
|
|
||||||
class RegexValidator:
|
class RegexValidator:
|
||||||
regex: SimpleLazyObject = ...
|
regex: _Regex = ...
|
||||||
message: Any = ...
|
message: Any = ...
|
||||||
code: str = ...
|
code: str = ...
|
||||||
inverse_match: bool = ...
|
inverse_match: bool = ...
|
||||||
flags: int = ...
|
flags: int = ...
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
regex: Optional[str] = ...,
|
regex: Optional[_Regex] = ...,
|
||||||
message: Optional[str] = ...,
|
message: Optional[str] = ...,
|
||||||
code: Optional[str] = ...,
|
code: Optional[str] = ...,
|
||||||
inverse_match: Optional[bool] = ...,
|
inverse_match: Optional[bool] = ...,
|
||||||
flags: Optional[RegexFlag] = ...,
|
flags: Optional[RegexFlag] = ...,
|
||||||
) -> None: ...
|
) -> None: ...
|
||||||
def __call__(self, value: Optional[Union[float, str]]) -> None: ...
|
def __call__(self, value: Optional[Union[float, str]]) -> None: ...
|
||||||
def __eq__(self, other: Union[ProhibitNullCharactersValidator, RegexValidator]) -> bool: ...
|
|
||||||
|
|
||||||
class URLValidator(RegexValidator):
|
class URLValidator(RegexValidator):
|
||||||
ul: str = ...
|
ul: str = ...
|
||||||
@@ -36,8 +37,6 @@ class URLValidator(RegexValidator):
|
|||||||
domain_re: Any = ...
|
domain_re: Any = ...
|
||||||
tld_re: Any = ...
|
tld_re: Any = ...
|
||||||
host_re: Any = ...
|
host_re: Any = ...
|
||||||
regex: SimpleLazyObject = ...
|
|
||||||
message: Any = ...
|
|
||||||
schemes: Any = ...
|
schemes: Any = ...
|
||||||
def __init__(self, schemes: Optional[List[str]] = ..., **kwargs: Any) -> None: ...
|
def __init__(self, schemes: Optional[List[str]] = ..., **kwargs: Any) -> None: ...
|
||||||
def __call__(self, value: str) -> None: ...
|
def __call__(self, value: str) -> None: ...
|
||||||
@@ -58,7 +57,6 @@ class EmailValidator:
|
|||||||
) -> None: ...
|
) -> None: ...
|
||||||
def __call__(self, value: Optional[str]) -> None: ...
|
def __call__(self, value: Optional[str]) -> None: ...
|
||||||
def validate_domain_part(self, domain_part: str) -> bool: ...
|
def validate_domain_part(self, domain_part: str) -> bool: ...
|
||||||
def __eq__(self, other: EmailValidator) -> bool: ...
|
|
||||||
|
|
||||||
validate_email: Any
|
validate_email: Any
|
||||||
slug_re: Any
|
slug_re: Any
|
||||||
@@ -83,13 +81,10 @@ class BaseValidator:
|
|||||||
message: Any = ...
|
message: Any = ...
|
||||||
code: str = ...
|
code: str = ...
|
||||||
limit_value: bool = ...
|
limit_value: bool = ...
|
||||||
def __init__(
|
def __init__(self, limit_value: Any, message: Optional[str] = ...) -> None: ...
|
||||||
self, limit_value: Optional[Union[datetime, Decimal, float, str]], message: Optional[str] = ...
|
def __call__(self, value: Any) -> None: ...
|
||||||
) -> None: ...
|
|
||||||
def __call__(self, value: Union[bytes, datetime, Decimal, float, str]) -> None: ...
|
|
||||||
def __eq__(self, other: BaseValidator) -> bool: ...
|
|
||||||
def compare(self, a: bool, b: bool) -> bool: ...
|
def compare(self, a: bool, b: bool) -> bool: ...
|
||||||
def clean(self, x: Union[datetime, Decimal, float]) -> Union[datetime, Decimal, float]: ...
|
def clean(self, x: Any) -> Any: ...
|
||||||
|
|
||||||
class MaxValueValidator(BaseValidator):
|
class MaxValueValidator(BaseValidator):
|
||||||
limit_value: Decimal
|
limit_value: Decimal
|
||||||
@@ -123,7 +118,6 @@ class DecimalValidator:
|
|||||||
decimal_places: int = ...
|
decimal_places: int = ...
|
||||||
def __init__(self, max_digits: Optional[Union[int, str]], decimal_places: Optional[Union[int, str]]) -> None: ...
|
def __init__(self, max_digits: Optional[Union[int, str]], decimal_places: Optional[Union[int, str]]) -> None: ...
|
||||||
def __call__(self, value: Decimal) -> None: ...
|
def __call__(self, value: Decimal) -> None: ...
|
||||||
def __eq__(self, other: Union[DecimalValidator, MinValueValidator]) -> bool: ...
|
|
||||||
|
|
||||||
class FileExtensionValidator:
|
class FileExtensionValidator:
|
||||||
message: Any = ...
|
message: Any = ...
|
||||||
@@ -133,7 +127,6 @@ class FileExtensionValidator:
|
|||||||
self, allowed_extensions: Optional[List[str]] = ..., message: Optional[str] = ..., code: Optional[str] = ...
|
self, allowed_extensions: Optional[List[str]] = ..., message: Optional[str] = ..., code: Optional[str] = ...
|
||||||
) -> None: ...
|
) -> None: ...
|
||||||
def __call__(self, value: File) -> None: ...
|
def __call__(self, value: File) -> None: ...
|
||||||
def __eq__(self, other: FileExtensionValidator) -> bool: ...
|
|
||||||
|
|
||||||
def get_available_image_extensions() -> List[str]: ...
|
def get_available_image_extensions() -> List[str]: ...
|
||||||
def validate_image_file_extension(value: File) -> None: ...
|
def validate_image_file_extension(value: File) -> None: ...
|
||||||
@@ -143,4 +136,3 @@ class ProhibitNullCharactersValidator:
|
|||||||
code: str = ...
|
code: str = ...
|
||||||
def __init__(self, message: Optional[str] = ..., code: Optional[str] = ...) -> None: ...
|
def __init__(self, message: Optional[str] = ..., code: Optional[str] = ...) -> None: ...
|
||||||
def __call__(self, value: Optional[Union[Dict[Any, Any], str, UUID]]) -> None: ...
|
def __call__(self, value: Optional[Union[Dict[Any, Any], str, UUID]]) -> None: ...
|
||||||
def __eq__(self, other: Union[ProhibitNullCharactersValidator, RegexValidator]) -> bool: ...
|
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ from .fields import (
|
|||||||
PositiveSmallIntegerField as PositiveSmallIntegerField,
|
PositiveSmallIntegerField as PositiveSmallIntegerField,
|
||||||
SmallIntegerField as SmallIntegerField,
|
SmallIntegerField as SmallIntegerField,
|
||||||
BigIntegerField as BigIntegerField,
|
BigIntegerField as BigIntegerField,
|
||||||
|
FloatField as FloatField,
|
||||||
CharField as CharField,
|
CharField as CharField,
|
||||||
EmailField as EmailField,
|
EmailField as EmailField,
|
||||||
URLField as URLField,
|
URLField as URLField,
|
||||||
@@ -19,14 +20,27 @@ from .fields import (
|
|||||||
NullBooleanField as NullBooleanField,
|
NullBooleanField as NullBooleanField,
|
||||||
FileField as FileField,
|
FileField as FileField,
|
||||||
DateField as DateField,
|
DateField as DateField,
|
||||||
|
TimeField as TimeField,
|
||||||
DateTimeField as DateTimeField,
|
DateTimeField as DateTimeField,
|
||||||
IPAddressField as IPAddressField,
|
IPAddressField as IPAddressField,
|
||||||
GenericIPAddressField as GenericIPAddressField,
|
GenericIPAddressField as GenericIPAddressField,
|
||||||
|
UUIDField as UUIDField,
|
||||||
|
DecimalField as DecimalField,
|
||||||
|
FilePathField as FilePathField,
|
||||||
|
BinaryField as BinaryField,
|
||||||
|
DurationField as DurationField,
|
||||||
)
|
)
|
||||||
|
|
||||||
from .fields.related import ForeignKey as ForeignKey, OneToOneField as OneToOneField, ManyToManyField as ManyToManyField
|
from .fields.related import ForeignKey as ForeignKey, OneToOneField as OneToOneField, ManyToManyField as ManyToManyField
|
||||||
|
from .fields.files import ImageField as ImageField, FileField as FileField
|
||||||
|
|
||||||
from .deletion import CASCADE as CASCADE, SET_DEFAULT as SET_DEFAULT, SET_NULL as SET_NULL, DO_NOTHING as DO_NOTHING
|
from .deletion import (
|
||||||
|
CASCADE as CASCADE,
|
||||||
|
SET_DEFAULT as SET_DEFAULT,
|
||||||
|
SET_NULL as SET_NULL,
|
||||||
|
DO_NOTHING as DO_NOTHING,
|
||||||
|
PROTECT as PROTECT,
|
||||||
|
)
|
||||||
|
|
||||||
from .query import QuerySet as QuerySet, RawQuerySet as RawQuerySet
|
from .query import QuerySet as QuerySet, RawQuerySet as RawQuerySet
|
||||||
|
|
||||||
|
|||||||
@@ -2,3 +2,4 @@ def CASCADE(collector, field, sub_objs, using): ...
|
|||||||
def SET_NULL(collector, field, sub_objs, using): ...
|
def SET_NULL(collector, field, sub_objs, using): ...
|
||||||
def SET_DEFAULT(collector, field, sub_objs, using): ...
|
def SET_DEFAULT(collector, field, sub_objs, using): ...
|
||||||
def DO_NOTHING(collector, field, sub_objs, using): ...
|
def DO_NOTHING(collector, field, sub_objs, using): ...
|
||||||
|
def PROTECT(collector, field, sub_objs, using): ...
|
||||||
|
|||||||
@@ -16,18 +16,27 @@ class PositiveIntegerField(PositiveIntegerRelDbTypeMixin, IntegerField): ...
|
|||||||
class PositiveSmallIntegerField(PositiveIntegerRelDbTypeMixin, IntegerField): ...
|
class PositiveSmallIntegerField(PositiveIntegerRelDbTypeMixin, IntegerField): ...
|
||||||
class SmallIntegerField(IntegerField): ...
|
class SmallIntegerField(IntegerField): ...
|
||||||
class BigIntegerField(IntegerField): ...
|
class BigIntegerField(IntegerField): ...
|
||||||
|
class FloatField(Field): ...
|
||||||
|
|
||||||
|
class DecimalField(IntegerField):
|
||||||
|
def __init__(self, *, max_digits: Optional[int] = ..., decimal_places: Optional[int] = ..., **kwargs): ...
|
||||||
|
|
||||||
class AutoField(Field):
|
class AutoField(Field):
|
||||||
def __get__(self, instance, owner) -> int: ...
|
def __get__(self, instance, owner) -> int: ...
|
||||||
|
|
||||||
class CharField(Field):
|
class CharField(Field):
|
||||||
def __init__(self, max_length: int, **kwargs: Any): ...
|
def __init__(self, max_length: int = ..., **kwargs: Any): ...
|
||||||
def __set__(self, instance, value: str) -> None: ...
|
def __set__(self, instance, value: str) -> None: ...
|
||||||
def __get__(self, instance, owner) -> str: ...
|
def __get__(self, instance, owner) -> str: ...
|
||||||
|
|
||||||
class SlugField(CharField): ...
|
class SlugField(CharField):
|
||||||
class EmailField(CharField): ...
|
def __init__(self, max_length: int = ..., **kwargs: Any): ...
|
||||||
class URLField(CharField): ...
|
|
||||||
|
class EmailField(CharField):
|
||||||
|
def __init__(self, max_length: int = ..., **kwargs: Any): ...
|
||||||
|
|
||||||
|
class URLField(CharField):
|
||||||
|
def __init__(self, max_length: int = ..., **kwargs: Any): ...
|
||||||
|
|
||||||
class TextField(Field):
|
class TextField(Field):
|
||||||
def __set__(self, instance, value: str) -> None: ...
|
def __set__(self, instance, value: str) -> None: ...
|
||||||
@@ -57,5 +66,36 @@ class GenericIPAddressField(Field):
|
|||||||
**kwargs: Any
|
**kwargs: Any
|
||||||
) -> None: ...
|
) -> None: ...
|
||||||
|
|
||||||
class DateField(Field): ...
|
class DateTimeCheckMixin: ...
|
||||||
|
|
||||||
|
class DateField(DateTimeCheckMixin, Field):
|
||||||
|
def __init__(
|
||||||
|
self,
|
||||||
|
verbose_name: Optional[str] = ...,
|
||||||
|
name: Optional[str] = ...,
|
||||||
|
auto_now: bool = ...,
|
||||||
|
auto_now_add: bool = ...,
|
||||||
|
**kwargs
|
||||||
|
): ...
|
||||||
|
|
||||||
|
class TimeField(DateTimeCheckMixin, Field): ...
|
||||||
class DateTimeField(DateField): ...
|
class DateTimeField(DateField): ...
|
||||||
|
class UUIDField(Field): ...
|
||||||
|
|
||||||
|
class FilePathField(Field):
|
||||||
|
def __init__(
|
||||||
|
self,
|
||||||
|
verbose_name: Optional[str] = ...,
|
||||||
|
name: Optional[str] = ...,
|
||||||
|
path: str = ...,
|
||||||
|
match: Optional[Any] = ...,
|
||||||
|
recursive: bool = ...,
|
||||||
|
allow_files: bool = ...,
|
||||||
|
allow_folders: bool = ...,
|
||||||
|
**kwargs
|
||||||
|
): ...
|
||||||
|
|
||||||
|
class BinaryField(Field):
|
||||||
|
def __init__(self, editable: bool = ..., **kwargs: Any): ...
|
||||||
|
|
||||||
|
class DurationField(Field): ...
|
||||||
|
|||||||
@@ -3,15 +3,15 @@ from typing import Any, Callable, Dict, List, Optional, Tuple, Type, Union
|
|||||||
from django.core.checks.messages import Error
|
from django.core.checks.messages import Error
|
||||||
from django.core.files.base import File
|
from django.core.files.base import File
|
||||||
from django.core.files.images import ImageFile
|
from django.core.files.images import ImageFile
|
||||||
from django.core.files.storage import FileSystemStorage, Storage
|
from django.core.files.storage import FileSystemStorage, Storage, DefaultStorage
|
||||||
from django.db.models.base import Model
|
from django.db.models.base import Model
|
||||||
from django.db.models.fields import Field
|
from django.db.models.fields import Field
|
||||||
from django.forms.fields import FileField, ImageField
|
from django.forms import fields as form_fields
|
||||||
|
|
||||||
class FieldFile(File):
|
class FieldFile(File):
|
||||||
instance: Model = ...
|
instance: Model = ...
|
||||||
field: django.db.models.fields.files.FileField = ...
|
field: FileField = ...
|
||||||
storage: django.core.files.storage.FileSystemStorage = ...
|
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 __eq__(self, other: Any) -> bool: ...
|
||||||
def __hash__(self): ...
|
def __hash__(self): ...
|
||||||
@@ -31,7 +31,7 @@ class FieldFile(File):
|
|||||||
def close(self) -> None: ...
|
def close(self) -> None: ...
|
||||||
|
|
||||||
class FileDescriptor:
|
class FileDescriptor:
|
||||||
field: django.db.models.fields.files.FileField = ...
|
field: FileField = ...
|
||||||
def __init__(self, field: FileField) -> None: ...
|
def __init__(self, field: FileField) -> None: ...
|
||||||
def __get__(self, instance: Optional[Model], cls: Type[Model] = ...) -> Union[FieldFile, FileDescriptor]: ...
|
def __get__(self, instance: Optional[Model], cls: Type[Model] = ...) -> Union[FieldFile, FileDescriptor]: ...
|
||||||
def __set__(self, instance: Model, value: Optional[Union[File, str]]) -> None: ...
|
def __set__(self, instance: Model, value: Optional[Union[File, str]]) -> None: ...
|
||||||
@@ -45,48 +45,43 @@ class FileField(Field):
|
|||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
verbose_name: Optional[str] = ...,
|
verbose_name: Optional[str] = ...,
|
||||||
name: None = ...,
|
name: Optional[str] = ...,
|
||||||
upload_to: Union[Callable, str] = ...,
|
upload_to: Union[Callable, str] = ...,
|
||||||
storage: Optional[Storage] = ...,
|
storage: Optional[Storage] = ...,
|
||||||
**kwargs: Any
|
**kwargs: Any
|
||||||
) -> None: ...
|
) -> None: ...
|
||||||
def check(self, **kwargs: Any) -> List[Error]: ...
|
def check(self, **kwargs: Any) -> List[Error]: ...
|
||||||
def deconstruct(self) -> Tuple[Optional[str], str, List[Any], Dict[str, Union[bool, str]]]: ...
|
def deconstruct(self) -> Any: ...
|
||||||
def get_internal_type(self) -> str: ...
|
def get_internal_type(self) -> str: ...
|
||||||
def get_prep_value(self, value: Union[FieldFile, str]) -> str: ...
|
def get_prep_value(self, value: Union[FieldFile, str]) -> str: ...
|
||||||
def pre_save(self, model_instance: Model, add: bool) -> FieldFile: ...
|
def pre_save(self, model_instance: Model, add: bool) -> FieldFile: ...
|
||||||
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: ...
|
||||||
def generate_filename(self, instance: Optional[Model], filename: str) -> str: ...
|
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 save_form_data(self, instance: Model, data: Optional[Union[bool, File, str]]) -> None: ...
|
||||||
def formfield(self, **kwargs: Any) -> FileField: ...
|
def formfield(self, **kwargs: Any) -> form_fields.FileField: ...
|
||||||
|
|
||||||
class ImageFileDescriptor(FileDescriptor):
|
class ImageFileDescriptor(FileDescriptor):
|
||||||
field: django.db.models.fields.files.ImageField
|
field: ImageField
|
||||||
def __set__(self, instance: Model, value: Optional[str]) -> None: ...
|
def __set__(self, instance: Model, value: Optional[str]) -> None: ...
|
||||||
|
|
||||||
class ImageFieldFile(ImageFile, FieldFile):
|
class ImageFieldFile(ImageFile, FieldFile):
|
||||||
field: django.db.models.fields.files.ImageField
|
field: ImageField
|
||||||
instance: Model
|
instance: Model
|
||||||
name: Optional[str]
|
name: Optional[str]
|
||||||
storage: django.core.files.storage.DefaultStorage
|
storage: DefaultStorage
|
||||||
def delete(self, save: bool = ...) -> None: ...
|
def delete(self, save: bool = ...) -> None: ...
|
||||||
|
|
||||||
class ImageField(FileField):
|
class ImageField(FileField):
|
||||||
attr_class: Any = ...
|
|
||||||
descriptor_class: Any = ...
|
|
||||||
description: Any = ...
|
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
verbose_name: None = ...,
|
verbose_name: Optional[str] = ...,
|
||||||
name: None = ...,
|
name: Optional[str] = ...,
|
||||||
width_field: Optional[str] = ...,
|
width_field: Optional[str] = ...,
|
||||||
height_field: Optional[str] = ...,
|
height_field: Optional[str] = ...,
|
||||||
**kwargs: Any
|
**kwargs: Any
|
||||||
) -> None: ...
|
) -> None: ...
|
||||||
def check(self, **kwargs: Any) -> List[Any]: ...
|
def check(self, **kwargs: Any) -> List[Any]: ...
|
||||||
def deconstruct(
|
def deconstruct(self) -> Any: ...
|
||||||
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 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 update_dimension_fields(self, instance: Model, force: bool = ..., *args: Any, **kwargs: Any) -> None: ...
|
||||||
def formfield(self, **kwargs: Any) -> ImageField: ...
|
def formfield(self, **kwargs: Any) -> form_fields.ImageField: ...
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ class ManyToManyField(RelatedField, Generic[_T]):
|
|||||||
related_query_name: Optional[str] = ...,
|
related_query_name: Optional[str] = ...,
|
||||||
limit_choices_to: Optional[Callable] = ...,
|
limit_choices_to: Optional[Callable] = ...,
|
||||||
symmetrical: Optional[bool] = ...,
|
symmetrical: Optional[bool] = ...,
|
||||||
through: Optional[str] = ...,
|
through: Optional[Union[str, Type[Model]]] = ...,
|
||||||
through_fields: Optional[Tuple[str, str]] = ...,
|
through_fields: Optional[Tuple[str, str]] = ...,
|
||||||
db_constraint: bool = ...,
|
db_constraint: bool = ...,
|
||||||
db_table: None = ...,
|
db_table: None = ...,
|
||||||
|
|||||||
@@ -10,8 +10,8 @@ class BaseManager(QuerySet[_T]):
|
|||||||
auto_created: bool = ...
|
auto_created: bool = ...
|
||||||
use_in_migrations: bool = ...
|
use_in_migrations: bool = ...
|
||||||
def __new__(cls: Type[BaseManager], *args: Any, **kwargs: Any) -> BaseManager: ...
|
def __new__(cls: Type[BaseManager], *args: Any, **kwargs: Any) -> BaseManager: ...
|
||||||
model: Any = ...
|
model: Optional[Any] = ...
|
||||||
name: Any = ...
|
name: Optional[Any] = ...
|
||||||
def __init__(self) -> None: ...
|
def __init__(self) -> None: ...
|
||||||
def deconstruct(self) -> Tuple[bool, str, None, Tuple, Dict[str, int]]: ...
|
def deconstruct(self) -> Tuple[bool, str, None, Tuple, Dict[str, int]]: ...
|
||||||
def check(self, **kwargs: Any) -> List[Any]: ...
|
def check(self, **kwargs: Any) -> List[Any]: ...
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ class SafeExceptionReporterFilter(ExceptionReporterFilter):
|
|||||||
def get_traceback_frame_variables(self, request: Any, tb_frame: Any): ...
|
def get_traceback_frame_variables(self, request: Any, tb_frame: Any): ...
|
||||||
|
|
||||||
class ExceptionReporter:
|
class ExceptionReporter:
|
||||||
request: Optional[django.core.handlers.wsgi.WSGIRequest] = ...
|
request: Optional[WSGIRequest] = ...
|
||||||
filter: django.views.debug.SafeExceptionReporterFilter = ...
|
filter: django.views.debug.SafeExceptionReporterFilter = ...
|
||||||
exc_type: None = ...
|
exc_type: None = ...
|
||||||
exc_value: Optional[str] = ...
|
exc_value: Optional[str] = ...
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import os
|
|||||||
if not os.path.exists('./django-sources'):
|
if not os.path.exists('./django-sources'):
|
||||||
git clone -b stable/2.1.x https://github.com/django/django.git django-sources
|
git clone -b stable/2.1.x https://github.com/django/django.git django-sources
|
||||||
|
|
||||||
ignored_error_patterns = ["Need type annotation for"]
|
ignored_error_patterns = ["Need type annotation for", "already defined on", "Cannot assign to a"]
|
||||||
for line in $(mypy --config-file ./scripts/mypy.ini ./django-sources/tests/files).split('\n'):
|
for line in $(mypy --config-file ./scripts/mypy.ini ./django-sources/tests/files).split('\n'):
|
||||||
for pattern in ignored_error_patterns:
|
for pattern in ignored_error_patterns:
|
||||||
if pattern in line:
|
if pattern in line:
|
||||||
|
|||||||
Reference in New Issue
Block a user