django-types 0.19.1__py3-none-any.whl → 0.21.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 (96) hide show
  1. django-stubs/contrib/admin/__init__.pyi +1 -0
  2. django-stubs/contrib/admin/actions.pyi +2 -2
  3. django-stubs/contrib/admin/decorators.pyi +4 -3
  4. django-stubs/contrib/admin/filters.pyi +5 -5
  5. django-stubs/contrib/admin/models.pyi +23 -11
  6. django-stubs/contrib/admin/options.pyi +67 -38
  7. django-stubs/contrib/admin/sites.pyi +11 -11
  8. django-stubs/contrib/admin/templatetags/base.pyi +1 -1
  9. django-stubs/contrib/admin/utils.pyi +2 -2
  10. django-stubs/contrib/admin/views/autocomplete.pyi +2 -2
  11. django-stubs/contrib/admin/views/main.pyi +8 -7
  12. django-stubs/contrib/admindocs/middleware.pyi +2 -2
  13. django-stubs/contrib/auth/__init__.pyi +14 -4
  14. django-stubs/contrib/auth/admin.pyi +2 -2
  15. django-stubs/contrib/auth/backends.pyi +22 -0
  16. django-stubs/contrib/auth/base_user.pyi +3 -3
  17. django-stubs/contrib/auth/forms.pyi +1 -1
  18. django-stubs/contrib/auth/middleware.pyi +1 -2
  19. django-stubs/contrib/auth/models.pyi +50 -26
  20. django-stubs/contrib/auth/views.pyi +1 -2
  21. django-stubs/contrib/contenttypes/fields.pyi +1 -1
  22. django-stubs/contrib/contenttypes/models.pyi +3 -1
  23. django-stubs/contrib/flatpages/middleware.pyi +2 -2
  24. django-stubs/contrib/flatpages/views.pyi +3 -3
  25. django-stubs/contrib/postgres/fields/array.pyi +6 -5
  26. django-stubs/contrib/postgres/fields/citext.pyi +13 -8
  27. django-stubs/contrib/postgres/fields/hstore.pyi +5 -4
  28. django-stubs/contrib/staticfiles/finders.pyi +1 -2
  29. django-stubs/contrib/staticfiles/views.pyi +2 -2
  30. django-stubs/contrib/syndication/views.pyi +4 -4
  31. django-stubs/core/cache/backends/base.pyi +9 -0
  32. django-stubs/core/exceptions.pyi +18 -11
  33. django-stubs/core/files/base.pyi +1 -1
  34. django-stubs/core/files/storage.pyi +2 -2
  35. django-stubs/core/mail/__init__.pyi +1 -1
  36. django-stubs/core/mail/backends/base.pyi +1 -0
  37. django-stubs/core/mail/message.pyi +6 -6
  38. django-stubs/core/serializers/json.pyi +1 -1
  39. django-stubs/core/servers/basehttp.pyi +2 -2
  40. django-stubs/db/backends/utils.pyi +1 -2
  41. django-stubs/db/migrations/recorder.pyi +1 -1
  42. django-stubs/db/models/base.pyi +9 -3
  43. django-stubs/db/models/constraints.pyi +1 -0
  44. django-stubs/db/models/enums.pyi +10 -19
  45. django-stubs/db/models/expressions.pyi +1 -1
  46. django-stubs/db/models/fields/__init__.pyi +227 -77
  47. django-stubs/db/models/fields/files.pyi +2 -2
  48. django-stubs/db/models/fields/json.pyi +10 -6
  49. django-stubs/db/models/fields/related.pyi +42 -20
  50. django-stubs/db/models/fields/related_descriptors.pyi +3 -3
  51. django-stubs/db/models/functions/__init__.pyi +2 -0
  52. django-stubs/db/models/functions/comparison.pyi +8 -0
  53. django-stubs/db/models/manager.pyi +11 -6
  54. django-stubs/db/models/query.pyi +4 -1
  55. django-stubs/db/models/query_utils.pyi +1 -0
  56. django-stubs/db/transaction.pyi +7 -1
  57. django-stubs/forms/boundfield.pyi +3 -1
  58. django-stubs/forms/forms.pyi +28 -35
  59. django-stubs/forms/formsets.pyi +98 -63
  60. django-stubs/forms/models.pyi +22 -17
  61. django-stubs/forms/renderers.pyi +26 -13
  62. django-stubs/forms/utils.pyi +38 -11
  63. django-stubs/http/cookie.pyi +3 -1
  64. django-stubs/http/request.pyi +43 -16
  65. django-stubs/http/response.pyi +38 -30
  66. django-stubs/shortcuts.pyi +1 -2
  67. django-stubs/template/backends/base.pyi +14 -5
  68. django-stubs/template/backends/django.pyi +24 -3
  69. django-stubs/template/backends/dummy.pyi +7 -6
  70. django-stubs/template/backends/jinja2.pyi +20 -2
  71. django-stubs/template/backends/utils.pyi +3 -3
  72. django-stubs/template/base.pyi +2 -2
  73. django-stubs/template/context.pyi +2 -2
  74. django-stubs/template/context_processors.pyi +1 -2
  75. django-stubs/template/library.pyi +79 -15
  76. django-stubs/template/loader.pyi +5 -3
  77. django-stubs/template/response.pyi +3 -3
  78. django-stubs/template/utils.pyi +6 -4
  79. django-stubs/test/client.pyi +176 -20
  80. django-stubs/test/testcases.pyi +4 -4
  81. django-stubs/test/utils.pyi +41 -55
  82. django-stubs/urls/base.pyi +18 -2
  83. django-stubs/urls/conf.pyi +7 -0
  84. django-stubs/utils/cache.pyi +4 -4
  85. django-stubs/utils/datastructures.pyi +5 -5
  86. django-stubs/utils/deconstruct.pyi +10 -2
  87. django-stubs/utils/log.pyi +1 -1
  88. django-stubs/utils/six.pyi +1 -1
  89. django-stubs/utils/translation/__init__.pyi +5 -3
  90. django-stubs/utils/translation/trans_real.pyi +2 -2
  91. django-stubs/views/decorators/csrf.pyi +1 -1
  92. django-stubs/views/generic/edit.pyi +1 -2
  93. {django_types-0.19.1.dist-info → django_types-0.21.0.dist-info}/METADATA +12 -8
  94. {django_types-0.19.1.dist-info → django_types-0.21.0.dist-info}/RECORD +96 -96
  95. {django_types-0.19.1.dist-info → django_types-0.21.0.dist-info}/WHEEL +1 -1
  96. {django_types-0.19.1.dist-info → django_types-0.21.0.dist-info}/LICENSE.txt +0 -0
