django-types 0.19.0__py3-none-any.whl → 0.20.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (68) hide show
  1. django-stubs/contrib/admin/__init__.pyi +1 -0
  2. django-stubs/contrib/admin/options.pyi +63 -35
  3. django-stubs/contrib/admin/templatetags/base.pyi +1 -1
  4. django-stubs/contrib/admin/views/main.pyi +2 -1
  5. django-stubs/contrib/auth/__init__.pyi +14 -4
  6. django-stubs/contrib/auth/base_user.pyi +1 -1
  7. django-stubs/contrib/auth/models.pyi +28 -26
  8. django-stubs/contrib/contenttypes/fields.pyi +1 -1
  9. django-stubs/contrib/contenttypes/models.pyi +3 -1
  10. django-stubs/contrib/postgres/fields/array.pyi +5 -3
  11. django-stubs/contrib/postgres/fields/citext.pyi +12 -6
  12. django-stubs/contrib/postgres/fields/hstore.pyi +4 -2
  13. django-stubs/core/cache/backends/base.pyi +9 -0
  14. django-stubs/core/exceptions.pyi +16 -11
  15. django-stubs/core/files/base.pyi +1 -1
  16. django-stubs/core/files/storage.pyi +2 -2
  17. django-stubs/core/mail/message.pyi +6 -6
  18. django-stubs/core/serializers/json.pyi +1 -1
  19. django-stubs/core/servers/basehttp.pyi +2 -2
  20. django-stubs/db/migrations/recorder.pyi +1 -1
  21. django-stubs/db/models/base.pyi +0 -1
  22. django-stubs/db/models/constraints.pyi +1 -0
  23. django-stubs/db/models/enums.pyi +9 -19
  24. django-stubs/db/models/expressions.pyi +1 -1
  25. django-stubs/db/models/fields/__init__.pyi +225 -75
  26. django-stubs/db/models/fields/files.pyi +2 -2
  27. django-stubs/db/models/fields/json.pyi +9 -5
  28. django-stubs/db/models/fields/related.pyi +40 -18
  29. django-stubs/db/models/fields/related_descriptors.pyi +3 -3
  30. django-stubs/db/models/functions/__init__.pyi +2 -0
  31. django-stubs/db/models/functions/comparison.pyi +8 -0
  32. django-stubs/db/models/manager.pyi +11 -6
  33. django-stubs/db/models/query.pyi +4 -1
  34. django-stubs/db/models/query_utils.pyi +1 -0
  35. django-stubs/db/transaction.pyi +7 -1
  36. django-stubs/forms/boundfield.pyi +3 -1
  37. django-stubs/forms/forms.pyi +28 -35
  38. django-stubs/forms/formsets.pyi +98 -63
  39. django-stubs/forms/models.pyi +20 -14
  40. django-stubs/forms/renderers.pyi +26 -13
  41. django-stubs/forms/utils.pyi +38 -11
  42. django-stubs/http/cookie.pyi +3 -1
  43. django-stubs/http/request.pyi +37 -14
  44. django-stubs/http/response.pyi +38 -30
  45. django-stubs/template/backends/base.pyi +14 -5
  46. django-stubs/template/backends/django.pyi +24 -3
  47. django-stubs/template/backends/dummy.pyi +7 -6
  48. django-stubs/template/backends/jinja2.pyi +20 -2
  49. django-stubs/template/backends/utils.pyi +3 -3
  50. django-stubs/template/base.pyi +1 -1
  51. django-stubs/template/context.pyi +2 -2
  52. django-stubs/template/library.pyi +79 -15
  53. django-stubs/template/loader.pyi +5 -3
  54. django-stubs/template/response.pyi +3 -3
  55. django-stubs/template/utils.pyi +6 -4
  56. django-stubs/test/client.pyi +176 -20
  57. django-stubs/test/testcases.pyi +2 -2
  58. django-stubs/test/utils.pyi +41 -55
  59. django-stubs/urls/conf.pyi +7 -0
  60. django-stubs/utils/datastructures.pyi +3 -3
  61. django-stubs/utils/deconstruct.pyi +10 -2
  62. django-stubs/utils/log.pyi +1 -1
  63. django-stubs/utils/six.pyi +1 -1
  64. django-stubs/views/decorators/csrf.pyi +1 -1
  65. {django_types-0.19.0.dist-info → django_types-0.20.0.dist-info}/METADATA +8 -3
  66. {django_types-0.19.0.dist-info → django_types-0.20.0.dist-info}/RECORD +68 -68
  67. {django_types-0.19.0.dist-info → django_types-0.20.0.dist-info}/WHEEL +1 -1
  68. {django_types-0.19.0.dist-info → django_types-0.20.0.dist-info}/LICENSE.txt +0 -0
