From 319ab7f9f752b73cedf01f6acd41532478a92eeb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joon=20Hwan=20=EA=B9=80=EC=A4=80=ED=99=98?= Date: Mon, 14 Feb 2022 21:06:01 +0900 Subject: [PATCH] get_cache_key can have multiple httprequest types. (#852) * Update cache.pyi * Apply black --- django-stubs/utils/cache.pyi | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/django-stubs/utils/cache.pyi b/django-stubs/utils/cache.pyi index 4a46b14..540fc6c 100644 --- a/django-stubs/utils/cache.pyi +++ b/django-stubs/utils/cache.pyi @@ -1,7 +1,9 @@ -from typing import Any, Optional, Tuple +from typing import Any, Optional, Tuple, Union from django.core.cache.backends.base import BaseCache +from django.core.handlers.asgi import ASGIRequest from django.core.handlers.wsgi import WSGIRequest +from django.http import HttpRequest from django.http.response import HttpResponse, HttpResponseBase cc_delim_re: Any @@ -20,7 +22,10 @@ def add_never_cache_headers(response: HttpResponseBase) -> None: ... def patch_vary_headers(response: HttpResponseBase, newheaders: Tuple[str]) -> None: ... def has_vary_header(response: HttpResponse, header_query: str) -> bool: ... def get_cache_key( - request: WSGIRequest, key_prefix: Optional[str] = ..., method: str = ..., cache: Optional[BaseCache] = ... + request: Union[ASGIRequest, HttpRequest, WSGIRequest], + key_prefix: Optional[str] = ..., + method: str = ..., + cache: Optional[BaseCache] = ..., ) -> Optional[str]: ... def learn_cache_key( request: WSGIRequest,