1
- from typing import Any , Dict , Optional , Type , Union
1
+ from typing import Any , Dict , List , Optional , Tuple , Type , Union
2
2
3
3
import coreapi
4
4
import requests
@@ -14,6 +14,8 @@ from rest_framework.authtoken.models import Token
14
14
from rest_framework .request import Request
15
15
from rest_framework .response import Response
16
16
17
+ _GetDataType = Optional [Union [Dict [str , Any ], str , List [Tuple [str , str ]]]]
18
+
17
19
def force_authenticate (
18
20
request : HttpRequest , user : Optional [Union [AnonymousUser , AbstractBaseUser ]] = ..., token : Optional [Token ] = ...
19
21
) -> None : ...
@@ -50,7 +52,7 @@ class APIRequestFactory(DjangoRequestFactory):
50
52
renderer_classes : Any = ...
51
53
def __init__ (self , enforce_csrf_checks : bool = ..., ** defaults : Any ) -> None : ...
52
54
def request (self , ** kwargs : Any ) -> Request : ... # type: ignore[override]
53
- def get (self , path : str , data : Optional [ Union [ Dict [ str , Any ], str ]] = ..., follow : bool = ..., ** extra : Any ): ... # type: ignore[override]
55
+ def get (self , path : str , data : _GetDataType = ..., follow : bool = ..., ** extra : Any ): ... # type: ignore[override]
54
56
def post (self , path : str , data : Optional [Any ] = ..., format : Optional [str ] = ..., content_type : Optional [str ] = ..., follow : bool = ..., ** extra : Any ) -> Request : ... # type: ignore[override]
55
57
def put (self , path : str , data : Optional [Any ] = ..., format : Optional [str ] = ..., content_type : Optional [str ] = ..., follow : bool = ..., ** extra : Any ) -> Request : ... # type: ignore[override]
56
58
def patch (self , path : str , data : Optional [Any ] = ..., format : Optional [str ] = ..., content_type : Optional [str ] = ..., follow : bool = ..., ** extra : Any ) -> Request : ... # type: ignore[override]
@@ -71,7 +73,7 @@ class APIClient(APIRequestFactory, DjangoClient):
71
73
self , user : Union [AnonymousUser , AbstractBaseUser ] = ..., token : Optional [Token ] = ...
72
74
) -> None : ...
73
75
def request (self , ** kwargs : Any ) -> Response : ... # type: ignore[override]
74
- def get (self , path : str , data : Optional [ Union [ Dict [ str , Any ], str ]] = ..., follow : bool = ..., ** extra : Any ): ... # type: ignore[override]
76
+ def get (self , path : str , data : _GetDataType = ..., follow : bool = ..., ** extra : Any ): ... # type: ignore[override]
75
77
def post (self , path : str , data : Optional [Any ] = ..., format : Optional [str ] = ..., content_type : Optional [str ] = ..., follow : bool = ..., ** extra : Any ) -> Response : ... # type: ignore[override]
76
78
def put (self , path : str , data : Optional [Any ] = ..., format : Optional [str ] = ..., content_type : Optional [str ] = ..., follow : bool = ..., ** extra : Any ) -> Response : ... # type: ignore[override]
77
79
def patch (self , path : str , data : Optional [Any ] = ..., format : Optional [str ] = ..., content_type : Optional [str ] = ..., follow : bool = ..., ** extra : Any ) -> Response : ... # type: ignore[override]
0 commit comments