@@ -1,8 +1,12 @@
1
- from collections.abc import Iterator
2
- from typing import Any
1
+ from collections.abc import Iterator, Mapping
2
+ from typing import Any, NoReturn
3
+ from typing_extensions import override
3
4
 
5
+ from django.http.request import HttpRequest
6
+ from django.template import base
4
7
  from django.template.engine import Engine
5
8
  from django.template.exceptions import TemplateDoesNotExist
9
+ from django.utils.safestring import SafeText
6
10
 
7
11
  from .base import BaseEngine
8
12
 
@@ -12,10 +16,27 @@ class DjangoTemplates(BaseEngine):
12
16
  def get_templatetag_libraries(
13
17
  self, custom_libraries: dict[str, str]
14
18
  ) -> dict[str, str]: ...
19
+ @override
20
+ def from_string(self, template_code: str) -> Template: ...
21
+ @override
22
+ def get_template(self, template_name: str) -> Template: ...
23
+
24
+ class Template:
25
+ template: base.Template
26
+ backend: DjangoTemplates
27
+ def __init__(self, template: base.Template, backend: DjangoTemplates) -> None: ...
28
+ @property
29
+ def origin(self) -> base.Origin: ...
30
+ def render(
31
+ self,
32
+ context: Mapping[str, Any] | None = ...,
33
+ request: HttpRequest | None = ...,
34
+ ) -> SafeText: ...
15
35
 
16
36
  def copy_exception(
17
37
  exc: TemplateDoesNotExist, backend: DjangoTemplates | None = ...
18
38
  ) -> TemplateDoesNotExist: ...
19
- def reraise(exc: TemplateDoesNotExist, backend: DjangoTemplates) -> Any: ...
39
+ def reraise(exc: TemplateDoesNotExist, backend: DjangoTemplates) -> NoReturn: ...
40
+ def get_template_tag_modules() -> Iterator[tuple[str, str]]: ...
20
41
  def get_installed_libraries() -> dict[str, str]: ...
21
42
  def get_package_libraries(pkg: Any) -> Iterator[str]: ...
@@ -1,20 +1,21 @@
1
1
  import string
2
+ from collections.abc import Mapping
2
3
  from typing import Any
4
+ from typing_extensions import override
3
5
 
4
6
  from django.http.request import HttpRequest
5
7
 
6
8
  from .base import BaseEngine
7
9
 
8
10
  class TemplateStrings(BaseEngine):
9
- template_dirs: tuple[str]
10
- def __init__(
11
- self, params: dict[str, dict[Any, Any] | list[Any] | bool | str]
12
- ) -> None: ...
11
+ @override
12
+ def from_string(self, template_code: str) -> Template: ...
13
+ @override
14
+ def get_template(self, template_name: str) -> Template: ...
13
15
 
14
16
  class Template(string.Template):
15
- template: str
16
17
  def render(
17
18
  self,
18
- context: dict[str, str] | None = ...,
19
+ context: Mapping[str, Any] | None = ...,
19
20
  request: HttpRequest | None = ...,
20
21
  ) -> str: ...
@@ -1,16 +1,34 @@
1
- from collections.abc import Callable
1
+ from collections.abc import Callable, Mapping
2
2
  from typing import Any
3
+ from typing_extensions import override
3
4
 
5
+ from django.http.request import HttpRequest
6
+ from django.template import base
4
7
  from django.template.exceptions import TemplateSyntaxError