@@ -17,22 +17,43 @@ class BaseBackend:
17
17
  password: str | None = ...,
18
18
  **kwargs: Any
19
19
  ) -> AbstractBaseUser | None: ...
20
+ async def aauthenticate(
21
+ self,
22
+ request: HttpRequest,
23
+ username: str | None = ...,
24
+ password: str | None = ...,
25
+ **kwargs: Any
26
+ ) -> AbstractBaseUser | None: ...
20
27
  def get_user(self, user_id: int) -> AbstractBaseUser | None: ...
28
+ async def aget_user(self, user_id: int) -> AbstractBaseUser | None: ...
21
29
  def get_user_permissions(
22
30
  self, user_obj: _AnyUser, obj: Model | None = ...
23
31
  ) -> set[str]: ...
32
+ async def aget_user_permissions(
33
+ self, user_obj: _AnyUser, obj: Model | None = ...
34
+ ) -> set[str]: ...
24
35
  def get_group_permissions(
25
36
  self, user_obj: _AnyUser, obj: Model | None = ...
26
37
  ) -> set[str]: ...
38
+ async def aget_group_permissions(
39
+ self, user_obj: _AnyUser, obj: Model | None = ...
40
+ ) -> set[str]: ...
27
41
  def get_all_permissions(
28
42
  self, user_obj: _AnyUser, obj: Model | None = ...
29
43
  ) -> set[str]: ...
44
+ async def aget_all_permissions(
45
+ self, user_obj: _AnyUser, obj: Model | None = ...
46
+ ) -> set[str]: ...
30
47
  def has_perm(
31
48
  self, user_obj: _AnyUser, perm: str, obj: Model | None = ...
32
49
  ) -> bool: ...
50
+ async def ahas_perm(
51
+ self, user_obj: _AnyUser, perm: str, obj: Model | None = ...
52
+ ) -> bool: ...
33
53
 
34
54
  class ModelBackend(BaseBackend):
35
55
  def has_module_perms(self, user_obj: _AnyUser, app_label: str) -> bool: ...
56
+ async def ahas_module_perms(self, user_obj: _AnyUser, app_label: str) -> bool: ...
36
57
  def user_can_authenticate(self, user: _AnyUser | None) -> bool: ...
