1
1
"""OpenAPI core contrib django decorators module"""
2
2
3
+ from typing import Any
4
+ from typing import Callable
5
+ from typing import Optional
3
6
from typing import Type
4
7
5
8
from django .conf import settings
@@ -26,7 +29,7 @@ class DjangoOpenAPIViewDecorator(DjangoIntegration):
26
29
27
30
def __init__ (
28
31
self ,
29
- openapi : OpenAPI = = None ,
32
+ openapi : Optional [ OpenAPI ] = None ,
30
33
request_cls : Type [DjangoOpenAPIRequest ] = DjangoOpenAPIRequest ,
31
34
response_cls : Type [DjangoOpenAPIResponse ] = DjangoOpenAPIResponse ,
32
35
errors_handler_cls : Type [
@@ -46,7 +49,7 @@ def __init__(
46
49
self .request_cls = request_cls
47
50
self .response_cls = response_cls
48
51
49
- def __call__ (self , view_func ) :
52
+ def __call__ (self , view_func : Callable [..., Any ]) -> Callable [..., Any ] :
50
53
"""
51
54
Thanks to this method, the class acts as a decorator.
52
55
Example usage:
@@ -57,7 +60,7 @@ def my_view(request): ...
57
60
"""
58
61
59
62
def _wrapped_view (
60
- request : HttpRequest , * args , ** kwargs
63
+ request : HttpRequest , * args : Any , ** kwargs : Any
61
64
) -> HttpResponse :
62
65
# get_response is the function that we treats
63
66
# as the "next step" in the chain (i.e., our original view).
0 commit comments