8
+ from django.utils.safestring import SafeText
5
9
 
6
10
  from .base import BaseEngine
7
11
 
8
12
  class Jinja2(BaseEngine):
9
13
  context_processors: list[str] = ...
10
- def __init__(self, params: dict[str, Any]) -> None: ...
14
+ @override
15
+ def from_string(self, template_code: str) -> Template: ...
16
+ @override
17
+ def get_template(self, template_name: str) -> Template: ...
11
18
  @property
12
19
  def template_context_processors(self) -> list[Callable[..., Any]]: ...
13
20
 
21
+ class Template:
22
+ template: base.Template
23
+ backend: Jinja2
24
+ origin: Origin
25
+ def __init__(self, template: base.Template, backend: Jinja2) -> None: ...
26
+ def render(
27
+ self,
28
+ context: Mapping[str, Any] | None = ...,
29
+ request: HttpRequest | None = ...,
30
+ ) -> SafeText: ...
31
+
14
32
  class Origin:
15
33
  name: str = ...
16
34
  template_name: str | None = ...
@@ -1,9 +1,9 @@
1
- from typing import Any
1
+ from collections.abc import Callable
2
2
 
3
3
  from django.http.request import HttpRequest
4
4
  from django.utils.safestring import SafeText
5
5
 
6
6
  def csrf_input(request: HttpRequest) -> SafeText: ...
7
7
 
8
- csrf_input_lazy: Any
9
- csrf_token_lazy: Any
8
+ csrf_input_lazy: Callable[[HttpRequest], SafeText]
9
+ csrf_token_lazy: Callable[[HttpRequest], SafeText]
@@ -67,7 +67,7 @@ class Template:
67
67
  self,
68
68
  context: Context | dict[str, Any] | None = ...,
69
69
  request: HttpRequest | None = ...,
70
- ) -> Any: ...
70
+ ) -> SafeText: ...
71
71
  def compile_nodelist(self) -> NodeList: ...
