Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion django-stubs/contrib/postgres/fields/array.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class ArrayField(CheckPostgresInstalledMixin, CheckFieldDefaultMixin, Field[_ST,
default_error_messages: ClassVar[_ErrorMessagesDict]
base_field: Field
size: int | None
default_validators: Sequence[_ValidatorCallable]
default_validators: list[_ValidatorCallable]
from_db_value: Any
def __init__(
self,
Expand Down
28 changes: 14 additions & 14 deletions django-stubs/db/models/fields/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ from datetime import datetime as real_datetime
from typing import Any, ClassVar, Generic, Protocol, TypeAlias, overload, type_check_only

from django import forms
from django.core import validators # due to weird mypy.stubtest error
from django.core.checks import CheckMessage
from django.core.validators import _ValidatorCallable
from django.db.backends.base.base import BaseDatabaseWrapper
from django.db.models import Model
from django.db.models.expressions import Col, Combinable, Expression, Func
Expand Down Expand Up @@ -144,7 +144,7 @@ class Field(RegisterLookupMixin, Generic[_ST, _GT]):
empty_values: Sequence[Any]
creation_counter: int
auto_creation_counter: int
default_validators: Sequence[validators._ValidatorCallable]
default_validators: list[_ValidatorCallable]
default_error_messages: ClassVar[_ErrorMessagesDict]
hidden: bool
system_check_removed_details: Any | None
Expand Down Expand Up @@ -172,7 +172,7 @@ class Field(RegisterLookupMixin, Generic[_ST, _GT]):
db_column: str | None = None,
db_tablespace: str | None = None,
auto_created: bool = False,
validators: Iterable[validators._ValidatorCallable] = (),
validators: Iterable[_ValidatorCallable] = (),
error_messages: _ErrorMessagesMapping | None = None,
db_comment: str | None = None,
db_default: type[NOT_PROVIDED] | Expression | _ST = ...,
Expand Down Expand Up @@ -205,7 +205,7 @@ class Field(RegisterLookupMixin, Generic[_ST, _GT]):
@cached_property
def error_messages(self) -> _ErrorMessagesDict: ...
@cached_property
def validators(self) -> list[validators._ValidatorCallable]: ...
def validators(self) -> list[_ValidatorCallable]: ...
def run_validators(self, value: Any) -> None: ...
def validate(self, value: Any, model_instance: Model | None) -> None: ...
def clean(self, value: Any, model_instance: Model | None) -> Any: ...
Expand Down Expand Up @@ -325,7 +325,7 @@ class DecimalField(Field[_ST, _GT]):
db_column: str | None = ...,
db_comment: str | None = ...,
db_tablespace: str | None = ...,
validators: Iterable[validators._ValidatorCallable] = ...,
validators: Iterable[_ValidatorCallable] = ...,
error_messages: _ErrorMessagesMapping | None = ...,
) -> None: ...
@cached_property
Expand Down Expand Up @@ -361,7 +361,7 @@ class CharField(Field[_ST, _GT]):
db_column: str | None = ...,
db_comment: str | None = ...,
db_tablespace: str | None = ...,
validators: Iterable[validators._ValidatorCallable] = ...,
validators: Iterable[_ValidatorCallable] = ...,
error_messages: _ErrorMessagesMapping | None = ...,
*,
db_collation: str | None = None,
Expand Down Expand Up @@ -393,7 +393,7 @@ class SlugField(CharField[_ST, _GT]):
db_column: str | None = ...,
db_comment: str | None = ...,
db_tablespace: str | None = ...,
validators: Iterable[validators._ValidatorCallable] = ...,
validators: Iterable[_ValidatorCallable] = ...,
error_messages: _ErrorMessagesMapping | None = ...,
*,
max_length: int | None = 50,
Expand Down Expand Up @@ -434,7 +434,7 @@ class URLField(CharField[_ST, _GT]):
db_comment: str | None = ...,
db_tablespace: str | None = ...,
auto_created: bool = ...,
validators: Iterable[validators._ValidatorCallable] = ...,
validators: Iterable[_ValidatorCallable] = ...,
error_messages: _ErrorMessagesMapping | None = ...,
) -> None: ...
@override
Expand Down Expand Up @@ -468,7 +468,7 @@ class TextField(Field[_ST, _GT]):
db_column: str | None = ...,
db_comment: str | None = ...,
db_tablespace: str | None = ...,
validators: Iterable[validators._ValidatorCallable] = ...,
validators: Iterable[_ValidatorCallable] = ...,
error_messages: _ErrorMessagesMapping | None = ...,
*,
db_collation: str | None = None,
Expand Down Expand Up @@ -520,7 +520,7 @@ class GenericIPAddressField(Field[_ST, _GT]):
db_column: str | None = ...,
db_comment: str | None = ...,
db_tablespace: str | None = ...,
validators: Iterable[validators._ValidatorCallable] = ...,
validators: Iterable[_ValidatorCallable] = ...,
error_messages: _ErrorMessagesMapping | None = ...,
) -> None: ...
@override
Expand Down Expand Up @@ -558,7 +558,7 @@ class DateField(DateTimeCheckMixin, Field[_ST, _GT]):
db_column: str | None = ...,
db_comment: str | None = ...,
db_tablespace: str | None = ...,
validators: Iterable[validators._ValidatorCallable] = ...,
validators: Iterable[_ValidatorCallable] = ...,
error_messages: _ErrorMessagesMapping | None = ...,
) -> None: ...
@override
Expand Down Expand Up @@ -593,7 +593,7 @@ class TimeField(DateTimeCheckMixin, Field[_ST, _GT]):
db_column: str | None = ...,
db_comment: str | None = ...,
db_tablespace: str | None = ...,
validators: Iterable[validators._ValidatorCallable] = ...,
validators: Iterable[_ValidatorCallable] = ...,
error_messages: _ErrorMessagesMapping | None = ...,
) -> None: ...
@override
Expand Down Expand Up @@ -635,7 +635,7 @@ class UUIDField(Field[_ST, _GT]):
db_comment: str | None = ...,
db_tablespace: str | None = ...,
auto_created: bool = ...,
validators: Iterable[validators._ValidatorCallable] = ...,
validators: Iterable[_ValidatorCallable] = ...,
error_messages: _ErrorMessagesMapping | None = ...,
) -> None: ...
@override
Expand Down Expand Up @@ -673,7 +673,7 @@ class FilePathField(Field[_ST, _GT]):
db_column: str | None = ...,
db_comment: str | None = ...,
db_tablespace: str | None = ...,
validators: Iterable[validators._ValidatorCallable] = ...,
validators: Iterable[_ValidatorCallable] = ...,
error_messages: _ErrorMessagesMapping | None = ...,
) -> None: ...
@override
Expand Down
4 changes: 2 additions & 2 deletions django-stubs/db/models/fields/composite.pyi
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from collections.abc import Iterable, Iterator, Mapping
from typing import Any, Literal

