From da9784ec35d5ddeb73c67055aa857e3c192e1c33 Mon Sep 17 00:00:00 2001 From: Thibaut Decombe <68703331+UnknownPlatypus@users.noreply.github.com> Date: Tue, 31 Oct 2023 10:18:35 +0100 Subject: [PATCH] Update `@property` attributes to `@cached_property` part 1 (#1761) --- django-stubs/contrib/staticfiles/storage.pyi | 2 - django-stubs/core/files/base.pyi | 4 +- .../core/files/storage/filesystem.pyi | 11 +-- django-stubs/core/files/storage/handler.pyi | 3 +- django-stubs/core/files/storage/memory.pyi | 11 +-- django-stubs/core/handlers/asgi.pyi | 5 +- .../core/management/commands/loaddata.pyi | 3 +- .../core/management/commands/makemessages.pyi | 7 +- django-stubs/core/paginator.pyi | 6 +- django-stubs/db/models/query.pyi | 5 +- django-stubs/db/models/sql/compiler.pyi | 5 +- django-stubs/db/models/sql/query.pyi | 3 +- django-stubs/db/models/sql/where.pyi | 5 +- django-stubs/db/utils.pyi | 3 +- django-stubs/forms/boundfield.pyi | 4 +- django-stubs/forms/forms.pyi | 4 +- django-stubs/forms/formsets.pyi | 5 +- django-stubs/forms/renderers.pyi | 5 +- django-stubs/http/request.pyi | 8 +++ django-stubs/template/backends/base.pyi | 3 +- django-stubs/template/backends/dummy.pyi | 1 - django-stubs/template/backends/jinja2.pyi | 3 +- django-stubs/template/engine.pyi | 5 +- django-stubs/template/utils.pyi | 3 +- scripts/stubtest/allowlist.txt | 63 ++++++++++++++++ scripts/stubtest/allowlist_todo.txt | 71 ------------------- 26 files changed, 131 insertions(+), 117 deletions(-) diff --git a/django-stubs/contrib/staticfiles/storage.pyi b/django-stubs/contrib/staticfiles/storage.pyi index bb1db0129..1624f4f2b 100644 --- a/django-stubs/contrib/staticfiles/storage.pyi +++ b/django-stubs/contrib/staticfiles/storage.pyi @@ -10,8 +10,6 @@ from typing_extensions import TypeAlias _PostProcessT: TypeAlias = Iterator[tuple[str, str, bool] | tuple[str, None, RuntimeError]] class StaticFilesStorage(FileSystemStorage): - base_location: str - location: _PathCompatible def __init__( self, location: _PathCompatible | None = ..., base_url: str | None = ..., *args: Any, **kwargs: Any ) -> None: ... diff --git a/django-stubs/core/files/base.pyi b/django-stubs/core/files/base.pyi index 5aacdfc7d..2d95871a4 100644 --- a/django-stubs/core/files/base.pyi +++ b/django-stubs/core/files/base.pyi @@ -3,6 +3,7 @@ from types import TracebackType from typing import IO, AnyStr, type_check_only from django.core.files.utils import FileProxyMixin +from django.utils.functional import cached_property from typing_extensions import Self class File(FileProxyMixin[AnyStr], IO[AnyStr]): @@ -13,7 +14,7 @@ class File(FileProxyMixin[AnyStr], IO[AnyStr]): def __init__(self, file: IO[AnyStr] | None, name: str | None = ...) -> None: ... def __bool__(self) -> bool: ... def __len__(self) -> int: ... - @property + @cached_property def size(self) -> int: ... def chunks(self, chunk_size: int | None = ...) -> Iterator[AnyStr]: ... def multiple_chunks(self, chunk_size: int | None = ...) -> bool | None: ... @@ -32,7 +33,6 @@ class File(FileProxyMixin[AnyStr], IO[AnyStr]): class ContentFile(File[AnyStr]): file: IO[AnyStr] - size: int def __init__(self, content: AnyStr, name: str | None = ...) -> None: ... def __bool__(self) -> bool: ... def open(self, mode: str | None = ...) -> Self: ... diff --git a/django-stubs/core/files/storage/filesystem.pyi b/django-stubs/core/files/storage/filesystem.pyi index 6b3e2444e..b8f0e7b2c 100644 --- a/django-stubs/core/files/storage/filesystem.pyi +++ b/django-stubs/core/files/storage/filesystem.pyi @@ -2,6 +2,7 @@ from collections.abc import Sequence from typing import Any from django.utils._os import _PathCompatible +from django.utils.functional import cached_property from .base import Storage from .mixins import StorageSettingsMixin @@ -16,14 +17,14 @@ class FileSystemStorage(Storage, StorageSettingsMixin): file_permissions_mode: int | None = ..., directory_permissions_mode: int | None = ..., ) -> None: ... - @property + @cached_property def base_location(self) -> _PathCompatible: ... - @property + @cached_property def location(self) -> _PathCompatible: ... - @property + @cached_property def base_url(self) -> str: ... - @property + @cached_property def file_permissions_mode(self) -> int | None: ... - @property + @cached_property def directory_permissions_mode(self) -> int | None: ... def deconstruct(obj) -> tuple[str, Sequence[Any], dict[str, Any]]: ... # fake diff --git a/django-stubs/core/files/storage/handler.pyi b/django-stubs/core/files/storage/handler.pyi index b4d28d95c..dcdcece2d 100644 --- a/django-stubs/core/files/storage/handler.pyi +++ b/django-stubs/core/files/storage/handler.pyi @@ -1,6 +1,7 @@ from typing import Any from django.core.exceptions import ImproperlyConfigured +from django.utils.functional import cached_property from .base import Storage @@ -8,7 +9,7 @@ class InvalidStorageError(ImproperlyConfigured): ... class StorageHandler: def __init__(self, backends: dict[str, Storage] | None = ...) -> None: ... - @property + @cached_property def backends(self) -> dict[str, Storage]: ... def __getitem__(self, alias: str) -> Storage: ... def create_storage(self, params: dict[str, Any]) -> Storage: ... diff --git a/django-stubs/core/files/storage/memory.pyi b/django-stubs/core/files/storage/memory.pyi index ab7c70f06..039268fda 100644 --- a/django-stubs/core/files/storage/memory.pyi +++ b/django-stubs/core/files/storage/memory.pyi @@ -2,6 +2,7 @@ from collections.abc import Sequence from typing import Any from django.utils._os import _PathCompatible +from django.utils.functional import cached_property from .base import Storage from .mixins import StorageSettingsMixin @@ -14,14 +15,14 @@ class InMemoryStorage(Storage, StorageSettingsMixin): file_permissions_mode: int | None = ..., directory_permissions_mode: int | None = ..., ) -> None: ... - @property + @cached_property def base_location(self) -> _PathCompatible: ... - @property + @cached_property def location(self) -> _PathCompatible: ... - @property + @cached_property def base_url(self) -> str: ... - @property + @cached_property def file_permissions_mode(self) -> int | None: ... - @property + @cached_property def directory_permissions_mode(self) -> int | None: ... def deconstruct(obj) -> tuple[str, Sequence[Any], dict[str, Any]]: ... # fake diff --git a/django-stubs/core/handlers/asgi.pyi b/django-stubs/core/handlers/asgi.pyi index 19e0c085e..aaf235ce2 100644 --- a/django-stubs/core/handlers/asgi.pyi +++ b/django-stubs/core/handlers/asgi.pyi @@ -6,6 +6,7 @@ from django.http.request import HttpRequest, _ImmutableQueryDict from django.http.response import HttpResponseBase from django.urls.resolvers import ResolverMatch, URLResolver from django.utils.datastructures import MultiValueDict +from django.utils.functional import cached_property from typing_extensions import TypeAlias _ReceiveCallback: TypeAlias = Callable[[], Awaitable[Mapping[str, Any]]] @@ -22,11 +23,11 @@ class ASGIRequest(HttpRequest): method: str META: dict[str, Any] def __init__(self, scope: Mapping[str, Any], body_file: IO[bytes]) -> None: ... - @property + @cached_property def GET(self) -> _ImmutableQueryDict: ... # type: ignore[override] POST: _ImmutableQueryDict FILES: MultiValueDict - @property + @cached_property def COOKIES(self) -> dict[str, str]: ... # type: ignore[override] _T = TypeVar("_T") diff --git a/django-stubs/core/management/commands/loaddata.pyi b/django-stubs/core/management/commands/loaddata.pyi index 3cf09f033..64f3ad696 100644 --- a/django-stubs/core/management/commands/loaddata.pyi +++ b/django-stubs/core/management/commands/loaddata.pyi @@ -4,6 +4,7 @@ from collections.abc import Sequence from django.apps.config import AppConfig from django.core.management.base import BaseCommand from django.db.models.base import Model +from django.utils.functional import cached_property has_bz2: bool has_lzma: bool @@ -22,7 +23,7 @@ class Command(BaseCommand): def loaddata(self, fixture_labels: Sequence[str]) -> None: ... def load_label(self, fixture_label: str) -> None: ... def find_fixtures(self, fixture_label: str) -> list[tuple[str, str | None, str | None]]: ... - @property + @cached_property def fixture_dirs(self) -> list[str]: ... def parse_name(self, fixture_name: str) -> tuple[str, str | None, str | None]: ... diff --git a/django-stubs/core/management/commands/makemessages.pyi b/django-stubs/core/management/commands/makemessages.pyi index 32e338218..e5779c471 100644 --- a/django-stubs/core/management/commands/makemessages.pyi +++ b/django-stubs/core/management/commands/makemessages.pyi @@ -2,6 +2,7 @@ from re import Pattern from typing import Any from django.core.management.base import BaseCommand +from django.utils.functional import cached_property plural_forms_re: Pattern[str] STATUS_OK: int @@ -21,11 +22,11 @@ class BuildFile: """ def __init__(self, command: BaseCommand, domain: str, translatable: TranslatableFile) -> None: ... - @property + @cached_property def is_templatized(self) -> bool: ... - @property + @cached_property def path(self) -> str: ... - @property + @cached_property def work_path(self) -> str: ... def preprocess(self) -> None: ... def postprocess_messages(self, msgs: str) -> str: ... diff --git a/django-stubs/core/paginator.pyi b/django-stubs/core/paginator.pyi index 8f28966cf..488d02477 100644 --- a/django-stubs/core/paginator.pyi +++ b/django-stubs/core/paginator.pyi @@ -1,7 +1,7 @@ from collections.abc import Iterable, Iterator, Sequence, Sized from typing import ClassVar, Generic, Protocol, TypeVar, overload -from django.utils.functional import _StrPromise +from django.utils.functional import _StrPromise, cached_property class UnorderedObjectListWarning(RuntimeWarning): ... class InvalidPage(Exception): ... @@ -33,9 +33,9 @@ class Paginator(Generic[_T]): def validate_number(self, number: int | float | str) -> int: ... def get_page(self, number: int | float | str | None) -> Page[_T]: ... def page(self, number: int | str) -> Page[_T]: ... - @property + @cached_property def count(self) -> int: ... - @property + @cached_property def num_pages(self) -> int: ... @property def page_range(self) -> range: ... diff --git a/django-stubs/db/models/query.pyi b/django-stubs/db/models/query.pyi index 5b19ab7bb..1fe6b48e4 100644 --- a/django-stubs/db/models/query.pyi +++ b/django-stubs/db/models/query.pyi @@ -7,6 +7,7 @@ from django.db.models import Manager from django.db.models.base import Model from django.db.models.expressions import Combinable from django.db.models.sql.query import Query, RawQuery +from django.utils.functional import cached_property from typing_extensions import Self, TypeAlias _T = TypeVar("_T", bound=Model, covariant=True) @@ -204,12 +205,12 @@ class RawQuerySet(Iterable[_T], Sized): def __getitem__(self, k: str) -> Any: ... @overload def __getitem__(self, k: slice) -> RawQuerySet[_T]: ... - @property + @cached_property def columns(self) -> list[str]: ... @property def db(self) -> str: ... def iterator(self) -> Iterator[_T]: ... - @property + @cached_property def model_fields(self) -> dict[str, str]: ... def prefetch_related(self, *lookups: Any) -> RawQuerySet[_T]: ... def resolve_model_init_order(self) -> tuple[list[str], list[int], list[tuple[str, int]]]: ... diff --git a/django-stubs/db/models/sql/compiler.pyi b/django-stubs/db/models/sql/compiler.pyi index dc545ada1..0931dbf4f 100644 --- a/django-stubs/db/models/sql/compiler.pyi +++ b/django-stubs/db/models/sql/compiler.pyi @@ -10,6 +10,7 @@ from django.db.models.base import Model from django.db.models.expressions import BaseExpression, Expression from django.db.models.sql.query import Query from django.db.models.sql.subqueries import AggregateQuery, DeleteQuery, InsertQuery, UpdateQuery +from django.utils.functional import cached_property from typing_extensions import TypeAlias _ParamT: TypeAlias = str | int @@ -129,9 +130,9 @@ class SQLInsertCompiler(SQLCompiler): class SQLDeleteCompiler(SQLCompiler): query: DeleteQuery - @property + @cached_property def single_alias(self) -> bool: ... - @property + @cached_property def contains_self_reference_subquery(self) -> bool: ... def as_sql(self) -> _AsSqlType: ... # type: ignore[override] diff --git a/django-stubs/db/models/sql/query.pyi b/django-stubs/db/models/sql/query.pyi index a00c63743..0b6418c4f 100644 --- a/django-stubs/db/models/sql/query.pyi +++ b/django-stubs/db/models/sql/query.pyi @@ -13,6 +13,7 @@ from django.db.models.query_utils import PathInfo from django.db.models.sql.compiler import SQLCompiler from django.db.models.sql.datastructures import BaseTable, Join from django.db.models.sql.where import WhereNode +from django.utils.functional import cached_property JoinInfo = namedtuple("JoinInfo", ("final_field", "targets", "opts", "joins", "path", "transform_function")) @@ -85,7 +86,7 @@ class Query(BaseExpression): def output_field(self) -> Field: ... @property def has_select_fields(self) -> bool: ... - @property + @cached_property def base_table(self) -> str: ... def sql_with_params(self) -> tuple[str, tuple]: ... def __deepcopy__(self, memo: dict[int, Any]) -> Query: ... diff --git a/django-stubs/db/models/sql/where.pyi b/django-stubs/db/models/sql/where.pyi index cc4e07b97..32d00bba9 100644 --- a/django-stubs/db/models/sql/where.pyi +++ b/django-stubs/db/models/sql/where.pyi @@ -6,6 +6,7 @@ from django.db.models.expressions import Expression from django.db.models.sql.compiler import SQLCompiler, _AsSqlType from django.db.models.sql.query import Query from django.utils import tree +from django.utils.functional import cached_property AND: str OR: str @@ -23,9 +24,9 @@ class WhereNode(tree.Node): def clone(self) -> WhereNode: ... def relabeled_clone(self, change_map: dict[str | None, str]) -> WhereNode: ... def resolve_expression(self, *args: Any, **kwargs: Any) -> WhereNode: ... - @property + @cached_property def contains_aggregate(self) -> bool: ... - @property + @cached_property def contains_over_clause(self) -> bool: ... @property def is_summary(self) -> bool: ... diff --git a/django-stubs/db/utils.pyi b/django-stubs/db/utils.pyi index a04919a5e..d0dfae43c 100644 --- a/django-stubs/db/utils.pyi +++ b/django-stubs/db/utils.pyi @@ -6,6 +6,7 @@ from django.apps import AppConfig from django.db.backends.base.base import BaseDatabaseWrapper from django.db.models import Model from django.utils.connection import BaseConnectionHandler +from django.utils.functional import cached_property DEFAULT_DB_ALIAS: str DJANGO_VERSION_PICKLE_KEY: str @@ -42,7 +43,7 @@ class ConnectionHandler(BaseConnectionHandler[BaseDatabaseWrapper]): class ConnectionRouter: def __init__(self, routers: Iterable[Any] | None = ...) -> None: ... - @property + @cached_property def routers(self) -> list[Any]: ... def db_for_read(self, model: type[Model], **hints: Any) -> str: ... def db_for_write(self, model: type[Model], **hints: Any) -> str: ... diff --git a/django-stubs/forms/boundfield.pyi b/django-stubs/forms/boundfield.pyi index e8b0e8370..fbc8f2825 100644 --- a/django-stubs/forms/boundfield.pyi +++ b/django-stubs/forms/boundfield.pyi @@ -6,7 +6,7 @@ from django.forms.forms import BaseForm from django.forms.renderers import BaseRenderer from django.forms.utils import ErrorList from django.forms.widgets import Widget -from django.utils.functional import _StrOrPromise +from django.utils.functional import _StrOrPromise, cached_property from django.utils.safestring import SafeString from typing_extensions import TypeAlias @@ -22,7 +22,7 @@ class BoundField: label: _StrOrPromise help_text: _StrOrPromise def __init__(self, form: BaseForm, field: Field, name: str) -> None: ... - @property + @cached_property def subwidgets(self) -> list[BoundWidget]: ... def __bool__(self) -> bool: ... def __iter__(self) -> Iterator[BoundWidget]: ... diff --git a/django-stubs/forms/forms.pyi b/django-stubs/forms/forms.pyi index 8b30b51ee..7a6ee68e8 100644 --- a/django-stubs/forms/forms.pyi +++ b/django-stubs/forms/forms.pyi @@ -7,7 +7,7 @@ from django.forms.fields import Field from django.forms.renderers import BaseRenderer from django.forms.utils import ErrorDict, ErrorList, RenderableFormMixin, _DataT, _FilesT from django.forms.widgets import Media, MediaDefiningClass -from django.utils.functional import _StrOrPromise +from django.utils.functional import _StrOrPromise, cached_property from django.utils.safestring import SafeString class DeclarativeFieldsMetaclass(MediaDefiningClass): ... @@ -65,7 +65,7 @@ class BaseForm(RenderableFormMixin): def full_clean(self) -> None: ... def clean(self) -> dict[str, Any] | None: ... def has_changed(self) -> bool: ... - @property + @cached_property def changed_data(self) -> list[str]: ... @property def media(self) -> Media: ... diff --git a/django-stubs/forms/formsets.pyi b/django-stubs/forms/formsets.pyi index 27f84390f..f4e347603 100644 --- a/django-stubs/forms/formsets.pyi +++ b/django-stubs/forms/formsets.pyi @@ -5,6 +5,7 @@ from django.db.models.fields import _ErrorMessagesDict from django.forms.forms import BaseForm, Form from django.forms.utils import ErrorList, RenderableFormMixin, _DataT, _FilesT from django.forms.widgets import Media, Widget +from django.utils.functional import cached_property TOTAL_FORM_COUNT: str INITIAL_FORM_COUNT: str @@ -65,11 +66,11 @@ class BaseFormSet(Generic[_F], Sized, RenderableFormMixin): def __getitem__(self, index: int) -> _F: ... def __len__(self) -> int: ... def __bool__(self) -> bool: ... - @property + @cached_property def management_form(self) -> ManagementForm: ... def total_form_count(self) -> int: ... def initial_form_count(self) -> int: ... - @property + @cached_property def forms(self) -> list[_F]: ... def get_form_kwargs(self, index: int | None) -> dict[str, Any]: ... @property diff --git a/django-stubs/forms/renderers.pyi b/django-stubs/forms/renderers.pyi index 4f365ec9a..b3f642af5 100644 --- a/django-stubs/forms/renderers.pyi +++ b/django-stubs/forms/renderers.pyi @@ -5,6 +5,7 @@ from django.template.backends.base import BaseEngine from django.template.backends.django import DjangoTemplates as DjangoTemplatesR from django.template.backends.jinja2 import Jinja2 as Jinja2R from django.template.base import Template +from django.utils.functional import cached_property def get_default_renderer() -> BaseRenderer: ... @@ -16,14 +17,14 @@ class BaseRenderer: class EngineMixin: def get_template(self, template_name: str) -> Any: ... - @property + @cached_property def engine(self) -> BaseEngine: ... class DjangoTemplates(EngineMixin, BaseRenderer): backend: type[DjangoTemplatesR] class Jinja2(EngineMixin, BaseRenderer): - @property + @cached_property def backend(self) -> type[Jinja2R]: ... class Jinja2DivFormRenderer(Jinja2): diff --git a/django-stubs/http/request.pyi b/django-stubs/http/request.pyi index 9ed40d99e..6b5125542 100644 --- a/django-stubs/http/request.pyi +++ b/django-stubs/http/request.pyi @@ -26,6 +26,14 @@ class HttpHeaders(CaseInsensitiveMapping[str]): def __init__(self, environ: Mapping[str, Any]) -> None: ... @classmethod def parse_header_name(cls, header: str) -> str | None: ... + @classmethod + def to_wsgi_name(cls, header: str) -> str: ... + @classmethod + def to_asgi_name(cls, header: str) -> str: ... + @classmethod + def to_wsgi_names(cls, headers: Mapping[str, Any]) -> dict[str, Any]: ... + @classmethod + def to_asgi_names(cls, headers: Mapping[str, Any]) -> dict[str, Any]: ... class HttpRequest(BytesIO): GET: _ImmutableQueryDict diff --git a/django-stubs/template/backends/base.pyi b/django-stubs/template/backends/base.pyi index 93c70db6d..cb25ce95f 100644 --- a/django-stubs/template/backends/base.pyi +++ b/django-stubs/template/backends/base.pyi @@ -3,6 +3,7 @@ from typing import Any, Protocol from django.http.request import HttpRequest from django.template.base import Context +from django.utils.functional import cached_property from django.utils.safestring import SafeString class BaseEngine: @@ -14,7 +15,7 @@ class BaseEngine: def app_dirname(self) -> str | None: ... def from_string(self, template_code: str) -> _EngineTemplate: ... def get_template(self, template_name: str) -> _EngineTemplate: ... - @property + @cached_property def template_dirs(self) -> tuple[str]: ... def iter_template_filenames(self, template_name: str) -> Iterator[str]: ... diff --git a/django-stubs/template/backends/dummy.pyi b/django-stubs/template/backends/dummy.pyi index 3a6109dc6..a1fb2b083 100644 --- a/django-stubs/template/backends/dummy.pyi +++ b/django-stubs/template/backends/dummy.pyi @@ -6,7 +6,6 @@ from django.http.request import HttpRequest from .base import BaseEngine class TemplateStrings(BaseEngine): - template_dirs: tuple[str] def __init__(self, params: dict[str, dict[Any, Any] | list[Any] | bool | str]) -> None: ... class Template(string.Template): diff --git a/django-stubs/template/backends/jinja2.pyi b/django-stubs/template/backends/jinja2.pyi index f454d2ed0..cae83ba8d 100644 --- a/django-stubs/template/backends/jinja2.pyi +++ b/django-stubs/template/backends/jinja2.pyi @@ -3,6 +3,7 @@ from typing import Any from _typeshed import Incomplete from django.template.exceptions import TemplateSyntaxError +from django.utils.functional import cached_property from .base import BaseEngine @@ -10,7 +11,7 @@ class Jinja2(BaseEngine): env: Any context_processors: list[str] def __init__(self, params: dict[str, Any]) -> None: ... - @property + @cached_property def template_context_processors(self) -> list[Callable]: ... class Origin: diff --git a/django-stubs/template/engine.pyi b/django-stubs/template/engine.pyi index 2f5d9bcee..135ff5bd1 100644 --- a/django-stubs/template/engine.pyi +++ b/django-stubs/template/engine.pyi @@ -4,6 +4,7 @@ from typing import Any from django.template.base import Origin from django.template.library import Library from django.template.loaders.base import Loader +from django.utils.functional import cached_property from django.utils.safestring import SafeString from typing_extensions import TypeAlias @@ -40,11 +41,11 @@ class Engine: ) -> None: ... @staticmethod def get_default() -> Engine: ... - @property + @cached_property def template_context_processors(self) -> Sequence[Callable]: ... def get_template_builtins(self, builtins: list[str]) -> list[Library]: ... def get_template_libraries(self, libraries: dict[str, str]) -> dict[str, Library]: ... - @property + @cached_property def template_loaders(self) -> list[Loader]: ... def get_template_loaders(self, template_loaders: Sequence[_Loader]) -> list[Loader]: ... def find_template_loader(self, loader: _Loader) -> Loader: ... diff --git a/django-stubs/template/utils.pyi b/django-stubs/template/utils.pyi index 4aaf8059f..4f308e71a 100644 --- a/django-stubs/template/utils.pyi +++ b/django-stubs/template/utils.pyi @@ -3,12 +3,13 @@ from typing import Any from django.core.exceptions import ImproperlyConfigured from django.template.backends.base import BaseEngine +from django.utils.functional import cached_property class InvalidTemplateEngineError(ImproperlyConfigured): ... class EngineHandler: def __init__(self, templates: list[dict[str, Any]] = ...) -> None: ... - @property + @cached_property def templates(self) -> dict[str, Any]: ... def __getitem__(self, alias: str) -> BaseEngine: ... def __iter__(self) -> Iterator[Any]: ... diff --git a/scripts/stubtest/allowlist.txt b/scripts/stubtest/allowlist.txt index 276b80a89..1306afc08 100644 --- a/scripts/stubtest/allowlist.txt +++ b/scripts/stubtest/allowlist.txt @@ -159,6 +159,42 @@ django.utils.functional.cached_property.__set__ django.utils.functional.cached_property.name # Ignore @cached_property error "cannot reconcile @property on stub with runtime object" +django.contrib.gis.forms.BaseForm.changed_data +django.contrib.gis.forms.BaseFormSet.forms +django.contrib.gis.forms.BaseFormSet.management_form +django.contrib.gis.forms.BoundField.subwidgets +django.core.files.File.size +django.core.files.base.File.size +django.core.files.storage.FileSystemStorage.base_location +django.core.files.storage.FileSystemStorage.base_url +django.core.files.storage.FileSystemStorage.directory_permissions_mode +django.core.files.storage.FileSystemStorage.file_permissions_mode +django.core.files.storage.FileSystemStorage.location +django.core.files.storage.InMemoryStorage.base_location +django.core.files.storage.InMemoryStorage.base_url +django.core.files.storage.InMemoryStorage.directory_permissions_mode +django.core.files.storage.InMemoryStorage.file_permissions_mode +django.core.files.storage.InMemoryStorage.location +django.core.files.storage.StorageHandler.backends +django.core.files.storage.filesystem.FileSystemStorage.base_location +django.core.files.storage.filesystem.FileSystemStorage.base_url +django.core.files.storage.filesystem.FileSystemStorage.directory_permissions_mode +django.core.files.storage.filesystem.FileSystemStorage.file_permissions_mode +django.core.files.storage.filesystem.FileSystemStorage.location +django.core.files.storage.handler.StorageHandler.backends +django.core.files.storage.memory.InMemoryStorage.base_location +django.core.files.storage.memory.InMemoryStorage.base_url +django.core.files.storage.memory.InMemoryStorage.directory_permissions_mode +django.core.files.storage.memory.InMemoryStorage.file_permissions_mode +django.core.files.storage.memory.InMemoryStorage.location +django.core.handlers.asgi.ASGIRequest.COOKIES +django.core.handlers.asgi.ASGIRequest.GET +django.core.management.commands.loaddata.Command.fixture_dirs +django.core.management.commands.makemessages.BuildFile.is_templatized +django.core.management.commands.makemessages.BuildFile.path +django.core.management.commands.makemessages.BuildFile.work_path +django.core.paginator.Paginator.count +django.core.paginator.Paginator.num_pages django.db.migrations.RenameField.new_name_lower django.db.migrations.RenameField.old_name_lower django.db.migrations.RenameIndex.new_name_lower @@ -184,9 +220,36 @@ django.db.migrations.operations.models.RenameModel.new_name_lower django.db.migrations.operations.models.RenameModel.old_name_lower django.db.migrations.state.ModelState.name_lower django.db.migrations.state.ProjectState.apps +django.db.models.query.RawQuerySet.columns +django.db.models.query.RawQuerySet.model_fields +django.db.models.sql.Query.base_table +django.db.models.sql.compiler.SQLDeleteCompiler.contains_self_reference_subquery +django.db.models.sql.compiler.SQLDeleteCompiler.single_alias +django.db.models.sql.query.Query.base_table +django.db.models.sql.where.WhereNode.contains_aggregate +django.db.models.sql.where.WhereNode.contains_over_clause +django.db.utils.ConnectionRouter.routers +django.forms.BaseForm.changed_data +django.forms.BaseFormSet.forms +django.forms.BaseFormSet.management_form +django.forms.BoundField.subwidgets +django.forms.boundfield.BoundField.subwidgets +django.forms.forms.BaseForm.changed_data +django.forms.formsets.BaseFormSet.forms +django.forms.formsets.BaseFormSet.management_form +django.forms.renderers.EngineMixin.engine +django.forms.renderers.Jinja2.backend django.middleware.csrf.CsrfViewMiddleware.allowed_origin_subdomains django.middleware.csrf.CsrfViewMiddleware.allowed_origins_exact django.middleware.csrf.CsrfViewMiddleware.csrf_trusted_origins_hosts +django.template.Engine.template_context_processors +django.template.Engine.template_loaders +django.template.EngineHandler.templates +django.template.backends.base.BaseEngine.template_dirs +django.template.backends.jinja2.Jinja2.template_context_processors +django.template.engine.Engine.template_context_processors +django.template.engine.Engine.template_loaders +django.template.utils.EngineHandler.templates django.urls.URLPattern.lookup_str django.urls.URLResolver.url_patterns django.urls.URLResolver.urlconf_module diff --git a/scripts/stubtest/allowlist_todo.txt b/scripts/stubtest/allowlist_todo.txt index 82aa48e50..2a5bf39c6 100644 --- a/scripts/stubtest/allowlist_todo.txt +++ b/scripts/stubtest/allowlist_todo.txt @@ -559,18 +559,14 @@ django.contrib.gis.default_app_config django.contrib.gis.forms.ALL_FIELDS django.contrib.gis.forms.BaseForm.Meta django.contrib.gis.forms.BaseForm.__init__ -django.contrib.gis.forms.BaseForm.changed_data django.contrib.gis.forms.BaseFormSet.__init__ django.contrib.gis.forms.BaseFormSet.deletion_widget -django.contrib.gis.forms.BaseFormSet.forms -django.contrib.gis.forms.BaseFormSet.management_form django.contrib.gis.forms.BaseFormSet.ordering_widget django.contrib.gis.forms.BaseModelForm.__init__ django.contrib.gis.forms.BaseModelForm.save_m2m django.contrib.gis.forms.BaseModelFormSet.model django.contrib.gis.forms.BaseModelFormSet.save_m2m django.contrib.gis.forms.BoundField.__html__ -django.contrib.gis.forms.BoundField.subwidgets django.contrib.gis.forms.BoundWidget django.contrib.gis.forms.ChoiceField.__deepcopy__ django.contrib.gis.forms.ChoiceWidget @@ -815,39 +811,14 @@ django.contrib.staticfiles.storage django.core.cache.cache django.core.checks.registry.CheckRegistry.register django.core.files.File.__next__ -django.core.files.File.size -django.core.files.base.ContentFile.size django.core.files.base.File.__next__ -django.core.files.base.File.size django.core.files.locks.OVERLAPPED django.core.files.locks.PVOID django.core.files.locks.ULONG_PTR django.core.files.storage.FileSystemStorage.__new__ -django.core.files.storage.FileSystemStorage.base_location -django.core.files.storage.FileSystemStorage.base_url -django.core.files.storage.FileSystemStorage.directory_permissions_mode -django.core.files.storage.FileSystemStorage.file_permissions_mode -django.core.files.storage.FileSystemStorage.location django.core.files.storage.InMemoryStorage.__new__ -django.core.files.storage.InMemoryStorage.base_location -django.core.files.storage.InMemoryStorage.base_url -django.core.files.storage.InMemoryStorage.directory_permissions_mode -django.core.files.storage.InMemoryStorage.file_permissions_mode -django.core.files.storage.InMemoryStorage.location -django.core.files.storage.StorageHandler.backends django.core.files.storage.filesystem.FileSystemStorage.__new__ -django.core.files.storage.filesystem.FileSystemStorage.base_location -django.core.files.storage.filesystem.FileSystemStorage.base_url -django.core.files.storage.filesystem.FileSystemStorage.directory_permissions_mode -django.core.files.storage.filesystem.FileSystemStorage.file_permissions_mode -django.core.files.storage.filesystem.FileSystemStorage.location -django.core.files.storage.handler.StorageHandler.backends django.core.files.storage.memory.InMemoryStorage.__new__ -django.core.files.storage.memory.InMemoryStorage.base_location -django.core.files.storage.memory.InMemoryStorage.base_url -django.core.files.storage.memory.InMemoryStorage.directory_permissions_mode -django.core.files.storage.memory.InMemoryStorage.file_permissions_mode -django.core.files.storage.memory.InMemoryStorage.location django.core.files.uploadedfile.InMemoryUploadedFile.__init__ django.core.files.uploadedfile.UploadedFile.size django.core.files.utils.FileProxyMixin.encoding @@ -865,9 +836,7 @@ django.core.files.utils.FileProxyMixin.truncate django.core.files.utils.FileProxyMixin.write django.core.files.utils.FileProxyMixin.writelines django.core.handlers.asgi.ASGIHandler.handle -django.core.handlers.asgi.ASGIRequest.COOKIES django.core.handlers.asgi.ASGIRequest.FILES -django.core.handlers.asgi.ASGIRequest.GET django.core.handlers.asgi.logger django.core.handlers.base.logger django.core.handlers.base.reset_urlconf @@ -901,14 +870,10 @@ django.core.management.commands.inspectdb.Command.get_meta django.core.management.commands.inspectdb.Command.handle django.core.management.commands.loaddata.Command.compression_formats django.core.management.commands.loaddata.Command.find_fixture_files_in_dir -django.core.management.commands.loaddata.Command.fixture_dirs django.core.management.commands.loaddata.Command.get_fixture_name_and_dirs django.core.management.commands.loaddata.Command.get_targets django.core.management.commands.loaddata.Command.reset_sequences django.core.management.commands.loaddata.Command.save_obj -django.core.management.commands.makemessages.BuildFile.is_templatized -django.core.management.commands.makemessages.BuildFile.path -django.core.management.commands.makemessages.BuildFile.work_path django.core.management.commands.makemessages.Command.build_potfiles django.core.management.commands.makemessages.Command.copy_plural_forms django.core.management.commands.makemessages.Command.find_files @@ -935,8 +900,6 @@ django.core.management.commands.startproject.Command.handle django.core.management.utils.find_formatters django.core.management.utils.run_formatters django.core.management.utils.sentinel -django.core.paginator.Paginator.count -django.core.paginator.Paginator.num_pages django.core.servers.basehttp.ServerHandler.__init__ django.core.servers.basehttp.ThreadedWSGIServer.__init__ django.core.signing.BASE62_ALPHABET @@ -1775,8 +1738,6 @@ django.db.models.query.QuerySet.iterator django.db.models.query.QuerySet.latest django.db.models.query.RawQuerySet.__aiter__ django.db.models.query.RawQuerySet.__init__ -django.db.models.query.RawQuerySet.columns -django.db.models.query.RawQuerySet.model_fields django.db.models.query.RelatedPopulator django.db.models.query.get_related_populators django.db.models.query.normalize_prefetch_lookups @@ -1806,7 +1767,6 @@ django.db.models.sql.Query.__init__ django.db.models.sql.Query.add_annotation django.db.models.sql.Query.add_filter django.db.models.sql.Query.add_select_col -django.db.models.sql.Query.base_table django.db.models.sql.Query.base_table_class django.db.models.sql.Query.build_filter django.db.models.sql.Query.bump_prefix @@ -1838,8 +1798,6 @@ django.db.models.sql.compiler.SQLCompiler.deferred_to_columns django.db.models.sql.compiler.SQLCompiler.get_default_columns django.db.models.sql.compiler.SQLCompiler.get_qualify_sql django.db.models.sql.compiler.SQLCompiler.get_related_selections -django.db.models.sql.compiler.SQLDeleteCompiler.contains_self_reference_subquery -django.db.models.sql.compiler.SQLDeleteCompiler.single_alias django.db.models.sql.datastructures.BaseTable.equals django.db.models.sql.datastructures.BaseTable.identity django.db.models.sql.datastructures.Join.equals @@ -1848,7 +1806,6 @@ django.db.models.sql.query.Query.__init__ django.db.models.sql.query.Query.add_annotation django.db.models.sql.query.Query.add_filter django.db.models.sql.query.Query.add_select_col -django.db.models.sql.query.Query.base_table django.db.models.sql.query.Query.base_table_class django.db.models.sql.query.Query.build_filter django.db.models.sql.query.Query.bump_prefix @@ -1878,8 +1835,6 @@ django.db.models.sql.subqueries.InsertQuery.__init__ django.db.models.sql.where.ExtraWhere.contains_over_clause django.db.models.sql.where.NothingNode.contains_over_clause django.db.models.sql.where.SubqueryConstraint.contains_over_clause -django.db.models.sql.where.WhereNode.contains_aggregate -django.db.models.sql.where.WhereNode.contains_over_clause django.db.models.sql.where.WhereNode.get_db_converters django.db.models.sql.where.WhereNode.get_group_by_cols django.db.models.sql.where.WhereNode.get_lookup @@ -1897,23 +1852,18 @@ django.db.models.utils.AltersData django.db.utils.ConnectionHandler.configure_settings django.db.utils.ConnectionHandler.ensure_defaults django.db.utils.ConnectionHandler.prepare_test_settings -django.db.utils.ConnectionRouter.routers django.db.utils.DatabaseErrorWrapper.__call__ django.forms.ALL_FIELDS django.forms.BaseForm.Meta django.forms.BaseForm.__init__ -django.forms.BaseForm.changed_data django.forms.BaseFormSet.__init__ django.forms.BaseFormSet.deletion_widget -django.forms.BaseFormSet.forms -django.forms.BaseFormSet.management_form django.forms.BaseFormSet.ordering_widget django.forms.BaseModelForm.__init__ django.forms.BaseModelForm.save_m2m django.forms.BaseModelFormSet.model django.forms.BaseModelFormSet.save_m2m django.forms.BoundField.__html__ -django.forms.BoundField.subwidgets django.forms.BoundWidget django.forms.ChoiceField.__deepcopy__ django.forms.ChoiceWidget @@ -1949,7 +1899,6 @@ django.forms.Widget.__deepcopy__ django.forms.Widget.subwidgets django.forms.Widget.use_fieldset django.forms.boundfield.BoundField.__html__ -django.forms.boundfield.BoundField.subwidgets django.forms.boundfield.BoundWidget.__html__ django.forms.fields.ChoiceField.__deepcopy__ django.forms.fields.Field.__deepcopy__ @@ -1960,14 +1909,11 @@ django.forms.fields.MultipleChoiceField.hidden_widget django.forms.fields.SplitDateTimeField.hidden_widget django.forms.forms.BaseForm.Meta django.forms.forms.BaseForm.__init__ -django.forms.forms.BaseForm.changed_data django.forms.forms.DeclarativeFieldsMetaclass.__new__ django.forms.forms.Form django.forms.formset_factory django.forms.formsets.BaseFormSet.__init__ django.forms.formsets.BaseFormSet.deletion_widget -django.forms.formsets.BaseFormSet.forms -django.forms.formsets.BaseFormSet.management_form django.forms.formsets.BaseFormSet.ordering_widget django.forms.formsets.ManagementForm django.forms.formsets.ManagementForm.__init__ @@ -1987,8 +1933,6 @@ django.forms.models.inlineformset_factory django.forms.models.modelform_factory django.forms.models.modelformset_factory django.forms.renderers.DjangoDivFormRenderer -django.forms.renderers.EngineMixin.engine -django.forms.renderers.Jinja2.backend django.forms.utils.DEFAULT_TEMPLATE_DEPRECATION_MSG django.forms.widgets.ChoiceWidget.__deepcopy__ django.forms.widgets.ChoiceWidget.subwidgets @@ -2022,10 +1966,6 @@ django.http.HttpResponseBase.getvalue django.http.StreamingHttpResponse.content django.http.multipartparser.MultiPartParser.IE_sanitize django.http.multipartparser.MultiPartParser.boundary_re -django.http.request.HttpHeaders.to_asgi_name -django.http.request.HttpHeaders.to_asgi_names -django.http.request.HttpHeaders.to_wsgi_name -django.http.request.HttpHeaders.to_wsgi_names django.http.request.HttpRequest.__init__ django.http.request.HttpRequest.accepted_types django.http.request.HttpRequest.get_raw_uri @@ -2043,17 +1983,12 @@ django.middleware.cache.FetchFromCacheMiddleware.cache django.middleware.cache.UpdateCacheMiddleware.cache django.middleware.gzip.GZipMiddleware.max_random_bytes django.shortcuts.SupportsGetAbsoluteUrl -django.template.Engine.template_context_processors -django.template.Engine.template_loaders django.template.EngineHandler.__init__ -django.template.EngineHandler.templates django.template.Library.filter_function django.template.Library.simple_tag django.template.Node.__iter__ django.template.VariableDoesNotExist.__init__ -django.template.backends.base.BaseEngine.template_dirs django.template.backends.django.get_template_tag_modules -django.template.backends.dummy.TemplateStrings.template_dirs django.template.base.Context django.template.base.FilterExpression.is_var django.template.base.Node.__iter__ @@ -2063,8 +1998,6 @@ django.template.defaulttags.IfEqualNode django.template.defaulttags.do_ifequal django.template.defaulttags.ifequal django.template.defaulttags.ifnotequal -django.template.engine.Engine.template_context_processors -django.template.engine.Engine.template_loaders django.template.library.InclusionNode.token django.template.library.Library.filter_function django.template.library.Library.simple_tag @@ -2077,7 +2010,6 @@ django.template.smartif.EndToken django.template.smartif.key django.template.smartif.op django.template.utils.EngineHandler.__init__ -django.template.utils.EngineHandler.templates django.templatetags.i18n.BlockTranslateNode.__init__ django.templatetags.static.PrefixNode.__init__ django.templatetags.static.StaticNode.__init__ @@ -2143,6 +2075,3 @@ django.urls.path django.urls.re_path django.urls.resolvers.LocaleRegexDescriptor.__get__ django.urls.resolvers.ResolverMatch.__iter__ - -# Jinja related: -django.template.backends.jinja2.Jinja2.template_context_processors