django-types 0.22.0__py3-none-any.whl → 0.23.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.
- django-stubs/apps/config.pyi +3 -2
- django-stubs/conf/global_settings.pyi +9 -9
- django-stubs/conf/urls/__init__.pyi +2 -2
- django-stubs/contrib/admin/checks.pyi +2 -2
- django-stubs/contrib/admin/models.pyi +4 -4
- django-stubs/contrib/admin/options.pyi +21 -13
- django-stubs/contrib/admin/utils.pyi +1 -2
- django-stubs/contrib/admin/views/main.pyi +1 -1
- django-stubs/contrib/auth/backends.pyi +2 -2
- django-stubs/contrib/auth/decorators.pyi +1 -1
- django-stubs/contrib/auth/management/commands/createsuperuser.pyi +1 -1
- django-stubs/contrib/auth/models.pyi +3 -3
- django-stubs/contrib/contenttypes/fields.pyi +1 -1
- django-stubs/contrib/gis/db/models/__init__.pyi +2 -2
- django-stubs/contrib/gis/gdal/srs.pyi +4 -4
- django-stubs/contrib/gis/geos/geometry.pyi +1 -1
- django-stubs/contrib/gis/geos/io.pyi +1 -1
- django-stubs/contrib/postgres/fields/array.pyi +1 -1
- django-stubs/contrib/postgres/fields/citext.pyi +9 -9
- django-stubs/contrib/postgres/fields/hstore.pyi +7 -7
- django-stubs/contrib/postgres/fields/ranges.pyi +6 -6
- django-stubs/contrib/postgres/search.pyi +3 -3
- django-stubs/contrib/sessions/base_session.pyi +1 -1
- django-stubs/contrib/sessions/models.pyi +1 -1
- django-stubs/contrib/sites/models.pyi +1 -1
- django-stubs/core/checks/registry.pyi +2 -2
- django-stubs/core/exceptions.pyi +2 -2
- django-stubs/core/files/base.pyi +1 -1
- django-stubs/core/handlers/wsgi.pyi +3 -3
- django-stubs/core/mail/__init__.pyi +2 -1
- django-stubs/core/mail/backends/base.pyi +1 -1
- django-stubs/core/mail/message.pyi +7 -7
- django-stubs/core/management/__init__.pyi +10 -8
- django-stubs/core/management/base.pyi +49 -33
- django-stubs/core/management/commands/compilemessages.pyi +2 -2
- django-stubs/core/servers/basehttp.pyi +1 -1
- django-stubs/core/validators.pyi +4 -4
- django-stubs/db/backends/base/operations.pyi +2 -2
- django-stubs/db/backends/base/schema.pyi +7 -1
- django-stubs/db/backends/utils.pyi +3 -3
- django-stubs/db/migrations/__init__.pyi +1 -1
- django-stubs/db/migrations/migration.pyi +1 -2
- django-stubs/db/migrations/operations/base.pyi +1 -1
- django-stubs/db/migrations/topological_sort.pyi +1 -1
- django-stubs/db/models/__init__.pyi +3 -1
- django-stubs/db/models/aggregates.pyi +5 -1
- django-stubs/db/models/base.pyi +1 -1
- django-stubs/db/models/constants.pyi +8 -1
- django-stubs/db/models/constraints.pyi +56 -17
- django-stubs/db/models/enums.pyi +3 -1
- django-stubs/db/models/expressions.pyi +7 -7
- django-stubs/db/models/fields/__init__.pyi +28 -25
- django-stubs/db/models/fields/composite.pyi +2 -3
- django-stubs/db/models/fields/files.pyi +3 -1
- django-stubs/db/models/fields/generated.pyi +84 -0
- django-stubs/db/models/fields/json.pyi +3 -1
- django-stubs/db/models/fields/related.pyi +26 -21
- django-stubs/db/models/indexes.pyi +1 -1
- django-stubs/db/models/lookups.pyi +1 -1
- django-stubs/db/models/manager.pyi +1 -1
- django-stubs/db/models/options.pyi +1 -0
- django-stubs/db/models/query.pyi +6 -6
- django-stubs/db/utils.pyi +1 -2
- django-stubs/dispatch/dispatcher.pyi +33 -26
- django-stubs/forms/fields.pyi +4 -4
- django-stubs/forms/models.pyi +4 -4
- django-stubs/forms/renderers.pyi +1 -1
- django-stubs/forms/widgets.pyi +2 -2
- django-stubs/http/request.pyi +4 -3
- django-stubs/http/response.pyi +9 -3
- django-stubs/shortcuts.pyi +17 -32
- django-stubs/template/backends/django.pyi +1 -1
- django-stubs/template/backends/dummy.pyi +1 -1
- django-stubs/template/backends/jinja2.pyi +1 -1
- django-stubs/template/base.pyi +5 -5
- django-stubs/template/context.pyi +9 -3
- django-stubs/template/defaultfilters.pyi +1 -1
- django-stubs/template/engine.pyi +2 -2
- django-stubs/template/library.pyi +1 -1
- django-stubs/template/loader.pyi +2 -4
- django-stubs/template/response.pyi +2 -2
- django-stubs/template/smartif.pyi +2 -2
- django-stubs/test/client.pyi +3 -3
- django-stubs/test/html.pyi +2 -2
- django-stubs/test/signals.pyi +1 -1
- django-stubs/test/testcases.pyi +10 -4
- django-stubs/test/utils.pyi +12 -7
- django-stubs/urls/conf.pyi +2 -2
- django-stubs/utils/archive.pyi +7 -1
- django-stubs/utils/datastructures.pyi +1 -0
- django-stubs/utils/dateformat.pyi +3 -3
- django-stubs/utils/deprecation.pyi +2 -2
- django-stubs/utils/functional.pyi +64 -31
- django-stubs/utils/safestring.pyi +1 -0
- django-stubs/utils/six.pyi +4 -5
- django-stubs/utils/timezone.pyi +7 -7
- django-stubs/utils/topological_sort.pyi +1 -1
- django-stubs/utils/translation/__init__.pyi +15 -6
- django-stubs/utils/tree.pyi +2 -2
- django-stubs/utils/xmlutils.pyi +2 -1
- django-stubs/views/__init__.pyi +2 -0
- django-stubs/views/csrf.pyi +4 -4
- django-stubs/views/debug.pyi +49 -50
- django-stubs/views/decorators/cache.pyi +1 -1
- django-stubs/views/decorators/debug.pyi +3 -1
- django-stubs/views/defaults.pyi +3 -6
- django-stubs/views/generic/dates.pyi +4 -2
- django-stubs/views/i18n.pyi +7 -16
- django-stubs/views/static.pyi +6 -7
- {django_types-0.22.0.dist-info → django_types-0.23.0.dist-info}/METADATA +8 -15
- {django_types-0.22.0.dist-info → django_types-0.23.0.dist-info}/RECORD +186 -185
- {django_types-0.22.0.dist-info → django_types-0.23.0.dist-info}/WHEEL +1 -1
- {django_types-0.22.0.dist-info → django_types-0.23.0.dist-info/licenses}/LICENSE.txt +0 -0
django-stubs/apps/config.pyi
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import types
|
|
1
2
|
from collections.abc import Iterator
|
|
2
3
|
from typing import Any
|
|
3
4
|
|
|
@@ -8,12 +9,12 @@ MODELS_MODULE_NAME: str
|
|
|
8
9
|
|
|
9
10
|
class AppConfig:
|
|
10
11
|
name: str = ...
|
|
11
|
-
module:
|
|
12
|
+
module: types.ModuleType | None = ...
|
|
12
13
|
apps: Apps | None = ...
|
|
13
14
|
label: str = ...
|
|
14
15
|
verbose_name: str = ...
|
|
15
16
|
path: str = ...
|
|
16
|
-
models_module:
|
|
17
|
+
models_module: types.ModuleType | None = ...
|
|
17
18
|
models: dict[str, type[Model]] = ...
|
|
18
19
|
def __init__(self, app_name: str, app_module: Any | None) -> None: ...
|
|
19
20
|
@classmethod
|
|
@@ -8,7 +8,7 @@ from re import Pattern
|
|
|
8
8
|
|
|
9
9
|
# This is defined here as a do-nothing function because we can't import
|
|
10
10
|
# django.utils.translation -- that module depends on the settings.
|
|
11
|
-
from typing import Any, Protocol
|
|
11
|
+
from typing import Any, Protocol, TypeAlias
|
|
12
12
|
|
|
13
13
|
####################
|
|
14
14
|
# CORE #
|
|
@@ -139,7 +139,7 @@ APPEND_SLASH: bool = ...
|
|
|
139
139
|
PREPEND_WWW: bool = ...
|
|
140
140
|
|
|
141
141
|
# Override the server-derived value of SCRIPT_NAME
|
|
142
|
-
FORCE_SCRIPT_NAME = None
|
|
142
|
+
FORCE_SCRIPT_NAME: TypeAlias = None
|
|
143
143
|
|
|
144
144
|
# List of compiled regular expression objects representing User-Agent strings
|
|
145
145
|
# that are not allowed to visit any page, systemwide. Use this for bad
|
|
@@ -213,12 +213,12 @@ FILE_UPLOAD_TEMP_DIR: str | None = ...
|
|
|
213
213
|
|
|
214
214
|
# The numeric mode to set newly-uploaded files to. The value should be a mode
|
|
215
215
|
# you'd pass directly to os.chmod; see https://docs.python.org/library/os.html#files-and-directories.
|
|
216
|
-
FILE_UPLOAD_PERMISSIONS = None
|
|
216
|
+
FILE_UPLOAD_PERMISSIONS: TypeAlias = None
|
|
217
217
|
|
|
218
218
|
# The numeric mode to assign to newly-created directories, when uploading files.
|
|
219
219
|
# The value should be a mode as you'd pass to os.chmod;
|
|
220
220
|
# see https://docs.python.org/library/os.html#files-and-directories.
|
|
221
|
-
FILE_UPLOAD_DIRECTORY_PERMISSIONS = None
|
|
221
|
+
FILE_UPLOAD_DIRECTORY_PERMISSIONS: TypeAlias = None
|
|
222
222
|
|
|
223
223
|
# Python module path where user will place custom format definition.
|
|
224
224
|
# The directory where this setting is pointing should contain subdirectories
|
|
@@ -337,7 +337,7 @@ SESSION_CACHE_ALIAS = "default"
|
|
|
337
337
|
# Cookie name. This can be whatever you want.
|
|
338
338
|
SESSION_COOKIE_NAME = "sessionid"
|
|
339
339
|
# Age of cookie, in seconds (default: 2 weeks).
|
|
340
|
-
SESSION_COOKIE_AGE =
|
|
340
|
+
SESSION_COOKIE_AGE = ...
|
|
341
341
|
# A string like "example.com", or None for standard domain cookie.
|
|
342
342
|
SESSION_COOKIE_DOMAIN: str | None = ...
|
|
343
343
|
# Whether the session cookie should be secure (https:// only).
|
|
@@ -411,8 +411,8 @@ CSRF_FAILURE_VIEW = "django.views.csrf.csrf_failure"
|
|
|
411
411
|
|
|
412
412
|
# Settings for CSRF cookie.
|
|
413
413
|
CSRF_COOKIE_NAME = "csrftoken"
|
|
414
|
-
CSRF_COOKIE_AGE =
|
|
415
|
-
CSRF_COOKIE_DOMAIN = None
|
|
414
|
+
CSRF_COOKIE_AGE = ...
|
|
415
|
+
CSRF_COOKIE_DOMAIN: TypeAlias = None
|
|
416
416
|
CSRF_COOKIE_PATH = "/"
|
|
417
417
|
CSRF_COOKIE_SECURE = False
|
|
418
418
|
CSRF_COOKIE_HTTPONLY = False
|
|
@@ -426,7 +426,7 @@ CSRF_USE_SESSIONS = False
|
|
|
426
426
|
############
|
|
427
427
|
|
|
428
428
|
# Class to use as messages backend
|
|
429
|
-
MESSAGE_STORAGE =
|
|
429
|
+
MESSAGE_STORAGE = ...
|
|
430
430
|
|
|
431
431
|
# Default values of MESSAGE_LEVEL and MESSAGE_TAGS are defined within
|
|
432
432
|
# django.contrib.messages to avoid imports in this settings file.
|
|
@@ -503,5 +503,5 @@ SECURE_HSTS_INCLUDE_SUBDOMAINS = False
|
|
|
503
503
|
SECURE_HSTS_PRELOAD = False
|
|
504
504
|
SECURE_HSTS_SECONDS = 0
|
|
505
505
|
SECURE_REDIRECT_EXEMPT: list[str] = ...
|
|
506
|
-
SECURE_SSL_HOST = None
|
|
506
|
+
SECURE_SSL_HOST: TypeAlias = None
|
|
507
507
|
SECURE_SSL_REDIRECT = False
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Stubs for django.conf.urls (Python 3.5)
|
|
2
2
|
from collections.abc import Callable
|
|
3
|
-
from typing import Any, overload
|
|
3
|
+
from typing import Any, TypeAlias, overload
|
|
4
4
|
|
|
5
5
|
from django.http.response import HttpResponse, HttpResponseBase
|
|
6
6
|
from django.urls import URLPattern, URLResolver
|
|
@@ -10,7 +10,7 @@ handler403: str | Callable[..., HttpResponse] = ...
|
|
|
10
10
|
handler404: str | Callable[..., HttpResponse] = ...
|
|
11
11
|
handler500: str | Callable[..., HttpResponse] = ...
|
|
12
12
|
|
|
13
|
-
IncludedURLConf = tuple[list[URLResolver], str | None, str | None]
|
|
13
|
+
IncludedURLConf: TypeAlias = tuple[list[URLResolver], str | None, str | None]
|
|
14
14
|
|
|
15
15
|
def include(arg: Any, namespace: str = ..., app_name: str = ...) -> IncludedURLConf: ...
|
|
16
16
|
@overload
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
from collections.abc import Sequence
|
|
2
|
-
from typing import Any
|
|
2
|
+
from typing import Any, TypeAlias
|
|
3
3
|
|
|
4
4
|
from django.apps.config import AppConfig
|
|
5
5
|
from django.contrib.admin.options import BaseModelAdmin
|
|
6
6
|
from django.core.checks.messages import CheckMessage, Error
|
|
7
7
|
|
|
8
|
-
_CheckError = str | Error
|
|
8
|
+
_CheckError: TypeAlias = str | Error
|
|
9
9
|
|
|
10
10
|
def check_admin_app(
|
|
11
11
|
app_configs: Sequence[AppConfig] | None = ..., **kwargs: Any
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
from collections.abc import Iterable
|
|
2
|
-
from typing import Any, ClassVar, TypeVar
|
|
3
|
-
from typing_extensions import Self
|
|
2
|
+
from typing import Any, ClassVar, TypeAlias, TypeVar
|
|
4
3
|
|
|
5
4
|
from django.contrib.auth.models import User
|
|
6
5
|
from django.contrib.contenttypes.models import ContentType
|
|
7
6
|
from django.db import models
|
|
8
7
|
from django.utils import timezone as timezone
|
|
8
|
+
from typing_extensions import Self
|
|
9
9
|
|
|
10
10
|
ADDITION: int
|
|
11
11
|
CHANGE: int
|
|
@@ -38,8 +38,8 @@ class LogEntryManager(models.Manager[_LogEntryT]):
|
|
|
38
38
|
|
|
39
39
|
class LogEntry(models.Model):
|
|
40
40
|
action_time = models.DateTimeField()
|
|
41
|
-
user = models.ForeignKey[User]
|
|
42
|
-
content_type = models.ForeignKey[ContentType]
|
|
41
|
+
user: TypeAlias = models.ForeignKey[User]
|
|
42
|
+
content_type: TypeAlias = models.ForeignKey[ContentType]
|
|
43
43
|
object_id = models.TextField(blank=True, null=True)
|
|
44
44
|
object_repr = models.CharField()
|
|
45
45
|
action_flag = models.PositiveSmallIntegerField()
|
|
@@ -1,14 +1,13 @@
|
|
|
1
|
+
import enum
|
|
1
2
|
from collections import OrderedDict
|
|
2
3
|
from collections.abc import Callable, Iterable, Iterator, Mapping, Sequence
|
|
3
|
-
from typing import Any, Generic, Literal, TypeVar
|
|
4
|
-
from typing_extensions import TypedDict
|
|
4
|
+
from typing import Any, Generic, Literal, TypeAlias, TypeVar, cast
|
|
5
5
|
|
|
6
6
|
from django.contrib.admin.filters import ListFilter
|
|
7
7
|
from django.contrib.admin.helpers import ActionForm
|
|
8
8
|
from django.contrib.admin.models import LogEntry
|
|
9
9
|
from django.contrib.admin.sites import AdminSite
|
|
10
10
|
from django.contrib.admin.views.main import ChangeList
|
|
11
|
-
from django.contrib.auth.forms import AdminPasswordChangeForm
|
|
12
11
|
from django.contrib.contenttypes.models import ContentType
|
|
13
12
|
from django.core.checks.messages import CheckMessage
|
|
14
13
|
from django.core.paginator import Paginator
|
|
@@ -38,13 +37,19 @@ from django.http.response import (
|
|
|
38
37
|
from django.template.response import TemplateResponse
|
|
39
38
|
from django.urls.resolvers import URLPattern
|
|
40
39
|
from django.utils.safestring import SafeText
|
|
40
|
+
from typing_extensions import TypedDict
|
|
41
41
|
|
|
42
42
|
IS_POPUP_VAR: str
|
|
43
43
|
TO_FIELD_VAR: str
|
|
44
44
|
HORIZONTAL: Literal[1] = ...
|
|
45
45
|
VERTICAL: Literal[2] = ...
|
|
46
46
|
|
|
47
|
-
_Direction = Literal[1, 2]
|
|
47
|
+
_Direction: TypeAlias = Literal[1, 2]
|
|
48
|
+
|
|
49
|
+
class ShowFacets(enum.Enum):
|
|
50
|
+
NEVER = cast(str, ...)
|
|
51
|
+
ALLOW = cast(str, ...)
|
|
52
|
+
ALWAYS = cast(str, ...)
|
|
48
53
|
|
|
49
54
|
def get_content_type_for_model(obj: type[Model] | Model) -> ContentType: ...
|
|
50
55
|
def get_ul_class(radio_style: int) -> str: ...
|
|
@@ -65,8 +70,8 @@ class _FieldOpts(_OptionalFieldOpts, total=True):
|
|
|
65
70
|
# https://github.com/python/mypy/issues/8921
|
|
66
71
|
# _FieldsetSpec = Sequence[tuple[str | None, _FieldOpts]]
|
|
67
72
|
_T = TypeVar("_T")
|
|
68
|
-
_ListOrTuple = tuple[_T, ...] | list[_T]
|
|
69
|
-
_FieldsetSpec = _ListOrTuple[tuple[str | None, _FieldOpts]]
|
|
73
|
+
_ListOrTuple: TypeAlias = tuple[_T, ...] | list[_T]
|
|
74
|
+
_FieldsetSpec: TypeAlias = _ListOrTuple[tuple[str | None, _FieldOpts]]
|
|
70
75
|
|
|
71
76
|
# Generic type specifically for models, for use in BaseModelAdmin and subclasses
|
|
72
77
|
# https://github.com/typeddjango/django-stubs/issues/482
|
|
@@ -107,7 +112,7 @@ class BaseModelAdmin(Generic[_ModelT]):
|
|
|
107
112
|
self,
|
|
108
113
|
db_field: ManyToManyField[Any, Any],
|
|
109
114
|
request: HttpRequest | None,
|
|
110
|
-
**kwargs: Any
|
|
115
|
+
**kwargs: Any,
|
|
111
116
|
) -> ModelMultipleChoiceField: ...
|
|
112
117
|
def get_autocomplete_fields(self, request: HttpRequest) -> Sequence[str]: ...
|
|
113
118
|
def get_view_on_site_url(self, obj: _ModelT | None = ...) -> str | None: ...
|
|
@@ -172,10 +177,13 @@ class ModelAdmin(BaseModelAdmin[_ModelT]):
|
|
|
172
177
|
delete_selected_confirmation_template: str = ...
|
|
173
178
|
object_history_template: str = ...
|
|
174
179
|
popup_response_template: str = ...
|
|
175
|
-
actions:
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
180
|
+
actions: (
|
|
181
|
+
Sequence[
|
|
182
|
+
Callable[[ModelAdmin[Any], HttpRequest, QuerySet[Any]], HttpResponse | None]
|
|
183
|
+
| str
|
|
184
|
+
]
|
|
185
|
+
| None
|
|
186
|
+
) = ...
|
|
179
187
|
action_form: type[ActionForm] = ...
|
|
180
188
|
actions_on_top: bool = ...
|
|
181
189
|
actions_on_bottom: bool = ...
|
|
@@ -198,7 +206,7 @@ class ModelAdmin(BaseModelAdmin[_ModelT]):
|
|
|
198
206
|
request: HttpRequest,
|
|
199
207
|
obj: _ModelT | None = ...,
|
|
200
208
|
change: bool = ...,
|
|
201
|
-
**kwargs: Any
|
|
209
|
+
**kwargs: Any,
|
|
202
210
|
) -> type[ModelForm]: ...
|
|
203
211
|
def get_changelist(
|
|
204
212
|
self, request: HttpRequest, **kwargs: Any
|
|
@@ -255,7 +263,7 @@ class ModelAdmin(BaseModelAdmin[_ModelT]):
|
|
|
255
263
|
def construct_change_message(
|
|
256
264
|
self,
|
|
257
265
|
request: HttpRequest,
|
|
258
|
-
form:
|
|
266
|
+
form: BaseForm,
|
|
259
267
|
formsets: None,
|
|
260
268
|
add: bool = ...,
|
|
261
269
|
) -> list[dict[str, dict[str, list[str]]]]: ...
|
|
@@ -6,7 +6,6 @@ from uuid import UUID
|
|
|
6
6
|
|
|
7
7
|
from django.contrib.admin.options import BaseModelAdmin
|
|
8
8
|
from django.contrib.admin.sites import AdminSite
|
|
9
|
-
from django.contrib.auth.forms import AdminPasswordChangeForm
|
|
10
9
|
from django.db.models.base import Model
|
|
11
10
|
from django.db.models.deletion import Collector
|
|
12
11
|
from django.db.models.fields import Field, reverse_related
|
|
@@ -74,5 +73,5 @@ def get_model_from_relation(
|
|
|
74
73
|
def reverse_field_path(model: type[Model], path: str) -> tuple[type[Model], str]: ...
|
|
75
74
|
def get_fields_from_path(model: type[Model], path: str) -> list[Field[Any, Any]]: ...
|
|
76
75
|
def construct_change_message(
|
|
77
|
-
form:
|
|
76
|
+
form: BaseForm, formsets: None, add: bool
|
|
78
77
|
) -> list[dict[str, dict[str, list[str]]]]: ...
|
|
@@ -3,7 +3,7 @@ from collections.abc import Callable
|
|
|
3
3
|
from typing import Any
|
|
4
4
|
|
|
5
5
|
from django.contrib.admin.filters import ListFilter, SimpleListFilter
|
|
6
|
-
from django.contrib.admin.options import IS_POPUP_VAR as IS_POPUP_VAR
|
|
6
|
+
from django.contrib.admin.options import IS_POPUP_VAR as IS_POPUP_VAR
|
|
7
7
|
from django.contrib.admin.options import TO_FIELD_VAR as TO_FIELD_VAR
|
|
8
8
|
from django.contrib.admin.options import ModelAdmin
|
|
9
9
|
from django.db.models.base import Model
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
from typing import Any
|
|
1
|
+
from typing import Any, TypeAlias
|
|
2
2
|
|
|
3
3
|
from django.contrib.auth.base_user import AbstractBaseUser
|
|
4
4
|
from django.contrib.auth.models import AnonymousUser, Permission, User
|
|
5
5
|
from django.db.models.base import Model
|
|
6
6
|
from django.http.request import HttpRequest
|
|
7
7
|
|
|
8
|
-
_AnyUser = Model | AnonymousUser
|
|
8
|
+
_AnyUser: TypeAlias = Model | AnonymousUser
|
|
9
9
|
|
|
10
10
|
UserModel: Any
|
|
11
11
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
from collections.abc import Callable
|
|
2
2
|
from typing import TypeVar, overload
|
|
3
3
|
|
|
4
|
-
from django.contrib.auth import REDIRECT_FIELD_NAME as REDIRECT_FIELD_NAME
|
|
4
|
+
from django.contrib.auth import REDIRECT_FIELD_NAME as REDIRECT_FIELD_NAME
|
|
5
5
|
from django.contrib.auth.models import AbstractUser
|
|
6
6
|
from django.http.response import HttpResponseBase
|
|
7
7
|
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
from collections.abc import Iterable
|
|
2
|
-
from typing import Any, ClassVar, Literal, TypeVar
|
|
3
|
-
from typing_extensions import Never, Self
|
|
2
|
+
from typing import Any, ClassVar, Literal, TypeAlias, TypeVar
|
|
4
3
|
|
|
5
4
|
from django.contrib.auth.backends import ModelBackend
|
|
6
5
|
from django.contrib.auth.base_user import AbstractBaseUser as AbstractBaseUser
|
|
@@ -10,8 +9,9 @@ from django.contrib.contenttypes.models import ContentType
|
|
|
10
9
|
from django.db import models
|
|
11
10
|
from django.db.models.base import Model
|
|
12
11
|
from django.db.models.manager import EmptyManager, ManyToManyRelatedManager
|
|
12
|
+
from typing_extensions import Never, Self
|
|
13
13
|
|
|
14
|
-
_AnyUser = AbstractUser | AnonymousUser
|
|
14
|
+
_AnyUser: TypeAlias = AbstractUser | AnonymousUser
|
|
15
15
|
|
|
16
16
|
_T = TypeVar("_T", bound=Model)
|
|
17
17
|
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
from collections.abc import Callable
|
|
2
2
|
from typing import Any
|
|
3
|
-
from typing_extensions import Self
|
|
4
3
|
|
|
5
4
|
from django.contrib.contenttypes.models import ContentType
|
|
6
5
|
from django.core.checks.messages import CheckMessage
|
|
@@ -14,6 +13,7 @@ from django.db.models.fields.reverse_related import ForeignObjectRel
|
|
|
14
13
|
from django.db.models.query import QuerySet
|
|
15
14
|
from django.db.models.query_utils import FilteredRelation, PathInfo
|
|
16
15
|
from django.db.models.sql.where import WhereNode
|
|
16
|
+
from typing_extensions import Self
|
|
17
17
|
|
|
18
18
|
class GenericForeignKey(FieldCacheMixin):
|
|
19
19
|
# django-stubs implementation only fields
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# FIXME: It would be better for typing to add the exact imports it has
|
|
2
2
|
# here instead of "import *"...
|
|
3
3
|
|
|
4
|
-
from django.contrib.gis.db.models.aggregates import *
|
|
4
|
+
from django.contrib.gis.db.models.aggregates import *
|
|
5
5
|
from django.contrib.gis.db.models.fields import (
|
|
6
6
|
GeometryCollectionField as GeometryCollectionField,
|
|
7
7
|
)
|
|
@@ -15,4 +15,4 @@ from django.contrib.gis.db.models.fields import MultiPolygonField as MultiPolygo
|
|
|
15
15
|
from django.contrib.gis.db.models.fields import PointField as PointField
|
|
16
16
|
from django.contrib.gis.db.models.fields import PolygonField as PolygonField
|
|
17
17
|
from django.contrib.gis.db.models.fields import RasterField as RasterField
|
|
18
|
-
from django.db.models import *
|
|
18
|
+
from django.db.models import *
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
from enum import IntEnum
|
|
2
|
-
from typing import Any
|
|
2
|
+
from typing import Any, cast
|
|
3
3
|
|
|
4
|
-
from django.contrib.gis.gdal.base import GDALBase
|
|
4
|
+
from django.contrib.gis.gdal.base import GDALBase
|
|
5
5
|
|
|
6
6
|
class AxisOrder(IntEnum):
|
|
7
|
-
TRADITIONAL
|
|
8
|
-
AUTHORITY
|
|
7
|
+
TRADITIONAL = cast(int, ...)
|
|
8
|
+
AUTHORITY = cast(int, ...)
|
|
9
9
|
|
|
10
10
|
class SpatialReference(GDALBase):
|
|
11
11
|
destructor: Any = ...
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
from typing import Any
|
|
2
2
|
|
|
3
|
-
from django.contrib.gis.geometry import hex_regex as hex_regex
|
|
3
|
+
from django.contrib.gis.geometry import hex_regex as hex_regex
|
|
4
4
|
from django.contrib.gis.geometry import json_regex as json_regex
|
|
5
5
|
from django.contrib.gis.geometry import wkt_regex as wkt_regex
|
|
6
6
|
from django.contrib.gis.geos.base import GEOSBase as GEOSBase
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
from typing import Any
|
|
2
2
|
|
|
3
|
-
from django.contrib.gis.geos.prototypes.io import WKBWriter as WKBWriter
|
|
3
|
+
from django.contrib.gis.geos.prototypes.io import WKBWriter as WKBWriter
|
|
4
4
|
from django.contrib.gis.geos.prototypes.io import WKTWriter as WKTWriter
|
|
5
5
|
from django.contrib.gis.geos.prototypes.io import _WKBReader, _WKTReader
|
|
6
6
|
|
|
@@ -29,7 +29,7 @@ class ArrayField(CheckFieldDefaultMixin, Generic[_V], Field[_V | Combinable, _V]
|
|
|
29
29
|
blank: bool = ...,
|
|
30
30
|
null: Literal[False] = False,
|
|
31
31
|
db_index: bool = ...,
|
|
32
|
-
default: list[_V] | Callable[[], list[_V]]
|
|
32
|
+
default: list[_V] | Callable[[], list[_V]] = ...,
|
|
33
33
|
editable: bool = ...,
|
|
34
34
|
auto_created: bool = ...,
|
|
35
35
|
serialize: bool = ...,
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
from collections.abc import Callable, Iterable
|
|
2
|
-
from typing import Any, Literal, TypeVar, overload
|
|
2
|
+
from typing import Any, Literal, TypeAlias, TypeVar, overload
|
|
3
3
|
|
|
4
4
|
from django.db.models.fields import CharField, EmailField, TextField
|
|
5
5
|
|
|
6
|
-
_Choice = tuple[Any, Any]
|
|
7
|
-
_ChoiceNamedGroup = tuple[str, Iterable[_Choice]]
|
|
8
|
-
_FieldChoices = Iterable[_Choice | _ChoiceNamedGroup]
|
|
6
|
+
_Choice: TypeAlias = tuple[Any, Any]
|
|
7
|
+
_ChoiceNamedGroup: TypeAlias = tuple[str, Iterable[_Choice]]
|
|
8
|
+
_FieldChoices: TypeAlias = Iterable[_Choice | _ChoiceNamedGroup]
|
|
9
9
|
|
|
10
|
-
_ValidatorCallable = Callable[..., None]
|
|
11
|
-
_ErrorMessagesToOverride = dict[str, Any]
|
|
10
|
+
_ValidatorCallable: TypeAlias = Callable[..., None]
|
|
11
|
+
_ErrorMessagesToOverride: TypeAlias = dict[str, Any]
|
|
12
12
|
|
|
13
13
|
_C = TypeVar("_C", bound=str | None)
|
|
14
14
|
|
|
@@ -67,7 +67,7 @@ class CICharField(CIText, CharField[_C]):
|
|
|
67
67
|
validators: Iterable[_ValidatorCallable] = ...,
|
|
68
68
|
error_messages: _ErrorMessagesToOverride | None = ...,
|
|
69
69
|
) -> None: ...
|
|
70
|
-
def __get__(self, instance: Any, owner: Any) -> _C: ...
|
|
70
|
+
def __get__(self, instance: Any, owner: Any) -> _C: ... # type: ignore[override]
|
|
71
71
|
def __set__(self, instance: Any, value: _C) -> None: ... # type: ignore [override]
|
|
72
72
|
|
|
73
73
|
class CIEmailField(CIText, EmailField[_C]):
|
|
@@ -123,7 +123,7 @@ class CIEmailField(CIText, EmailField[_C]):
|
|
|
123
123
|
validators: Iterable[_ValidatorCallable] = ...,
|
|
124
124
|
error_messages: _ErrorMessagesToOverride | None = ...,
|
|
125
125
|
) -> None: ...
|
|
126
|
-
def __get__(self, instance: Any, owner: Any) -> _C: ...
|
|
126
|
+
def __get__(self, instance: Any, owner: Any) -> _C: ... # type: ignore[override]
|
|
127
127
|
def __set__(self, instance: Any, value: _C) -> None: ... # type: ignore [override]
|
|
128
128
|
|
|
129
129
|
class CITextField(CIText, TextField[_C]):
|
|
@@ -179,5 +179,5 @@ class CITextField(CIText, TextField[_C]):
|
|
|
179
179
|
validators: Iterable[_ValidatorCallable] = ...,
|
|
180
180
|
error_messages: _ErrorMessagesToOverride | None = ...,
|
|
181
181
|
) -> None: ...
|
|
182
|
-
def __get__(self, instance: Any, owner: Any) -> _C: ...
|
|
182
|
+
def __get__(self, instance: Any, owner: Any) -> _C: ... # type: ignore[override]
|
|
183
183
|
def __set__(self, instance: Any, value: _C) -> None: ... # type: ignore [override]
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
from collections.abc import Callable, Iterable
|
|
2
|
-
from typing import Any, Generic, Literal, TypeVar, overload
|
|
2
|
+
from typing import Any, Generic, Literal, TypeAlias, TypeVar, overload
|
|
3
3
|
|
|
4
4
|
from django.db.models import Field, Transform
|
|
5
5
|
|
|
6
6
|
from .mixins import CheckFieldDefaultMixin
|
|
7
7
|
|
|
8
|
-
_Choice = tuple[Any, Any]
|
|
9
|
-
_ChoiceNamedGroup = tuple[str, Iterable[_Choice]]
|
|
10
|
-
_FieldChoices = Iterable[_Choice | _ChoiceNamedGroup]
|
|
11
|
-
_ValidatorCallable = Callable[..., None]
|
|
12
|
-
_ErrorMessagesToOverride = dict[str, Any]
|
|
8
|
+
_Choice: TypeAlias = tuple[Any, Any]
|
|
9
|
+
_ChoiceNamedGroup: TypeAlias = tuple[str, Iterable[_Choice]]
|
|
10
|
+
_FieldChoices: TypeAlias = Iterable[_Choice | _ChoiceNamedGroup]
|
|
11
|
+
_ValidatorCallable: TypeAlias = Callable[..., None]
|
|
12
|
+
_ErrorMessagesToOverride: TypeAlias = dict[str, Any]
|
|
13
13
|
|
|
14
14
|
_T = TypeVar("_T", bound=dict[str, str | None] | None)
|
|
15
15
|
|
|
@@ -67,7 +67,7 @@ class HStoreField(Generic[_T], CheckFieldDefaultMixin, Field[Any, Any]):
|
|
|
67
67
|
error_messages: _ErrorMessagesToOverride | None = ...,
|
|
68
68
|
) -> None: ...
|
|
69
69
|
def get_transform(self, name: Any) -> Any: ...
|
|
70
|
-
def __get__(self, instance: Any, owner: Any) -> _T: ...
|
|
70
|
+
def __get__(self, instance: Any, owner: Any) -> _T: ... # type: ignore[override]
|
|
71
71
|
def __set__(self, instance: Any, value: _T) -> None: ...
|
|
72
72
|
|
|
73
73
|
class KeyTransform(Transform):
|
|
@@ -12,22 +12,22 @@ class RangeField(models.Field[Any, Any]):
|
|
|
12
12
|
def value_to_string(self, obj: Any) -> Any: ...
|
|
13
13
|
|
|
14
14
|
class IntegerRangeField(RangeField):
|
|
15
|
-
def __get__(self, instance: Any, owner: Any) -> NumericRange: ...
|
|
15
|
+
def __get__(self, instance: Any, owner: Any) -> NumericRange: ... # type: ignore[override]
|
|
16
16
|
|
|
17
17
|
class BigIntegerRangeField(RangeField):
|
|
18
|
-
def __get__(self, instance: Any, owner: Any) -> NumericRange: ...
|
|
18
|
+
def __get__(self, instance: Any, owner: Any) -> NumericRange: ... # type: ignore[override]
|
|
19
19
|
|
|
20
20
|
class DecimalRangeField(RangeField):
|
|
21
|
-
def __get__(self, instance: Any, owner: Any) -> NumericRange: ...
|
|
21
|
+
def __get__(self, instance: Any, owner: Any) -> NumericRange: ... # type: ignore[override]
|
|
22
22
|
|
|
23
23
|
class FloatRangeField(RangeField):
|
|
24
|
-
def __get__(self, instance: Any, owner: Any) -> NumericRange: ...
|
|
24
|
+
def __get__(self, instance: Any, owner: Any) -> NumericRange: ... # type: ignore[override]
|
|
25
25
|
|
|
26
26
|
class DateTimeRangeField(RangeField):
|
|
27
|
-
def __get__(self, instance: Any, owner: Any) -> DateTimeTZRange: ...
|
|
27
|
+
def __get__(self, instance: Any, owner: Any) -> DateTimeTZRange: ... # type: ignore[override]
|
|
28
28
|
|
|
29
29
|
class DateRangeField(RangeField):
|
|
30
|
-
def __get__(self, instance: Any, owner: Any) -> DateRange: ...
|
|
30
|
+
def __get__(self, instance: Any, owner: Any) -> DateRange: ... # type: ignore[override]
|
|
31
31
|
|
|
32
32
|
class RangeOperators:
|
|
33
33
|
EQUAL: str
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
from collections.abc import Iterable
|
|
2
|
-
from typing import Any
|
|
3
|
-
from typing_extensions import Self
|
|
2
|
+
from typing import Any, TypeAlias
|
|
4
3
|
|
|
5
4
|
from django.db.models import Field
|
|
6
5
|
from django.db.models.expressions import (
|
|
@@ -16,8 +15,9 @@ from django.db.models.fields import (
|
|
|
16
15
|
_ValidatorCallable,
|
|
17
16
|
)
|
|
18
17
|
from django.db.models.lookups import Lookup
|
|
18
|
+
from typing_extensions import Self
|
|
19
19
|
|
|
20
|
-
_Expression = str | Combinable | SearchQueryCombinable
|
|
20
|
+
_Expression: TypeAlias = str | Combinable | SearchQueryCombinable
|
|
21
21
|
|
|
22
22
|
class SearchVectorExact(Lookup[Any]): ...
|
|
23
23
|
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
from datetime import datetime
|
|
2
2
|
from typing import ClassVar, TypeVar
|
|
3
|
-
from typing_extensions import Self
|
|
4
3
|
|
|
5
4
|
from django.contrib.sessions.backends.base import SessionBase
|
|
6
5
|
from django.db import models
|
|
6
|
+
from typing_extensions import Self
|
|
7
7
|
|
|
8
8
|
_SessionT = TypeVar("_SessionT", bound=AbstractBaseSession)
|
|
9
9
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
from typing import ClassVar, TypeVar
|
|
2
|
-
from typing_extensions import Self
|
|
3
2
|
|
|
4
3
|
from django.contrib.sessions.backends.db import SessionStore
|
|
5
4
|
from django.contrib.sessions.base_session import AbstractBaseSession, BaseSessionManager
|
|
5
|
+
from typing_extensions import Self
|
|
6
6
|
|
|
7
7
|
_T = TypeVar("_T", bound=AbstractBaseSession)
|
|
8
8
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
from collections.abc import Callable
|
|
2
|
-
from typing import Any
|
|
2
|
+
from typing import Any, TypeAlias
|
|
3
3
|
|
|
4
4
|
from django.apps.config import AppConfig
|
|
5
5
|
from django.core.checks.messages import CheckMessage
|
|
@@ -16,7 +16,7 @@ class Tags:
|
|
|
16
16
|
translation: str = ...
|
|
17
17
|
urls: str = ...
|
|
18
18
|
|
|
19
|
-
_CheckCallable = Callable[..., list[CheckMessage]]
|
|
19
|
+
_CheckCallable: TypeAlias = Callable[..., list[CheckMessage]]
|
|
20
20
|
|
|
21
21
|
class CheckRegistry:
|
|
22
22
|
registered_checks: set[Callable[..., Any]] = ...
|
django-stubs/core/exceptions.pyi
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
from collections.abc import Iterator, Mapping
|
|
2
|
-
from typing import Any
|
|
2
|
+
from typing import Any, TypeAlias
|
|
3
3
|
|
|
4
4
|
class FieldDoesNotExist(Exception): ...
|
|
5
5
|
class AppRegistryNotReady(Exception): ...
|
|
@@ -26,7 +26,7 @@ class FieldError(Exception): ...
|
|
|
26
26
|
|
|
27
27
|
NON_FIELD_ERRORS: str
|
|
28
28
|
|
|
29
|
-
ValidationErrorMessageArg = (
|
|
29
|
+
ValidationErrorMessageArg: TypeAlias = (
|
|
30
30
|
str
|
|
31
31
|
| ValidationError
|
|
32
32
|
| dict[str, ValidationErrorMessageArg]
|
django-stubs/core/files/base.pyi
CHANGED
|
@@ -2,9 +2,9 @@ import types
|
|
|
2
2
|
from collections.abc import Iterator
|
|
3
3
|
from io import StringIO
|
|
4
4
|
from typing import IO, Any
|
|
5
|
-
from typing_extensions import Self
|
|
6
5
|
|
|
7
6
|
from django.core.files.utils import FileProxyMixin
|
|
7
|
+
from typing_extensions import Self
|
|
8
8
|
|
|
9
9
|
class File(FileProxyMixin, IO[Any]):
|
|
10
10
|
DEFAULT_CHUNK_SIZE: Any = ...
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
from collections.abc import Callable
|
|
2
2
|
from io import BytesIO
|
|
3
|
-
from typing import Any
|
|
3
|
+
from typing import Any, TypeAlias
|
|
4
4
|
|
|
5
5
|
from django.contrib.sessions.backends.base import SessionBase
|
|
6
6
|
from django.core.handlers import base
|
|
7
7
|
from django.http import HttpRequest
|
|
8
8
|
from django.http.response import HttpResponse
|
|
9
9
|
|
|
10
|
-
_Stream = BytesIO | str
|
|
11
|
-
_WSGIEnviron = dict[str, Any]
|
|
10
|
+
_Stream: TypeAlias = BytesIO | str
|
|
11
|
+
_WSGIEnviron: TypeAlias = dict[str, Any]
|
|
12
12
|
|
|
13
13
|
class LimitedStream:
|
|
14
14
|
stream: _Stream = ...
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
from collections.abc import Sequence
|
|
1
2
|
from typing import Any
|
|
2
3
|
|
|
3
4
|
from .message import DEFAULT_ATTACHMENT_MIME_TYPE as DEFAULT_ATTACHMENT_MIME_TYPE
|
|
@@ -25,7 +26,7 @@ def send_mail(
|
|
|
25
26
|
html_message: str | None = ...,
|
|
26
27
|
) -> int: ...
|
|
27
28
|
def send_mass_mail(
|
|
28
|
-
datatuple:
|
|
29
|
+
datatuple: Sequence[tuple[str, str, str | None, Sequence[str]]],
|
|
29
30
|
fail_silently: bool = ...,
|
|
30
31
|
auth_user: str | None = ...,
|
|
31
32
|
auth_password: str | None = ...,
|