2 Commits

Author SHA1 Message Date
Maxim Kurnikov
86642e3ddd bump version 2019-04-15 14:50:43 +03:00
Maciej Gol
952e1c3ee9 Preserve callable type in view decorators (#67) 2019-04-13 22:31:49 +03:00
7 changed files with 26 additions and 16 deletions

View File

@@ -1,5 +1,7 @@
from typing import Any, Callable, Optional
from typing import Any, Callable, Optional, TypeVar
_F = TypeVar("_F", bound=Callable[..., Any])
def cache_page(timeout: float, *, cache: Optional[Any] = ..., key_prefix: Optional[Any] = ...) -> Callable: ...
def cache_control(**kwargs: Any) -> Callable: ...
def never_cache(view_func: Callable) -> Callable: ...
def never_cache(view_func: _F) -> _F: ...

View File

@@ -1,5 +1,7 @@
from typing import Callable
from typing import Callable, TypeVar, Any
def xframe_options_deny(view_func: Callable) -> Callable: ...
def xframe_options_sameorigin(view_func: Callable) -> Callable: ...
def xframe_options_exempt(view_func: Callable) -> Callable: ...
_F = TypeVar("_F", bound=Callable[..., Any])
def xframe_options_deny(view_func: _F) -> _F: ...
def xframe_options_sameorigin(view_func: _F) -> _F: ...
def xframe_options_exempt(view_func: _F) -> _F: ...

View File

@@ -1,4 +1,4 @@
from typing import Any, Callable
from typing import Any, Callable, TypeVar
from django.middleware.csrf import CsrfViewMiddleware
@@ -14,4 +14,6 @@ class _EnsureCsrfCookie(CsrfViewMiddleware):
ensure_csrf_cookie: Any
def csrf_exempt(view_func: Callable) -> Callable: ...
_F = TypeVar("_F", bound=Callable[..., Any])
def csrf_exempt(view_func: _F) -> _F: ...

View File

@@ -1,5 +1,5 @@
from typing import Callable, TypeVar
from typing import Callable, TypeVar, Any
_C = TypeVar("_C", bound=Callable)
_C = TypeVar("_C", bound=Callable[..., Any])
def gzip_page(view_func: _C) -> _C: ...

View File

@@ -1,4 +1,4 @@
from typing import Any, Callable, List, Optional
from typing import Any, Callable, List, Optional, TypeVar
conditional_page: Any
@@ -8,6 +8,8 @@ require_GET: Any
require_POST: Any
require_safe: Any
_F = TypeVar("_F", bound=Callable[..., Any])
def condition(etag_func: Optional[Callable] = ..., last_modified_func: Optional[Callable] = ...) -> Callable: ...
def etag(etag_func: Callable) -> Callable: ...
def last_modified(last_modified_func: Callable) -> Callable: ...
def etag(etag_func: Callable[..., Any]) -> Callable[[_F], _F]: ...
def last_modified(last_modified_func: Callable[..., Any]) -> Callable[[_F], _F]: ...

View File

@@ -1,4 +1,6 @@
from typing import Any, Callable
from typing import Any, Callable, TypeVar
_F = TypeVar("_F", bound=Callable[..., Any])
def vary_on_headers(*headers: Any) -> Callable: ...
def vary_on_cookie(func: Callable) -> Callable: ...
def vary_on_cookie(func: _F) -> _F: ...

View File

@@ -30,7 +30,7 @@ if sys.version_info[:2] < (3, 7):
setup(
name="django-stubs",
version="0.12.0",
version="0.12.1",
description='Django mypy stubs',
long_description=readme,
long_description_content_type='text/markdown',