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,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): ...
@@ -28,14 +27,19 @@ class FieldError(Exception): ...
28
27
  NON_FIELD_ERRORS: str
29
28
 
30
29
  class ValidationError(Exception):
31
- error_dict: Any = ...
32
- error_list: Any = ...
33
- message: Any = ...
34
- code: Any = ...
35
- params: Any = ...
30
+ error_dict: dict[str, list[ValidationError]] | None
31
+ error_list: list[ValidationError] | None
32
+ message: str | None
33
+ code: str | None
34
+ params: Mapping[str, Any] | None
36
35
  def __init__(
37
36
  self,
38
- message: Any,
37
+ message: (
38
+ ValidationError
39
+ | dict[str, ValidationError | list[str]]
40
+ | list[ValidationError | str]
41
+ | str
42
+ ),
39
43
  code: str | None = ...,
40
44
  params: Mapping[str, Any] | None = ...,
41
45
  ) -> None: ...
@@ -44,9 +48,10 @@ class ValidationError(Exception):
44
48
  @property
45
49
  def messages(self) -> list[str]: ...
46
50
  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]: ...
51
+ self, error_dict: Mapping[str, list[ValidationError]]
52
+ ) -> Mapping[str, list[ValidationError]]: ...
53
+ def __iter__(self) -> Iterator[tuple[str, list[ValidationError]] | str]: ...
50
54
 
51
55
  class EmptyResultSet(Exception): ...
56
+ class FullResultSet(Exception): ...
52
57
  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]: ...
@@ -26,15 +26,15 @@ class MIMEMixin: ...
26
26
 
27
27
  class SafeMIMEMessage(MIMEMixin, MIMEMessage):
28
28
  defects: list[Any]
29
- epilogue: None
29
+ epilogue: None # pyright: ignore[reportIncompatibleVariableOverride]
30
30
  policy: Policy # type: ignore [no-any-unimported]
31
- preamble: None
31
+ preamble: None # pyright: ignore[reportIncompatibleVariableOverride]
32
32
 
33
33
  class SafeMIMEText(MIMEMixin, MIMEText):
34
34
  defects: list[Any]
35
- epilogue: None
35
+ epilogue: None # pyright: ignore[reportIncompatibleVariableOverride]
36
36
  policy: Policy # type: ignore [no-any-unimported]
37
- preamble: None
37
+ preamble: None # pyright: ignore[reportIncompatibleVariableOverride]
38
38
  encoding: str = ...