72
72
  def get_exception_info(
73
73
  self, exception: Exception, token: Token
@@ -68,8 +68,8 @@ class RequestContext(Context):
68
68
  dicts: list[dict[str, str]]
69
69
  render_context: RenderContext
70
70
  template_name: str | None
71
- use_l10n: None
72
- use_tz: None
71
+ use_l10n: None # pyright: ignore[reportIncompatibleVariableOverride]
72
+ use_tz: None # pyright: ignore[reportIncompatibleVariableOverride]
73
73
  request: HttpRequest = ...
74
74
  def __init__(
75
75
  self,
@@ -1,5 +1,6 @@
1
1
  from collections.abc import Callable
2
- from typing import Any
2
+ from typing import Any, TypeVar, overload
3
+ from typing_extensions import ParamSpec
3
4
 
4
5
  from django.template.base import FilterExpression, Origin, Parser, Token
5
6
  from django.template.context import Context
@@ -7,40 +8,103 @@ from django.utils.safestring import SafeText
7
8
 
8
9
  from .base import Node, Template
9
10
 
11
+ T = TypeVar("T")
12
+ P = ParamSpec("P")
13
+
10
14
  class InvalidTemplateLibrary(Exception): ...
11
15
 
12
16
  class Library:
13
17
  filters: dict[str, Callable[..., Any]] = ...
14
18
  tags: dict[str, Callable[..., Any]] = ...
15
19
  def __init__(self) -> None: ...
20
+
21
+ # Both arguments None
22
+ @overload
23
+ def tag(
24
+ self,
25
+ name: None = ...,
26
+ compile_function: None = ...,
27
+ ) -> Callable[[Callable[P, T]], Callable[P, T]]: ...
28
+ # Only name as function
29
+ @overload
30
+ def tag(
31
+ self,
32
+ name: Callable[P, T],
33
+ compile_function: None = ...,
34
+ ) -> Callable[P, T]: ...
35
+ # Only name as string
36
+ @overload
16
37
  def tag(
17
38
  self,
18
- name: Callable[..., Any] | str | None = ...,
19
- compile_function: Callable[..., Any] | str | None = ...,
20
- ) -> Callable[..., Any]: ...
21
- def tag_function(self, func: Callable[..., Any]) -> Callable[..., Any]: ...
39
+ name: str,
40
+ compile_function: None = ...,
41
+ ) -> Callable[[Callable[P, T]], Callable[P, T]]: ...
42
+ # Both arguments specified
43
+ @overload
44
+ def tag(
45
+ self,
46
+ name: str,
47
+ compile_function: Callable[P, T],
48
+ ) -> Callable[P, T]: ...
49
+ def tag_function(self, func: Callable[P, T]) -> Callable[P, T]: ...
50
+
51
+ # Both arguments None
52
+ @overload
53
+ def filter(
54
+ self,
55
+ name: None = ...,
56
+ filter_func: None = ...,
57
+ **flags: Any,
58
+ ) -> Callable[[Callable[P, T]], Callable[P, T]]: ...
59
+ # Only name as string
60
+ @overload
22
61
  def filter(
23
62
  self,
24
- name: Callable[..., Any] | str | None = ...,
25
- filter_func: Callable[..., Any] | str | None = ...,
26
- **flags: Any
27
- ) -> Callable[..., Any]: ...
28
- def filter_function(
29
- self, func: Callable[..., Any], **flags: Any
30
- ) -> Callable[..., Any]: ...
63
+ name: str = ...,
64
+ filter_func: None = ...,
65
+ **flags: Any,
66
+ ) -> Callable[[Callable[P, T]], Callable[P, T]]: ...
67
+ # Only name as callable
68
+ @overload
69
+ def filter(
70
+ self,
71
+ name: Callable[P, T],
72
+ filter_func: None = ...,
73
+ **flags: Any,
74
+ ) -> Callable[P, T]: ...
75
+ # Both arguments
76
+ @overload
77
+ def filter(
78
+ self,
79
+ name: str,
80
+ filter_func: Callable[P, T],
81
+ **flags: Any,
82
+ ) -> Callable[P, T]: ...
83
+ def filter_function(self, func: Callable[P, T], **flags: Any) -> Callable[P, T]: ...
84
+
85
+ # func is None
86
+ @overload
87
+ def simple_tag(
88
+ self,
89
+ func: None = ...,
90
+ takes_context: bool | None = ...,
91
+ name: str | None = ...,
92
+ ) -> Callable[[Callable[P, T]], Callable[P, T]]: ...
93
+ # func is callable
94
+ @overload
31
95
  def simple_tag(
32
96
  self,
33
- func: Callable[..., Any] | str | None = ...,
97
+ func: Callable[P, T],
34
98
  takes_context: bool | None = ...,
35
99
  name: str | None = ...,
36
- ) -> Callable[..., Any]: ...
100
+ ) -> Callable[P, T]: ...
37
101
  def inclusion_tag(
38
102
  self,
39
103
  filename: Template | str,
40
104
  func: None = ...,
41
105
  takes_context: bool | None = ...,
42
106
  name: str | None = ...,
43
- ) -> Callable[..., Any]: ...
107
+ ) -> Callable[[Callable[P, T]], Callable[P, T]]: ...
44
108
 
45
109
  class TagHelperNode(Node):
46
110
  func: Any = ...
@@ -1,19 +1,21 @@
1
1
  from typing import Any
2
2
 
3
3
  from django.http.request import HttpRequest
4
+ from django.template.backends.base import _BaseTemplate
4
5
  from django.template.exceptions import ( # noqa: F401
5
6
  TemplateDoesNotExist as TemplateDoesNotExist,
6
7
  )
8
+ from django.utils.safestring import SafeText
7
9
 
8
10
  from . import engines as engines # noqa: F401
9
11
 
10
- def get_template(template_name: str, using: str | None = ...) -> Any: ...
12
+ def get_template(template_name: str, using: str | None = ...) -> _BaseTemplate: ...
11
13
  def select_template(
12
14
  template_name_list: list[str] | str, using: str | None = ...
13
- ) -> Any: ...
15
+ ) -> _BaseTemplate: ...
14
16
  def render_to_string(
15
17
  template_name: list[str] | str,
16
18
  context: dict[str, Any] | None = ...,
17
19
  request: HttpRequest | None = ...,
18
20
  using: str | None = ...,
19
- ) -> str: ...
21
+ ) -> SafeText: ...
@@ -15,7 +15,7 @@ class ContentNotRenderedError(Exception): ...
15
15
  class SimpleTemplateResponse(HttpResponse):