from django.core import validators # due to weird mypy.stubtest error
from django.core.validators import _ValidatorCallable
from django.db.models import NOT_PROVIDED, Field
from django.db.models.base import Model
from django.db.models.fields.reverse_related import ForeignObjectRel
Expand Down Expand Up @@ -48,7 +48,7 @@ class CompositePrimaryKey(Field[Any, Any]):
db_column: None = None,
db_tablespace: str | None = None,
auto_created: bool = False,
validators: Iterable[validators._ValidatorCallable] = (),
validators: Iterable[_ValidatorCallable] = (),
error_messages: Mapping[str, _StrOrPromise] | None = None,
db_comment: str | None = None,
db_default: type[NOT_PROVIDED] = ...,
Expand Down
4 changes: 2 additions & 2 deletions django-stubs/db/models/fields/files.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ import sys
from collections.abc import Callable, Iterable
from typing import Any, Protocol, overload, type_check_only

from django.core import validators # due to weird mypy.stubtest error
from django.core.files.base import File
from django.core.files.images import ImageFile
from django.core.files.storage import Storage
from django.core.validators import _ValidatorCallable
from django.db.models.base import Model
from django.db.models.expressions import Expression
from django.db.models.fields import NOT_PROVIDED, Field, _ErrorMessagesMapping
Expand Down Expand Up @@ -90,7 +90,7 @@ class FileField(Field[Any, Any]):
db_column: str | None = ...,
db_comment: str | None = ...,
db_tablespace: str | None = ...,
validators: Iterable[validators._ValidatorCallable] = ...,
validators: Iterable[_ValidatorCallable] = ...,
error_messages: _ErrorMessagesMapping | None = ...,
) -> None: ...
# class access
Expand Down
10 changes: 5 additions & 5 deletions django-stubs/db/models/fields/related.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ from typing import Any, Generic, Literal, overload
from uuid import UUID

