From a43c32a69d3ceedc12a39ff4484b6379becf4306 Mon Sep 17 00:00:00 2001 From: sobolevn Date: Wed, 7 Aug 2024 11:50:09 +0300 Subject: [PATCH] Fix `tuple[A]` types to be `tuple[A, ...]` types --- django-stubs/contrib/postgres/constraints.pyi | 2 +- django-stubs/db/models/options.pyi | 4 ++-- django-stubs/template/base.pyi | 2 +- django-stubs/template/engine.pyi | 4 ++-- django-stubs/test/utils.pyi | 2 +- django-stubs/utils/cache.pyi | 3 ++- 6 files changed, 9 insertions(+), 8 deletions(-) diff --git a/django-stubs/contrib/postgres/constraints.pyi b/django-stubs/contrib/postgres/constraints.pyi index edf8c461d..6e0d7dd24 100644 --- a/django-stubs/contrib/postgres/constraints.pyi +++ b/django-stubs/contrib/postgres/constraints.pyi @@ -24,7 +24,7 @@ class ExclusionConstraint(BaseConstraint): index_type: str | None = None, condition: Q | None = None, deferrable: Deferrable | None = None, - include: list[str] | tuple[str] | None = None, + include: list[str] | tuple[str, ...] | None = None, violation_error_code: str | None = None, violation_error_message: _StrOrPromise | None = None, ) -> None: ... diff --git a/django-stubs/db/models/options.pyi b/django-stubs/db/models/options.pyi index 227b877ff..4e9712b27 100644 --- a/django-stubs/db/models/options.pyi +++ b/django-stubs/db/models/options.pyi @@ -53,8 +53,8 @@ class Options(Generic[_M]): db_table: str ordering: Sequence[str] | None indexes: list[Any] - unique_together: Sequence[tuple[str]] # Are always normalized - index_together: Sequence[tuple[str]] # Are always normalized + unique_together: Sequence[tuple[str, ...]] # Are always normalized + index_together: Sequence[tuple[str, ...]] # Are always normalized select_on_save: bool default_permissions: Sequence[str] permissions: list[Any] diff --git a/django-stubs/template/base.pyi b/django-stubs/template/base.pyi index 1b29d1775..fd4d2dc4c 100644 --- a/django-stubs/template/base.pyi +++ b/django-stubs/template/base.pyi @@ -132,7 +132,7 @@ class FilterExpression: class Variable: var: dict[Any, Any] | str literal: SafeString | float | None - lookups: tuple[str] | None + lookups: tuple[str, ...] | None translate: bool message_context: str | None def __init__(self, var: dict[Any, Any] | str) -> None: ... diff --git a/django-stubs/template/engine.pyi b/django-stubs/template/engine.pyi index 8c9f8088d..e8816325c 100644 --- a/django-stubs/template/engine.pyi +++ b/django-stubs/template/engine.pyi @@ -17,7 +17,7 @@ class Engine: dirs: list[str] app_dirs: bool autoescape: bool - context_processors: list[str] | tuple[str] + context_processors: list[str] | tuple[str, ...] debug: bool loaders: Sequence[_Loader] string_if_invalid: str @@ -30,7 +30,7 @@ class Engine: self, dirs: list[str] | None = None, app_dirs: bool = False, - context_processors: list[str] | tuple[str] | None = None, + context_processors: list[str] | tuple[str, ...] | None = None, debug: bool = False, loaders: Sequence[_Loader] | None = None, string_if_invalid: str = "", diff --git a/django-stubs/test/utils.pyi b/django-stubs/test/utils.pyi index e79a0a35c..860cd47aa 100644 --- a/django-stubs/test/utils.pyi +++ b/django-stubs/test/utils.pyi @@ -125,7 +125,7 @@ class LoggingCaptureMixin: def tearDown(self) -> None: ... class isolate_apps(TestContextDecorator): - installed_apps: tuple[str] + installed_apps: tuple[str, ...] def __init__(self, *installed_apps: Any, **kwargs: Any) -> None: ... old_apps: Apps diff --git a/django-stubs/utils/cache.pyi b/django-stubs/utils/cache.pyi index 50fdeee7a..45449c7ca 100644 --- a/django-stubs/utils/cache.pyi +++ b/django-stubs/utils/cache.pyi @@ -1,3 +1,4 @@ +from collections.abc import Iterable from typing import Any from django.core.cache.backends.base import BaseCache @@ -17,7 +18,7 @@ def get_conditional_response( ) -> HttpResponse | None: ... def patch_response_headers(response: HttpResponseBase, cache_timeout: int | None = ...) -> None: ... def add_never_cache_headers(response: HttpResponseBase) -> None: ... -def patch_vary_headers(response: HttpResponseBase, newheaders: tuple[str]) -> None: ... +def patch_vary_headers(response: HttpResponseBase, newheaders: Iterable[str]) -> None: ... def has_vary_header(response: HttpResponse, header_query: str) -> bool: ... def get_cache_key( request: HttpRequest, key_prefix: str | None = ..., method: str = ..., cache: BaseCache | None = ...