39
39
  def __init__(
40
40
  self, _text: str, _subtype: str = ..., _charset: str = ...
@@ -42,9 +42,9 @@ class SafeMIMEText(MIMEMixin, MIMEText):
42
42
 
43
43
  class SafeMIMEMultipart(MIMEMixin, MIMEMultipart):
44
44
  defects: list[Any]
45
- epilogue: None
45
+ epilogue: None # pyright: ignore[reportIncompatibleVariableOverride]
46
46
  policy: Policy # type: ignore [no-any-unimported]
47
- preamble: None
47
+ preamble: None # pyright: ignore[reportIncompatibleVariableOverride]
48
48
  encoding: str = ...
49
49
  def __init__(
50
50
  self,
@@ -12,6 +12,6 @@ class DjangoJSONEncoder(json.JSONEncoder):
12
12
  allow_nan: bool
13
13
  check_circular: bool
14
14
  ensure_ascii: bool
15
- indent: int
15
+ indent: int # pyright: ignore[reportIncompatibleVariableOverride]
16
16
  skipkeys: bool
17
17
  sort_keys: bool
@@ -28,8 +28,8 @@ class WSGIRequestHandler(simple_server.WSGIRequestHandler):
28
28
  close_connection: bool
29
29
  connection: WSGIRequest
30
30
  request: WSGIRequest
31
- rfile: BytesIO
32
- wfile: BytesIO
31
+ rfile: BytesIO # pyright: ignore[reportIncompatibleVariableOverride]
32
+ wfile: BytesIO # pyright: ignore[reportIncompatibleVariableOverride]
33
33
  protocol_version: str = ...
34
34
  def address_string(self) -> str: ...
35
35
  def log_message(self, format: str, *args: Any) -> None: ...
@@ -15,7 +15,7 @@ class MigrationRecorder:
15
15
  def migration_qs(self) -> QuerySet[Any]: ...
16
16
  def has_table(self) -> bool: ...
17
17
  def ensure_schema(self) -> None: ...
18
- def applied_migrations(self) -> set[tuple[str, str]]: ...
18
+ def applied_migrations(self) -> dict[tuple[str, str], Any]: ...
19
19
  def record_applied(self, app: str, name: str) -> None: ...
20
20
  def record_unapplied(self, app: str, name: str) -> None: ...
21
21
  def flush(self) -> None: ...
@@ -26,7 +26,6 @@ class Model(metaclass=ModelBase):
26
26
  _default_manager: ClassVar[BaseManager[Self]]
27
27
  objects: ClassVar[BaseManager[Self]]
28
28
 
29
- class Meta: ...
30
29
  pk: Any = ...
31
30
  _state: ModelState
32
31
  def __init__(self, *args: Any, **kwargs: Any) -> None: ...
@@ -61,4 +61,5 @@ class UniqueConstraint(BaseConstraint):
61
61
  include: str | Sequence[str] | None = ...,
62
62
  opclasses: Sequence[str] = ...,
63
63
  violation_error_message: str | None = ...,
64
+ nulls_distinct: bool | None = ...,
64
65
  ) -> None: ...
@@ -1,12 +1,16 @@
1
1
  import enum
2
- from typing import Any
2
+ from typing import Any, Sequence, TypeVar
3
+
4
+ _EnumMemberT = TypeVar("_EnumMemberT")
3
5
 
4
6
  class ChoicesMeta(enum.EnumMeta):
5
7
  names: list[str] = ...
6
- choices: list[tuple[Any, str]] = ...
7
8
  labels: list[str] = ...
8
- values: list[Any] = ...
9
9
  def __contains__(self, item: Any) -> bool: ...
10
+ @property
11
+ def values(self: type[_EnumMemberT]) -> Sequence[_EnumMemberT]: ...
12
+ @property
13
+ def choices(self: type[_EnumMemberT]) -> Sequence[tuple[_EnumMemberT, str]]: ...
10
14
 
11
15
  class Choices(enum.Enum, metaclass=ChoicesMeta):
12
16
  def __str__(self) -> Any: ...
@@ -15,24 +19,10 @@ class Choices(enum.Enum, metaclass=ChoicesMeta):
15
19
  @property
16
20
  def value(self) -> Any: ...
17
21
 
18
- # fake
19
- class _IntegerChoicesMeta(ChoicesMeta):
20
- names: list[str] = ...
21
- choices: list[tuple[int, str]] = ...
22
- labels: list[str] = ...
23
- values: list[int] = ...
24
-
25
- class IntegerChoices(int, Choices, metaclass=_IntegerChoicesMeta):
22
+ class IntegerChoices(int, Choices):
26
23
  @property
27
24
  def value(self) -> int: ...
28
25
 
29
- # fake
30
- class _TextChoicesMeta(ChoicesMeta):
31
- names: list[str] = ...
32
- choices: list[tuple[str, str]] = ...
33
- labels: list[str] = ...
34
- values: list[str] = ...
35
-
36
- class TextChoices(str, Choices, metaclass=_TextChoicesMeta):
26
+ class TextChoices(str, Choices):
37
27
  @property
38
28
  def value(self) -> str: ...
@@ -49,7 +49,7 @@ class Combinable:
49
49
  def __radd__(
50
50
  self, other: datetime | _Numeric | Combinable | None
51
51
  ) -> Combinable: ...
52
- def __rsub__(self, other: _Numeric | Combinable) -> Combinable: ...
52
+ def __rsub__(self, other: datetime | _Numeric | Combinable) -> Combinable: ...
53
53
  def __rmul__(self, other: _Numeric | Combinable) -> Combinable: ...
54
54
  def __rtruediv__(self, other: _Numeric | Combinable) -> Combinable: ...
55
55
  def __rmod__(self, other: int | Combinable) -> Combinable: ...