16
16
  content: Any = ...
17
17
  closed: bool
18
- cookies: SimpleCookie[Any]
18
+ cookies: SimpleCookie # type: ignore [type-arg]
19
19
  status_code: int
20
20
  rendering_attrs: Any = ...
21
21
  template_name: list[str] | Template | str = ...
@@ -47,9 +47,9 @@ class SimpleTemplateResponse(HttpResponse):
47
47
  class TemplateResponse(SimpleTemplateResponse):
48
48
  client: Client
49
49
  closed: bool
50
- context: RequestContext
50
+ context: RequestContext # pyright: ignore[reportIncompatibleVariableOverride]
51
51
  context_data: dict[str, Any] | None
52
- cookies: SimpleCookie[Any]
52
+ cookies: SimpleCookie # type: ignore [type-arg]
53
53
  csrf_cookie_set: bool
54
54
  json: functools.partial[Any]
55
55
  redirect_chain: list[tuple[str, int]]
@@ -1,4 +1,5 @@
1
- import collections
1
+ from collections.abc import Iterator
2
+ from pathlib import Path
2
3
  from typing import Any
3
4
 
4
5
  from django.core.exceptions import ImproperlyConfigured
@@ -7,10 +8,11 @@ from django.template.backends.base import BaseEngine
7
8
  class InvalidTemplateEngineError(ImproperlyConfigured): ...
8
9
 
9
10
  class EngineHandler:
10
- templates: collections.OrderedDict[Any, Any]
11
11
  def __init__(self, templates: list[dict[str, Any]] = ...) -> None: ...
12
+ @property
13
+ def templates(self) -> dict[str, dict[str, Any]]: ...
12
14
  def __getitem__(self, alias: str) -> BaseEngine: ...
13
- def __iter__(self) -> Any: ...
15
+ def __iter__(self) -> Iterator[BaseEngine]: ...
14
16
  def all(self) -> list[BaseEngine]: ...
15
17
 
16
- def get_app_template_dirs(dirname: str) -> tuple[Any, ...]: ...
18
+ def get_app_template_dirs(dirname: str) -> tuple[Path, ...]: ...
@@ -1,3 +1,4 @@
1
+ from collections.abc import Mapping
1
2
  from io import BytesIO
2
3
  from json import JSONEncoder
3
4
  from re import Pattern
@@ -36,6 +37,13 @@ class ClientHandler(BaseHandler):
36
37
  ) -> None: ...
37
38
  def __call__(self, environ: dict[str, Any]) -> HttpResponseBase: ...
38
39
 
40
+ class AsyncClientHandler(BaseHandler):
41
+ enforce_csrf_checks: bool = ...
42
+ def __init__(
43
+ self, enforce_csrf_checks: bool = ..., *args: Any, **kwargs: Any
44
+ ) -> None: ...
45
+ async def __call__(self, scope: dict[str, Any]) -> HttpResponseBase: ...
46
+
39
47
  def encode_multipart(boundary: str, data: dict[str, Any]) -> bytes: ...
40
48
  def encode_file(boundary: str, key: str, file: Any) -> list[bytes]: ...
41
49
 
@@ -44,10 +52,14 @@ _RequestData = Any | None
44
52
  class RequestFactory:
45
53
  json_encoder: type[JSONEncoder]
46
54
  defaults: dict[str, str]
47
- cookies: SimpleCookie[str]
55
+ cookies: SimpleCookie # type: ignore [type-arg]
48
56
  errors: BytesIO
49
57
  def __init__(
50
- self, *, json_encoder: type[JSONEncoder] = ..., **defaults: Any
58
+ self,
59
+ *,
60
+ json_encoder: type[JSONEncoder] = ...,
61
+ headers: Mapping[str, Any] | None = ...,
62
+ **defaults: Any,
51
63
  ) -> None: ...
