11from typing import Any
2+ from typing_extensions import TypeAlias
23
34import coreapi
45import requests
@@ -14,6 +15,8 @@ from rest_framework.authtoken.models import Token
1415from rest_framework .request import Request
1516from rest_framework .response import _MonkeyPatchedResponse
1617
18+ _GetDataType : TypeAlias = dict [str , Any ] | str | list [tuple [str , str ]] | None
19+
1720def force_authenticate (
1821 request : HttpRequest , user : AnonymousUser | AbstractBaseUser | None = ..., token : Token | None = ...
1922) -> None : ...
@@ -50,7 +53,7 @@ class APIRequestFactory(DjangoRequestFactory):
5053 renderer_classes : Any
5154 def __init__ (self , enforce_csrf_checks : bool = ..., ** defaults : Any ) -> None : ...
5255 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]
5457 def post (self , path : str , data : Any | None = ..., format : str | None = ..., content_type : str | None = ..., follow : bool = ..., ** extra : Any ) -> Request : ... # type: ignore[override]
5558 def put (self , path : str , data : Any | None = ..., format : str | None = ..., content_type : str | None = ..., follow : bool = ..., ** extra : Any ) -> Request : ... # type: ignore[override]
5659 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):
6871 def credentials (self , ** kwargs : Any ): ...
6972 def force_authenticate (self , user : AnonymousUser | AbstractBaseUser = ..., token : Token | None = ...) -> None : ...
7073 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]
7275 def post (self , path : str , data : Any | None = ..., format : str | None = ..., content_type : str | None = ..., follow : bool = ..., ** extra : Any ) -> _MonkeyPatchedResponse : ... # type: ignore[override]
7376 def put (self , path : str , data : Any | None = ..., format : str | None = ..., content_type : str | None = ..., follow : bool = ..., ** extra : Any ) -> _MonkeyPatchedResponse : ... # type: ignore[override]
7477 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