37
58
  def with_perm(
38
59
  self,
@@ -48,5 +69,6 @@ class RemoteUserBackend(ModelBackend):
48
69
  create_unknown_user: bool = ...
49
70
  def clean_username(self, username: str) -> str: ...
50
71
  def configure_user(self, request: HttpRequest, user: User) -> User: ...
72
+ async def aconfigure_user(self, request: HttpRequest, user: User) -> User: ...
51
73
 
52
74
  class AllowAllUsersRemoteUserBackend(RemoteUserBackend): ...
@@ -1,5 +1,4 @@
1
- from typing import Any, TypeVar
2
- from typing_extensions import Literal
1
+ from typing import Any, Literal, TypeVar
3
2
 
4
3
  from django.db import models
5
4
  from django.db.models.base import Model
@@ -14,7 +13,8 @@ class BaseUserManager(models.Manager[_ModelT]):
14
13
  def make_random_password(
15
14
  self, length: int = ..., allowed_chars: str = ...
16
15
  ) -> str: ...
17
- def get_by_natural_key(self, username: str | None) -> _ModelT: ...
16
+ def get_by_natural_key(self, username: str) -> _ModelT: ...
17
+ async def aget_by_natural_key(self, username: str) -> _ModelT: ...
18
18
 
19
19
  class AbstractBaseUser(models.Model):
20
20
  REQUIRED_FIELDS: list[str] = ...
@@ -35,7 +35,7 @@ class AuthenticationForm(forms.Form):
35
35
  password: Any = ...
36
36
  error_messages: Any = ...
37
37
  request: WSGIRequest = ...
38
- user_cache: None = ...
38
+ user_cache: AbstractBaseUser | None = ...
39
39
  username_field: Any = ...
40
40
  def __init__(self, request: Any = ..., *args: Any, **kwargs: Any) -> None: ...
41
41
  def confirm_login_allowed(self, user: AbstractBaseUser) -> None: ...
@@ -1,9 +1,8 @@
1
1
  from django.contrib.auth.models import AnonymousUser, User
2
- from django.core.handlers.wsgi import WSGIRequest
3
2
  from django.http.request import HttpRequest
4
3
  from django.utils.deprecation import MiddlewareMixin
5
4
 
6
- def get_user(request: WSGIRequest) -> AnonymousUser | User: ...
5
+ def get_user(request: HttpRequest) -> AnonymousUser | User: ...
7
6
 
8
7
  class AuthenticationMiddleware(MiddlewareMixin):
9
8
  def process_request(self, request: HttpRequest) -> None: ...
@@ -1,6 +1,6 @@
1
- from collections.abc import Collection
2
- from typing import Any, ClassVar, TypeVar
3
- from typing_extensions import Literal, Self
1
+ from collections.abc import Iterable
2
+ from typing import Any, ClassVar, Literal, TypeVar
3
+ from typing_extensions import Never, Self
4
4
 
5
5
  from django.contrib.auth.backends import ModelBackend
6
6
  from django.contrib.auth.base_user import AbstractBaseUser as AbstractBaseUser
@@ -9,9 +9,9 @@ from django.contrib.auth.validators import UnicodeUsernameValidator
9
9
  from django.contrib.contenttypes.models import ContentType
10
10
  from django.db import models
11
11
  from django.db.models.base import Model
12
- from django.db.models.manager import EmptyManager
12
+ from django.db.models.manager import EmptyManager, ManyToManyRelatedManager
13
13
 
14
- _AnyUser = Model | AnonymousUser
14
+ _AnyUser = AbstractUser | AnonymousUser
15
15
 
16
16
  _T = TypeVar("_T", bound=Model)
17
17
 
@@ -34,6 +34,7 @@ class Permission(models.Model):
34
34
  content_type = models.ForeignKey(ContentType, on_delete=models.CASCADE)
35
35
  codename = models.CharField(max_length=100)
36
36
  def natural_key(self) -> tuple[str, str, str]: ...
37
+ group_set = ManyToManyRelatedManager["Group", "Permission"]()
37
38
 
38
39
  _GroupT = TypeVar("_GroupT", bound=Group)
39
40
 
@@ -45,22 +46,38 @@ class Group(models.Model):
45
46
 
46
47
  name = models.CharField(max_length=150)
47
48
  permissions = models.ManyToManyField[Permission, Any](Permission)
48
- def natural_key(self) -> tuple[str, ...]: ...
49
+ def natural_key(self) -> tuple[str]: ...
50
+ user_set = ManyToManyRelatedManager["PermissionsMixin", "Group"]()
49
51
 
50
52
  class UserManager(BaseUserManager[_T]):
53
+ use_in_migrations: bool = ...
51
54
  def create_user(
52
55
  self,
53
56
  username: str,
54
57
  email: str | None = ...,
55
58
  password: str | None = ...,
56
- **extra_fields: Any
59
+ **extra_fields: Any,
60
+ ) -> _T: ...
61
+ async def acreate_user(
62
+ self,
63
+ username: str,
64
+ email: str | None = ...,
65
+ password: str | None = ...,
66
+ **extra_fields: Any,
57
67
  ) -> _T: ...
58
68
  def create_superuser(
59
69
  self,
60
70
  username: str,
61
71
  email: str | None,
62
72
  password: str | None,
63
- **extra_fields: Any
73
+ **extra_fields: Any,
74
+ ) -> _T: ...
75
+ async def acreate_superuser(
76
+ self,
77
+ username: str,
78
+ email: str | None,
79
+ password: str | None,
80
+ **extra_fields: Any,
64
81
  ) -> _T: ...
65
82
  def with_perm(
66
83
  self,
@@ -69,26 +86,32 @@ class UserManager(BaseUserManager[_T]):
69
86
  include_superusers: bool = ...,
70
87
  backend: type[ModelBackend] | str | None = ...,
71
88
  obj: Model | None = ...,
72
- ) -> Any: ...
89
+ ) -> Self | UserManager[_T]: ...
73
90
 
