1- from collections .abc import Awaitable , Callable , Iterable , Iterator
1+ from collections .abc import Awaitable , Callable , Iterable , Iterator , Mapping
22from io import BytesIO
33from json import JSONEncoder
44from re import Pattern
@@ -16,6 +16,7 @@ from django.http.response import HttpResponseBase
1616from django .template .base import Template
1717from django .test .utils import ContextList
1818from django .urls import ResolverMatch
19+ from typing_extensions import TypeAlias
1920
2021BOUNDARY : str
2122MULTIPART_CONTENT : str
@@ -58,14 +59,18 @@ class AsyncClientHandler(BaseHandler):
5859def encode_multipart (boundary : str , data : dict [str , Any ]) -> bytes : ...
5960def encode_file (boundary : str , key : str , file : Any ) -> list [bytes ]: ...
6061
62+ _GetDataType : TypeAlias = (
63+ Mapping [str , str | bytes | Iterable [str | bytes ]] | Iterable [tuple [str , str | bytes | Iterable [str | bytes ]]] | None
64+ )
65+
6166class _RequestFactory (Generic [_T ]):
6267 json_encoder : type [JSONEncoder ]
6368 defaults : dict [str , str ]
6469 cookies : SimpleCookie
6570 errors : BytesIO
6671 def __init__ (self , * , json_encoder : type [JSONEncoder ] = ..., ** defaults : Any ) -> None : ...
6772 def request (self , ** request : Any ) -> _T : ...
68- def get (self , path : str , data : Any = ..., secure : bool = ..., ** extra : Any ) -> _T : ...
73+ def get (self , path : str , data : _GetDataType = ..., secure : bool = ..., ** extra : Any ) -> _T : ...
6974 def post (self , path : str , data : Any = ..., content_type : str = ..., secure : bool = ..., ** extra : Any ) -> _T : ...
7075 def head (self , path : str , data : Any = ..., secure : bool = ..., ** extra : Any ) -> _T : ...
7176 def trace (self , path : str , secure : bool = ..., ** extra : Any ) -> _T : ...
@@ -129,7 +134,7 @@ class Client(ClientMixin, _RequestFactory[_MonkeyPatchedWSGIResponse]):
129134 # Silence type warnings, since this class overrides arguments and return types in an unsafe manner.
130135 def request (self , ** request : Any ) -> _MonkeyPatchedWSGIResponse : ...
131136 def get ( # type: ignore
132- self , path : str , data : Any = ..., follow : bool = ..., secure : bool = ..., ** extra : Any
137+ self , path : str , data : _GetDataType = ..., follow : bool = ..., secure : bool = ..., ** extra : Any
133138 ) -> _MonkeyPatchedWSGIResponse : ...
134139 def post ( # type: ignore
135140 self , path : str , data : Any = ..., content_type : str = ..., follow : bool = ..., secure : bool = ..., ** extra : Any
0 commit comments