1
+ from collections .abc import Iterable , Mapping
1
2
from typing import Any
3
+ from typing_extensions import TypeAlias
2
4
3
5
import coreapi
4
6
import requests
@@ -14,6 +16,10 @@ from rest_framework.authtoken.models import Token
14
16
from rest_framework .request import Request
15
17
from rest_framework .response import _MonkeyPatchedResponse
16
18
19
+ _GetDataType : TypeAlias = (
20
+ Mapping [str , str | bytes | Iterable [str | bytes ]] | Iterable [tuple [str , str | bytes | Iterable [str | bytes ]]] | None
21
+ )
22
+
17
23
def force_authenticate (
18
24
request : HttpRequest , user : AnonymousUser | AbstractBaseUser | None = ..., token : Token | None = ...
19
25
) -> None : ...
@@ -50,7 +56,7 @@ class APIRequestFactory(DjangoRequestFactory):
50
56
renderer_classes : Any
51
57
def __init__ (self , enforce_csrf_checks : bool = ..., ** defaults : Any ) -> None : ...
52
58
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]
59
+ def get (self , path : str , data : _GetDataType = ..., follow : bool = ..., ** extra : Any ): ... # type: ignore[override]
54
60
def post (self , path : str , data : Any | None = ..., format : str | None = ..., content_type : str | None = ..., follow : bool = ..., ** extra : Any ) -> Request : ... # type: ignore[override]
55
61
def put (self , path : str , data : Any | None = ..., format : str | None = ..., content_type : str | None = ..., follow : bool = ..., ** extra : Any ) -> Request : ... # type: ignore[override]
56
62
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 +74,7 @@ class APIClient(APIRequestFactory, DjangoClient):
68
74
def credentials (self , ** kwargs : Any ): ...
69
75
def force_authenticate (self , user : AnonymousUser | AbstractBaseUser = ..., token : Token | None = ...) -> None : ...
70
76
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]
77
+ def get (self , path : str , data : _GetDataType = ..., follow : bool = ..., ** extra : Any ): ... # type: ignore[override]
72
78
def post (self , path : str , data : Any | None = ..., format : str | None = ..., content_type : str | None = ..., follow : bool = ..., ** extra : Any ) -> _MonkeyPatchedResponse : ... # type: ignore[override]
73
79
def put (self , path : str , data : Any | None = ..., format : str | None = ..., content_type : str | None = ..., follow : bool = ..., ** extra : Any ) -> _MonkeyPatchedResponse : ... # type: ignore[override]
74
80
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