74
91
  class PermissionsMixin(models.Model):
75
92
  is_superuser = models.BooleanField()
76
93
  groups = models.ManyToManyField[Group, Any](Group)
77
94
  user_permissions = models.ManyToManyField[Permission, Any](Permission)
78
- def get_user_permissions(self, obj: _AnyUser | None = ...) -> set[str]: ...
79
- def get_group_permissions(self, obj: _AnyUser | None = ...) -> set[str]: ...
80
- def get_all_permissions(self, obj: _AnyUser | None = ...) -> set[str]: ...
81
- def has_perm(self, perm: str, obj: _AnyUser | None = ...) -> bool: ...
82
- def has_perms(
83
- self, perm_list: Collection[str], obj: _AnyUser | None = ...
95
+ def get_user_permissions(self, obj: Model | None = ...) -> set[str]: ...
96
+ async def aget_user_permissions(self, obj: Model | None = ...) -> set[str]: ...
97
+ def get_group_permissions(self, obj: Model | None = ...) -> set[str]: ...
98
+ async def aget_group_permissions(self, obj: Model | None = ...) -> set[str]: ...
99
+ def get_all_permissions(self, obj: Model | None = ...) -> set[str]: ...
100
+ async def aget_all_permissions(self, obj: Model | None = ...) -> set[str]: ...
101
+ def has_perm(self, perm: str, obj: Model | None = ...) -> bool: ...
102
+ async def ahas_perm(self, perm: str, obj: Model | None = ...) -> bool: ...
103
+ def has_perms(self, perm_list: Iterable[str], obj: Model | None = ...) -> bool: ...
104
+ async def ahas_perms(
105
+ self, perm_list: Iterable[str], obj: Model | None = ...
84
106
  ) -> bool: ...
85
107
  def has_module_perms(self, app_label: str) -> bool: ...
108
+ async def ahas_module_perms(self, app_label: str) -> bool: ...
86
109
 
87
110
  class AbstractUser(AbstractBaseUser, PermissionsMixin):
88
111
  username_validator: UnicodeUsernameValidator = ...
89
112
 
90
113
  username = models.CharField(max_length=150)
91
- first_name = models.CharField(max_length=30, blank=True)
114
+ first_name = models.CharField(max_length=150, blank=True)
92
115
  last_name = models.CharField(max_length=150, blank=True)
93
116
  email = models.EmailField(blank=True)
94
117
  is_staff = models.BooleanField()
@@ -100,33 +123,34 @@ class AbstractUser(AbstractBaseUser, PermissionsMixin):
100
123
  def get_full_name(self) -> str: ...
101
124
  def get_short_name(self) -> str: ...
102
125
  def email_user(
103
- self, subject: str, message: str, from_email: str = ..., **kwargs: Any
126
+ self, subject: str, message: str, from_email: str | None = ..., **kwargs: Any
104
127
  ) -> None: ...
105
128
 
106
- class User(AbstractUser):
107
129
  objects: ClassVar[UserManager[Self]] # type: ignore[assignment]
108
130
 
131
+ class User(AbstractUser): ...
132
+
109
133
  class AnonymousUser:
110
- id: Any = ...
111
- pk: Any = ...
134
+ id: None = ...
135
+ pk: None = ...
112
136
  username: str = ...
113
137
  is_staff: bool = ...
114
138
  is_active: bool = ...
115
139
  is_superuser: bool = ...
116
- def save(self) -> Any: ...
117
- def delete(self) -> Any: ...
118
- def set_password(self, raw_password: str) -> Any: ...
119
- def check_password(self, raw_password: str) -> Any: ...
140
+ def save(self) -> Never: ...
141
+ def delete(self) -> Never: ...
142
+ def set_password(self, raw_password: str) -> Never: ...
143
+ def check_password(self, raw_password: str) -> Never: ...
120
144
  @property
121
145
  def groups(self) -> EmptyManager[Group]: ...
122
146
  @property
123
147
  def user_permissions(self) -> EmptyManager[Permission]: ...
124
148
  def get_user_permissions(self, obj: _AnyUser | None = ...) -> set[str]: ...
125
- def get_group_permissions(self, obj: _AnyUser | None = ...) -> set[Any]: ...
149
+ def get_group_permissions(self, obj: _AnyUser | None = ...) -> set[str]: ...
126
150
  def get_all_permissions(self, obj: _AnyUser | None = ...) -> set[str]: ...
127
151
  def has_perm(self, perm: str, obj: _AnyUser | None = ...) -> bool: ...
128
152
  def has_perms(
129
- self, perm_list: Collection[str], obj: _AnyUser | None = ...
153
+ self, perm_list: Iterable[str], obj: _AnyUser | None = ...
130
154
  ) -> bool: ...
131
155
  def has_module_perms(self, module: str) -> bool: ...
132
156
  @property
@@ -2,7 +2,6 @@ from typing import Any
2
2
 
3
3
  from django.contrib.auth.base_user import AbstractBaseUser
4
4
  from django.contrib.auth.forms import AuthenticationForm
5
- from django.core.handlers.wsgi import WSGIRequest
6
5
  from django.http.request import HttpRequest
7
6
  from django.http.response import HttpResponseRedirect
8
7
  from django.template.response import TemplateResponse
@@ -27,7 +26,7 @@ class LogoutView(SuccessURLAllowedHostsMixin, TemplateView):
27
26
  redirect_field_name: Any = ...
28
27
  extra_context: Any = ...
29
28
  def post(
30
- self, request: WSGIRequest, *args: Any, **kwargs: Any
29
+ self, request: HttpRequest, *args: Any, **kwargs: Any
31
30
  ) -> TemplateResponse: ...
32
31
  def get_next_page(self) -> str | None: ...
33
32
 
@@ -67,7 +67,7 @@ class GenericForeignKey(FieldCacheMixin):
67
67
  def __set__(self, instance: Model, value: Any | None) -> None: ...
68
68
 
69
69
  class GenericRel(ForeignObjectRel):
70
- field: GenericRelation
70
+ field: GenericRelation # pyright: ignore[reportIncompatibleVariableOverride]
71
71
  def __init__(
72
72
  self,
73
73
  field: GenericRelation,
@@ -22,7 +22,9 @@ class ContentType(models.Model):
22
22
  id: int
23
23
  app_label: models.CharField[Any] = ...
24
24
  model: models.CharField[Any] = ...
25
- objects: ClassVar[ContentTypeManager] = ...
25
+ objects: ClassVar[ # pyright: ignore[reportIncompatibleVariableOverride]
26
+ ContentTypeManager
27
+ ] = ...
26
28
  permission_set: Manager[Permission]
27
29
  @property
28
30
  def name(self) -> str: ...
@@ -1,8 +1,8 @@
1
- from django.core.handlers.wsgi import WSGIRequest
1
+ from django.http.request import HttpRequest
2
2
  from django.http.response import HttpResponse
3
3
  from django.utils.deprecation import MiddlewareMixin
4
4
 
5
5
  class FlatpageFallbackMiddleware(MiddlewareMixin):
6
6
  def process_response(
7
- self, request: WSGIRequest, response: HttpResponse
7
+ self, request: HttpRequest, response: HttpResponse
8
8
  ) -> HttpResponse: ...
@@ -1,8 +1,8 @@
1
1
  from django.contrib.flatpages.models import FlatPage
2
- from django.core.handlers.wsgi import WSGIRequest
2
+ from django.http.request import HttpRequest
3
3
  from django.http.response import HttpResponse
4
4
 
5
5
  DEFAULT_TEMPLATE: str
6
6
 
7
- def flatpage(request: WSGIRequest, url: str) -> HttpResponse: ...
8
- def render_flatpage(request: WSGIRequest, f: FlatPage) -> HttpResponse: ...
7
+ def flatpage(request: HttpRequest, url: str) -> HttpResponse: ...
8
+ def render_flatpage(request: HttpRequest, f: FlatPage) -> HttpResponse: ...
@@ -1,6 +1,5 @@
1
1
  from collections.abc import Callable, Iterable
2
- from typing import Any, Generic, TypeVar, overload
3
- from typing_extensions import Literal
2
+ from typing import Any, Generic, Literal, TypeVar, overload
4
3
 
5
4
  from django.db.models.expressions import Combinable
6
5
  from django.db.models.fields import Field, _ErrorMessagesToOverride, _ValidatorCallable
@@ -17,17 +16,18 @@ class ArrayField(CheckFieldDefaultMixin, Generic[_V], Field[_V | Combinable, _V]
17
16
  from_db_value: Any = ...
18
17
  base_field: Field[_V, _V] = ...
19
18
  @overload
20
- def __new__( # type: ignore [misc]
19
+ def __new__(
21
20
  cls,
22
21
  base_field: Field[Any, _V],
23
22
  size: int | None = ...,
24
23
  verbose_name: str | None = ...,
24
+ *,
25
25
  name: str | None = ...,
26
26
  primary_key: bool = ...,
27
27
  max_length: int | None = ...,
28
28
  unique: bool = ...,
29
29
  blank: bool = ...,
30
- null: Literal[False] = ...,
30
+ null: Literal[False] = False,
31
31
  db_index: bool = ...,
32
32
  default: list[_V] | Callable[[], list[_V]] | None = ...,
33
33
  editable: bool = ...,
@@ -51,12 +51,13 @@ class ArrayField(CheckFieldDefaultMixin, Generic[_V], Field[_V | Combinable, _V]
51
51
  base_field: Field[Any, _V],
52
52
  size: int | None = ...,
53
53
  verbose_name: str | None = ...,
54
+ *,
54
55
  name: str | None = ...,
55
56
  primary_key: bool = ...,
56
57
  max_length: int | None = ...,
57
58
  unique: bool = ...,
58
59
  blank: bool = ...,
59
- null: Literal[True] = ...,
60
+ null: Literal[True],
60
61
  db_index: bool = ...,
61
62
  default: list[_V] | Callable[[], list[_V]] | None = ...,
62
63
  editable: bool = ...,
@@ -1,6 +1,5 @@
1
1
  from collections.abc import Callable, Iterable
2
- from typing import Any, TypeVar, overload
3
- from typing_extensions import Literal
2
+ from typing import Any, Literal, TypeVar, overload
4
3
 
5
4
  from django.db.models.fields import CharField, EmailField, TextField
6
5
 
@@ -20,12 +19,13 @@ class CICharField(CIText, CharField[_C]):
20
19
  def __init__(
21
20
  self: CICharField[str],
22
21
  verbose_name: str | bytes | None = ...,
22
+ *,
23
23
  name: str | None = ...,
24
24
  primary_key: bool = ...,
25
25
  max_length: int | None = ...,
26
26
  unique: bool = ...,
27
27
  blank: bool = ...,
28
- null: Literal[False] = ...,
28
+ null: Literal[False] = False,
29
29
  db_index: bool = ...,
30
30
  default: Any = ...,
31
31
  editable: bool = ...,
@@ -45,12 +45,13 @@ class CICharField(CIText, CharField[_C]):
45
45
  def __init__(
46
46
  self: CICharField[str | None],
47
47
  verbose_name: str | bytes | None = ...,
48
+ *,
48
49
  name: str | None = ...,
49
50
  primary_key: bool = ...,
50
51
  max_length: int | None = ...,
51
52
  unique: bool = ...,
52
53
  blank: bool = ...,
53
- null: Literal[True] = ...,
54
+ null: Literal[True],
54
55
  db_index: bool = ...,
55
56
  default: Any = ...,
56
57
  editable: bool = ...,
@@ -74,12 +75,13 @@ class CIEmailField(CIText, EmailField[_C]):
74
75
  def __init__(
75
76
  self: CIEmailField[str],
76
77
  verbose_name: str | bytes | None = ...,
78
+ *,
77
79
  name: str | None = ...,
78
80
  primary_key: bool = ...,
79
81
  max_length: int | None = ...,
80
82
  unique: bool = ...,
81
83
  blank: bool = ...,
82
- null: Literal[False] = ...,
84
+ null: Literal[False] = False,
83
85
  db_index: bool = ...,
84
86
  default: Any = ...,
85
87
  editable: bool = ...,
@@ -99,12 +101,13 @@ class CIEmailField(CIText, EmailField[_C]):
99
101
  def __init__(
100
102
  self: CIEmailField[str | None],
101
103
  verbose_name: str | bytes | None = ...,
104
+ *,
102
105
  name: str | None = ...,
103
106
  primary_key: bool = ...,
104
107
  max_length: int | None = ...,
105
108
  unique: bool = ...,
106
109
  blank: bool = ...,
107
- null: Literal[True] = ...,
110
+ null: Literal[True],
108
111
  db_index: bool = ...,
109
112
  default: Any = ...,
110
113
  editable: bool = ...,
@@ -128,12 +131,13 @@ class CITextField(CIText, TextField[_C]):
128
131
  def __init__(
129
132
  self: CITextField[str],
130
133
  verbose_name: str | bytes | None = ...,
134
+ *,
131
135
  name: str | None = ...,
132
136
  primary_key: bool = ...,
133
137
  max_length: int | None = ...,
134
138
  unique: bool = ...,
135
139
  blank: bool = ...,
136
- null: Literal[False] = ...,
140
+ null: Literal[False] = False,
137
141
  db_index: bool = ...,
138
142
  default: Any = ...,
139
143
  editable: bool = ...,
@@ -153,12 +157,13 @@ class CITextField(CIText, TextField[_C]):
153
157
  def __init__(
154
158
  self: CITextField[str | None],
155
159
  verbose_name: str | bytes | None = ...,
160
+ *,
156
161
  name: str | None = ...,
157
162
  primary_key: bool = ...,
158
163
  max_length: int | None = ...,
159
164
  unique: bool = ...,
160
165
  blank: bool = ...,
161
- null: Literal[True] = ...,
166
+ null: Literal[True],
162
167
  db_index: bool = ...,
163
168
  default: Any = ...,
164
169
  editable: bool = ...,
@@ -1,6 +1,5 @@
1
1
  from collections.abc import Callable, Iterable
2
- from typing import Any, Generic, TypeVar, overload
3
- from typing_extensions import Literal
2
+ from typing import Any, Generic, Literal, TypeVar, overload
4
3
 
5
4
  from django.db.models import Field, Transform
6
5
 
@@ -19,12 +18,13 @@ class HStoreField(Generic[_T], CheckFieldDefaultMixin, Field[Any, Any]):
19
18
  def __init__(
20
19
  self: HStoreField[dict[str, str | None]],
21
20
  verbose_name: str | bytes | None = ...,
21
+ *,
22
22
  name: str | None = ...,
23
23
  primary_key: bool = ...,
24
24
  max_length: int | None = ...,
25
25
  unique: bool = ...,
26
26
  blank: bool = ...,
27
- null: Literal[False] = ...,
27
+ null: Literal[False] = False,
28
28
  db_index: bool = ...,
29
29
  default: Any = ...,
30
30
  editable: bool = ...,
@@ -44,12 +44,13 @@ class HStoreField(Generic[_T], CheckFieldDefaultMixin, Field[Any, Any]):
44
44
  def __init__(
45
45
  self: HStoreField[dict[str, str | None] | None],
46
46
  verbose_name: str | bytes | None = ...,
47
+ *,
47
48
  name: str | None = ...,
48
49
  primary_key: bool = ...,
49
50
  max_length: int | None = ...,
50
51
  unique: bool = ...,
51
52
  blank: bool = ...,
52
- null: Literal[True] = ...,
53
+ null: Literal[True],
53
54
  db_index: bool = ...,
54
55
  default: Any = ...,
55
56
  editable: bool = ...,
@@ -1,6 +1,5 @@
1
1
  from collections.abc import Iterable, Iterator, Mapping
2
- from typing import Any, overload
3
- from typing_extensions import Literal
2
+ from typing import Any, Literal, overload
4
3
 
5
4
  from django.core.checks.messages import CheckMessage
6
5
  from django.core.files.storage import Storage
@@ -1,8 +1,8 @@
1
1
  from typing import Any
2
2
 
3
- from django.core.handlers.wsgi import WSGIRequest
3
+ from django.http.request import HttpRequest
4
4
  from django.http.response import FileResponse
5
5
 
6
6
  def serve(
7
- request: WSGIRequest, path: str, insecure: bool = ..., **kwargs: Any
7
+ request: HttpRequest, path: str, insecure: bool = ..., **kwargs: Any
8
8
  ) -> FileResponse: ...
@@ -1,8 +1,8 @@
1
1
  from typing import Any
2
2
 
3
3
  from django.core.exceptions import ObjectDoesNotExist
4
- from django.core.handlers.wsgi import WSGIRequest
5
4
  from django.db.models.base import Model
5
+ from django.http.request import HttpRequest
6
6
  from django.http.response import HttpResponse
7
7
  from django.utils.feedgenerator import Enclosure, SyndicationFeed
8
8
  from django.utils.safestring import SafeText
@@ -16,7 +16,7 @@ class Feed:
16
16
  title_template: Any = ...
17
17
  description_template: Any = ...
18
18
  def __call__(
19
- self, request: WSGIRequest, *args: Any, **kwargs: Any
19
+ self, request: HttpRequest, *args: Any, **kwargs: Any
20
20
  ) -> HttpResponse: ...
21
21
  def item_title(self, item: Model) -> SafeText: ...
22
22
  def item_description(self, item: Model) -> str: ...
@@ -24,6 +24,6 @@ class Feed:
24
24
  def item_enclosures(self, item: Model) -> list[Enclosure]: ...
25
25
  def feed_extra_kwargs(self, obj: None) -> dict[Any, Any]: ...
26
26
  def item_extra_kwargs(self, item: Model) -> dict[Any, Any]: ...
27
- def get_object(self, request: WSGIRequest, *args: Any, **kwargs: Any) -> None: ...
27
+ def get_object(self, request: HttpRequest, *args: Any, **kwargs: Any) -> None: ...
28
28
  def get_context_data(self, **kwargs: Any) -> dict[str, Any]: ...
29
- def get_feed(self, obj: None, request: WSGIRequest) -> SyndicationFeed: ...
29
+ def get_feed(self, obj: None, request: HttpRequest) -> SyndicationFeed: ...
@@ -61,6 +61,9 @@ class BaseCache:
61
61
  def get_many(
62
62
  self, keys: Iterable[str], version: int | None = ...
63
63
  ) -> dict[str, int | str]: ...
64
+ async def aget_many(
65
+ self, keys: Iterable[str], version: int | None = ...
66
+ ) -> dict[str, int | str]: ...
64
67
  def get_or_set(
65
68
  self,
66
69
  key: str,
@@ -85,6 +88,12 @@ class BaseCache:
85
88
  timeout: int | None = ...,
86
89
  version: int | None = ...,
87
90
  ) -> list[Any]: ...
91
+ async def aset_many(
92
+ self,
93
+ data: dict[str, Any],
94
+ timeout: int | None = ...,
95
+ version: int | None = ...,
96
+ ) -> list[Any]: ...
88
97
  def delete_many(self, keys: Iterable[str], version: int | None = ...) -> None: ...
89
98
  async def adelete_many(
90
99
  self, keys: Iterable[str], version: int | None = ...
@@ -1,8 +1,6 @@
1
1
  from collections.abc import Iterator, Mapping
2
2
  from typing import Any
3
3
 
4
- from django.forms.utils import ErrorDict
5
-
6
4
  class FieldDoesNotExist(Exception): ...
7
5
  class AppRegistryNotReady(Exception): ...
8
6
 
@@ -16,6 +14,7 @@ class SuspiciousFileOperation(SuspiciousOperation): ...
16
14
  class DisallowedHost(SuspiciousOperation): ...
17
15
  class DisallowedRedirect(SuspiciousOperation): ...
18
16
  class TooManyFieldsSent(SuspiciousOperation): ...
17
+ class TooManyFilesSent(SuspiciousOperation): ...
19
18
  class RequestDataTooBig(SuspiciousOperation): ...
20
19
  class RequestAborted(Exception): ...
21
20
  class BadRequest(Exception): ...
@@ -27,15 +26,22 @@ class FieldError(Exception): ...
27
26
 
28
27
  NON_FIELD_ERRORS: str
29
28
 
29
+ ValidationErrorMessageArg = (
30
+ str
31
+ | ValidationError
32
+ | dict[str, ValidationErrorMessageArg]
33
+ | list[ValidationErrorMessageArg]
34
+ )
35
+
30
36
  class ValidationError(Exception):
31
- error_dict: Any = ...
32
- error_list: Any = ...
33
- message: Any = ...
34
- code: Any = ...
35
- params: Any = ...
37
+ error_dict: dict[str, list[ValidationError]] | None
38
+ error_list: list[ValidationError] | None
39
+ message: str | None
40
+ code: str | None
41
+ params: Mapping[str, Any] | None
36
42
  def __init__(
37
43
  self,
38
- message: Any,
44
+ message: ValidationErrorMessageArg,
39
45
  code: str | None = ...,
40
46
  params: Mapping[str, Any] | None = ...,
41
47
  ) -> None: ...
@@ -44,9 +50,10 @@ class ValidationError(Exception):
44
50
  @property
45
51
  def messages(self) -> list[str]: ...
46
52
  def update_error_dict(
47
- self, error_dict: Mapping[str, Any]
48
- ) -> dict[str, list[ValidationError]] | ErrorDict: ...
49
- def __iter__(self) -> Iterator[tuple[str, list[str]] | str]: ...
53
+ self, error_dict: Mapping[str, list[ValidationError]]
54
+ ) -> Mapping[str, list[ValidationError]]: ...
55
+ def __iter__(self) -> Iterator[tuple[str, list[ValidationError]] | str]: ...
50
56
 
51
57
  class EmptyResultSet(Exception): ...
58
+ class FullResultSet(Exception): ...
52
59
  class SynchronousOnlyOperation(Exception): ...
@@ -31,7 +31,7 @@ class File(FileProxyMixin, IO[Any]):
31
31
  def close(self) -> None: ...
32
32
 
33
33
  class ContentFile(File):
34
- file: StringIO
34
+ file: StringIO # pyright: ignore[reportIncompatibleVariableOverride]
35
35
  size: Any = ...
36
36
  def __init__(self, content: bytes | str, name: str | None = ...) -> None: ...
37
37
  def write(self, data: str) -> int: ... # type: ignore[override]
@@ -17,7 +17,7 @@ class Storage:
17
17
  def exists(self, name: str) -> bool: ...
18
18
  def listdir(self, path: str) -> tuple[list[str], list[str]]: ...
19
19
  def size(self, name: str) -> int: ...
20
- def url(self, name: str | None) -> str: ...
20
+ def url(self, name: str) -> str: ...
21
21
  def get_accessed_time(self, name: str) -> datetime: ...
22
22
  def get_created_time(self, name: str) -> datetime: ...
23
23
  def get_modified_time(self, name: str) -> datetime: ...
@@ -44,6 +44,6 @@ class FileSystemStorage(Storage):
44
44
 
45
45
  class DefaultStorage(LazyObject): ...
46
46
 
47
- default_storage: Any
47
+ default_storage: Storage
48
48
 
49
49
  def get_storage_class(import_path: str | None = ...) -> type[Storage]: ...
@@ -25,7 +25,7 @@ def send_mail(
25
25
  html_message: str | None = ...,
26
26
  ) -> int: ...
27
27
  def send_mass_mail(
28
- datatuple: list[tuple[str, str, str, list[str]]],
28
+ datatuple: list[tuple[str, str, str | None, list[str]]],
29
29
  fail_silently: bool = ...,
30
30
  auth_user: str | None = ...,
31
31
  auth_password: str | None = ...,