52
64
  def request(self, **request: Any) -> WSGIRequest: ...
53
65
  def get(
@@ -57,7 +69,8 @@ class RequestFactory:
57
69
  secure: bool = ...,
58
70
  *,
59
71
  QUERY_STRING: str = ...,
60
- **extra: str
72
+ headers: Mapping[str, Any] | None = ...,
73
+ **extra: str,
61
74
  ) -> WSGIRequest: ...
62
75
  def post(
63
76
  self,
@@ -67,7 +80,8 @@ class RequestFactory:
67
80
  secure: bool = ...,
68
81
  *,
69
82
  QUERY_STRING: str = ...,
70
- **extra: str
83
+ headers: Mapping[str, Any] | None = ...,
84
+ **extra: str,
71
85
  ) -> WSGIRequest: ...
72
86
  def head(
73
87
  self,
@@ -76,10 +90,17 @@ class RequestFactory:
76
90
  secure: bool = ...,
77
91
  *,
78
92
  QUERY_STRING: str = ...,
79
- **extra: str
93
+ headers: Mapping[str, Any] | None = ...,
94
+ **extra: str,
80
95
  ) -> WSGIRequest: ...
81
96
  def trace(
82
- self, path: str, secure: bool = ..., *, QUERY_STRING: str = ..., **extra: str
97
+ self,
98
+ path: str,
99
+ secure: bool = ...,
100
+ *,
101
+ QUERY_STRING: str = ...,
102
+ headers: Mapping[str, Any] | None = ...,
103
+ **extra: str,
83
104
  ) -> WSGIRequest: ...
84
105
  def options(
85
106
  self,
@@ -89,7 +110,8 @@ class RequestFactory:
89
110
  secure: bool = ...,
90
111
  *,
91
112
  QUERY_STRING: str = ...,
92
- **extra: str
113
+ headers: Mapping[str, Any] | None = ...,
114
+ **extra: str,
93
115
  ) -> WSGIRequest: ...
94
116
  def put(
95
117
  self,
@@ -99,7 +121,8 @@ class RequestFactory:
99
121
  secure: bool = ...,
100
122
  *,
101
123
  QUERY_STRING: str = ...,
102
- **extra: str
124
+ headers: Mapping[str, Any] | None = ...,
125
+ **extra: str,
103
126
  ) -> WSGIRequest: ...
104
127
  def patch(
105
128
  self,
@@ -109,7 +132,8 @@ class RequestFactory:
109
132
  secure: bool = ...,
110
133
  *,
111
134
  QUERY_STRING: str = ...,
112
- **extra: str
135
+ headers: Mapping[str, Any] | None = ...,
136
+ **extra: str,
113
137
  ) -> WSGIRequest: ...
114
138
  def delete(
115
139
  self,
@@ -119,7 +143,8 @@ class RequestFactory:
119
143
  secure: bool = ...,
120
144
  *,
121
145
  QUERY_STRING: str = ...,
122
- **extra: str
146
+ headers: Mapping[str, Any] | None = ...,
147
+ **extra: str,
123
148
  ) -> WSGIRequest: ...
124
149
  def generic(
125
150
  self,
@@ -130,20 +155,23 @@ class RequestFactory:
130
155
  secure: bool = ...,
131
156
  *,
132
157
  QUERY_STRING: str = ...,
133
- **extra: str
158
+ headers: Mapping[str, Any] | None = ...,
159
+ **extra: str,
134
160
  ) -> WSGIRequest: ...
135
161
 
136
162
  class Client(RequestFactory):
137
163
  handler: ClientHandler
138
164
  raise_request_exception: bool
139
165
  exc_info: tuple[type[BaseException], BaseException, TracebackType] | None
166
+ headers: dict[str, Any]
140
167
  def __init__(
141
168
  self,
142
169
  enforce_csrf_checks: bool = ...,
143
170
  raise_request_exception: bool = ...,
144
171
  *,
145
172
  json_encoder: type[JSONEncoder] = ...,
146
- **defaults: Any
173
+ headers: Mapping[str, Any] | None = ...,
174
+ **defaults: Any,
147
175
  ) -> None: ...