from django import forms
from django.core import validators # due to weird mypy.stubtest error
from django.core.validators import _ValidatorCallable
from django.db.backends.base.base import BaseDatabaseWrapper
from django.db.models.base import Model
from django.db.models.expressions import Combinable, Expression
Expand Down Expand Up @@ -73,7 +73,7 @@ class RelatedField(FieldCacheMixin, Field[_ST, _GT]):
db_column: str | None = ...,
db_tablespace: str | None = ...,
auto_created: bool = ...,
validators: Iterable[validators._ValidatorCallable] = ...,
validators: Iterable[_ValidatorCallable] = ...,
error_messages: _ErrorMessagesMapping | None = ...,
db_comment: str | None = ...,
) -> None: ...
Expand Down Expand Up @@ -130,7 +130,7 @@ class ForeignObject(RelatedField[_ST, _GT]):
help_text: _StrOrPromise = ...,
db_column: str | None = ...,
db_tablespace: str | None = ...,
validators: Iterable[validators._ValidatorCallable] = ...,
validators: Iterable[_ValidatorCallable] = ...,
error_messages: _ErrorMessagesMapping | None = ...,
db_comment: str | None = ...,
) -> None: ...
Expand Down Expand Up @@ -216,7 +216,7 @@ class ForeignKey(ForeignObject[_ST, _GT]):
help_text: _StrOrPromise = ...,
db_column: str | None = ...,
db_tablespace: str | None = ...,
validators: Iterable[validators._ValidatorCallable] = ...,
validators: Iterable[_ValidatorCallable] = ...,
error_messages: _ErrorMessagesMapping | None = ...,
db_comment: str | None = ...,
) -> None: ...
Expand Down Expand Up @@ -270,7 +270,7 @@ class OneToOneField(ForeignKey[_ST, _GT]):
help_text: _StrOrPromise = ...,
db_column: str | None = ...,
db_tablespace: str | None = ...,
validators: Iterable[validators._ValidatorCallable] = ...,
validators: Iterable[_ValidatorCallable] = ...,
error_messages: _ErrorMessagesMapping | None = ...,
db_comment: str | None = ...,
) -> None: ...
Expand Down
40 changes: 20 additions & 20 deletions django-stubs/forms/fields.pyi
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import datetime
from collections.abc import Callable, Collection, Iterator, Sequence
from collections.abc import Callable, Collection, Iterable, Iterator, Sequence
from decimal import Decimal
from re import Pattern
from typing import Any, ClassVar, Protocol, TypeAlias, type_check_only
Expand Down Expand Up @@ -52,7 +52,7 @@ class Field:
help_text: _StrOrPromise = "",
error_messages: _ErrorMessagesMapping | None = None,
show_hidden_initial: bool = False,
validators: Sequence[_ValidatorCallable] = (),
validators: Iterable[_ValidatorCallable] = (),
localize: bool = False,
disabled: bool = False,
label_suffix: str | None = None,
Expand Down Expand Up @@ -89,7 +89,7 @@ class CharField(Field):
help_text: _StrOrPromise = ...,
error_messages: _ErrorMessagesMapping | None = ...,
show_hidden_initial: bool = ...,
validators: Sequence[_ValidatorCallable] = ...,
validators: Iterable[_ValidatorCallable] = ...,
localize: bool = ...,
disabled: bool = ...,
label_suffix: str | None = ...,
Expand Down Expand Up @@ -118,7 +118,7 @@ class IntegerField(Field):
help_text: _StrOrPromise = ...,
error_messages: _ErrorMessagesMapping | None = ...,
show_hidden_initial: bool = ...,
validators: Sequence[_ValidatorCallable] = ...,
validators: Iterable[_ValidatorCallable] = ...,
localize: bool = ...,
disabled: bool = ...,
label_suffix: str | None = ...,
Expand All @@ -142,7 +142,7 @@ class FloatField(IntegerField):
help_text: _StrOrPromise = ...,
error_messages: _ErrorMessagesMapping | None = ...,
show_hidden_initial: bool = ...,
validators: Sequence[_ValidatorCallable] = ...,
validators: Iterable[_ValidatorCallable] = ...,
localize: bool = ...,
disabled: bool = ...,
label_suffix: str | None = ...,
Expand Down Expand Up @@ -172,7 +172,7 @@ class DecimalField(IntegerField):
help_text: _StrOrPromise = ...,
error_messages: _ErrorMessagesMapping | None = ...,
show_hidden_initial: bool = ...,
validators: Sequence[_ValidatorCallable] = ...,
validators: Iterable[_ValidatorCallable] = ...,
localize: bool = ...,
disabled: bool = ...,
label_suffix: str | None = ...,
Expand All @@ -197,7 +197,7 @@ class BaseTemporalField(Field):
help_text: _StrOrPromise = ...,
error_messages: _ErrorMessagesMapping | None = ...,
show_hidden_initial: bool = ...,
validators: Sequence[_ValidatorCallable] = ...,
validators: Iterable[_ValidatorCallable] = ...,
localize: bool = ...,
disabled: bool = ...,
label_suffix: str | None = ...,
Expand Down Expand Up @@ -255,7 +255,7 @@ class RegexField(CharField):
help_text: _StrOrPromise = ...,
error_messages: _ErrorMessagesMapping | None = ...,
show_hidden_initial: bool = ...,
validators: Sequence[_ValidatorCallable] = ...,
validators: Iterable[_ValidatorCallable] = ...,
localize: bool = ...,
disabled: bool = ...,
label_suffix: str | None = ...,
Expand All @@ -277,7 +277,7 @@ class EmailField(CharField):
help_text: _StrOrPromise = ...,
error_messages: _ErrorMessagesMapping | None = ...,
show_hidden_initial: bool = ...,
validators: Sequence[_ValidatorCallable] = ...,
validators: Iterable[_ValidatorCallable] = ...,
localize: bool = ...,
disabled: bool = ...,
label_suffix: str | None = ...,
Expand All @@ -299,7 +299,7 @@ class FileField(Field):
help_text: _StrOrPromise = ...,
error_messages: _ErrorMessagesMapping | None = ...,
show_hidden_initial: bool = ...,
validators: Sequence[_ValidatorCallable] = ...,
validators: Iterable[_ValidatorCallable] = ...,
localize: bool = ...,
disabled: bool = ...,
label_suffix: str | None = ...,
Expand Down Expand Up @@ -335,7 +335,7 @@ class URLField(CharField):
help_text: _StrOrPromise = ...,
error_messages: _ErrorMessagesMapping | None = ...,
show_hidden_initial: bool = ...,
validators: Sequence[_ValidatorCallable] = ...,
validators: Iterable[_ValidatorCallable] = ...,
localize: bool = ...,
disabled: bool = ...,
label_suffix: str | None = ...,
Expand Down Expand Up @@ -377,7 +377,7 @@ class ChoiceField(Field):
help_text: _StrOrPromise = ...,
error_messages: _ErrorMessagesMapping | None = ...,
show_hidden_initial: bool = ...,
validators: Sequence[_ValidatorCallable] = ...,
validators: Iterable[_ValidatorCallable] = ...,
localize: bool = ...,
disabled: bool = ...,
label_suffix: str | None = ...,
Expand Down Expand Up @@ -412,7 +412,7 @@ class TypedChoiceField(ChoiceField):
help_text: _StrOrPromise = ...,
error_messages: _ErrorMessagesMapping | None = ...,
show_hidden_initial: bool = ...,
validators: Sequence[_ValidatorCallable] = ...,
validators: Iterable[_ValidatorCallable] = ...,
localize: bool = ...,
disabled: bool = ...,
label_suffix: str | None = ...,
Expand Down Expand Up @@ -446,7 +446,7 @@ class TypedMultipleChoiceField(MultipleChoiceField):
help_text: _StrOrPromise = ...,
error_messages: _ErrorMessagesMapping | None = ...,
show_hidden_initial: bool = ...,
validators: Sequence[_ValidatorCallable] = ...,
validators: Iterable[_ValidatorCallable] = ...,
localize: bool = ...,
disabled: bool = ...,
label_suffix: str | None = ...,
Expand All @@ -469,7 +469,7 @@ class ComboField(Field):
help_text: _StrOrPromise = ...,
error_messages: _ErrorMessagesMapping | None = ...,
show_hidden_initial: bool = ...,
validators: Sequence[_ValidatorCallable] = ...,
validators: Iterable[_ValidatorCallable] = ...,
localize: bool = ...,
disabled: bool = ...,
label_suffix: str | None = ...,
Expand All @@ -492,7 +492,7 @@ class MultiValueField(Field):
help_text: _StrOrPromise = ...,
error_messages: _ErrorMessagesMapping | None = ...,
show_hidden_initial: bool = ...,
validators: Sequence[_ValidatorCallable] = ...,
validators: Iterable[_ValidatorCallable] = ...,
localize: bool = ...,
disabled: bool = ...,
label_suffix: str | None = ...,
Expand Down Expand Up @@ -530,7 +530,7 @@ class FilePathField(ChoiceField):
help_text: _StrOrPromise = ...,
error_messages: _ErrorMessagesMapping | None = ...,
show_hidden_initial: bool = ...,
validators: Sequence[_ValidatorCallable] = ...,
validators: Iterable[_ValidatorCallable] = ...,
localize: bool = ...,
disabled: bool = ...,
label_suffix: str | None = ...,
Expand All @@ -553,7 +553,7 @@ class SplitDateTimeField(MultiValueField):
help_text: _StrOrPromise = ...,
error_messages: _ErrorMessagesMapping | None = ...,
show_hidden_initial: bool = ...,
validators: Sequence[_ValidatorCallable] = ...,
validators: Iterable[_ValidatorCallable] = ...,
localize: bool = ...,
disabled: bool = ...,
label_suffix: str | None = ...,
Expand All @@ -575,7 +575,7 @@ class GenericIPAddressField(CharField):
help_text: _StrOrPromise = ...,
error_messages: _ErrorMessagesMapping | None = ...,
show_hidden_initial: bool = ...,
validators: Sequence[_ValidatorCallable] = ...,
validators: Iterable[_ValidatorCallable] = ...,
localize: bool = ...,
disabled: bool = ...,
label_suffix: str | None = ...,
Expand All @@ -600,7 +600,7 @@ class SlugField(CharField):
help_text: _StrOrPromise = ...,
error_messages: _ErrorMessagesMapping | None = ...,
show_hidden_initial: bool = ...,
validators: Sequence[_ValidatorCallable] = ...,
validators: Iterable[_ValidatorCallable] = ...,
localize: bool = ...,
disabled: bool = ...,
label_suffix: str | None = ...,
Expand Down
Loading