From d10805b6fd4c971743ec705aeacb922d424a2822 Mon Sep 17 00:00:00 2001 From: PyCharm Automation Bot Date: Mon, 10 Aug 2026 11:05:26 +0000 Subject: [PATCH] PY-91520 Update django stubs version to 6.0.9 Closes PY-91520 (cherry picked from commit 91065ac60b5b87595f0d978bcbe3b7dad7a54afb) IJ-MR-217716 GitOrigin-RevId: daa9b7472ef9951572459c536e5349e41b50e4fc --- .../Django/django-stubs/apps/registry.pyi | 7 +- .../django-stubs/contrib/admin/actions.pyi | 6 +- .../django-stubs/contrib/admin/checks.pyi | 19 ++--- .../django-stubs/contrib/admin/filters.pyi | 18 ++-- .../django-stubs/contrib/admin/helpers.pyi | 48 +++++------ .../django-stubs/contrib/admin/models.pyi | 18 ++-- .../django-stubs/contrib/admin/options.pyi | 40 +++++---- .../django-stubs/contrib/admin/sites.pyi | 5 +- .../contrib/admin/templatetags/admin_list.pyi | 8 +- .../contrib/admin/templatetags/admin_urls.pyi | 4 +- .../contrib/admin/templatetags/base.pyi | 4 +- .../django-stubs/contrib/admin/utils.pyi | 22 ++--- .../contrib/admin/views/autocomplete.pyi | 10 ++- .../contrib/admin/views/decorators.pyi | 6 +- .../django-stubs/contrib/admin/views/main.pyi | 30 +++---- .../django-stubs/contrib/admin/widgets.pyi | 14 ++-- .../django-stubs/contrib/admindocs/utils.pyi | 8 +- .../django-stubs/contrib/admindocs/views.pyi | 5 +- .../django-stubs/contrib/auth/__init__.pyi | 2 +- .../django-stubs/contrib/auth/admin.pyi | 4 +- .../django-stubs/contrib/auth/base_user.pyi | 5 +- .../django-stubs/contrib/auth/checks.pyi | 7 +- .../django-stubs/contrib/auth/forms.pyi | 8 +- .../django-stubs/contrib/auth/hashers.pyi | 2 +- .../django-stubs/contrib/auth/middleware.pyi | 6 +- .../django-stubs/contrib/auth/mixins.pyi | 2 +- .../django-stubs/contrib/auth/models.pyi | 26 +++--- .../django-stubs/contrib/auth/views.pyi | 6 +- .../contrib/contenttypes/admin.pyi | 4 +- .../contrib/contenttypes/checks.pyi | 5 +- .../contrib/contenttypes/fields.pyi | 8 +- .../contrib/contenttypes/forms.pyi | 4 +- .../contrib/contenttypes/models.pyi | 7 +- .../contrib/contenttypes/prefetch.pyi | 2 +- .../django-stubs/contrib/flatpages/models.pyi | 15 ++-- .../contrib/flatpages/sitemaps.pyi | 3 +- .../gis/db/backends/postgis/operations.pyi | 2 +- .../contrib/gis/db/models/fields.pyi | 6 +- .../contrib/gis/db/models/functions.pyi | 84 +++++++++++-------- .../contrib/gis/db/models/lookups.pyi | 9 +- .../contrib/gis/db/models/sql/conversion.pyi | 11 ++- .../Django/django-stubs/contrib/gis/feeds.pyi | 2 +- .../contrib/gis/gdal/raster/source.pyi | 2 +- .../django-stubs/contrib/gis/sitemaps/kml.pyi | 2 +- .../contrib/postgres/aggregates/general.pyi | 10 +-- .../postgres/aggregates/statistics.pyi | 4 +- .../contrib/postgres/expressions.pyi | 2 +- .../contrib/postgres/fields/array.pyi | 8 +- .../contrib/postgres/fields/citext.pyi | 12 ++- .../contrib/postgres/fields/hstore.pyi | 6 +- .../contrib/postgres/fields/ranges.pyi | 26 +++--- .../contrib/postgres/functions.pyi | 6 +- .../django-stubs/contrib/postgres/search.pyi | 23 +++-- .../django-stubs/contrib/redirects/admin.pyi | 3 +- .../django-stubs/contrib/redirects/models.pyi | 8 +- .../contrib/sessions/base_session.pyi | 11 +-- .../contrib/sitemaps/__init__.pyi | 2 +- .../django-stubs/contrib/sitemaps/views.pyi | 7 +- .../django-stubs/contrib/sites/admin.pyi | 3 +- .../django-stubs/contrib/sites/checks.pyi | 5 +- .../django-stubs/contrib/sites/models.pyi | 5 +- .../contrib/staticfiles/checks.pyi | 5 +- .../contrib/staticfiles/storage.pyi | 12 +-- .../django-stubs/core/cache/backends/base.pyi | 4 +- .../core/cache/backends/redis.pyi | 2 +- .../django-stubs/core/checks/async_checks.pyi | 5 +- .../django-stubs/core/checks/caches.pyi | 15 ++-- .../django-stubs/core/checks/commands.pyi | 6 +- .../core/checks/compatibility/django_4_0.pyi | 5 +- .../django-stubs/core/checks/database.pyi | 3 +- .../Django/django-stubs/core/checks/files.pyi | 7 +- .../django-stubs/core/checks/model_checks.pyi | 5 +- .../django-stubs/core/checks/registry.pyi | 6 +- .../core/checks/security/base.pyi | 37 ++++---- .../core/checks/security/csrf.pyi | 9 +- .../core/checks/security/sessions.pyi | 7 +- .../django-stubs/core/checks/templates.pyi | 3 +- .../django-stubs/core/checks/translation.pyi | 14 ++-- .../Django/django-stubs/core/checks/urls.pyi | 12 +-- .../Django/django-stubs/core/files/images.pyi | 6 +- .../django-stubs/core/files/storage/base.pyi | 6 +- .../core/files/storage/filesystem.pyi | 8 +- .../core/files/storage/memory.pyi | 8 +- .../django-stubs/core/files/uploadedfile.pyi | 17 ++-- .../django-stubs/core/files/uploadhandler.pyi | 10 +-- .../Django/django-stubs/core/files/utils.pyi | 4 +- .../django-stubs/core/handlers/asgi.pyi | 5 +- .../django-stubs/core/handlers/exception.pyi | 4 +- .../django-stubs/core/handlers/wsgi.pyi | 2 +- .../django-stubs/core/management/base.pyi | 4 +- .../management/commands/compilemessages.pyi | 6 +- .../Django/django-stubs/core/paginator.pyi | 2 +- .../core/serializers/__init__.pyi | 2 +- .../django-stubs/core/serializers/base.pyi | 4 +- .../Django/django-stubs/core/validators.pyi | 4 +- .../db/backends/base/introspection.pyi | 2 +- .../django-stubs/db/backends/mysql/base.pyi | 3 +- .../django-stubs/db/backends/sqlite3/base.pyi | 3 +- .../db/backends/sqlite3/creation.pyi | 5 +- .../db/backends/sqlite3/introspection.pyi | 3 +- .../db/backends/sqlite3/operations.pyi | 5 +- .../Django/django-stubs/db/backends/utils.pyi | 10 +-- .../db/migrations/autodetector.pyi | 2 +- .../django-stubs/db/migrations/graph.pyi | 2 +- .../db/migrations/operations/models.pyi | 8 +- .../django-stubs/db/migrations/recorder.pyi | 2 +- .../django-stubs/db/migrations/serializer.pyi | 2 +- .../django-stubs/db/migrations/state.pyi | 10 ++- .../django-stubs/db/models/aggregates.pyi | 2 +- .../Django/django-stubs/db/models/base.pyi | 17 ++-- .../django-stubs/db/models/deletion.pyi | 2 +- .../Django/django-stubs/db/models/enums.pyi | 11 +-- .../django-stubs/db/models/expressions.pyi | 12 +-- .../db/models/fields/__init__.pyi | 10 +-- .../db/models/fields/composite.pyi | 2 +- .../django-stubs/db/models/fields/files.pyi | 14 ++-- .../db/models/fields/generated.pyi | 12 +-- .../django-stubs/db/models/fields/json.pyi | 2 +- .../django-stubs/db/models/fields/proxy.pyi | 2 +- .../django-stubs/db/models/fields/related.pyi | 36 ++++---- .../db/models/fields/related_descriptors.pyi | 6 +- .../db/models/fields/reverse_related.pyi | 14 ++-- .../db/models/functions/datetime.pyi | 8 +- .../django-stubs/db/models/functions/json.pyi | 4 +- .../django-stubs/db/models/functions/text.pyi | 14 ++-- .../db/models/functions/window.pyi | 12 +-- .../Django/django-stubs/db/models/lookups.pyi | 6 +- .../Django/django-stubs/db/models/manager.pyi | 6 +- .../Django/django-stubs/db/models/options.pyi | 18 ++-- .../Django/django-stubs/db/models/query.pyi | 16 ++-- .../django-stubs/db/models/query_utils.pyi | 4 +- .../Django/django-stubs/db/models/signals.pyi | 5 +- .../django-stubs/db/models/sql/compiler.pyi | 16 ++-- .../db/models/sql/datastructures.pyi | 2 +- .../django-stubs/db/models/sql/query.pyi | 18 ++-- .../django-stubs/db/models/sql/where.pyi | 2 +- .../Django/django-stubs/db/transaction.pyi | 2 +- .../django-stubs/dispatch/dispatcher.pyi | 15 ++-- .../Django/django-stubs/forms/fields.pyi | 28 ++++--- .../Django/django-stubs/forms/models.pyi | 30 +++---- .../Django/django-stubs/forms/utils.pyi | 2 +- .../Django/django-stubs/forms/widgets.pyi | 13 +-- .../django-stubs/http/multipartparser.pyi | 2 +- .../Django/django-stubs/http/request.pyi | 25 +++--- .../Django/django-stubs/middleware/cache.pyi | 4 +- .../Django/django-stubs/middleware/gzip.pyi | 5 +- .../Django/django-stubs/shortcuts.pyi | 2 +- .../django-stubs/tasks/backends/base.pyi | 18 ++-- .../django-stubs/tasks/backends/dummy.pyi | 13 +-- .../django-stubs/tasks/backends/immediate.pyi | 7 +- .../Django/django-stubs/tasks/signals.pyi | 6 +- .../Django/django-stubs/template/context.pyi | 4 +- .../template/context_processors.pyi | 7 +- .../Django/django-stubs/template/response.pyi | 13 +-- .../Django/django-stubs/test/client.pyi | 68 +++++++-------- .../Django/django-stubs/test/selenium.pyi | 5 +- .../Django/django-stubs/test/testcases.pyi | 4 +- .../Django/django-stubs/test/utils.pyi | 2 +- .../Django/django-stubs/urls/resolvers.pyi | 6 +- .../Django/django-stubs/utils/_os.pyi | 12 +-- .../Django/django-stubs/utils/autoreload.pyi | 12 ++- .../Django/django-stubs/utils/cache.pyi | 3 +- .../Django/django-stubs/utils/choices.pyi | 3 +- .../Django/django-stubs/utils/csp.pyi | 6 +- .../Django/django-stubs/utils/deprecation.pyi | 17 ++-- .../Django/django-stubs/utils/html.pyi | 10 +-- .../django-stubs/utils/regex_helper.pyi | 7 +- .../Django/django-stubs/utils/text.pyi | 2 +- .../utils/translation/__init__.pyi | 2 +- .../Django/django-stubs/views/debug.pyi | 2 +- .../django-stubs/views/generic/base.pyi | 22 +++-- .../django-stubs/views/generic/dates.pyi | 20 ++--- .../django-stubs/views/generic/edit.pyi | 2 +- .../django-stubs/views/generic/list.pyi | 6 +- .../Django/django-stubs/views/i18n.pyi | 2 +- 175 files changed, 875 insertions(+), 760 deletions(-) diff --git a/python/helpers/bundled_stubs/Django/django-stubs/apps/registry.pyi b/python/helpers/bundled_stubs/Django/django-stubs/apps/registry.pyi index 7da72a7cf04c..a92dbd4ec668 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/apps/registry.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/apps/registry.pyi @@ -1,4 +1,5 @@ import threading +from collections import defaultdict from collections.abc import Callable, Iterable from typing import Any @@ -13,7 +14,9 @@ class Apps: apps_ready: bool ready_event: threading.Event loading: bool - _pending_operations: dict[tuple[str, str], list] + # Maps ("app_label", "modelname") tuples to lists of functions to be called when the corresponding model is ready. + _pending_operations: defaultdict[tuple[str, str], list[Callable[[type[Model]], Any]]] + _apps: dict[str, type[Any]] models_ready: bool ready: bool def __init__(self, installed_apps: Iterable[AppConfig | str] | None = ()) -> None: ... @@ -35,7 +38,7 @@ class Apps: def set_installed_apps(self, installed: Iterable[str]) -> None: ... def unset_installed_apps(self) -> None: ... def clear_cache(self) -> None: ... - def lazy_model_operation(self, function: Callable, *model_keys: Any) -> None: ... + def lazy_model_operation(self, function: Callable[..., Any], *model_keys: Any) -> None: ... def do_pending_operations(self, model: type[Model]) -> None: ... apps: Apps diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/admin/actions.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/admin/actions.pyi index 767fc7100d58..a13ca5df97fc 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/contrib/admin/actions.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/admin/actions.pyi @@ -1,6 +1,10 @@ +from typing import Any + from django.contrib.admin.options import ModelAdmin from django.db.models.query import QuerySet from django.http.request import HttpRequest from django.template.response import TemplateResponse -def delete_selected(modeladmin: ModelAdmin, request: HttpRequest, queryset: QuerySet) -> TemplateResponse | None: ... +def delete_selected( + modeladmin: ModelAdmin[Any], request: HttpRequest, queryset: QuerySet[Any] +) -> TemplateResponse | None: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/admin/checks.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/admin/checks.pyi index de67a382dd64..09141910cc12 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/contrib/admin/checks.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/admin/checks.pyi @@ -6,20 +6,19 @@ from django.contrib.admin.options import BaseModelAdmin from django.core.checks.messages import CheckMessage from typing_extensions import override -def check_admin_app(app_configs: Sequence[AppConfig] | None, **kwargs: Any) -> list[CheckMessage]: ... -def check_dependencies(**kwargs: Any) -> list[CheckMessage]: ... +def check_admin_app(app_configs: Sequence[AppConfig] | None, **kwargs: object) -> list[CheckMessage]: ... +def check_dependencies(**kwargs: object) -> list[CheckMessage]: ... class BaseModelAdminChecks: - def check(self, admin_obj: BaseModelAdmin, **kwargs: Any) -> list[CheckMessage]: ... + def check(self, admin_obj: BaseModelAdmin[Any], **kwargs: object) -> list[CheckMessage]: ... -class ModelAdminChecks(BaseModelAdminChecks): - @override - def check(self, admin_obj: BaseModelAdmin, **kwargs: Any) -> list[CheckMessage]: ... +class ModelAdminChecks(BaseModelAdminChecks): ... class InlineModelAdminChecks(BaseModelAdminChecks): + # We need this override because `InlineModelAdminChecks` rename `admin_obj` to `inline_obj` here @override - def check(self, inline_obj: BaseModelAdmin, **kwargs: Any) -> list[CheckMessage]: ... # type: ignore[override] + def check(self, inline_obj: BaseModelAdmin[Any], **kwargs: object) -> list[CheckMessage]: ... # type: ignore[override] -def must_be(type: Any, option: Any, obj: Any, id: Any) -> list[CheckMessage]: ... -def must_inherit_from(parent: Any, option: Any, obj: Any, id: Any) -> list[CheckMessage]: ... -def refer_to_missing_field(field: Any, option: Any, obj: Any, id: Any) -> list[CheckMessage]: ... +def must_be(type: str, option: str, obj: BaseModelAdmin[Any], id: str) -> list[CheckMessage]: ... +def must_inherit_from(parent: str, option: str, obj: BaseModelAdmin[Any], id: str) -> list[CheckMessage]: ... +def refer_to_missing_field(field: str, option: str, obj: BaseModelAdmin[Any], id: str) -> list[CheckMessage]: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/admin/filters.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/admin/filters.pyi index 8b02c726f8e8..6c2d01891311 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/contrib/admin/filters.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/admin/filters.pyi @@ -27,11 +27,11 @@ class ListFilter: request: HttpRequest used_parameters: dict[str, object] def __init__( - self, request: HttpRequest, params: dict[str, list[str]], model: type[Model], model_admin: ModelAdmin + self, request: HttpRequest, params: dict[str, list[str]], model: type[Model], model_admin: ModelAdmin[Any] ) -> None: ... def has_output(self) -> bool: ... def choices(self, changelist: ChangeList) -> Iterator[Mapping[str, object]]: ... - def queryset(self, request: HttpRequest, queryset: QuerySet) -> QuerySet | None: ... + def queryset(self, request: HttpRequest, queryset: QuerySet[Any]) -> QuerySet[Any] | None: ... def expected_parameters(self) -> list[str | None]: ... class FacetsMixin: @@ -45,7 +45,9 @@ class SimpleListFilter(FacetsMixin, ListFilter): parameter_name: str | None lookup_choices: list[tuple[str, _StrOrPromise]] def value(self) -> str | None: ... - def lookups(self, request: HttpRequest, model_admin: ModelAdmin) -> Iterable[tuple[str, _StrOrPromise]] | None: ... + def lookups( + self, request: HttpRequest, model_admin: ModelAdmin[Any] + ) -> Iterable[tuple[str, _StrOrPromise]] | None: ... @override def choices(self, changelist: ChangeList) -> Iterator[_ListFilterChoices]: ... @@ -59,7 +61,7 @@ class FieldListFilter(FacetsMixin, ListFilter): request: HttpRequest, params: dict[str, list[str]], model: type[Model], - model_admin: ModelAdmin, + model_admin: ModelAdmin[Any], field_path: str, ) -> None: ... @classmethod @@ -73,7 +75,7 @@ class FieldListFilter(FacetsMixin, ListFilter): request: HttpRequest, params: dict[str, list[str]], model: type[Model], - model_admin: ModelAdmin, + model_admin: ModelAdmin[Any], field_path: str, ) -> FieldListFilter: ... @override @@ -90,10 +92,10 @@ class RelatedFieldListFilter(FieldListFilter): @property def include_empty_choice(self) -> bool: ... def field_admin_ordering( - self, field: RelatedField, request: HttpRequest, model_admin: ModelAdmin + self, field: RelatedField[Any, Any], request: HttpRequest, model_admin: ModelAdmin[Any] ) -> _ListOrTuple[str]: ... def field_choices( - self, field: RelatedField, request: HttpRequest, model_admin: ModelAdmin + self, field: RelatedField[Any, Any], request: HttpRequest, model_admin: ModelAdmin[Any] ) -> list[tuple[str, _StrOrPromise]]: ... class BooleanFieldListFilter(FieldListFilter): @@ -122,7 +124,7 @@ class AllValuesFieldListFilter(FieldListFilter): lookup_val: str | None lookup_val_isnull: str | None empty_value_display: SafeString - lookup_choices: QuerySet + lookup_choices: QuerySet[Any] class RelatedOnlyFieldListFilter(RelatedFieldListFilter): ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/admin/helpers.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/admin/helpers.pyi index faa4aa24ba48..f317b4cf99a2 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/contrib/admin/helpers.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/admin/helpers.pyi @@ -2,7 +2,7 @@ from collections.abc import Callable, Iterable, Iterator, Mapping, Sequence from typing import Any, type_check_only from django import forms -from django.contrib.admin.options import ModelAdmin +from django.contrib.admin.options import BaseModelAdmin, ModelAdmin from django.db.models import Model from django.db.models.fields import AutoField from django.db.models.fields.reverse_related import ForeignObjectRel @@ -29,17 +29,17 @@ class _PrepopulatedDict(TypedDict): class AdminForm: prepopulated_fields: list[_PrepopulatedDict] - model_admin: ModelAdmin | None + model_admin: BaseModelAdmin[Any] | None readonly_fields: Sequence[str] - form: ModelForm + form: ModelForm[Any] fieldsets: list[tuple[Any, dict[str, list[str]]]] def __init__( self, - form: ModelForm, + form: ModelForm[Any], fieldsets: list[tuple[Any, dict[str, list[str]]]], prepopulated_fields: Mapping[str, Iterable[str]], readonly_fields: Sequence[str] | None = ..., - model_admin: ModelAdmin | None = ..., + model_admin: BaseModelAdmin[Any] | None = ..., ) -> None: ... def __iter__(self) -> Iterator[Fieldset]: ... @property @@ -54,20 +54,20 @@ class AdminForm: def media(self) -> Media: ... class Fieldset: - form: ModelForm + form: ModelForm[Any] classes: str description: str | None - model_admin: ModelAdmin | None + model_admin: BaseModelAdmin[Any] | None readonly_fields: Sequence[str] def __init__( self, - form: ModelForm, + form: ModelForm[Any], name: Any | None = ..., readonly_fields: Sequence[str] = ..., fields: Sequence[str] = ..., classes: Iterable[str] = ..., description: str | None = ..., - model_admin: ModelAdmin | None = ..., + model_admin: BaseModelAdmin[Any] | None = ..., ) -> None: ... @cached_property def is_collapsible(self) -> bool: ... @@ -76,17 +76,17 @@ class Fieldset: def __iter__(self) -> Iterator[Fieldline]: ... class Fieldline: - form: ModelForm + form: ModelForm[Any] fields: Sequence[str] has_visible_field: bool - model_admin: ModelAdmin | None + model_admin: BaseModelAdmin[Any] | None readonly_fields: Sequence[str] def __init__( self, - form: ModelForm, + form: ModelForm[Any], field: str | Sequence[str], readonly_fields: Sequence[str] | None = ..., - model_admin: ModelAdmin | None = ..., + model_admin: BaseModelAdmin[Any] | None = ..., ) -> None: ... def __iter__(self) -> Iterator[AdminField | AdminReadonlyField]: ... def errors(self) -> SafeString: ... @@ -96,7 +96,7 @@ class AdminField: is_first: bool is_checkbox: bool is_readonly: bool - def __init__(self, form: ModelForm, field: str, is_first: bool) -> None: ... + def __init__(self, form: ModelForm[Any], field: str, is_first: bool) -> None: ... def label_tag(self) -> SafeString: ... def errors(self) -> SafeString: ... @@ -110,18 +110,18 @@ class _FieldDictT(TypedDict): class AdminReadonlyField: field: _FieldDictT - form: ModelForm - model_admin: ModelAdmin | None + form: ModelForm[Any] + model_admin: BaseModelAdmin[Any] | None is_first: bool is_checkbox: bool is_readonly: bool empty_value_display: Any def __init__( self, - form: ModelForm, + form: ModelForm[Any], field: Callable[[Model], Any] | str, is_first: bool, - model_admin: ModelAdmin | None = ..., + model_admin: BaseModelAdmin[Any] | None = ..., ) -> None: ... def label_tag(self) -> SafeString: ... def get_admin_url(self, remote_field: ForeignObjectRel, remote_obj: Model) -> str: ... @@ -131,7 +131,7 @@ class InlineAdminFormSet: opts: Any formset: Any fieldsets: Any - model_admin: ModelAdmin | None + model_admin: ModelAdmin[Any] | None readonly_fields: Sequence[str] prepopulated_fields: dict[str, Any] classes: str @@ -146,7 +146,7 @@ class InlineAdminFormSet: fieldsets: Any, prepopulated_fields: dict[str, Any] | None = ..., readonly_fields: Sequence[str] | None = ..., - model_admin: ModelAdmin | None = ..., + model_admin: ModelAdmin[Any] | None = ..., has_add_permission: bool = ..., has_change_permission: bool = ..., has_delete_permission: bool = ..., @@ -175,17 +175,17 @@ class InlineAdminForm(AdminForm): def __init__( self, formset: Any, - form: ModelForm, + form: ModelForm[Any], fieldsets: Any, prepopulated_fields: Any, original: bool | None, readonly_fields: Sequence[str] | None = ..., - model_admin: ModelAdmin | None = ..., + model_admin: BaseModelAdmin[Any] | None = ..., view_on_site_url: str | None = ..., ) -> None: ... @override def __iter__(self) -> Iterator[InlineFieldset]: ... - def needs_explicit_pk_field(self) -> bool | AutoField: ... + def needs_explicit_pk_field(self) -> bool | AutoField[Any, Any]: ... def pk_field(self) -> AdminField: ... def fk_field(self) -> AdminField: ... def deletion_field(self) -> AdminField: ... @@ -197,4 +197,4 @@ class InlineFieldset(Fieldset): def __iter__(self) -> Iterator[Fieldline]: ... class AdminErrorList(forms.utils.ErrorList): - def __init__(self, form: ModelForm, inline_formsets: Any) -> None: ... + def __init__(self, form: ModelForm[Any], inline_formsets: Any) -> None: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/admin/models.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/admin/models.pyi index 30fb359d5d69..ff10cf31972a 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/contrib/admin/models.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/admin/models.pyi @@ -1,9 +1,13 @@ +import datetime as dt from collections.abc import Iterable from typing import Any, ClassVar, Literal, overload from uuid import UUID +from django.contrib.auth.models import _User +from django.contrib.contenttypes.models import ContentType from django.db import models from django.db.models.base import Model +from django.db.models.expressions import Combinable ADDITION: int CHANGE: int @@ -33,13 +37,13 @@ class LogEntryManager(models.Manager[LogEntry]): ) -> list[LogEntry]: ... class LogEntry(models.Model): - action_time: models.DateTimeField - user: models.ForeignKey - content_type: models.ForeignKey - object_id: models.TextField - object_repr: models.CharField - action_flag: models.PositiveSmallIntegerField - change_message: models.TextField + action_time: models.DateTimeField[str | dt.datetime | dt.date | Combinable, dt.datetime] + user: models.ForeignKey[_User | Combinable, _User] + content_type: models.ForeignKey[ContentType | Combinable | None, ContentType | None] + object_id: models.TextField[str | Combinable | None, str | None] + object_repr: models.CharField[str | int | Combinable, str] + action_flag: models.PositiveSmallIntegerField[float | int | str | Combinable, int] + change_message: models.TextField[str | Combinable, str] objects: ClassVar[LogEntryManager] def is_addition(self) -> bool: ... def is_change(self) -> bool: ... 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 c369d42159a6..51de4285e67f 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 @@ -112,20 +112,24 @@ class BaseModelAdmin(Generic[_ModelT], metaclass=MediaDefiningClass): def formfield_for_choice_field( self, db_field: Field[Any, Any], request: HttpRequest, **kwargs: Any ) -> TypedChoiceField | None: ... - def get_field_queryset(self, db: str | None, db_field: RelatedField, request: HttpRequest) -> QuerySet | None: ... + def get_field_queryset( + self, db: str | None, db_field: RelatedField[Any, Any], request: HttpRequest + ) -> QuerySet[Any] | None: ... def formfield_for_foreignkey( - self, db_field: ForeignKey, request: HttpRequest, **kwargs: Any - ) -> ModelChoiceField | None: ... + self, db_field: ForeignKey[Any, Any], request: HttpRequest, **kwargs: Any + ) -> ModelChoiceField[Any] | None: ... def formfield_for_manytomany( - self, db_field: ManyToManyField, request: HttpRequest, **kwargs: Any - ) -> ModelMultipleChoiceField | None: ... + self, db_field: ManyToManyField[Any, Any], request: HttpRequest, **kwargs: Any + ) -> ModelMultipleChoiceField[Any] | None: ... def get_autocomplete_fields(self, request: HttpRequest) -> _ListOrTuple[str]: ... def get_view_on_site_url(self, obj: _ModelT | None = ...) -> str | None: ... def get_empty_value_display(self) -> SafeString: ... def get_exclude(self, request: HttpRequest, obj: _ModelT | None = ...) -> _ListOrTuple[str] | None: ... def get_fields(self, request: HttpRequest, obj: _ModelT | None = ...) -> _FieldGroups: ... def get_fieldsets(self, request: HttpRequest, obj: _ModelT | None = ...) -> _FieldsetSpec: ... - def get_inlines(self, request: HttpRequest, obj: _ModelT | None) -> _ListOrTuple[type[InlineModelAdmin]]: ... + def get_inlines( + self, request: HttpRequest, obj: _ModelT | None + ) -> _ListOrTuple[type[InlineModelAdmin[Any, Any]]]: ... def get_ordering(self, request: HttpRequest) -> _ListOrTuple[_OrderByFieldName]: ... def get_readonly_fields(self, request: HttpRequest, obj: _ModelT | None = ...) -> _ListOrTuple[str]: ... def get_prepopulated_fields(self, request: HttpRequest, obj: _ModelT | None = ...) -> dict[str, Sequence[str]]: ... @@ -163,7 +167,7 @@ class ModelAdmin(BaseModelAdmin[_ModelT]): paginator: ClassVar[type] preserve_filters: ClassVar[bool] show_facets: ClassVar[ShowFacets] - inlines: ClassVar[_ListOrTuple[type[InlineModelAdmin]]] + inlines: ClassVar[_ListOrTuple[type[InlineModelAdmin[Any, Any]]]] add_form_template: ClassVar[_TemplateForResponseT | None] change_form_template: ClassVar[_TemplateForResponseT | None] change_list_template: ClassVar[_TemplateForResponseT | None] @@ -180,7 +184,9 @@ class ModelAdmin(BaseModelAdmin[_ModelT]): opts: Options[_ModelT] admin_site: AdminSite def __init__(self, model: type[_ModelT], admin_site: AdminSite) -> None: ... - def get_inline_instances(self, request: HttpRequest, obj: _ModelT | None = ...) -> list[InlineModelAdmin]: ... + def get_inline_instances( + self, request: HttpRequest, obj: _ModelT | None = ... + ) -> list[InlineModelAdmin[Any, Any]]: ... def get_urls(self) -> list[URLPattern]: ... @property def urls(self) -> list[URLPattern]: ... @@ -202,11 +208,11 @@ class ModelAdmin(BaseModelAdmin[_ModelT]): def get_paginator( self, request: HttpRequest, - queryset: QuerySet, + queryset: QuerySet[Any], per_page: int, orphans: int = ..., allow_empty_first_page: bool = ..., - ) -> Paginator: ... + ) -> Paginator[Any]: ... def log_addition(self, request: HttpRequest, obj: _ModelT, message: Any) -> LogEntry: ... def log_change(self, request: HttpRequest, obj: _ModelT, message: Any) -> LogEntry: ... def log_deletions(self, request: HttpRequest, queryset: QuerySet[_ModelT]) -> list[LogEntry]: ... @@ -215,7 +221,7 @@ class ModelAdmin(BaseModelAdmin[_ModelT]): def get_action_choices( self, request: HttpRequest, default_choices: list[tuple[str, str]] = ... ) -> list[tuple[str, str]]: ... - def get_action(self, action: Callable | str) -> tuple[Callable[..., str], str, str] | None: ... + 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] @@ -224,13 +230,13 @@ class ModelAdmin(BaseModelAdmin[_ModelT]): def get_list_select_related(self, request: HttpRequest) -> bool | _ListOrTuple[str]: ... def get_search_fields(self, request: HttpRequest) -> _ListOrTuple[str]: ... def get_search_results( - self, request: HttpRequest, queryset: QuerySet, search_term: str + self, request: HttpRequest, queryset: QuerySet[Any], search_term: str ) -> tuple[QuerySet[_ModelT], bool]: ... def get_preserved_filters(self, request: HttpRequest) -> str: ... def _get_edited_object_pks(self, request: HttpRequest, prefix: str) -> list[str]: ... def _get_list_editable_queryset(self, request: HttpRequest, prefix: str) -> QuerySet[_ModelT]: ... def construct_change_message( - self, request: HttpRequest, form: forms.Form, formsets: Iterable[BaseFormSet], add: bool = ... + self, request: HttpRequest, form: forms.Form, formsets: Iterable[BaseFormSet[Any]], add: bool = ... ) -> list[dict[str, dict[str, list[str]]]]: ... def message_user( self, @@ -243,7 +249,7 @@ class ModelAdmin(BaseModelAdmin[_ModelT]): def save_form(self, request: HttpRequest, form: Any, change: Any) -> Any: ... def save_model(self, request: HttpRequest, obj: _ModelT, form: Any, change: Any) -> None: ... def delete_model(self, request: HttpRequest, obj: _ModelT) -> None: ... - def delete_queryset(self, request: HttpRequest, queryset: QuerySet) -> None: ... + def delete_queryset(self, request: HttpRequest, queryset: QuerySet[Any]) -> None: ... def save_formset(self, request: HttpRequest, form: Any, formset: Any, change: Any) -> None: ... def save_related(self, request: HttpRequest, form: Any, formsets: Any, change: Any) -> None: ... def render_change_form( @@ -260,7 +266,7 @@ 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) -> HttpResponse | None: ... + def response_action(self, request: HttpRequest, queryset: QuerySet[Any]) -> 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( @@ -332,7 +338,9 @@ class InlineModelAdmin(BaseModelAdmin[Any], Generic[_ChildModelT, _ParentModelT] @override def get_fieldsets(self, request: HttpRequest, obj: _ParentModelT | None = ...) -> _FieldsetSpec: ... @override - def get_inlines(self, request: HttpRequest, obj: _ParentModelT | None) -> _ListOrTuple[type[InlineModelAdmin]]: ... + def get_inlines( + self, request: HttpRequest, obj: _ParentModelT | None + ) -> _ListOrTuple[type[InlineModelAdmin[Any, Any]]]: ... @override def get_readonly_fields(self, request: HttpRequest, obj: _ParentModelT | None = ...) -> _ListOrTuple[str]: ... @override 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 10a9e1a58b07..db90922e99c8 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 @@ -20,7 +20,7 @@ all_sites: WeakSet[AdminSite] _ViewType = TypeVar("_ViewType", bound=Callable[..., HttpResponseBase]) _ModelT = TypeVar("_ModelT", bound=Model) -_ActionCallback: TypeAlias = Callable[[ModelAdmin, HttpRequest, QuerySet], TemplateResponse | None] +_ActionCallback: TypeAlias = Callable[[ModelAdmin[Any], HttpRequest, QuerySet[Any]], TemplateResponse | None] class AdminSite: site_title: _StrOrPromise @@ -40,7 +40,7 @@ class AdminSite: empty_value_display: str final_catch_all_view: bool _empty_value_display: str - _registry: dict[type[Model], ModelAdmin] + _registry: dict[type[Model], ModelAdmin[Any]] _global_actions: dict[str, _ActionCallback] _actions: dict[str, _ActionCallback] def __init__(self, name: str = ...) -> None: ... @@ -84,4 +84,5 @@ class AdminSite: class DefaultAdminSite(LazyObject[AdminSite]): ... +# site is actually an instance of DefaultAdminSite, but it proxies through to a AdminSite site: AdminSite diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/admin/templatetags/admin_list.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/admin/templatetags/admin_list.pyi index 4beb121128a2..94136cd19365 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/contrib/admin/templatetags/admin_list.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/admin/templatetags/admin_list.pyi @@ -18,11 +18,11 @@ def paginator_number(cl: ChangeList, i: int) -> SafeString: ... def pagination(cl: ChangeList) -> dict[str, Any]: ... def pagination_tag(parser: Parser, token: Token) -> InclusionAdminNode: ... def result_headers(cl: ChangeList) -> Iterator[dict[str, int | str | None]]: ... -def items_for_result(cl: ChangeList, result: Model, form: ModelForm | None) -> Iterator[SafeString]: ... +def items_for_result(cl: ChangeList, result: Model, form: ModelForm[Any] | None) -> Iterator[SafeString]: ... -class ResultList(list): - form: ModelForm | None - def __init__(self, form: ModelForm | None, *items: Any) -> None: ... +class ResultList(list[Any]): + form: ModelForm[Any] | None + def __init__(self, form: ModelForm[Any] | None, *items: Any) -> None: ... def results(cl: ChangeList) -> Iterator[ResultList]: ... def result_hidden_fields(cl: ChangeList) -> Iterator[BoundField]: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/admin/templatetags/admin_urls.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/admin/templatetags/admin_urls.pyi index 02b0351be98c..f16d7ae155e3 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/contrib/admin/templatetags/admin_urls.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/admin/templatetags/admin_urls.pyi @@ -7,10 +7,10 @@ from django.utils.safestring import SafeString register: Any -def admin_urlname(value: Options, arg: SafeString) -> str: ... +def admin_urlname(value: Options[Any], arg: SafeString) -> str: ... def admin_urlquote(value: int | str | UUID) -> int | str | UUID: ... def add_preserved_filters( - context: dict[str, Options | str] | RequestContext, + context: dict[str, Options[Any] | str] | RequestContext, url: str, popup: bool = ..., to_field: str | None = ..., 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 bbff55644bdc..407eccbdfdab 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 @@ -9,12 +9,12 @@ from typing_extensions import override class InclusionAdminNode(InclusionNode): args: list[Any] - func: Callable + func: Callable[..., Any] kwargs: dict[str, Any] takes_context: bool template_name: str def __init__( - self, parser: Parser, token: Token, func: Callable, template_name: str, takes_context: bool = ... + self, 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 712d6be31b36..9759f480e1ea 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 @@ -1,5 +1,6 @@ from collections import defaultdict from collections.abc import Callable, Iterable, Sequence +from re import Pattern from typing import Any, Literal, overload, type_check_only from uuid import UUID @@ -22,10 +23,11 @@ _T = TypeVar("_T") QUOTE_MAP: dict[int, str] UNQUOTE_MAP: dict[str, str] +UNQUOTE_RE: Pattern[str] class FieldIsAForeignKeyColumnName(Exception): ... -def lookup_spawns_duplicates(opts: Options, lookup_path: str) -> bool: ... +def lookup_spawns_duplicates(opts: Options[Any], lookup_path: str) -> bool: ... def get_last_value_from_parameters(parameters: dict[str, list[str] | str], key: str) -> str | None: ... @overload def prepare_lookup_value(key: str, value: list[str], separator: str = ...) -> list[str] | list[bool]: ... @@ -79,24 +81,24 @@ class _ModelFormatDict(TypedDict): verbose_name: str verbose_name_plural: str -def model_format_dict(obj: Model | type[Model] | QuerySet | Options[Model]) -> _ModelFormatDict: ... -def model_ngettext(obj: Options | QuerySet, n: int | None = ...) -> str: ... +def model_format_dict(obj: Model | type[Model] | QuerySet[Any] | Options[Model]) -> _ModelFormatDict: ... +def model_ngettext(obj: Options[Any] | QuerySet[Any], n: int | None = ...) -> str: ... def lookup_field( - name: Callable | str, obj: Model, model_admin: BaseModelAdmin | None = ... + name: Callable[..., Any] | str, obj: Model, model_admin: BaseModelAdmin[Any] | None = ... ) -> tuple[Field[Any, Any] | None, str | None, Any]: ... @overload def label_for_field( - name: Callable | str, + name: Callable[..., Any] | str, model: type[Model], - model_admin: BaseModelAdmin | None = ..., + model_admin: BaseModelAdmin[Any] | None = ..., return_attr: Literal[True] = True, form: BaseForm | None = ..., -) -> tuple[str, Callable | str | None]: ... +) -> tuple[str, Callable[..., Any] | str | None]: ... @overload def label_for_field( - name: Callable | str, + name: Callable[..., Any] | str, model: type[Model], - model_admin: BaseModelAdmin | None = ..., + model_admin: BaseModelAdmin[Any] | None = ..., return_attr: Literal[False] = False, form: BaseForm | None = ..., ) -> str: ... @@ -112,5 +114,5 @@ def get_model_from_relation(field: Field[Any, Any] | reverse_related.ForeignObje def reverse_field_path(model: type[Model], path: str) -> tuple[type[Model], str]: ... def get_fields_from_path(model: type[Model], path: str) -> list[Field[Any, Any]]: ... def construct_change_message( - form: Form, formsets: Iterable[BaseFormSet], add: bool + form: Form, formsets: Iterable[BaseFormSet[Any]], add: bool ) -> list[dict[str, dict[str, list[str]]]]: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/admin/views/autocomplete.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/admin/views/autocomplete.pyi index b0b6c128e53c..39842ac6e4c5 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/contrib/admin/views/autocomplete.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/admin/views/autocomplete.pyi @@ -1,3 +1,5 @@ +from typing import Any + from django.contrib.admin.options import ModelAdmin from django.contrib.admin.sites import AdminSite from django.db.models import Model @@ -5,11 +7,11 @@ from django.db.models.fields.related import ForeignKey from django.http.request import HttpRequest from django.views.generic.list import BaseListView -class AutocompleteJsonView(BaseListView): +class AutocompleteJsonView(BaseListView[Any]): admin_site: AdminSite | None - model_admin: ModelAdmin - source_field: ForeignKey + model_admin: ModelAdmin[Any] + source_field: ForeignKey[Any, Any] term: str def serialize_result(self, obj: Model, to_field_name: str) -> dict[str, str]: ... - def process_request(self, request: HttpRequest) -> tuple[str, ModelAdmin, ForeignKey, str]: ... + def process_request(self, request: HttpRequest) -> tuple[str, ModelAdmin[Any], ForeignKey[Any, Any], str]: ... def has_perm(self, request: HttpRequest, obj: Model | None = ...) -> bool: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/admin/views/decorators.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/admin/views/decorators.pyi index 3be7667130f9..a1df8b6c940a 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/contrib/admin/views/decorators.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/admin/views/decorators.pyi @@ -1,10 +1,10 @@ from collections.abc import Callable -from typing import overload +from typing import Any, overload from django.utils.functional import _StrOrPromise from typing_extensions import TypeVar -_C = TypeVar("_C", bound=Callable) +_C = TypeVar("_C", bound=Callable[..., Any]) @overload def staff_member_required( @@ -13,4 +13,4 @@ def staff_member_required( @overload def staff_member_required( view_func: None = None, redirect_field_name: str | None = ..., login_url: _StrOrPromise = ... -) -> Callable: ... +) -> Callable[..., Any]: ... 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 e9afdc71bb4a..d546df1a2629 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 @@ -22,11 +22,11 @@ class ChangeListSearchForm(forms.Form): ... class ChangeList: search_form_class: type[forms.Form] model: type[Model] - opts: Options - lookup_opts: Options - root_queryset: QuerySet - list_display: _ListDisplayT - list_display_links: _ListDisplayT + opts: Options[Any] + lookup_opts: Options[Any] + root_queryset: QuerySet[Any] + list_display: _ListDisplayT[Any] + list_display_links: _ListDisplayT[Any] list_filter: Sequence[_ListFilterT] date_hierarchy: Any search_fields: Sequence[str] @@ -34,7 +34,7 @@ class ChangeList: list_select_related: bool | Sequence[str] list_per_page: int list_max_show_all: int - model_admin: ModelAdmin + model_admin: ModelAdmin[Any] preserved_filters: str sortable_by: Sequence[str] | None page_num: int @@ -52,13 +52,13 @@ class ChangeList: queryset: Any title: str pk_attname: str - formset: BaseFormSet | None + formset: BaseFormSet[Any] | None def __init__( self, request: HttpRequest, model: type[Model], - list_display: _ListDisplayT, - list_display_links: _ListDisplayT, + list_display: _ListDisplayT[Any], + list_display_links: _ListDisplayT[Any], list_filter: Sequence[_ListFilterT], date_hierarchy: str | None, search_fields: Sequence[str], @@ -66,7 +66,7 @@ class ChangeList: list_per_page: int, list_max_show_all: int, list_editable: Sequence[str], - model_admin: ModelAdmin, + model_admin: ModelAdmin[Any], sortable_by: Sequence[str] | None, search_help_text: str | None, ) -> None: ... @@ -82,14 +82,16 @@ class ChangeList: multi_page: bool paginator: Any def get_results(self, request: HttpRequest) -> None: ... - def get_ordering_field(self, field_name: Callable | str) -> _OrderByFieldName | None: ... - def get_ordering(self, request: HttpRequest, queryset: QuerySet) -> list[_OrderByFieldName]: ... + def get_ordering_field(self, field_name: Callable[..., Any] | str) -> _OrderByFieldName | None: ... + def get_ordering(self, request: HttpRequest, queryset: QuerySet[Any]) -> list[_OrderByFieldName]: ... def get_ordering_field_columns(self) -> dict[int, Literal["desc", "asc"]]: ... - def get_queryset(self, request: HttpRequest, exclude_parameters: list[str | None] | None = ...) -> QuerySet: ... + def get_queryset( + self, request: HttpRequest, exclude_parameters: list[str | None] | None = ... + ) -> QuerySet[Any]: ... filter_specs: list[ListFilter] has_filters: bool has_active_filters: bool clear_all_filters_qs: str - def apply_select_related(self, qs: QuerySet) -> QuerySet: ... + def apply_select_related(self, qs: QuerySet[Any]) -> QuerySet[Any]: ... def has_related_field_in_list_display(self) -> bool: ... def url_for_result(self, result: Model) -> str: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/admin/widgets.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/admin/widgets.pyi index e0ffb24328ae..8110fb317dc6 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/contrib/admin/widgets.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/admin/widgets.pyi @@ -92,7 +92,9 @@ class ManyToManyRawIdWidget(ForeignKeyRawIdWidget): @override def format_value(self, value: Any) -> str | None: ... @override - def value_from_datadict(self, data: Mapping[str, Any], files: Mapping[str, Iterable[File]], name: str) -> Any: ... + def value_from_datadict( + self, data: Mapping[str, Any], files: Mapping[str, Iterable[File[Any]]], name: str + ) -> Any: ... class RelatedFieldWidgetWrapper(forms.Widget): template_name: str @@ -117,17 +119,19 @@ class RelatedFieldWidgetWrapper(forms.Widget): @override def is_hidden(self) -> bool: ... @property - def choices(self) -> ModelChoiceIterator: ... + def choices(self) -> ModelChoiceIterator[Any]: ... @choices.setter - def choices(self, value: ModelChoiceIterator) -> None: ... + def choices(self, value: ModelChoiceIterator[Any]) -> None: ... def get_related_url(self, info: tuple[str, str], action: str, *args: Any) -> str: ... @override def get_context(self, name: str, value: Any, attrs: _OptAttrs | None) -> dict[str, Any]: ... @override - def value_from_datadict(self, data: Mapping[str, Any], files: Mapping[str, Iterable[File]], name: str) -> Any: ... + def value_from_datadict( + self, data: Mapping[str, Any], files: Mapping[str, Iterable[File[Any]]], name: str + ) -> Any: ... @override def value_omitted_from_data( - self, data: Mapping[str, Any], files: Mapping[str, Iterable[File]], name: str + self, data: Mapping[str, Any], files: Mapping[str, Iterable[File[Any]]], name: str ) -> bool: ... @override def id_for_label(self, id_: str) -> str: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/admindocs/utils.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/admindocs/utils.pyi index 09b5a6b3b7ff..a7fc9687a54c 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/contrib/admindocs/utils.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/admindocs/utils.pyi @@ -6,7 +6,7 @@ from django.utils.safestring import SafeString docutils_is_available: bool -def get_view_name(view_func: Callable) -> str: ... +def get_view_name(view_func: Callable[..., Any]) -> str: ... def parse_docstring(docstring: str) -> tuple[str, str, dict[str, str]]: ... def parse_rst(text: str, default_reference_context: Any, thing_being_parsed: Any | None = ...) -> SafeString: ... @@ -25,9 +25,9 @@ def default_reference_role( content: Any | None = ..., ) -> tuple[list[Any], list[Any]]: ... -named_group_matcher: Any -unnamed_group_matcher: Any -non_capturing_group_matcher: Any +named_group_matcher: Pattern[str] +unnamed_group_matcher: Pattern[str] +non_capturing_group_matcher: Pattern[str] def replace_metacharacters(pattern: str) -> str: ... def replace_named_groups(pattern: str) -> str: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/admindocs/views.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/admindocs/views.pyi index 1ebf4f41b3fb..3d1671f08d64 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/contrib/admindocs/views.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/admindocs/views.pyi @@ -3,6 +3,7 @@ from re import Pattern from typing import Any from django.contrib.auth.models import AbstractBaseUser, AnonymousUser +from django.db.models import Model from django.db.models.fields import Field from django.db.models.options import Options from django.urls import _AnyURL @@ -17,7 +18,7 @@ class TemplateFilterIndexView(BaseAdminDocsView): ... class ViewIndexView(BaseAdminDocsView): ... class ViewDetailView(BaseAdminDocsView): ... -def user_has_model_view_permission(user: AbstractBaseUser | AnonymousUser, opts: Options) -> bool: ... +def user_has_model_view_permission(user: AbstractBaseUser | AnonymousUser, opts: Options[Model]) -> bool: ... class ModelIndexView(BaseAdminDocsView): ... class ModelDetailView(BaseAdminDocsView): ... @@ -27,5 +28,5 @@ def get_return_data_type(func_name: Any) -> str: ... def get_readable_field_data_type(field: Field[Any, Any] | str) -> str: ... def extract_views_from_urlpatterns( urlpatterns: Iterable[_AnyURL], base: str = ..., namespace: str | None = ... -) -> list[tuple[Callable, Pattern[str], str | None, str | None]]: ... +) -> list[tuple[Callable[..., Any], Pattern[str], str | None, str | None]]: ... def simplify_regex(pattern: str) -> 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 693ad6bb48d3..2608544452c6 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 @@ -26,6 +26,6 @@ async def alogout(request: HttpRequest) -> None: ... def get_user_model() -> _UserModel: ... def get_user(request: HttpRequest | Client) -> _AnyUser: ... async def aget_user(request: HttpRequest | Client) -> _AnyUser: ... -def get_permission_codename(action: str, opts: Options) -> str: ... +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: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/auth/admin.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/auth/admin.pyi index a7d3dce0b19d..d148c21228e4 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/contrib/auth/admin.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/auth/admin.pyi @@ -12,8 +12,8 @@ from typing_extensions import override class GroupAdmin(admin.ModelAdmin[Group]): @override def formfield_for_manytomany( - self, db_field: ManyToManyField, request: HttpRequest | None = ..., **kwargs: Any - ) -> ModelMultipleChoiceField | None: ... + self, db_field: ManyToManyField[Any, Any], request: HttpRequest | None = ..., **kwargs: Any + ) -> ModelMultipleChoiceField[Any] | None: ... class UserAdmin(admin.ModelAdmin[_UserType]): change_user_password_template: Any diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/auth/base_user.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/auth/base_user.pyi index 6336d1366b13..116fecf18a1c 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/contrib/auth/base_user.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/auth/base_user.pyi @@ -1,3 +1,4 @@ +import datetime as dt from collections.abc import Iterable from typing import Any, ClassVar, Literal, overload @@ -21,8 +22,8 @@ class AbstractBaseUser(models.Model): class Meta: abstract: ClassVar[bool] - password = models.CharField(max_length=128) - last_login = models.DateTimeField(blank=True, null=True) + password: models.CharField[str | int | Combinable, str] + last_login: models.DateTimeField[str | dt.datetime | dt.date | Combinable | None, dt.datetime | None] is_active: bool | BooleanField[bool | Combinable, bool] backend: str # Set dynamically by authenticate(), used by login() diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/auth/checks.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/auth/checks.pyi index a5ac830f1518..559e92472cf8 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/contrib/auth/checks.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/auth/checks.pyi @@ -1,9 +1,8 @@ from collections.abc import Sequence -from typing import Any from django.apps.config import AppConfig from django.core.checks.messages import CheckMessage -def check_user_model(app_configs: Sequence[AppConfig] | None, **kwargs: Any) -> list[CheckMessage]: ... -def check_models_permissions(app_configs: Sequence[AppConfig] | None, **kwargs: Any) -> list[CheckMessage]: ... -def check_middleware(app_configs: Sequence[AppConfig] | None, **kwargs: Any) -> list[CheckMessage]: ... +def check_user_model(app_configs: Sequence[AppConfig] | None, **kwargs: object) -> list[CheckMessage]: ... +def check_models_permissions(app_configs: Sequence[AppConfig] | None, **kwargs: object) -> list[CheckMessage]: ... +def check_middleware(app_configs: Sequence[AppConfig] | None, **kwargs: object) -> list[CheckMessage]: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/auth/forms.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/auth/forms.pyi index 7cc6d925819a..e1dbbf65c401 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/contrib/auth/forms.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/auth/forms.pyi @@ -97,7 +97,7 @@ class AuthenticationForm(forms.Form): error_messages: _ErrorMessagesDict request: HttpRequest | None user_cache: _User | None - username_field: models.Field + username_field: models.Field[Any, Any] def __init__(self, request: HttpRequest | None = ..., *args: Any, **kwargs: Any) -> None: ... def confirm_login_allowed(self, user: _User) -> None: ... def get_user(self) -> _User: ... @@ -130,14 +130,14 @@ class PasswordResetForm(forms.Form): extra_email_context: dict[str, str] | None = ..., ) -> None: ... -class SetPasswordForm(SetPasswordMixin, forms.Form, Generic[_UserType]): +class SetPasswordForm(SetPasswordMixin[_UserType], forms.Form, Generic[_UserType]): new_password1: forms.Field new_password2: forms.Field user: _UserType def __init__(self, user: _UserType, *args: Any, **kwargs: Any) -> None: ... def save(self, commit: bool = ...) -> _UserType: ... -class PasswordChangeForm(SetPasswordForm): +class PasswordChangeForm(SetPasswordForm[_User]): old_password: forms.Field def clean_old_password(self) -> str: ... @@ -154,5 +154,5 @@ class AdminPasswordChangeForm(forms.Form, Generic[_UserType]): @override def changed_data(self) -> list[str]: ... -class AdminUserCreationForm(SetUnusablePasswordMixin, UserCreationForm): +class AdminUserCreationForm(SetUnusablePasswordMixin[_UserType], UserCreationForm[_UserType]): usable_password: forms.ChoiceField = ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/auth/hashers.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/auth/hashers.pyi index af11eebbc7cb..ca4fbf5047b9 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/contrib/auth/hashers.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/auth/hashers.pyi @@ -13,7 +13,7 @@ def check_password( password: str | None, encoded: str, setter: Callable[[str | None], Any] | None = ..., preferred: str = ... ) -> bool: ... async def acheck_password( - password: str | None, encoded: str, setter: Callable | None = ..., preferred: str = ... + password: str | None, encoded: str, setter: Callable[..., Any] | None = ..., preferred: str = ... ) -> bool: ... def make_password(password: str | None, salt: str | None = ..., hasher: str | BasePasswordHasher = ...) -> str: ... def get_hashers() -> list[BasePasswordHasher]: ... 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 546f8e8ee4da..68e2512c85cd 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 @@ -3,7 +3,7 @@ from typing import Any, ClassVar, Literal from django.contrib.auth.models import _AnyUser from django.http import HttpRequest, HttpResponseBase, HttpResponseRedirect -from django.utils.deprecation import MiddlewareMixin, _AsyncGetResponseCallable, _GetResponseCallable +from django.utils.deprecation import MiddlewareMixin, _AnyGetResponseCallable def get_user(request: HttpRequest) -> _AnyUser: ... async def auser(request: HttpRequest) -> _AnyUser: ... @@ -32,9 +32,9 @@ class RemoteUserMiddleware: force_logout_if_no_header: ClassVar[bool] sync_capable: ClassVar[Literal[True]] async_capable: ClassVar[Literal[True]] - get_response: _GetResponseCallable | _AsyncGetResponseCallable + get_response: _AnyGetResponseCallable is_async: bool - def __init__(self, get_response: _GetResponseCallable | _AsyncGetResponseCallable) -> None: ... + def __init__(self, get_response: _AnyGetResponseCallable) -> None: ... def __call__(self, request: HttpRequest) -> HttpResponseBase | Awaitable[HttpResponseBase]: ... async def __acall__(self, request: HttpRequest) -> HttpResponseBase: ... def clean_username(self, username: str, request: HttpRequest) -> str: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/auth/mixins.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/auth/mixins.pyi index fea979a652bd..2424f58feb34 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/contrib/auth/mixins.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/auth/mixins.pyi @@ -26,5 +26,5 @@ class PermissionRequiredMixin(AccessMixin): class UserPassesTestMixin(AccessMixin): def test_func(self) -> bool | None: ... - def get_test_func(self) -> Callable: ... + def get_test_func(self) -> Callable[..., Any]: ... def dispatch(self, request: http.HttpRequest, *args: Any, **kwargs: Any) -> HttpResponseBase: ... 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 b4dbad8a8044..6683bc93d396 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,3 +1,4 @@ +import datetime as dt from collections.abc import Iterable from typing import Any, ClassVar, Literal, TypeAlias @@ -8,6 +9,7 @@ from django.contrib.contenttypes.models import ContentType from django.db import models from django.db.models import QuerySet 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 @@ -36,9 +38,9 @@ class Permission(models.Model): content_type_id: int objects: ClassVar[PermissionManager] - name = models.CharField(max_length=255) - content_type = models.ForeignKey(ContentType, on_delete=models.CASCADE) - codename = models.CharField(max_length=100) + name: models.CharField[str | int | Combinable, str] + content_type: models.ForeignKey[ContentType | Combinable, ContentType] + codename: models.CharField[str | int | Combinable, str] def natural_key(self) -> tuple[str, str, str]: ... class GroupManager(models.Manager[Group]): @@ -48,7 +50,7 @@ class GroupManager(models.Manager[Group]): class Group(models.Model): objects: ClassVar[GroupManager] - name = models.CharField(max_length=150) + name: models.CharField[str | int | Combinable, str] permissions = models.ManyToManyField(Permission) def natural_key(self) -> tuple[str]: ... @@ -75,7 +77,7 @@ class UserManager(BaseUserManager[_UserType]): ) -> QuerySet[_UserType]: ... class PermissionsMixin(models.Model): - is_superuser = models.BooleanField() + is_superuser: models.BooleanField[bool | Combinable, bool] groups = models.ManyToManyField(Group) user_permissions = models.ManyToManyField(Permission) @@ -103,13 +105,13 @@ class AbstractUser(AbstractBaseUser, PermissionsMixin): verbose_name: ClassVar[str] verbose_name_plural: ClassVar[str] - username = models.CharField(max_length=150) - first_name = models.CharField(max_length=30, blank=True) - last_name = models.CharField(max_length=150, blank=True) - email = models.EmailField(blank=True) - is_staff = models.BooleanField() - is_active = models.BooleanField() - date_joined = models.DateTimeField() + username: models.CharField[str | int | Combinable, str] + first_name: models.CharField[str | int | Combinable, str] + last_name: models.CharField[str | int | Combinable, str] + email: models.EmailField[str | Combinable, str] + is_staff: models.BooleanField[bool | Combinable, bool] + is_active: models.BooleanField[bool | Combinable, bool] + date_joined: models.DateTimeField[str | dt.datetime | dt.date | Combinable, dt.datetime] objects: ClassVar[UserManager[Self]] 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 be4ad8a83107..290e13c5963e 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 @@ -29,7 +29,7 @@ class LoginView(RedirectURLMixin, FormView[_AuthForm]): redirect_authenticated_user: bool extra_context: Mapping[str, Any] | None -class LogoutView(RedirectURLMixin, TemplateView): +class LogoutView(RedirectURLMixin, TemplateView[HttpResponse]): next_page: str | None redirect_field_name: str extra_context: Mapping[str, Any] | None @@ -61,8 +61,8 @@ INTERNAL_RESET_SESSION_TOKEN: str class PasswordResetDoneView(PasswordContextMixin, TemplateView): title: _StrOrPromise -class PasswordResetConfirmView(PasswordContextMixin, FormView[SetPasswordForm]): - form_class: type[SetPasswordForm] +class PasswordResetConfirmView(PasswordContextMixin, FormView[SetPasswordForm[_User]]): + form_class: type[SetPasswordForm[_User]] post_reset_login: bool post_reset_login_backend: str | None reset_url_token: str diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/contenttypes/admin.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/contenttypes/admin.pyi index 0c5f68027af1..a055df50a677 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/contrib/contenttypes/admin.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/contenttypes/admin.pyi @@ -9,10 +9,10 @@ class GenericInlineModelAdminChecks(InlineModelAdminChecks): def _check_exclude_of_parent_model(self, obj: GenericInlineModelAdmin, parent_model: type[Model]) -> list[Any]: ... def _check_relation(self, obj: GenericInlineModelAdmin, parent_model: type[Model]) -> list[Any]: ... -class GenericInlineModelAdmin(InlineModelAdmin): +class GenericInlineModelAdmin(InlineModelAdmin[Any, Any]): ct_field: str ct_fk_field: str - formset: type[BaseGenericInlineFormSet] # type: ignore[assignment] + formset: type[BaseGenericInlineFormSet[Any, Any]] # type: ignore[assignment] class GenericStackedInline(GenericInlineModelAdmin): template: str diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/contenttypes/checks.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/contenttypes/checks.pyi index 74447171c2b0..333dc493744c 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/contrib/contenttypes/checks.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/contenttypes/checks.pyi @@ -1,12 +1,11 @@ from collections.abc import Sequence -from typing import Any from django.apps.config import AppConfig from django.core.checks.messages import CheckMessage def check_generic_foreign_keys( - app_configs: Sequence[AppConfig] | None, *, databases: Sequence[str] | None = ..., **kwargs: Any + app_configs: Sequence[AppConfig] | None, *, databases: Sequence[str] | None = ..., **kwargs: object ) -> list[CheckMessage]: ... def check_model_name_lengths( - app_configs: Sequence[AppConfig] | None, *, databases: Sequence[str] | None = ..., **kwargs: Any + app_configs: Sequence[AppConfig] | None, *, databases: Sequence[str] | None = ..., **kwargs: object ) -> list[CheckMessage]: ... 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 511e2549386e..dcfc8786b847 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 @@ -16,7 +16,7 @@ from django.db.models.sql.where import WhereNode from django.utils.functional import cached_property from typing_extensions import override -class GenericForeignKey(FieldCacheMixin, Field): +class GenericForeignKey(FieldCacheMixin, Field[Any, Any]): # django-stubs implementation only fields _pyi_private_set_type: Any | Combinable _pyi_private_get_type: Any @@ -56,7 +56,7 @@ class GenericForeignKey(FieldCacheMixin, Field): model: type[Model] | None = None, ) -> ContentType: ... def get_prefetch_querysets( - self, instances: list[Model] | QuerySet, querysets: list[QuerySet] | None = None + self, instances: list[Model] | QuerySet[Any], querysets: list[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] @@ -105,8 +105,8 @@ class GenericRelation(ForeignObject[Any, Any]): def get_content_type(self) -> ContentType: ... @override def get_extra_restriction(self, alias: str | None, remote_alias: str) -> WhereNode: ... - def bulk_related_objects(self, objs: list[Model], using: str = "default") -> QuerySet: ... + def bulk_related_objects(self, objs: list[Model], using: str = "default") -> QuerySet[Any]: ... -class ReverseGenericManyToOneDescriptor(ReverseManyToOneDescriptor): ... +class ReverseGenericManyToOneDescriptor(ReverseManyToOneDescriptor[Any]): ... def create_generic_related_manager(superclass: Any, rel: Any) -> type[Any]: ... # GenericRelatedObjectManager diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/contenttypes/forms.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/contenttypes/forms.pyi index 8cea96583bc1..33ad14a0282c 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/contrib/contenttypes/forms.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/contenttypes/forms.pyi @@ -5,7 +5,7 @@ from django.forms.models import BaseModelFormSet, ModelForm from typing_extensions import TypeVar, override _M = TypeVar("_M", bound=Model) -_ModelFormT = TypeVar("_ModelFormT", bound=ModelForm) +_ModelFormT = TypeVar("_ModelFormT", bound=ModelForm[Any], default=ModelForm[_M]) # ONLY use together with _M class BaseGenericInlineFormSet(BaseModelFormSet[_M, _ModelFormT]): instance: Any @@ -32,7 +32,7 @@ class BaseGenericInlineFormSet(BaseModelFormSet[_M, _ModelFormT]): def generic_inlineformset_factory( model: type[_M], form: type[_ModelFormT] = ..., - formset: Any = ..., + formset: type[BaseGenericInlineFormSet[Any, Any]] = ..., ct_field: str = ..., fk_field: str = ..., fields: Any | None = ..., diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/contenttypes/models.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/contenttypes/models.pyi index 332e8c5c7027..35cd6541a45e 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/contrib/contenttypes/models.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/contenttypes/models.pyi @@ -2,6 +2,7 @@ from typing import Any, ClassVar from django.db import models from django.db.models.base import Model +from django.db.models.expressions import Combinable from django.db.models.query import QuerySet class ContentTypeManager(models.Manager[ContentType]): @@ -14,8 +15,8 @@ class ContentTypeManager(models.Manager[ContentType]): class ContentType(models.Model): id: int - app_label = models.CharField(max_length=100) - model = models.CharField(max_length=100) + app_label: models.CharField[str | int | Combinable, str] + model: models.CharField[str | int | Combinable, str] objects: ClassVar[ContentTypeManager] @property def name(self) -> str: ... @@ -23,5 +24,5 @@ class ContentType(models.Model): def app_labeled_name(self) -> str: ... def model_class(self) -> type[Model] | None: ... def get_object_for_this_type(self, using: str | None = None, **kwargs: Any) -> Model: ... - def get_all_objects_for_this_type(self, **kwargs: Any) -> QuerySet: ... + def get_all_objects_for_this_type(self, **kwargs: Any) -> QuerySet[Any]: ... def natural_key(self) -> tuple[str, str]: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/contenttypes/prefetch.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/contenttypes/prefetch.pyi index 338be0d66238..b7c058e31dd2 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/contrib/contenttypes/prefetch.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/contenttypes/prefetch.pyi @@ -16,7 +16,7 @@ _PrefetchedQuerySetsT = TypeVar( # This will be specialized to a `LiteralString` in the plugin for further processing and validation _ToAttrT = TypeVar("_ToAttrT", bound=str, covariant=True, default=str) -class GenericPrefetch(Prefetch, Generic[_LookupT, _PrefetchedQuerySetsT, _ToAttrT]): +class GenericPrefetch(Prefetch[Any, Any, Any], Generic[_LookupT, _PrefetchedQuerySetsT, _ToAttrT]): def __init__(self, lookup: _LookupT, querysets: _PrefetchedQuerySetsT, to_attr: _ToAttrT | None = None) -> None: ... @override def __getstate__(self) -> dict[str, Any]: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/flatpages/models.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/flatpages/models.pyi index 4b578fe03540..a7227537faea 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/contrib/flatpages/models.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/flatpages/models.pyi @@ -1,12 +1,13 @@ from django.contrib.sites.models import Site from django.db import models +from django.db.models.expressions import Combinable class FlatPage(models.Model): - url: models.CharField - title: models.CharField - content: models.TextField - enable_comments: models.BooleanField - template_name: models.CharField - registration_required: models.BooleanField - sites: models.ManyToManyField[Site, Site] + url: models.CharField[str | int | Combinable, str] + title: models.CharField[str | int | Combinable, str] + content: models.TextField[str | Combinable, str] + enable_comments: models.BooleanField[bool | Combinable, bool] + template_name: models.CharField[str | int | Combinable, str] + registration_required: models.BooleanField[bool | Combinable, bool] + sites = models.ManyToManyField(Site) def get_absolute_url(self) -> str: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/flatpages/sitemaps.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/flatpages/sitemaps.pyi index e67408371817..0ff14213727f 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/contrib/flatpages/sitemaps.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/flatpages/sitemaps.pyi @@ -1,3 +1,4 @@ +from django.contrib.flatpages.models import FlatPage from django.contrib.sitemaps import Sitemap -class FlatPageSitemap(Sitemap): ... +class FlatPageSitemap(Sitemap[FlatPage]): ... 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 53538c87cb10..4417c4e77787 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 @@ -28,7 +28,7 @@ class ST_Polygon(Func): def __init__(self, expr: Any) -> None: ... @cached_property @override - def output_field(self) -> GeometryField: ... + def output_field(self) -> GeometryField[Any, Any]: ... class PostGISOperations(BaseSpatialOperations, DatabaseOperations): name: str 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 7d501b017fe8..59a56e3c996e 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 @@ -22,9 +22,9 @@ from django.utils.functional import _StrOrPromise from typing_extensions import TypeVar, override # __set__ value type -_ST = TypeVar("_ST") +_ST = TypeVar("_ST", contravariant=True) # __get__ return type -_GT = TypeVar("_GT") +_GT = TypeVar("_GT", covariant=True) class SRIDCacheEntry(NamedTuple): units: Any @@ -204,7 +204,7 @@ class ExtentField(Field[Any, Any]): @override def get_internal_type(self) -> str: ... -class RasterField(BaseSpatialField): +class RasterField(BaseSpatialField[_ST, _GT]): @override def db_type(self, connection: Any) -> Any: ... def from_db_value(self, value: Any, expression: Any, connection: Any) -> Any: ... 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 bee8e40762b5..33a0b33347ea 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 @@ -20,18 +20,26 @@ class GeoFuncMixin: def name(self) -> str: ... @cached_property def geo_field(self) -> Any: ... + # `as_sql` drops `template`/`arg_joiner` from `Func.as_sql`, matching runtime. + def as_sql( + self, + compiler: SQLCompiler, + connection: BaseDatabaseWrapper, + function: str | None = None, + **extra_context: Any, + ) -> _AsSqlType: ... def resolve_expression( self, *args: Any, **kwargs: Any, ) -> Any: ... -class GeoFunc(GeoFuncMixin, Func): ... +class GeoFunc(GeoFuncMixin, Func): ... # type: ignore[misc] class GeomOutputGeoFunc(GeoFunc): @cached_property @override - def output_field(self) -> GeometryField: ... + def output_field(self) -> GeometryField[Any, Any]: ... class SQLiteDecimalToFloatMixin: def as_sqlite(self, compiler: SQLCompiler, connection: BaseDatabaseWrapper, **extra_context: Any) -> _AsSqlType: ... @@ -44,17 +52,21 @@ class Area(OracleToleranceMixin, GeoFunc): arity: int @cached_property @override - def output_field(self) -> AreaField: ... + def output_field(self) -> AreaField[Any, Any]: ... + @override + def as_sql( # type: ignore[override] + self, compiler: SQLCompiler, connection: BaseDatabaseWrapper, **extra_context: Any + ) -> _AsSqlType: ... @override def as_sqlite(self, compiler: SQLCompiler, connection: BaseDatabaseWrapper, **extra_context: Any) -> _AsSqlType: ... class Azimuth(GeoFunc): - output_field: ClassVar[FloatField] + output_field: ClassVar[FloatField[Any, Any]] arity: int geom_param_pos: Any class AsGeoJSON(GeoFunc): - output_field: ClassVar[TextField] + output_field: ClassVar[TextField[Any, Any]] def __init__( self, expression: Any, bbox: bool = False, crs: bool = False, precision: int = 8, **extra: Any ) -> None: ... @@ -62,48 +74,48 @@ class AsGeoJSON(GeoFunc): class AsGML(GeoFunc): geom_param_pos: Any - output_field: ClassVar[TextField] + output_field: ClassVar[TextField[Any, Any]] def __init__(self, expression: Any, version: int = 2, precision: int = 8, **extra: Any) -> None: ... def as_oracle(self, compiler: SQLCompiler, connection: BaseDatabaseWrapper, **extra_context: Any) -> _AsSqlType: ... class AsKML(GeoFunc): - output_field: ClassVar[TextField] + output_field: ClassVar[TextField[Any, Any]] def __init__(self, expression: Any, precision: int = 8, **extra: Any) -> None: ... class AsSVG(GeoFunc): - output_field: ClassVar[TextField] + output_field: ClassVar[TextField[Any, Any]] def __init__(self, expression: Any, relative: bool = False, precision: int = 8, **extra: Any) -> None: ... class AsWKB(GeoFunc): - output_field: ClassVar[BinaryField] + output_field: ClassVar[BinaryField[Any, Any]] arity: int class AsWKT(GeoFunc): - output_field: ClassVar[TextField] + output_field: ClassVar[TextField[Any, Any]] arity: int -class BoundingCircle(OracleToleranceMixin, GeomOutputGeoFunc): +class BoundingCircle(OracleToleranceMixin, GeomOutputGeoFunc): # type: ignore[misc] def __init__(self, expression: Any, num_seg: int = 48, **extra: Any) -> None: ... @override def as_oracle(self, compiler: SQLCompiler, connection: BaseDatabaseWrapper, **extra_context: Any) -> _AsSqlType: ... -class Centroid(OracleToleranceMixin, GeomOutputGeoFunc): +class Centroid(OracleToleranceMixin, GeomOutputGeoFunc): # type: ignore[misc] arity: int class ClosestPoint(GeomOutputGeoFunc): arity: int geom_param_pos: tuple[int, int] -class Difference(OracleToleranceMixin, GeomOutputGeoFunc): +class Difference(OracleToleranceMixin, GeomOutputGeoFunc): # type: ignore[misc] arity: int geom_param_pos: Any class DistanceResultMixin: @cached_property - def output_field(self) -> DistanceField: ... + def output_field(self) -> DistanceField[Any, Any]: ... def source_is_geography(self) -> Any: ... -class Distance(DistanceResultMixin, OracleToleranceMixin, GeoFunc): +class Distance(DistanceResultMixin, OracleToleranceMixin, GeoFunc): # type: ignore[misc] geom_param_pos: Any spheroid: Any def __init__(self, expr1: Any, expr2: Any, spheroid: Any | None = None, **extra: Any) -> None: ... @@ -127,39 +139,43 @@ class FromWKB(GeoFunc): class FromWKT(FromWKB): ... class GeoHash(GeoFunc): - output_field: ClassVar[TextField] + output_field: ClassVar[TextField[Any, Any]] def __init__(self, expression: Any, precision: Any | None = None, **extra: Any) -> None: ... def as_mysql(self, compiler: SQLCompiler, connection: BaseDatabaseWrapper, **extra_context: Any) -> _AsSqlType: ... class GeometryDistance(GeoFunc): - output_field: ClassVar[FloatField] + output_field: ClassVar[FloatField[Any, Any]] arity: int function: str arg_joiner: str geom_param_pos: Any -class Intersection(OracleToleranceMixin, GeomOutputGeoFunc): +class Intersection(OracleToleranceMixin, GeomOutputGeoFunc): # type: ignore[misc] arity: int geom_param_pos: Any -class GeometryType(GeoFuncMixin, StandardTransform): +class GeometryType(GeoFuncMixin, StandardTransform): # type: ignore[misc] lookup_name: str - output_field: ClassVar[CharField] + output_field: ClassVar[CharField[Any, Any]] def as_oracle(self, compiler: SQLCompiler, connection: BaseDatabaseWrapper, **extra_context: Any) -> _AsSqlType: ... -class IsEmpty(GeoFuncMixin, StandardTransform): +class IsEmpty(GeoFuncMixin, StandardTransform): # type: ignore[misc] lookup_name: str - output_field: ClassVar[BooleanField] + output_field: ClassVar[BooleanField[Any, Any]] -class IsValid(OracleToleranceMixin, GeoFuncMixin, StandardTransform): +class IsValid(OracleToleranceMixin, GeoFuncMixin, StandardTransform): # type: ignore[misc] lookup_name: str - output_field: ClassVar[BooleanField] + output_field: ClassVar[BooleanField[Any, Any]] @override def as_oracle(self, compiler: SQLCompiler, connection: BaseDatabaseWrapper, **extra_context: Any) -> _AsSqlType: ... class Length(DistanceResultMixin, OracleToleranceMixin, GeoFunc): spheroid: Any def __init__(self, expr1: Any, spheroid: bool = True, **extra: Any) -> None: ... + @override + def as_sql( # type: ignore[override] + self, compiler: SQLCompiler, connection: BaseDatabaseWrapper, **extra_context: Any + ) -> _AsSqlType: ... def as_postgresql( self, compiler: SQLCompiler, connection: BaseDatabaseWrapper, **extra_context: Any ) -> _AsSqlType: ... @@ -167,25 +183,25 @@ class Length(DistanceResultMixin, OracleToleranceMixin, GeoFunc): def as_sqlite(self, compiler: SQLCompiler, connection: BaseDatabaseWrapper, **extra_context: Any) -> _AsSqlType: ... class LineLocatePoint(GeoFunc): - output_field: ClassVar[FloatField] + output_field: ClassVar[FloatField[Any, Any]] arity: int geom_param_pos: Any class MakeValid(GeomOutputGeoFunc): ... class MemSize(GeoFunc): - output_field: ClassVar[IntegerField] + output_field: ClassVar[IntegerField[Any, Any]] arity: int class NumGeometries(GeoFunc): - output_field: ClassVar[IntegerField] + output_field: ClassVar[IntegerField[Any, Any]] arity: int class NumPoints(GeoFunc): - output_field: ClassVar[IntegerField] + output_field: ClassVar[IntegerField[Any, Any]] arity: int -class Perimeter(DistanceResultMixin, OracleToleranceMixin, GeoFunc): +class Perimeter(DistanceResultMixin, OracleToleranceMixin, GeoFunc): # type: ignore[misc] arity: int def as_postgresql( self, compiler: SQLCompiler, connection: BaseDatabaseWrapper, **extra_context: Any @@ -193,7 +209,7 @@ class Perimeter(DistanceResultMixin, OracleToleranceMixin, GeoFunc): @override def as_sqlite(self, compiler: SQLCompiler, connection: BaseDatabaseWrapper, **extra_context: Any) -> _AsSqlType: ... -class PointOnSurface(OracleToleranceMixin, GeomOutputGeoFunc): +class PointOnSurface(OracleToleranceMixin, GeomOutputGeoFunc): # type: ignore[misc] arity: int class Reverse(GeoFunc): @@ -202,13 +218,13 @@ class Reverse(GeoFunc): class Rotate(GeomOutputGeoFunc): def __init__(self, expression: Any, angle: Any, origin: Any | None = None, **extra: Any) -> None: ... -class Scale(SQLiteDecimalToFloatMixin, GeomOutputGeoFunc): +class Scale(SQLiteDecimalToFloatMixin, GeomOutputGeoFunc): # type: ignore[misc] def __init__(self, expression: Any, x: Any, y: Any, z: float = 0.0, **extra: Any) -> None: ... -class SnapToGrid(SQLiteDecimalToFloatMixin, GeomOutputGeoFunc): +class SnapToGrid(SQLiteDecimalToFloatMixin, GeomOutputGeoFunc): # type: ignore[misc] def __init__(self, expression: Any, *args: Any, **extra: Any) -> None: ... -class SymDifference(OracleToleranceMixin, GeomOutputGeoFunc): +class SymDifference(OracleToleranceMixin, GeomOutputGeoFunc): # type: ignore[misc] arity: int geom_param_pos: Any @@ -219,6 +235,6 @@ class Translate(Scale): @override def as_sqlite(self, compiler: SQLCompiler, connection: BaseDatabaseWrapper, **extra_context: Any) -> _AsSqlType: ... -class Union(OracleToleranceMixin, GeomOutputGeoFunc): +class Union(OracleToleranceMixin, GeomOutputGeoFunc): # type: ignore[misc] arity: int geom_param_pos: Any diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/models/lookups.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/models/lookups.pyi index 202559447261..843c6515911a 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/models/lookups.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/models/lookups.pyi @@ -1,9 +1,14 @@ +from re import Pattern from typing import Any +from django.db.backends.base.base import BaseDatabaseWrapper from django.db.models import Lookup, Transform +from django.db.models.sql.compiler import SQLCompiler, _AsSqlType from typing_extensions import override -class RasterBandTransform(Transform): ... +class RasterBandTransform(Transform): + @override + def as_sql(self, compiler: SQLCompiler, connection: BaseDatabaseWrapper) -> _AsSqlType: ... # type: ignore[override] class GISLookup(Lookup): sql_template: Any @@ -87,7 +92,7 @@ class OverlapsLookup(GISLookup): class RelateLookup(GISLookup): lookup_name: str sql_template: str - pattern_regex: Any + pattern_regex: Pattern[str] @override def process_rhs(self, compiler: Any, connection: Any) -> Any: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/models/sql/conversion.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/models/sql/conversion.pyi index 448e2389d453..71b12f04b51e 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/models/sql/conversion.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/models/sql/conversion.pyi @@ -1,9 +1,14 @@ from typing import Any from django.db import models -from typing_extensions import override +from typing_extensions import TypeVar, override -class AreaField(models.FloatField): +# __set__ value type +_ST = TypeVar("_ST", contravariant=True) +# __get__ return type +_GT = TypeVar("_GT", covariant=True) + +class AreaField(models.FloatField[_ST, _GT]): geo_field: Any def __init__(self, geo_field: Any) -> None: ... @override @@ -14,7 +19,7 @@ class AreaField(models.FloatField): @override def get_internal_type(self) -> Any: ... -class DistanceField(models.FloatField): +class DistanceField(models.FloatField[_ST, _GT]): geo_field: Any def __init__(self, geo_field: Any) -> None: ... @override diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/feeds.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/feeds.pyi index 6c1c5031781f..f8c74152748e 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/feeds.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/feeds.pyi @@ -21,4 +21,4 @@ class W3CGeoFeed(Rss201rev2Feed, GeoFeedMixin): @override def rss_attributes(self) -> dict[str, str]: ... -class Feed(BaseFeed): ... +class Feed(BaseFeed[Any, 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 bbbe42b20788..86c16f9c2acc 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 @@ -24,7 +24,7 @@ class TransformPoint(list[Sequence[float]]): class GDALRaster(GDALRasterBase): destructor: Any - def __init__(self, ds_input: str | Path | bytes | dict | c_void_p, write: bool = ...) -> None: ... + def __init__(self, ds_input: str | Path | bytes | dict[str, Any] | c_void_p, write: bool = ...) -> None: ... @override def __del__(self) -> None: ... @property diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/sitemaps/kml.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/sitemaps/kml.pyi index e5e34970fc6b..089eaa1bc8c3 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/sitemaps/kml.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/sitemaps/kml.pyi @@ -3,7 +3,7 @@ from typing import Any from django.contrib.sitemaps import Sitemap from typing_extensions import override -class KMLSitemap(Sitemap): +class KMLSitemap(Sitemap[Any]): geo_format: str locations: Any def __init__(self, locations: Any | None = ...) -> None: ... 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 52802df54aa6..e23e0ce55aa8 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 @@ -15,7 +15,7 @@ from .mixins import OrderableAggMixin class ArrayAgg(OrderableAggMixin, Aggregate): @property @override - def output_field(self) -> ArrayField: ... + def output_field(self) -> ArrayField[Any, Any]: ... @override def resolve_expression( self, @@ -33,13 +33,13 @@ class BitOr(Aggregate): ... class BitXor(Aggregate): ... class BoolAnd(Aggregate): - output_field: ClassVar[BooleanField] + output_field: ClassVar[BooleanField[Any, Any]] class BoolOr(Aggregate): - output_field: ClassVar[BooleanField] + output_field: ClassVar[BooleanField[Any, Any]] class JSONBAgg(OrderableAggMixin, Aggregate): - output_field: ClassVar[JSONField] + output_field: ClassVar[JSONField[Any, Any]] @override def resolve_expression( self, @@ -53,7 +53,7 @@ class JSONBAgg(OrderableAggMixin, Aggregate): def as_sql(self, compiler: SQLCompiler, connection: BaseDatabaseWrapper) -> _AsSqlType: ... # type: ignore[override] class StringAgg(OrderableAggMixin, Aggregate): - output_field: ClassVar[TextField] + output_field: ClassVar[TextField[Any, Any]] def __init__( self, expression: BaseExpression | Combinable | str, diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/postgres/aggregates/statistics.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/postgres/aggregates/statistics.pyi index 38f6381ebdb6..86c1780ccff0 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/contrib/postgres/aggregates/statistics.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/postgres/aggregates/statistics.pyi @@ -3,7 +3,7 @@ from typing import Any, ClassVar from django.db.models import Aggregate, FloatField, IntegerField class StatAggregate(Aggregate): - output_field: ClassVar[FloatField] + output_field: ClassVar[FloatField[Any, Any]] def __init__( self, y: Any, x: Any, output_field: Any | None = ..., filter: Any | None = ..., default: Any | None = ... ) -> None: ... @@ -19,7 +19,7 @@ class RegrAvgX(StatAggregate): ... class RegrAvgY(StatAggregate): ... class RegrCount(StatAggregate): - output_field: ClassVar[IntegerField] # type: ignore[assignment] + output_field: ClassVar[IntegerField[Any, Any]] # type: ignore[assignment] class RegrIntercept(StatAggregate): ... class RegrR2(StatAggregate): ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/postgres/expressions.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/postgres/expressions.pyi index 634108d6e644..9c75ca35ea68 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/contrib/postgres/expressions.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/postgres/expressions.pyi @@ -13,4 +13,4 @@ class ArraySubquery(Subquery): def __init__(self, queryset: Query | QuerySet[Any] | Subquery, **kwargs: Any) -> None: ... @cached_property @override - def output_field(self) -> ArrayField: ... + def output_field(self) -> ArrayField[Any, Any]: ... 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 8dd3f0fee38a..a4051b4199ea 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 @@ -16,9 +16,9 @@ from django.utils.functional import _StrOrPromise from typing_extensions import TypeVar, override # __set__ value type -_ST = TypeVar("_ST") +_ST = TypeVar("_ST", contravariant=True) # __get__ return type -_GT = TypeVar("_GT") +_GT = TypeVar("_GT", covariant=True) class ArrayField(CheckPostgresInstalledMixin, CheckFieldDefaultMixin, Field[_ST, _GT]): _pyi_private_set_type: Sequence[Any] | Combinable @@ -26,13 +26,13 @@ class ArrayField(CheckPostgresInstalledMixin, CheckFieldDefaultMixin, Field[_ST, empty_strings_allowed: bool default_error_messages: ClassVar[_ErrorMessagesDict] - base_field: Field + base_field: Field[Any, Any] size: int | None default_validators: list[_ValidatorCallable] from_db_value: Any def __init__( self, - base_field: Field, + base_field: Field[Any, Any], size: int | None = None, *, verbose_name: _StrOrPromise | None = ..., diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/postgres/fields/citext.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/postgres/fields/citext.pyi index 80b16118e89d..65aeaa4a31d4 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/contrib/postgres/fields/citext.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/postgres/fields/citext.pyi @@ -1,7 +1,13 @@ from django.db.models.fields import CharField, EmailField, TextField +from typing_extensions import TypeVar -class CICharField(CharField): ... -class CIEmailField(EmailField): ... -class CITextField(TextField): ... +# __set__ value type +_ST = TypeVar("_ST", contravariant=True) +# __get__ return type +_GT = TypeVar("_GT", covariant=True) + +class CICharField(CharField[_ST, _GT]): ... +class CIEmailField(EmailField[_ST, _GT]): ... +class CITextField(TextField[_ST, _GT]): ... __all__ = ["CICharField", "CIEmailField", "CITextField"] diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/postgres/fields/hstore.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/postgres/fields/hstore.pyi index 5f11b320b428..565456d86fb3 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/contrib/postgres/fields/hstore.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/postgres/fields/hstore.pyi @@ -13,7 +13,7 @@ class HStoreField(CheckPostgresInstalledMixin, CheckFieldDefaultMixin, Field[Any def get_transform(self, name: str) -> Any: ... class KeyTransform(Transform): - output_field: ClassVar[TextField] + output_field: ClassVar[TextField[Any, Any]] def __init__(self, key_name: str, *args: Any, **kwargs: Any) -> None: ... @override @@ -24,9 +24,9 @@ class KeyTransformFactory: def __call__(self, *args: Any, **kwargs: Any) -> KeyTransform: ... class KeysTransform(Transform): - output_field: ClassVar[ArrayField] + output_field: ClassVar[ArrayField[Any, Any]] class ValuesTransform(Transform): - output_field: ClassVar[ArrayField] + output_field: ClassVar[ArrayField[Any, Any]] __all__ = ["HStoreField"] 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 88194bdeb63b..2fab488994d8 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 @@ -31,7 +31,7 @@ _RangeT = TypeVar("_RangeT", bound=Range[Any]) class RangeField(CheckPostgresInstalledMixin, models.Field[Any, _RangeT]): empty_strings_allowed: bool - base_field: type[models.Field] + base_field: type[models.Field[Any, Any]] range_type: type[_RangeT] def get_placeholder(self, value: Unused, compiler: Unused, connection: BaseDatabaseWrapper) -> str: ... @override @@ -46,23 +46,23 @@ class ContinuousRangeField(RangeField[_RangeT]): def __init__(self, *args: Any, default_bounds: str = "[)", **kwargs: Any) -> None: ... class IntegerRangeField(RangeField[NumericRange]): - base_field: type[models.IntegerField] + base_field: type[models.IntegerField[Any, Any]] form_field: type[forms.IntegerRangeField] class BigIntegerRangeField(RangeField[NumericRange]): - base_field: type[models.BigIntegerField] + base_field: type[models.BigIntegerField[Any, Any]] form_field: type[forms.IntegerRangeField] class DecimalRangeField(ContinuousRangeField[NumericRange]): - base_field: type[models.DecimalField] + base_field: type[models.DecimalField[Any, Any]] form_field: type[forms.DecimalRangeField] class DateTimeRangeField(ContinuousRangeField[DateTimeTZRange]): - base_field: type[models.DateTimeField] + base_field: type[models.DateTimeField[Any, Any]] form_field: type[forms.DateTimeRangeField] class DateRangeField(RangeField[DateRange]): - base_field: type[models.DateField] + base_field: type[models.DateField[Any, Any]] form_field: type[forms.DateRangeField] class DateTimeRangeContains(PostgresOperatorLookup): ... @@ -81,27 +81,27 @@ class AdjacentToLookup(PostgresOperatorLookup): ... class RangeStartsWith(models.Transform): @property @override - def output_field(self) -> models.Field: ... + def output_field(self) -> models.Field[Any, Any]: ... class RangeEndsWith(models.Transform): @property @override - def output_field(self) -> models.Field: ... + def output_field(self) -> models.Field[Any, Any]: ... class IsEmpty(models.Transform): - output_field: ClassVar[models.BooleanField] + output_field: ClassVar[models.BooleanField[Any, Any]] class LowerInclusive(models.Transform): - output_field: ClassVar[models.BooleanField] + output_field: ClassVar[models.BooleanField[Any, Any]] class LowerInfinite(models.Transform): - output_field: ClassVar[models.BooleanField] + output_field: ClassVar[models.BooleanField[Any, Any]] class UpperInclusive(models.Transform): - output_field: ClassVar[models.BooleanField] + output_field: ClassVar[models.BooleanField[Any, Any]] class UpperInfinite(models.Transform): - output_field: ClassVar[models.BooleanField] + output_field: ClassVar[models.BooleanField[Any, Any]] __all__ = [ "BigIntegerRangeField", diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/postgres/functions.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/postgres/functions.pyi index 2d957735d7a5..bc5d27481379 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/contrib/postgres/functions.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/postgres/functions.pyi @@ -1,9 +1,9 @@ -from typing import ClassVar +from typing import Any, ClassVar from django.db.models import DateTimeField, Func, UUIDField class RandomUUID(Func): - output_field: ClassVar[UUIDField] + output_field: ClassVar[UUIDField[Any, Any]] class TransactionNow(Func): - output_field: ClassVar[DateTimeField] + output_field: ClassVar[DateTimeField[Any, Any]] 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 6f9689493171..083ffe2d1a62 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 @@ -7,12 +7,17 @@ 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, override +from typing_extensions import Self, TypeVar, override from .utils import CheckPostgresInstalledMixin _Expression: TypeAlias = str | Combinable | SearchQueryCombinable +# __set__ value type +_ST = TypeVar("_ST", contravariant=True) +# __get__ return type +_GT = TypeVar("_GT", covariant=True) + class UTF8Dumper(Dumper): @override def dump(self, obj: object) -> bytes: ... @@ -31,8 +36,8 @@ class SearchVectorExact(Lookup): @override def as_sql(self, qn: SQLCompiler, connection: BaseDatabaseWrapper) -> _AsSqlType: ... -class SearchVectorField(CheckPostgresInstalledMixin, Field[Any, Any]): ... -class SearchQueryField(CheckPostgresInstalledMixin, Field[Any, Any]): ... +class SearchVectorField(CheckPostgresInstalledMixin, Field[_ST, _GT]): ... +class SearchQueryField(CheckPostgresInstalledMixin, Field[_ST, _GT]): ... class SearchConfig(Expression): config: _Expression | None @@ -47,7 +52,7 @@ class SearchVector(SearchVectorCombinable, Func): config: _Expression | None function: str arg_joiner: str - output_field: ClassVar[SearchVectorField] + output_field: ClassVar[SearchVectorField[Any, Any]] def __init__( self, *expressions: _Expression, config: _Expression | None = None, weight: Any | None = None ) -> None: ... @@ -79,7 +84,7 @@ class SearchQueryCombinable: def __rand__(self, other: SearchQueryCombinable) -> Self: ... class SearchQuery(SearchQueryCombinable, Func): # type: ignore[misc] - output_field: ClassVar[SearchQueryField] + output_field: ClassVar[SearchQueryField[Any, Any]] SEARCH_TYPES: dict[str, str] def __init__( self, @@ -112,7 +117,7 @@ class CombinedSearchQuery(SearchQueryCombinable, CombinedExpression): # type: i ) -> None: ... class SearchRank(Func): - output_field: ClassVar[FloatField] + output_field: ClassVar[FloatField[Any, Any]] def __init__( self, vector: SearchVector | _Expression, @@ -125,7 +130,7 @@ class SearchRank(Func): class SearchHeadline(Func): function: str template: str - output_field: ClassVar[TextField] + output_field: ClassVar[TextField[Any, Any]] def __init__( self, expression: _Expression, @@ -151,11 +156,11 @@ class SearchHeadline(Func): ) -> _AsSqlType: ... class TrigramBase(Func): - output_field: ClassVar[FloatField] + output_field: ClassVar[FloatField[Any, Any]] def __init__(self, expression: _Expression, string: str, **extra: Any) -> None: ... class TrigramWordBase(Func): - output_field: ClassVar[FloatField] + output_field: ClassVar[FloatField[Any, Any]] def __init__(self, string: str, expression: _Expression, **extra: Any) -> None: ... class TrigramSimilarity(TrigramBase): ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/redirects/admin.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/redirects/admin.pyi index cf79e30f8610..601163a2da89 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/contrib/redirects/admin.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/redirects/admin.pyi @@ -1,8 +1,9 @@ from typing import Any, ClassVar from django.contrib import admin +from django.contrib.redirects.models import Redirect -class RedirectAdmin(admin.ModelAdmin): +class RedirectAdmin(admin.ModelAdmin[Redirect]): list_display: Any list_filter: ClassVar[Any] search_fields: ClassVar[Any] diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/redirects/models.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/redirects/models.pyi index 444960881d91..e5c6e090d71c 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/contrib/redirects/models.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/redirects/models.pyi @@ -1,6 +1,8 @@ +from django.contrib.sites.models import Site from django.db import models +from django.db.models.expressions import Combinable class Redirect(models.Model): - site: models.ForeignKey - old_path: models.CharField - new_path: models.CharField + site: models.ForeignKey[Site | Combinable, Site] + old_path: models.CharField[str | int | Combinable, str] + new_path: models.CharField[str | int | Combinable, str] 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 7881554920dc..f4ac8bd4970b 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,20 +1,21 @@ -from datetime import datetime +import datetime as dt from typing import Any, ClassVar 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 _T = TypeVar("_T", bound=AbstractBaseSession) class BaseSessionManager(models.Manager[_T]): def encode(self, session_dict: dict[str, Any]) -> str: ... - def save(self, session_key: str, session_dict: dict[str, Any], expire_date: datetime) -> _T: ... + def save(self, session_key: str, session_dict: dict[str, Any], expire_date: dt.datetime) -> _T: ... class AbstractBaseSession(models.Model): - session_key = models.CharField(primary_key=True) - session_data = models.TextField() - expire_date = models.DateTimeField() + session_key: models.CharField[str | int | Combinable, str] + session_data: models.TextField[str | Combinable, str] + expire_date: models.DateTimeField[str | dt.datetime | dt.date | Combinable, dt.datetime] objects: ClassVar[BaseSessionManager[Self]] class Meta: diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/sitemaps/__init__.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/sitemaps/__init__.pyi index a3d635b88e5f..94b7b7e59fa8 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/contrib/sitemaps/__init__.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/sitemaps/__init__.pyi @@ -21,7 +21,7 @@ class Sitemap(Generic[_ItemT]): def items(self) -> Iterable[_ItemT]: ... def location(self, item: _ItemT) -> str: ... @property - def paginator(self) -> Paginator: ... + def paginator(self) -> Paginator[_ItemT]: ... def get_languages_for_item(self, item: _ItemT) -> list[str]: ... def get_protocol(self, protocol: str | None = None) -> str: ... def get_domain(self, site: Site | RequestSite | None = None) -> str: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/sitemaps/views.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/sitemaps/views.pyi index 859c033233f3..8586810a1565 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/contrib/sitemaps/views.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/sitemaps/views.pyi @@ -1,12 +1,13 @@ from collections.abc import Callable from dataclasses import dataclass +from typing import Any from django.contrib.sitemaps import Sitemap from django.http.request import HttpRequest from django.template.response import TemplateResponse from typing_extensions import TypeVar -_C = TypeVar("_C", bound=Callable) +_C = TypeVar("_C", bound=Callable[..., Any]) @dataclass class SitemapIndexItem: @@ -16,14 +17,14 @@ class SitemapIndexItem: def x_robots_tag(func: _C) -> _C: ... def index( request: HttpRequest, - sitemaps: dict[str, type[Sitemap] | Sitemap], + sitemaps: dict[str, type[Sitemap[Any]] | Sitemap[Any]], template_name: str = ..., content_type: str = ..., sitemap_url_name: str = ..., ) -> TemplateResponse: ... def sitemap( request: HttpRequest, - sitemaps: dict[str, type[Sitemap] | Sitemap], + sitemaps: dict[str, type[Sitemap[Any]] | Sitemap[Any]], section: str | None = ..., template_name: str = ..., content_type: str = ..., diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/sites/admin.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/sites/admin.pyi index 9c4ad46f9fc8..177061b96d6a 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/contrib/sites/admin.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/sites/admin.pyi @@ -1,7 +1,8 @@ from typing import Any, ClassVar from django.contrib import admin +from django.contrib.sites.models import Site -class SiteAdmin(admin.ModelAdmin): +class SiteAdmin(admin.ModelAdmin[Site]): list_display: Any search_fields: ClassVar[Any] diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/sites/checks.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/sites/checks.pyi index 1f1334606723..f0b58a952a90 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/contrib/sites/checks.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/sites/checks.pyi @@ -1,7 +1,6 @@ from collections.abc import Sequence -from typing import Any from django.apps.config import AppConfig -from django.core.checks.messages import Error +from django.core.checks.messages import CheckMessage -def check_site_id(app_configs: Sequence[AppConfig] | None, **kwargs: Any) -> list[Error]: ... +def check_site_id(app_configs: Sequence[AppConfig] | None, **kwargs: object) -> list[CheckMessage]: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/sites/models.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/sites/models.pyi index e4181d66f5f4..8ba7992fe7fd 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/contrib/sites/models.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/sites/models.pyi @@ -1,6 +1,7 @@ from typing import Any, ClassVar from django.db import models +from django.db.models.expressions import Combinable from django.http.request import HttpRequest SITE_CACHE: Any @@ -13,8 +14,8 @@ class SiteManager(models.Manager[Site]): class Site(models.Model): objects: ClassVar[SiteManager] - domain = models.CharField(max_length=100) - name = models.CharField(max_length=50) + domain: models.CharField[str | int | Combinable, str] + name: models.CharField[str | int | Combinable, str] def natural_key(self) -> tuple[str]: ... def clear_site_cache(sender: type[Site], **kwargs: Any) -> None: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/staticfiles/checks.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/staticfiles/checks.pyi index 73c9500c27ce..954465f95aa9 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/contrib/staticfiles/checks.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/staticfiles/checks.pyi @@ -1,10 +1,9 @@ from collections.abc import Sequence -from typing import Any from django.apps.config import AppConfig from django.core.checks.messages import CheckMessage, Error E005: Error -def check_finders(app_configs: Sequence[AppConfig] | None, **kwargs: Any) -> list[CheckMessage]: ... -def check_storages(app_configs: Sequence[AppConfig] | None, **kwargs: Any) -> list[CheckMessage]: ... +def check_finders(app_configs: Sequence[AppConfig] | None, **kwargs: object) -> list[CheckMessage]: ... +def check_storages(app_configs: Sequence[AppConfig] | None, **kwargs: object) -> list[CheckMessage]: ... 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 0a22f2345891..414aeea2c881 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 @@ -2,9 +2,9 @@ from collections.abc import Callable, Iterator from re import Match from typing import Any, TypeAlias +from _typeshed import StrPath from django.core.files.base import File from django.core.files.storage import FileSystemStorage, Storage -from django.utils._os import _PathCompatible from django.utils.functional import LazyObject from typing_extensions import override @@ -12,10 +12,10 @@ _PostProcessT: TypeAlias = Iterator[tuple[str, str, bool] | tuple[str, None, Run class StaticFilesStorage(FileSystemStorage): def __init__( - self, location: _PathCompatible | None = None, base_url: str | None = None, *args: Any, **kwargs: Any + self, location: StrPath | None = None, base_url: str | None = None, *args: Any, **kwargs: Any ) -> None: ... @override - def path(self, name: _PathCompatible) -> str: ... + def path(self, name: StrPath) -> str: ... class HashedFilesMixin: default_template: str @@ -25,12 +25,12 @@ class HashedFilesMixin: hashed_files: Any keep_intermediate_files: bool def __init__(self, *args: Any, **kwargs: Any) -> None: ... - def file_hash(self, name: str, content: File | None = None) -> str | None: ... - def hashed_name(self, name: str, content: File | None = None, filename: str | None = None) -> str: ... + 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 url_converter( self, name: str, hashed_files: dict[str, Any], template: str | None = None - ) -> Callable[[Match], str]: ... + ) -> 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: ... def hash_key(self, name: str) -> str: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/core/cache/backends/base.pyi b/python/helpers/bundled_stubs/Django/django-stubs/core/cache/backends/base.pyi index c87be3333bc2..8ae170e7c0b0 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/core/cache/backends/base.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/core/cache/backends/base.pyi @@ -12,7 +12,7 @@ DEFAULT_TIMEOUT: Any MEMCACHE_MAX_KEY_LENGTH: int def default_key_func(key: Any, key_prefix: str, version: Any) -> str: ... -def get_key_func(key_func: Callable | str | None) -> Callable: ... +def get_key_func(key_func: Callable[..., Any] | str | None) -> Callable[..., Any]: ... class BaseCache: _missing_key: object @@ -21,7 +21,7 @@ class BaseCache: _cull_frequency: int key_prefix: str version: int - key_func: Callable + key_func: Callable[..., Any] def __init__(self, params: dict[str, Any]) -> None: ... def get_backend_timeout(self, timeout: float | None = ...) -> float | None: ... def make_key(self, key: Any, version: int | None = None) -> str: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/core/cache/backends/redis.pyi b/python/helpers/bundled_stubs/Django/django-stubs/core/cache/backends/redis.pyi index e1a80909ed10..ec77dd8c8edc 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/core/cache/backends/redis.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/core/cache/backends/redis.pyi @@ -38,7 +38,7 @@ class RedisCacheClient: parser_class: str | type[BaseParser] | None = None, **options: Any, ) -> None: ... - def get_client(self, key: _Key | None = None, *, write: bool = False) -> Redis: ... + def get_client(self, key: _Key | None = None, *, write: bool = False) -> Redis[Any]: ... def add(self, key: _Key, value: Any, timeout: _Expiry | None) -> bool: ... def get(self, key: _Key, default: Any) -> Any: ... def set(self, key: _Key, value: Any, timeout: _Expiry | None) -> None: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/core/checks/async_checks.pyi b/python/helpers/bundled_stubs/Django/django-stubs/core/checks/async_checks.pyi index d0142558d2bc..9fc79ace43d5 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/core/checks/async_checks.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/core/checks/async_checks.pyi @@ -1,9 +1,8 @@ from collections.abc import Sequence -from typing import Any from django.apps.config import AppConfig -from django.core.checks.messages import Error +from django.core.checks.messages import CheckMessage, Error E001: Error -def check_async_unsafe(app_configs: Sequence[AppConfig] | None, **kwargs: Any) -> list[Error]: ... +def check_async_unsafe(app_configs: Sequence[AppConfig] | None, **kwargs: object) -> list[CheckMessage]: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/core/checks/caches.pyi b/python/helpers/bundled_stubs/Django/django-stubs/core/checks/caches.pyi index 085fd9254690..944151827b1f 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/core/checks/caches.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/core/checks/caches.pyi @@ -1,11 +1,16 @@ from collections.abc import Sequence -from typing import Any from django.apps.config import AppConfig -from django.core.checks.messages import Error, Warning +from django.core.checks.messages import CheckMessage, Error E001: Error -def check_default_cache_is_configured(app_configs: Sequence[AppConfig] | None, **kwargs: Any) -> list[Error]: ... -def check_cache_location_not_exposed(app_configs: Sequence[AppConfig] | None, **kwargs: Any) -> list[Warning]: ... -def check_file_based_cache_is_absolute(app_configs: Sequence[AppConfig] | None, **kwargs: Any) -> list[Warning]: ... +def check_default_cache_is_configured( + app_configs: Sequence[AppConfig] | None, **kwargs: object +) -> list[CheckMessage]: ... +def check_cache_location_not_exposed( + app_configs: Sequence[AppConfig] | None, **kwargs: object +) -> list[CheckMessage]: ... +def check_file_based_cache_is_absolute( + app_configs: Sequence[AppConfig] | None, **kwargs: object +) -> list[CheckMessage]: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/core/checks/commands.pyi b/python/helpers/bundled_stubs/Django/django-stubs/core/checks/commands.pyi index 1fb1e47c6298..79e425089f6e 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/core/checks/commands.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/core/checks/commands.pyi @@ -1,5 +1,3 @@ -from typing import Any +from django.core.checks.messages import CheckMessage -from django.core.checks.messages import Error - -def migrate_and_makemigrations_autodetector(**kwargs: Any) -> list[Error]: ... +def migrate_and_makemigrations_autodetector(**kwargs: object) -> list[CheckMessage]: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/core/checks/compatibility/django_4_0.pyi b/python/helpers/bundled_stubs/Django/django-stubs/core/checks/compatibility/django_4_0.pyi index bb1d355bd283..1ee402dad5b2 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/core/checks/compatibility/django_4_0.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/core/checks/compatibility/django_4_0.pyi @@ -1,7 +1,6 @@ from collections.abc import Sequence -from typing import Any from django.apps.config import AppConfig -from django.core.checks.messages import Error +from django.core.checks.messages import CheckMessage -def check_csrf_trusted_origins(app_configs: Sequence[AppConfig] | None, **kwargs: Any) -> list[Error]: ... +def check_csrf_trusted_origins(app_configs: Sequence[AppConfig] | None, **kwargs: object) -> list[CheckMessage]: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/core/checks/database.pyi b/python/helpers/bundled_stubs/Django/django-stubs/core/checks/database.pyi index 3a193dd9a3d4..8c92bf31a5b6 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/core/checks/database.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/core/checks/database.pyi @@ -1,6 +1,5 @@ from collections.abc import Iterable -from typing import Any from django.core.checks import CheckMessage -def check_database_backends(databases: Iterable[str] | None = None, **kwargs: Any) -> list[CheckMessage]: ... +def check_database_backends(databases: Iterable[str] | None = None, **kwargs: object) -> list[CheckMessage]: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/core/checks/files.pyi b/python/helpers/bundled_stubs/Django/django-stubs/core/checks/files.pyi index be604c2eca84..f703ea1baaf4 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/core/checks/files.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/core/checks/files.pyi @@ -1,7 +1,8 @@ from collections.abc import Sequence -from typing import Any from django.apps.config import AppConfig -from django.core.checks.messages import Error +from django.core.checks.messages import CheckMessage -def check_setting_file_upload_temp_dir(app_configs: Sequence[AppConfig] | None, **kwargs: Any) -> list[Error]: ... +def check_setting_file_upload_temp_dir( + app_configs: Sequence[AppConfig] | None, **kwargs: object +) -> list[CheckMessage]: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/core/checks/model_checks.pyi b/python/helpers/bundled_stubs/Django/django-stubs/core/checks/model_checks.pyi index 3d935d2d4fc8..1e66a7d12dba 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/core/checks/model_checks.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/core/checks/model_checks.pyi @@ -1,8 +1,7 @@ from collections.abc import Sequence -from typing import Any from django.apps.config import AppConfig from django.core.checks.messages import CheckMessage -def check_all_models(app_configs: Sequence[AppConfig] | None, **kwargs: Any) -> list[CheckMessage]: ... -def check_lazy_references(app_configs: Sequence[AppConfig] | None, **kwargs: Any) -> list[CheckMessage]: ... +def check_all_models(app_configs: Sequence[AppConfig] | None, **kwargs: object) -> list[CheckMessage]: ... +def check_lazy_references(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 5d18c4f0ef0b..8d7806061115 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 @@ -40,8 +40,8 @@ class _ProcessedCheckCallable(Protocol[_C]): __call__: _C class CheckRegistry: - registered_checks: set[_ProcessedCheckCallable] - deployment_checks: set[_ProcessedCheckCallable] + registered_checks: set[_ProcessedCheckCallable[_CheckCallable]] + deployment_checks: set[_ProcessedCheckCallable[_CheckCallable]] def __init__(self) -> None: ... @overload def register(self, check: _C, *tags: str, **kwargs: Any) -> _ProcessedCheckCallable[_C]: ... @@ -58,7 +58,7 @@ class CheckRegistry: ) -> list[CheckMessage]: ... def tag_exists(self, tag: str, include_deployment_checks: bool = False) -> bool: ... def tags_available(self, deployment_checks: bool = False) -> set[str]: ... - def get_checks(self, include_deployment_checks: bool = False) -> list[_ProcessedCheckCallable]: ... + def get_checks(self, include_deployment_checks: bool = False) -> list[_ProcessedCheckCallable[_CheckCallable]]: ... registry: CheckRegistry = ... register = registry.register 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 561d2a9be8c2..733d10531d99 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 @@ -1,8 +1,7 @@ from collections.abc import Sequence -from typing import Any from django.apps.config import AppConfig -from django.core.checks.messages import Error, Warning +from django.core.checks.messages import CheckMessage, Error, Warning CROSS_ORIGIN_OPENER_POLICY_VALUES: set[str] REFERRER_POLICY_VALUES: set[str] @@ -27,18 +26,22 @@ E024: Error W025: Warning E026: Error -def check_security_middleware(app_configs: Sequence[AppConfig] | None, **kwargs: Any) -> list[Warning]: ... -def check_xframe_options_middleware(app_configs: Sequence[AppConfig] | None, **kwargs: Any) -> list[Warning]: ... -def check_sts(app_configs: Sequence[AppConfig] | None, **kwargs: Any) -> list[Warning]: ... -def check_sts_include_subdomains(app_configs: Sequence[AppConfig] | None, **kwargs: Any) -> list[Warning]: ... -def check_sts_preload(app_configs: Sequence[AppConfig] | None, **kwargs: Any) -> list[Warning]: ... -def check_content_type_nosniff(app_configs: Sequence[AppConfig] | None, **kwargs: Any) -> list[Warning]: ... -def check_ssl_redirect(app_configs: Sequence[AppConfig] | None, **kwargs: Any) -> list[Warning]: ... -def check_secret_key(app_configs: Sequence[AppConfig] | None, **kwargs: Any) -> list[Warning]: ... -def check_secret_key_fallbacks(app_configs: Sequence[AppConfig] | None, **kwargs: Any) -> list[Warning]: ... -def check_debug(app_configs: Sequence[AppConfig] | None, **kwargs: Any) -> list[Warning]: ... -def check_xframe_deny(app_configs: Sequence[AppConfig] | None, **kwargs: Any) -> list[Warning]: ... -def check_allowed_hosts(app_configs: Sequence[AppConfig] | None, **kwargs: Any) -> list[Warning]: ... -def check_referrer_policy(app_configs: Sequence[AppConfig] | None, **kwargs: Any) -> list[Warning | Error]: ... -def check_cross_origin_opener_policy(app_configs: Sequence[AppConfig] | None, **kwargs: Any) -> list[Error]: ... -def check_csp_settings(app_configs: Sequence[AppConfig] | None, **kwargs: Any) -> list[Error]: ... +def check_security_middleware(app_configs: Sequence[AppConfig] | None, **kwargs: object) -> list[CheckMessage]: ... +def check_xframe_options_middleware( + app_configs: Sequence[AppConfig] | None, **kwargs: object +) -> list[CheckMessage]: ... +def check_sts(app_configs: Sequence[AppConfig] | None, **kwargs: object) -> list[CheckMessage]: ... +def check_sts_include_subdomains(app_configs: Sequence[AppConfig] | None, **kwargs: object) -> list[CheckMessage]: ... +def check_sts_preload(app_configs: Sequence[AppConfig] | None, **kwargs: object) -> list[CheckMessage]: ... +def check_content_type_nosniff(app_configs: Sequence[AppConfig] | None, **kwargs: object) -> list[CheckMessage]: ... +def check_ssl_redirect(app_configs: Sequence[AppConfig] | None, **kwargs: object) -> list[CheckMessage]: ... +def check_secret_key(app_configs: Sequence[AppConfig] | None, **kwargs: object) -> list[CheckMessage]: ... +def check_secret_key_fallbacks(app_configs: Sequence[AppConfig] | None, **kwargs: object) -> list[CheckMessage]: ... +def check_debug(app_configs: Sequence[AppConfig] | None, **kwargs: object) -> list[CheckMessage]: ... +def check_xframe_deny(app_configs: Sequence[AppConfig] | None, **kwargs: object) -> list[CheckMessage]: ... +def check_allowed_hosts(app_configs: Sequence[AppConfig] | None, **kwargs: object) -> list[CheckMessage]: ... +def check_referrer_policy(app_configs: Sequence[AppConfig] | None, **kwargs: object) -> list[CheckMessage]: ... +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]: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/core/checks/security/csrf.pyi b/python/helpers/bundled_stubs/Django/django-stubs/core/checks/security/csrf.pyi index c72f19d66610..662d96e8118f 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/core/checks/security/csrf.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/core/checks/security/csrf.pyi @@ -1,12 +1,11 @@ from collections.abc import Sequence -from typing import Any from django.apps.config import AppConfig -from django.core.checks.messages import Error, Warning +from django.core.checks.messages import CheckMessage, Warning W003: Warning W016: Warning -def check_csrf_middleware(app_configs: Sequence[AppConfig] | None, **kwargs: Any) -> list[Warning]: ... -def check_csrf_cookie_secure(app_configs: Sequence[AppConfig] | None, **kwargs: Any) -> list[Warning]: ... -def check_csrf_failure_view(app_configs: Sequence[AppConfig] | None, **kwargs: Any) -> list[Error]: ... +def check_csrf_middleware(app_configs: Sequence[AppConfig] | None, **kwargs: object) -> list[CheckMessage]: ... +def check_csrf_cookie_secure(app_configs: Sequence[AppConfig] | None, **kwargs: object) -> list[CheckMessage]: ... +def check_csrf_failure_view(app_configs: Sequence[AppConfig] | None, **kwargs: object) -> list[CheckMessage]: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/core/checks/security/sessions.pyi b/python/helpers/bundled_stubs/Django/django-stubs/core/checks/security/sessions.pyi index e21ebb8b6338..a206e560ee7b 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/core/checks/security/sessions.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/core/checks/security/sessions.pyi @@ -1,8 +1,7 @@ from collections.abc import Sequence -from typing import Any from django.apps.config import AppConfig -from django.core.checks.messages import Warning +from django.core.checks.messages import CheckMessage, Warning def add_session_cookie_message(message: str) -> str: ... @@ -16,5 +15,5 @@ W013: Warning W014: Warning W015: Warning -def check_session_cookie_secure(app_configs: Sequence[AppConfig] | None, **kwargs: Any) -> list[Warning]: ... -def check_session_cookie_httponly(app_configs: Sequence[AppConfig] | None, **kwargs: Any) -> list[Warning]: ... +def check_session_cookie_secure(app_configs: Sequence[AppConfig] | None, **kwargs: object) -> list[CheckMessage]: ... +def check_session_cookie_httponly(app_configs: Sequence[AppConfig] | None, **kwargs: object) -> list[CheckMessage]: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/core/checks/templates.pyi b/python/helpers/bundled_stubs/Django/django-stubs/core/checks/templates.pyi index 1c3aeaf02360..c1d2a7cdbc54 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/core/checks/templates.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/core/checks/templates.pyi @@ -1,7 +1,6 @@ from collections.abc import Sequence -from typing import Any from django.apps.config import AppConfig from django.core.checks.messages import CheckMessage -def check_templates(app_configs: Sequence[AppConfig] | None, **kwargs: Any) -> list[CheckMessage]: ... +def check_templates(app_configs: Sequence[AppConfig] | None, **kwargs: object) -> list[CheckMessage]: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/core/checks/translation.pyi b/python/helpers/bundled_stubs/Django/django-stubs/core/checks/translation.pyi index d773366cdac5..16d31dfe5f63 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/core/checks/translation.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/core/checks/translation.pyi @@ -1,16 +1,16 @@ from collections.abc import Sequence -from typing import Any from django.apps.config import AppConfig - -from . import Error +from django.core.checks.messages import CheckMessage, Error E001: Error E002: Error E003: Error E004: Error -def check_setting_language_code(app_configs: Sequence[AppConfig] | None, **kwargs: Any) -> list[Error]: ... -def check_setting_languages(app_configs: Sequence[AppConfig] | None, **kwargs: Any) -> list[Error]: ... -def check_setting_languages_bidi(app_configs: Sequence[AppConfig] | None, **kwargs: Any) -> list[Error]: ... -def check_language_settings_consistent(app_configs: Sequence[AppConfig] | None, **kwargs: Any) -> list[Error]: ... +def check_setting_language_code(app_configs: Sequence[AppConfig] | None, **kwargs: object) -> list[CheckMessage]: ... +def check_setting_languages(app_configs: Sequence[AppConfig] | None, **kwargs: object) -> list[CheckMessage]: ... +def check_setting_languages_bidi(app_configs: Sequence[AppConfig] | None, **kwargs: object) -> list[CheckMessage]: ... +def check_language_settings_consistent( + app_configs: Sequence[AppConfig] | None, **kwargs: object +) -> list[CheckMessage]: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/core/checks/urls.pyi b/python/helpers/bundled_stubs/Django/django-stubs/core/checks/urls.pyi index d5b28a59bcee..3f9cf76208f7 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/core/checks/urls.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/core/checks/urls.pyi @@ -2,13 +2,13 @@ from collections.abc import Sequence from typing import Any from django.apps.config import AppConfig -from django.core.checks.messages import CheckMessage, Error, Warning +from django.core.checks.messages import CheckMessage, Error from django.urls import _AnyURL -def check_url_config(app_configs: Sequence[AppConfig] | None, **kwargs: Any) -> list[CheckMessage]: ... +def check_url_config(app_configs: Sequence[AppConfig] | None, **kwargs: object) -> list[CheckMessage]: ... def check_resolver(resolver: _AnyURL) -> list[CheckMessage]: ... -def check_url_namespaces_unique(app_configs: Sequence[AppConfig] | None, **kwargs: Any) -> list[Warning]: ... -def get_warning_for_invalid_pattern(pattern: Any) -> list[Error]: ... -def check_url_settings(app_configs: Sequence[AppConfig] | None, **kwargs: Any) -> list[Error]: ... +def check_url_namespaces_unique(app_configs: Sequence[AppConfig] | None, **kwargs: object) -> list[CheckMessage]: ... +def get_warning_for_invalid_pattern(pattern: Any) -> list[CheckMessage]: ... +def check_url_settings(app_configs: Sequence[AppConfig] | None, **kwargs: object) -> list[CheckMessage]: ... def E006(name: str) -> Error: ... -def check_custom_error_handlers(app_configs: Sequence[AppConfig] | None, **kwargs: Any) -> list[Error]: ... +def check_custom_error_handlers(app_configs: Sequence[AppConfig] | None, **kwargs: object) -> list[CheckMessage]: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/core/files/images.pyi b/python/helpers/bundled_stubs/Django/django-stubs/core/files/images.pyi index 70fe9ace32cf..88378bffee57 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/core/files/images.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/core/files/images.pyi @@ -1,7 +1,7 @@ from typing import IO +from _typeshed import StrPath from django.core.files import File -from django.utils._os import _PathCompatible class ImageFile(File[bytes]): @property @@ -9,6 +9,4 @@ class ImageFile(File[bytes]): @property def height(self) -> int: ... -def get_image_dimensions( - file_or_path: _PathCompatible | IO[bytes], close: bool = False -) -> tuple[int | None, int | None]: ... +def get_image_dimensions(file_or_path: StrPath | IO[bytes], close: bool = False) -> tuple[int | None, int | None]: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/core/files/storage/base.pyi b/python/helpers/bundled_stubs/Django/django-stubs/core/files/storage/base.pyi index b71d968b6617..1b3b10529b6c 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/core/files/storage/base.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/core/files/storage/base.pyi @@ -1,17 +1,17 @@ from datetime import datetime from typing import IO, Any +from _typeshed import StrPath from django.core.files.base import File -from django.utils._os import _PathCompatible class Storage: - def open(self, name: str, mode: str = "rb") -> File: ... + def open(self, name: str, mode: str = "rb") -> File[Any]: ... def save(self, name: str | None, content: IO[Any], max_length: int | None = None) -> str: ... def is_name_available(self, name: str, max_length: int | None = None) -> bool: ... def get_valid_name(self, name: str) -> str: ... def get_alternative_name(self, file_root: str, file_ext: str) -> str: ... def get_available_name(self, name: str, max_length: int | None = None) -> str: ... - def generate_filename(self, filename: _PathCompatible) -> str: ... + def generate_filename(self, filename: StrPath) -> str: ... def path(self, name: str) -> str: ... def delete(self, name: str) -> None: ... def exists(self, name: str) -> bool: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/core/files/storage/filesystem.pyi b/python/helpers/bundled_stubs/Django/django-stubs/core/files/storage/filesystem.pyi index 706e557883c9..499e3b88bf75 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/core/files/storage/filesystem.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/core/files/storage/filesystem.pyi @@ -1,4 +1,4 @@ -from django.utils._os import _PathCompatible +from _typeshed import StrPath from django.utils.deconstruct import _Deconstructible from django.utils.functional import cached_property @@ -8,16 +8,16 @@ from .mixins import StorageSettingsMixin class FileSystemStorage(_Deconstructible, Storage, StorageSettingsMixin): def __init__( self, - location: _PathCompatible | None = None, + location: StrPath | None = None, base_url: str | None = None, file_permissions_mode: int | None = None, directory_permissions_mode: int | None = None, allow_overwrite: bool = False, ) -> None: ... @cached_property - def base_location(self) -> _PathCompatible: ... + def base_location(self) -> StrPath: ... @cached_property - def location(self) -> _PathCompatible: ... + def location(self) -> StrPath: ... @cached_property def base_url(self) -> str: ... @cached_property diff --git a/python/helpers/bundled_stubs/Django/django-stubs/core/files/storage/memory.pyi b/python/helpers/bundled_stubs/Django/django-stubs/core/files/storage/memory.pyi index d6f9d0bc49db..0b56ece63432 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/core/files/storage/memory.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/core/files/storage/memory.pyi @@ -1,4 +1,4 @@ -from django.utils._os import _PathCompatible +from _typeshed import StrPath from django.utils.deconstruct import _Deconstructible from django.utils.functional import cached_property @@ -8,15 +8,15 @@ from .mixins import StorageSettingsMixin class InMemoryStorage(_Deconstructible, Storage, StorageSettingsMixin): def __init__( self, - location: _PathCompatible | None = None, + location: StrPath | None = None, base_url: str | None = None, file_permissions_mode: int | None = None, directory_permissions_mode: int | None = None, ) -> None: ... @cached_property - def base_location(self) -> _PathCompatible: ... + def base_location(self) -> StrPath: ... @cached_property - def location(self) -> _PathCompatible: ... + def location(self) -> StrPath: ... @cached_property def base_url(self) -> str: ... @cached_property 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 9019d2e4748e..fc1d9a48b8b4 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,10 +1,13 @@ -from typing import IO +from typing import IO, Any from django.core.files.base import File from django.utils.functional import cached_property -from typing_extensions import Self, override +from typing_extensions import Self, TypeVar, override -class UploadedFile(File): +# `typing.AnyStr` is deprecated from 3.16+, so we define our own equivalent constrained TypeVar. +_AnyStr = TypeVar("_AnyStr", str, bytes) + +class UploadedFile(File[_AnyStr]): content_type: str | None charset: str | None content_type_extra: dict[str, bytes] | None @@ -14,7 +17,7 @@ class UploadedFile(File): name: str | None def __init__( self, - file: IO | None = None, + file: IO[_AnyStr] | None = None, name: str | None = None, content_type: str | None = None, size: int | None = None, @@ -22,7 +25,7 @@ class UploadedFile(File): content_type_extra: dict[str, bytes] | None = None, ) -> None: ... -class TemporaryUploadedFile(UploadedFile): +class TemporaryUploadedFile(UploadedFile[Any]): def __init__( self, name: str, @@ -33,11 +36,11 @@ class TemporaryUploadedFile(UploadedFile): ) -> None: ... def temporary_file_path(self) -> str: ... -class InMemoryUploadedFile(UploadedFile): +class InMemoryUploadedFile(UploadedFile[Any]): field_name: str | None def __init__( self, - file: IO, + file: IO[Any], field_name: str | None, name: str | None, content_type: str | None, diff --git a/python/helpers/bundled_stubs/Django/django-stubs/core/files/uploadhandler.pyi b/python/helpers/bundled_stubs/Django/django-stubs/core/files/uploadhandler.pyi index 6b61e90cd4b3..b949f3bd4da0 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/core/files/uploadhandler.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/core/files/uploadhandler.pyi @@ -31,7 +31,7 @@ class FileUploadHandler: content_length: int, boundary: str, encoding: str | None = None, - ) -> tuple[QueryDict, MultiValueDict[str, UploadedFile]] | None: ... + ) -> tuple[QueryDict, MultiValueDict[str, UploadedFile[Any]]] | None: ... def new_file( self, field_name: str, @@ -42,7 +42,7 @@ class FileUploadHandler: content_type_extra: dict[str, bytes] | None = None, ) -> None: ... def receive_data_chunk(self, raw_data: bytes, start: int) -> bytes | None: ... - def file_complete(self, file_size: int) -> UploadedFile | None: ... + def file_complete(self, file_size: int) -> UploadedFile[Any] | None: ... def upload_complete(self) -> None: ... def upload_interrupted(self) -> None: ... @@ -61,7 +61,7 @@ class TemporaryFileUploadHandler(FileUploadHandler): @override def receive_data_chunk(self, raw_data: bytes, start: int) -> bytes | None: ... @override - def file_complete(self, file_size: int) -> UploadedFile | None: ... + def file_complete(self, file_size: int) -> UploadedFile[Any] | None: ... @override def upload_interrupted(self) -> None: ... @@ -76,7 +76,7 @@ class MemoryFileUploadHandler(FileUploadHandler): content_length: int, boundary: str, encoding: str | None = None, - ) -> tuple[QueryDict, MultiValueDict[str, UploadedFile]] | None: ... + ) -> tuple[QueryDict, MultiValueDict[str, UploadedFile[Any]]] | None: ... @override def new_file( self, @@ -90,7 +90,7 @@ class MemoryFileUploadHandler(FileUploadHandler): @override def receive_data_chunk(self, raw_data: bytes, start: int) -> bytes | None: ... @override - def file_complete(self, file_size: int) -> UploadedFile | None: ... + def file_complete(self, file_size: int) -> UploadedFile[Any] | None: ... def load_handler(path: str, *args: Any, **kwargs: Any) -> FileUploadHandler: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/core/files/utils.pyi b/python/helpers/bundled_stubs/Django/django-stubs/core/files/utils.pyi index b594cd7b9254..1cf578dac9b0 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/core/files/utils.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/core/files/utils.pyi @@ -1,9 +1,9 @@ from collections.abc import Iterator from typing import IO, Any, AnyStr, Generic -from django.utils._os import _PathCompatible +from _typeshed import StrPath -def validate_file_name(name: _PathCompatible, allow_relative_path: bool = False) -> _PathCompatible: ... +def validate_file_name(name: StrPath, allow_relative_path: bool = False) -> StrPath: ... class FileProxyMixin(Generic[AnyStr]): file: IO[AnyStr] | None diff --git a/python/helpers/bundled_stubs/Django/django-stubs/core/handlers/asgi.pyi b/python/helpers/bundled_stubs/Django/django-stubs/core/handlers/asgi.pyi index 446447daf9d3..d310739eaede 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/core/handlers/asgi.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/core/handlers/asgi.pyi @@ -2,6 +2,7 @@ from collections.abc import Awaitable, Callable, Iterator, Mapping, Sequence from logging import Logger from typing import IO, Any, TypeAlias +from _typeshed import ExcInfo from django.core.files import uploadedfile from django.core.handlers import base from django.http.request import HttpRequest, _ImmutableQueryDict @@ -35,7 +36,7 @@ class ASGIRequest(HttpRequest): POST: _ImmutableQueryDict @property @override - def FILES(self) -> MultiValueDict[str, uploadedfile.UploadedFile]: ... # type: ignore[override] + def FILES(self) -> MultiValueDict[str, uploadedfile.UploadedFile[Any]]: ... # type: ignore[override] @cached_property @override def COOKIES(self) -> dict[str, str]: ... # type: ignore[override] @@ -62,7 +63,7 @@ class ASGIHandler(base.BaseHandler): self, scope: Mapping[str, Any], body_file: IO[bytes] ) -> tuple[ASGIRequest, None] | tuple[None, HttpResponseBase]: ... def handle_uncaught_exception( - self, request: HttpRequest, resolver: URLResolver, exc_info: Any + self, request: HttpRequest, resolver: URLResolver, exc_info: ExcInfo ) -> HttpResponseBase: ... async def send_response(self, response: HttpResponseBase, send: _SendCallback) -> None: ... @classmethod diff --git a/python/helpers/bundled_stubs/Django/django-stubs/core/handlers/exception.pyi b/python/helpers/bundled_stubs/Django/django-stubs/core/handlers/exception.pyi index ea2df1c47507..21e1a814fff6 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/core/handlers/exception.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/core/handlers/exception.pyi @@ -1,6 +1,6 @@ from collections.abc import Awaitable, Callable -from typing import Any +from _typeshed import ExcInfo from django.http.request import HttpRequest from django.http.response import HttpResponse, HttpResponseBase from django.urls.resolvers import URLResolver @@ -12,4 +12,4 @@ def response_for_exception(request: HttpRequest, exc: Exception) -> HttpResponse def get_exception_response( request: HttpRequest, resolver: URLResolver, status_code: int, exception: Exception ) -> HttpResponse: ... -def handle_uncaught_exception(request: HttpRequest, resolver: URLResolver, exc_info: Any) -> HttpResponse: ... +def handle_uncaught_exception(request: HttpRequest, resolver: URLResolver, exc_info: ExcInfo) -> HttpResponse: ... 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 ad0f61fb7e40..7d97b85c9714 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 @@ -35,7 +35,7 @@ class WSGIRequest(HttpRequest): def COOKIES(self) -> dict[str, str]: ... # type: ignore[override] @property @override - def FILES(self) -> MultiValueDict[str, uploadedfile.UploadedFile]: ... # type: ignore[override] + def FILES(self) -> MultiValueDict[str, uploadedfile.UploadedFile[Any]]: ... # type: ignore[override] class WSGIHandler(base.BaseHandler): request_class: type[WSGIRequest] diff --git a/python/helpers/bundled_stubs/Django/django-stubs/core/management/base.pyi b/python/helpers/bundled_stubs/Django/django-stubs/core/management/base.pyi index e550c7c350ab..aa9211973661 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/core/management/base.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/core/management/base.pyi @@ -26,7 +26,7 @@ class CommandParser(ArgumentParser): def error(self, message: str) -> Any: ... def handle_default_options(options: Namespace) -> None: ... -def no_translations(handle_func: Callable) -> Callable: ... +def no_translations(handle_func: Callable[..., Any]) -> Callable[..., Any]: ... class DjangoHelpFormatter(HelpFormatter): show_last: set[str] @@ -42,7 +42,7 @@ class OutputWrapper(TextIOBase): def style_func(self, style_func: Callable[[str], str] | None) -> None: ... ending: str def __init__(self, out: TextIO, ending: str = "\n") -> None: ... - def __getattr__(self, name: str) -> Callable: ... + def __getattr__(self, name: str) -> Callable[..., Any]: ... @override def flush(self) -> None: ... @override diff --git a/python/helpers/bundled_stubs/Django/django-stubs/core/management/commands/compilemessages.pyi b/python/helpers/bundled_stubs/Django/django-stubs/core/management/commands/compilemessages.pyi index fd1bd130c3cb..6c04016aa301 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/core/management/commands/compilemessages.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/core/management/commands/compilemessages.pyi @@ -1,12 +1,12 @@ from pathlib import Path from typing import Any +from _typeshed import StrPath from django.core.management.base import BaseCommand -from django.utils._os import _PathCompatible from typing_extensions import override def has_bom(fn: Path) -> bool: ... -def is_dir_writable(path: _PathCompatible) -> bool: ... +def is_dir_writable(path: StrPath) -> bool: ... class Command(BaseCommand): program: str @@ -15,4 +15,4 @@ class Command(BaseCommand): has_errors: bool @override def handle(self, **options: Any) -> None: ... - def compile_messages(self, locations: list[tuple[_PathCompatible, _PathCompatible]]) -> None: ... + def compile_messages(self, locations: list[tuple[StrPath, StrPath]]) -> None: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/core/paginator.pyi b/python/helpers/bundled_stubs/Django/django-stubs/core/paginator.pyi index a4e3c9ddabf4..e438126da187 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/core/paginator.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/core/paginator.pyi @@ -13,7 +13,7 @@ class EmptyPage(InvalidPage): ... _T = TypeVar("_T") @type_check_only -class _SupportsPagination(Protocol[_T], Sized, Iterable): +class _SupportsPagination(Protocol[_T], Sized, Iterable[_T]): @overload def __getitem__(self, index: int, /) -> _T: ... @overload diff --git a/python/helpers/bundled_stubs/Django/django-stubs/core/serializers/__init__.pyi b/python/helpers/bundled_stubs/Django/django-stubs/core/serializers/__init__.pyi index f8db005c4837..55bcf28beec1 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/core/serializers/__init__.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/core/serializers/__init__.pyi @@ -19,7 +19,7 @@ def unregister_serializer(format: str) -> None: ... def get_serializer(format: str) -> type[Serializer] | BadSerializer: ... def get_serializer_formats() -> list[str]: ... def get_public_serializer_formats() -> list[str]: ... -def get_deserializer(format: str) -> Callable | type[Deserializer]: ... +def get_deserializer(format: str) -> Callable[..., Any] | type[Deserializer]: ... def serialize(format: str, queryset: Iterable[Model], **options: Any) -> Any: ... def deserialize(format: str, stream_or_string: Any, **options: Any) -> Iterator[DeserializedObject]: ... def sort_dependencies(app_list: Iterable[Any], allow_cycles: bool = False) -> list[type[Model]]: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/core/serializers/base.pyi b/python/helpers/bundled_stubs/Django/django-stubs/core/serializers/base.pyi index 004f425c3ccb..142c244ec38c 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/core/serializers/base.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/core/serializers/base.pyi @@ -82,8 +82,8 @@ class DeserializedObject: def build_instance(Model: type[Model], data: dict[str, Any], db: str) -> Model: ... def deserialize_m2m_values( - field: ManyToManyField, field_value: Iterable[Any], using: str | None, handle_forward_references: bool + field: ManyToManyField[Any, Any], field_value: Iterable[Any], using: str | None, handle_forward_references: bool ) -> Sequence[Any] | object: ... def deserialize_fk_value( - field: ForeignKey, field_value: Any, using: str | None, handle_forward_references: bool + field: ForeignKey[Any, Any], field_value: Any, using: str | None, handle_forward_references: bool ) -> Any | object: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/core/validators.pyi b/python/helpers/bundled_stubs/Django/django-stubs/core/validators.pyi index b44d7497862b..ec5cc889e34e 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/core/validators.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/core/validators.pyi @@ -153,10 +153,10 @@ class FileExtensionValidator(_Deconstructible): message: _StrOrPromise | None = None, code: str | None = None, ) -> None: ... - def __call__(self, value: File) -> None: ... + def __call__(self, value: File[Any]) -> None: ... def get_available_image_extensions() -> Sequence[str]: ... -def validate_image_file_extension(value: File) -> None: ... +def validate_image_file_extension(value: File[Any]) -> None: ... class ProhibitNullCharactersValidator(_Deconstructible): message: _StrOrPromise 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 ea7d472149ee..9a35a098cee2 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 @@ -56,7 +56,7 @@ class BaseDatabaseIntrospection: def installed_models(self, tables: list[str]) -> set[type[Model]]: ... def sequence_list(self) -> list[dict[str, str]]: ... def get_sequences( - self, cursor: CursorWrapper, table_name: str, table_fields: Iterable[Field] = () + self, cursor: CursorWrapper, table_name: str, table_fields: Iterable[Field[Any, Any]] = () ) -> list[_SequenceDict]: ... def get_relations(self, cursor: CursorWrapper, table_name: str) -> dict[str, tuple[str, str]]: ... def get_primary_key_column(self, cursor: CursorWrapper, table_name: str) -> str | None: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/db/backends/mysql/base.pyi b/python/helpers/bundled_stubs/Django/django-stubs/db/backends/mysql/base.pyi index 4d1b77bf4676..b7a08c0dca24 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/db/backends/mysql/base.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/db/backends/mysql/base.pyi @@ -1,4 +1,5 @@ from collections.abc import Container, Iterator +from re import Pattern from typing import Any, Literal from django.db.backends.base.base import BaseDatabaseWrapper @@ -13,7 +14,7 @@ from .validation import DatabaseValidation version: Any django_conversions: Any -server_version_re: Any +server_version_re: Pattern[str] class CursorWrapper: codes_for_integrityerror: Any diff --git a/python/helpers/bundled_stubs/Django/django-stubs/db/backends/sqlite3/base.pyi b/python/helpers/bundled_stubs/Django/django-stubs/db/backends/sqlite3/base.pyi index 73cc09b6c53a..ccc9052ee8b6 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/db/backends/sqlite3/base.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/db/backends/sqlite3/base.pyi @@ -1,5 +1,6 @@ from collections.abc import Callable, Iterable from datetime import date, datetime +from re import Pattern from sqlite3 import dbapi2 as Database from types import ModuleType from typing import Any @@ -41,7 +42,7 @@ class DatabaseWrapper(BaseDatabaseWrapper): def is_in_memory_db(self) -> bool: ... -FORMAT_QMARK_REGEX: Any +FORMAT_QMARK_REGEX: Pattern[str] class SQLiteCursorWrapper(Database.Cursor): @override diff --git a/python/helpers/bundled_stubs/Django/django-stubs/db/backends/sqlite3/creation.pyi b/python/helpers/bundled_stubs/Django/django-stubs/db/backends/sqlite3/creation.pyi index a5767a685480..2c69b3ae6988 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/db/backends/sqlite3/creation.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/db/backends/sqlite3/creation.pyi @@ -1,5 +1,4 @@ -from os import PathLike - +from _typeshed import StrPath from django.db.backends.base.creation import BaseDatabaseCreation from django.db.backends.sqlite3.base import DatabaseWrapper @@ -7,4 +6,4 @@ class DatabaseCreation(BaseDatabaseCreation): connection: DatabaseWrapper @staticmethod - def is_in_memory_db(database_name: str | PathLike[str]) -> bool: ... + def is_in_memory_db(database_name: StrPath) -> bool: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/db/backends/sqlite3/introspection.pyi b/python/helpers/bundled_stubs/Django/django-stubs/db/backends/sqlite3/introspection.pyi index cc91fc15b058..abb17813758e 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/db/backends/sqlite3/introspection.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/db/backends/sqlite3/introspection.pyi @@ -1,3 +1,4 @@ +from re import Pattern from typing import Any, NamedTuple from django.db.backends.base.introspection import BaseDatabaseIntrospection @@ -18,7 +19,7 @@ class FieldInfo(NamedTuple): pk: bool has_json_constraint: bool -field_size_re: Any +field_size_re: Pattern[str] def get_field_size(name: str) -> int | None: ... 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 60b69fd79f7c..bf4f361d2f41 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 @@ -1,8 +1,11 @@ from collections.abc import Callable +from decimal import Decimal from typing import Any from uuid import UUID +from django.db.backends.base.base import BaseDatabaseWrapper from django.db.backends.base.operations import BaseDatabaseOperations +from django.db.models.expressions import Expression from typing_extensions import override class DatabaseOperations(BaseDatabaseOperations): @@ -13,7 +16,7 @@ class DatabaseOperations(BaseDatabaseOperations): def get_decimalfield_converter( self, expression: Any, - ) -> Callable: ... + ) -> Callable[[float | None, Expression, BaseDatabaseWrapper], Decimal | None]: ... def convert_uuidfield_value(self, value: Any, expression: Any, connection: Any) -> UUID | None: ... def convert_booleanfield_value(self, value: Any, expression: Any, connection: Any) -> Any: ... @override 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 4e08141b5cd9..04876ff42ae0 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 @@ -22,8 +22,7 @@ _ExecuteQuery: TypeAlias = str | _Composable # Python types that can be adapted to SQL. _SQLType: TypeAlias = ( - None - | bool + bool | int | float | Decimal @@ -34,6 +33,7 @@ _SQLType: TypeAlias = ( | UUID | tuple[Any, ...] | list[Any] + | None ) _ExecuteParameters: TypeAlias = Sequence[_SQLType] | Mapping[str, _SQLType] | None @@ -71,15 +71,15 @@ class CursorDebugWrapper(CursorWrapper): def debug_transaction(connection: Any, sql: str) -> AbstractContextManager[None]: ... def split_tzname_delta(tzname: str) -> tuple[str, str | None, str | None]: ... @overload -def typecast_date(s: None | Literal[""]) -> None: ... # type: ignore[overload-overlap] +def typecast_date(s: Literal[""] | None) -> None: ... # type: ignore[overload-overlap] @overload def typecast_date(s: str) -> datetime.date: ... @overload -def typecast_time(s: None | Literal[""]) -> None: ... # type: ignore[overload-overlap] +def typecast_time(s: Literal[""] | None) -> None: ... # type: ignore[overload-overlap] @overload def typecast_time(s: str) -> datetime.time: ... @overload -def typecast_timestamp(s: None | Literal[""]) -> None: ... # type: ignore[overload-overlap] +def typecast_timestamp(s: Literal[""] | None) -> None: ... # type: ignore[overload-overlap] @overload def typecast_timestamp(s: str) -> datetime.datetime: ... def split_identifier(identifier: str) -> tuple[str, str]: ... 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 d8fbbaba1854..b6e180bc9a08 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 @@ -48,7 +48,7 @@ class MigrationAutodetector: def deep_deconstruct(self, obj: Any) -> Any: ... def only_relation_agnostic_fields( self, fields: dict[str, Field[Any, Any]] - ) -> list[tuple[str, list[Any], dict[str, Callable | int | str]]]: ... + ) -> list[tuple[str, list[Any], dict[str, Callable[..., Any] | int | str]]]: ... def check_dependency(self, operation: Operation, dependency: tuple[str, str, str | None, bool | str]) -> bool: ... def add_operation( self, diff --git a/python/helpers/bundled_stubs/Django/django-stubs/db/migrations/graph.pyi b/python/helpers/bundled_stubs/Django/django-stubs/db/migrations/graph.pyi index dd1420bc8405..360308d2916b 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/db/migrations/graph.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/db/migrations/graph.pyi @@ -52,7 +52,7 @@ class MigrationGraph: def ensure_not_cyclic(self) -> None: ... def make_state( self, - nodes: None | tuple[str, str] | Sequence[tuple[str, str]] = None, + nodes: tuple[str, str] | Sequence[tuple[str, str]] | None = None, at_end: bool = True, real_apps: list[str] | None = None, ) -> ProjectState: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/db/migrations/operations/models.pyi b/python/helpers/bundled_stubs/Django/django-stubs/db/migrations/operations/models.pyi index 83e442386a37..819e9bb20ba0 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/db/migrations/operations/models.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/db/migrations/operations/models.pyi @@ -23,14 +23,14 @@ class CreateModel(ModelOperation): fields: list[tuple[str, Field[Any, Any]]] options: dict[str, Any] bases: Sequence[type[Model] | str] | None - managers: Sequence[tuple[str, Manager]] | None + managers: Sequence[tuple[str, Manager[Any]]] | None def __init__( self, name: str, fields: list[tuple[str, Field[Any, Any]]], options: dict[str, Any] | None = None, bases: Sequence[type[Any] | str] | None = None, - managers: Sequence[tuple[str, Manager]] | None = None, + managers: Sequence[tuple[str, Manager[Any]]] | None = None, ) -> None: ... class DeleteModel(ModelOperation): ... @@ -117,8 +117,8 @@ class AlterModelOptions(ModelOptionOperation): def __init__(self, name: str, options: dict[str, Any]) -> None: ... class AlterModelManagers(ModelOptionOperation): - managers: Sequence[tuple[str, Manager]] - def __init__(self, name: str, managers: Sequence[tuple[str, Manager]]) -> None: ... + managers: Sequence[tuple[str, Manager[Any]]] + def __init__(self, name: str, managers: Sequence[tuple[str, Manager[Any]]]) -> None: ... class IndexOperation(Operation): option_name: str 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 8db4583723be..5b6f9e966dd3 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 @@ -16,7 +16,7 @@ class MigrationRecorder: connection: BaseDatabaseWrapper def __init__(self, connection: BaseDatabaseWrapper) -> None: ... @property - def migration_qs(self) -> QuerySet: ... + def migration_qs(self) -> QuerySet[Migration]: ... def has_table(self) -> bool: ... def ensure_schema(self) -> None: ... def applied_migrations(self) -> dict[tuple[str, str], Migration]: ... 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 184c5259f8d7..1bc8ad596d41 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 @@ -19,7 +19,7 @@ class ChoicesSerializer(BaseSerializer): ... class DeconstructibleSerializer(BaseSerializer): @staticmethod def serialize_deconstructed( - path: str, args: list[Any], kwargs: dict[str, Callable | int | str] + path: str, args: list[Any], kwargs: dict[str, Callable[..., Any] | int | str] ) -> tuple[str, set[str]]: ... class DictionarySerializer(BaseSerializer): ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/db/migrations/state.pyi b/python/helpers/bundled_stubs/Django/django-stubs/db/migrations/state.pyi index 489d9488b04c..80a8fd62b643 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/db/migrations/state.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/db/migrations/state.pyi @@ -19,7 +19,7 @@ class ModelState: fields: dict[str, Field[Any, Any]] options: dict[str, Any] bases: Sequence[type[Model] | str] - managers: list[tuple[str, Manager]] + managers: list[tuple[str, Manager[Any]]] def __init__( self, app_label: str, @@ -27,10 +27,10 @@ class ModelState: fields: list[tuple[str, Field[Any, Any]]] | dict[str, Field[Any, Any]], options: dict[str, Any] | None = None, bases: Sequence[type[Model] | str] | None = None, - managers: list[tuple[str, Manager]] | None = None, + managers: list[tuple[str, Manager[Any]]] | None = None, ) -> None: ... def clone(self) -> ModelState: ... - def construct_managers(self) -> Iterator[tuple[str, Manager]]: ... + def construct_managers(self) -> Iterator[tuple[str, Manager[Any]]]: ... @classmethod def from_model(cls, model: type[Model], exclude_rels: bool = False) -> ModelState: ... def get_field(self, field_name: str) -> Field[Any, Any]: ... @@ -69,7 +69,9 @@ class ProjectState: self, app_label: str, model_name: str, options: dict[str, Any], option_keys: Iterable[str] | None = None ) -> None: ... def remove_model_options(self, app_label: str, model_name: str, option_name: str, value_to_remove: Any) -> None: ... - def alter_model_managers(self, app_label: str, model_name: str, managers: list[tuple[str, Manager]]) -> None: ... + def alter_model_managers( + self, app_label: str, model_name: str, managers: list[tuple[str, Manager[Any]]] + ) -> None: ... def add_index(self, app_label: str, model_name: str, index: Any) -> None: ... def remove_index(self, app_label: str, model_name: str, index_name: str) -> None: ... def rename_index(self, app_label: str, model_name: str, old_index_name: str, new_index_name: str) -> None: ... 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 3bb4d62870f4..4e65b9e11938 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 @@ -41,7 +41,7 @@ class AnyValue(Aggregate): class Avg(FixDurationInputMixin, NumericOutputFieldMixin, Aggregate): ... class Count(Aggregate): - output_field: ClassVar[IntegerField] + output_field: ClassVar[IntegerField[Any, Any]] def __init__( self, expression: Combinable | str, 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 96335752d3a4..f44dbb9636f0 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 @@ -37,16 +37,15 @@ class ModelBase(type): def _default_manager(cls: type[_Self]) -> Manager[_Self]: ... # type: ignore[misc] class Model(AltersData, metaclass=ModelBase): - # Note: these two metaclass generated attributes don't really exist on the 'Model' - # class, runtime they are only added on concrete subclasses of 'Model'. The - # metaclass also sets up correct inheritance from concrete parent models exceptions. - # Our mypy plugin aligns with this behaviour and will remove the 2 attributes below - # and re-add them to correct concrete subclasses of 'Model' + # These attributes should only exist on concrete subclasses, not abstract models, and are + # generated by the metaclass. To replicate this runtime behavior, the mypy plugin will delete + # them, replacing them only on concrete subclasses. In the case of the exception subclasses, + # the correct inheritance hierarchy including any concrete parents will also be reproduced. + # Other type checkers will not understand the absence of these from abstract models, nor the + # correct exception hierarchy unless they re-implement the plugin logic themselves. DoesNotExist: Final[type[ObjectDoesNotExist]] NotUpdated: Final[type[ObjectNotUpdated]] MultipleObjectsReturned: Final[type[BaseMultipleObjectsReturned]] - # This 'objects' attribute will be deleted, via the plugin, in favor of managing it - # to only exist on subclasses it exists on during runtime. objects: ClassVar[Manager[Self]] _meta: ClassVar[Options[Self]] @@ -57,9 +56,9 @@ class Model(AltersData, metaclass=ModelBase): 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: ... + def __getstate__(self) -> dict[str, Any]: ... else: - def __getstate__(self) -> dict: ... + 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/deletion.pyi b/python/helpers/bundled_stubs/Django/django-stubs/db/models/deletion.pyi index 256aae1fa25f..6dcf97fa7ffe 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 @@ -46,7 +46,7 @@ def RESTRICT( using: str, ) -> None: ... def SET(value: Any) -> Callable[..., Any]: ... -def get_candidate_relations_to_delete(opts: Options) -> Iterable[Field[Any, Any]]: ... +def get_candidate_relations_to_delete(opts: Options[Model]) -> Iterable[Field[Any, Any]]: ... class ProtectedError(IntegrityError): protected_objects: set[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 997a6e08153f..96af108ed62b 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 @@ -3,8 +3,9 @@ import sys from typing import Any, Literal, overload, type_check_only from _typeshed import ConvertibleToInt +from _typeshed import Self as MetaclassSelf # noqa: TID251 from django.utils.functional import _StrOrPromise -from typing_extensions import TypeVar, override +from typing_extensions import override if sys.version_info >= (3, 11): from enum import EnumType, IntEnum, StrEnum @@ -17,13 +18,11 @@ else: class IntEnum(int, ReprEnum): ... # type: ignore[misc] class StrEnum(str, ReprEnum): ... # type: ignore[misc] -_Self = TypeVar("_Self", bound=ChoicesType) - class ChoicesType(EnumType): __empty__: _StrOrPromise def __new__( - metacls: type[_Self], classname: str, bases: tuple[type, ...], classdict: enum._EnumDict, **kwds: Any - ) -> _Self: ... + metacls: type[MetaclassSelf], classname: str, bases: tuple[type, ...], classdict: enum._EnumDict, **kwds: Any + ) -> MetaclassSelf: ... @property def names(self) -> list[str]: ... @property @@ -60,6 +59,7 @@ class _IntegerChoicesType(ChoicesType): # all the arguments of `int.__new__`/`str.__new__` (e.g. `base`, `encoding`). # They are omitted on purpose to avoid having convoluted stubs for these enums: class IntegerChoices(Choices, IntEnum, metaclass=_IntegerChoicesType): # type: ignore[misc] + _value_: int @overload def __init__(self, x: ConvertibleToInt) -> None: ... @overload @@ -79,6 +79,7 @@ class _TextChoicesType(ChoicesType): def values(self) -> list[str]: ... class TextChoices(Choices, StrEnum, metaclass=_TextChoicesType): # type: ignore[misc] + _value_: str @overload def __init__(self, object: str) -> None: ... @overload 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 2e4a7b3b6e25..ac920c4eab8e 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 @@ -75,7 +75,7 @@ class BaseExpression: set_returning: bool allows_composite_expressions: bool def __init__(self, output_field: Field[Any, Any] | None = None) -> None: ... - def get_db_converters(self, connection: BaseDatabaseWrapper) -> list[Callable]: ... + def get_db_converters(self, connection: BaseDatabaseWrapper) -> list[Callable[..., Any]]: ... def get_source_expressions(self) -> list[Any]: ... def set_source_expressions(self, exprs: Sequence[Combinable | Expression]) -> None: ... def as_sql(self, compiler: SQLCompiler, connection: BaseDatabaseWrapper) -> _AsSqlType: ... @@ -102,7 +102,7 @@ class BaseExpression: @cached_property def output_field(self) -> Field[Any, Any]: ... @cached_property - def convert_value(self) -> Callable: ... + def convert_value(self) -> Callable[..., Any]: ... def get_lookup(self, lookup: str) -> type[Lookup] | None: ... def get_transform(self, name: str) -> type[Transform] | None: ... def relabeled_clone(self, change_map: Mapping[str, str]) -> Self: ... @@ -145,7 +145,7 @@ class DurationExpression(CombinedExpression): def compile(self, side: Combinable, compiler: SQLCompiler, connection: BaseDatabaseWrapper) -> _AsSqlType: ... class TemporalSubtraction(CombinedExpression): - output_field: ClassVar[fields.DurationField] + output_field: ClassVar[fields.DurationField[Any, Any]] def __init__(self, lhs: Combinable, rhs: Combinable) -> None: ... class F(_Deconstructible, Combinable): @@ -326,7 +326,7 @@ class Subquery(BaseExpression, Combinable, Generic[_OutputField]): query: Query extra: dict[Any, Any] def __init__( - self, queryset: Query | QuerySet | Subquery, output_field: _OutputField | None = None, **extra: Any + self, queryset: Query | QuerySet[Any] | Subquery, output_field: _OutputField | None = None, **extra: Any ) -> None: ... @property def external_aliases(self) -> set[str]: ... @@ -337,8 +337,8 @@ class Subquery(BaseExpression, Combinable, Generic[_OutputField]): ) -> _AsSqlType: ... class Exists(Subquery): - output_field: ClassVar[fields.BooleanField] - def __init__(self, queryset: Query | QuerySet | Subquery, **kwargs: Any) -> None: ... + output_field: ClassVar[fields.BooleanField[Any, Any]] + def __init__(self, queryset: Query | QuerySet[Any] | Subquery, **kwargs: Any) -> None: ... class OrderBy(Expression): template: str 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 fa825e615e55..cc8f8bec6300 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 @@ -189,7 +189,7 @@ class Field(RegisterLookupMixin, Generic[_ST, _GT]): @overload def __get__(self, instance: Any, owner: Any) -> Self: ... def check(self, **kwargs: Any) -> list[CheckMessage]: ... - def get_col(self, alias: str, output_field: Field | None = None) -> Col: ... + def get_col(self, alias: str, output_field: Field[Any, Any] | None = None) -> Col: ... @cached_property def cached_col(self) -> Col: ... def select_format(self, compiler: SQLCompiler, sql: str, params: _ParamsT) -> _AsSqlType: ... @@ -210,7 +210,7 @@ class Field(RegisterLookupMixin, Generic[_ST, _GT]): def run_validators(self, value: Any) -> None: ... def validate(self, value: Any, model_instance: Model | None) -> None: ... def clean(self, value: Any, model_instance: Model | None) -> Any: ... - def db_type_parameters(self, connection: BaseDatabaseWrapper) -> DictWrapper: ... + def db_type_parameters(self, connection: BaseDatabaseWrapper) -> DictWrapper[Any]: ... def db_check(self, connection: BaseDatabaseWrapper) -> str | None: ... def db_type(self, connection: BaseDatabaseWrapper) -> str | None: ... def rel_db_type(self, connection: BaseDatabaseWrapper) -> str | None: ... @@ -285,13 +285,13 @@ class BigIntegerField(IntegerField[_ST, _GT]): MAX_BIGINT: ClassVar[int] class PositiveIntegerField(PositiveIntegerRelDbTypeMixin, IntegerField[_ST, _GT]): - integer_field_class: type[IntegerField] + integer_field_class: type[IntegerField[Any, Any]] class PositiveSmallIntegerField(PositiveIntegerRelDbTypeMixin, SmallIntegerField[_ST, _GT]): - integer_field_class: type[SmallIntegerField] + integer_field_class: type[SmallIntegerField[Any, Any]] class PositiveBigIntegerField(PositiveIntegerRelDbTypeMixin, BigIntegerField[_ST, _GT]): - integer_field_class: type[BigIntegerField] + integer_field_class: type[BigIntegerField[Any, Any]] class FloatField(Field[_ST, _GT]): _pyi_private_set_type: float | int | str | Combinable diff --git a/python/helpers/bundled_stubs/Django/django-stubs/db/models/fields/composite.pyi b/python/helpers/bundled_stubs/Django/django-stubs/db/models/fields/composite.pyi index 31786b82b6e7..c2149c8376c9 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/db/models/fields/composite.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/db/models/fields/composite.pyi @@ -62,7 +62,7 @@ class CompositePrimaryKey(Field[Any, Any]): def __iter__(self) -> Iterator[_AnyField]: ... def __len__(self) -> int: ... @override - def get_pk_value_on_save(self, instance: Model) -> tuple: ... # actual type is tuple of field.value_from_object + def get_pk_value_on_save(self, instance: Model) -> tuple[Any, ...]: ... @override def get_attname_column(self) -> tuple[str, None]: ... 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 08a106fd9d24..05f5db8a0b63 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 @@ -2,6 +2,7 @@ import sys from collections.abc import Callable, Iterable from typing import Any, Protocol, overload, type_check_only +from _typeshed import StrPath from django.core.files.base import File from django.core.files.images import ImageFile from django.core.files.storage import Storage @@ -11,12 +12,11 @@ from django.db.models.expressions import Expression from django.db.models.fields import NOT_PROVIDED, Field, _ErrorMessagesMapping from django.db.models.query_utils import DeferredAttribute from django.db.models.utils import AltersData -from django.utils._os import _PathCompatible from django.utils.choices import _Choices from django.utils.functional import _StrOrPromise from typing_extensions import Self, TypeVar, override -class FieldFile(File, AltersData): +class FieldFile(File[Any], AltersData): instance: Model field: FileField storage: Storage @@ -36,7 +36,7 @@ class FieldFile(File, AltersData): def size(self) -> int: ... @override def open(self, mode: str = "rb") -> Self: ... # type: ignore[override] - def save(self, name: str, content: File, save: bool = True) -> None: ... + def save(self, name: str, content: File[Any], save: bool = True) -> None: ... def delete(self, save: bool = True) -> None: ... @property @override @@ -58,18 +58,18 @@ _M = TypeVar("_M", bound=Model, contravariant=True) @type_check_only class _UploadToCallable(Protocol[_M]): - def __call__(self, instance: _M, filename: str, /) -> _PathCompatible: ... + def __call__(self, instance: _M, filename: str, /) -> StrPath: ... class FileField(Field[Any, Any]): attr_class: type[FieldFile] descriptor_class: type[FileDescriptor] storage: Storage - upload_to: _PathCompatible | _UploadToCallable + upload_to: StrPath | _UploadToCallable[Any] def __init__( self, verbose_name: _StrOrPromise | None = None, name: str | None = None, - upload_to: _PathCompatible | _UploadToCallable = "", + upload_to: StrPath | _UploadToCallable[Any] = "", storage: Storage | Callable[[], Storage] | None = None, *, max_length: int | None = ..., @@ -107,7 +107,7 @@ class FileField(Field[Any, Any]): def __get__(self, instance: Any, owner: Any) -> Self: ... @override def contribute_to_class(self, cls: type[Model], name: str, **kwargs: Any) -> None: ... # type: ignore[override] - def generate_filename(self, instance: Model | None, filename: _PathCompatible) -> str: ... + def generate_filename(self, instance: Model | None, filename: StrPath) -> str: ... class ImageFileDescriptor(FileDescriptor): field: ImageField diff --git a/python/helpers/bundled_stubs/Django/django-stubs/db/models/fields/generated.pyi b/python/helpers/bundled_stubs/Django/django-stubs/db/models/fields/generated.pyi index 0bf3eae73b8a..b428345086f6 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/db/models/fields/generated.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/db/models/fields/generated.pyi @@ -7,7 +7,7 @@ from django.db.backends.base.base import BaseDatabaseWrapper from django.db.models.expressions import Expression from django.db.models.fields import _ErrorMessagesMapping from django.db.models.sql import Query -from django.utils.choices import _Choices +from django.utils.choices import _ChoicesInput from django.utils.datastructures import DictWrapper from django.utils.functional import _StrOrPromise, cached_property from typing_extensions import override @@ -16,13 +16,13 @@ class GeneratedField(models.Field[Any, Any]): generated: ClassVar[Literal[True]] db_returning: Literal[True] _query: Query | None - output_field: models.Field | None + output_field: models.Field[Any, Any] | None def __init__( self, *, expression: Expression, - output_field: models.Field, + output_field: models.Field[Any, Any], db_persist: bool, verbose_name: _StrOrPromise | None = ..., name: str | None = ..., @@ -37,7 +37,7 @@ class GeneratedField(models.Field[Any, Any]): unique_for_date: str | None = ..., unique_for_month: str | None = ..., unique_for_year: str | None = ..., - choices: _Choices | None = ..., + choices: _ChoicesInput | None = ..., help_text: _StrOrPromise = ..., db_column: str | None = ..., db_comment: str | None = ..., @@ -48,8 +48,8 @@ class GeneratedField(models.Field[Any, Any]): ) -> None: ... def generated_sql(self, connection: BaseDatabaseWrapper) -> tuple[str, Any]: ... @cached_property - def referenced_fields(self) -> frozenset[models.Field]: ... + def referenced_fields(self) -> frozenset[models.Field[Any, Any]]: ... @override - def db_type_parameters(self, connection: BaseDatabaseWrapper) -> DictWrapper: ... + def db_type_parameters(self, connection: BaseDatabaseWrapper) -> DictWrapper[Any]: ... __all__ = ["GeneratedField"] 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 89bc78a75b8d..77828e55fbb6 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 @@ -88,7 +88,7 @@ class KeyTransform(Transform): class KeyTextTransform(KeyTransform): postgres_operator: str postgres_nested_operator: str - output_field: ClassVar[TextField] + output_field: ClassVar[TextField[Any, Any]] @override def as_mysql(self, compiler: SQLCompiler, connection: BaseDatabaseWrapper) -> _AsSqlType: ... @classmethod diff --git a/python/helpers/bundled_stubs/Django/django-stubs/db/models/fields/proxy.pyi b/python/helpers/bundled_stubs/Django/django-stubs/db/models/fields/proxy.pyi index ef647530a68d..0bbe0e28bdb1 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/db/models/fields/proxy.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/db/models/fields/proxy.pyi @@ -2,5 +2,5 @@ from typing import Any from django.db.models import fields -class OrderWrt(fields.IntegerField): +class OrderWrt(fields.IntegerField[Any, Any]): def __init__(self, *args: Any, **kwargs: Any) -> None: ... 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 2caa440f0486..fd49b5c5b983 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 @@ -92,7 +92,7 @@ class RelatedField(FieldCacheMixin, Field[_ST, _GT]): def get_limit_choices_to(self) -> _LimitChoicesTo: ... def related_query_name(self) -> str: ... @property - def target_field(self) -> Field: ... + def target_field(self) -> Field[Any, Any]: ... class ForeignObject(RelatedField[_ST, _GT]): remote_field: ForeignObjectRel @@ -145,21 +145,21 @@ class ForeignObject(RelatedField[_ST, _GT]): @overload @override def __get__(self, instance: Any, owner: Any) -> Self: ... - def resolve_related_fields(self) -> list[tuple[Field, Field]]: ... + def resolve_related_fields(self) -> list[tuple[Field[Any, Any], Field[Any, Any]]]: ... @cached_property - def related_fields(self) -> list[tuple[Field, Field]]: ... + def related_fields(self) -> list[tuple[Field[Any, Any], Field[Any, Any]]]: ... @cached_property - def reverse_related_fields(self) -> list[tuple[Field, Field]]: ... + def reverse_related_fields(self) -> list[tuple[Field[Any, Any], Field[Any, Any]]]: ... @cached_property - def local_related_fields(self) -> tuple[Field, ...]: ... + def local_related_fields(self) -> tuple[Field[Any, Any], ...]: ... @cached_property - def foreign_related_fields(self) -> tuple[Field, ...]: ... + def foreign_related_fields(self) -> tuple[Field[Any, Any], ...]: ... def get_local_related_value(self, instance: Model) -> tuple[Any, ...]: ... def get_foreign_related_value(self, instance: Model) -> tuple[Any, ...]: ... @staticmethod - def get_instance_value_for_fields(instance: Model, fields: Sequence[Field]) -> tuple[Any, ...]: ... - def get_joining_fields(self, reverse_join: bool = False) -> tuple[tuple[Field, Field], ...]: ... - def get_reverse_joining_fields(self) -> tuple[tuple[Field, Field], ...]: ... + def get_instance_value_for_fields(instance: Model, fields: Sequence[Field[Any, Any]]) -> tuple[Any, ...]: ... + def get_joining_fields(self, reverse_join: bool = False) -> tuple[tuple[Field[Any, Any], Field[Any, Any]], ...]: ... + def get_reverse_joining_fields(self) -> tuple[tuple[Field[Any, Any], Field[Any, Any]], ...]: ... def get_extra_descriptor_filter(self, instance: Model) -> dict[str, Any] | Q: ... def get_extra_restriction(self, alias: str, related_alias: str) -> WhereNode | None: ... def get_path_info(self, filtered_relation: FilteredRelation | None = None) -> list[PathInfo]: ... @@ -168,11 +168,11 @@ class ForeignObject(RelatedField[_ST, _GT]): def get_reverse_path_info(self, filtered_relation: FilteredRelation | None = None) -> list[PathInfo]: ... @cached_property def reverse_path_infos(self) -> list[PathInfo]: ... - def contribute_to_related_class(self, cls: type[Model], related: RelatedField) -> None: ... + def contribute_to_related_class(self, cls: type[Model], related: RelatedField[Any, Any]) -> None: ... @override def get_attname_column(self) -> tuple[str, None]: ... - forward_related_accessor_class: type[ForwardManyToOneDescriptor] - related_accessor_class: type[ReverseManyToOneDescriptor] + forward_related_accessor_class: type[ForwardManyToOneDescriptor[Any]] + related_accessor_class: type[ReverseManyToOneDescriptor[Any]] requires_unique_target: bool class ForeignKey(ForeignObject[_ST, _GT]): @@ -222,7 +222,7 @@ class ForeignKey(ForeignObject[_ST, _GT]): @classmethod def __class_getitem__(cls, *args: Any, **kwargs: Any) -> type[Self]: ... @override - def contribute_to_related_class(self, cls: type[Model], related: RelatedField) -> None: ... + def contribute_to_related_class(self, cls: type[Model], related: RelatedField[Any, Any]) -> None: ... @override def formfield( self, @@ -304,10 +304,10 @@ class OneToOneField(ForeignKey[_ST, _GT]): @overload @override def __get__(self, instance: Any, owner: Any) -> Self: ... - forward_related_accessor_class: type[ForwardOneToOneDescriptor] - related_accessor_class: type[ReverseOneToOneDescriptor] # type: ignore[assignment] + forward_related_accessor_class: type[ForwardOneToOneDescriptor[Any]] + related_accessor_class: type[ReverseOneToOneDescriptor[Any, Any]] # type: ignore[assignment] -_Through = TypeVar("_Through", bound=Model) +_Through = TypeVar("_Through", bound=Model, default=Any) _To = TypeVar("_To", bound=Model) class ManyToManyField(RelatedField[Any, Any], Generic[_To, _Through]): @@ -373,7 +373,7 @@ class ManyToManyField(RelatedField[Any, Any], Generic[_To, _Through]): def get_reverse_path_info(self, filtered_relation: FilteredRelation | None = None) -> list[PathInfo]: ... @override def contribute_to_class(self, cls: type[Model], name: str, **kwargs: Any) -> None: ... # type: ignore[override] - def contribute_to_related_class(self, cls: type[Model], related: RelatedField) -> None: ... + def contribute_to_related_class(self, cls: type[Model], related: RelatedField[Any, Any]) -> None: ... @override def get_attname_column(self) -> tuple[str, None]: ... def m2m_db_table(self) -> str: ... @@ -409,4 +409,4 @@ class ManyToManyField(RelatedField[Any, Any], Generic[_To, _Through]): @cached_property def reverse_path_infos(self) -> list[PathInfo]: ... -def create_many_to_many_intermediary_model(field: ManyToManyField, klass: type[Model]) -> type[Model]: ... +def create_many_to_many_intermediary_model(field: ManyToManyField[Any, Any], klass: type[Model]) -> type[Model]: ... 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 ff3c91571860..aead041ca77e 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 @@ -19,7 +19,7 @@ _Through = TypeVar("_Through", bound=Model, default=Model) _To = TypeVar("_To", bound=Model) class ForeignKeyDeferredAttribute(DeferredAttribute): - field: RelatedField + field: RelatedField[Any, Any] def __set__(self, instance: Model, value: Any) -> None: ... class ForwardManyToOneDescriptor(Generic[_F]): @@ -35,7 +35,7 @@ class ForwardManyToOneDescriptor(Generic[_F]): def get_object(self, instance: Model) -> Model: ... def __get__( self, instance: Model | None, cls: type[Model] | None = None - ) -> Model | ForwardManyToOneDescriptor | None: ... + ) -> Model | ForwardManyToOneDescriptor[Any] | None: ... def __set__(self, instance: Model, value: Model | None) -> None: ... @override def __reduce__(self) -> tuple[Callable[..., Any], tuple[type[Model], str]]: ... @@ -122,7 +122,7 @@ def create_reverse_many_to_one_manager( superclass: type[BaseManager[_M]], rel: ManyToOneRel ) -> type[RelatedManager[_M]]: ... -class ManyToManyDescriptor(ReverseManyToOneDescriptor, Generic[_To, _Through]): +class ManyToManyDescriptor(ReverseManyToOneDescriptor[Any], Generic[_To, _Through]): """ In the example:: 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 b16d765cc453..c37f42d737fd 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 @@ -26,7 +26,7 @@ class ForeignObjectRel(FieldCacheMixin): empty_strings_allowed: bool is_relation: bool null: bool - field: ForeignObject + field: ForeignObject[Any, Any] model: type[Model] related_name: str | None related_query_name: str | None @@ -38,7 +38,7 @@ class ForeignObjectRel(FieldCacheMixin): field_name: str | None def __init__( self, - field: ForeignObject, + field: ForeignObject[Any, Any], to: type[Model] | str, related_name: str | None = None, related_query_name: str | None = None, @@ -51,7 +51,7 @@ class ForeignObjectRel(FieldCacheMixin): @cached_property def name(self) -> str: ... @property - def remote_field(self) -> ForeignObject: ... + def remote_field(self) -> ForeignObject[Any, Any]: ... @property def target_field(self) -> Field[Any, Any]: ... @cached_property @@ -92,10 +92,10 @@ class ForeignObjectRel(FieldCacheMixin): def path_infos(self) -> list[PathInfo]: ... class ManyToOneRel(ForeignObjectRel): - field: ForeignKey + field: ForeignKey[Any, Any] def __init__( self, - field: ForeignKey, + field: ForeignKey[Any, Any], to: type[Model] | str, field_name: str, related_name: str | None = None, @@ -112,10 +112,10 @@ class ManyToOneRel(ForeignObjectRel): def identity(self) -> tuple[Any, ...]: ... class OneToOneRel(ManyToOneRel): - field: OneToOneField + field: OneToOneField[Any, Any] def __init__( self, - field: OneToOneField, + field: OneToOneField[Any, Any], to: type[Model] | str, field_name: str | None, related_name: str | None = None, diff --git a/python/helpers/bundled_stubs/Django/django-stubs/db/models/functions/datetime.pyi b/python/helpers/bundled_stubs/Django/django-stubs/db/models/functions/datetime.pyi index bdc01ef68b9b..bd52db3f8c2d 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/db/models/functions/datetime.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/db/models/functions/datetime.pyi @@ -15,7 +15,7 @@ class TimezoneMixin: class Extract(TimezoneMixin, Transform): lookup_name: str | None # type: ignore[assignment] - output_field: ClassVar[models.IntegerField] + output_field: ClassVar[models.IntegerField[Any, Any]] def __init__( self, expression: Combinable | str, lookup_name: str | None = None, tzinfo: Any | None = None, **extra: Any ) -> None: ... @@ -35,7 +35,7 @@ class ExtractMinute(Extract): ... class ExtractSecond(Extract): ... class Now(Func): - output_field: ClassVar[models.DateTimeField] + output_field: ClassVar[models.DateTimeField[Any, Any]] def as_postgresql( self, compiler: SQLCompiler, connection: BaseDatabaseWrapper, **extra_context: Any ) -> _AsSqlType: ... @@ -73,10 +73,10 @@ class TruncWeek(TruncBase): ... class TruncDay(TruncBase): ... class TruncDate(TruncBase): - output_field: ClassVar[models.DateField] + output_field: ClassVar[models.DateField[Any, Any]] class TruncTime(TruncBase): - output_field: ClassVar[models.TimeField] + output_field: ClassVar[models.TimeField[Any, Any]] class TruncHour(TruncBase): ... class TruncMinute(TruncBase): ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/db/models/functions/json.pyi b/python/helpers/bundled_stubs/Django/django-stubs/db/models/functions/json.pyi index b5fc0f8492a6..b6fb8e9a43fd 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/db/models/functions/json.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/db/models/functions/json.pyi @@ -8,7 +8,7 @@ from django.db.models.sql.compiler import SQLCompiler, _AsSqlType from typing_extensions import override class JSONArray(Func): - output_field: ClassVar[JSONField] + output_field: ClassVar[JSONField[Any, Any]] @override def as_sql(self, compiler: SQLCompiler, connection: BaseDatabaseWrapper, **extra_context: Any) -> _AsSqlType: ... # type: ignore [override] def as_native( @@ -20,7 +20,7 @@ class JSONArray(Func): def as_oracle(self, compiler: SQLCompiler, connection: BaseDatabaseWrapper, **extra_context: Any) -> _AsSqlType: ... class JSONObject(Func): - output_field: ClassVar[JSONField] + output_field: ClassVar[JSONField[Any, Any]] def __init__(self, **fields: Any) -> None: ... @override def as_sql(self, compiler: SQLCompiler, connection: BaseDatabaseWrapper, **extra_context: Any) -> _AsSqlType: ... # type: ignore [override] diff --git a/python/helpers/bundled_stubs/Django/django-stubs/db/models/functions/text.pyi b/python/helpers/bundled_stubs/Django/django-stubs/db/models/functions/text.pyi index 390e0a1e1911..88d2af263ba4 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/db/models/functions/text.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/db/models/functions/text.pyi @@ -37,7 +37,7 @@ class Concat(Func): def __init__(self, *expressions: Any, **extra: Any) -> None: ... class Left(Func[_OutputField]): - output_field: ClassVar[models.CharField] + output_field: ClassVar[models.CharField[Any, Any]] def __init__( self, expression: Combinable | str, @@ -50,13 +50,13 @@ class Left(Func[_OutputField]): def as_oracle(self, compiler: SQLCompiler, connection: BaseDatabaseWrapper, **extra_context: Any) -> _AsSqlType: ... class Length(Transform): - output_field: ClassVar[models.IntegerField] + output_field: ClassVar[models.IntegerField[Any, Any]] def as_mysql(self, compiler: SQLCompiler, connection: BaseDatabaseWrapper, **extra_context: Any) -> _AsSqlType: ... class Lower(Transform): ... class LPad(Func): - output_field: ClassVar[models.CharField] + output_field: ClassVar[models.CharField[Any, Any]] def __init__( self, expression: Combinable | str, length: Expression | int | None, fill_text: Expression = ..., **extra: Any ) -> None: ... @@ -65,11 +65,11 @@ class LTrim(Transform): ... class MD5(OracleHashMixin, Transform): ... class Ord(Transform): - output_field: ClassVar[models.IntegerField] + output_field: ClassVar[models.IntegerField[Any, Any]] def as_mysql(self, compiler: SQLCompiler, connection: BaseDatabaseWrapper, **extra_context: Any) -> _AsSqlType: ... class Repeat(Func): - output_field: ClassVar[models.CharField] + output_field: ClassVar[models.CharField[Any, Any]] def __init__(self, expression: Combinable | str, number: Expression | int | None, **extra: Any) -> None: ... def as_oracle(self, compiler: SQLCompiler, connection: BaseDatabaseWrapper, **extra_context: Any) -> _AsSqlType: ... @@ -95,13 +95,13 @@ class SHA384(MySQLSHA2Mixin, OracleHashMixin, PostgreSQLSHAMixin, Transform): .. class SHA512(MySQLSHA2Mixin, OracleHashMixin, PostgreSQLSHAMixin, Transform): ... class StrIndex(Func): - output_field: ClassVar[models.IntegerField] + output_field: ClassVar[models.IntegerField[Any, Any]] def as_postgresql( self, compiler: SQLCompiler, connection: BaseDatabaseWrapper, **extra_context: Any ) -> _AsSqlType: ... class Substr(Func[_OutputField]): - output_field: ClassVar[models.CharField] + output_field: ClassVar[models.CharField[Any, Any]] def __init__( self, expression: Combinable | str, diff --git a/python/helpers/bundled_stubs/Django/django-stubs/db/models/functions/window.pyi b/python/helpers/bundled_stubs/Django/django-stubs/db/models/functions/window.pyi index be14a347bbbf..28baf6ffe7d5 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/db/models/functions/window.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/db/models/functions/window.pyi @@ -4,10 +4,10 @@ from django.db import models from django.db.models.expressions import Combinable, Func class CumeDist(Func): - output_field: ClassVar[models.FloatField] + output_field: ClassVar[models.FloatField[Any, Any]] class DenseRank(Func): - output_field: ClassVar[models.IntegerField] + output_field: ClassVar[models.IntegerField[Any, Any]] class FirstValue(Func): ... @@ -23,16 +23,16 @@ class NthValue(Func): class Ntile(Func): def __init__(self, num_buckets: int = 1, **extra: Any) -> None: ... - output_field: ClassVar[models.IntegerField] + output_field: ClassVar[models.IntegerField[Any, Any]] class PercentRank(Func): - output_field: ClassVar[models.FloatField] + output_field: ClassVar[models.FloatField[Any, Any]] class Rank(Func): - output_field: ClassVar[models.IntegerField] + output_field: ClassVar[models.IntegerField[Any, Any]] class RowNumber(Func): - output_field: ClassVar[models.IntegerField] + output_field: ClassVar[models.IntegerField[Any, Any]] __all__ = [ "CumeDist", 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 76ca7ae16022..665f111784f6 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 @@ -22,7 +22,7 @@ class Lookup(Expression, Generic[_T]): def __init__(self, lhs: Any, rhs: Any) -> None: ... def apply_bilateral_transforms(self, value: Expression) -> Expression: ... def batch_process_rhs( - self, compiler: SQLCompiler, connection: BaseDatabaseWrapper, rhs: OrderedSet | None = None + self, compiler: SQLCompiler, connection: BaseDatabaseWrapper, rhs: OrderedSet[Any] | None = None ) -> tuple[list[str], list[str]]: ... @override def get_source_expressions(self) -> list[Expression]: ... @@ -39,7 +39,7 @@ class Lookup(Expression, Generic[_T]): def as_oracle(self, compiler: SQLCompiler, connection: BaseDatabaseWrapper) -> _AsSqlType: ... @cached_property @override - def output_field(self) -> BooleanField: ... + def output_field(self) -> BooleanField[Any, Any]: ... @property @override def identity(self) -> tuple[type[Lookup], Any, Any]: ... @@ -72,7 +72,7 @@ class FieldGetDbPrepValueIterableMixin(FieldGetDbPrepValueMixin): self, compiler: SQLCompiler, connection: BaseDatabaseWrapper, sql: str, param: Any ) -> _AsSqlType: ... def batch_process_rhs( - self, compiler: SQLCompiler, connection: BaseDatabaseWrapper, rhs: OrderedSet | None = None + self, compiler: SQLCompiler, connection: BaseDatabaseWrapper, rhs: OrderedSet[Any] | None = None ) -> tuple[list[str], list[str]]: ... class PostgresOperatorLookup(Lookup[_T]): 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 0fcbee2e7673..8198fa9561af 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 @@ -165,10 +165,10 @@ class Manager(BaseManager[_T]): def using(self, alias: str | None) -> QuerySet[_T]: ... class ManagerDescriptor: - manager: BaseManager - def __init__(self, manager: BaseManager) -> None: ... + manager: BaseManager[Any] + def __init__(self, manager: BaseManager[Any]) -> None: ... @overload - def __get__(self, instance: None, cls: type[Model] | None = None) -> BaseManager: ... + def __get__(self, instance: None, cls: type[Model] | None = None) -> BaseManager[Any]: ... @overload def __get__(self, instance: Model, cls: type[Model] | None = None) -> NoReturn: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/db/models/options.pyi b/python/helpers/bundled_stubs/Django/django-stubs/db/models/options.pyi index f900e4a6ef34..537a7e400843 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/db/models/options.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/db/models/options.pyi @@ -43,9 +43,9 @@ class Options(Generic[_M]): REVERSE_PROPERTIES: set[str] default_apps: Any local_fields: list[Field[Any, Any]] - local_many_to_many: list[ManyToManyField] + local_many_to_many: list[ManyToManyField[Any, Any]] private_fields: list[Any] - local_managers: list[Manager] + local_managers: list[Manager[_M]] base_manager_name: str | None default_manager_name: str | None model_name: str | None @@ -90,7 +90,7 @@ class Options(Generic[_M]): @property def app_config(self) -> AppConfig: ... def contribute_to_class(self, cls: type[Model], name: str) -> None: ... - def add_manager(self, manager: Manager) -> None: ... + def add_manager(self, manager: Manager[_M]) -> None: ... def add_field(self, field: Field[Any, Any], private: bool = False) -> None: ... # if GenericForeignKey is passed as argument, it has primary_key = True set before def setup_pk(self, field: Field[Any, Any]) -> None: ... @@ -102,13 +102,13 @@ class Options(Generic[_M]): def swapped(self) -> str | None: ... def setting_changed(self, *, setting: str, **kwargs: Any) -> None: ... @cached_property - def managers(self) -> ImmutableList[Manager]: ... + def managers(self) -> ImmutableList[Manager[_M]]: ... @cached_property - def managers_map(self) -> dict[str, Manager]: ... + def managers_map(self) -> dict[str, Manager[_M]]: ... @cached_property - def base_manager(self) -> Manager: ... + def base_manager(self) -> Manager[_M]: ... @cached_property - def default_manager(self) -> Manager | None: ... + def default_manager(self) -> Manager[_M] | None: ... @cached_property def fields(self) -> ImmutableList[Field[Any, Any]]: ... @cached_property @@ -120,13 +120,13 @@ class Options(Generic[_M]): @cached_property def related_objects(self) -> ImmutableList[ForeignObjectRel]: ... @cached_property - def fields_map(self) -> dict[str, Field[Any, Any] | ForeignObjectRel]: ... + def fields_map(self) -> dict[str, _AnyField]: ... def get_field(self, field_name: str) -> _AnyField: ... def get_base_chain(self, model: type[Model]) -> list[type[Model]]: ... @cached_property def all_parents(self) -> tuple[type[Model]]: ... def get_parent_list(self) -> list[type[Model]]: ... - def get_ancestor_link(self, ancestor: type[Model]) -> OneToOneField | None: ... + def get_ancestor_link(self, ancestor: type[Model]) -> OneToOneField[Any, Any] | None: ... def get_path_to_parent(self, parent: type[Model]) -> list[PathInfo]: ... def get_path_from_parent(self, parent: type[Model]) -> list[PathInfo]: ... def get_fields(self, include_parents: bool = True, include_hidden: bool = False) -> list[_AnyField]: ... 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 fa47532df5cd..98d6943b5639 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 @@ -67,7 +67,7 @@ class _SupportsContains(Generic[_ContainsT]): class QuerySet(AltersData, _SupportsContains[object], Iterable[_Row], Sized, Generic[_Model, _Row]): model: type[_Model] query: Query - _iterable_class: type[BaseIterable] + _iterable_class: type[BaseIterable[Any]] _result_cache: list[_Row] | None def __init__( self, @@ -305,13 +305,17 @@ class Prefetch(Generic[_LookupT, _PrefetchedQuerySetT, _ToAttrT]): def get_current_to_attr(self, level: int) -> tuple[str, str]: ... def get_current_querysets(self, level: int) -> Sequence[_PrefetchedQuerySetT] | None: ... -def normalize_prefetch_lookups(lookups: Sequence[str | Prefetch], prefix: str | None = None) -> list[Prefetch]: ... -def prefetch_related_objects(model_instances: Sequence[_Model], *related_lookups: str | Prefetch) -> None: ... -async def aprefetch_related_objects(model_instances: Sequence[_Model], *related_lookups: str | Prefetch) -> None: ... +def normalize_prefetch_lookups( + lookups: Sequence[str | Prefetch[Any]], prefix: str | None = None +) -> list[Prefetch[Any]]: ... +def prefetch_related_objects(model_instances: Sequence[_Model], *related_lookups: str | Prefetch[Any]) -> None: ... +async def aprefetch_related_objects( + model_instances: Sequence[_Model], *related_lookups: str | Prefetch[Any] +) -> None: ... def get_prefetcher(instance: Model, through_attr: str, to_attr: str) -> tuple[Any, Any, bool, bool]: ... def prefetch_one_level( - instances: Sequence[Model], prefetcher: Any, lookup: Prefetch, level: int -) -> tuple[list[Any], list[Prefetch]]: ... + instances: Sequence[Model], prefetcher: Any, lookup: Prefetch[Any], level: int +) -> tuple[list[Any], list[Prefetch[Any]]]: ... class InstanceCheckMeta(type): ... 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 fe1b960b2a81..a240c641057b 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 @@ -26,8 +26,8 @@ class class_or_instance_method: def __get__(self, instance: Any, owner: Any) -> Callable[..., Any]: ... class PathInfo(NamedTuple): - from_opts: Options - to_opts: Options + from_opts: Options[Model] + to_opts: Options[Model] target_fields: tuple[Field[Any, Any], ...] join_field: Field[Any, Any] m2m: bool diff --git a/python/helpers/bundled_stubs/Django/django-stubs/db/models/signals.pyi b/python/helpers/bundled_stubs/Django/django-stubs/db/models/signals.pyi index 7b1ed1ec6d5f..5dfd1a48f2d1 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/db/models/signals.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/db/models/signals.pyi @@ -1,4 +1,5 @@ from collections.abc import Callable +from typing import Any from django.apps.registry import Apps from django.db.models.base import Model @@ -12,7 +13,7 @@ class ModelSignal(Signal): @override def connect( # type: ignore[override] self, - receiver: Callable, + receiver: Callable[..., Any], sender: type[Model] | str | None = None, weak: bool = True, dispatch_uid: _AnyHashable | None = None, @@ -21,7 +22,7 @@ class ModelSignal(Signal): @override def disconnect( # type: ignore[override] self, - receiver: Callable | None = None, + receiver: Callable[..., Any] | None = None, sender: type[Model] | str | None = None, dispatch_uid: _AnyHashable | None = None, apps: Apps | None = None, 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 fcca6ff67e9b..ba0682a4b8f8 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 @@ -1,6 +1,7 @@ from collections.abc import Callable, Iterable, Iterator, Sequence from datetime import date, datetime from decimal import Decimal +from re import Pattern from typing import Any, Literal, TypeAlias, overload from uuid import UUID @@ -11,13 +12,12 @@ from django.db.models.base import Model 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.datastructures import _ListOrTuple from django.utils.functional import cached_property from typing_extensions import override _ParamT: TypeAlias = str | int -_ParamsT: TypeAlias = _ListOrTuple[_ParamT] +_ParamsT: TypeAlias = tuple[_ParamT, ...] _AsSqlType: TypeAlias = tuple[str, _ParamsT] class PositionRef(Ref): @@ -31,7 +31,7 @@ class SQLCompiler: select: Any annotation_col_map: Any klass_info: Any - ordering_parts: Any + ordering_parts: Pattern[str] def __init__( self, query: Query, connection: BaseDatabaseWrapper, using: str | None, elide_empty: bool = True ) -> None: ... @@ -52,7 +52,7 @@ class SQLCompiler: order_by: list[tuple[Expression, tuple[str, _ParamsT, bool]]], ) -> list[_AsSqlType]: ... def collapse_group_by( - self, expressions: list[Expression], having: list[Expression] | tuple + self, expressions: list[Expression], having: list[Expression] | tuple[Any, ...] ) -> list[Expression]: ... def get_select( self, @@ -98,10 +98,12 @@ class SQLCompiler: restricted: bool | None = None, ) -> list[dict[str, Any]]: ... def get_select_for_update_of_arguments(self) -> list[Any]: ... - def get_converters(self, expressions: list[Expression]) -> dict[int, tuple[list[Callable], Expression]]: ... + def get_converters( + self, expressions: list[Expression] + ) -> dict[int, tuple[list[Callable[..., Any]], Expression]]: ... def apply_converters( - self, rows: Iterable[Iterable[Any]], converters: dict[int, tuple[list[Callable], Expression]] - ) -> Iterator[list[None | date | datetime | float | Decimal | UUID | bytes | str]]: ... + self, rows: Iterable[Iterable[Any]], converters: dict[int, tuple[list[Callable[..., Any]], Expression]] + ) -> Iterator[list[date | datetime | float | Decimal | UUID | bytes | str | None]]: ... def has_composite_fields(self, expressions: Iterable[Expression]) -> bool: ... def composite_fields_to_tuples( self, rows: Iterable[Any], expressions: Iterable[Expression] diff --git a/python/helpers/bundled_stubs/Django/django-stubs/db/models/sql/datastructures.pyi b/python/helpers/bundled_stubs/Django/django-stubs/db/models/sql/datastructures.pyi index 43c595c3275b..c63a60a106be 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/db/models/sql/datastructures.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/db/models/sql/datastructures.pyi @@ -17,7 +17,7 @@ class Join: parent_alias: str table_alias: str | None join_type: str - join_cols: tuple + join_cols: tuple[Any, ...] join_field: FieldCacheMixin nullable: bool filtered_relation: FilteredRelation | None 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 984844ec6b5c..969916a3ed59 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 @@ -37,7 +37,7 @@ class RawQuery: def get_columns(self) -> list[str]: ... def __iter__(self) -> Iterator[Any]: ... @property - def params_type(self) -> type[dict | tuple] | None: ... + def params_type(self) -> type[dict[Any, Any] | tuple[Any, ...]] | None: ... class Query(BaseExpression): alias_prefix: str @@ -56,7 +56,7 @@ class Query(BaseExpression): where: WhereNode filter_is_sticky: bool subquery: bool - group_by: None | Sequence[Combinable] | Sequence[str] | Literal[True] + group_by: Sequence[Combinable] | Sequence[str] | Literal[True] | None order_by: Sequence[_OrderByFieldName] distinct: bool distinct_fields: tuple[str, ...] @@ -64,19 +64,19 @@ class Query(BaseExpression): select_for_update: bool select_for_update_nowait: bool select_for_update_skip_locked: bool - select_for_update_of: tuple + select_for_update_of: tuple[Any, ...] select_for_no_key_update: bool select_related: dict[str, Any] | bool max_depth: int join_class: type[Join] - values_select: tuple + values_select: tuple[Any, ...] selected: dict[str, int | str | Expression] | None annotation_select_mask: list[str] | None combinator: str | None combinator_all: bool - combined_queries: tuple + combined_queries: tuple[Any, ...] extra_select_mask: set[str] | None - extra_tables: tuple + extra_tables: tuple[Any, ...] extra_order_by: Sequence[_OrderByFieldName] deferred_loading: tuple[set[str] | frozenset[str], bool] high_mark: int | None @@ -94,7 +94,7 @@ class Query(BaseExpression): @cached_property def base_table(self) -> str: ... def add_annotation(self, annotation: Any, alias: str, select: bool = True) -> None: ... - def sql_with_params(self) -> tuple[str, tuple]: ... + def sql_with_params(self) -> tuple[str, tuple[Any, ...]]: ... def __deepcopy__(self, memo: dict[int, Any]) -> Query: ... def get_compiler( self, using: str | None = None, connection: Any | None = None, elide_empty: bool = True @@ -103,7 +103,7 @@ class Query(BaseExpression): def names_to_path( self, names: Sequence[str], opts: Any, allow_many: bool = True, fail_on_missing: bool = False ) -> tuple[list[Any], Any, tuple[Any, ...], Sequence[str]]: ... - def get_meta(self) -> Options: ... + def get_meta(self) -> Options[Any]: ... def clone(self) -> Query: ... def chain(self, klass: type[Query] | None = None) -> Query: ... def get_count(self, using: str) -> int: ... @@ -231,7 +231,7 @@ class JoinPromoter: negated: bool effective_connector: str num_children: int - votes: collections.Counter + votes: collections.Counter[str] def __init__(self, connector: str, num_children: int, negated: bool) -> None: ... def add_votes(self, votes: Iterable[str]) -> None: ... def update_join_types(self, query: Query) -> set[str]: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/db/models/sql/where.pyi b/python/helpers/bundled_stubs/Django/django-stubs/db/models/sql/where.pyi index a76e35470aec..23518ee3ab20 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/db/models/sql/where.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/db/models/sql/where.pyi @@ -36,7 +36,7 @@ class WhereNode(tree.Node): def is_summary(self) -> bool: ... def resolve_expression(self, *args: Any, **kwargs: Any) -> WhereNode: ... @cached_property - def output_field(self) -> BooleanField: ... + def output_field(self) -> BooleanField[Any, Any]: ... def select_format(self, compiler: SQLCompiler, sql: str, params: _ParamsT) -> _AsSqlType: ... def get_db_converters(self, connection: BaseDatabaseWrapper) -> list[Any]: ... def get_lookup(self, lookup: str) -> type[Lookup] | None: ... 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 fddfea09187b..7a74580a6e45 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/db/transaction.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/db/transaction.pyi @@ -22,7 +22,7 @@ def set_rollback(rollback: bool, using: str | None = None) -> None: ... def mark_for_rollback_on_error(using: str | None = None) -> AbstractContextManager[None]: ... def on_commit(func: Callable[[], object], using: str | None = None, robust: bool = False) -> None: ... -_C = TypeVar("_C", bound=Callable) # Any callable +_C = TypeVar("_C", bound=Callable[..., Any]) # Any callable # Don't inherit from ContextDecorator, so we can provide a more specific signature for __call__ class Atomic: diff --git a/python/helpers/bundled_stubs/Django/django-stubs/dispatch/dispatcher.pyi b/python/helpers/bundled_stubs/Django/django-stubs/dispatch/dispatcher.pyi index c65f70ca77c0..17be5d27043e 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/dispatch/dispatcher.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/dispatch/dispatcher.pyi @@ -21,19 +21,22 @@ class Signal: def __init__(self, use_caching: bool = False) -> None: ... def connect( self, - receiver: Callable, + receiver: Callable[..., Any], sender: object | None = None, weak: bool = True, dispatch_uid: _AnyHashable | None = None, ) -> None: ... def disconnect( - self, receiver: Callable | None = None, sender: object | None = None, dispatch_uid: _AnyHashable | None = None + self, + receiver: Callable[..., Any] | None = None, + sender: object | None = None, + dispatch_uid: _AnyHashable | None = None, ) -> bool: ... def has_listeners(self, sender: Any | None = None) -> bool: ... - def send(self, sender: Any, **named: Any) -> list[tuple[Callable, str | None]]: ... - async def asend(self, sender: Any, **named: Any) -> list[tuple[Callable, str | None]]: ... - def send_robust(self, sender: Any, **named: Any) -> list[tuple[Callable, Exception | Any]]: ... - async def asend_robust(self, sender: Any, **named: Any) -> list[tuple[Callable, Exception | Any]]: ... + def send(self, sender: Any, **named: Any) -> list[tuple[Callable[..., Any], str | None]]: ... + async def asend(self, sender: Any, **named: Any) -> list[tuple[Callable[..., Any], str | None]]: ... + def send_robust(self, sender: Any, **named: Any) -> list[tuple[Callable[..., Any], Exception | Any]]: ... + async def asend_robust(self, sender: Any, **named: Any) -> list[tuple[Callable[..., Any], Exception | Any]]: ... def _live_receivers(self, sender: Any) -> tuple[list[Callable[..., Any]], list[Callable[..., Any]]]: ... _F = TypeVar("_F", bound=Callable[..., Any]) 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 e664922891c7..5a6f45a3c227 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/forms/fields.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/forms/fields.pyi @@ -1,4 +1,5 @@ import datetime +import json from collections.abc import Callable, Collection, Iterable, Iterator, Sequence from decimal import Decimal from re import Pattern @@ -104,7 +105,7 @@ class IntegerField(Field): max_value: int | Callable[[], int] | None min_value: int | Callable[[], int] | None step_size: int | Callable[[], int] | None - re_decimal: Any + re_decimal: Pattern[str] def __init__( self, *, @@ -185,11 +186,11 @@ class DecimalField(IntegerField): def widget_attrs(self, widget: Widget) -> dict[str, Any]: ... class BaseTemporalField(Field): - input_formats: Any + input_formats: Collection[str] | DateTimeFormatsIterator | None def __init__( self, *, - input_formats: Any | None = None, + input_formats: Collection[str] | DateTimeFormatsIterator | None = None, required: bool = ..., widget: Widget | type[Widget] | None = ..., label: _StrOrPromise | None = ..., @@ -209,14 +210,14 @@ class BaseTemporalField(Field): class DateField(BaseTemporalField): widget: _ClassLevelWidgetT @override - def to_python(self, value: None | str | datetime.datetime | datetime.date) -> datetime.date | None: ... + def to_python(self, value: str | datetime.datetime | datetime.date | None) -> datetime.date | None: ... @override def strptime(self, value: str, format: str) -> datetime.date: ... class TimeField(BaseTemporalField): widget: _ClassLevelWidgetT @override - def to_python(self, value: None | str | datetime.time) -> datetime.time | None: ... + def to_python(self, value: str | datetime.time | None) -> datetime.time | None: ... @override def strptime(self, value: str, format: str) -> datetime.time: ... @@ -228,7 +229,7 @@ class DateTimeField(BaseTemporalField): @override def prepare_value(self, value: Any) -> Any: ... @override - def to_python(self, value: None | str | datetime.datetime | datetime.date) -> datetime.datetime | None: ... + def to_python(self, value: str | datetime.datetime | datetime.date | None) -> datetime.datetime | None: ... @override def strptime(self, value: str, format: str) -> datetime.datetime: ... @@ -305,7 +306,7 @@ class FileField(Field): label_suffix: str | None = ..., ) -> None: ... @override - def to_python(self, data: File | None) -> File | None: ... + def to_python(self, data: File[Any] | None) -> File[Any] | None: ... @override def clean(self, data: Any, initial: Any | None = None) -> Any: ... @override @@ -315,7 +316,7 @@ class FileField(Field): class ImageField(FileField): @override - def to_python(self, data: File | None) -> File | None: ... + def to_python(self, data: File[Any] | None) -> File[Any] | None: ... @override def widget_attrs(self, widget: Widget) -> dict[str, Any]: ... @@ -618,9 +619,14 @@ class JSONString(str): ... class JSONField(CharField): default_error_messages: ClassVar[_ErrorMessagesDict] widget: _ClassLevelWidgetT - encoder: Any - decoder: Any - def __init__(self, encoder: Any | None = None, decoder: Any | None = None, **kwargs: Any) -> None: ... + encoder: type[json.JSONEncoder] | None + decoder: type[json.JSONDecoder] | None + def __init__( + self, + encoder: type[json.JSONEncoder] | None = None, + decoder: type[json.JSONDecoder] | None = None, + **kwargs: Any, + ) -> None: ... @override def to_python(self, value: Any) -> Any: ... @override 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 0d55940747c1..a1f77f4cfef4 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/forms/models.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/forms/models.pyi @@ -28,7 +28,7 @@ _Widgets: TypeAlias = dict[str, type[Widget] | Widget] _Labels: TypeAlias = dict[str, str] _HelpTexts: TypeAlias = dict[str, str] _ErrorMessages: TypeAlias = dict[str, dict[str, str]] -_FormFieldCallback: TypeAlias = Callable[[models.Field], Field | None] +_FormFieldCallback: TypeAlias = Callable[[models.Field[Any, Any]], Field | None] _M = TypeVar("_M", bound=Model) _ParentM = TypeVar("_ParentM", bound=Model) @@ -109,7 +109,7 @@ def modelform_factory( field_classes: Mapping[str, type[Field]] | None = None, ) -> type[ModelForm[_M]]: ... -_ModelFormT = TypeVar("_ModelFormT", bound=ModelForm) +_ModelFormT = TypeVar("_ModelFormT", bound=ModelForm[Any], default=ModelForm[_M]) # ONLY use together with _M class BaseModelFormSet(BaseFormSet[_ModelFormT], AltersData, Generic[_M, _ModelFormT]): model: type[_M] | None @@ -155,7 +155,7 @@ def modelformset_factory( model: type[_M], form: type[_ModelFormT] = ..., formfield_callback: _FormFieldCallback | None = None, - formset: type[BaseModelFormSet] = ..., + formset: type[BaseModelFormSet[Any, Any]] = ..., extra: int = 1, can_delete: bool = False, can_order: bool = False, @@ -181,7 +181,7 @@ class BaseInlineFormSet(BaseModelFormSet[_M, _ModelFormT], Generic[_M, _ParentM, instance: _ParentM save_as_new: bool unique_fields: Collection[str] - fk: ForeignKey # set by inlineformset_set + fk: ForeignKey[Any, Any] # set by inlineformset_set def __init__( self, data: _DataT | None = None, @@ -207,16 +207,16 @@ class BaseInlineFormSet(BaseModelFormSet[_M, _ModelFormT], Generic[_M, _ParentM, @overload def _get_foreign_key( parent_model: type[Model], model: type[Model], fk_name: str | None = None, can_fail: Literal[False] = ... -) -> ForeignKey: ... +) -> ForeignKey[Any, Any]: ... @overload def _get_foreign_key( parent_model: type[Model], model: type[Model], fk_name: str | None = None, can_fail: Literal[True] = ... -) -> ForeignKey | None: ... +) -> ForeignKey[Any, Any] | None: ... def inlineformset_factory( parent_model: type[_ParentM], model: type[_M], form: type[_ModelFormT] = ..., - formset: type[BaseInlineFormSet] = ..., + formset: type[BaseInlineFormSet[Any, Any, Any]] = ..., fk_name: str | None = None, fields: _Fields | None = None, exclude: _Fields | None = None, @@ -261,18 +261,18 @@ class InlineForeignKeyField(Field): class ModelChoiceIteratorValue: def __init__(self, value: Any, instance: Model) -> None: ... -class ModelChoiceIterator(BaseChoiceIterator): - field: ModelChoiceField - queryset: QuerySet - def __init__(self, field: ModelChoiceField) -> None: ... +class ModelChoiceIterator(BaseChoiceIterator, Generic[_M]): + field: ModelChoiceField[_M] + queryset: QuerySet[_M] + def __init__(self, field: ModelChoiceField[_M]) -> None: ... @override def __iter__(self) -> Iterator[tuple[ModelChoiceIteratorValue | str, str]]: ... def __len__(self) -> int: ... def __bool__(self) -> bool: ... - def choice(self, obj: Model) -> tuple[ModelChoiceIteratorValue, str]: ... + def choice(self, obj: _M) -> tuple[ModelChoiceIteratorValue, str]: ... class ModelChoiceField(ChoiceField, Generic[_M]): - iterator: type[ModelChoiceIterator] + iterator: type[ModelChoiceIterator[_M]] empty_label: _StrOrPromise | None queryset: QuerySet[_M] | None limit_choices_to: _AllLimitChoicesTo | None @@ -299,7 +299,7 @@ class ModelChoiceField(ChoiceField, Generic[_M]): def label_from_instance(self, obj: _M) -> str: ... choices: _PropertyDescriptor[ _ChoicesInput | _ChoicesCallable | CallableChoiceIterator, - _ChoicesInput | CallableChoiceIterator | ModelChoiceIterator, + _ChoicesInput | CallableChoiceIterator | ModelChoiceIterator[_M], ] @override def prepare_value(self, value: Any) -> Any: ... @@ -323,7 +323,7 @@ class ModelMultipleChoiceField(ModelChoiceField[_M]): @override def has_changed(self, initial: Collection[Any] | None, data: Collection[Any] | None) -> bool: ... # type: ignore[override] -def modelform_defines_fields(form_class: type[ModelForm]) -> bool: ... +def modelform_defines_fields(form_class: type[ModelForm[Any]]) -> bool: ... __all__ = ( "ALL_FIELDS", diff --git a/python/helpers/bundled_stubs/Django/django-stubs/forms/utils.pyi b/python/helpers/bundled_stubs/Django/django-stubs/forms/utils.pyi index 626a44082977..196766025580 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/forms/utils.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/forms/utils.pyi @@ -13,7 +13,7 @@ from typing_extensions import override _DataT: TypeAlias = Mapping[str, Any] # noqa: PYI047 -_FilesT: TypeAlias = MultiValueDict[str, UploadedFile] # noqa: PYI047 +_FilesT: TypeAlias = MultiValueDict[str, UploadedFile[Any]] # noqa: PYI047 def pretty_name(name: str) -> str: ... def flatatt(attrs: dict[str, Any]) -> SafeString: ... 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 c2b2cdd167ab..033635c15ff8 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/forms/widgets.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/forms/widgets.pyi @@ -1,8 +1,9 @@ import datetime from collections.abc import Iterable, Iterator, Mapping, Sequence +from re import Pattern from typing import Any, Literal, Protocol, TypeAlias, type_check_only -import _typeshed +from _typeshed import Self as MetaclassSelf # noqa: TID251 from django.core.files.base import File from django.forms.renderers import BaseRenderer from django.forms.utils import _DataT, _FilesT @@ -51,11 +52,11 @@ class Media: class MediaDefiningClass(type): def __new__( - mcs: type[_typeshed.Self], # noqa: TID251 + mcs: type[MetaclassSelf], name: str, bases: tuple[type, ...], attrs: dict[str, Any], - ) -> _typeshed.Self: ... # noqa: TID251 + ) -> MetaclassSelf: ... class Widget(metaclass=MediaDefiningClass): needs_multipart_form: bool @@ -162,7 +163,7 @@ class ClearableFileInput(FileInput): checked: bool def clear_checkbox_name(self, name: str) -> str: ... def clear_checkbox_id(self, name: str) -> str: ... - def is_initial(self, value: File | str | None) -> bool: ... + def is_initial(self, value: File[Any] | str | None) -> bool: ... @override def format_value(self, value: Any) -> Any: ... @override @@ -351,7 +352,7 @@ class SelectDateWidget(Widget): template_name: str input_type: str select_widget: type[ChoiceWidget] - date_re: Any + date_re: Pattern[str] years: Iterable[int | str] months: Mapping[int, str] year_none_value: tuple[Literal[""], str] @@ -371,7 +372,7 @@ class SelectDateWidget(Widget): @override def id_for_label(self, id_: str) -> str: ... @override - def value_from_datadict(self, data: _DataT, files: _FilesT, name: str) -> str | None | Any: ... + def value_from_datadict(self, data: _DataT, files: _FilesT, name: str) -> str | Any | None: ... @override def value_omitted_from_data(self, data: _DataT, files: _FilesT, name: str) -> bool: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/http/multipartparser.pyi b/python/helpers/bundled_stubs/Django/django-stubs/http/multipartparser.pyi index ba2ebf0abbf9..78fb56642de6 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/http/multipartparser.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/http/multipartparser.pyi @@ -22,7 +22,7 @@ class MultiPartParser: upload_handlers: list[Any] | ImmutableList[Any], encoding: str | None = ..., ) -> None: ... - def parse(self) -> tuple[QueryDict, MultiValueDict]: ... + def parse(self) -> tuple[QueryDict, MultiValueDict[Any, Any]]: ... def handle_file_complete(self, old_field_name: str, counters: list[int]) -> None: ... def sanitize_file_name(self, file_name: str) -> str | None: ... def IE_sanitize(self, file_name: str) -> str | None: ... 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 e6d13fcb546c..79085cfe004d 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/http/request.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/http/request.pyi @@ -10,6 +10,7 @@ from django.core.files import uploadedfile, uploadhandler 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 RAISE_ERROR: object @@ -47,7 +48,7 @@ class HttpRequest: POST: _ImmutableQueryDict COOKIES: dict[str, str] META: dict[str, Any] - FILES: MultiValueDict[str, uploadedfile.UploadedFile] + FILES: MultiValueDict[str, uploadedfile.UploadedFile[Any]] path: str path_info: str method: str | None @@ -56,19 +57,23 @@ class HttpRequest: content_params: dict[str, str] | None _body: bytes _stream: BinaryIO - # Attributes added by optional parts of Django - # django.contrib.admin views: - current_app: str + # Attributes set by middleware: + # https://docs.djangoproject.com/en/stable/ref/request-response/#attributes-set-by-middleware + # django.contrib.sessions.middleware.SessionMiddleware: + session: SessionBase + # django.contrib.sites.middleware.CurrentSiteMiddleware: + site: Site # django.contrib.auth.middleware.AuthenticationMiddleware: user: _AnyUser - # django.contrib.auth.middleware.AuthenticationMiddleware: auser: Callable[[], Awaitable[_AnyUser]] # django.middleware.locale.LocaleMiddleware: LANGUAGE_CODE: str - # django.contrib.sites.middleware.CurrentSiteMiddleware - site: Site - # django.contrib.sessions.middleware.SessionMiddleware - session: SessionBase + # Attributes set by application code: + # https://docs.djangoproject.com/en/stable/ref/request-response/#attributes-set-by-application-code + current_app: str + urlconf: str | None + exception_reporter_filter: SafeExceptionReporterFilter + exception_reporter_class: type[ExceptionReporter] def __init__(self) -> None: ... def get_host(self) -> str: ... def get_port(self) -> str: ... @@ -97,7 +102,7 @@ class HttpRequest: def get_preferred_type(self, media_types: Sequence[str]) -> str | None: ... def parse_file_upload( self, META: Mapping[str, Any], post_data: _PostDataProtocol - ) -> tuple[QueryDict, MultiValueDict[str, uploadedfile.UploadedFile]]: ... + ) -> tuple[QueryDict, MultiValueDict[str, uploadedfile.UploadedFile[Any]]]: ... @cached_property def headers(self) -> HttpHeaders: ... @property diff --git a/python/helpers/bundled_stubs/Django/django-stubs/middleware/cache.pyi b/python/helpers/bundled_stubs/Django/django-stubs/middleware/cache.pyi index b9f0756ee823..7099a25fd761 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/middleware/cache.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/middleware/cache.pyi @@ -3,7 +3,7 @@ from typing import Any from django.core.cache import BaseCache from django.http.request import HttpRequest from django.http.response import HttpResponse, HttpResponseBase -from django.utils.deprecation import MiddlewareMixin, _AsyncGetResponseCallable, _GetResponseCallable +from django.utils.deprecation import MiddlewareMixin, _AnyGetResponseCallable class UpdateCacheMiddleware(MiddlewareMixin): cache_timeout: float @@ -26,7 +26,7 @@ class CacheMiddleware(UpdateCacheMiddleware, FetchFromCacheMiddleware): cache_timeout: float def __init__( self, - get_response: _GetResponseCallable | _AsyncGetResponseCallable, + get_response: _AnyGetResponseCallable, cache_timeout: float | None = ..., page_timeout: float | None = ..., **kwargs: Any, diff --git a/python/helpers/bundled_stubs/Django/django-stubs/middleware/gzip.pyi b/python/helpers/bundled_stubs/Django/django-stubs/middleware/gzip.pyi index e1c10a76829e..9b71d7a29520 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/middleware/gzip.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/middleware/gzip.pyi @@ -1,10 +1,11 @@ -from typing import Any, ClassVar +from re import Pattern +from typing import ClassVar from django.http.request import HttpRequest from django.http.response import HttpResponseBase from django.utils.deprecation import MiddlewareMixin -re_accepts_gzip: Any +re_accepts_gzip: Pattern[str] class GZipMiddleware(MiddlewareMixin): max_random_bytes: ClassVar[int] diff --git a/python/helpers/bundled_stubs/Django/django-stubs/shortcuts.pyi b/python/helpers/bundled_stubs/Django/django-stubs/shortcuts.pyi index 5d1f49c4fd72..0bf127c57f1e 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/shortcuts.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/shortcuts.pyi @@ -48,4 +48,4 @@ def get_object_or_404(klass: type[_T] | Manager[_T] | QuerySet[_T], *args: Any, async def aget_object_or_404(klass: type[_T] | Manager[_T] | QuerySet[_T], *args: Any, **kwargs: Any) -> _T: ... def get_list_or_404(klass: type[_T] | Manager[_T] | QuerySet[_T], *args: Any, **kwargs: Any) -> list[_T]: ... async def aget_list_or_404(klass: type[_T] | Manager[_T] | QuerySet[_T], *args: Any, **kwargs: Any) -> list[_T]: ... -def resolve_url(to: Callable | Model | _StrOrPromise, *args: Any, **kwargs: Any) -> str: ... +def resolve_url(to: Callable[..., Any] | Model | _StrOrPromise, *args: Any, **kwargs: Any) -> str: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/tasks/backends/base.pyi b/python/helpers/bundled_stubs/Django/django-stubs/tasks/backends/base.pyi index 050f79195ba1..a006a9f6b4c0 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/tasks/backends/base.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/tasks/backends/base.pyi @@ -2,21 +2,25 @@ from abc import ABCMeta, abstractmethod from typing import Any from django.tasks.base import Task, TaskResult +from typing_extensions import ParamSpec, TypeVar + +_P = ParamSpec("_P") +_R = TypeVar("_R") class BaseTaskBackend(metaclass=ABCMeta): - task_class: type[Task] + task_class: type[Task[..., Any]] supports_defer: bool supports_async_task: bool supports_get_result: bool supports_priority: bool alias: str - queues: list[str] + queues: set[str] options: dict[str, Any] def __init__(self, alias: str, params: dict[str, Any]) -> None: ... - def validate_task(self, task: Task) -> None: ... + def validate_task(self, task: Task[..., Any]) -> None: ... @abstractmethod - def enqueue(self, task: Task, args: list[Any], kwargs: dict[str, Any]) -> TaskResult: ... - async def aenqueue(self, task: Task, args: list[Any], kwargs: dict[str, Any]) -> TaskResult: ... - def get_result(self, result_id: str) -> TaskResult: ... - async def aget_result(self, result_id: str) -> TaskResult: ... + def enqueue(self, task: Task[_P, _R], args: list[Any], kwargs: dict[str, Any]) -> TaskResult[_P, _R]: ... + async def aenqueue(self, task: Task[_P, _R], args: list[Any], kwargs: dict[str, Any]) -> TaskResult[_P, _R]: ... + def get_result(self, result_id: str) -> TaskResult[..., Any]: ... + async def aget_result(self, result_id: str) -> TaskResult[..., Any]: ... def check(self, **kwargs: Any) -> list[Any]: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/tasks/backends/dummy.pyi b/python/helpers/bundled_stubs/Django/django-stubs/tasks/backends/dummy.pyi index eef304e5dd4b..eead997022cc 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/tasks/backends/dummy.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/tasks/backends/dummy.pyi @@ -1,17 +1,20 @@ from typing import Any from django.tasks.base import Task, TaskResult -from typing_extensions import override +from typing_extensions import ParamSpec, TypeVar, override from .base import BaseTaskBackend +_P = ParamSpec("_P") +_R = TypeVar("_R") + class DummyBackend(BaseTaskBackend): - results: list[TaskResult] + results: list[TaskResult[..., Any]] def __init__(self, alias: str, params: dict[str, Any]) -> None: ... @override - def enqueue(self, task: Task, args: list[Any], kwargs: dict[str, Any]) -> TaskResult: ... + def enqueue(self, task: Task[_P, _R], args: list[Any], kwargs: dict[str, Any]) -> TaskResult[_P, _R]: ... @override - def get_result(self, result_id: str) -> TaskResult: ... + def get_result(self, result_id: str) -> TaskResult[..., Any]: ... @override - async def aget_result(self, result_id: str) -> TaskResult: ... + async def aget_result(self, result_id: str) -> TaskResult[..., Any]: ... def clear(self) -> None: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/tasks/backends/immediate.pyi b/python/helpers/bundled_stubs/Django/django-stubs/tasks/backends/immediate.pyi index 1b85365db2e9..c3b9f608deb1 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/tasks/backends/immediate.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/tasks/backends/immediate.pyi @@ -2,14 +2,17 @@ from logging import Logger from typing import Any from django.tasks.base import Task, TaskResult -from typing_extensions import override +from typing_extensions import ParamSpec, TypeVar, override from .base import BaseTaskBackend +_P = ParamSpec("_P") +_R = TypeVar("_R") + logger: Logger class ImmediateBackend(BaseTaskBackend): worker_id: str def __init__(self, alias: str, params: dict[str, Any]) -> None: ... @override - def enqueue(self, task: Task, args: list[Any], kwargs: dict[str, Any]) -> TaskResult: ... + def enqueue(self, task: Task[_P, _R], args: list[Any], kwargs: dict[str, Any]) -> TaskResult[_P, _R]: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/tasks/signals.pyi b/python/helpers/bundled_stubs/Django/django-stubs/tasks/signals.pyi index d1d338cf0580..28cc11e3c4aa 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/tasks/signals.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/tasks/signals.pyi @@ -14,6 +14,6 @@ task_finished: Signal task_started: Signal def clear_tasks_handlers(*, setting: str, **kwargs: Any) -> None: ... -def log_task_enqueued(sender: type[BaseTaskBackend], task_result: TaskResult, **kwargs: Any) -> None: ... -def log_task_started(sender: type[BaseTaskBackend], task_result: TaskResult, **kwargs: Any) -> None: ... -def log_task_finished(sender: type[BaseTaskBackend], task_result: TaskResult, **kwargs: Any) -> None: ... +def log_task_enqueued(sender: type[BaseTaskBackend], task_result: TaskResult[..., Any], **kwargs: Any) -> None: ... +def log_task_started(sender: type[BaseTaskBackend], task_result: TaskResult[..., Any], **kwargs: Any) -> None: ... +def log_task_finished(sender: type[BaseTaskBackend], task_result: TaskResult[..., Any], **kwargs: Any) -> None: ... 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 79393e22efa1..7e8dc88b43d9 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/template/context.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/template/context.pyi @@ -14,7 +14,7 @@ _ContextValues: TypeAlias = dict[str, Any] | Context class ContextPopException(Exception): ... -class ContextDict(dict): +class ContextDict(dict[Any, Any]): context: BaseContext def __init__(self, context: BaseContext, *args: Any, **kwargs: Any) -> None: ... def __enter__(self) -> Self: ... @@ -77,7 +77,7 @@ class RequestContext(Context): self, request: HttpRequest, dict_: dict[str, Any] | None = None, - processors: list[Callable] | None = None, + processors: list[Callable[..., Any]] | None = None, use_l10n: bool | None = None, use_tz: bool | None = None, autoescape: bool = True, diff --git a/python/helpers/bundled_stubs/Django/django-stubs/template/context_processors.pyi b/python/helpers/bundled_stubs/Django/django-stubs/template/context_processors.pyi index 8f71c34d2ae7..6ab082dc408e 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/template/context_processors.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/template/context_processors.pyi @@ -1,4 +1,5 @@ from collections.abc import Callable +from typing import Any from django.http.request import HttpRequest from django.utils.functional import SimpleLazyObject @@ -6,9 +7,9 @@ from typing_extensions import TypeVar _R = TypeVar("_R", bound=HttpRequest) -def csp(request: HttpRequest) -> dict[str, SimpleLazyObject | None]: ... -def csrf(request: HttpRequest) -> dict[str, SimpleLazyObject]: ... -def debug(request: HttpRequest) -> dict[str, Callable | bool]: ... +def csp(request: HttpRequest) -> dict[str, SimpleLazyObject[str] | None]: ... +def csrf(request: HttpRequest) -> dict[str, SimpleLazyObject[str]]: ... +def debug(request: HttpRequest) -> dict[str, Callable[..., Any] | bool]: ... def i18n(request: HttpRequest) -> dict[str, list[tuple[str, str]] | bool | str]: ... def tz(request: HttpRequest) -> dict[str, str]: ... def static(request: HttpRequest) -> dict[str, str]: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/template/response.pyi b/python/helpers/bundled_stubs/Django/django-stubs/template/response.pyi index e6298e1138ba..9eb88cf60597 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/template/response.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/template/response.pyi @@ -1,14 +1,9 @@ -import functools from collections.abc import Callable, Iterator, Sequence from http.cookies import SimpleCookie from typing import Any, TypeAlias -from django.core.handlers.wsgi import WSGIRequest from django.http import HttpResponse from django.http.request import HttpRequest -from django.template.base import Template -from django.template.context import RequestContext -from django.test.client import Client from typing_extensions import override from .backends.base import _EngineTemplate @@ -40,7 +35,7 @@ class SimpleTemplateResponse(HttpResponse): def resolve_context(self, context: dict[str, Any] | None) -> dict[str, Any] | None: ... @property def rendered_content(self) -> str: ... - def add_post_render_callback(self, callback: Callable) -> None: ... + def add_post_render_callback(self, callback: Callable[..., Any]) -> None: ... def render(self) -> SimpleTemplateResponse: ... @property def is_rendered(self) -> bool: ... @@ -48,19 +43,13 @@ class SimpleTemplateResponse(HttpResponse): def __iter__(self) -> Iterator[Any]: ... class TemplateResponse(SimpleTemplateResponse): - client: Client closed: bool - context: RequestContext context_data: dict[str, Any] | None cookies: SimpleCookie - csrf_cookie_set: bool - json: functools.partial _request: HttpRequest status_code: int template_name: _TemplateForResponseT - templates: list[Template] using: str | None - wsgi_request: WSGIRequest rendering_attrs: Any def __init__( self, diff --git a/python/helpers/bundled_stubs/Django/django-stubs/test/client.pyi b/python/helpers/bundled_stubs/Django/django-stubs/test/client.pyi index fbd9260b2b7e..d92b57aa1575 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/test/client.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/test/client.pyi @@ -4,9 +4,9 @@ from http.cookies import SimpleCookie from io import BytesIO, IOBase from json import JSONEncoder from re import Pattern -from types import TracebackType from typing import Any, Generic, Literal, NoReturn, TypeAlias, TypedDict, type_check_only +from _typeshed import ExcInfo from asgiref.typing import ASGIVersions from django.contrib.auth.models import _User from django.contrib.sessions.backends.base import SessionBase @@ -86,7 +86,7 @@ class _RequestFactory(Generic[_T]): self, *, json_encoder: type[JSONEncoder] = ..., - headers: Mapping[str, Any] | None = ..., + headers: Mapping[str, str] | None = ..., query_params: Mapping[Any, Any] | None = ..., **defaults: Any, ) -> None: ... @@ -97,7 +97,7 @@ class _RequestFactory(Generic[_T]): data: _GetDataType = ..., secure: bool = ..., *, - headers: Mapping[str, Any] | None = ..., + headers: Mapping[str, str] | None = ..., query_params: Mapping[Any, Any] | None = ..., **extra: Any, ) -> _T: ... @@ -108,7 +108,7 @@ class _RequestFactory(Generic[_T]): content_type: str = ..., secure: bool = ..., *, - headers: Mapping[str, Any] | None = ..., + headers: Mapping[str, str] | None = ..., query_params: Mapping[Any, Any] | None = ..., **extra: Any, ) -> _T: ... @@ -118,7 +118,7 @@ class _RequestFactory(Generic[_T]): data: Any = ..., secure: bool = ..., *, - headers: Mapping[str, Any] | None = ..., + headers: Mapping[str, str] | None = ..., query_params: Mapping[Any, Any] | None = ..., **extra: Any, ) -> _T: ... @@ -127,7 +127,7 @@ class _RequestFactory(Generic[_T]): path: _StrOrPromise, secure: bool = ..., *, - headers: Mapping[str, Any] | None = ..., + headers: Mapping[str, str] | None = ..., query_params: Mapping[Any, Any] | None = ..., **extra: Any, ) -> _T: ... @@ -138,7 +138,7 @@ class _RequestFactory(Generic[_T]): content_type: str = ..., secure: bool = ..., *, - headers: Mapping[str, Any] | None = ..., + headers: Mapping[str, str] | None = ..., query_params: Mapping[Any, Any] | None = ..., **extra: Any, ) -> _T: ... @@ -149,7 +149,7 @@ class _RequestFactory(Generic[_T]): content_type: str = ..., secure: bool = ..., *, - headers: Mapping[str, Any] | None = ..., + headers: Mapping[str, str] | None = ..., query_params: Mapping[Any, Any] | None = ..., **extra: Any, ) -> _T: ... @@ -160,7 +160,7 @@ class _RequestFactory(Generic[_T]): content_type: str = ..., secure: bool = ..., *, - headers: Mapping[str, Any] | None = ..., + headers: Mapping[str, str] | None = ..., query_params: Mapping[Any, Any] | None = ..., **extra: Any, ) -> _T: ... @@ -171,7 +171,7 @@ class _RequestFactory(Generic[_T]): content_type: str = ..., secure: bool = ..., *, - headers: Mapping[str, Any] | None = ..., + headers: Mapping[str, str] | None = ..., query_params: Mapping[Any, Any] | None = ..., **extra: Any, ) -> _T: ... @@ -183,7 +183,7 @@ class _RequestFactory(Generic[_T]): content_type: str | None = ..., secure: bool = ..., *, - headers: Mapping[str, Any] | None = ..., + headers: Mapping[str, str] | None = ..., query_params: Mapping[Any, Any] | None = ..., **extra: Any, ) -> _T: ... @@ -258,7 +258,7 @@ class _MonkeyPatchedASGIResponse(_ASGIResponse): redirect_chain: list[tuple[str, int]] class ClientMixin: - def store_exc_info(self, **kwargs: Any) -> None: ... + def store_exc_info(self, **kwargs: object) -> None: ... def check_exception(self, response: HttpResponseBase) -> NoReturn: ... @property def session(self) -> SessionBase: ... @@ -273,15 +273,15 @@ class ClientMixin: class Client(ClientMixin, _RequestFactory[_MonkeyPatchedWSGIResponse]): handler: ClientHandler raise_request_exception: bool - exc_info: tuple[type[BaseException], BaseException, TracebackType] | None + exc_info: ExcInfo | None extra: dict[str, Any] | None - headers: dict[str, Any] + headers: Mapping[str, str] | None def __init__( self, enforce_csrf_checks: bool = ..., raise_request_exception: bool = ..., *, - headers: Mapping[str, Any] | None = ..., + headers: Mapping[str, str] | None = ..., query_params: Mapping[Any, Any] | None = ..., **defaults: Any, ) -> None: ... @@ -295,7 +295,7 @@ class Client(ClientMixin, _RequestFactory[_MonkeyPatchedWSGIResponse]): follow: bool = ..., secure: bool = ..., *, - headers: Mapping[str, Any] | None = ..., + headers: Mapping[str, str] | None = ..., query_params: Mapping[Any, Any] | None = ..., **extra: Any, ) -> _MonkeyPatchedWSGIResponse: ... @@ -308,7 +308,7 @@ class Client(ClientMixin, _RequestFactory[_MonkeyPatchedWSGIResponse]): follow: bool = ..., secure: bool = ..., *, - headers: Mapping[str, Any] | None = ..., + headers: Mapping[str, str] | None = ..., query_params: Mapping[Any, Any] | None = ..., **extra: Any, ) -> _MonkeyPatchedWSGIResponse: ... @@ -320,7 +320,7 @@ class Client(ClientMixin, _RequestFactory[_MonkeyPatchedWSGIResponse]): follow: bool = ..., secure: bool = ..., *, - headers: Mapping[str, Any] | None = ..., + headers: Mapping[str, str] | None = ..., query_params: Mapping[Any, Any] | None = ..., **extra: Any, ) -> _MonkeyPatchedWSGIResponse: ... @@ -333,7 +333,7 @@ class Client(ClientMixin, _RequestFactory[_MonkeyPatchedWSGIResponse]): follow: bool = ..., secure: bool = ..., *, - headers: Mapping[str, Any] | None = ..., + headers: Mapping[str, str] | None = ..., query_params: Mapping[Any, Any] | None = ..., **extra: Any, ) -> _MonkeyPatchedWSGIResponse: ... @@ -346,7 +346,7 @@ class Client(ClientMixin, _RequestFactory[_MonkeyPatchedWSGIResponse]): follow: bool = ..., secure: bool = ..., *, - headers: Mapping[str, Any] | None = ..., + headers: Mapping[str, str] | None = ..., query_params: Mapping[Any, Any] | None = ..., **extra: Any, ) -> _MonkeyPatchedWSGIResponse: ... @@ -359,7 +359,7 @@ class Client(ClientMixin, _RequestFactory[_MonkeyPatchedWSGIResponse]): follow: bool = ..., secure: bool = ..., *, - headers: Mapping[str, Any] | None = ..., + headers: Mapping[str, str] | None = ..., query_params: Mapping[Any, Any] | None = ..., **extra: Any, ) -> _MonkeyPatchedWSGIResponse: ... @@ -372,7 +372,7 @@ class Client(ClientMixin, _RequestFactory[_MonkeyPatchedWSGIResponse]): follow: bool = ..., secure: bool = ..., *, - headers: Mapping[str, Any] | None = ..., + headers: Mapping[str, str] | None = ..., query_params: Mapping[Any, Any] | None = ..., **extra: Any, ) -> _MonkeyPatchedWSGIResponse: ... @@ -384,7 +384,7 @@ class Client(ClientMixin, _RequestFactory[_MonkeyPatchedWSGIResponse]): follow: bool = ..., secure: bool = ..., *, - headers: Mapping[str, Any] | None = ..., + headers: Mapping[str, str] | None = ..., query_params: Mapping[Any, Any] | None = ..., **extra: Any, ) -> _MonkeyPatchedWSGIResponse: ... @@ -392,15 +392,15 @@ class Client(ClientMixin, _RequestFactory[_MonkeyPatchedWSGIResponse]): class AsyncClient(ClientMixin, _AsyncRequestFactory[Awaitable[_MonkeyPatchedASGIResponse]]): handler: AsyncClientHandler raise_request_exception: bool - exc_info: Any + exc_info: ExcInfo | None extra: dict[str, Any] | None - headers: dict[str, Any] + headers: Mapping[str, str] | None def __init__( self, enforce_csrf_checks: bool = ..., raise_request_exception: bool = ..., *, - headers: Mapping[str, Any] | None = ..., + headers: Mapping[str, str] | None = ..., query_params: Mapping[Any, Any] | None = ..., **defaults: Any, ) -> None: ... @@ -414,7 +414,7 @@ class AsyncClient(ClientMixin, _AsyncRequestFactory[Awaitable[_MonkeyPatchedASGI follow: bool = ..., secure: bool = ..., *, - headers: Mapping[str, Any] | None = ..., + headers: Mapping[str, str] | None = ..., query_params: Mapping[Any, Any] | None = ..., **extra: Any, ) -> _MonkeyPatchedASGIResponse: ... @@ -427,7 +427,7 @@ class AsyncClient(ClientMixin, _AsyncRequestFactory[Awaitable[_MonkeyPatchedASGI follow: bool = ..., secure: bool = ..., *, - headers: Mapping[str, Any] | None = ..., + headers: Mapping[str, str] | None = ..., query_params: Mapping[Any, Any] | None = ..., **extra: Any, ) -> _MonkeyPatchedASGIResponse: ... @@ -439,7 +439,7 @@ class AsyncClient(ClientMixin, _AsyncRequestFactory[Awaitable[_MonkeyPatchedASGI follow: bool = ..., secure: bool = ..., *, - headers: Mapping[str, Any] | None = ..., + headers: Mapping[str, str] | None = ..., query_params: Mapping[Any, Any] | None = ..., **extra: Any, ) -> _MonkeyPatchedASGIResponse: ... @@ -452,7 +452,7 @@ class AsyncClient(ClientMixin, _AsyncRequestFactory[Awaitable[_MonkeyPatchedASGI follow: bool = ..., secure: bool = ..., *, - headers: Mapping[str, Any] | None = ..., + headers: Mapping[str, str] | None = ..., query_params: Mapping[Any, Any] | None = ..., **extra: Any, ) -> _MonkeyPatchedASGIResponse: ... @@ -465,7 +465,7 @@ class AsyncClient(ClientMixin, _AsyncRequestFactory[Awaitable[_MonkeyPatchedASGI follow: bool = ..., secure: bool = ..., *, - headers: Mapping[str, Any] | None = ..., + headers: Mapping[str, str] | None = ..., query_params: Mapping[Any, Any] | None = ..., **extra: Any, ) -> _MonkeyPatchedASGIResponse: ... @@ -478,7 +478,7 @@ class AsyncClient(ClientMixin, _AsyncRequestFactory[Awaitable[_MonkeyPatchedASGI follow: bool = ..., secure: bool = ..., *, - headers: Mapping[str, Any] | None = ..., + headers: Mapping[str, str] | None = ..., query_params: Mapping[Any, Any] | None = ..., **extra: Any, ) -> _MonkeyPatchedASGIResponse: ... @@ -491,7 +491,7 @@ class AsyncClient(ClientMixin, _AsyncRequestFactory[Awaitable[_MonkeyPatchedASGI follow: bool = ..., secure: bool = ..., *, - headers: Mapping[str, Any] | None = ..., + headers: Mapping[str, str] | None = ..., query_params: Mapping[Any, Any] | None = ..., **extra: Any, ) -> _MonkeyPatchedASGIResponse: ... @@ -503,7 +503,7 @@ class AsyncClient(ClientMixin, _AsyncRequestFactory[Awaitable[_MonkeyPatchedASGI follow: bool = ..., secure: bool = ..., *, - headers: Mapping[str, Any] | None = ..., + headers: Mapping[str, str] | None = ..., query_params: Mapping[Any, Any] | None = ..., **extra: Any, ) -> _MonkeyPatchedASGIResponse: ... 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 96f5d9a45786..a6aea5ff6bb4 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/test/selenium.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/test/selenium.pyi @@ -3,6 +3,7 @@ from contextlib import AbstractContextManager from types import TracebackType from typing import Any, TypeAlias +from _typeshed import Self as MetaclassSelf # noqa: TID251 from django.test import LiveServerTestCase from typing_extensions import Self, TypeVar @@ -17,7 +18,9 @@ class SeleniumTestCaseBase(type): external_host: str | None = None browser: Any headless: bool = False - def __new__(cls, name: str, bases: tuple[type, ...], attrs: dict[str, Any]) -> SeleniumTestCaseBase: ... + def __new__( + cls: type[MetaclassSelf], name: str, bases: tuple[type, ...], attrs: dict[str, Any] + ) -> MetaclassSelf: ... @classmethod def import_webdriver(cls, browser: Any) -> type[_WebDriver]: ... @classmethod 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 97887f0aa378..4bc37aa0049d 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/test/testcases.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/test/testcases.pyi @@ -110,7 +110,7 @@ class SimpleTestCase(unittest.TestCase): ) -> None: ... def assertFormSetError( self, - formset: BaseFormSet, + formset: BaseFormSet[Any], form_index: int | None, field: str | None, errors: list[str] | str, @@ -167,7 +167,7 @@ class TransactionTestCase(SimpleTestCase): serialized_rollback: bool def assertQuerySetEqual( self, - qs: Iterator[Any] | list[Model] | QuerySet | RawQuerySet, + qs: Iterator[Any] | list[Model] | QuerySet[Any] | RawQuerySet[Any], values: Iterable[Any], transform: Callable[[Model], Any] | type[str] | None = None, ordered: bool = True, 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 2d34b341f878..c7dbcf8cbd15 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/test/utils.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/test/utils.pyi @@ -116,7 +116,7 @@ class ignore_warnings(TestContextDecorator): ignore_kwargs: dict[str, Any] filter_func: Callable[..., Any] def __init__(self, **kwargs: Any) -> None: ... - catch_warnings: AbstractContextManager[list | None] + catch_warnings: AbstractContextManager[list[Any] | None] requires_tz_support: Any diff --git a/python/helpers/bundled_stubs/Django/django-stubs/urls/resolvers.pyi b/python/helpers/bundled_stubs/Django/django-stubs/urls/resolvers.pyi index 157dd265da55..d2d8ea475556 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/urls/resolvers.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/urls/resolvers.pyi @@ -111,7 +111,7 @@ class URLResolver: namespace: str | None app_name: str | None _local: Any - _reverse_dict: MultiValueDict + _reverse_dict: MultiValueDict[Any, Any] def __init__( self, pattern: _Pattern, @@ -121,13 +121,13 @@ class URLResolver: namespace: str | None = None, ) -> None: ... @property - def reverse_dict(self) -> MultiValueDict: ... + def reverse_dict(self) -> MultiValueDict[Any, Any]: ... @property def namespace_dict(self) -> dict[str, tuple[str, URLResolver]]: ... @property def app_dict(self) -> dict[str, list[str]]: ... @cached_property - def urlconf_module(self) -> ModuleType | None | Sequence[_AnyURL]: ... + def urlconf_module(self) -> ModuleType | Sequence[_AnyURL] | None: ... @cached_property def url_patterns(self) -> list[_AnyURL]: ... def check(self) -> list[CheckMessage]: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/utils/_os.pyi b/python/helpers/bundled_stubs/Django/django-stubs/utils/_os.pyi index 5307f8208af8..832374919131 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/utils/_os.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/utils/_os.pyi @@ -1,13 +1,9 @@ -import os from pathlib import Path -from typing import TypeAlias -_PathCompatible: TypeAlias = str | os.PathLike[str] +from _typeshed import StrPath -def makedirs( - name: _PathCompatible, mode: int = 0o777, exist_ok: bool = False, *, parent_mode: int | None = None -) -> None: ... -def safe_makedirs(name: _PathCompatible, mode: int = 0o777, exist_ok: bool = False) -> None: ... -def safe_join(base: _PathCompatible, *paths: _PathCompatible) -> str: ... +def makedirs(name: StrPath, mode: int = 0o777, exist_ok: bool = False, *, parent_mode: int | None = None) -> None: ... +def safe_makedirs(name: StrPath, mode: int = 0o777, exist_ok: bool = False) -> None: ... +def safe_join(base: StrPath, *paths: StrPath) -> str: ... def symlinks_supported() -> bool: ... def to_path(value: Path | str) -> Path: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/utils/autoreload.pyi b/python/helpers/bundled_stubs/Django/django-stubs/utils/autoreload.pyi index 8818899add71..8e4bc4e0c2ef 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/utils/autoreload.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/utils/autoreload.pyi @@ -6,9 +6,9 @@ from logging import Logger from pathlib import Path from typing import Any +from _typeshed import StrPath from django.apps.registry import Apps from django.dispatch import Signal -from django.utils._os import _PathCompatible from django.utils.functional import cached_property from typing_extensions import ParamSpec, override @@ -20,14 +20,12 @@ file_changed: Signal DJANGO_AUTORELOAD_ENV: str def is_django_module(module: types.ModuleType) -> bool: ... -def is_django_path(path: _PathCompatible) -> bool: ... +def is_django_path(path: StrPath) -> bool: ... def check_errors(fn: Callable[_P, Any]) -> Callable[_P, None]: ... def raise_last_exception() -> None: ... def ensure_echo_on() -> None: ... def iter_all_python_module_files() -> set[Path]: ... -def iter_modules_and_files( - modules: Iterable[types.ModuleType], extra_files: Iterable[_PathCompatible] -) -> frozenset[Path]: ... +def iter_modules_and_files(modules: Iterable[types.ModuleType], extra_files: Iterable[StrPath]) -> frozenset[Path]: ... def common_roots(paths: Iterable[Path]) -> Iterable[Path]: ... def sys_path_directories() -> Iterator[Path]: ... def get_child_arguments() -> list[str]: ... @@ -38,7 +36,7 @@ class BaseReloader: extra_files: set[Path] directory_globs: dict[Path, set[str]] def __init__(self) -> None: ... - def watch_dir(self, path: _PathCompatible, glob: str) -> None: ... + def watch_dir(self, path: StrPath, glob: str) -> None: ... def watched_files(self, include_globs: bool = True) -> Iterator[Path]: ... def wait_for_apps_ready(self, app_reg: Apps, django_main_thread: threading.Thread) -> bool: ... def run(self, django_main_thread: threading.Thread) -> None: ... @@ -46,7 +44,7 @@ class BaseReloader: def tick(self) -> Iterator[None]: ... @classmethod def check_availability(cls) -> bool | None: ... - def notify_file_changed(self, path: _PathCompatible) -> None: ... + def notify_file_changed(self, path: StrPath) -> None: ... @property def should_stop(self) -> bool: ... def stop(self) -> None: ... 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 00873355f9a5..a629602757e6 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/utils/cache.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/utils/cache.pyi @@ -1,11 +1,12 @@ 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: Any # Any: SimpleLazyObject wrapping a compiled regex +cc_delim_re: Pattern[str] def patch_cache_control(response: HttpResponseBase, **kwargs: Any) -> None: ... def get_max_age(response: HttpResponseBase) -> int | None: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/utils/choices.pyi b/python/helpers/bundled_stubs/Django/django-stubs/utils/choices.pyi index 6e88c3a738f8..cb551b234b8d 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/utils/choices.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/utils/choices.pyi @@ -8,7 +8,8 @@ _Choice: TypeAlias = tuple[Any, Any] _ChoiceNamedGroup: TypeAlias = tuple[str, Iterable[_Choice]] _Choices: TypeAlias = Iterable[_Choice | _ChoiceNamedGroup] _ChoicesMapping: TypeAlias = Mapping[Any, Any] -_ChoicesInput: TypeAlias = _Choices | _ChoicesMapping | type[Choices] | Callable[[], _Choices | _ChoicesMapping] # noqa: PYI047 +_ChoicesPrimitive: TypeAlias = _Choices | _ChoicesMapping | type[Choices] +_ChoicesInput: TypeAlias = _ChoicesPrimitive | Callable[[], _ChoicesPrimitive] # noqa: PYI047 @type_check_only class _ChoicesCallable(Protocol): 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 ca85c56ce0c6..56ee27a23c01 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/utils/csp.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/utils/csp.pyi @@ -27,10 +27,12 @@ class CSP(_StrEnum): NONCE = "" -class LazyNonce(SimpleLazyObject): +class LazyNonce(SimpleLazyObject[str]): def __init__(self) -> None: ... @override def __bool__(self) -> bool: ... def generate_nonce() -> str: ... -def build_policy(config: Mapping[str, Collection[str] | str], nonce: SimpleLazyObject | str | None = None) -> str: ... +def build_policy( + config: Mapping[str, Collection[str] | str], nonce: SimpleLazyObject[str] | str | None = None +) -> str: ... 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 b37f4f4bb3f9..f3ae232a5ac8 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/utils/deprecation.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/utils/deprecation.pyi @@ -1,6 +1,7 @@ from collections.abc import Awaitable, Callable, Sequence from typing import Any, ClassVar, Protocol, TypeAlias, type_check_only +from _typeshed import Self as MetaclassSelf # noqa: TID251 from django.http.request import HttpRequest from django.http.response import HttpResponseBase from typing_extensions import TypeVar @@ -27,24 +28,22 @@ class warn_about_renamed_method: class RenameMethodsBase(type): renamed_methods: tuple[tuple[str, str, type[DeprecationWarning]], ...] - def __new__(cls, name: str, bases: tuple[type, ...], attrs: dict[str, Any]) -> type: ... + def __new__( + cls: type[MetaclassSelf], name: str, bases: tuple[type, ...], attrs: dict[str, Any] + ) -> MetaclassSelf: ... def deprecate_posargs(deprecation_warning: type[Warning], remappable_names: Sequence[str], /) -> Callable[[_C], _C]: ... @type_check_only -class _GetResponseCallable(Protocol): - def __call__(self, request: HttpRequest, /) -> HttpResponseBase: ... - -@type_check_only -class _AsyncGetResponseCallable(Protocol): - def __call__(self, request: HttpRequest, /) -> Awaitable[HttpResponseBase]: ... +class _AnyGetResponseCallable(Protocol): + def __call__(self, request: HttpRequest, /) -> HttpResponseBase | Awaitable[HttpResponseBase]: ... class MiddlewareMixin: sync_capable: ClassVar[bool] async_capable: ClassVar[bool] - get_response: _GetResponseCallable | _AsyncGetResponseCallable + get_response: _AnyGetResponseCallable async_mode: bool - def __init__(self, get_response: _GetResponseCallable | _AsyncGetResponseCallable) -> None: ... + def __init__(self, get_response: _AnyGetResponseCallable) -> None: ... def __call__(self, request: HttpRequest) -> HttpResponseBase | Awaitable[HttpResponseBase]: ... async def __acall__(self, request: HttpRequest) -> HttpResponseBase: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/utils/html.pyi b/python/helpers/bundled_stubs/Django/django-stubs/utils/html.pyi index 0b5397742491..bd9e9dd9996c 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/utils/html.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/utils/html.pyi @@ -4,14 +4,14 @@ from json import JSONEncoder from re import Pattern from typing import Any, overload -from django.utils.functional import SimpleLazyObject, _StrOrPromise, cached_property +from django.utils.functional import _StrOrPromise, cached_property from django.utils.safestring import SafeData, SafeString from typing_extensions import deprecated, override VOID_ELEMENTS: frozenset[str] MAX_URL_LENGTH: int MAX_STRIP_TAGS_DEPTH: int -long_open_tag_without_closing_re: SimpleLazyObject +long_open_tag_without_closing_re: Pattern[str] def escape(text: Any) -> SafeString: ... def escapejs(value: Any) -> SafeString: ... @@ -50,9 +50,9 @@ class CountsDict(dict[str, Any]): class Urlizer: trailing_punctuation_chars: str wrapping_punctuation: list[tuple[str, str]] - word_split_re: Pattern[str] | SimpleLazyObject - simple_url_re: Pattern[str] | SimpleLazyObject - simple_url_2_re: Pattern[str] | SimpleLazyObject + word_split_re: Pattern[str] + simple_url_re: Pattern[str] + simple_url_2_re: Pattern[str] mailto_template: str url_template: str def __call__( diff --git a/python/helpers/bundled_stubs/Django/django-stubs/utils/regex_helper.pyi b/python/helpers/bundled_stubs/Django/django-stubs/utils/regex_helper.pyi index 62a0083ebaa5..e37258fc2e28 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/utils/regex_helper.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/utils/regex_helper.pyi @@ -1,13 +1,14 @@ from collections.abc import Iterator, Mapping from re import Pattern +from typing import Any from typing_extensions import TypeVar ESCAPE_MAPPINGS: Mapping[str, str | None] -class Choice(list): ... -class Group(list): ... -class NonCapture(list): ... +class Choice(list[Any]): ... +class Group(list[Any]): ... +class NonCapture(list[Any]): ... def normalize(pattern: str) -> list[tuple[str, list[str]]]: ... def next_char(input_iter: Iterator[str]) -> Iterator[tuple[str, bool]]: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/utils/text.pyi b/python/helpers/bundled_stubs/Django/django-stubs/utils/text.pyi index 2ea435f83851..30b6de64fc33 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/utils/text.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/utils/text.pyi @@ -39,7 +39,7 @@ class TruncateCharsHTMLParser(TruncateHTMLParser): class TruncateWordsHTMLParser(TruncateHTMLParser): def process(self, data: str) -> tuple[str, str]: ... -class Truncator(SimpleLazyObject): +class Truncator(SimpleLazyObject[str]): def __init__(self, text: Model | str) -> None: ... def chars(self, num: int, truncate: str | None = None, html: bool = False) -> str: ... def words(self, num: int, truncate: str | None = None, html: bool = False) -> str: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/utils/translation/__init__.pyi b/python/helpers/bundled_stubs/Django/django-stubs/utils/translation/__init__.pyi index 2641318f4361..c6b8cbec040b 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/utils/translation/__init__.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/utils/translation/__init__.pyi @@ -11,7 +11,7 @@ def gettext_noop(message: str) -> str: ... def gettext(message: str) -> str: ... def ngettext(singular: str, plural: str, number: float) -> str: ... def pgettext(context: str, message: str) -> str: ... -def npgettext(context: str, singular: str, plural: str, number: int) -> str: ... +def npgettext(context: str, singular: str, plural: str, number: float) -> str: ... # lazy evaluated translation functions def gettext_lazy(message: str) -> _StrPromise: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/views/debug.pyi b/python/helpers/bundled_stubs/Django/django-stubs/views/debug.pyi index 19a149bf8b43..712c671bb22f 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/views/debug.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/views/debug.pyi @@ -12,7 +12,7 @@ from django.utils.safestring import SafeString DEBUG_ENGINE: Engine class CallableSettingWrapper: - def __init__(self, callable_setting: Callable | type[Any]) -> None: ... + def __init__(self, callable_setting: Callable[..., Any] | type[Any]) -> None: ... class ExceptionCycleWarning(UserWarning): ... 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 f32397e9968f..e97881c0972b 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 @@ -1,11 +1,11 @@ import logging from collections.abc import Callable, Mapping, Sequence -from typing import Any +from typing import Any, Generic from django.http.request import HttpRequest from django.http.response import HttpResponse, HttpResponseBase from django.utils.functional import _Getter -from typing_extensions import override +from typing_extensions import TypeVar, override logger: logging.Logger @@ -13,7 +13,9 @@ class ContextMixin: extra_context: Mapping[str, Any] | None def get_context_data(self, **kwargs: Any) -> dict[str, Any]: ... -class View: +_ViewResponse = TypeVar("_ViewResponse", bound=HttpResponseBase, default=HttpResponseBase) + +class View(Generic[_ViewResponse]): http_method_names: Sequence[str] request: HttpRequest args: Any @@ -21,23 +23,25 @@ class View: def __init__(self, **kwargs: Any) -> None: ... view_is_async: _Getter[bool] | bool @classmethod - def as_view(cls: Any, **initkwargs: Any) -> Callable[..., HttpResponseBase]: ... + def as_view(cls: Any, **initkwargs: Any) -> Callable[..., _ViewResponse]: ... def setup(self, request: HttpRequest, *args: Any, **kwargs: Any) -> None: ... def dispatch(self, request: HttpRequest, *args: Any, **kwargs: Any) -> HttpResponseBase: ... def http_method_not_allowed(self, request: HttpRequest, *args: Any, **kwargs: Any) -> HttpResponse: ... def options(self, request: HttpRequest, *args: Any, **kwargs: Any) -> HttpResponseBase: ... -class TemplateResponseMixin: +_TemplateResponse = TypeVar("_TemplateResponse", bound=HttpResponse, default=HttpResponse) + +class TemplateResponseMixin(Generic[_TemplateResponse]): template_name: str | None template_engine: str | None - response_class: type[HttpResponse] + response_class: type[_TemplateResponse] content_type: str | None request: HttpRequest - def render_to_response(self, context: dict[str, Any], **response_kwargs: Any) -> HttpResponse: ... + def render_to_response(self, context: dict[str, Any], **response_kwargs: Any) -> _TemplateResponse: ... def get_template_names(self) -> list[str]: ... -class TemplateView(TemplateResponseMixin, ContextMixin, View): - def get(self, request: HttpRequest, *args: Any, **kwargs: Any) -> HttpResponse: ... +class TemplateView(TemplateResponseMixin[_TemplateResponse], ContextMixin, View[_TemplateResponse]): + def get(self, request: HttpRequest, *args: Any, **kwargs: Any) -> _TemplateResponse: ... class RedirectView(View): permanent: bool diff --git a/python/helpers/bundled_stubs/Django/django-stubs/views/generic/dates.pyi b/python/helpers/bundled_stubs/Django/django-stubs/views/generic/dates.pyi index c77cb251ca36..f6b18511e8da 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/views/generic/dates.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/views/generic/dates.pyi @@ -57,21 +57,21 @@ class DateMixin: class BaseDateListView(MultipleObjectMixin[_M], DateMixin, View): date_list_period: str def get(self, request: HttpRequest, *args: Any, **kwargs: Any) -> HttpResponse: ... - def get_dated_items(self) -> _DatedItems: ... + def get_dated_items(self) -> _DatedItems[_M]: ... @override def get_ordering(self) -> str | Sequence[_OrderByFieldName]: ... def get_dated_queryset(self, **lookup: Any) -> models.query.QuerySet[_M]: ... def get_date_list_period(self) -> str: ... def get_date_list( - self, queryset: models.query.QuerySet, date_type: str | None = ..., ordering: str = ... - ) -> models.query.QuerySet: ... + self, queryset: models.query.QuerySet[_M], date_type: str | None = ..., ordering: str = ... + ) -> models.query.QuerySet[_M]: ... class BaseArchiveIndexView(BaseDateListView[_M]): context_object_name: str @override def get_dated_items(self) -> _DatedItems[_M]: ... -class ArchiveIndexView(MultipleObjectTemplateResponseMixin, BaseArchiveIndexView): +class ArchiveIndexView(MultipleObjectTemplateResponseMixin, BaseArchiveIndexView[_M]): template_name_suffix: str class BaseYearArchiveView(YearMixin, BaseDateListView[_M]): @@ -81,7 +81,7 @@ class BaseYearArchiveView(YearMixin, BaseDateListView[_M]): def get_dated_items(self) -> _DatedItems[_M]: ... def get_make_object_list(self) -> bool: ... -class YearArchiveView(MultipleObjectTemplateResponseMixin, BaseYearArchiveView): +class YearArchiveView(MultipleObjectTemplateResponseMixin, BaseYearArchiveView[_M]): template_name_suffix: str class BaseMonthArchiveView(YearMixin, MonthMixin, BaseDateListView[_M]): @@ -89,35 +89,35 @@ class BaseMonthArchiveView(YearMixin, MonthMixin, BaseDateListView[_M]): @override def get_dated_items(self) -> _DatedItems[_M]: ... -class MonthArchiveView(MultipleObjectTemplateResponseMixin, BaseMonthArchiveView): +class MonthArchiveView(MultipleObjectTemplateResponseMixin, BaseMonthArchiveView[_M]): template_name_suffix: str class BaseWeekArchiveView(YearMixin, WeekMixin, BaseDateListView[_M]): @override def get_dated_items(self) -> _DatedItems[_M]: ... -class WeekArchiveView(MultipleObjectTemplateResponseMixin, BaseWeekArchiveView): +class WeekArchiveView(MultipleObjectTemplateResponseMixin, BaseWeekArchiveView[_M]): template_name_suffix: str class BaseDayArchiveView(YearMixin, MonthMixin, DayMixin, BaseDateListView[_M]): @override def get_dated_items(self) -> _DatedItems[_M]: ... -class DayArchiveView(MultipleObjectTemplateResponseMixin, BaseDayArchiveView): +class DayArchiveView(MultipleObjectTemplateResponseMixin, BaseDayArchiveView[_M]): template_name_suffix: str class BaseTodayArchiveView(BaseDayArchiveView[_M]): @override def get_dated_items(self) -> _DatedItems[_M]: ... -class TodayArchiveView(MultipleObjectTemplateResponseMixin, BaseTodayArchiveView): +class TodayArchiveView(MultipleObjectTemplateResponseMixin, BaseTodayArchiveView[_M]): template_name_suffix: str class BaseDateDetailView(YearMixin, MonthMixin, DayMixin, DateMixin, BaseDetailView[_M]): @override def get_object(self, queryset: QuerySet[_M] | None = ...) -> _M: ... -class DateDetailView(SingleObjectTemplateResponseMixin, BaseDateDetailView): +class DateDetailView(SingleObjectTemplateResponseMixin, BaseDateDetailView[_M]): template_name_suffix: str def timezone_today() -> datetime.date: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/views/generic/edit.pyi b/python/helpers/bundled_stubs/Django/django-stubs/views/generic/edit.pyi index 48737eb82e2b..14006809b7fa 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/views/generic/edit.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/views/generic/edit.pyi @@ -11,7 +11,7 @@ from django.views.generic.detail import BaseDetailView, SingleObjectMixin, Singl from typing_extensions import TypeVar, override _FormT = TypeVar("_FormT", bound=BaseForm) -_ModelFormT = TypeVar("_ModelFormT", bound=BaseModelForm) +_ModelFormT = TypeVar("_ModelFormT", bound=BaseModelForm[Any]) _M = TypeVar("_M", bound=models.Model) class FormMixin(ContextMixin, Generic[_FormT]): diff --git a/python/helpers/bundled_stubs/Django/django-stubs/views/generic/list.pyi b/python/helpers/bundled_stubs/Django/django-stubs/views/generic/list.pyi index 0b7353b07702..0be5a51a33bb 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/views/generic/list.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/views/generic/list.pyi @@ -22,14 +22,14 @@ class MultipleObjectMixin(ContextMixin, Generic[_M]): paginate_by: int | None paginate_orphans: int context_object_name: str | None - paginator_class: type[Paginator] + paginator_class: type[Paginator[Any]] page_kwarg: str ordering: str | Sequence[_OrderByFieldName] | None def get_queryset(self) -> QuerySet[_M]: ... def get_ordering(self) -> str | Sequence[_OrderByFieldName] | None: ... def paginate_queryset( self, queryset: _SupportsPagination[_M], page_size: int - ) -> tuple[Paginator, Page, _SupportsPagination[_M], bool]: ... + ) -> tuple[Paginator[Any], Page[Any], _SupportsPagination[_M], bool]: ... def get_paginate_by(self, queryset: QuerySet[_M]) -> int | None: ... def get_paginator( self, @@ -38,7 +38,7 @@ class MultipleObjectMixin(ContextMixin, Generic[_M]): orphans: int = ..., allow_empty_first_page: bool = ..., **kwargs: Any, - ) -> Paginator: ... + ) -> Paginator[Any]: ... def get_paginate_orphans(self) -> int: ... def get_allow_empty(self) -> bool: ... @overload diff --git a/python/helpers/bundled_stubs/Django/django-stubs/views/i18n.pyi b/python/helpers/bundled_stubs/Django/django-stubs/views/i18n.pyi index 48031f8cb714..fe00560ad050 100644 --- a/python/helpers/bundled_stubs/Django/django-stubs/views/i18n.pyi +++ b/python/helpers/bundled_stubs/Django/django-stubs/views/i18n.pyi @@ -14,7 +14,7 @@ def set_language(request: HttpRequest) -> HttpResponse: ... def get_formats() -> dict[str, list[str] | int | str]: ... class JavaScriptCatalog(View): - head: Callable + head: Callable[..., Any] domain: str packages: list[str] | None translation: DjangoTranslation