148
176
  # Silence type warnings, since this class overrides arguments and return types in an unsafe manner.
149
177
  def request(self, **request: Any) -> HttpResponse: ... # type: ignore [override]
@@ -155,7 +183,8 @@ class Client(RequestFactory):
155
183
  secure: bool = ...,
156
184
  *,
157
185
  QUERY_STRING: str = ...,
158
- **extra: str
186
+ headers: Mapping[str, Any] | None = ...,
187
+ **extra: str,
159
188
  ) -> HttpResponse: ...
160
189
  def post( # type: ignore [override]
161
190
  self,
@@ -166,7 +195,8 @@ class Client(RequestFactory):
166
195
  secure: bool = ...,
167
196
  *,
168
197
  QUERY_STRING: str = ...,
169
- **extra: str
198
+ headers: Mapping[str, Any] | None = ...,
199
+ **extra: str,
170
200
  ) -> HttpResponse: ...
171
201
  def head( # type: ignore [override]
172
202
  self,
@@ -176,7 +206,8 @@ class Client(RequestFactory):
176
206
  secure: bool = ...,
177
207
  *,
178
208
  QUERY_STRING: str = ...,
179
- **extra: str
209
+ headers: Mapping[str, Any] | None = ...,
210
+ **extra: str,
180
211
  ) -> HttpResponse: ...
181
212
  def trace( # type: ignore [override]
182
213
  self,
@@ -186,7 +217,8 @@ class Client(RequestFactory):
186
217
  secure: bool = ...,
187
218
  *,
188
219
  QUERY_STRING: str = ...,
189
- **extra: str
220
+ headers: Mapping[str, Any] | None = ...,
221
+ **extra: str,
190
222
  ) -> HttpResponse: ...
191
223
  def options( # type: ignore [override]
192
224
  self,
@@ -197,7 +229,8 @@ class Client(RequestFactory):
197
229
  secure: bool = ...,
198
230
  *,
199
231
  QUERY_STRING: str = ...,
200
- **extra: str
232
+ headers: Mapping[str, Any] | None = ...,
233
+ **extra: str,
201
234
  ) -> HttpResponse: ...
202
235
  def put( # type: ignore [override]
203
236
  self,
@@ -208,7 +241,8 @@ class Client(RequestFactory):
208
241
  secure: bool = ...,
209
242
  *,
210
243
  QUERY_STRING: str = ...,
211
- **extra: str
244
+ headers: Mapping[str, Any] | None = ...,
245
+ **extra: str,
212
246
  ) -> HttpResponse: ...
213
247
  def patch( # type: ignore [override]
214
248
  self,
@@ -219,7 +253,8 @@ class Client(RequestFactory):
219
253
  secure: bool = ...,
220
254
  *,
221
255
  QUERY_STRING: str = ...,
222
- **extra: str
256
+ headers: Mapping[str, Any] | None = ...,
257
+ **extra: str,
223
258
  ) -> HttpResponse: ...
