diff --git a/django-stubs/conf/urls/__init__.pyi b/django-stubs/conf/urls/__init__.pyi index e2850fb..6bb0dfa 100644 --- a/django-stubs/conf/urls/__init__.pyi +++ b/django-stubs/conf/urls/__init__.pyi @@ -5,10 +5,10 @@ from django.http.response import HttpResponse, HttpResponseBase from django.urls import URLResolver, URLPattern -handler400 = ... # type: str -handler403 = ... # type: str -handler404 = ... # type: str -handler500 = ... # type: str +handler400: Callable[..., HttpResponse] = ... +handler403: Callable[..., HttpResponse] = ... +handler404: Callable[..., HttpResponse] = ... +handler500: Callable[..., HttpResponse] = ... IncludedURLConf = Tuple[List[URLResolver], Optional[str], Optional[str]] diff --git a/django-stubs/db/migrations/loader.pyi b/django-stubs/db/migrations/loader.pyi index 3cf234e..2c52e64 100644 --- a/django-stubs/db/migrations/loader.pyi +++ b/django-stubs/db/migrations/loader.pyi @@ -1,4 +1,4 @@ -from typing import Any, Dict, Optional, Set, Tuple, Union +from typing import Any, Dict, Optional, Set, Tuple, Union, Sequence from django.db import DefaultConnectionProxy from django.db.backends.base.base import BaseDatabaseWrapper @@ -34,4 +34,6 @@ class MigrationLoader: def build_graph(self) -> None: ... def check_consistent_history(self, connection: Any) -> None: ... def detect_conflicts(self) -> Dict[str, Set[str]]: ... - def project_state(self, nodes: Optional[Tuple[str, str]] = ..., at_end: bool = ...) -> ProjectState: ... + def project_state( + self, nodes: Optional[Tuple[str, str], Sequence[Tuple[str, str]]] = ..., at_end: bool = ... + ) -> ProjectState: ... diff --git a/django-stubs/db/models/query.pyi b/django-stubs/db/models/query.pyi index 836b2a5..92f7a8e 100644 --- a/django-stubs/db/models/query.pyi +++ b/django-stubs/db/models/query.pyi @@ -16,7 +16,7 @@ from typing import ( ) from django.db.models.base import Model -from django.db.models.expressions import Combinable +from django.db.models.expressions import Combinable as Combinable, F as F from django.db.models.sql.query import Query, RawQuery from django.db import models diff --git a/django-stubs/middleware/csrf.pyi b/django-stubs/middleware/csrf.pyi index eb13f65..abfde51 100644 --- a/django-stubs/middleware/csrf.pyi +++ b/django-stubs/middleware/csrf.pyi @@ -27,3 +27,7 @@ class CsrfViewMiddleware(MiddlewareMixin): def process_response(self, request: HttpRequest, response: HttpResponseBase) -> HttpResponseBase: ... def _compare_salted_tokens(request_csrf_token: str, csrf_token: str) -> bool: ... +def _get_new_csrf_string() -> str: ... +def _salt_cipher_secret(secret: str) -> str: ... +def _unsalt_cipher_token(token: str) -> str: ... +def _get_new_csrf_token() -> str: ... diff --git a/django-stubs/template/loader.pyi b/django-stubs/template/loader.pyi index 527a596..693d881 100644 --- a/django-stubs/template/loader.pyi +++ b/django-stubs/template/loader.pyi @@ -1,6 +1,7 @@ from typing import Any, Dict, List, Optional, Union from django.http.request import HttpRequest +from django.template.exceptions import TemplateDoesNotExist as TemplateDoesNotExist def get_template(template_name: str, using: Optional[str] = ...) -> Any: ... def select_template(template_name_list: Union[List[str], str], using: Optional[str] = ...) -> Any: ... diff --git a/django-stubs/test/client.pyi b/django-stubs/test/client.pyi index 2a04e78..481d944 100644 --- a/django-stubs/test/client.pyi +++ b/django-stubs/test/client.pyi @@ -11,7 +11,10 @@ from django.http.response import HttpResponse, HttpResponseBase from django.core.handlers.wsgi import WSGIRequest -CONTENT_TYPE_RE: Pattern +BOUNDARY: str = ... +MULTIPART_CONTENT: str = ... +CONTENT_TYPE_RE: Pattern = ... +JSON_CONTENT_TYPE_RE: Pattern = ... class RedirectCycleError(Exception): last_response: HttpResponseBase = ... diff --git a/django-stubs/urls/resolvers.pyi b/django-stubs/urls/resolvers.pyi index 6a8798b..68a8a44 100644 --- a/django-stubs/urls/resolvers.pyi +++ b/django-stubs/urls/resolvers.pyi @@ -23,6 +23,8 @@ class ResolverMatch: namespaces: Optional[List[Optional[str]]] = ..., ) -> None: ... def __getitem__(self, index: int) -> Any: ... + # for tuple unpacking + def __iter__(self) -> Any: ... def get_resolver(urlconf: Optional[str] = ...) -> URLResolver: ... def get_ns_resolver(ns_pattern: str, resolver: URLResolver, converters: Tuple) -> URLResolver: ...