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