PY-90606 Update django stubs version to 6.0.6

Closes PY-90606


(cherry picked from commit 8cfe053d970e2b038d401a8274e742828395991f)

IJ-MR-214051

GitOrigin-RevId: c52691e152bcb3abf19e42e35fe99b2dcd8ecdbe
This commit is contained in:
PyCharm Automation Bot
2026-07-20 11:47:59 +00:00
committed by intellij-monorepo-bot
parent 258525024c
commit 97dbe006f3
21 changed files with 140 additions and 75 deletions
@@ -431,6 +431,7 @@ AUTH_PASSWORD_VALIDATORS: list[_AuthPasswordValidatorsDict]
# SIGNING #
###########
SIGNED_COOKIE_LEGACY_SALT_FALLBACK: bool
SIGNING_BACKEND: str
########
@@ -60,7 +60,7 @@ class StringAgg(OrderableAggMixin, Aggregate):
delimiter: Any,
*,
distinct: bool = False,
filter: Q | None = None,
filter: Q | BaseExpression | None = None,
default: Any | None = None,
ordering: _OrderByFieldName | Sequence[_OrderByFieldName] = ...,
order_by: _OrderByFieldName | Sequence[_OrderByFieldName] = ...,
@@ -12,7 +12,7 @@ class OrderableAggMixin:
self,
*expressions: BaseExpression | Combinable | str,
distinct: bool = False,
filter: Q | None = None,
filter: Q | BaseExpression | None = None,
default: Any | None = None,
ordering: _OrderByFieldName | Sequence[_OrderByFieldName] = ...,
order_by: _OrderByFieldName | Sequence[_OrderByFieldName] = ...,
@@ -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,
@@ -1,4 +1,5 @@
from collections.abc import Callable
from collections import deque
from collections.abc import Callable, Iterable
from contextlib import AbstractContextManager
from datetime import tzinfo
from logging import Logger
@@ -13,6 +14,7 @@ from django.db.backends.base.schema import BaseDatabaseSchemaEditor
from django.db.backends.base.validation import BaseDatabaseValidation
from django.db.backends.utils import CursorDebugWrapper, CursorWrapper
from django.db.transaction import Atomic
from django.db.utils import DatabaseErrorWrapper
from django.utils.functional import cached_property
from typing_extensions import Self
@@ -42,7 +44,7 @@ class BaseDatabaseWrapper:
connection: Any
settings_dict: dict[str, Any]
alias: str
queries_log: Any
queries_log: deque[dict[str, str]]
force_debug_cursor: bool
autocommit: bool
in_atomic_block: bool
@@ -78,7 +80,7 @@ class BaseDatabaseWrapper:
def get_connection_params(self) -> dict[str, Any]: ...
def get_new_connection(self, conn_params: Any) -> Any: ...
def init_connection_state(self) -> None: ...
def create_cursor(self, name: Any | None = None) -> Any: ...
def create_cursor(self, name: str | None = None) -> Any: ...
def connect(self) -> None: ...
def check_settings(self) -> None: ...
def ensure_connection(self) -> None: ...
@@ -101,7 +103,7 @@ class BaseDatabaseWrapper:
def constraint_checks_disabled(self) -> AbstractContextManager[None]: ...
def disable_constraint_checking(self) -> bool: ...
def enable_constraint_checking(self) -> None: ...
def check_constraints(self, table_names: Any | None = None) -> None: ...
def check_constraints(self, table_names: Iterable[str] | None = None) -> None: ...
def is_usable(self) -> bool: ...
def close_if_health_check_failed(self) -> None: ...
def close_if_unusable_or_obsolete(self) -> None: ...
@@ -112,7 +114,7 @@ class BaseDatabaseWrapper:
def validate_thread_sharing(self) -> None: ...
def prepare_database(self) -> None: ...
@cached_property
def wrap_database_errors(self) -> Any: ...
def wrap_database_errors(self) -> DatabaseErrorWrapper: ...
def chunked_cursor(self) -> CursorWrapper: ...
def make_debug_cursor(self, cursor: CursorWrapper) -> CursorDebugWrapper: ...
def make_cursor(self, cursor: CursorWrapper) -> CursorWrapper: ...
@@ -1,9 +1,11 @@
from collections.abc import Iterable
from typing import Any, NamedTuple
from typing import Any, Literal, NamedTuple, type_check_only
from django.db.backends.base.base import BaseDatabaseWrapper
from django.db.backends.utils import CursorWrapper
from django.db.models.base import Model
from django.db.models.fields import Field
from typing_extensions import NotRequired, TypedDict
class TableInfo(NamedTuple):
name: str
@@ -20,6 +22,25 @@ class FieldInfo(NamedTuple):
default: str
collation: str
@type_check_only
class _ConstraintDict(TypedDict):
columns: list[str]
primary_key: bool
unique: bool
foreign_key: tuple[str, str] | None
check: bool
index: bool
orders: NotRequired[list[Literal["ASC", "DESC"]]]
type: NotRequired[str]
definition: NotRequired[str | None]
options: NotRequired[dict[str, str] | None]
@type_check_only
class _SequenceDict(TypedDict):
table: str
column: str
name: NotRequired[str]
class BaseDatabaseIntrospection:
data_types_reverse: Any
connection: BaseDatabaseWrapper
@@ -28,14 +49,16 @@ class BaseDatabaseIntrospection:
def get_field_type(self, data_type: str, description: FieldInfo) -> str: ...
def identifier_converter(self, name: str) -> str: ...
def table_names(self, cursor: CursorWrapper | None = None, include_views: bool = False) -> list[str]: ...
def get_table_list(self, cursor: CursorWrapper | None) -> Any: ...
def get_table_description(self, cursor: CursorWrapper | None, table_name: str) -> Any: ...
def get_table_list(self, cursor: CursorWrapper) -> list[TableInfo]: ...
def get_table_description(self, cursor: CursorWrapper, table_name: str) -> list[Any]: ...
def get_migratable_models(self) -> Iterable[type[Model]]: ...
def django_table_names(self, only_existing: bool = False, include_views: bool = True) -> list[str]: ...
def installed_models(self, tables: list[str]) -> set[type[Model]]: ...
def sequence_list(self) -> list[dict[str, str]]: ...
def get_sequences(self, cursor: CursorWrapper | None, table_name: str, table_fields: Any = ()) -> Any: ...
def get_relations(self, cursor: CursorWrapper | None, table_name: str) -> dict[str, tuple[str, str]]: ...
def get_primary_key_column(self, cursor: CursorWrapper | None, table_name: str) -> str | None: ...
def get_primary_key_columns(self, cursor: CursorWrapper | None, table_name: str) -> list[str] | None: ...
def get_constraints(self, cursor: CursorWrapper | None, table_name: str) -> Any: ...
def get_sequences(
self, cursor: CursorWrapper, table_name: str, table_fields: Iterable[Field] = ()
) -> list[_SequenceDict]: ...
def get_relations(self, cursor: CursorWrapper, table_name: str) -> dict[str, tuple[str, str]]: ...
def get_primary_key_column(self, cursor: CursorWrapper, table_name: str) -> str | None: ...
def get_primary_key_columns(self, cursor: CursorWrapper, table_name: str) -> list[str] | None: ...
def get_constraints(self, cursor: CursorWrapper, table_name: str) -> dict[str, _ConstraintDict]: ...
@@ -71,10 +71,10 @@ class BaseDatabaseOperations:
def savepoint_rollback_sql(self, sid: str) -> str: ...
def set_time_zone_sql(self) -> str: ...
def sql_flush(
self, style: Any, tables: Sequence[str], *, reset_sequences: bool = False, allow_cascade: bool = False
self, style: Style, tables: Sequence[str], *, reset_sequences: bool = False, allow_cascade: bool = False
) -> list[str]: ...
def execute_sql_flush(self, sql_list: Iterable[str]) -> None: ...
def sequence_reset_by_name_sql(self, style: Style | None, sequences: list[Any]) -> list[Any]: ...
def sequence_reset_by_name_sql(self, style: Style, sequences: list[Any]) -> list[Any]: ...
def sequence_reset_sql(self, style: Style, model_list: Sequence[type[Model]]) -> list[Any]: ...
def start_transaction_sql(self) -> str: ...
def end_transaction_sql(self, success: bool = True) -> str: ...
@@ -2,6 +2,8 @@ from typing import Any, NamedTuple
from django.db.backends.base.introspection import BaseDatabaseIntrospection
from django.db.backends.mysql.base import DatabaseWrapper
from django.db.backends.utils import CursorWrapper
from typing_extensions import override
FieldInfo: Any
@@ -26,3 +28,5 @@ class DatabaseIntrospection(BaseDatabaseIntrospection):
connection: DatabaseWrapper
data_types_reverse: Any
def get_storage_engine(self, cursor: Any, table_name: str) -> str: ...
@override
def get_table_description(self, cursor: CursorWrapper, table_name: str) -> list[FieldInfo]: ...
@@ -1,5 +1,6 @@
from typing import Any
from django.core.management.color import Style
from django.db.backends.base.operations import BaseDatabaseOperations
from django.db.backends.mysql.base import DatabaseWrapper
from django.db.models.constants import OnConflict
@@ -37,7 +38,7 @@ class DatabaseOperations(BaseDatabaseOperations):
@override
def quote_name(self, name: str) -> Any: ...
@override
def sequence_reset_by_name_sql(self, style: Any, sequences: Any) -> Any: ...
def sequence_reset_by_name_sql(self, style: Style, sequences: Any) -> Any: ...
@override
def validate_autopk_value(self, value: Any) -> Any: ...
@override
@@ -2,6 +2,8 @@ from typing import Any, NamedTuple
from django.db.backends.base.introspection import BaseDatabaseIntrospection
from django.db.backends.oracle.base import DatabaseWrapper
from django.db.backends.utils import CursorWrapper
from typing_extensions import override
FieldInfo: Any
@@ -14,3 +16,6 @@ class DatabaseIntrospection(BaseDatabaseIntrospection):
connection: DatabaseWrapper
cache_bust_counter: int
data_types_reverse: dict[int, str]
@override
def get_table_description(self, cursor: CursorWrapper, table_name: str) -> list[FieldInfo]: ...
@@ -1,5 +1,6 @@
from typing import Any
from django.core.management.color import Style
from django.db.backends.base.operations import BaseDatabaseOperations
from django.db.backends.oracle.base import DatabaseWrapper
from typing_extensions import override
@@ -66,9 +67,9 @@ class DatabaseOperations(BaseDatabaseOperations):
@override
def regex_lookup(self, lookup_type: str) -> str: ...
@override
def sequence_reset_by_name_sql(self, style: Any, sequences: Any) -> list[str]: ...
def sequence_reset_by_name_sql(self, style: Style, sequences: Any) -> list[str]: ...
@override
def sequence_reset_sql(self, style: Any, model_list: Any) -> list[str]: ...
def sequence_reset_sql(self, style: Style, model_list: Any) -> list[str]: ...
@override
def start_transaction_sql(self) -> str: ...
@override
@@ -2,6 +2,8 @@ from typing import NamedTuple
from django.db.backends.base.introspection import BaseDatabaseIntrospection
from django.db.backends.postgresql.base import DatabaseWrapper
from django.db.backends.utils import CursorWrapper
from typing_extensions import override
class FieldInfo(NamedTuple):
name: str
@@ -26,3 +28,6 @@ class DatabaseIntrospection(BaseDatabaseIntrospection):
data_types_reverse: dict[int, str]
index_default_access_method: str
ignored_tables: list[str]
@override
def get_table_description(self, cursor: CursorWrapper, table_name: str) -> list[FieldInfo]: ...
@@ -2,6 +2,8 @@ from typing import Any, NamedTuple
from django.db.backends.base.introspection import BaseDatabaseIntrospection
from django.db.backends.sqlite3.base import DatabaseWrapper
from django.db.backends.utils import CursorWrapper
from typing_extensions import override
class FieldInfo(NamedTuple):
name: str
@@ -26,3 +28,6 @@ class FlexibleFieldLookupDict:
class DatabaseIntrospection(BaseDatabaseIntrospection):
connection: DatabaseWrapper
@override
def get_table_description(self, cursor: CursorWrapper, table_name: str) -> list[FieldInfo]: ...
@@ -2,7 +2,7 @@ from collections.abc import Sequence
from typing import Any, ClassVar
from django.db.backends.base.base import BaseDatabaseWrapper
from django.db.models.expressions import Combinable, Func
from django.db.models.expressions import BaseExpression, Combinable, Func
from django.db.models.fields import IntegerField
from django.db.models.functions.mixins import FixDurationInputMixin, NumericOutputFieldMixin
from django.db.models.query import _OrderByFieldName
@@ -20,7 +20,7 @@ class Aggregate(Func):
self,
*expressions: Any,
distinct: bool = False,
filter: Q | None = None,
filter: Q | BaseExpression | None = None,
default: Any | None = None,
order_by: _OrderByFieldName | Sequence[_OrderByFieldName] | None = None,
**extra: Any,
@@ -45,7 +45,7 @@ class Count(Aggregate):
def __init__(
self,
expression: Combinable | str,
filter: Q | None = None,
filter: Q | BaseExpression | None = None,
*,
distinct: bool = False,
**extra: Any,
@@ -60,7 +60,7 @@ class StdDev(NumericOutputFieldMixin, Aggregate):
expression: Combinable | str,
sample: bool = False,
*,
filter: Q | None = None,
filter: Q | BaseExpression | None = None,
default: Any | None = None,
**extra: Any,
) -> None: ...
@@ -72,7 +72,7 @@ class StringAgg(Aggregate):
delimiter: str | Combinable,
*,
distinct: bool = False,
filter: Q | None = None,
filter: Q | BaseExpression | None = None,
default: Any | None = None,
order_by: _OrderByFieldName | Sequence[_OrderByFieldName] | None = None,
**extra: Any,
@@ -90,7 +90,7 @@ class Variance(NumericOutputFieldMixin, Aggregate):
expression: Combinable | str,
sample: bool = False,
*,
filter: Q | None = None,
filter: Q | BaseExpression | None = None,
default: Any | None = None,
**extra: Any,
) -> None: ...
@@ -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
@@ -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
@@ -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 = ...,
@@ -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: ...
@@ -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
@@ -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,
@@ -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,
@@ -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
@@ -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,
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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] = ...,
@@ -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
@@ -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
@@ -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
@@ -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: ...
@@ -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: ...
@@ -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: ...
@@ -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: ...
@@ -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
@@ -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,
@@ -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 = ...,
@@ -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 = ...,
@@ -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 = ...,
@@ -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 = ...,
@@ -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 = ...,
@@ -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 = ...,
@@ -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 = ...,
@@ -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 = ...,
@@ -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 = ...,
@@ -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 = ...,
@@ -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 = ...,
@@ -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 = ...,
@@ -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 = ...,
@@ -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 = ...,
@@ -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 = ...,
@@ -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 = ...,
@@ -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 = ...,
@@ -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 = ...,
@@ -1,7 +1,7 @@
from collections.abc import Callable
from dataclasses import dataclass
from datetime import datetime
from typing import Any, Generic, overload
from typing import Any, Concatenate, Generic, Literal, overload
from django.db.models.enums import TextChoices as TextChoices
from django.utils.module_loading import import_string as import_string
@@ -30,7 +30,8 @@ _R = TypeVar("_R")
@dataclass(kw_only=True)
class Task(Generic[_P, _R]):
priority: int
func: Callable[_P, _R]
# Loose: `_P` excludes `TaskContext` when `takes_context=True`, so `func` may have an extra leading param.
func: Callable[..., _R]
backend: str
queue_name: str
run_after: datetime | None
@@ -56,6 +57,15 @@ class Task(Generic[_P, _R]):
@property
def module_path(self) -> str: ...
@overload
def task(
function: Callable[Concatenate[TaskContext[Any, Any], _P], _R],
*,
priority: int | None = None,
queue_name: str | None = None,
backend: str | None = None,
takes_context: Literal[True],
) -> Task[_P, _R]: ...
@overload
def task(
function: Callable[_P, _R],
@@ -63,7 +73,7 @@ def task(
priority: int | None = None,
queue_name: str | None = None,
backend: str | None = None,
takes_context: bool = ...,
takes_context: Literal[False] = False,
) -> Task[_P, _R]: ...
@overload
def task(
@@ -71,7 +81,15 @@ def task(
priority: int | None = None,
queue_name: str | None = None,
backend: str | None = None,
takes_context: bool = ...,
takes_context: Literal[True],
) -> Callable[[Callable[Concatenate[TaskContext[Any, Any], _P], _R]], Task[_P, _R]]: ...
@overload
def task(
*,
priority: int | None = None,
queue_name: str | None = None,
backend: str | None = None,
takes_context: Literal[False] = False,
) -> Callable[[Callable[_P, _R]], Task[_P, _R]]: ...
@dataclass(kw_only=True)
@@ -10,7 +10,7 @@ class DjangoUnicodeDecodeError(UnicodeDecodeError): ...
_P = TypeVar("_P", bound=Promise)
_S = TypeVar("_S", bound=str)
_B = TypeVar("_B", bound=bytes)
_PT = TypeVar("_PT", None, int, float, Decimal, datetime.datetime, datetime.date, datetime.time)
_PT = TypeVar("_PT", bound=int | float | Decimal | datetime.date | datetime.time | None)
@overload
def smart_str(s: object, encoding: str = "utf-8", *, errors: str = "strict") -> str: ...