diff --git a/python/helpers/bundled_stubs/Django/django-stubs/conf/__init__.pyi b/python/helpers/bundled_stubs/Django/django-stubs/conf/__init__.pyi index 03d0c4635159..55fa7c251afc 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/conf/__init__.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/conf/__init__.pyi @@ -1,7 +1,7 @@ -from typing import Any, Literal, type_check_only +from typing import Any, Literal, Self, type_check_only from django.utils.functional import LazyObject -from typing_extensions import Self, override +from typing_extensions import override # explicit dependency on standard settings to make it loaded from . import global_settings # noqa: F401 @@ -10,6 +10,12 @@ ENVIRONMENT_VARIABLE: Literal["DJANGO_SETTINGS_MODULE"] DEFAULT_STORAGE_ALIAS: Literal["default"] STATICFILES_STORAGE_ALIAS: Literal["staticfiles"] +# RemovedInDjango70Warning. +SIGNED_COOKIE_LEGACY_SALT_DEPRECATED_MSG: str +USE_BLANK_CHOICE_DASH_DEPRECATED_MSG: str +DEPRECATED_EMAIL_SETTINGS: set[str] +EMAIL_SETTING_DEPRECATED_MSG: str + # required for plugin to be able to distinguish this specific instance of LazySettings from others @type_check_only class _DjangoConfLazyObject(LazyObject[Any]): diff --git a/python/helpers/bundled_stubs/Django/django-stubs/conf/global_settings.pyi b/python/helpers/bundled_stubs/Django/django-stubs/conf/global_settings.pyi index 7765a55a2e28..f3397769de25 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/conf/global_settings.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/conf/global_settings.pyi @@ -1,9 +1,8 @@ from collections.abc import Collection, Mapping, Sequence from re import Pattern -from typing import Any, Literal, Protocol, TypeAlias, TypedDict, type_check_only +from typing import Any, Literal, NotRequired, Protocol, TypeAlias, TypedDict, type_check_only from django.utils.functional import _StrOrPromise -from typing_extensions import NotRequired from django_stubs_ext.settings import TemplatesSetting @@ -97,6 +96,11 @@ class Router(Protocol): DATABASE_ROUTERS: list[str | Router] +# Mailer configurations. No mailers are defined by default. +# RemovedInDjango70Warning: uncomment the next line. +# MAILERS: Mapping[str, Mapping[str, Any]] + +# RemovedInDjango70Warning. # The email backend to use. For possible shortcuts see django.core.mail. # The default is to use the SMTP backend. # Third-party backends can be specified by providing a Python path @@ -107,15 +111,18 @@ EMAIL_BACKEND: str # Because Django doesn't define it, we can't provide its type here. Use `getattr` for type-safe access # e.g. `getattr(settings, "EMAIL_FILE_PATH")` +# RemovedInDjango70Warning. # Host for sending email. EMAIL_HOST: str +# RemovedInDjango70Warning. # Port for sending email. EMAIL_PORT: int # Whether to send SMTP 'Date' header in the local time zone or in UTC. EMAIL_USE_LOCALTIME: bool +# RemovedInDjango70Warning. # Optional SMTP authentication information for EMAIL_HOST. EMAIL_HOST_USER: str EMAIL_HOST_PASSWORD: str @@ -132,6 +139,9 @@ TEMPLATES: list[TemplatesSetting] # Default form rendering class. FORM_RENDERER: str +# RemovedInDjango70Warning: This setting allows to revert back to the old +# blank choice label in Django 6.1. +USE_BLANK_CHOICE_DASH: bool # Default email address to use for various automated correspondence from # the site managers. diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/admin/__init__.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/admin/__init__.pyi index 486e4c75370a..0491400f7321 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/contrib/admin/__init__.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/admin/__init__.pyi @@ -14,6 +14,8 @@ from .filters import RelatedOnlyFieldListFilter as RelatedOnlyFieldListFilter from .filters import SimpleListFilter as SimpleListFilter from .options import HORIZONTAL as HORIZONTAL from .options import VERTICAL as VERTICAL +from .options import Action as Action +from .options import ActionLocation as ActionLocation from .options import ModelAdmin as ModelAdmin from .options import ShowFacets as ShowFacets from .options import StackedInline as StackedInline @@ -26,6 +28,8 @@ def autodiscover() -> None: ... __all__ = [ "HORIZONTAL", "VERTICAL", + "Action", + "ActionLocation", "AdminSite", "AllValuesFieldListFilter", "BooleanFieldListFilter", diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/admin/decorators.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/admin/decorators.pyi index 1267ddcfc9df..9fb0b8ab0e6c 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/contrib/admin/decorators.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/admin/decorators.pyi @@ -1,7 +1,7 @@ from collections.abc import Callable, Sequence from typing import Any, overload -from django.contrib.admin import ModelAdmin +from django.contrib.admin import ActionLocation, ModelAdmin from django.contrib.admin.sites import AdminSite from django.db.models.base import Model from django.db.models.expressions import BaseExpression, Combinable @@ -17,6 +17,8 @@ def action( *, permissions: Sequence[str] | None = ..., description: _StrOrPromise | None = ..., + description_plural: _StrOrPromise | None = ..., + location: ActionLocation = ..., ) -> _F: ... @overload def action( @@ -24,6 +26,8 @@ def action( *, permissions: Sequence[str] | None = ..., description: _StrOrPromise | None = ..., + description_plural: _StrOrPromise | None = ..., + location: ActionLocation = ..., ) -> Callable[[_F], _F]: ... @overload def display( diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/admin/options.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/admin/options.pyi index 51de4285e67f..3ebe227c10fb 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/contrib/admin/options.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/admin/options.pyi @@ -1,6 +1,8 @@ import enum +import sys from collections.abc import Callable, Iterable, Iterator, Mapping, Sequence -from typing import Any, ClassVar, Generic, Literal, TypeAlias, cast, type_check_only +from dataclasses import dataclass +from typing import Any, ClassVar, Generic, Literal, Self, TypeAlias, cast, type_check_only from django import forms from django.contrib.admin.filters import FieldListFilter, ListFilter @@ -33,21 +35,42 @@ from django.urls.resolvers import URLPattern from django.utils.datastructures import _ListOrTuple from django.utils.functional import _StrOrPromise from django.utils.safestring import SafeString -from typing_extensions import Self, TypedDict, TypeVar, override +from typing_extensions import TypedDict, TypeVar, deprecated, override -IS_POPUP_VAR: str -TO_FIELD_VAR: str -IS_FACETS_VAR: str -HORIZONTAL: Literal[1] -VERTICAL: Literal[2] - -_Direction: TypeAlias = Literal[1, 2] +IS_POPUP_VAR: Literal["_popup"] +SOURCE_MODEL_VAR: Literal["_source_model"] +TO_FIELD_VAR: Literal["_to_field"] +IS_FACETS_VAR: Literal["_facets"] +EMPTY_VALUE_STRING: Literal["-"] class ShowFacets(enum.Enum): NEVER = cast(str, ...) ALLOW = cast(str, ...) ALWAYS = cast(str, ...) +class ActionLocation(enum.Enum): + CHANGE_FORM = cast(str, ...) + CHANGE_LIST = cast(str, ...) + +HORIZONTAL: Literal[1] +VERTICAL: Literal[2] + +_Direction: TypeAlias = Literal[1, 2] + +@dataclass +class Action: + func: _ActionCallable[ModelAdmin[Any], Any] + name: str + description: str + plural_description: str + locations: list[ActionLocation] + # RemovedInDjango70Warning. + @deprecated("Unpacking an action tuple is deprecated. Use Action attributes instead.") + def __iter__(self) -> Iterator[_ActionCallable[ModelAdmin[Any], Any] | str]: ... + # RemovedInDjango70Warning. + @deprecated("Using indexes on an action tuple is deprecated. Use Action attributes instead.") + def __getitem__(self, index: int) -> _ActionCallable[ModelAdmin[Any], Any] | str: ... + def get_content_type_for_model(obj: type[Model] | Model) -> ContentType: ... def get_ul_class(radio_style: int) -> str: ... @@ -101,6 +124,7 @@ class BaseModelAdmin(Generic[_ModelT], metaclass=MediaDefiningClass): sortable_by: ClassVar[_ListOrTuple[str] | None] show_full_result_count: ClassVar[bool] checks_class: ClassVar[Any] + delete_confirmation_max_display: ClassVar[int | None] model: type[_ModelT] opts: Options[_ModelT] admin_site: AdminSite @@ -217,11 +241,29 @@ class ModelAdmin(BaseModelAdmin[_ModelT]): def log_change(self, request: HttpRequest, obj: _ModelT, message: Any) -> LogEntry: ... def log_deletions(self, request: HttpRequest, queryset: QuerySet[_ModelT]) -> list[LogEntry]: ... def action_checkbox(self, obj: _ModelT) -> SafeString: ... - def get_actions(self, request: HttpRequest) -> dict[str, tuple[Callable[..., str], str, str] | None]: ... - def get_action_choices( - self, request: HttpRequest, default_choices: list[tuple[str, str]] = ... - ) -> list[tuple[str, str]]: ... - def get_action(self, action: Callable[..., Any] | str) -> tuple[Callable[..., str], str, str] | None: ... + # Django 6.0 requires Python 3.12, so the `else` branch can only ever meet + # Django 5.x: it keeps the Django 5.x action signatures. + if sys.version_info >= (3, 12): + def get_actions( + self, request: HttpRequest, action_location: ActionLocation = ... + ) -> dict[str, Action | None]: ... + def get_action_choices( + self, + request: HttpRequest, + default_choices: list[tuple[str, str]] | None = ..., + action_location: ActionLocation = ..., + ) -> list[tuple[str, str]]: ... + def get_action( + self, + action: _ActionCallable[Self, _ModelT] | str, + action_location: ActionLocation = ..., + ) -> Action | None: ... + else: + def get_actions(self, request: HttpRequest) -> dict[str, tuple[Callable[..., str], str, str] | None]: ... + def get_action_choices( + self, request: HttpRequest, default_choices: list[tuple[str, str]] = ... + ) -> list[tuple[str, str]]: ... + def get_action(self, action: Callable[..., Any] | str) -> tuple[Callable[..., str], str, str] | None: ... def get_list_display(self, request: HttpRequest) -> _ListDisplayT[_ModelT]: ... def get_list_display_links( self, request: HttpRequest, list_display: _ListDisplayT[_ModelT] @@ -266,7 +308,9 @@ class ModelAdmin(BaseModelAdmin[_ModelT]): def response_post_save_add(self, request: HttpRequest, obj: _ModelT) -> HttpResponseRedirect: ... def response_post_save_change(self, request: HttpRequest, obj: _ModelT) -> HttpResponseRedirect: ... # Probably FileResponse cannot come from ModelAdmin views - def response_action(self, request: HttpRequest, queryset: QuerySet[Any]) -> HttpResponse | None: ... + def response_action( + self, request: HttpRequest, queryset: QuerySet[Any], action_location: ActionLocation = ... + ) -> HttpResponse | None: ... def response_delete(self, request: HttpRequest, obj_display: str, obj_id: int) -> HttpResponse: ... def render_delete_form(self, request: HttpRequest, context: dict[str, Any]) -> HttpResponse: ... def get_inline_formsets( diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/admin/sites.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/admin/sites.pyi index db90922e99c8..ac391ae13513 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/contrib/admin/sites.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/admin/sites.pyi @@ -1,10 +1,10 @@ from collections.abc import Callable, Iterable, Sequence -from typing import Any, TypeAlias +from typing import Any from weakref import WeakSet from django.apps.config import AppConfig from django.contrib.admin.models import LogEntry -from django.contrib.admin.options import ModelAdmin +from django.contrib.admin.options import ModelAdmin, _ActionCallable from django.contrib.auth.forms import AuthenticationForm, PasswordChangeForm from django.core.checks import CheckMessage from django.db.models.base import Model @@ -20,7 +20,6 @@ all_sites: WeakSet[AdminSite] _ViewType = TypeVar("_ViewType", bound=Callable[..., HttpResponseBase]) _ModelT = TypeVar("_ModelT", bound=Model) -_ActionCallback: TypeAlias = Callable[[ModelAdmin[Any], HttpRequest, QuerySet[Any]], TemplateResponse | None] class AdminSite: site_title: _StrOrPromise @@ -41,8 +40,8 @@ class AdminSite: final_catch_all_view: bool _empty_value_display: str _registry: dict[type[Model], ModelAdmin[Any]] - _global_actions: dict[str, _ActionCallback] - _actions: dict[str, _ActionCallback] + _global_actions: dict[str, _ActionCallable[ModelAdmin[Any], Any]] + _actions: dict[str, _ActionCallable[ModelAdmin[Any], Any]] def __init__(self, name: str = ...) -> None: ... def check(self, app_configs: Sequence[AppConfig] | None) -> list[CheckMessage]: ... def register( @@ -54,11 +53,11 @@ class AdminSite: def unregister(self, model_or_iterable: type[Model] | Iterable[type[Model]]) -> None: ... def is_registered(self, model: type[Model]) -> bool: ... def get_model_admin(self, model: type[_ModelT]) -> ModelAdmin[_ModelT]: ... - def add_action(self, action: _ActionCallback, name: str | None = ...) -> None: ... + def add_action(self, action: _ActionCallable[ModelAdmin[_ModelT], _ModelT], name: str | None = ...) -> None: ... def disable_action(self, name: str) -> None: ... - def get_action(self, name: str) -> _ActionCallback: ... + def get_action(self, name: str) -> _ActionCallable[ModelAdmin[_ModelT], _ModelT]: ... @property - def actions(self) -> Iterable[tuple[str, _ActionCallback]]: ... + def actions(self) -> Iterable[tuple[str, _ActionCallable[ModelAdmin[_ModelT], _ModelT]]]: ... def has_permission(self, request: HttpRequest) -> bool: ... def admin_view(self, view: _ViewType, cacheable: bool = ...) -> _ViewType: ... def get_urls(self) -> list[URLResolver | URLPattern]: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/admin/templatetags/admin_filters.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/admin/templatetags/admin_filters.pyi new file mode 100644 index 000000000000..5edbed90997f --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/admin/templatetags/admin_filters.pyi @@ -0,0 +1,8 @@ +from typing import Any + +from django.utils.safestring import SafeString + +register: Any + +def to_object_display_value(value: Any) -> str: ... +def truncated_unordered_list(value: Any, max_items: int, autoescape: bool = ...) -> SafeString: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/admin/templatetags/admin_modify.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/admin/templatetags/admin_modify.pyi index 67ee4c6783f7..f2ea9d4f99fa 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/contrib/admin/templatetags/admin_modify.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/admin/templatetags/admin_modify.pyi @@ -14,3 +14,4 @@ def submit_row(context: RequestContext) -> Context: ... def submit_row_tag(parser: Parser, token: Token) -> InclusionAdminNode: ... def change_form_object_tools_tag(parser: Parser, token: Token) -> InclusionAdminNode: ... def cell_count(inline_admin_form: InlineAdminForm) -> int: ... +def admin_actions_tag(parser: Parser, token: Token) -> InclusionAdminNode: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/admin/templatetags/base.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/admin/templatetags/base.pyi index 407eccbdfdab..33181ec69db9 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/contrib/admin/templatetags/base.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/admin/templatetags/base.pyi @@ -14,7 +14,13 @@ class InclusionAdminNode(InclusionNode): takes_context: bool template_name: str def __init__( - self, parser: Parser, token: Token, func: Callable[..., Any], template_name: str, takes_context: bool = ... + self, + name: str, + parser: Parser, + token: Token, + func: Callable[..., Any], + template_name: str, + takes_context: bool = ..., ) -> None: ... @override def render(self, context: Context) -> SafeString: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/admin/utils.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/admin/utils.pyi index 9759f480e1ea..511cdcf9a3c0 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/contrib/admin/utils.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/admin/utils.pyi @@ -4,7 +4,6 @@ from re import Pattern from typing import Any, Literal, overload, type_check_only from uuid import UUID -from _typeshed import Unused from django.contrib.admin.options import BaseModelAdmin, _DisplayT, _FieldGroups, _FieldsetSpec, _ListDisplayT, _ModelT from django.contrib.admin.sites import AdminSite from django.db.models.base import Model @@ -51,6 +50,8 @@ class NestedObjects(Collector): edges: dict[Model, list[Model]] protected: set[Model] model_objs: defaultdict[str, set[Model]] + @override + def __init__(self, *args: object, force_collection: bool = ..., **kwargs: object) -> None: ... def add_edge(self, source: Model | None, target: Model) -> None: ... @override def collect( # type: ignore[override] @@ -73,8 +74,6 @@ class NestedObjects(Collector): def nested(self, format_callback: None = None) -> list[Any]: ... @overload def nested(self, format_callback: Callable[[Model], _T]) -> list[Any]: ... - @override - def can_fast_delete(self, *args: Unused, **kwargs: Unused) -> Literal[False]: ... @type_check_only class _ModelFormatDict(TypedDict): diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/admin/views/main.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/admin/views/main.pyi index d546df1a2629..30bf52e6b66c 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/contrib/admin/views/main.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/admin/views/main.pyi @@ -93,5 +93,5 @@ class ChangeList: has_active_filters: bool clear_all_filters_qs: str def apply_select_related(self, qs: QuerySet[Any]) -> QuerySet[Any]: ... - def has_related_field_in_list_display(self) -> bool: ... + def get_select_related_fields(self) -> list[str]: ... def url_for_result(self, result: Model) -> str: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/auth/__init__.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/auth/__init__.pyi index 2608544452c6..14f95cec3d24 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/contrib/auth/__init__.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/auth/__init__.pyi @@ -29,3 +29,5 @@ async def aget_user(request: HttpRequest | Client) -> _AnyUser: ... def get_permission_codename(action: str, opts: Options[Any]) -> str: ... def update_session_auth_hash(request: HttpRequest, user: _User) -> None: ... async def aupdate_session_auth_hash(request: HttpRequest, user: _User) -> None: ... +def check_password_with_timing_attack_mitigation(user: _User | None, password: str | None) -> bool: ... +async def acheck_password_with_timing_attack_mitigation(user: _User | None, password: str | None) -> bool: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/auth/management/__init__.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/auth/management/__init__.pyi index 82fac24c07d7..26055a51ec8a 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/contrib/auth/management/__init__.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/auth/management/__init__.pyi @@ -1,7 +1,9 @@ -from typing import Any +from collections.abc import Sequence +from typing import Any, TextIO from django.apps.config import AppConfig from django.apps.registry import Apps +from django.db.migrations.migration import Migration def create_permissions( app_config: AppConfig, @@ -11,5 +13,14 @@ def create_permissions( apps: Apps = ..., **kwargs: Any, ) -> None: ... +def rename_permissions_after_model_rename( + app_config: AppConfig, + verbosity: int = ..., + plan: Sequence[tuple[Migration, bool]] | None = ..., + using: str = ..., + apps: Apps = ..., + stdout: TextIO = ..., + **kwargs: Any, +) -> None: ... def get_system_username() -> str: ... def get_default_username(check_db: bool = ..., database: str = ...) -> str: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/auth/management/commands/createsuperuser.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/auth/management/commands/createsuperuser.pyi index 8176304a022b..77ceedb525e8 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/contrib/auth/management/commands/createsuperuser.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/auth/management/commands/createsuperuser.pyi @@ -17,3 +17,5 @@ class Command(BaseCommand): def get_input_data(self, field: Field[Any, Any], message: str, default: str | None = ...) -> str | None: ... @cached_property def username_is_unique(self) -> bool: ... + @cached_property + def natural_key_defined(self) -> bool: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/auth/middleware.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/auth/middleware.pyi index 68e2512c85cd..9d0f5c147ebd 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/contrib/auth/middleware.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/auth/middleware.pyi @@ -38,6 +38,8 @@ class RemoteUserMiddleware: def __call__(self, request: HttpRequest) -> HttpResponseBase | Awaitable[HttpResponseBase]: ... async def __acall__(self, request: HttpRequest) -> HttpResponseBase: ... def clean_username(self, username: str, request: HttpRequest) -> str: ... + async def aclean_username(self, username: str, request: HttpRequest) -> str: ... + def get_username(self, request: HttpRequest) -> str: ... def process_request(self, request: HttpRequest) -> None: ... async def aprocess_request(self, request: HttpRequest) -> None: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/auth/models.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/auth/models.pyi index 6683bc93d396..9f6fa786c992 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/contrib/auth/models.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/auth/models.pyi @@ -1,6 +1,6 @@ import datetime as dt from collections.abc import Iterable -from typing import Any, ClassVar, Literal, TypeAlias +from typing import Any, ClassVar, Literal, Never, Self, TypeAlias from django.contrib.auth.base_user import AbstractBaseUser as AbstractBaseUser from django.contrib.auth.base_user import BaseUserManager as BaseUserManager @@ -12,7 +12,7 @@ from django.db.models.base import Model from django.db.models.expressions import Combinable from django.db.models.manager import EmptyManager from django.utils.functional import _StrOrPromise -from typing_extensions import Never, Self, TypeVar +from typing_extensions import TypeVar # This is our "placeholder" type the mypy plugin refines to configured 'AUTH_USER_MODEL' # wherever it is used as a type. The most recognised example of this is (probably) @@ -41,6 +41,8 @@ class Permission(models.Model): name: models.CharField[str | int | Combinable, str] content_type: models.ForeignKey[ContentType | Combinable, ContentType] codename: models.CharField[str | int | Combinable, str] + @property + def user_perm_str(self) -> str: ... def natural_key(self) -> tuple[str, str, str]: ... class GroupManager(models.Manager[Group]): diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/auth/views.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/auth/views.pyi index 290e13c5963e..2e46fe0ebf1a 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/contrib/auth/views.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/auth/views.pyi @@ -18,8 +18,8 @@ class RedirectURLMixin: redirect_field_name: str success_url_allowed_hosts: set[str] def get_success_url(self) -> str: ... - def get_redirect_url(self) -> str: ... - def get_success_url_allowed_hosts(self) -> set[str]: ... + def get_redirect_url(self, request: HttpRequest | None = None) -> str: ... + def get_success_url_allowed_hosts(self, request: HttpRequest | None = None) -> set[str]: ... def get_default_redirect_url(self) -> str: ... class LoginView(RedirectURLMixin, FormView[_AuthForm]): diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/contenttypes/fields.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/contenttypes/fields.pyi index dcfc8786b847..1b931a01ddc6 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/contrib/contenttypes/fields.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/contenttypes/fields.pyi @@ -1,5 +1,5 @@ -from collections.abc import Callable -from typing import Any +from collections.abc import Callable, Sequence +from typing import Any, Self, overload from django.contrib.contenttypes.models import ContentType from django.core.checks.messages import CheckMessage @@ -35,6 +35,18 @@ class GenericForeignKey(FieldCacheMixin, Field[Any, Any]): def __init__( self, ct_field: str = "content_type", fk_field: str = "object_id", for_concrete_model: bool = True ) -> None: ... + # class access + @overload + @override + def __get__(self, instance: None, owner: Any) -> GenericForeignKeyDescriptor: ... + # Model instance access + @overload + @override + def __get__(self, instance: Model, owner: Any) -> Any | None: ... + # non-Model instances + @overload + @override + def __get__(self, instance: Any, owner: Any) -> Self: ... name: Any model: Any @override @@ -55,12 +67,17 @@ class GenericForeignKey(FieldCacheMixin, Field[Any, Any]): using: str | None = None, model: type[Model] | None = None, ) -> ContentType: ... + +class GenericForeignKeyDescriptor: + field: GenericForeignKey + def __init__(self, field: GenericForeignKey) -> None: ... + def is_cached(self, instance: Model) -> bool: ... def get_prefetch_querysets( - self, instances: list[Model] | QuerySet[Any], querysets: list[QuerySet[Any]] | None = None + self, instances: Sequence[Model] | QuerySet[Any], querysets: Sequence[QuerySet[Any]] | None = None ) -> tuple[list[Model], Callable[..., Any], Callable[..., Any], bool, str, bool]: ... - @override - def __get__(self, instance: Model | None, cls: type[Model] | None = ...) -> Any | None: ... # type: ignore[override] - @override + def __get__(self, instance: Model | None, cls: type[Model] | None = ...) -> Any | None: ... + def fetch_one(self, instance: Model) -> None: ... + def fetch_many(self, instances: Sequence[Model] | QuerySet[Any]) -> None: ... def __set__(self, instance: Model, value: Any | None) -> None: ... class GenericRel(ForeignObjectRel): diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/contenttypes/management/commands/remove_stale_contenttypes.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/contenttypes/management/commands/remove_stale_contenttypes.pyi index fff8388d1b1d..5d1f0e648ab7 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/contrib/contenttypes/management/commands/remove_stale_contenttypes.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/contenttypes/management/commands/remove_stale_contenttypes.pyi @@ -1,14 +1,8 @@ -from typing import Any, Literal +from typing import Any -from _typeshed import Unused from django.core.management import BaseCommand -from django.db.models.deletion import Collector from typing_extensions import override class Command(BaseCommand): @override def handle(self, **options: Any) -> None: ... - -class NoFastDeleteCollector(Collector): - @override - def can_fast_delete(self, *args: Unused, **kwargs: Unused) -> Literal[False]: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/backends/base/features.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/backends/base/features.pyi index cd5d14ea8221..76c25f8c374f 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/backends/base/features.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/backends/base/features.pyi @@ -24,16 +24,10 @@ class BaseSpatialFeatures: unsupported_geojson_options: set[str] empty_intersection_returns_none: bool @property - def supports_bbcontains_lookup(self) -> bool: ... - @property - def supports_contained_lookup(self) -> bool: ... - @property def supports_crosses_lookup(self) -> bool: ... @property def supports_distances_lookups(self) -> bool: ... @property - def supports_dwithin_lookup(self) -> bool: ... - @property def supports_relate_lookup(self) -> bool: ... @property def supports_isvalid_lookup(self) -> bool: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/backends/base/operations.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/backends/base/operations.pyi index b2d238457a16..9b16e95a65c1 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/backends/base/operations.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/backends/base/operations.pyi @@ -1,5 +1,6 @@ from typing import Any +from django.db.models.sql.compiler import _AsSqlType from django.utils.functional import cached_property class BaseSpatialOperations: @@ -22,7 +23,7 @@ class BaseSpatialOperations: def geo_quote_name(self, name: Any) -> Any: ... def geo_db_type(self, f: Any) -> Any: ... def get_distance(self, f: Any, value: Any, lookup_type: Any) -> Any: ... - def get_geom_placeholder(self, f: Any, value: Any, compiler: Any) -> Any: ... + def get_geom_placeholder_sql(self, f: Any, value: Any, compiler: Any) -> _AsSqlType: ... def check_expression_support(self, expression: Any) -> None: ... def spatial_aggregate_name(self, agg_name: Any) -> Any: ... def spatial_function_name(self, func_name: Any) -> Any: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/backends/oracle/models.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/backends/oracle/models.pyi index 7b002731bd93..4c0ab62d60d9 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/backends/oracle/models.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/backends/oracle/models.pyi @@ -1,9 +1,8 @@ -from typing import Any, ClassVar +from typing import Any, ClassVar, Self from django.contrib.gis.db import models from django.contrib.gis.db.backends.base.models import SpatialRefSysMixin from django.db.models.manager import Manager -from typing_extensions import Self class OracleGeometryColumns(models.Model): table_name: Any diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/backends/oracle/operations.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/backends/oracle/operations.pyi index bd0083323016..2c4910b02738 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/backends/oracle/operations.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/backends/oracle/operations.pyi @@ -3,6 +3,7 @@ from typing import Any from django.contrib.gis.db.backends.base.operations import BaseSpatialOperations from django.contrib.gis.db.backends.utils import SpatialOperator from django.db.backends.oracle.operations import DatabaseOperations +from django.db.models.sql.compiler import _AsSqlType from typing_extensions import override DEFAULT_TOLERANCE: str @@ -41,7 +42,7 @@ class OracleOperations(BaseSpatialOperations, DatabaseOperations): @override def get_distance(self, f: Any, value: Any, lookup_type: Any) -> Any: ... @override - def get_geom_placeholder(self, f: Any, value: Any, compiler: Any) -> Any: ... + def get_geom_placeholder_sql(self, f: Any, value: Any, compiler: Any) -> _AsSqlType: ... @override def spatial_aggregate_name(self, agg_name: Any) -> Any: ... @override diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/backends/postgis/models.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/backends/postgis/models.pyi index 4bd4da16ff02..98c95bd9bca0 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/backends/postgis/models.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/backends/postgis/models.pyi @@ -1,8 +1,7 @@ -from typing import Any, ClassVar +from typing import Any, ClassVar, Self from django.contrib.gis.db.backends.base.models import SpatialRefSysMixin from django.db import models -from typing_extensions import Self class PostGISGeometryColumns(models.Model): f_table_catalog: Any diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/backends/postgis/operations.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/backends/postgis/operations.pyi index 4417c4e77787..362b59b172c6 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/backends/postgis/operations.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/backends/postgis/operations.pyi @@ -7,6 +7,7 @@ from django.contrib.gis.db.models.fields import GeometryField from django.contrib.gis.db.models.lookups import GISLookup from django.db.backends.postgresql.operations import DatabaseOperations from django.db.models import Func +from django.db.models.sql.compiler import _AsSqlType from django.utils.functional import cached_property from typing_extensions import override @@ -61,7 +62,7 @@ class PostGISOperations(BaseSpatialOperations, DatabaseOperations): @override def get_distance(self, f: Any, dist_val: Any, lookup_type: Any) -> Any: ... @override - def get_geom_placeholder(self, f: Any, value: Any, compiler: Any) -> Any: ... + def get_geom_placeholder_sql(self, f: Any, value: Any, compiler: Any) -> _AsSqlType: ... def postgis_geos_version(self) -> Any: ... def postgis_lib_version(self) -> Any: ... def postgis_proj_version(self) -> Any: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/backends/spatialite/models.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/backends/spatialite/models.pyi index 5585d2e17bd0..7a053a383b3d 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/backends/spatialite/models.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/backends/spatialite/models.pyi @@ -1,8 +1,7 @@ -from typing import Any, ClassVar +from typing import Any, ClassVar, Self from django.contrib.gis.db.backends.base.models import SpatialRefSysMixin from django.db import models -from typing_extensions import Self class SpatialiteGeometryColumns(models.Model): f_table_name: Any diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/models/__init__.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/models/__init__.pyi index 87e3b39fc84c..27ab7cc273a4 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/models/__init__.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/models/__init__.pyi @@ -16,9 +16,16 @@ from django.db.models import * __all__ = [ "BLANK_CHOICE_DASH", + "BLANK_CHOICE_LABEL", "CASCADE", + "DB_CASCADE", + "DB_SET_DEFAULT", + "DB_SET_NULL", "DEFERRED", "DO_NOTHING", + "FETCH_ONE", + "FETCH_PEERS", + "FETCH_RAISE", "NOT_PROVIDED", "PROTECT", "RESTRICT", @@ -33,6 +40,9 @@ __all__ = [ "BigAutoField", "BigIntegerField", "BinaryField", + "BitAnd", + "BitOr", + "BitXor", "BooleanField", "Case", "CharField", @@ -75,6 +85,7 @@ __all__ = [ "IntegerChoices", "IntegerField", "JSONField", + "JSONNull", "LineStringField", "Lookup", "MakeLine", diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/models/fields.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/models/fields.pyi index 59a56e3c996e..1586995f8ba1 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/models/fields.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/models/fields.pyi @@ -16,6 +16,7 @@ from django.core.validators import _ValidatorCallable from django.db.models import Model from django.db.models.expressions import Combinable, Expression from django.db.models.fields import NOT_PROVIDED, Field, _ErrorMessagesMapping +from django.db.models.sql.compiler import _AsSqlType from django.forms.widgets import Widget from django.utils.choices import _Choices from django.utils.functional import _StrOrPromise @@ -76,7 +77,7 @@ class BaseSpatialField(Field[_ST, _GT]): def units(self, connection: Any) -> Any: ... def units_name(self, connection: Any) -> Any: ... def geodetic(self, connection: Any) -> Any: ... - def get_placeholder(self, value: Any, compiler: Any, connection: Any) -> Any: ... + def get_placeholder_sql(self, value: Any, compiler: Any, connection: Any) -> _AsSqlType: ... def get_srid(self, obj: Any) -> Any: ... @override def get_db_prep_value(self, value: Any, connection: Any, *args: Any, **kwargs: Any) -> Any: ... @@ -94,6 +95,7 @@ class GeometryField(BaseSpatialField[_ST, _GT]): *, extent: tuple[float, float, float, float] = ..., tolerance: float = 0.05, + max_geom_collections: int | None = ..., srid: int = 4326, spatial_index: bool = True, name: str | None = ..., diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/models/functions.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/models/functions.pyi index 33a0b33347ea..3053846f79b8 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/models/functions.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/models/functions.pyi @@ -193,6 +193,11 @@ class MemSize(GeoFunc): output_field: ClassVar[IntegerField[Any, Any]] arity: int +class NumDimensions(GeoFuncMixin, StandardTransform): # type: ignore[misc] + lookup_name: str + output_field: ClassVar[IntegerField[Any, Any]] + arity: int + class NumGeometries(GeoFunc): output_field: ClassVar[IntegerField[Any, Any]] arity: int diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/forms/fields.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/forms/fields.pyi index 063d17029229..59a2fa770949 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/forms/fields.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/forms/fields.pyi @@ -6,8 +6,16 @@ from typing_extensions import override class GeometryField(forms.Field): widget: Any geom_type: str + max_geom_collections: int srid: Any - def __init__(self, *, srid: Any | None = ..., geom_type: Any | None = ..., **kwargs: Any) -> None: ... + def __init__( + self, + *, + srid: Any | None = ..., + geom_type: Any | None = ..., + max_geom_collections: int | None = None, + **kwargs: Any, + ) -> None: ... @override def to_python(self, value: Any) -> Any: ... @override diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/forms/widgets.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/forms/widgets.pyi index a4c388bdc0ee..e4846e7e675c 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/forms/widgets.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/forms/widgets.pyi @@ -11,6 +11,7 @@ class BaseGeometryWidget(Widget): geom_type: str map_srid: int display_raw: bool + max_geom_collections: int supports_3d: bool template_name: str attrs: Any diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/gdal/raster/source.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/gdal/raster/source.pyi index 86c16f9c2acc..fb64ef0507fb 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/gdal/raster/source.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/gdal/raster/source.pyi @@ -7,9 +7,12 @@ from django.contrib.gis.gdal.driver import Driver from django.contrib.gis.gdal.raster.band import BandList from django.contrib.gis.gdal.raster.base import GDALRasterBase from django.contrib.gis.gdal.srs import SpatialReference +from django.core.exceptions import SuspiciousOperation from django.utils.functional import cached_property from typing_extensions import override +class DisallowedRasterLookup(SuspiciousOperation): ... + class TransformPoint(list[Sequence[float]]): indices: dict[str, tuple[int, int]] def __init__(self, raster: GDALRaster, prop: str) -> None: ... @@ -27,6 +30,8 @@ class GDALRaster(GDALRasterBase): def __init__(self, ds_input: str | Path | bytes | dict[str, Any] | c_void_p, write: bool = ...) -> None: ... @override def __del__(self) -> None: ... + @classmethod + def check_raster_lookup_value(cls, ds_input: Any) -> None: ... @property def vsi_buffer(self) -> bytes | None: ... @cached_property diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/gdal/srs.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/gdal/srs.pyi index dcf0fe86bacb..dfc93661d8a9 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/gdal/srs.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/gdal/srs.pyi @@ -1,8 +1,7 @@ from enum import IntEnum -from typing import Any, AnyStr, cast +from typing import Any, AnyStr, Self, cast from django.contrib.gis.gdal.base import GDALBase -from typing_extensions import Self class AxisOrder(IntEnum): TRADITIONAL = cast(int, ...) diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/geos/coordseq.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/geos/coordseq.pyi index bd58af312a32..152a8bf29762 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/geos/coordseq.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/geos/coordseq.pyi @@ -1,8 +1,7 @@ from collections.abc import Iterator -from typing import Any +from typing import Any, Self from django.contrib.gis.geos.base import GEOSBase -from typing_extensions import Self class GEOSCoordSeq(GEOSBase): ptr_type: Any @@ -19,12 +18,16 @@ class GEOSCoordSeq(GEOSBase): def setY(self, index: int, value: float) -> None: ... def getZ(self, index: int) -> float: ... def setZ(self, index: int, value: float) -> None: ... + def getM(self, index: int) -> float: ... + def setM(self, index: int, value: float) -> None: ... @property def size(self) -> int: ... @property def dims(self) -> int: ... @property def hasz(self) -> bool: ... + @property + def hasm(self) -> bool: ... def clone(self) -> Self: ... @property def kml(self) -> str: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/geos/geometry.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/geos/geometry.pyi index 0a7273ec043a..3429db3d818f 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/geos/geometry.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/geos/geometry.pyi @@ -1,4 +1,4 @@ -from typing import Any, Literal, overload +from typing import Any, Literal, Self, overload from django.contrib.gis.gdal import CoordTransform, SpatialReference from django.contrib.gis.gdal.geometries import OGRGeometry @@ -8,7 +8,7 @@ from django.contrib.gis.geos.mutable_list import ListMixin from django.contrib.gis.geos.point import Point from django.contrib.gis.geos.prepared import PreparedGeometry from django.utils.deconstruct import _Deconstructible -from typing_extensions import Self, override +from typing_extensions import override class GEOSGeometryBase(GEOSBase): ptr_type: Any @@ -153,4 +153,10 @@ class LinearGeometryMixin: def closed(self) -> bool: ... class GEOSGeometry(_Deconstructible, GEOSGeometryBase, ListMixin): - def __init__(self, geo_input: Any, srid: int | None = ...) -> None: ... + def __init__( + self, + geo_input: Any, + srid: int | None = ..., + *, + max_geom_collections: int | None = ..., + ) -> None: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/geos/io.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/geos/io.pyi index bbcf56e6eaa2..7615704b0880 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/geos/io.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/geos/io.pyi @@ -6,10 +6,10 @@ from typing_extensions import override class WKBReader(_WKBReader): @override - def read(self, wkb: bytes | str) -> GEOSGeometry: ... + def read(self, wkb: bytes | str) -> GEOSGeometry: ... # type: ignore[override] class WKTReader(_WKTReader): @override - def read(self, wkt: bytes | str) -> GEOSGeometry: ... + def read(self, wkt: bytes | str) -> GEOSGeometry: ... # type: ignore[override] __all__ = ["WKBReader", "WKBWriter", "WKTReader", "WKTWriter"] diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/geos/mutable_list.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/geos/mutable_list.pyi index 7f436c024a76..bf259c0f909e 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/geos/mutable_list.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/geos/mutable_list.pyi @@ -1,6 +1,6 @@ -from typing import Any +from typing import Any, Self -from typing_extensions import Self, override +from typing_extensions import override class ListMixin: def __init__(self, *args: Any, **kwargs: Any) -> None: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/geos/prototypes/coordseq.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/geos/prototypes/coordseq.pyi index 0a2e4d0cd534..03afe160fb03 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/geos/prototypes/coordseq.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/geos/prototypes/coordseq.pyi @@ -21,6 +21,11 @@ class CsOutput(GEOSFuncFactory): @override def errcheck(result: Any, func: Any, cargs: Any) -> Any: ... +class CsUnaryPredicate(GEOSFuncFactory): + argtypes: Any + restype: Any + errcheck: Any + cs_clone: Any create_cs: Any get_cs: Any @@ -29,9 +34,12 @@ cs_setordinate: Any cs_getx: Any cs_gety: Any cs_getz: Any +cs_getm: Any cs_setx: Any cs_sety: Any cs_setz: Any +cs_setm: Any cs_getsize: Any cs_getdims: Any +cs_hasm: Any cs_is_ccw: Any diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/geos/prototypes/io.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/geos/prototypes/io.pyi index 20b3c836df35..ed569a429d7e 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/geos/prototypes/io.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/geos/prototypes/io.pyi @@ -63,15 +63,20 @@ class IOBase(GEOSBase): ptr: Any def __init__(self) -> None: ... +MAX_GEOM_COLLECTIONS: int + class _WKTReader(IOBase): ptr_type: Any destructor: Any - def read(self, wkt: Any) -> Any: ... + def limit(self, wkt: Any, max_geom_collections: int | None) -> None: ... + def read(self, wkt: Any, max_geom_collections: int | None = ...) -> Any: ... class _WKBReader(IOBase): ptr_type: Any destructor: Any - def read(self, wkb: Any) -> Any: ... + def limit_wkb(self, wkb: Any, max_geom_collections: int | None) -> None: ... + def limit_hex(self, wkb: Any, max_geom_collections: int | None) -> None: ... + def read(self, wkb: Any, max_geom_collections: int | None = ...) -> Any: ... def default_trim_value() -> bool: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/measure.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/measure.pyi index 54e32cb0438b..4d41a3473635 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/measure.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/measure.pyi @@ -1,7 +1,7 @@ from decimal import Decimal -from typing import Any, TypeAlias +from typing import Any, Self, TypeAlias -from typing_extensions import Self, override +from typing_extensions import override _NUMERIC_TYPES: TypeAlias = int | float | Decimal diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/postgres/aggregates/general.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/postgres/aggregates/general.pyi index e23e0ce55aa8..4ee62ad75e5b 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/contrib/postgres/aggregates/general.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/postgres/aggregates/general.pyi @@ -1,5 +1,5 @@ from collections.abc import Sequence -from typing import Any, ClassVar +from typing import Any, ClassVar, Self from django.contrib.postgres.fields import ArrayField from django.db.backends.base.base import BaseDatabaseWrapper @@ -8,7 +8,7 @@ from django.db.models.expressions import BaseExpression, Combinable from django.db.models.query import _OrderByFieldName from django.db.models.query_utils import Q from django.db.models.sql.compiler import SQLCompiler, _AsSqlType -from typing_extensions import Self, override +from typing_extensions import deprecated, override from .mixins import OrderableAggMixin @@ -28,9 +28,24 @@ class ArrayAgg(OrderableAggMixin, Aggregate): @override def as_sql(self, compiler: SQLCompiler, connection: BaseDatabaseWrapper) -> _AsSqlType: ... # type: ignore[override] -class BitAnd(Aggregate): ... -class BitOr(Aggregate): ... -class BitXor(Aggregate): ... +class BitAnd(Aggregate): + @override + @deprecated( + "The PostgreSQL-specific BitAnd function is deprecated. Use django.db.models.aggregates.BitAnd instead." + ) + def __init__(self, expression: Any, **extra: Any) -> None: ... + +class BitOr(Aggregate): + @override + @deprecated("The PostgreSQL-specific BitOr function is deprecated. Use django.db.models.aggregates.BitOr instead.") + def __init__(self, expression: Any, **extra: Any) -> None: ... + +class BitXor(Aggregate): + @override + @deprecated( + "The PostgreSQL-specific BitXor function is deprecated. Use django.db.models.aggregates.BitXor instead." + ) + def __init__(self, expression: Any, **extra: Any) -> None: ... class BoolAnd(Aggregate): output_field: ClassVar[BooleanField[Any, Any]] @@ -54,6 +69,9 @@ class JSONBAgg(OrderableAggMixin, Aggregate): class StringAgg(OrderableAggMixin, Aggregate): output_field: ClassVar[TextField[Any, Any]] + @deprecated( + "The PostgreSQL specific StringAgg function is deprecated. Use django.db.models.aggregates.StringAgg instead." + ) def __init__( self, expression: BaseExpression | Combinable | str, diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/postgres/aggregates/mixins.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/postgres/aggregates/mixins.pyi index c78285a22e02..30feb183f086 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/contrib/postgres/aggregates/mixins.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/postgres/aggregates/mixins.pyi @@ -1,22 +1,8 @@ -from collections.abc import Sequence from typing import Any, ClassVar -from django.db.models.expressions import BaseExpression, Combinable -from django.db.models.query import _OrderByFieldName -from django.db.models.query_utils import Q from typing_extensions import override class OrderableAggMixin: allow_order_by: ClassVar[bool] - def __init__( - self, - *expressions: BaseExpression | Combinable | str, - distinct: bool = False, - filter: Q | BaseExpression | None = None, - default: Any | None = None, - ordering: _OrderByFieldName | Sequence[_OrderByFieldName] = ..., - order_by: _OrderByFieldName | Sequence[_OrderByFieldName] = ..., - **extra: Any, - ) -> None: ... @override - def __init_subclass__(cls, *args: Any, **kwargs: Any) -> None: ... + def __init_subclass__(cls, /, *args: Any, **kwargs: Any) -> None: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/postgres/fields/array.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/postgres/fields/array.pyi index a4051b4199ea..196f5ac50f03 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/contrib/postgres/fields/array.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/postgres/fields/array.pyi @@ -11,6 +11,7 @@ from django.db.models.expressions import Combinable, Expression from django.db.models.fields import NOT_PROVIDED, _ErrorMessagesDict, _ErrorMessagesMapping from django.db.models.fields.mixins import CheckFieldDefaultMixin from django.db.models.lookups import Transform +from django.db.models.sql.compiler import _AsSqlType from django.utils.choices import _Choices from django.utils.functional import _StrOrPromise from typing_extensions import TypeVar, override @@ -66,7 +67,7 @@ class ArrayField(CheckPostgresInstalledMixin, CheckFieldDefaultMixin, Field[_ST, def description(self) -> str: ... # type: ignore[override] @override def cast_db_type(self, connection: BaseDatabaseWrapper) -> str: ... - def get_placeholder(self, value: Unused, compiler: Unused, connection: BaseDatabaseWrapper) -> str: ... + def get_placeholder_sql(self, value: Unused, compiler: Unused, connection: BaseDatabaseWrapper) -> _AsSqlType: ... @override def get_transform(self, name: str) -> type[Transform] | None: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/postgres/fields/ranges.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/postgres/fields/ranges.pyi index 2fab488994d8..71ebc2cad7f3 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/contrib/postgres/fields/ranges.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/postgres/fields/ranges.pyi @@ -33,7 +33,7 @@ class RangeField(CheckPostgresInstalledMixin, models.Field[Any, _RangeT]): empty_strings_allowed: bool base_field: type[models.Field[Any, Any]] range_type: type[_RangeT] - def get_placeholder(self, value: Unused, compiler: Unused, connection: BaseDatabaseWrapper) -> str: ... + def get_placeholder_sql(self, value: Unused, compiler: Unused, connection: BaseDatabaseWrapper) -> _AsSqlType: ... @override def get_prep_value(self, value: Any) -> Any | None: ... @override diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/postgres/search.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/postgres/search.pyi index 083ffe2d1a62..a14ecfbcedb3 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/contrib/postgres/search.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/postgres/search.pyi @@ -1,5 +1,5 @@ import re -from typing import Any, ClassVar, TypeAlias +from typing import Any, ClassVar, Self, TypeAlias from django.db.backends.base.base import BaseDatabaseWrapper from django.db.models import Expression, Field, FloatField, TextField @@ -7,7 +7,7 @@ from django.db.models.expressions import Combinable, CombinedExpression, Func, V from django.db.models.lookups import Lookup from django.db.models.sql.compiler import SQLCompiler, _AsSqlType from psycopg.adapt import Dumper -from typing_extensions import Self, TypeVar, override +from typing_extensions import TypeVar, override from .utils import CheckPostgresInstalledMixin diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/sessions/backends/base.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/sessions/backends/base.pyi index beac7a00370e..c60b0e3b51db 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/contrib/sessions/backends/base.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/sessions/backends/base.pyi @@ -19,6 +19,7 @@ class SessionBase(dict[str, Any]): serializer: Any def __init__(self, session_key: str | None = None) -> None: ... async def aset(self, key: str, value: Any) -> None: ... + def __bool__(self) -> bool: ... @property def key_salt(self) -> str: ... @overload # type: ignore[override] diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/sessions/base_session.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/sessions/base_session.pyi index f4ac8bd4970b..dc2c255a5bec 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/contrib/sessions/base_session.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/sessions/base_session.pyi @@ -1,10 +1,10 @@ import datetime as dt -from typing import Any, ClassVar +from typing import Any, ClassVar, Self from django.contrib.sessions.backends.base import SessionBase from django.db import models from django.db.models.expressions import Combinable -from typing_extensions import Self, TypeVar +from typing_extensions import TypeVar _T = TypeVar("_T", bound=AbstractBaseSession) diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/staticfiles/finders.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/staticfiles/finders.pyi index 3997128de8b8..5f03d9d33361 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/contrib/staticfiles/finders.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/staticfiles/finders.pyi @@ -3,7 +3,7 @@ from typing import Any, Literal, overload from django.core.checks.messages import CheckMessage from django.core.files.storage import FileSystemStorage, Storage -from typing_extensions import deprecated, override +from typing_extensions import override searched_locations: Any @@ -13,12 +13,6 @@ class BaseFinder: def find(self, path: str, find_all: Literal[False] = False) -> str | None: ... @overload def find(self, path: str, find_all: Literal[True]) -> list[str]: ... - @overload - @deprecated("The `all` keyword argument is deprecated; use `find_all` instead.") - def find(self, path: str, *, all: Literal[False]) -> str | None: ... - @overload - @deprecated("The `all` keyword argument is deprecated; use `find_all` instead.") - def find(self, path: str, *, all: Literal[True]) -> list[str]: ... def list(self, ignore_patterns: Iterable[str] | None) -> Iterable[Any]: ... class FileSystemFinder(BaseFinder): @@ -53,11 +47,5 @@ class DefaultStorageFinder(BaseStorageFinder): def find(path: str, find_all: Literal[False] = False) -> str | None: ... @overload def find(path: str, find_all: Literal[True]) -> list[str]: ... -@overload -@deprecated("The `all` keyword argument is deprecated; use `find_all` instead.") -def find(path: str, *, all: Literal[False]) -> str | None: ... -@overload -@deprecated("The `all` keyword argument is deprecated; use `find_all` instead.") -def find(path: str, *, all: Literal[True]) -> list[str]: ... def get_finders() -> Iterator[BaseFinder]: ... def get_finder(import_path: str) -> BaseFinder: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/staticfiles/handlers.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/staticfiles/handlers.pyi index 23e2d7c54c21..973d1875d76e 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/contrib/staticfiles/handlers.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/staticfiles/handlers.pyi @@ -1,7 +1,7 @@ -import sys from collections.abc import Awaitable, Callable, Mapping from typing import Any from urllib.parse import ParseResult +from wsgiref.types import StartResponse, WSGIEnvironment from django.core.handlers.asgi import ASGIHandler from django.core.handlers.base import BaseHandler @@ -10,11 +10,6 @@ from django.http import HttpRequest from django.http.response import FileResponse, HttpResponse, HttpResponseBase from typing_extensions import override -if sys.version_info >= (3, 11): - from wsgiref.types import StartResponse, WSGIEnvironment -else: - from _typeshed.wsgi import StartResponse, WSGIEnvironment - class StaticFilesHandlerMixin: handles_files: bool application: BaseHandler diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/staticfiles/storage.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/staticfiles/storage.pyi index 414aeea2c881..f65e1b1451df 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/contrib/staticfiles/storage.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/staticfiles/storage.pyi @@ -1,5 +1,5 @@ from collections.abc import Callable, Iterator -from re import Match +from re import Match, Pattern from typing import Any, TypeAlias from _typeshed import StrPath @@ -28,8 +28,14 @@ class HashedFilesMixin: def file_hash(self, name: str, content: File[Any] | None = None) -> str | None: ... def hashed_name(self, name: str, content: File[Any] | None = None, filename: str | None = None) -> str: ... def url(self, name: str, force: bool = False) -> str: ... + def get_ignored_blocks(self, content: str, pattern: Pattern[str]) -> list[tuple[int, int]]: ... + def is_in_ignored_block(self, pos: int, ignored_blocks: list[tuple[int, int]]) -> bool: ... def url_converter( - self, name: str, hashed_files: dict[str, Any], template: str | None = None + self, + name: str, + hashed_files: dict[str, Any], + template: str | None = None, + ignored_blocks: list[tuple[int, int]] | None = None, ) -> Callable[[Match[str]], str]: ... def post_process(self, paths: dict[str, Any], dry_run: bool = False, **options: Any) -> _PostProcessT: ... def clean_name(self, name: str) -> str: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/core/checks/mail.pyi b/python/helpers/bundled_stubs/Django/django-stubs/core/checks/mail.pyi new file mode 100644 index 000000000000..d22f97aeeac2 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/core/checks/mail.pyi @@ -0,0 +1,12 @@ +from collections.abc import Sequence + +from django.apps.config import AppConfig +from django.core.checks import CheckMessage + +def check_mailers_default_alias(app_configs: Sequence[AppConfig] | None, **kwargs: object) -> list[CheckMessage]: ... + +NON_PRODUCTION_EMAIL_BACKENDS: set[str] + +def check_mailers_production_backend( + app_configs: Sequence[AppConfig] | None, **kwargs: object +) -> list[CheckMessage]: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/core/checks/registry.pyi b/python/helpers/bundled_stubs/Django/django-stubs/core/checks/registry.pyi index 8d7806061115..a5c544200594 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/core/checks/registry.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/core/checks/registry.pyi @@ -13,6 +13,7 @@ class Tags: compatibility: str database: str files: str + mail: str models: str security: str signals: str diff --git a/python/helpers/bundled_stubs/Django/django-stubs/core/checks/security/base.pyi b/python/helpers/bundled_stubs/Django/django-stubs/core/checks/security/base.pyi index 733d10531d99..bda24df23643 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/core/checks/security/base.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/core/checks/security/base.pyi @@ -25,6 +25,7 @@ E023: Error E024: Error W025: Warning E026: Error +W027: Warning def check_security_middleware(app_configs: Sequence[AppConfig] | None, **kwargs: object) -> list[CheckMessage]: ... def check_xframe_options_middleware( @@ -45,3 +46,6 @@ def check_cross_origin_opener_policy( app_configs: Sequence[AppConfig] | None, **kwargs: object ) -> list[CheckMessage]: ... def check_csp_settings(app_configs: Sequence[AppConfig] | None, **kwargs: object) -> list[CheckMessage]: ... +def check_csp_nonce_context_processor( + app_configs: Sequence[AppConfig] | None, **kwargs: object +) -> list[CheckMessage]: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/core/exceptions.pyi b/python/helpers/bundled_stubs/Django/django-stubs/core/exceptions.pyi index ceaada382175..fd2df81be002 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/core/exceptions.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/core/exceptions.pyi @@ -26,6 +26,7 @@ class ViewDoesNotExist(Exception): ... class MiddlewareNotUsed(Exception): ... class ImproperlyConfigured(Exception): ... class FieldError(Exception): ... +class FieldFetchBlocked(Exception): ... NON_FIELD_ERRORS: Literal["__all__"] diff --git a/python/helpers/bundled_stubs/Django/django-stubs/core/files/base.pyi b/python/helpers/bundled_stubs/Django/django-stubs/core/files/base.pyi index a5b2126fc0a0..cc8fc92aae96 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/core/files/base.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/core/files/base.pyi @@ -1,10 +1,10 @@ from collections.abc import Callable, Iterator from types import TracebackType -from typing import IO, AnyStr, type_check_only +from typing import IO, AnyStr, Self, type_check_only from django.core.files.utils import FileProxyMixin from django.utils.functional import cached_property -from typing_extensions import Self, override +from typing_extensions import override class File(FileProxyMixin[AnyStr], IO[AnyStr]): DEFAULT_CHUNK_SIZE: int diff --git a/python/helpers/bundled_stubs/Django/django-stubs/core/files/uploadedfile.pyi b/python/helpers/bundled_stubs/Django/django-stubs/core/files/uploadedfile.pyi index fc1d9a48b8b4..a5c6c446fa74 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/core/files/uploadedfile.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/core/files/uploadedfile.pyi @@ -1,8 +1,8 @@ -from typing import IO, Any +from typing import IO, Any, Self from django.core.files.base import File from django.utils.functional import cached_property -from typing_extensions import Self, TypeVar, override +from typing_extensions import TypeVar, override # `typing.AnyStr` is deprecated from 3.16+, so we define our own equivalent constrained TypeVar. _AnyStr = TypeVar("_AnyStr", str, bytes) diff --git a/python/helpers/bundled_stubs/Django/django-stubs/core/handlers/wsgi.pyi b/python/helpers/bundled_stubs/Django/django-stubs/core/handlers/wsgi.pyi index 7d97b85c9714..e9e748a18330 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/core/handlers/wsgi.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/core/handlers/wsgi.pyi @@ -1,6 +1,6 @@ -import sys from io import BytesIO, IOBase from typing import Any +from wsgiref.types import StartResponse, WSGIEnvironment from django.core.files import uploadedfile from django.core.handlers import base @@ -11,11 +11,6 @@ from django.utils.datastructures import MultiValueDict from django.utils.functional import cached_property from typing_extensions import override -if sys.version_info >= (3, 11): - from wsgiref.types import StartResponse, WSGIEnvironment -else: - from _typeshed.wsgi import StartResponse, WSGIEnvironment - class LimitedStream(IOBase): limit: int def __init__(self, stream: BytesIO, limit: int) -> None: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/core/mail/__init__.pyi b/python/helpers/bundled_stubs/Django/django-stubs/core/mail/__init__.pyi index 5e92aacf4a61..cda5c8b47a9f 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/core/mail/__init__.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/core/mail/__init__.pyi @@ -3,6 +3,10 @@ from typing import Any from django.utils.functional import _StrOrPromise +from .backends.base import BaseEmailBackend +from .exceptions import InvalidMailer as InvalidMailer +from .exceptions import MailerDoesNotExist as MailerDoesNotExist +from .handler import MailersHandler from .message import DEFAULT_ATTACHMENT_MIME_TYPE as DEFAULT_ATTACHMENT_MIME_TYPE from .message import BadHeaderError as BadHeaderError from .message import EmailAlternative as EmailAlternative @@ -16,7 +20,9 @@ from .message import make_msgid as make_msgid from .utils import DNS_NAME as DNS_NAME from .utils import CachedDnsName as CachedDnsName -def get_connection(backend: str | None = None, *, fail_silently: bool = False, **kwds: Any) -> Any: ... +mailers: MailersHandler + +def get_connection(backend: str | None = None, *, fail_silently: bool = False, **kwds: Any) -> BaseEmailBackend: ... def send_mail( subject: _StrOrPromise, message: _StrOrPromise, @@ -26,8 +32,9 @@ def send_mail( fail_silently: bool = False, auth_user: str | None = None, auth_password: str | None = None, - connection: Any | None = None, + connection: BaseEmailBackend | None = None, html_message: str | None = None, + using: str | None = None, ) -> int: ... def send_mass_mail( datatuple: Iterable[tuple[str, str, str | None, list[str]]], @@ -35,23 +42,26 @@ def send_mass_mail( fail_silently: bool = False, auth_user: str | None = None, auth_password: str | None = None, - connection: Any | None = None, + connection: BaseEmailBackend | None = None, + using: str | None = None, ) -> int: ... def mail_admins( subject: _StrOrPromise, message: _StrOrPromise, *, fail_silently: bool = False, - connection: Any | None = None, + connection: BaseEmailBackend | None = None, html_message: str | None = None, + using: str | None = None, ) -> None: ... def mail_managers( subject: _StrOrPromise, message: _StrOrPromise, *, fail_silently: bool = False, - connection: Any | None = None, + connection: BaseEmailBackend | None = None, html_message: str | None = None, + using: str | None = None, ) -> None: ... outbox: list[EmailMessage | EmailMultiAlternatives] @@ -65,12 +75,15 @@ __all__ = [ "EmailAttachment", "EmailMessage", "EmailMultiAlternatives", + "InvalidMailer", + "MailerDoesNotExist", "SafeMIMEMultipart", "SafeMIMEText", "forbid_multi_line_headers", "get_connection", "mail_admins", "mail_managers", + "mailers", "make_msgid", "send_mail", "send_mass_mail", diff --git a/python/helpers/bundled_stubs/Django/django-stubs/core/mail/backends/base.pyi b/python/helpers/bundled_stubs/Django/django-stubs/core/mail/backends/base.pyi index a282c451587a..2d58f152f281 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/core/mail/backends/base.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/core/mail/backends/base.pyi @@ -1,13 +1,19 @@ from collections.abc import Sequence from types import TracebackType -from typing import Any +from typing import Any, Self from django.core.mail.message import EmailMessage -from typing_extensions import Self class BaseEmailBackend: fail_silently: bool - def __init__(self, fail_silently: bool = False, **kwargs: Any) -> None: ... + def __init__( + self, + fail_silently: bool | object = ..., + *, + alias: str | None = None, + _ignore_unknown_kwargs: set[str] | None = None, + **kwargs: Any, + ) -> None: ... def open(self) -> bool | None: ... def close(self) -> None: ... def __enter__(self) -> Self: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/core/mail/backends/filebased.pyi b/python/helpers/bundled_stubs/Django/django-stubs/core/mail/backends/filebased.pyi index 4c81472e7852..ebe005fd6c11 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/core/mail/backends/filebased.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/core/mail/backends/filebased.pyi @@ -4,4 +4,4 @@ from django.core.mail.backends.console import EmailBackend as ConsoleEmailBacken class EmailBackend(ConsoleEmailBackend): file_path: str - def __init__(self, *args: Any, file_path: str | None = None, **kwargs: Any) -> None: ... + def __init__(self, fail_silently: bool = False, file_path: str | None = None, **kwargs: Any) -> None: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/core/mail/deprecation.pyi b/python/helpers/bundled_stubs/Django/django-stubs/core/mail/deprecation.pyi new file mode 100644 index 000000000000..5d6667ca76bf --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/core/mail/deprecation.pyi @@ -0,0 +1,16 @@ +# RemovedInDjango70Warning: this entire file. + +from django.core.mail.backends.base import BaseEmailBackend + +FAIL_SILENTLY_ARG_WARNING: str +AUTH_ARGS_WARNING: str +CONNECTION_ARG_WARNING: str +NO_DEFAULT_MAILER_WARNING: str + +def report_using_incompatibility( + connection: BaseEmailBackend | None = None, + fail_silently: bool = False, + auth_user: str | None = None, + auth_password: str | None = None, +) -> None: ... +def warn_about_default_mailers_if_needed() -> None: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/core/mail/exceptions.pyi b/python/helpers/bundled_stubs/Django/django-stubs/core/mail/exceptions.pyi new file mode 100644 index 000000000000..44d8c892864d --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/core/mail/exceptions.pyi @@ -0,0 +1,7 @@ +from django.core.exceptions import ImproperlyConfigured + +class InvalidMailer(ImproperlyConfigured): + def __init__(self, msg: str, *, alias: str | None = None) -> None: ... + +class MailerDoesNotExist(InvalidMailer, KeyError): + def __init__(self, *, alias: str) -> None: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/core/mail/handler.pyi b/python/helpers/bundled_stubs/Django/django-stubs/core/mail/handler.pyi new file mode 100644 index 000000000000..44b2ae858e84 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/core/mail/handler.pyi @@ -0,0 +1,22 @@ +from collections.abc import Iterator, Mapping +from typing import Any, Literal, TypeAlias + +from django.core.mail.backends.base import BaseEmailBackend + +DEFAULT_MAILER_ALIAS: Literal["default"] +DEFAULT_MAILER_BACKEND: Literal["django.core.mail.backends.smtp.EmailBackend"] + +_MailerSetting: TypeAlias = Mapping[str, Any] + +class MailersHandler: + def __getitem__(self, /, alias: str) -> BaseEmailBackend: ... + def __contains__(self, /, alias: str) -> bool: ... + def __iter__(self) -> Iterator[_MailerSetting]: ... + def get(self, alias: str, /, default: Any | None = None) -> BaseEmailBackend: ... + @property + def default(self) -> BaseEmailBackend: ... + @property + def settings(self) -> _MailerSetting: ... + def create_connection( + self, alias: str, /, *, _deprecated_kwargs: Mapping[str, Any] | None = None + ) -> BaseEmailBackend: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/core/mail/message.pyi b/python/helpers/bundled_stubs/Django/django-stubs/core/mail/message.pyi index 944914d077cb..81f6341a54cc 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/core/mail/message.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/core/mail/message.pyi @@ -9,6 +9,7 @@ from email.policy import Policy from email.utils import make_msgid as make_msgid from typing import Any, NamedTuple, TypeAlias, overload +from django.core.mail.backends.base import BaseEmailBackend from django.utils.functional import _StrOrPromise utf8_charset: Any @@ -70,7 +71,7 @@ class EmailMessage: body: _StrOrPromise attachments: list[Any] extra_headers: dict[Any, Any] - connection: Any + connection: BaseEmailBackend | None def __init__( self, subject: _StrOrPromise = "", @@ -79,16 +80,15 @@ class EmailMessage: to: Sequence[str] | None = None, *, bcc: Sequence[str] | None = None, - connection: Any | None = None, + connection: BaseEmailBackend | None = None, attachments: Sequence[MIMEBase | _AttachmentTuple] | None = None, headers: dict[str, str] | None = None, cc: Sequence[str] | None = None, reply_to: Sequence[str] | None = None, ) -> None: ... - def get_connection(self, fail_silently: bool = False) -> Any: ... def message(self, *, policy: Policy | None = ...) -> _StdlibEmailMessage: ... def recipients(self) -> list[str]: ... - def send(self, fail_silently: bool = False) -> int: ... + def send(self, fail_silently: bool = False, *, using: str | None = None) -> int: ... @overload def attach(self, filename: MIMEBase | None = None, content: None = None, mimetype: None = None) -> None: ... @overload diff --git a/python/helpers/bundled_stubs/Django/django-stubs/core/management/commands/sendtestemail.pyi b/python/helpers/bundled_stubs/Django/django-stubs/core/management/commands/sendtestemail.pyi index c27c67d72997..39588bf84687 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/core/management/commands/sendtestemail.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/core/management/commands/sendtestemail.pyi @@ -1,4 +1,9 @@ +from typing import Any + from django.core.management.base import BaseCommand +from typing_extensions import override class Command(BaseCommand): missing_args_message: str + @override + def handle(self, *args: Any, using: str | None = None, **kwargs: Any) -> None: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/core/serializers/pyyaml.pyi b/python/helpers/bundled_stubs/Django/django-stubs/core/serializers/pyyaml.pyi index 1de63c423755..5efe78646d05 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/core/serializers/pyyaml.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/core/serializers/pyyaml.pyi @@ -5,11 +5,11 @@ from django.core.serializers.python import Serializer as PythonSerializer from django.db.models.fields import Field from typing_extensions import override from yaml import CSafeDumper as SafeDumper -from yaml import MappingNode, ScalarNode +from yaml import ScalarNode class DjangoSafeDumper(SafeDumper): def represent_decimal(self, data: Any) -> ScalarNode: ... - def represent_ordered_dict(self, data: Any) -> MappingNode: ... + def represent_time(self, data: Any) -> ScalarNode: ... class Serializer(PythonSerializer): internal_use_only: bool diff --git a/python/helpers/bundled_stubs/Django/django-stubs/core/serializers/xml_serializer.pyi b/python/helpers/bundled_stubs/Django/django-stubs/core/serializers/xml_serializer.pyi index 9d470e6e05a5..4b821c11bfa1 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/core/serializers/xml_serializer.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/core/serializers/xml_serializer.pyi @@ -1,12 +1,9 @@ -from contextlib import AbstractContextManager from typing import IO, Any from xml.sax.expatreader import ExpatParser from django.core.serializers import base from typing_extensions import override -def fast_cache_clearing() -> AbstractContextManager[None]: ... - class Serializer(base.Serializer): def indent(self, level: int) -> None: ... xml: Any @@ -41,8 +38,9 @@ class Deserializer(base.Deserializer): @override def __next__(self) -> base.DeserializedObject: ... +def check_element_type(element: Any) -> bool: ... +def getChildrenByTagName(node: Any, tag_name: str) -> list[Any]: ... def getInnerText(node: Any) -> str: ... -def getInnerTextList(node: Any) -> list[str]: ... class DefusedExpatParser(ExpatParser): def __init__(self, *args: Any, **kwargs: Any) -> None: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/core/signing.pyi b/python/helpers/bundled_stubs/Django/django-stubs/core/signing.pyi index ea4f5a4fd980..c908119b0659 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/core/signing.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/core/signing.pyi @@ -12,7 +12,7 @@ def b62_encode(s: int) -> str: ... def b62_decode(s: str) -> int: ... def b64_encode(s: bytes) -> bytes: ... def b64_decode(s: bytes) -> bytes: ... -def base64_hmac(salt: bytes | str, value: bytes | str, key: bytes | str, algorithm: str = "sha1") -> str: ... +def base64_hmac(salt: bytes | str, value: bytes | str, key: bytes | str, algorithm: str | None = None) -> str: ... def get_cookie_signer(salt: str = "django.core.signing.get_cookie_signer") -> TimestampSigner: ... @type_check_only diff --git a/python/helpers/bundled_stubs/Django/django-stubs/db/backends/base/base.pyi b/python/helpers/bundled_stubs/Django/django-stubs/db/backends/base/base.pyi index a6704a34fe55..fddee8d78454 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/db/backends/base/base.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/db/backends/base/base.pyi @@ -3,7 +3,7 @@ from collections.abc import Callable, Iterable from contextlib import AbstractContextManager from datetime import tzinfo from logging import Logger -from typing import Any, TypeAlias +from typing import Any, Self, TypeAlias from django.db.backends.base.client import BaseDatabaseClient from django.db.backends.base.creation import BaseDatabaseCreation @@ -16,7 +16,6 @@ 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 NO_DB_ALIAS: str RAN_DB_VERSION_CHECK: set[str] diff --git a/python/helpers/bundled_stubs/Django/django-stubs/db/backends/base/creation.pyi b/python/helpers/bundled_stubs/Django/django-stubs/db/backends/base/creation.pyi index ddbd0960f249..6670e89e6d43 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/db/backends/base/creation.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/db/backends/base/creation.pyi @@ -1,16 +1,27 @@ -from typing import Any +from typing import Any, ClassVar, overload from django.db.backends.base.base import BaseDatabaseWrapper +from typing_extensions import deprecated TEST_DATABASE_PREFIX: str class BaseDatabaseCreation: + destroy_test_db_connection_close_method: ClassVar[str | None] connection: BaseDatabaseWrapper def __init__(self, connection: BaseDatabaseWrapper) -> None: ... def __del__(self) -> None: ... def log(self, msg: str) -> None: ... + @overload + @deprecated( + "DatabaseCreation.create_test_db(serialize) is deprecated. Call DatabaseCreation.serialize_test_db() once all " + "test databases are set up instead if you need fixtures persistence between tests." + ) def create_test_db( - self, verbosity: int = 1, autoclobber: bool = False, serialize: bool | None = None, keepdb: bool = False + self, verbosity: int = 1, autoclobber: bool = False, serialize: bool = ..., keepdb: bool = False + ) -> str: ... + @overload + def create_test_db( + self, verbosity: int = 1, autoclobber: bool = False, serialize: None = None, keepdb: bool = False ) -> str: ... def set_as_test_mirror(self, primary_settings_dict: dict[str, dict[str, None] | int | str | None]) -> None: ... def serialize_db_to_string(self) -> str: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/db/backends/base/features.pyi b/python/helpers/bundled_stubs/Django/django-stubs/db/backends/base/features.pyi index 8eb8175e5768..7146892212cb 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/db/backends/base/features.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/db/backends/base/features.pyi @@ -41,6 +41,7 @@ class BaseDatabaseFeatures: has_real_datatype: bool supports_subqueries_in_group_by: bool ignores_unnecessary_order_by_in_subqueries: bool + has_native_boolean_field: bool has_native_uuid_field: bool has_native_duration_field: bool supports_temporal_subtraction: bool @@ -100,6 +101,8 @@ class BaseDatabaseFeatures: supports_aggregate_order_by_clause: bool supports_aggregate_distinct_multiple_argument: bool supports_any_value: bool + supports_bit_aggregations: bool + supports_default_in_bit_aggregations: bool supports_index_on_text_field: bool supports_over_clause: bool supports_frame_range_fixed_distance: bool @@ -139,17 +142,29 @@ class BaseDatabaseFeatures: supports_comments_inline: bool supports_stored_generated_columns: bool supports_virtual_generated_columns: bool + supports_alter_generated_column_data_type: bool supports_logical_xor: bool prohibits_null_characters_in_text_exception: tuple[ValueError | DataError] | None supports_unlimited_charfield: bool supports_tuple_comparison_against_subquery: bool rounds_to_even: bool + pattern_lookup_needs_param_pattern: bool + supports_no_precision_decimalfield: bool supports_tuple_lookups: bool + supports_on_delete_db_cascade: bool + supports_on_delete_db_default: bool + supports_on_delete_db_null: bool + supports_inspectdb: bool test_collations: dict[str, str | None] test_now_utc_template: str | None insert_test_table_with_defaults: str | None django_test_expected_failures: set[str] django_test_skips: dict[str, set[str]] + disallowed_simple_test_case_connection_methods: list[tuple[str, str]] + supports_uuid4_function: bool + supports_uuid4_function_in_default: bool + supports_uuid7_function: bool + supports_uuid7_function_shift: bool connection: BaseDatabaseWrapper def __init__(self, connection: BaseDatabaseWrapper) -> None: ... def __del__(self) -> None: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/db/backends/base/introspection.pyi b/python/helpers/bundled_stubs/Django/django-stubs/db/backends/base/introspection.pyi index 9a35a098cee2..7834a87ce590 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/db/backends/base/introspection.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/db/backends/base/introspection.pyi @@ -1,11 +1,12 @@ from collections.abc import Iterable -from typing import Any, Literal, NamedTuple, type_check_only +from typing import Any, Literal, NamedTuple, NotRequired, 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.deletion import DatabaseOnDelete, _Collector from django.db.models.fields import Field -from typing_extensions import NotRequired, TypedDict +from typing_extensions import TypedDict class TableInfo(NamedTuple): name: str @@ -43,6 +44,7 @@ class _SequenceDict(TypedDict): class BaseDatabaseIntrospection: data_types_reverse: Any + on_delete_types: dict[str, _Collector | DatabaseOnDelete] connection: BaseDatabaseWrapper def __init__(self, connection: BaseDatabaseWrapper) -> None: ... def __del__(self) -> None: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/db/backends/base/operations.pyi b/python/helpers/bundled_stubs/Django/django-stubs/db/backends/base/operations.pyi index 2b34a0161089..a36d7272417a 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/db/backends/base/operations.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/db/backends/base/operations.pyi @@ -51,6 +51,7 @@ class BaseDatabaseOperations: self, nowait: bool = False, skip_locked: bool = False, of: Any = (), no_key: bool = False ) -> str: ... def limit_offset_sql(self, low_mark: int, high_mark: int | None) -> str: ... + def fk_on_delete_sql(self, operation: str) -> str: ... def bulk_insert_sql(self, fields: Iterable[Field[Any, Any]], placeholder_rows: Iterable[str]) -> str: ... def last_executed_query(self, cursor: Any, sql: Any, params: Any) -> str: ... def last_insert_id(self, cursor: CursorWrapper, table_name: str, pk_name: str) -> int: ... @@ -86,6 +87,7 @@ class BaseDatabaseOperations: def adapt_integerfield_value(self, value: Any, internal_type: Any) -> Any: ... def adapt_datefield_value(self, value: date | None) -> str | None: ... def adapt_datetimefield_value(self, value: real_datetime | None) -> str | None: ... + def adapt_durationfield_value(self, value: timedelta | None) -> int | None: ... def adapt_timefield_value(self, value: real_datetime | time | None) -> str | None: ... def adapt_decimalfield_value( self, value: Decimal | None, max_digits: int | None = None, decimal_places: int | None = None @@ -98,11 +100,14 @@ class BaseDatabaseOperations: def convert_durationfield_value( self, value: float | None, expression: Expression, connection: BaseDatabaseWrapper ) -> timedelta | None: ... + def convert_trunc_expression( + self, value: real_datetime | None, expression: Expression + ) -> real_datetime | date | time | None: ... def check_expression_support(self, expression: Any) -> None: ... def conditional_expression_supported_in_where_clause(self, expression: Any) -> bool: ... def combine_expression(self, connector: str, sub_expressions: list[str]) -> str: ... def combine_duration_expression(self, connector: Any, sub_expressions: Any) -> str: ... - def binary_placeholder_sql(self, value: Case | None) -> str: ... + def binary_placeholder_sql(self, value: Case | None, compiler: SQLCompiler) -> str: ... def modify_insert_params(self, placeholder: str, params: Any) -> Any: ... def integer_field_range(self, internal_type: Any) -> tuple[int, int]: ... def subtract_temporals(self, internal_type: Any, lhs: Any, rhs: Any) -> tuple[str, tuple[Any, ...]]: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/db/backends/base/schema.pyi b/python/helpers/bundled_stubs/Django/django-stubs/db/backends/base/schema.pyi index cdeaf0c559ff..74fd66e53e28 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/db/backends/base/schema.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/db/backends/base/schema.pyi @@ -2,7 +2,7 @@ from collections.abc import Sequence from contextlib import AbstractContextManager from logging import Logger from types import TracebackType -from typing import Any +from typing import Any, Self from django.db.backends.base.base import BaseDatabaseWrapper from django.db.backends.ddl_references import Statement @@ -11,7 +11,7 @@ from django.db.models.constraints import BaseConstraint from django.db.models.fields import Field from django.db.models.indexes import Index from django.db.models.sql.compiler import _AsSqlType -from typing_extensions import Self, override +from typing_extensions import override logger: Logger diff --git a/python/helpers/bundled_stubs/Django/django-stubs/db/backends/mysql/features.pyi b/python/helpers/bundled_stubs/Django/django-stubs/db/backends/mysql/features.pyi index b07df3b0701d..cfbe298aea0e 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/db/backends/mysql/features.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/db/backends/mysql/features.pyi @@ -78,8 +78,6 @@ class DatabaseFeatures(BaseDatabaseFeatures): @override def has_select_for_update_of(self) -> bool: ... # type: ignore[override] @cached_property - def supports_explain_analyze(self) -> bool: ... - @cached_property @override def supported_explain_formats(self) -> set[str]: ... # type: ignore[override] @cached_property @@ -121,3 +119,12 @@ class DatabaseFeatures(BaseDatabaseFeatures): @cached_property @override def supports_any_value(self) -> bool: ... # type: ignore[override] + @cached_property + @override + def supports_uuid4_function(self) -> bool: ... # type: ignore[override] + @property + @override + def supports_uuid4_function_in_default(self) -> bool: ... # type: ignore[override] + @cached_property + @override + def supports_uuid7_function(self) -> bool: ... # type: ignore[override] diff --git a/python/helpers/bundled_stubs/Django/django-stubs/db/backends/mysql/operations.pyi b/python/helpers/bundled_stubs/Django/django-stubs/db/backends/mysql/operations.pyi index 36c3df0eb7b8..e4065fcb396e 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/db/backends/mysql/operations.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/db/backends/mysql/operations.pyi @@ -4,6 +4,7 @@ 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 +from django.db.models.sql.compiler import SQLCompiler from typing_extensions import override class DatabaseOperations(BaseDatabaseOperations): @@ -55,7 +56,7 @@ class DatabaseOperations(BaseDatabaseOperations): def convert_datetimefield_value(self, value: Any, expression: Any, connection: Any) -> Any: ... def convert_uuidfield_value(self, value: Any, expression: Any, connection: Any) -> Any: ... @override - def binary_placeholder_sql(self, value: Any) -> Any: ... + def binary_placeholder_sql(self, value: Any, compiler: SQLCompiler) -> Any: ... @override def subtract_temporals(self, internal_type: Any, lhs: Any, rhs: Any) -> Any: ... @override diff --git a/python/helpers/bundled_stubs/Django/django-stubs/db/backends/oracle/creation.pyi b/python/helpers/bundled_stubs/Django/django-stubs/db/backends/oracle/creation.pyi index 6a35b2e2ef1a..6f023e873175 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/db/backends/oracle/creation.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/db/backends/oracle/creation.pyi @@ -1,4 +1,4 @@ -from typing import Any +from typing import Any, ClassVar from django.db.backends.base.creation import BaseDatabaseCreation from django.db.backends.oracle.base import DatabaseWrapper @@ -7,6 +7,7 @@ from typing_extensions import override TEST_DATABASE_PREFIX: str class DatabaseCreation(BaseDatabaseCreation): + destroy_test_db_connection_close_method: ClassVar[str | None] connection: DatabaseWrapper @override def set_as_test_mirror(self, primary_settings_dict: Any) -> None: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/db/backends/oracle/features.pyi b/python/helpers/bundled_stubs/Django/django-stubs/db/backends/oracle/features.pyi index e1a3727cb671..6fc50f5bceed 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/db/backends/oracle/features.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/db/backends/oracle/features.pyi @@ -48,8 +48,10 @@ class DatabaseFeatures(BaseDatabaseFeatures): supports_aggregate_order_by_clause: bool supports_any_value: bool supports_tuple_comparison_against_subquery: bool - supports_json_negative_indexing: bool + @cached_property + @override + def supports_json_negative_indexing(self) -> bool: ... # type: ignore[override] @cached_property @override def django_test_skips(self) -> dict[str, set[str]]: ... # type: ignore[override] @@ -79,3 +81,15 @@ class DatabaseFeatures(BaseDatabaseFeatures): @cached_property @override def supports_tuple_lookups(self) -> bool: ... # type: ignore[override] + @cached_property + @override + def supports_uuid4_function(self) -> bool: ... # type: ignore[override] + @cached_property + @override + def supports_uuid4_function_in_default(self) -> bool: ... # type: ignore[override] + @cached_property + @override + def supports_stored_generated_columns(self) -> bool: ... # type: ignore[override] + @cached_property + @override + def supports_bit_aggregations(self) -> bool: ... # type: ignore[override] diff --git a/python/helpers/bundled_stubs/Django/django-stubs/db/backends/oracle/operations.pyi b/python/helpers/bundled_stubs/Django/django-stubs/db/backends/oracle/operations.pyi index 66f466a391c7..8c2b156be135 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/db/backends/oracle/operations.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/db/backends/oracle/operations.pyi @@ -79,6 +79,8 @@ class DatabaseOperations(BaseDatabaseOperations): @override def adapt_datetimefield_value(self, value: Any) -> Any: ... @override + def adapt_durationfield_value(self, value: Any) -> Any: ... + @override def adapt_timefield_value(self, value: Any) -> Any: ... @override def combine_expression(self, connector: Any, sub_expressions: Any) -> Any: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/db/backends/postgresql/compiler.pyi b/python/helpers/bundled_stubs/Django/django-stubs/db/backends/postgresql/compiler.pyi index 22a23832d57c..f2983e3ec1e0 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/db/backends/postgresql/compiler.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/db/backends/postgresql/compiler.pyi @@ -1,7 +1,7 @@ from typing import Any from django.db.models.sql.compiler import SQLAggregateCompiler as SQLAggregateCompiler -from django.db.models.sql.compiler import SQLCompiler as BaseSQLCompiler +from django.db.models.sql.compiler import SQLCompiler as SQLCompiler from django.db.models.sql.compiler import SQLDeleteCompiler as SQLDeleteCompiler from django.db.models.sql.compiler import SQLInsertCompiler as BaseSQLInsertCompiler from django.db.models.sql.compiler import SQLUpdateCompiler as SQLUpdateCompiler @@ -17,10 +17,6 @@ __all__ = [ class InsertUnnest(list[str]): ... -class SQLCompiler(BaseSQLCompiler): - @override - def quote_name_unless_alias(self, name: str) -> str: ... - class SQLInsertCompiler(BaseSQLInsertCompiler): @override def assemble_as_sql(self, fields: Any, value_rows: Any) -> tuple[Any, Any]: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/db/backends/postgresql/features.pyi b/python/helpers/bundled_stubs/Django/django-stubs/db/backends/postgresql/features.pyi index a6f2a5d3ad90..684d5254216c 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/db/backends/postgresql/features.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/db/backends/postgresql/features.pyi @@ -11,6 +11,7 @@ class DatabaseFeatures(BaseDatabaseFeatures): can_return_columns_from_insert: bool can_return_rows_from_bulk_insert: bool has_real_datatype: bool + has_native_boolean_field: bool has_native_uuid_field: bool has_native_duration_field: bool has_native_json_field: bool @@ -44,6 +45,13 @@ class DatabaseFeatures(BaseDatabaseFeatures): supports_deferrable_unique_constraints: bool has_json_operators: bool json_key_contains_list_matching_requires_list: bool + supports_uuid4_function: bool + @cached_property + @override + def supports_uuid7_function(self) -> bool: ... # type: ignore[override] + @cached_property + @override + def supports_uuid7_function_shift(self) -> bool: ... # type: ignore[override] @cached_property @override def django_test_skips(self) -> dict[str, set[str]]: ... # type: ignore[override] @@ -54,16 +62,19 @@ class DatabaseFeatures(BaseDatabaseFeatures): def uses_server_side_binding(self) -> bool: ... @cached_property @override + def max_query_params(self) -> int | None: ... # type: ignore[override] + @cached_property + @override def prohibits_null_characters_in_text_exception(self) -> tuple[type[Exception], str]: ... # type: ignore[override] @cached_property @override def introspected_field_types(self) -> dict[str, str]: ... # type: ignore[override] @cached_property - def is_postgresql_15(self) -> bool: ... - @cached_property def is_postgresql_16(self) -> bool: ... @cached_property def is_postgresql_17(self) -> bool: ... + @cached_property + def is_postgresql_18(self) -> bool: ... supports_covering_indexes: bool supports_non_deterministic_collations: bool can_return_rows_from_update: bool @@ -74,3 +85,9 @@ class DatabaseFeatures(BaseDatabaseFeatures): @property @override def supports_any_value(self) -> bool: ... # type: ignore[override] + @property + @override + def supports_virtual_generated_columns(self) -> bool: ... # type: ignore[override] + @property + @override + def supports_uuid4_function_in_default(self) -> bool: ... # type: ignore[override] diff --git a/python/helpers/bundled_stubs/Django/django-stubs/db/backends/postgresql/introspection.pyi b/python/helpers/bundled_stubs/Django/django-stubs/db/backends/postgresql/introspection.pyi index 8ca0f75523a7..aaf6a03741f1 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/db/backends/postgresql/introspection.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/db/backends/postgresql/introspection.pyi @@ -3,6 +3,7 @@ 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 django.db.models.deletion import DatabaseOnDelete, _Collector from typing_extensions import override class FieldInfo(NamedTuple): @@ -28,6 +29,7 @@ class DatabaseIntrospection(BaseDatabaseIntrospection): data_types_reverse: dict[int, str] index_default_access_method: str ignored_tables: list[str] + on_delete_types: dict[str, _Collector | DatabaseOnDelete] @override def get_table_description(self, cursor: CursorWrapper, table_name: str) -> list[FieldInfo]: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/db/backends/postgresql/psycopg_any.pyi b/python/helpers/bundled_stubs/Django/django-stubs/db/backends/postgresql/psycopg_any.pyi index d1ddb8777921..aa0d0aaf8922 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/db/backends/postgresql/psycopg_any.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/db/backends/postgresql/psycopg_any.pyi @@ -32,11 +32,12 @@ RANGE_TYPES: tuple[Any, ...] Jsonb: Any ClientCursor: Any TextLoader: Any -TimestamptzLoader: Any BaseTzLoader: Any RangeDumper: Any DjangoRangeDumper: Any +orig_tz_loader_cls: Any + def Inet(address: str) -> Any: ... def mogrify(sql: str, params: Any, connection: BaseDatabaseWrapper) -> str: ... def register_tzloader(tz: Any, context: Any) -> None: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/db/backends/sqlite3/features.pyi b/python/helpers/bundled_stubs/Django/django-stubs/db/backends/sqlite3/features.pyi index a155af161a95..fd880d3a2ece 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/db/backends/sqlite3/features.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/db/backends/sqlite3/features.pyi @@ -11,6 +11,9 @@ class DatabaseFeatures(BaseDatabaseFeatures): supports_any_value: bool @cached_property @override + def supports_uuid7_function(self) -> bool: ... # type: ignore[override] + @cached_property + @override def django_test_skips(self) -> dict[str, set[str]]: ... # type: ignore[override] @cached_property @override @@ -36,3 +39,6 @@ class DatabaseFeatures(BaseDatabaseFeatures): @property @override def can_return_rows_from_update(self) -> bool: ... # type: ignore[override] + @property + @override + def supports_uuid4_function_in_default(self) -> bool: ... # type: ignore[override] diff --git a/python/helpers/bundled_stubs/Django/django-stubs/db/backends/sqlite3/operations.pyi b/python/helpers/bundled_stubs/Django/django-stubs/db/backends/sqlite3/operations.pyi index bf4f361d2f41..e2d7f46e4292 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/db/backends/sqlite3/operations.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/db/backends/sqlite3/operations.pyi @@ -5,9 +5,14 @@ from uuid import UUID from django.db.backends.base.base import BaseDatabaseWrapper from django.db.backends.base.operations import BaseDatabaseOperations +from django.db.models.aggregates import Aggregate from django.db.models.expressions import Expression +from django.db.models.fields import DateField, DateTimeField, TimeField from typing_extensions import override +UNSUPPORTED_DATETIME_AGGREGATES: tuple[type[Aggregate], ...] +DATETIME_FIELDS: tuple[type[DateField[Any, Any] | DateTimeField[Any, Any] | TimeField[Any, Any]], ...] + class DatabaseOperations(BaseDatabaseOperations): jsonfield_datatype_values: frozenset[str] def convert_datetimefield_value(self, value: Any, expression: Any, connection: Any) -> Any | None: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/db/backends/utils.pyi b/python/helpers/bundled_stubs/Django/django-stubs/db/backends/utils.pyi index 04876ff42ae0..6801a21b44f3 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/db/backends/utils.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/db/backends/utils.pyi @@ -4,11 +4,9 @@ from contextlib import AbstractContextManager from decimal import Decimal from logging import Logger from types import TracebackType -from typing import Any, Literal, Protocol, TypeAlias, overload, type_check_only +from typing import Any, Literal, Protocol, Self, TypeAlias, overload, type_check_only from uuid import UUID -from typing_extensions import Self - logger: Logger # Protocol matching psycopg2.sql.Composable, to avoid depending psycopg2 diff --git a/python/helpers/bundled_stubs/Django/django-stubs/db/migrations/autodetector.pyi b/python/helpers/bundled_stubs/Django/django-stubs/db/migrations/autodetector.pyi index b6e180bc9a08..5781d58169f9 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/db/migrations/autodetector.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/db/migrations/autodetector.pyi @@ -1,6 +1,6 @@ from collections.abc import Callable, Iterable from enum import Enum -from typing import Any +from typing import Any, Self from django.db.migrations.graph import MigrationGraph from django.db.migrations.migration import Migration @@ -9,7 +9,6 @@ from django.db.migrations.questioner import MigrationQuestioner from django.db.migrations.state import ProjectState from django.db.models.fields import Field from django.utils.functional import cached_property -from typing_extensions import Self class OperationDependency(tuple[str, str, str | None, OperationDependency.Type]): class Type(Enum): diff --git a/python/helpers/bundled_stubs/Django/django-stubs/db/migrations/migration.pyi b/python/helpers/bundled_stubs/Django/django-stubs/db/migrations/migration.pyi index 1fa7be9a4a9c..ca8ae1afd7ab 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/db/migrations/migration.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/db/migrations/migration.pyi @@ -1,10 +1,9 @@ from collections.abc import Sequence -from typing import ClassVar +from typing import ClassVar, Self from django.db.backends.base.schema import BaseDatabaseSchemaEditor from django.db.migrations.operations.base import Operation from django.db.migrations.state import ProjectState -from typing_extensions import Self class Migration: operations: ClassVar[Sequence[Operation]] diff --git a/python/helpers/bundled_stubs/Django/django-stubs/db/migrations/operations/base.pyi b/python/helpers/bundled_stubs/Django/django-stubs/db/migrations/operations/base.pyi index 3469e42dd211..174feffdb8e9 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/db/migrations/operations/base.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/db/migrations/operations/base.pyi @@ -1,14 +1,13 @@ from collections.abc import Sequence -from enum import Enum -from typing import Any, ClassVar +from enum import StrEnum +from typing import Any, ClassVar, Self from django.db.backends.base.base import BaseDatabaseWrapper from django.db.backends.base.schema import BaseDatabaseSchemaEditor from django.db.migrations.state import ProjectState from django.db.models import Model -from typing_extensions import Self -class OperationCategory(str, Enum): +class OperationCategory(StrEnum): ADDITION = "+" REMOVAL = "-" ALTERATION = "~" diff --git a/python/helpers/bundled_stubs/Django/django-stubs/db/migrations/recorder.pyi b/python/helpers/bundled_stubs/Django/django-stubs/db/migrations/recorder.pyi index 5b6f9e966dd3..07ac4c4f2da7 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/db/migrations/recorder.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/db/migrations/recorder.pyi @@ -1,10 +1,9 @@ -from typing import Any, ClassVar +from typing import Any, ClassVar, Self from django.db.backends.base.base import BaseDatabaseWrapper from django.db.models.base import Model from django.db.models.manager import Manager from django.db.models.query import QuerySet -from typing_extensions import Self class MigrationRecorder: class Migration(Model): diff --git a/python/helpers/bundled_stubs/Django/django-stubs/db/migrations/serializer.pyi b/python/helpers/bundled_stubs/Django/django-stubs/db/migrations/serializer.pyi index 1bc8ad596d41..c01bbc92ecd3 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/db/migrations/serializer.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/db/migrations/serializer.pyi @@ -15,6 +15,7 @@ class DateTimeSerializer(BaseSerializer): ... class DatetimeDatetimeSerializer(BaseSerializer): ... class DecimalSerializer(BaseSerializer): ... class ChoicesSerializer(BaseSerializer): ... +class DatabaseOnDeleteSerializer(BaseSerializer): ... class DeconstructibleSerializer(BaseSerializer): @staticmethod @@ -28,6 +29,7 @@ class FloatSerializer(BaseSimpleSerializer): ... class FrozensetSerializer(BaseUnorderedSequenceSerializer): ... class FunctionTypeSerializer(BaseSerializer): ... class FunctoolsPartialSerializer(BaseSerializer): ... +class GenericAliasSerializer(BaseSerializer): ... class IterableSerializer(BaseSerializer): ... class ModelFieldSerializer(DeconstructibleSerializer): ... class ModelManagerSerializer(DeconstructibleSerializer): ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/db/models/__init__.pyi b/python/helpers/bundled_stubs/Django/django-stubs/db/models/__init__.pyi index 651463131e4f..7d3756563e26 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/db/models/__init__.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/db/models/__init__.pyi @@ -5,6 +5,9 @@ from . import signals as signals from .aggregates import Aggregate as Aggregate from .aggregates import AnyValue as AnyValue from .aggregates import Avg as Avg +from .aggregates import BitAnd as BitAnd +from .aggregates import BitOr as BitOr +from .aggregates import BitXor as BitXor from .aggregates import Count as Count from .aggregates import Max as Max from .aggregates import Min as Min @@ -19,6 +22,9 @@ from .constraints import CheckConstraint as CheckConstraint from .constraints import Deferrable as Deferrable from .constraints import UniqueConstraint as UniqueConstraint from .deletion import CASCADE as CASCADE +from .deletion import DB_CASCADE as DB_CASCADE +from .deletion import DB_SET_DEFAULT as DB_SET_DEFAULT +from .deletion import DB_SET_NULL as DB_SET_NULL from .deletion import DO_NOTHING as DO_NOTHING from .deletion import PROTECT as PROTECT from .deletion import RESTRICT as RESTRICT @@ -37,6 +43,7 @@ from .expressions import ExpressionList as ExpressionList from .expressions import ExpressionWrapper as ExpressionWrapper from .expressions import F as F from .expressions import Func as Func +from .expressions import JSONNull as JSONNull from .expressions import OrderBy as OrderBy from .expressions import OuterRef as OuterRef from .expressions import RowRange as RowRange @@ -47,7 +54,11 @@ from .expressions import When as When from .expressions import Window as Window from .expressions import WindowFrame as WindowFrame from .expressions import WindowFrameExclusion as WindowFrameExclusion +from .fetch_modes import FETCH_ONE as FETCH_ONE +from .fetch_modes import FETCH_PEERS as FETCH_PEERS +from .fetch_modes import FETCH_RAISE as FETCH_RAISE from .fields import BLANK_CHOICE_DASH as BLANK_CHOICE_DASH +from .fields import BLANK_CHOICE_LABEL as BLANK_CHOICE_LABEL from .fields import NOT_PROVIDED as NOT_PROVIDED from .fields import AutoField as AutoField from .fields import BigAutoField as BigAutoField @@ -106,9 +117,16 @@ from .query_utils import Q as Q __all__ = [ "BLANK_CHOICE_DASH", + "BLANK_CHOICE_LABEL", "CASCADE", + "DB_CASCADE", + "DB_SET_DEFAULT", + "DB_SET_NULL", "DEFERRED", "DO_NOTHING", + "FETCH_ONE", + "FETCH_PEERS", + "FETCH_RAISE", "NOT_PROVIDED", "PROTECT", "RESTRICT", @@ -123,6 +141,9 @@ __all__ = [ "BigAutoField", "BigIntegerField", "BinaryField", + "BitAnd", + "BitOr", + "BitXor", "BooleanField", "Case", "CharField", @@ -160,6 +181,7 @@ __all__ = [ "IntegerChoices", "IntegerField", "JSONField", + "JSONNull", "Lookup", "Manager", "ManyToManyField", diff --git a/python/helpers/bundled_stubs/Django/django-stubs/db/models/aggregates.pyi b/python/helpers/bundled_stubs/Django/django-stubs/db/models/aggregates.pyi index 4e65b9e11938..a2365edb95a7 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/db/models/aggregates.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/db/models/aggregates.pyi @@ -40,6 +40,14 @@ class AnyValue(Aggregate): class Avg(FixDurationInputMixin, NumericOutputFieldMixin, Aggregate): ... +class BitAggregate(Aggregate): + def __init__(self, expression: Combinable | str, **extra: Any) -> None: ... + def as_oracle(self, compiler: SQLCompiler, connection: BaseDatabaseWrapper, **extra_context: Any) -> _AsSqlType: ... + +class BitAnd(BitAggregate): ... +class BitOr(BitAggregate): ... +class BitXor(BitAggregate): ... + class Count(Aggregate): output_field: ClassVar[IntegerField[Any, Any]] def __init__( @@ -95,4 +103,18 @@ class Variance(NumericOutputFieldMixin, Aggregate): **extra: Any, ) -> None: ... -__all__ = ["Aggregate", "AnyValue", "Avg", "Count", "Max", "Min", "StdDev", "StringAgg", "Sum", "Variance"] +__all__ = [ + "Aggregate", + "AnyValue", + "Avg", + "BitAnd", + "BitOr", + "BitXor", + "Count", + "Max", + "Min", + "StdDev", + "StringAgg", + "Sum", + "Variance", +] diff --git a/python/helpers/bundled_stubs/Django/django-stubs/db/models/base.pyi b/python/helpers/bundled_stubs/Django/django-stubs/db/models/base.pyi index f44dbb9636f0..b5cb2d835b37 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/db/models/base.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/db/models/base.pyi @@ -1,15 +1,17 @@ -import sys from collections.abc import Collection, Iterable, Sequence -from typing import Any, ClassVar, Final, overload +from typing import Any, ClassVar, Final, Self, overload +from weakref import ReferenceType from django.core.checks.messages import CheckMessage from django.core.exceptions import MultipleObjectsReturned as BaseMultipleObjectsReturned from django.core.exceptions import ObjectDoesNotExist, ObjectNotUpdated, ValidationError from django.db.models import BaseConstraint, Field, QuerySet +from django.db.models.fetch_modes import FetchMode from django.db.models.manager import Manager from django.db.models.options import Options from django.db.models.utils import AltersData -from typing_extensions import Self, TypeVar, override +from django.utils.datastructures import _ListOrTuple +from typing_extensions import TypeVar, override _Self = TypeVar("_Self", bound=Model) @@ -23,10 +25,21 @@ class ModelStateFieldsCacheDescriptor: @overload def __get__(self, instance: ModelState, cls: type[ModelState] | None = None) -> dict[Any, Any]: ... +class ModelStateFetchModeDescriptor: + @overload + def __get__(self, instance: None, cls: type[ModelState] | None = None) -> Self: ... + @overload + def __get__(self, instance: ModelState, cls: type[ModelState] | None = None) -> FetchMode: ... + class ModelState: db: str | None adding: bool fields_cache: ModelStateFieldsCacheDescriptor + fetch_mode: ModelStateFetchModeDescriptor + peers: _ListOrTuple[ReferenceType[Model]] + @override + def __getstate__(self) -> dict[str, Any]: ... + def __del__(self) -> None: ... class ModelBase(type): def __new__(cls, name: str, bases: tuple[type, ...], attrs: dict[str, Any], **kwargs: Any) -> ModelBase: ... @@ -53,12 +66,16 @@ class Model(AltersData, metaclass=ModelBase): _state: ModelState def __init__(self, *args: Any, **kwargs: Any) -> None: ... @classmethod - def from_db(cls, db: str | None, field_names: Collection[str], values: Collection[Any]) -> Self: ... - if sys.version_info >= (3, 11): - @override - def __getstate__(self) -> dict[str, Any]: ... - else: - def __getstate__(self) -> dict[str, Any]: ... + def from_db( + cls, + db: str | None, + field_names: Collection[str], + values: Collection[Any], + *, + fetch_mode: FetchMode | None = None, + ) -> Self: ... + @override + def __getstate__(self) -> dict[str, Any]: ... def _get_pk_val(self, meta: Options[Model] | None = None) -> str: ... def get_deferred_fields(self) -> set[str]: ... def refresh_from_db( diff --git a/python/helpers/bundled_stubs/Django/django-stubs/db/models/constraints.pyi b/python/helpers/bundled_stubs/Django/django-stubs/db/models/constraints.pyi index 8c7bd0ae7231..14ceca9f4cb0 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/db/models/constraints.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/db/models/constraints.pyi @@ -1,6 +1,6 @@ from collections.abc import Sequence from enum import Enum -from typing import Any, cast, overload +from typing import Any, Self, cast, overload from django.core.checks import CheckMessage from django.db.backends.base.base import BaseDatabaseWrapper @@ -9,7 +9,7 @@ from django.db.models.base import Model from django.db.models.expressions import BaseExpression, Combinable from django.db.models.query_utils import Q from django.utils.functional import _StrOrPromise -from typing_extensions import Self, override +from typing_extensions import override class Deferrable(Enum): DEFERRED = cast(str, ...) @@ -71,7 +71,7 @@ class UniqueConstraint(BaseConstraint): self, *expressions: str | BaseExpression | Combinable, fields: None = None, - name: str | None = None, + name: str, condition: Q | None = None, deferrable: Deferrable | None = None, include: Sequence[str] | None = None, @@ -85,7 +85,7 @@ class UniqueConstraint(BaseConstraint): self, *, fields: Sequence[str], - name: str | None = None, + name: str, condition: Q | None = None, deferrable: Deferrable | None = None, include: Sequence[str] | None = None, diff --git a/python/helpers/bundled_stubs/Django/django-stubs/db/models/deletion.pyi b/python/helpers/bundled_stubs/Django/django-stubs/db/models/deletion.pyi index 6dcf97fa7ffe..28bd9a31fb49 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/db/models/deletion.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/db/models/deletion.pyi @@ -1,8 +1,9 @@ from collections import defaultdict from collections.abc import Callable, Iterable, Iterator, Sequence -from typing import Any +from typing import Any, TypeAlias from django.db import IntegrityError +from django.db.backends.base.schema import BaseDatabaseSchemaEditor from django.db.models.base import Model from django.db.models.fields import Field from django.db.models.options import Options @@ -46,6 +47,25 @@ def RESTRICT( using: str, ) -> None: ... def SET(value: Any) -> Callable[..., Any]: ... + +_Collector: TypeAlias = Callable[[Collector, Field[Any, Any], QuerySet[Model], str], None] + +class DatabaseOnDelete: + operation: str + forced_collector: _Collector | None + + def __init__(self, operation: str, name: str, forced_collector: _Collector | None = ...) -> None: ... + + __call__: _Collector + + def on_delete_sql(self, schema_editor: BaseDatabaseSchemaEditor) -> str: ... + +DB_CASCADE: DatabaseOnDelete +DB_SET_DEFAULT: DatabaseOnDelete +DB_SET_NULL: DatabaseOnDelete + +SKIP_COLLECTION: frozenset[_Collector | DatabaseOnDelete] + def get_candidate_relations_to_delete(opts: Options[Model]) -> Iterable[Field[Any, Any]]: ... class ProtectedError(IntegrityError): @@ -64,7 +84,9 @@ class Collector: restricted_objects: defaultdict[Model, defaultdict[Field[Any, Any], set[Model]]] fast_deletes: list[QuerySet[Model]] dependencies: defaultdict[Model, set[Model]] - def __init__(self, using: str, origin: Model | QuerySet[Model] | None = None) -> None: ... + def __init__( + self, using: str, origin: Model | QuerySet[Model] | None = None, force_collection: bool = ... + ) -> None: ... def add( self, objs: _IndexableCollection[Model], diff --git a/python/helpers/bundled_stubs/Django/django-stubs/db/models/enums.pyi b/python/helpers/bundled_stubs/Django/django-stubs/db/models/enums.pyi index 96af108ed62b..f0adc0074e23 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/db/models/enums.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/db/models/enums.pyi @@ -1,5 +1,7 @@ import enum import sys +from enum import EnumType, IntEnum, StrEnum +from enum import property as enum_property from typing import Any, Literal, overload, type_check_only from _typeshed import ConvertibleToInt @@ -7,17 +9,6 @@ from _typeshed import Self as MetaclassSelf # noqa: TID251 from django.utils.functional import _StrOrPromise from typing_extensions import override -if sys.version_info >= (3, 11): - from enum import EnumType, IntEnum, StrEnum - from enum import property as enum_property -else: - from enum import EnumMeta as EnumType - from types import DynamicClassAttribute as enum_property - - class ReprEnum(enum.Enum): ... # type: ignore[misc] - class IntEnum(int, ReprEnum): ... # type: ignore[misc] - class StrEnum(str, ReprEnum): ... # type: ignore[misc] - class ChoicesType(EnumType): __empty__: _StrOrPromise def __new__( diff --git a/python/helpers/bundled_stubs/Django/django-stubs/db/models/expressions.pyi b/python/helpers/bundled_stubs/Django/django-stubs/db/models/expressions.pyi index ac920c4eab8e..df8693df53ae 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/db/models/expressions.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/db/models/expressions.pyi @@ -2,7 +2,7 @@ import datetime from collections.abc import Callable, Iterator, Mapping, Sequence from decimal import Decimal from enum import Enum -from typing import Any, ClassVar, Generic, Literal, TypeAlias +from typing import Any, ClassVar, Generic, Literal, Never, Self, TypeAlias from django.core.exceptions import FieldError from django.db.backends.base.base import BaseDatabaseWrapper @@ -14,7 +14,7 @@ from django.db.models.sql.compiler import SQLCompiler, _AsSqlType, _ParamsT from django.db.models.sql.query import Query from django.utils.deconstruct import _Deconstructible from django.utils.functional import cached_property -from typing_extensions import Never, Self, TypeVar, override +from typing_extensions import TypeVar, override _OutputField = TypeVar("_OutputField", bound=Field[Any, Any], default=Field[Any, Any]) _Numeric: TypeAlias = float | Decimal @@ -220,6 +220,11 @@ class Value(Expression): @property @override def empty_result_set_value(self) -> Any: ... + def as_sqlite(self, compiler: SQLCompiler, connection: BaseDatabaseWrapper, **extra_context: Any) -> _AsSqlType: ... + +class JSONNull(Value): + def __init__(self) -> None: ... + def as_mysql(self, compiler: SQLCompiler, connection: BaseDatabaseWrapper) -> _AsSqlType: ... class RawSQL(Expression): params: list[Any] diff --git a/python/helpers/bundled_stubs/Django/django-stubs/db/models/fetch_modes.pyi b/python/helpers/bundled_stubs/Django/django-stubs/db/models/fetch_modes.pyi new file mode 100644 index 000000000000..a2922b3132e7 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/db/models/fetch_modes.pyi @@ -0,0 +1,35 @@ +from typing import Any, NoReturn + +from django.db.models import Model +from typing_extensions import override + +class FetchMode: + track_peers: bool + + def fetch(self, fetcher: Any, instance: Model) -> None: ... + +class FetchOne(FetchMode): + @override + def fetch(self, fetcher: Any, instance: Model) -> None: ... + @override + def __reduce__(self) -> str: ... + +FETCH_ONE: FetchOne + +class FetchPeers(FetchMode): + track_peers: bool + + @override + def fetch(self, fetcher: Any, instance: Model) -> None: ... + @override + def __reduce__(self) -> str: ... + +FETCH_PEERS: FetchPeers + +class FetchRaise(FetchMode): + @override + def fetch(self, fetcher: Any, instance: Model) -> NoReturn: ... + @override + def __reduce__(self) -> str: ... + +FETCH_RAISE: FetchRaise diff --git a/python/helpers/bundled_stubs/Django/django-stubs/db/models/fields/__init__.pyi b/python/helpers/bundled_stubs/Django/django-stubs/db/models/fields/__init__.pyi index cc8f8bec6300..3415587bf9eb 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/db/models/fields/__init__.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/db/models/fields/__init__.pyi @@ -3,7 +3,7 @@ import uuid from collections.abc import Callable, Iterable, Mapping, Sequence from datetime import date, time, timedelta from datetime import datetime as real_datetime -from typing import Any, ClassVar, Generic, Protocol, TypeAlias, overload, type_check_only +from typing import Any, ClassVar, Generic, Protocol, Self, TypeAlias, overload, type_check_only from django import forms from django.core.checks import CheckMessage @@ -19,13 +19,16 @@ from django.forms.widgets import Widget from django.utils.choices import BlankChoiceIterator, _Choice, _ChoiceNamedGroup, _ChoicesCallable, _ChoicesInput from django.utils.datastructures import DictWrapper from django.utils.functional import _Getter, _StrOrPromise, cached_property -from typing_extensions import Self, TypeVar, override +from typing_extensions import TypeVar, override class Empty: ... class NOT_PROVIDED: ... +# RemovedInDjango70Warning BLANK_CHOICE_DASH: list[tuple[str, str]] +BLANK_CHOICE_LABEL: _StrOrPromise + _ChoicesList: TypeAlias = Sequence[_Choice] | Sequence[_ChoiceNamedGroup] _LimitChoicesTo: TypeAlias = Q | dict[str, Any] _LimitChoicesToCallable: TypeAlias = Callable[[], _LimitChoicesTo] @@ -241,7 +244,7 @@ class Field(RegisterLookupMixin, Generic[_ST, _GT]): def get_choices( self, include_blank: bool = True, - blank_choice: _ChoicesList = ..., + blank_choice: _ChoicesList | None = None, limit_choices_to: _LimitChoicesTo | None = None, ordering: Sequence[_OrderByFieldName] = (), ) -> BlankChoiceIterator | _ChoicesList: ... @@ -657,7 +660,7 @@ class FilePathField(Field[_ST, _GT]): class BinaryField(Field[_ST, _GT]): _pyi_private_get_type: bytes | memoryview - def get_placeholder(self, value: Any, compiler: SQLCompiler, connection: BaseDatabaseWrapper) -> str: ... + def get_placeholder_sql(self, value: Any, compiler: SQLCompiler, connection: BaseDatabaseWrapper) -> _AsSqlType: ... class DurationField(Field[_ST, _GT]): _pyi_private_get_type: timedelta @@ -669,6 +672,7 @@ class AutoFieldMixin: def deconstruct(self) -> tuple[str, str, Sequence[Any], dict[str, Any]]: ... def validate(self, value: Any, model_instance: Model | None) -> None: ... def get_db_prep_value(self, value: Any, connection: BaseDatabaseWrapper, prepared: bool = False) -> Any: ... + def get_db_prep_save(self, value: Any, connection: BaseDatabaseWrapper) -> Any: ... def contribute_to_class(self, cls: type[Model], name: str, **kwargs: Any) -> None: ... def formfield(self, **kwargs: Any) -> None: ... @@ -684,6 +688,7 @@ class SmallAutoField(AutoFieldMixin, SmallIntegerField[_ST, _GT]): ... # type: __all__ = [ "BLANK_CHOICE_DASH", + "BLANK_CHOICE_LABEL", "NOT_PROVIDED", "AutoField", "BigAutoField", diff --git a/python/helpers/bundled_stubs/Django/django-stubs/db/models/fields/files.pyi b/python/helpers/bundled_stubs/Django/django-stubs/db/models/fields/files.pyi index 05f5db8a0b63..94cf97355ccc 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/db/models/fields/files.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/db/models/fields/files.pyi @@ -1,6 +1,5 @@ -import sys from collections.abc import Callable, Iterable -from typing import Any, Protocol, overload, type_check_only +from typing import Any, Protocol, Self, overload, type_check_only from _typeshed import StrPath from django.core.files.base import File @@ -14,7 +13,7 @@ from django.db.models.query_utils import DeferredAttribute from django.db.models.utils import AltersData from django.utils.choices import _Choices from django.utils.functional import _StrOrPromise -from typing_extensions import Self, TypeVar, override +from typing_extensions import TypeVar, override class FieldFile(File[Any], AltersData): instance: Model @@ -41,11 +40,8 @@ class FieldFile(File[Any], AltersData): @property @override def closed(self) -> bool: ... - if sys.version_info >= (3, 11): - @override - def __getstate__(self) -> dict[str, Any]: ... - else: - def __getstate__(self) -> dict[str, Any]: ... + @override + def __getstate__(self) -> dict[str, Any]: ... def __setstate__(self, state: dict[str, Any]) -> None: ... class FileDescriptor(DeferredAttribute): diff --git a/python/helpers/bundled_stubs/Django/django-stubs/db/models/fields/json.pyi b/python/helpers/bundled_stubs/Django/django-stubs/db/models/fields/json.pyi index 77828e55fbb6..7eac426b1231 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/db/models/fields/json.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/db/models/fields/json.pyi @@ -1,6 +1,6 @@ import json from collections.abc import Callable -from typing import Any, ClassVar +from typing import Any, ClassVar, Self from django.db.backends.base.base import BaseDatabaseWrapper from django.db.models import Model, lookups @@ -9,7 +9,7 @@ from django.db.models.fields import TextField from django.db.models.lookups import FieldGetDbPrepValueMixin, PostgresOperatorLookup, Transform from django.db.models.sql.compiler import SQLCompiler, _AsSqlType from django.utils.functional import _StrOrPromise -from typing_extensions import Self, TypeVar, override +from typing_extensions import TypeVar, override from . import Field from .mixins import CheckFieldDefaultMixin diff --git a/python/helpers/bundled_stubs/Django/django-stubs/db/models/fields/related.pyi b/python/helpers/bundled_stubs/Django/django-stubs/db/models/fields/related.pyi index fd49b5c5b983..9241f632e05d 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/db/models/fields/related.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/db/models/fields/related.pyi @@ -1,5 +1,5 @@ from collections.abc import Callable, Iterable, Sequence -from typing import Any, Generic, Literal, overload +from typing import Any, Generic, Literal, Self, overload from uuid import UUID from django import forms @@ -24,7 +24,7 @@ from django.db.models.sql.where import WhereNode from django.forms.widgets import Widget from django.utils.choices import _Choices from django.utils.functional import _StrOrPromise, cached_property -from typing_extensions import Self, TypeVar, override +from typing_extensions import TypeVar, override RECURSIVE_RELATIONSHIP_CONSTANT: Literal["self"] diff --git a/python/helpers/bundled_stubs/Django/django-stubs/db/models/fields/related_descriptors.pyi b/python/helpers/bundled_stubs/Django/django-stubs/db/models/fields/related_descriptors.pyi index aead041ca77e..32da24b16215 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/db/models/fields/related_descriptors.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/db/models/fields/related_descriptors.pyi @@ -1,5 +1,5 @@ from collections.abc import Callable, Iterable, Mapping -from typing import Any, Generic, overload, type_check_only +from typing import Any, Generic, Never, Self, overload, type_check_only from django.core.exceptions import ObjectDoesNotExist from django.db.models.base import Model @@ -10,7 +10,7 @@ from django.db.models.manager import BaseManager, Manager from django.db.models.query import QuerySet from django.db.models.query_utils import DeferredAttribute from django.utils.functional import cached_property -from typing_extensions import Never, Self, TypeVar, override +from typing_extensions import TypeVar, override _M = TypeVar("_M", bound=Model) _F = TypeVar("_F", bound=Field[Any, Any]) @@ -28,7 +28,7 @@ class ForwardManyToOneDescriptor(Generic[_F]): @cached_property def RelatedObjectDoesNotExist(self) -> type[ObjectDoesNotExist]: ... def is_cached(self, instance: Model) -> bool: ... - def get_queryset(self, **hints: Any) -> QuerySet[Any]: ... + def get_queryset(self, *, instance: Model) -> QuerySet[Any]: ... def get_prefetch_querysets( self, instances: list[Model], querysets: list[QuerySet[Any]] | None = None ) -> tuple[QuerySet[Any], Callable[..., Any], Callable[..., Any], bool, str, bool]: ... @@ -36,6 +36,8 @@ class ForwardManyToOneDescriptor(Generic[_F]): def __get__( self, instance: Model | None, cls: type[Model] | None = None ) -> Model | ForwardManyToOneDescriptor[Any] | None: ... + def fetch_one(self, instance: Model) -> None: ... + def fetch_many(self, instances: Iterable[Model]) -> None: ... def __set__(self, instance: Model, value: Model | None) -> None: ... @override def __reduce__(self) -> tuple[Callable[..., Any], tuple[type[Model], str]]: ... @@ -59,7 +61,7 @@ class ReverseOneToOneDescriptor(Generic[_From, _To]): @cached_property def RelatedObjectDoesNotExist(self) -> type[ObjectDoesNotExist]: ... def is_cached(self, instance: _From) -> bool: ... - def get_queryset(self, **hints: Any) -> QuerySet[_To]: ... + def get_queryset(self, *, instance: Model) -> QuerySet[_To]: ... def get_prefetch_querysets( self, instances: list[_From], querysets: list[QuerySet[_To]] | None = None ) -> tuple[QuerySet[_To], Callable[..., Any], Callable[..., Any], bool, str, bool]: ... @@ -67,6 +69,12 @@ class ReverseOneToOneDescriptor(Generic[_From, _To]): def __get__(self, instance: None, cls: Any | None = None) -> ReverseOneToOneDescriptor[_From, _To]: ... @overload def __get__(self, instance: _From, cls: Any | None = None) -> _To: ... + # For compatibility with the fetcher protocol. While `self.related` is really a `OneToOneRel`, + # it quacks enough like a `Field` to work. + @property + def field(self) -> Field[Any, Any]: ... + def fetch_one(self, instance: Model) -> None: ... + def fetch_many(self, instances: Iterable[Model]) -> None: ... def __set__(self, instance: _From, value: _To | None) -> None: ... @override def __reduce__(self) -> tuple[Callable[..., Any], tuple[type[_To], str]]: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/db/models/fields/reverse_related.pyi b/python/helpers/bundled_stubs/Django/django-stubs/db/models/fields/reverse_related.pyi index c37f42d737fd..18c05e04086e 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/db/models/fields/reverse_related.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/db/models/fields/reverse_related.pyi @@ -75,7 +75,7 @@ class ForeignObjectRel(FieldCacheMixin): def get_choices( self, include_blank: bool = True, - blank_choice: _ChoicesList = ..., + blank_choice: _ChoicesList | None = None, limit_choices_to: _LimitChoicesTo | None = None, ordering: Sequence[_OrderByFieldName] = (), ) -> _ChoicesList: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/db/models/functions/__init__.pyi b/python/helpers/bundled_stubs/Django/django-stubs/db/models/functions/__init__.pyi index e9d295c25311..c76c29dcc38f 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/db/models/functions/__init__.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/db/models/functions/__init__.pyi @@ -78,6 +78,8 @@ from .text import StrIndex as StrIndex from .text import Substr as Substr from .text import Trim as Trim from .text import Upper as Upper +from .uuid import UUID4 as UUID4 +from .uuid import UUID7 as UUID7 from .window import CumeDist as CumeDist from .window import DenseRank as DenseRank from .window import FirstValue as FirstValue @@ -91,20 +93,19 @@ from .window import Rank as Rank from .window import RowNumber as RowNumber __all__ = [ - # text "MD5", "SHA1", "SHA224", "SHA256", "SHA384", "SHA512", + "UUID4", + "UUID7", "ACos", "ASin", "ATan", "ATan2", - # math "Abs", - # comparison and conversion "Cast", "Ceil", "Chr", @@ -114,12 +115,10 @@ __all__ = [ "ConcatPair", "Cos", "Cot", - # window "CumeDist", "Degrees", "DenseRank", "Exp", - # datetime "Extract", "ExtractDay", "ExtractHour", @@ -135,7 +134,6 @@ __all__ = [ "FirstValue", "Floor", "Greatest", - # json "JSONArray", "JSONObject", "LPad", diff --git a/python/helpers/bundled_stubs/Django/django-stubs/db/models/functions/uuid.pyi b/python/helpers/bundled_stubs/Django/django-stubs/db/models/functions/uuid.pyi new file mode 100644 index 000000000000..084c68cf0e33 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/db/models/functions/uuid.pyi @@ -0,0 +1,30 @@ +import datetime as dt +from typing import Any, ClassVar + +from django.db import models +from django.db.backends.base.base import BaseDatabaseWrapper +from django.db.models.expressions import Func +from django.db.models.sql.compiler import SQLCompiler, _AsSqlType +from typing_extensions import override + +class UUID4(Func): + output_field: ClassVar[models.UUIDField[Any, Any]] + @override + def as_sql(self, compiler: SQLCompiler, connection: BaseDatabaseWrapper, **extra_context: Any) -> _AsSqlType: ... # type: ignore[override] + def as_postgresql( + self, compiler: SQLCompiler, connection: BaseDatabaseWrapper, **extra_context: Any + ) -> _AsSqlType: ... + def as_mysql(self, compiler: SQLCompiler, connection: BaseDatabaseWrapper, **extra_context: Any) -> _AsSqlType: ... + def as_oracle(self, compiler: SQLCompiler, connection: BaseDatabaseWrapper, **extra_context: Any) -> _AsSqlType: ... + +class UUID7(Func): + output_field: ClassVar[models.UUIDField[Any, Any]] + def __init__(self, shift: dt.timedelta | None = None, **extra: Any) -> None: ... + @override + def as_sql(self, compiler: SQLCompiler, connection: BaseDatabaseWrapper, **extra_context: Any) -> _AsSqlType: ... # type: ignore[override] + def as_postgresql( + self, compiler: SQLCompiler, connection: BaseDatabaseWrapper, **extra_context: Any + ) -> _AsSqlType: ... + @override + def as_sqlite(self, compiler: SQLCompiler, connection: BaseDatabaseWrapper, **extra_context: Any) -> _AsSqlType: ... + def as_mysql(self, compiler: SQLCompiler, connection: BaseDatabaseWrapper, **extra_context: Any) -> _AsSqlType: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/db/models/lookups.pyi b/python/helpers/bundled_stubs/Django/django-stubs/db/models/lookups.pyi index 665f111784f6..ac859469dd89 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/db/models/lookups.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/db/models/lookups.pyi @@ -112,6 +112,8 @@ class PatternLookup(BuiltinLookup[str]): param_pattern: str @override def process_rhs(self, qn: SQLCompiler, connection: BaseDatabaseWrapper) -> _AsSqlType: ... + @property + def is_simple_lookup(self) -> bool: ... class Contains(PatternLookup): ... class IContains(Contains): ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/db/models/manager.pyi b/python/helpers/bundled_stubs/Django/django-stubs/db/models/manager.pyi index 8198fa9561af..145e85200c0f 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/db/models/manager.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/db/models/manager.pyi @@ -1,12 +1,12 @@ import datetime from collections.abc import AsyncIterator, Collection, Iterable, Iterator, Mapping, Sequence -from typing import Any, Generic, Literal, NoReturn, overload +from typing import Any, Generic, Literal, NoReturn, Self, overload from django.core.checks.messages import CheckMessage from django.db.models.base import Model from django.db.models.expressions import Combinable, OrderBy from django.db.models.query import Prefetch, QuerySet, RawQuerySet, _LookupT, _PrefetchedQuerySetT, _ToAttrT -from typing_extensions import Self, TypeVar +from typing_extensions import TypeVar _T = TypeVar("_T", bound=Model, covariant=True) diff --git a/python/helpers/bundled_stubs/Django/django-stubs/db/models/query.pyi b/python/helpers/bundled_stubs/Django/django-stubs/db/models/query.pyi index 98d6943b5639..e3169435c952 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/db/models/query.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/db/models/query.pyi @@ -1,16 +1,17 @@ import datetime -import sys from collections.abc import AsyncIterator, Collection, Iterable, Iterator, Mapping, Sequence, Sized -from typing import Any, Generic, Literal, NamedTuple, TypeAlias, overload, type_check_only +from types import TracebackType +from typing import Any, Generic, Literal, NamedTuple, Self, TypeAlias, overload, type_check_only from django.db.backends.utils import _ExecuteQuery from django.db.models import Manager from django.db.models.base import Model from django.db.models.expressions import Combinable, OrderBy +from django.db.models.fetch_modes import FetchMode from django.db.models.sql.query import Query, RawQuery from django.db.models.utils import AltersData from django.utils.functional import cached_property -from typing_extensions import Self, TypeVar, override +from typing_extensions import TypeVar, override _T = TypeVar("_T", covariant=True) _ContainsT = TypeVar("_ContainsT") @@ -31,6 +32,7 @@ _OrderByFieldName: TypeAlias = str | Combinable MAX_GET_RESULTS: int REPR_OUTPUT_SIZE: int +DEFAULT_FETCH_MODE: FetchMode PROHIBITED_FILTER_KWARGS: frozenset[str] class BaseIterable(Generic[_T]): @@ -63,6 +65,17 @@ class FlatValuesListIterable(BaseIterable[_T]): class _SupportsContains(Generic[_ContainsT]): def __contains__(self, item: _ContainsT, /) -> bool: ... +class PreventQuerySetCloning: + queryset: QuerySet[Any] + def __init__(self, queryset: QuerySet[Any]) -> None: ... + def __enter__(self) -> QuerySet[Any]: ... + def __exit__( + self, + exc_type: type[BaseException] | None, + exc_value: BaseException | None, + traceback: TracebackType | None, + ) -> None: ... + # Using `object` (not `_Row | None`) to satisfy Collection protocol and support `User | AnonymousUser` patterns class QuerySet(AltersData, _SupportsContains[object], Iterable[_Row], Sized, Generic[_Model, _Row]): model: type[_Model] @@ -79,11 +92,8 @@ class QuerySet(AltersData, _SupportsContains[object], Iterable[_Row], Sized, Gen @classmethod def as_manager(cls) -> Manager[_Model]: ... def __deepcopy__(self, memo: dict[int, Any]) -> Self: ... - if sys.version_info >= (3, 11): - @override - def __getstate__(self) -> dict[str, Any]: ... - else: - def __getstate__(self) -> dict[str, Any]: ... + @override + def __getstate__(self) -> dict[str, Any]: ... @override def __len__(self) -> int: ... @override @@ -233,10 +243,13 @@ class QuerySet(AltersData, _SupportsContains[object], Iterable[_Row], Sized, Gen @overload def defer(self, *fields: str) -> Self: ... def only(self, *fields: str) -> Self: ... + def fetch_mode(self, fetch_mode: FetchMode) -> Self: ... def using(self, alias: str | None) -> Self: ... @property def ordered(self) -> bool: ... @property + def totally_ordered(self) -> bool: ... + @property def db(self) -> str: ... def _fetch_all(self) -> None: ... def resolve_expression(self, *args: Any, **kwargs: Any) -> Any: ... @@ -257,6 +270,7 @@ class RawQuerySet(_SupportsContains[object], Iterable[_Model], Sized): translations: dict[str, str] | None = None, using: str | None = None, hints: dict[str, Model] | None = None, + fetch_mode: FetchMode = ..., ) -> None: ... def resolve_model_init_order(self) -> tuple[list[str], list[int], list[tuple[str, int]]]: ... @overload @@ -295,11 +309,8 @@ class Prefetch(Generic[_LookupT, _PrefetchedQuerySetT, _ToAttrT]): def __init__( self, lookup: _LookupT, queryset: _PrefetchedQuerySetT | None = None, to_attr: _ToAttrT | None = None ) -> None: ... - if sys.version_info >= (3, 11): - @override - def __getstate__(self) -> dict[str, Any]: ... - else: - def __getstate__(self) -> dict[str, Any]: ... + @override + def __getstate__(self) -> dict[str, Any]: ... def add_prefix(self, prefix: str) -> None: ... def get_current_prefetch_to(self, level: int) -> str: ... def get_current_to_attr(self, level: int) -> tuple[str, str]: ... @@ -333,7 +344,9 @@ class RelatedPopulator: related_populators: list[RelatedPopulator] local_setter: Any remote_setter: Any - def __init__(self, klass_info: dict[str, Any], select: Any, db: str) -> None: ... + def __init__(self, klass_info: dict[str, Any], select: Any, db: str, fetch_mode: FetchMode) -> None: ... def populate(self, row: Sequence[Any], from_obj: Model) -> None: ... -def get_related_populators(klass_info: dict[str, Any], select: Any, db: str) -> list[RelatedPopulator]: ... +def get_related_populators( + klass_info: dict[str, Any], select: Any, db: str, fetch_mode: FetchMode +) -> list[RelatedPopulator]: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/db/models/query_utils.pyi b/python/helpers/bundled_stubs/Django/django-stubs/db/models/query_utils.pyi index a240c641057b..42d82e47a8f9 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/db/models/query_utils.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/db/models/query_utils.pyi @@ -19,6 +19,8 @@ from typing_extensions import TypeVar logger: logging.Logger +PROHIBITED_FILTER_KWARGS: frozenset[str] + class class_or_instance_method: class_method: Callable[..., Any] instance_method: Callable[..., Any] @@ -70,6 +72,8 @@ class DeferredAttribute: field: Field[Any, Any] def __init__(self, field: Field[Any, Any]) -> None: ... def __get__(self, instance: Model | None, cls: type[Model] | None = None) -> Any: ... + def fetch_one(self, instance: Model) -> None: ... + def fetch_many(self, instances: Iterable[Model]) -> None: ... _R = TypeVar("_R", bound=type) diff --git a/python/helpers/bundled_stubs/Django/django-stubs/db/models/sql/compiler.pyi b/python/helpers/bundled_stubs/Django/django-stubs/db/models/sql/compiler.pyi index ba0682a4b8f8..4dacdfff8c44 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/db/models/sql/compiler.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/db/models/sql/compiler.pyi @@ -13,7 +13,7 @@ from django.db.models.expressions import BaseExpression, Expression, Ref from django.db.models.sql.query import Query from django.db.models.sql.subqueries import AggregateQuery, DeleteQuery, InsertQuery, UpdateQuery from django.utils.functional import cached_property -from typing_extensions import override +from typing_extensions import deprecated, override _ParamT: TypeAlias = str | int @@ -54,6 +54,8 @@ class SQLCompiler: def collapse_group_by( self, expressions: list[Expression], having: list[Expression] | tuple[Any, ...] ) -> list[Expression]: ... + @classmethod + def get_select_from_parent(cls, klass_info: dict[str, Any]) -> None: ... def get_select( self, with_col_aliases: bool = False, @@ -65,6 +67,8 @@ class SQLCompiler: order_by: list[tuple[Expression, tuple[str, _ParamsT, bool]]], select: list[tuple[Expression, _AsSqlType, str | None]], ) -> list[tuple[Expression, _AsSqlType, None]]: ... + def quote_name(self, name: str) -> str: ... + @deprecated("SQLCompiler.quote_name_unless_alias() is deprecated. Use .quote_name() instead.") def quote_name_unless_alias(self, name: str) -> str: ... def compile(self, node: BaseExpression) -> _AsSqlType: ... def get_combinator_sql(self, combinator: str, all: bool) -> tuple[list[str], list[int] | list[str]]: ... @@ -144,7 +148,7 @@ class SQLInsertCompiler(SQLCompiler): def field_as_sql( self, field: Field[Any, Any] | None, - get_placeholder: Callable[[Any, SQLInsertCompiler, BaseDatabaseWrapper], str], + get_placeholder_sql: Callable[[Any, SQLInsertCompiler, BaseDatabaseWrapper], _AsSqlType], val: Any, ) -> _AsSqlType: ... def prepare_value(self, field: Any, value: Any) -> Any: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/db/models/sql/query.pyi b/python/helpers/bundled_stubs/Django/django-stubs/db/models/sql/query.pyi index 969916a3ed59..053510ac17c1 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/db/models/sql/query.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/db/models/sql/query.pyi @@ -190,6 +190,8 @@ class Query(BaseExpression): def add_distinct_fields(self, *field_names: str) -> None: ... def add_fields(self, field_names: Iterable[str], allow_m2m: bool = True) -> None: ... def add_ordering(self, *ordering: _OrderByFieldName) -> None: ... + @property + def orderby_issubset_groupby(self) -> bool: ... def clear_where(self) -> None: ... def clear_ordering(self, force: bool = False, clear_default: bool = True) -> None: ... def set_group_by(self, allow_aliases: bool = True) -> None: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/db/models/utils.pyi b/python/helpers/bundled_stubs/Django/django-stubs/db/models/utils.pyi index afa683c08087..8fb819de2a91 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/db/models/utils.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/db/models/utils.pyi @@ -2,7 +2,7 @@ from collections.abc import Iterable, Iterator, Mapping from typing import Any, NamedTuple from django.db.models.base import Model -from typing_extensions import override +from typing_extensions import deprecated, override def make_model_tuple(model: type[Model] | str | tuple[str, str]) -> tuple[str, str]: ... def resolve_callables(mapping: Mapping[str, Any]) -> Iterator[tuple[str, Any]]: ... @@ -12,3 +12,7 @@ def create_namedtuple_class(*names: str) -> type[NamedTuple]: ... class AltersData: @override def __init_subclass__(cls, **kwargs: Any) -> None: ... + +# RemovedInDjango70Warning +@deprecated("Replace with `BLANK_CHOICE_LABEL` if not using `BLANK_CHOICE_DASH`.") +def get_blank_choice_label() -> str: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/db/transaction.pyi b/python/helpers/bundled_stubs/Django/django-stubs/db/transaction.pyi index 7a74580a6e45..7c1e0e379a2c 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/db/transaction.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/db/transaction.pyi @@ -4,7 +4,7 @@ from types import TracebackType from typing import Any, overload from django.db import ProgrammingError -from typing_extensions import TypeVar +from typing_extensions import TypeVar, deprecated class TransactionManagementError(ProgrammingError): ... @@ -13,7 +13,9 @@ def get_autocommit(using: str | None = None) -> bool: ... def set_autocommit(autocommit: bool, using: str | None = None) -> Any: ... def commit(using: str | None = None) -> None: ... def rollback(using: str | None = None) -> None: ... +@deprecated("savepoint() is deprecated. Use savepoint_create() instead.") def savepoint(using: str | None = None) -> str: ... +def savepoint_create(using: str | None = None) -> str: ... def savepoint_rollback(sid: str, using: str | None = None) -> None: ... def savepoint_commit(sid: str, using: str | None = None) -> None: ... def clean_savepoints(using: str | None = None) -> None: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/forms/fields.pyi b/python/helpers/bundled_stubs/Django/django-stubs/forms/fields.pyi index 5a6f45a3c227..585c77465d7f 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/forms/fields.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/forms/fields.pyi @@ -3,7 +3,7 @@ import json 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 +from typing import Any, ClassVar, Protocol, Self, TypeAlias, type_check_only from uuid import UUID from django.core.files import File @@ -15,7 +15,7 @@ from django.forms.widgets import Widget from django.utils.choices import CallableChoiceIterator, _ChoicesCallable, _ChoicesInput from django.utils.datastructures import _PropertyDescriptor from django.utils.functional import _StrOrPromise -from typing_extensions import Self, override +from typing_extensions import override # Problem: attribute `widget` is always of type `Widget` after field instantiation. # However, on class level it can be set to `Type[Widget]` too. @@ -536,6 +536,7 @@ class FilePathField(ChoiceField): disabled: bool = ..., label_suffix: str | None = ..., ) -> None: ... + def set_choices(self) -> None: ... class SplitDateTimeField(MultiValueField): widget: _ClassLevelWidgetT diff --git a/python/helpers/bundled_stubs/Django/django-stubs/forms/models.pyi b/python/helpers/bundled_stubs/Django/django-stubs/forms/models.pyi index a1f77f4cfef4..a4472bc384d7 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/forms/models.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/forms/models.pyi @@ -1,5 +1,5 @@ from collections.abc import Callable, Collection, Container, Iterator, Mapping, MutableMapping, Sequence -from typing import Any, ClassVar, Generic, Literal, TypeAlias, overload +from typing import Any, ClassVar, Generic, Literal, Self, TypeAlias, overload from uuid import UUID from django.db import models @@ -18,7 +18,7 @@ from django.forms.widgets import Widget from django.utils.choices import BaseChoiceIterator, CallableChoiceIterator, _ChoicesCallable, _ChoicesInput from django.utils.datastructures import _PropertyDescriptor from django.utils.functional import _StrOrPromise -from typing_extensions import Self, TypeVar, override +from typing_extensions import TypeVar, override ALL_FIELDS: Literal["__all__"] @@ -281,7 +281,7 @@ class ModelChoiceField(ChoiceField, Generic[_M]): self, queryset: Manager[_M] | QuerySet[_M] | None, *, - empty_label: _StrOrPromise | None = "---------", + empty_label: _StrOrPromise | None = "", required: bool = True, widget: Widget | type[Widget] | None = None, label: _StrOrPromise | None = None, diff --git a/python/helpers/bundled_stubs/Django/django-stubs/forms/widgets.pyi b/python/helpers/bundled_stubs/Django/django-stubs/forms/widgets.pyi index 033635c15ff8..cafe6563c147 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/forms/widgets.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/forms/widgets.pyi @@ -1,7 +1,7 @@ import datetime from collections.abc import Iterable, Iterator, Mapping, Sequence from re import Pattern -from typing import Any, Literal, Protocol, TypeAlias, type_check_only +from typing import Any, Literal, Protocol, Self, TypeAlias, type_check_only from _typeshed import Self as MetaclassSelf # noqa: TID251 from django.core.files.base import File @@ -10,7 +10,7 @@ from django.forms.utils import _DataT, _FilesT from django.utils.choices import _Choices from django.utils.datastructures import _ListOrTuple from django.utils.safestring import SafeString -from typing_extensions import Self, override +from typing_extensions import override _OptAttrs: TypeAlias = dict[str, Any] @@ -25,6 +25,7 @@ class MediaAsset: @override def __hash__(self) -> int: ... def __html__(self) -> SafeString: ... + def render(self, *, attrs: Any | None = None) -> SafeString: ... @property def path(self) -> str: ... @@ -33,6 +34,11 @@ class Script(MediaAsset): def __init__(self, src: str, **attributes: Any) -> None: ... +class Stylesheet(MediaAsset): + element_template: str + + def __init__(self, href: str, **attributes: Any) -> None: ... + class Media: def __init__( self, @@ -40,9 +46,9 @@ class Media: css: dict[str, Sequence[str]] | None = None, js: Sequence[str] | None = None, ) -> None: ... - def render(self) -> SafeString: ... - def render_js(self) -> list[SafeString]: ... - def render_css(self) -> Iterable[SafeString]: ... + def render(self, *, attrs: Any | None = None) -> SafeString: ... + def render_js(self, *, attrs: Any | None = None) -> list[SafeString]: ... + def render_css(self, *, attrs: Any | None = None) -> Iterable[SafeString]: ... def absolute_path(self, path: str) -> str: ... def __getitem__(self, name: str) -> Media: ... @staticmethod @@ -401,6 +407,7 @@ __all__ = ( "SelectMultiple", "SplitDateTimeWidget", "SplitHiddenDateTimeWidget", + "Stylesheet", "TelInput", "TextInput", "Textarea", diff --git a/python/helpers/bundled_stubs/Django/django-stubs/http/request.pyi b/python/helpers/bundled_stubs/Django/django-stubs/http/request.pyi index 79085cfe004d..6ad363b23663 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/http/request.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/http/request.pyi @@ -1,17 +1,18 @@ import datetime from collections.abc import Awaitable, Callable, Iterable, Iterator, Mapping, Sequence from re import Pattern -from typing import Any, BinaryIO, Literal, NoReturn, Protocol, TypeAlias, overload, type_check_only +from typing import Any, BinaryIO, Literal, NoReturn, Protocol, Self, TypeAlias, overload, type_check_only from django.contrib.auth.models import _AnyUser from django.contrib.sessions.backends.base import SessionBase from django.contrib.sites.models import Site from django.core.files import uploadedfile, uploadhandler +from django.http.multipartparser import MultiPartParser from django.urls import ResolverMatch from django.utils.datastructures import CaseInsensitiveMapping, ImmutableList, MultiValueDict from django.utils.functional import cached_property from django.views.debug import ExceptionReporter, SafeExceptionReporterFilter -from typing_extensions import Self, TypeVar, override +from typing_extensions import TypeVar, override RAISE_ERROR: object host_validation_re: Pattern[str] @@ -94,6 +95,10 @@ class HttpRequest: def upload_handlers(self) -> _UploadHandlerList: ... @upload_handlers.setter def upload_handlers(self, upload_handlers: _UploadHandlerList) -> None: ... + @property + def multipart_parser_class(self) -> MultiPartParser: ... + @multipart_parser_class.setter + def multipart_parser_class(self, multipart_parser_class: MultiPartParser) -> None: ... @cached_property def accepted_types(self) -> list[MediaType]: ... @cached_property diff --git a/python/helpers/bundled_stubs/Django/django-stubs/http/response.pyi b/python/helpers/bundled_stubs/Django/django-stubs/http/response.pyi index 97a8d6208c62..3c17415c5a9d 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/http/response.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/http/response.pyi @@ -139,7 +139,12 @@ class FileResponse(StreamingHttpResponse): class HttpResponseRedirectBase(HttpResponse): allowed_schemes: list[str] def __init__( - self, redirect_to: _StrOrPromise, preserve_request: bool = False, *args: Any, **kwargs: Any + self, + redirect_to: _StrOrPromise, + preserve_request: bool = False, + *args: Any, + max_length: int = ..., + **kwargs: Any, ) -> None: ... @property def url(self) -> str: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/middleware/common.pyi b/python/helpers/bundled_stubs/Django/django-stubs/middleware/common.pyi index 39ace2008a1a..f287a1b06b91 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/middleware/common.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/middleware/common.pyi @@ -1,4 +1,4 @@ -from typing import ClassVar +from typing import Any, ClassVar from django.http.request import HttpRequest from django.http.response import HttpResponseBase, HttpResponsePermanentRedirect, HttpResponseRedirectBase @@ -12,6 +12,8 @@ class CommonMiddleware(MiddlewareMixin): def process_response(self, request: HttpRequest, response: HttpResponseBase) -> HttpResponseBase: ... class BrokenLinkEmailsMiddleware(MiddlewareMixin): + using: ClassVar[str | None] def process_response(self, request: HttpRequest, response: HttpResponseBase) -> HttpResponseBase: ... + def send_mail(self, subject: str, message: str, *args: Any, **kwargs: Any) -> None: ... def is_internal_request(self, domain: str, referer: str) -> bool: ... def is_ignorable_request(self, request: HttpRequest, uri: str, domain: str, referer: str) -> bool: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/shortcuts.pyi b/python/helpers/bundled_stubs/Django/django-stubs/shortcuts.pyi index 0bf127c57f1e..44b3d57c7985 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/shortcuts.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/shortcuts.pyi @@ -27,6 +27,7 @@ def redirect( *args: Any, permanent: Literal[True], preserve_request: bool = False, + max_length: int = ..., **kwargs: Any, ) -> HttpResponsePermanentRedirect: ... @overload diff --git a/python/helpers/bundled_stubs/Django/django-stubs/tasks/base.pyi b/python/helpers/bundled_stubs/Django/django-stubs/tasks/base.pyi index bcb76adb55bf..8b7d38709550 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/tasks/base.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/tasks/base.pyi @@ -27,14 +27,14 @@ class TaskResultStatus(TextChoices): _P = ParamSpec("_P") _R = TypeVar("_R") -@dataclass(kw_only=True) +@dataclass(frozen=True, slots=True, kw_only=True) class Task(Generic[_P, _R]): - priority: int # 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 + priority: int = ... + backend: str = ... + queue_name: str = ... + run_after: datetime | None = None takes_context: bool = ... def __post_init__(self) -> None: ... @property diff --git a/python/helpers/bundled_stubs/Django/django-stubs/template/context.pyi b/python/helpers/bundled_stubs/Django/django-stubs/template/context.pyi index 7e8dc88b43d9..79b169c6e1dc 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/template/context.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/template/context.pyi @@ -1,12 +1,12 @@ from collections.abc import Callable, Iterable, Iterator from contextlib import AbstractContextManager from types import TracebackType -from typing import Any, TypeAlias +from typing import Any, Self, TypeAlias from django.http.request import HttpRequest from django.template.base import Node, Origin, Template from django.template.loader_tags import IncludeNode -from typing_extensions import Self, override +from typing_extensions import override _ContextKeys: TypeAlias = int | str | Node diff --git a/python/helpers/bundled_stubs/Django/django-stubs/template/defaulttags.pyi b/python/helpers/bundled_stubs/Django/django-stubs/template/defaulttags.pyi index 37bfb4ec9181..157fa85d19db 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/template/defaulttags.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/template/defaulttags.pyi @@ -2,6 +2,7 @@ from collections.abc import Iterator, Mapping, Sequence from datetime import date as real_date from typing import Any, NamedTuple +from django.forms.widgets import Media from django.http.request import QueryDict from django.template.base import FilterExpression, Parser, PartialTemplate, Token from django.template.context import Context @@ -202,3 +203,4 @@ def url(parser: Parser, token: Token) -> URLNode: ... def verbatim(parser: Parser, token: Token) -> VerbatimNode: ... def widthratio(parser: Parser, token: Token) -> WidthRatioNode: ... def do_with(parser: Parser, token: Token) -> WithNode: ... +def csp_nonce_attr(context: Context, media: Media | None = None) -> SafeString: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/template/library.pyi b/python/helpers/bundled_stubs/Django/django-stubs/template/library.pyi index b95cca73df4a..dadc7fd6afbe 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/template/library.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/template/library.pyi @@ -156,7 +156,6 @@ def parse_bits( defaults: Sized | None, kwonly: Collection[str], kwonly_defaults: Mapping[str, int] | None, - takes_context: bool | None, name: str, ) -> tuple[list[FilterExpression], dict[str, FilterExpression]]: ... def import_library(name: str) -> Library: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/test/selenium.pyi b/python/helpers/bundled_stubs/Django/django-stubs/test/selenium.pyi index a6aea5ff6bb4..c83f9ad19964 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/test/selenium.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/test/selenium.pyi @@ -1,11 +1,11 @@ from collections.abc import Callable, Sequence from contextlib import AbstractContextManager from types import TracebackType -from typing import Any, TypeAlias +from typing import Any, Self, TypeAlias from _typeshed import Self as MetaclassSelf # noqa: TID251 from django.test import LiveServerTestCase -from typing_extensions import Self, TypeVar +from typing_extensions import TypeVar _F = TypeVar("_F", bound=Callable[..., Any]) diff --git a/python/helpers/bundled_stubs/Django/django-stubs/test/signals.pyi b/python/helpers/bundled_stubs/Django/django-stubs/test/signals.pyi index 3742c3df6ef6..ccae5d72d584 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/test/signals.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/test/signals.pyi @@ -21,3 +21,4 @@ def static_finders_changed(*, setting: str, **kwargs: Any) -> None: ... def form_renderer_changed(*, setting: str, **kwargs: Any) -> None: ... def auth_password_validators_changed(*, setting: str, **kwargs: Any) -> None: ... def user_model_swapped(*, setting: str, **kwargs: Any) -> None: ... +def update_logging_config(*, setting: str, **kwargs: Any) -> None: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/test/testcases.pyi b/python/helpers/bundled_stubs/Django/django-stubs/test/testcases.pyi index 4bc37aa0049d..4a7fbf8a006d 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/test/testcases.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/test/testcases.pyi @@ -3,8 +3,9 @@ import unittest from collections.abc import Callable, Iterable, Iterator, Mapping, Sequence from contextlib import AbstractContextManager from types import TracebackType -from typing import Any, Literal, overload +from typing import Any, Literal, Self, overload +from _typeshed import Unused from django.core.exceptions import ImproperlyConfigured from django.core.handlers.wsgi import WSGIHandler from django.core.servers.basehttp import ThreadedWSGIServer, WSGIRequestHandler @@ -21,7 +22,7 @@ from django.test.client import AsyncClient, Client from django.test.html import Element from django.test.utils import CaptureQueriesContext, ContextList from django.utils.functional import _StrOrPromise, classproperty -from typing_extensions import Self, override +from typing_extensions import override def to_list(value: Any) -> list[Any]: ... def assert_and_parse_html(self: Any, html: str, user_msg: str, msg: str) -> Element: ... @@ -55,7 +56,7 @@ class _DatabaseFailure: wrapped: Any message: str def __init__(self, wrapped: Any, message: str) -> None: ... - def __call__(self) -> None: ... + def __call__(self, *args: Unused, **kwargs: Unused) -> None: ... class SimpleTestCase(unittest.TestCase): client_class: type[Client] diff --git a/python/helpers/bundled_stubs/Django/django-stubs/test/utils.pyi b/python/helpers/bundled_stubs/Django/django-stubs/test/utils.pyi index c7dbcf8cbd15..f63b65299c87 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/test/utils.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/test/utils.pyi @@ -5,7 +5,7 @@ from decimal import Decimal from io import StringIO from logging import Logger from types import TracebackType -from typing import Any, Protocol, SupportsIndex, TypeAlias, type_check_only +from typing import Any, Protocol, Self, SupportsIndex, TypeAlias, type_check_only from django.apps.registry import Apps from django.conf import LazySettings, Settings @@ -15,7 +15,7 @@ from django.db.models.lookups import Lookup, Transform from django.db.models.query_utils import RegisterLookupMixin from django.test.runner import DiscoverRunner from django.test.testcases import SimpleTestCase -from typing_extensions import Self, TypeVar, override +from typing_extensions import TypeVar, override _TestClass: TypeAlias = type[SimpleTestCase] _DecoratedTest: TypeAlias = Callable[..., Any] | _TestClass diff --git a/python/helpers/bundled_stubs/Django/django-stubs/utils/archive.pyi b/python/helpers/bundled_stubs/Django/django-stubs/utils/archive.pyi index a3732c215c19..bf80d13fdf4a 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/utils/archive.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/utils/archive.pyi @@ -1,8 +1,8 @@ from collections.abc import Iterable, Sequence from types import TracebackType -from typing import Any +from typing import Any, Self -from typing_extensions import Self, override +from typing_extensions import override class ArchiveException(Exception): ... class UnrecognizedArchiveFormat(ArchiveException): ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/utils/cache.pyi b/python/helpers/bundled_stubs/Django/django-stubs/utils/cache.pyi index a629602757e6..74ccf081ad6f 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/utils/cache.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/utils/cache.pyi @@ -1,13 +1,10 @@ from collections.abc import Iterable -from re import Pattern from typing import Any from django.core.cache.backends.base import BaseCache from django.http.request import HttpRequest from django.http.response import HttpResponse, HttpResponseBase -cc_delim_re: Pattern[str] - def patch_cache_control(response: HttpResponseBase, **kwargs: Any) -> None: ... def get_max_age(response: HttpResponseBase) -> int | None: ... def set_response_etag(response: HttpResponseBase) -> HttpResponseBase: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/utils/crypto.pyi b/python/helpers/bundled_stubs/Django/django-stubs/utils/crypto.pyi index 66a2d4c9feb9..dbf437264391 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/utils/crypto.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/utils/crypto.pyi @@ -1,13 +1,24 @@ from collections.abc import Callable from hmac import HMAC -from typing import Any +from typing import Any, overload + +from typing_extensions import deprecated RANDOM_STRING_CHARS: str class InvalidAlgorithm(ValueError): ... +@overload +@deprecated( + "The default argument for algorithm in salted_hmac() will change from 'sha1' to 'sha256' in " + "Django 7.0. Pass an explicit algorithm to silence this warning.", +) def salted_hmac( - key_salt: bytes | str, value: bytes | str, secret: bytes | str | None = None, *, algorithm: str = "sha1" + key_salt: bytes | str, value: bytes | str, secret: bytes | str | None = None, *, algorithm: None = None +) -> HMAC: ... +@overload +def salted_hmac( + key_salt: bytes | str, value: bytes | str, secret: bytes | str | None = None, *, algorithm: str = ... ) -> HMAC: ... def get_random_string(length: int, allowed_chars: str = ...) -> str: ... def constant_time_compare(val1: bytes | str, val2: bytes | str) -> bool: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/utils/csp.pyi b/python/helpers/bundled_stubs/Django/django-stubs/utils/csp.pyi index 56ee27a23c01..a680cb071b33 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/utils/csp.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/utils/csp.pyi @@ -1,16 +1,13 @@ -import sys from collections.abc import Collection, Mapping +from enum import StrEnum as _StrEnum +from django.forms import Media +from django.template import Context from django.utils.functional import SimpleLazyObject +from django.utils.safestring import SafeString from typing_extensions import override -if sys.version_info >= (3, 11): - from enum import StrEnum as _StrEnum -else: - from enum import Enum - - class _ReprEnum(Enum): ... # type: ignore[misc] - class _StrEnum(str, _ReprEnum): ... # type: ignore[misc] +CONTEXT_KEY: str class CSP(_StrEnum): HEADER_ENFORCE = "Content-Security-Policy" @@ -32,6 +29,7 @@ class LazyNonce(SimpleLazyObject[str]): @override def __bool__(self) -> bool: ... +def nonce_attr(context: Context, media: Media | None = None) -> SafeString: ... def generate_nonce() -> str: ... def build_policy( config: Mapping[str, Collection[str] | str], nonce: SimpleLazyObject[str] | str | None = None diff --git a/python/helpers/bundled_stubs/Django/django-stubs/utils/datastructures.pyi b/python/helpers/bundled_stubs/Django/django-stubs/utils/datastructures.pyi index ca4ae842ec81..5d0503a09c01 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/utils/datastructures.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/utils/datastructures.pyi @@ -1,8 +1,8 @@ from collections.abc import Collection, Iterable, Iterator, Mapping, MutableMapping, MutableSet -from typing import Any, Generic, NoReturn, Protocol, TypeAlias, overload, type_check_only +from typing import Any, Generic, NoReturn, Protocol, Self, TypeAlias, overload, type_check_only from _typeshed import Incomplete -from typing_extensions import Self, TypeVar, override +from typing_extensions import TypeVar, override _K = TypeVar("_K") _V = TypeVar("_V") diff --git a/python/helpers/bundled_stubs/Django/django-stubs/utils/deconstruct.pyi b/python/helpers/bundled_stubs/Django/django-stubs/utils/deconstruct.pyi index 3d9762da7e01..46a8607710b4 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/utils/deconstruct.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/utils/deconstruct.pyi @@ -1,7 +1,7 @@ from collections.abc import Callable, Sequence -from typing import Any, overload, type_check_only +from typing import Any, Self, overload, type_check_only -from typing_extensions import Self, TypeVar +from typing_extensions import TypeVar # Contains additions from a class being decorated with '@deconstructible' @type_check_only diff --git a/python/helpers/bundled_stubs/Django/django-stubs/utils/deprecation.pyi b/python/helpers/bundled_stubs/Django/django-stubs/utils/deprecation.pyi index f3ae232a5ac8..3fe155aadc0d 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/utils/deprecation.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/utils/deprecation.pyi @@ -1,4 +1,5 @@ from collections.abc import Awaitable, Callable, Sequence +from types import FunctionType, MethodType from typing import Any, ClassVar, Protocol, TypeAlias, type_check_only from _typeshed import Self as MetaclassSelf # noqa: TID251 @@ -10,12 +11,25 @@ _C = TypeVar("_C", bound=Callable[..., Any]) def django_file_prefixes() -> tuple[str, ...]: ... -class RemovedInDjango61Warning(DeprecationWarning): ... +class RemovedInNextVersionWarning(DeprecationWarning): ... class RemovedInDjango70Warning(PendingDeprecationWarning): ... -RemovedInNextVersionWarning: TypeAlias = RemovedInDjango61Warning RemovedAfterNextVersionWarning: TypeAlias = RemovedInDjango70Warning +def warn_about_external_use( + message: str, + category: type[Warning] | None, + *, + skip_name_prefixes: str | tuple[str, ...] | None = None, + skip_frames: int = 0, + internal_modules: tuple[str, ...] | None = None, +) -> None: ... +def warn_about_implementation( + message: str, + category: type[Warning] | None, + target: FunctionType | MethodType | classmethod[Any, Any, Any] | property | staticmethod[Any, Any] | type, +) -> None: ... + class warn_about_renamed_method: class_name: str old_method_name: str diff --git a/python/helpers/bundled_stubs/Django/django-stubs/utils/functional.pyi b/python/helpers/bundled_stubs/Django/django-stubs/utils/functional.pyi index af71dcde4c9e..e5721b6c0ac9 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/utils/functional.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/utils/functional.pyi @@ -2,10 +2,10 @@ from collections.abc import Callable, Iterable, Iterator # Mypy has special handling for functools.cached_property, reuse typeshed's definition instead of defining our own from functools import cached_property as cached_property -from typing import Any, Generic, Protocol, SupportsIndex, TypeAlias, overload, type_check_only +from typing import Any, Generic, Protocol, Self, SupportsIndex, TypeAlias, overload, type_check_only from django.db.models.base import Model -from typing_extensions import Self, TypeVar, override +from typing_extensions import TypeVar, override _T = TypeVar("_T") diff --git a/python/helpers/bundled_stubs/Django/django-stubs/utils/http.pyi b/python/helpers/bundled_stubs/Django/django-stubs/utils/http.pyi index 2625fe91cb10..2dd71afc8dc0 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/utils/http.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/utils/http.pyi @@ -1,4 +1,4 @@ -from collections.abc import Iterable, Mapping +from collections.abc import Iterable, Iterator, Mapping from re import Pattern from typing import Literal, overload @@ -28,6 +28,8 @@ def base36_to_int(s: str) -> int: ... def int_to_base36(i: int) -> str: ... def urlsafe_base64_encode(s: bytes) -> str: ... def urlsafe_base64_decode(s: str) -> bytes: ... +def split_header_value(value: str, sep: str = ",") -> Iterator[str]: ... +def split_directive_names(value: str) -> Iterator[str]: ... def parse_etags(etag_str: str) -> list[str]: ... def quote_etag(etag_str: str) -> str: ... def is_same_domain(host: str, pattern: str) -> bool: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/utils/inspect.pyi b/python/helpers/bundled_stubs/Django/django-stubs/utils/inspect.pyi index 28c15779111a..fb92a658e5d7 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/utils/inspect.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/utils/inspect.pyi @@ -3,7 +3,7 @@ import sys import threading from collections.abc import Callable from contextlib import AbstractContextManager -from inspect import Signature, _ParameterKind +from inspect import FullArgSpec, Signature, _ParameterKind from types import FunctionType from typing import Any, TypeGuard @@ -21,4 +21,5 @@ def method_has_no_args(meth: Callable[..., Any]) -> bool: ... def func_supports_parameter(func: Callable[..., Any], name: str) -> bool: ... def is_module_level_function(func: Callable[..., Any]) -> TypeGuard[FunctionType]: ... def lazy_annotations() -> AbstractContextManager[None]: ... +def getfullargspec(*args: Any, annotation_format: Any | None = None, **kwargs: Any) -> FullArgSpec: ... def signature(obj: Any) -> Signature: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/utils/log.pyi b/python/helpers/bundled_stubs/Django/django-stubs/utils/log.pyi index fb027b70ac99..a6fd74e9dcb4 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/utils/log.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/utils/log.pyi @@ -1,12 +1,12 @@ import logging.config from collections.abc import Callable from logging import Logger, LogRecord -from typing import Any +from typing import Any, overload from django.core.management.color import Style from django.http import HttpRequest, HttpResponse from django.utils.functional import _StrOrPromise -from typing_extensions import override +from typing_extensions import deprecated, override request_logger: Logger DEFAULT_LOGGING: Any @@ -17,6 +17,15 @@ class AdminEmailHandler(logging.Handler): include_html: bool email_backend: str | None reporter_class: type[Any] + @overload + def __init__( + self, + include_html: bool = False, + reporter_class: str | None = None, + using: str | None = None, + ) -> None: ... + @overload + @deprecated("The 'email_backend' argument is deprecated. Use 'using' instead.") def __init__( self, include_html: bool = False, @@ -24,7 +33,6 @@ class AdminEmailHandler(logging.Handler): reporter_class: str | None = None, ) -> None: ... def send_mail(self, subject: _StrOrPromise, message: _StrOrPromise, *args: Any, **kwargs: Any) -> None: ... - def connection(self) -> Any: ... def format_subject(self, subject: str) -> str: ... class CallbackFilter(logging.Filter): diff --git a/python/helpers/bundled_stubs/Django/django-stubs/utils/safestring.pyi b/python/helpers/bundled_stubs/Django/django-stubs/utils/safestring.pyi index a1c279f2de16..850b384b5277 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/utils/safestring.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/utils/safestring.pyi @@ -1,8 +1,8 @@ from collections.abc import Callable -from typing import Any, TypeAlias, overload +from typing import Any, Self, TypeAlias, overload from django.utils.functional import _StrOrPromise -from typing_extensions import Self, TypeVar, override +from typing_extensions import TypeVar, override _SD = TypeVar("_SD", bound=SafeData) diff --git a/python/helpers/bundled_stubs/Django/django-stubs/utils/translation/trans_real.pyi b/python/helpers/bundled_stubs/Django/django-stubs/utils/translation/trans_real.pyi index e8841a6aa01a..a02ac847ac5e 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/utils/translation/trans_real.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/utils/translation/trans_real.pyi @@ -64,6 +64,7 @@ def ngettext(singular: str, plural: str, number: float) -> str: ... def npgettext(context: str, singular: str, plural: str, number: int) -> str: ... def all_locale_paths() -> list[str]: ... def check_for_language(lang_code: str | None) -> bool: ... +def translation_catalog_exists(lang_code: str) -> bool: ... def get_languages() -> dict[str, str]: ... def get_supported_language_variant(lang_code: str | None, strict: bool = False) -> str: ... def get_language_from_path(path: str, strict: bool = False) -> str | None: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/utils/tree.pyi b/python/helpers/bundled_stubs/Django/django-stubs/utils/tree.pyi index b1f0ea89d8bd..6ec6571cdbae 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/utils/tree.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/utils/tree.pyi @@ -1,8 +1,8 @@ from collections.abc import Sequence -from typing import Any, TypeAlias +from typing import Any, Self, TypeAlias from django.db.models.sql.where import NothingNode -from typing_extensions import Self, override +from typing_extensions import override _NodeChildren: TypeAlias = list[Node | NothingNode | Sequence[Any]] diff --git a/python/helpers/bundled_stubs/Django/django-stubs/utils/version.pyi b/python/helpers/bundled_stubs/Django/django-stubs/utils/version.pyi index 66fa0afceaa3..a5de527ee261 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/utils/version.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/utils/version.pyi @@ -2,13 +2,12 @@ from typing import TypeAlias PYPY: bool -PY38: bool -PY39: bool PY310: bool PY311: bool PY312: bool PY313: bool PY314: bool +PY315: bool _VT: TypeAlias = tuple[int, int, int, str, int] diff --git a/python/helpers/bundled_stubs/Django/django-stubs/utils/xmlutils.pyi b/python/helpers/bundled_stubs/Django/django-stubs/utils/xmlutils.pyi index 7eaee688dcbf..890a29a638e7 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/utils/xmlutils.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/utils/xmlutils.pyi @@ -3,7 +3,8 @@ from xml.sax.xmlreader import AttributesImpl from typing_extensions import override -class UnserializableContentError(ValueError): ... +class UnserializableContentError(ValueError): + def __init__(self, msg: str = "Control characters are not supported in XML 1.0"): ... class SimplerXMLGenerator(XMLGenerator): def addQuickElement(self, name: str, contents: str | None = None, attrs: dict[str, str] | None = None) -> None: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/views/generic/base.pyi b/python/helpers/bundled_stubs/Django/django-stubs/views/generic/base.pyi index e97881c0972b..bb0c6f0f7f9d 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/views/generic/base.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/views/generic/base.pyi @@ -48,6 +48,7 @@ class RedirectView(View): url: str | None pattern_name: str | None query_string: bool + preserve_request: bool def get_redirect_url(self, *args: Any, **kwargs: Any) -> str | None: ... def get(self, request: HttpRequest, *args: Any, **kwargs: Any) -> HttpResponseBase: ... def head(self, request: HttpRequest, *args: Any, **kwargs: Any) -> HttpResponseBase: ...