224
259
  def delete( # type: ignore [override]
225
260
  self,
@@ -230,7 +265,128 @@ class Client(RequestFactory):
230
265
  secure: bool = ...,
231
266
  *,
232
267
  QUERY_STRING: str = ...,
233
- **extra: str
268
+ headers: Mapping[str, Any] | None = ...,
269
+ **extra: str,
270
+ ) -> HttpResponse: ...
271
+ def store_exc_info(self, **kwargs: Any) -> None: ...
272
+ @property
273
+ def session(self) -> SessionBase: ...
274
+ def login(self, **credentials: Any) -> bool: ...
275
+ def force_login(
276
+ self, user: AbstractBaseUser, backend: str | None = ...
277
+ ) -> None: ...
278
+ def logout(self) -> None: ...
279
+
280
+ class AsyncRequestFactory(RequestFactory): ...
281
+
282
+ class AsyncClient(AsyncRequestFactory):
283
+ handler: AsyncClientHandler
284
+ raise_request_exception: bool
285
+ exc_info: tuple[type[BaseException], BaseException, TracebackType] | None
286
+ headers: dict[str, Any]
287
+ def __init__(
288
+ self,
289
+ enforce_csrf_checks: bool = ...,
290
+ raise_request_exception: bool = ...,
291
+ *,
292
+ json_encoder: type[JSONEncoder] = ...,
293
+ headers: Mapping[str, Any] | None = ...,
294
+ **defaults: Any,
295
+ ) -> None: ...
296
+ # Silence type warnings, since this class overrides arguments and return types in an unsafe manner.
297
+ async def request(self, **request: Any) -> HttpResponse: ... # type: ignore [override]
298
+ async def get( # type: ignore [override]
299
+ self,
300
+ path: str,
301
+ data: _RequestData = ...,
302
+ follow: bool = ...,
303
+ secure: bool = ...,
304
+ *,
305
+ QUERY_STRING: str = ...,
306
+ headers: Mapping[str, Any] | None = ...,
307
+ **extra: str,
308
+ ) -> HttpResponse: ...
309
+ async def post( # type: ignore [override]
310
+ self,
311
+ path: str,
312
+ data: _RequestData = ...,
313
+ content_type: str = ...,
314
+ follow: bool = ...,
315
+ secure: bool = ...,
316
+ *,
317
+ QUERY_STRING: str = ...,
318
+ headers: Mapping[str, Any] | None = ...,
319
+ **extra: str,
320
+ ) -> HttpResponse: ...
321
+ async def head( # type: ignore [override]
322
+ self,
323
+ path: str,
324
+ data: _RequestData = ...,
325
+ follow: bool = ...,
326
+ secure: bool = ...,
327
+ *,
328
+ QUERY_STRING: str = ...,
329
+ headers: Mapping[str, Any] | None = ...,
330
+ **extra: str,
331
+ ) -> HttpResponse: ...
332
+ async def trace( # type: ignore [override]
333
+ self,
334
+ path: str,
335
+ data: _RequestData = ...,
336
+ follow: bool = ...,
337
+ secure: bool = ...,
338
+ *,
339
+ QUERY_STRING: str = ...,
340
+ headers: Mapping[str, Any] | None = ...,
341
+ **extra: str,
342
+ ) -> HttpResponse: ...
343
+ async def options( # type: ignore [override]
344
+ self,
345
+ path: str,
346
+ data: _RequestData = ...,
347
+ content_type: str = ...,
348
+ follow: bool = ...,
349
+ secure: bool = ...,
350
+ *,
351
+ QUERY_STRING: str = ...,
352
+ headers: Mapping[str, Any] | None = ...,
353
+ **extra: str,
354
+ ) -> HttpResponse: ...
355
+ async def put( # type: ignore [override]
356
+ self,
357
+ path: str,
358
+ data: _RequestData = ...,
359
+ content_type: str = ...,
360
+ follow: bool = ...,
361
+ secure: bool = ...,
362
+ *,
363
+ QUERY_STRING: str = ...,
364
+ headers: Mapping[str, Any] | None = ...,
365
+ **extra: str,
366
+ ) -> HttpResponse: ...
367
+ async def patch( # type: ignore [override]
368
+ self,
369
+ path: str,
370
+ data: _RequestData = ...,
371
+ content_type: str = ...,
372
+ follow: bool = ...,
373
+ secure: bool = ...,
374
+ *,
375
+ QUERY_STRING: str = ...,
376
+ headers: Mapping[str, Any] | None = ...,
377
+ **extra: str,
378
+ ) -> HttpResponse: ...
379
+ async def delete( # type: ignore [override]
380
+ self,
381
+ path: str,
382
+ data: _RequestData = ...,
383
+ content_type: str = ...,
384
+ follow: bool = ...,
385
+ secure: bool = ...,
386
+ *,
387
+ QUERY_STRING: str = ...,
388
+ headers: Mapping[str, Any] | None = ...,
389
+ **extra: str,
234
390
  ) -> HttpResponse: ...
235
391
  def store_exc_info(self, **kwargs: Any) -> None: ...
236
392
  @property