django-types 0.21.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 +41 -16
- django-stubs/db/migrations/topological_sort.pyi +1 -1
- django-stubs/db/models/__init__.pyi +3 -0
- 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 +73 -0
- 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 +41 -17
- 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/connection.pyi +38 -0
- 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.21.0.dist-info → django_types-0.23.0.dist-info}/METADATA +8 -15
- {django_types-0.21.0.dist-info → django_types-0.23.0.dist-info}/RECORD +187 -184
- {django_types-0.21.0.dist-info → django_types-0.23.0.dist-info}/WHEEL +1 -1
- {django_types-0.21.0.dist-info → django_types-0.23.0.dist-info/licenses}/LICENSE.txt +0 -0
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
from collections.abc import Sequence
|
|
2
|
-
from email._policybase import Policy
|
|
2
|
+
from email._policybase import Policy
|
|
3
3
|
from email.message import Message
|
|
4
4
|
from email.mime.base import MIMEBase
|
|
5
5
|
from email.mime.message import MIMEMessage
|
|
6
6
|
from email.mime.multipart import MIMEMultipart
|
|
7
7
|
from email.mime.text import MIMEText
|
|
8
|
-
from typing import Any, overload
|
|
8
|
+
from typing import Any, TypeAlias, overload
|
|
9
9
|
|
|
10
10
|
utf8_charset: Any
|
|
11
11
|
utf8_charset_qp: Any
|
|
@@ -27,13 +27,13 @@ class MIMEMixin: ...
|
|
|
27
27
|
class SafeMIMEMessage(MIMEMixin, MIMEMessage):
|
|
28
28
|
defects: list[Any]
|
|
29
29
|
epilogue: None # pyright: ignore[reportIncompatibleVariableOverride]
|
|
30
|
-
policy: Policy
|
|
30
|
+
policy: Policy
|
|
31
31
|
preamble: None # pyright: ignore[reportIncompatibleVariableOverride]
|
|
32
32
|
|
|
33
33
|
class SafeMIMEText(MIMEMixin, MIMEText):
|
|
34
34
|
defects: list[Any]
|
|
35
35
|
epilogue: None # pyright: ignore[reportIncompatibleVariableOverride]
|
|
36
|
-
policy: Policy
|
|
36
|
+
policy: Policy
|
|
37
37
|
preamble: None # pyright: ignore[reportIncompatibleVariableOverride]
|
|
38
38
|
encoding: str = ...
|
|
39
39
|
def __init__(
|
|
@@ -43,7 +43,7 @@ class SafeMIMEText(MIMEMixin, MIMEText):
|
|
|
43
43
|
class SafeMIMEMultipart(MIMEMixin, MIMEMultipart):
|
|
44
44
|
defects: list[Any]
|
|
45
45
|
epilogue: None # pyright: ignore[reportIncompatibleVariableOverride]
|
|
46
|
-
policy: Policy
|
|
46
|
+
policy: Policy
|
|
47
47
|
preamble: None # pyright: ignore[reportIncompatibleVariableOverride]
|
|
48
48
|
encoding: str = ...
|
|
49
49
|
def __init__(
|
|
@@ -55,8 +55,8 @@ class SafeMIMEMultipart(MIMEMixin, MIMEMultipart):
|
|
|
55
55
|
**_params: Any
|
|
56
56
|
) -> None: ...
|
|
57
57
|
|
|
58
|
-
_AttachmentContent = bytes | EmailMessage | Message | SafeMIMEText | str
|
|
59
|
-
_AttachmentTuple = (
|
|
58
|
+
_AttachmentContent: TypeAlias = bytes | EmailMessage | Message | SafeMIMEText | str
|
|
59
|
+
_AttachmentTuple: TypeAlias = (
|
|
60
60
|
tuple[str, _AttachmentContent]
|
|
61
61
|
| tuple[str | None, _AttachmentContent, str]
|
|
62
62
|
| tuple[str, _AttachmentContent, None]
|
|
@@ -2,22 +2,24 @@ from typing import Any
|
|
|
2
2
|
|
|
3
3
|
from .base import BaseCommand as BaseCommand
|
|
4
4
|
from .base import CommandError as CommandError
|
|
5
|
+
from .base import CommandParser as CommandParser
|
|
6
|
+
from .base import handle_default_options as handle_default_options
|
|
5
7
|
|
|
6
8
|
def find_commands(management_dir: str) -> list[str]: ...
|
|
7
9
|
def load_command_class(app_name: str, name: str) -> BaseCommand: ...
|
|
8
10
|
def get_commands() -> dict[str, str]: ...
|
|
9
11
|
def call_command(
|
|
10
|
-
command_name:
|
|
11
|
-
) -> str: ...
|
|
12
|
+
command_name: str | BaseCommand, *args: Any, **options: Any
|
|
13
|
+
) -> str | None: ...
|
|
12
14
|
|
|
13
15
|
class ManagementUtility:
|
|
14
|
-
argv: list[str]
|
|
15
|
-
prog_name: str
|
|
16
|
-
settings_exception: None
|
|
17
|
-
def __init__(self, argv: list[str] = ...) -> None: ...
|
|
18
|
-
def main_help_text(self, commands_only: bool = ...) ->
|
|
16
|
+
argv: list[str]
|
|
17
|
+
prog_name: str
|
|
18
|
+
settings_exception: None
|
|
19
|
+
def __init__(self, argv: list[str] | None = ...) -> None: ...
|
|
20
|
+
def main_help_text(self, commands_only: bool = ...) -> str: ...
|
|
19
21
|
def fetch_command(self, subcommand: str) -> BaseCommand: ...
|
|
20
22
|
def autocomplete(self) -> None: ...
|
|
21
23
|
def execute(self) -> None: ...
|
|
22
24
|
|
|
23
|
-
def execute_from_command_line(argv: list[str] = ...) -> None: ...
|
|
25
|
+
def execute_from_command_line(argv: list[str] | None = ...) -> None: ...
|
|
@@ -1,60 +1,69 @@
|
|
|
1
1
|
from argparse import ArgumentParser, HelpFormatter, Namespace
|
|
2
|
-
from collections.abc import Callable
|
|
3
|
-
from
|
|
4
|
-
from typing import Any
|
|
2
|
+
from collections.abc import Callable, Sequence
|
|
3
|
+
from typing import Any, NoReturn, TextIO
|
|
5
4
|
|
|
6
5
|
from django.apps.config import AppConfig
|
|
7
6
|
from django.core.management.color import Style
|
|
8
7
|
|
|
9
|
-
class CommandError(Exception):
|
|
8
|
+
class CommandError(Exception):
|
|
9
|
+
returncode: int
|
|
10
|
+
def __init__(self, *args: Any, returncode: int = ..., **kwargs: Any) -> None: ...
|
|
11
|
+
|
|
10
12
|
class SystemCheckError(CommandError): ...
|
|
11
13
|
|
|
12
14
|
class CommandParser(ArgumentParser):
|
|
13
|
-
missing_args_message:
|
|
14
|
-
called_from_command_line: bool
|
|
15
|
-
def __init__(
|
|
16
|
-
|
|
15
|
+
missing_args_message: str | None
|
|
16
|
+
called_from_command_line: bool | None
|
|
17
|
+
def __init__(
|
|
18
|
+
self,
|
|
19
|
+
*,
|
|
20
|
+
missing_args_message: str | None = None,
|
|
21
|
+
called_from_command_line: bool | None = ...,
|
|
22
|
+
**kwargs: Any,
|
|
23
|
+
) -> None: ...
|
|
24
|
+
def error(self, message: str) -> NoReturn: ...
|
|
17
25
|
|
|
18
26
|
def handle_default_options(options: Namespace) -> None: ...
|
|
19
27
|
def no_translations(handle_func: Callable[..., Any]) -> Callable[..., Any]: ...
|
|
20
28
|
|
|
21
29
|
class DjangoHelpFormatter(HelpFormatter): ...
|
|
22
30
|
|
|
23
|
-
class OutputWrapper
|
|
31
|
+
class OutputWrapper:
|
|
24
32
|
@property
|
|
25
|
-
def style_func(self) ->
|
|
33
|
+
def style_func(self) -> Callable[[str], str]: ...
|
|
26
34
|
@style_func.setter
|
|
27
|
-
def style_func(self, style_func: Callable[[str], str]) ->
|
|
35
|
+
def style_func(self, style_func: Callable[[str], str]) -> None: ...
|
|
28
36
|
ending: str = ...
|
|
29
37
|
def __init__(
|
|
30
38
|
self,
|
|
31
|
-
out:
|
|
32
|
-
style_func: Callable[[str], str] | None = ...,
|
|
39
|
+
out: TextIO,
|
|
33
40
|
ending: str = ...,
|
|
34
41
|
) -> None: ...
|
|
35
|
-
def __getattr__(self, name: str) ->
|
|
42
|
+
def __getattr__(self, name: str) -> Any: ...
|
|
43
|
+
def flush(self) -> None: ...
|
|
36
44
|
def isatty(self) -> bool: ...
|
|
37
|
-
def write(
|
|
45
|
+
def write(
|
|
38
46
|
self,
|
|
39
|
-
msg: str
|
|
47
|
+
msg: str = ...,
|
|
40
48
|
style_func: Callable[[str], str] | None = ...,
|
|
41
49
|
ending: str | None = ...,
|
|
42
50
|
) -> None: ...
|
|
43
51
|
|
|
44
52
|
class BaseCommand:
|
|
45
|
-
help: str
|
|
46
|
-
output_transaction: bool
|
|
47
|
-
requires_migrations_checks: bool
|
|
48
|
-
requires_system_checks:
|
|
49
|
-
base_stealth_options: tuple[str, ...]
|
|
50
|
-
stealth_options: tuple[str, ...]
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
53
|
+
help: str
|
|
54
|
+
output_transaction: bool
|
|
55
|
+
requires_migrations_checks: bool
|
|
56
|
+
requires_system_checks: str
|
|
57
|
+
base_stealth_options: tuple[str, ...]
|
|
58
|
+
stealth_options: tuple[str, ...]
|
|
59
|
+
suppressed_base_arguments: set[str]
|
|
60
|
+
stdout: OutputWrapper
|
|
61
|
+
stderr: OutputWrapper
|
|
62
|
+
style: Style
|
|
54
63
|
def __init__(
|
|
55
64
|
self,
|
|
56
|
-
stdout:
|
|
57
|
-
stderr:
|
|
65
|
+
stdout: TextIO | None = ...,
|
|
66
|
+
stderr: TextIO | None = ...,
|
|
58
67
|
no_color: bool = ...,
|
|
59
68
|
force_color: bool = ...,
|
|
60
69
|
) -> None: ...
|
|
@@ -63,9 +72,13 @@ class BaseCommand:
|
|
|
63
72
|
self, prog_name: str, subcommand: str, **kwargs: Any
|
|
64
73
|
) -> CommandParser: ...
|
|
65
74
|
def add_arguments(self, parser: CommandParser) -> None: ...
|
|
75
|
+
def add_base_argument(
|
|
76
|
+
self, parser: CommandParser, *args: Any, **kwargs: Any
|
|
77
|
+
) -> None: ...
|
|
66
78
|
def print_help(self, prog_name: str, subcommand: str) -> None: ...
|
|
67
|
-
def run_from_argv(self, argv:
|
|
79
|
+
def run_from_argv(self, argv: Sequence[str]) -> None: ...
|
|
68
80
|
def execute(self, *args: Any, **options: Any) -> Any: ...
|
|
81
|
+
def get_check_kwargs(self, options: dict[str, Any]) -> dict[str, Any]: ...
|
|
69
82
|
def check(
|
|
70
83
|
self,
|
|
71
84
|
app_configs: list[AppConfig] | None = ...,
|
|
@@ -73,15 +86,18 @@ class BaseCommand:
|
|
|
73
86
|
display_num_errors: bool = ...,
|
|
74
87
|
include_deployment_checks: bool = ...,
|
|
75
88
|
fail_level: int = ...,
|
|
89
|
+
databases: list[str] | None = None,
|
|
76
90
|
) -> None: ...
|
|
77
91
|
def check_migrations(self) -> None: ...
|
|
78
92
|
def handle(self, *args: Any, **options: Any) -> str | None: ...
|
|
79
93
|
|
|
80
94
|
class AppCommand(BaseCommand):
|
|
81
|
-
missing_args_message: str
|
|
82
|
-
def
|
|
95
|
+
missing_args_message: str
|
|
96
|
+
def handle(self, *app_labels: str, **options: Any) -> str: ...
|
|
97
|
+
def handle_app_config(self, app_config: AppConfig, **options: Any) -> str: ...
|
|
83
98
|
|
|
84
99
|
class LabelCommand(BaseCommand):
|
|
85
|
-
label: str
|
|
86
|
-
missing_args_message:
|
|
87
|
-
def
|
|
100
|
+
label: str
|
|
101
|
+
missing_args_message: str
|
|
102
|
+
def handle(self, *labels: str, **options: Any) -> str: ...
|
|
103
|
+
def handle_label(self, label: str, **options: Any) -> str: ...
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import os
|
|
2
|
-
from typing import Any
|
|
2
|
+
from typing import Any, TypeAlias
|
|
3
3
|
|
|
4
4
|
from django.core.management.base import BaseCommand as BaseCommand
|
|
5
5
|
from django.core.management.base import CommandError as CommandError
|
|
@@ -7,7 +7,7 @@ from django.core.management.base import CommandParser as CommandParser
|
|
|
7
7
|
from django.core.management.utils import find_command as find_command
|
|
8
8
|
from django.core.management.utils import popen_wrapper as popen_wrapper
|
|
9
9
|
|
|
10
|
-
_PathType = str | bytes | os.PathLike[Any]
|
|
10
|
+
_PathType: TypeAlias = str | bytes | os.PathLike[Any]
|
|
11
11
|
|
|
12
12
|
def has_bom(fn: _PathType) -> bool: ...
|
|
13
13
|
def is_writable(path: _PathType) -> bool: ...
|
|
@@ -4,7 +4,7 @@ from typing import Any
|
|
|
4
4
|
from wsgiref import simple_server
|
|
5
5
|
|
|
6
6
|
from django.core.handlers.wsgi import WSGIHandler, WSGIRequest
|
|
7
|
-
from django.core.wsgi import get_wsgi_application as get_wsgi_application
|
|
7
|
+
from django.core.wsgi import get_wsgi_application as get_wsgi_application
|
|
8
8
|
|
|
9
9
|
class WSGIServer(simple_server.WSGIServer):
|
|
10
10
|
request_queue_size: int = ...
|
django-stubs/core/validators.pyi
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
from collections.abc import Callable, Collection
|
|
2
2
|
from decimal import Decimal
|
|
3
3
|
from re import Pattern, RegexFlag
|
|
4
|
-
from typing import Any
|
|
4
|
+
from typing import Any, TypeAlias
|
|
5
5
|
|
|
6
6
|
from django.core.files.base import File
|
|
7
7
|
|
|
8
8
|
EMPTY_VALUES: Any
|
|
9
9
|
|
|
10
|
-
_Regex = str | Pattern[str]
|
|
11
|
-
_ErrorMessage = str | Any
|
|
10
|
+
_Regex: TypeAlias = str | Pattern[str]
|
|
11
|
+
_ErrorMessage: TypeAlias = str | Any
|
|
12
12
|
|
|
13
13
|
def _lazy_re_compile(regex: _Regex, flags: int = ...) -> Any: ...
|
|
14
14
|
|
|
@@ -71,7 +71,7 @@ def validate_ipv4_address(value: str) -> None: ...
|
|
|
71
71
|
def validate_ipv6_address(value: str) -> None: ...
|
|
72
72
|
def validate_ipv46_address(value: str) -> None: ...
|
|
73
73
|
|
|
74
|
-
_IPValidator = tuple[Callable[[Any], None], str]
|
|
74
|
+
_IPValidator: TypeAlias = tuple[Callable[[Any], None], str]
|
|
75
75
|
ip_address_validator_map: dict[str, _IPValidator]
|
|
76
76
|
|
|
77
77
|
def ip_address_validators(protocol: str, unpack_ipv4: bool) -> _IPValidator: ...
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
from collections.abc import Sequence
|
|
2
2
|
from datetime import date, datetime, time, timedelta
|
|
3
3
|
from decimal import Decimal
|
|
4
|
-
from typing import Any
|
|
4
|
+
from typing import Any, TypeAlias
|
|
5
5
|
|
|
6
6
|
from django.core.management.color import Style
|
|
7
7
|
from django.db import DefaultConnectionProxy
|
|
@@ -12,7 +12,7 @@ from django.db.models.expressions import Case, Expression
|
|
|
12
12
|
from django.db.models.fields import Field
|
|
13
13
|
from django.db.models.sql.compiler import SQLCompiler
|
|
14
14
|
|
|
15
|
-
_Connection = DefaultConnectionProxy | BaseDatabaseWrapper
|
|
15
|
+
_Connection: TypeAlias = DefaultConnectionProxy | BaseDatabaseWrapper
|
|
16
16
|
|
|
17
17
|
class BaseDatabaseOperations:
|
|
18
18
|
compiler_module: str = ...
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
from collections.abc import Sequence
|
|
2
2
|
from contextlib import AbstractContextManager
|
|
3
|
+
from types import TracebackType
|
|
3
4
|
from typing import Any
|
|
4
5
|
|
|
5
6
|
from django.db.backends.ddl_references import Statement
|
|
@@ -46,7 +47,12 @@ class BaseDatabaseSchemaEditor(AbstractContextManager[Any]):
|
|
|
46
47
|
deferred_sql: Any = ...
|
|
47
48
|
atomic: Any = ...
|
|
48
49
|
def __enter__(self) -> BaseDatabaseSchemaEditor: ...
|
|
49
|
-
def __exit__(
|
|
50
|
+
def __exit__(
|
|
51
|
+
self,
|
|
52
|
+
exc_type: type[BaseException] | None,
|
|
53
|
+
exc_value: BaseException | None,
|
|
54
|
+
traceback: TracebackType | None,
|
|
55
|
+
) -> None: ...
|
|
50
56
|
def execute(
|
|
51
57
|
self,
|
|
52
58
|
sql: Statement | str,
|
|
@@ -2,7 +2,7 @@ import types
|
|
|
2
2
|
from collections.abc import Iterable, Iterator, Mapping, Sequence
|
|
3
3
|
from datetime import date, datetime, time
|
|
4
4
|
from decimal import Decimal
|
|
5
|
-
from typing import IO, Any, Literal
|
|
5
|
+
from typing import IO, Any, Literal, TypeAlias
|
|
6
6
|
from uuid import UUID
|
|
7
7
|
|
|
8
8
|
import psycopg2.extensions
|
|
@@ -12,8 +12,8 @@ from psycopg2.extensions import Column
|
|
|
12
12
|
logger: Any
|
|
13
13
|
|
|
14
14
|
# Python types that can be adapted to SQL.
|
|
15
|
-
_Mixed = None | bool | int | float | Decimal | str | bytes | datetime | UUID
|
|
16
|
-
_SQLType = _Mixed | Sequence[_Mixed] | Mapping[str, _Mixed]
|
|
15
|
+
_Mixed: TypeAlias = None | bool | int | float | Decimal | str | bytes | datetime | UUID
|
|
16
|
+
_SQLType: TypeAlias = _Mixed | Sequence[_Mixed] | Mapping[str, _Mixed]
|
|
17
17
|
|
|
18
18
|
class CursorWrapper:
|
|
19
19
|
cursor: psycopg2.extensions.cursor = ...
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
from typing_extensions import Self
|
|
2
|
-
|
|
3
1
|
from django.db.backends.base.schema import BaseDatabaseSchemaEditor
|
|
4
2
|
from django.db.migrations.operations.base import Operation
|
|
5
3
|
from django.db.migrations.state import ProjectState
|
|
4
|
+
from typing_extensions import Self
|
|
6
5
|
|
|
7
6
|
class Migration:
|
|
8
7
|
operations: list[Operation] = ...
|
|
@@ -1,25 +1,50 @@
|
|
|
1
|
+
import enum
|
|
2
|
+
from collections.abc import Sequence
|
|
1
3
|
from typing import Any
|
|
2
4
|
|
|
5
|
+
from django.db.backends.base.schema import BaseDatabaseSchemaEditor
|
|
6
|
+
from django.db.migrations.state import ProjectState
|
|
7
|
+
from django.db.models import Model
|
|
8
|
+
from typing_extensions import Self
|
|
9
|
+
|
|
10
|
+
class OperationCategory(str, enum.Enum):
|
|
11
|
+
ADDITION = "+"
|
|
12
|
+
REMOVAL = "-"
|
|
13
|
+
ALTERATION = "~"
|
|
14
|
+
PYTHON = "p"
|
|
15
|
+
SQL = "s"
|
|
16
|
+
MIXED = "?"
|
|
17
|
+
|
|
3
18
|
class Operation:
|
|
4
|
-
reversible: bool
|
|
5
|
-
reduces_to_sql: bool
|
|
6
|
-
atomic: bool
|
|
7
|
-
elidable: bool
|
|
8
|
-
serialization_expand_args: Any
|
|
9
|
-
|
|
10
|
-
def
|
|
19
|
+
reversible: bool
|
|
20
|
+
reduces_to_sql: bool
|
|
21
|
+
atomic: bool
|
|
22
|
+
elidable: bool
|
|
23
|
+
serialization_expand_args: list[Any]
|
|
24
|
+
category: OperationCategory | None
|
|
25
|
+
def __new__(cls, *args: Any, **kwargs: Any) -> Self: ...
|
|
26
|
+
def deconstruct(self) -> tuple[str, Sequence[Any], dict[str, Any]]: ...
|
|
27
|
+
def state_forwards(self, app_label: str, state: ProjectState) -> None: ...
|
|
11
28
|
def database_forwards(
|
|
12
|
-
self,
|
|
29
|
+
self,
|
|
30
|
+
app_label: str,
|
|
31
|
+
schema_editor: BaseDatabaseSchemaEditor,
|
|
32
|
+
from_state: ProjectState,
|
|
33
|
+
to_state: ProjectState,
|
|
13
34
|
) -> None: ...
|
|
14
35
|
def database_backwards(
|
|
15
|
-
self,
|
|
36
|
+
self,
|
|
37
|
+
app_label: str,
|
|
38
|
+
schema_editor: BaseDatabaseSchemaEditor,
|
|
39
|
+
from_state: ProjectState,
|
|
40
|
+
to_state: ProjectState,
|
|
16
41
|
) -> None: ...
|
|
17
42
|
def describe(self) -> str: ...
|
|
18
|
-
def references_model(self, name: str, app_label: str
|
|
19
|
-
def references_field(
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
43
|
+
def references_model(self, name: str, app_label: str) -> bool: ...
|
|
44
|
+
def references_field(self, model_name: str, name: str, app_label: str) -> bool: ...
|
|
45
|
+
def allow_migrate_model(
|
|
46
|
+
self, connection_alias: str, model: type[Model]
|
|
47
|
+
) -> bool | None: ...
|
|
23
48
|
def reduce(
|
|
24
|
-
self, operation: Operation,
|
|
25
|
-
) -> bool: ...
|
|
49
|
+
self, operation: Operation, app_label: str
|
|
50
|
+
) -> list[Operation] | bool: ...
|
|
@@ -6,5 +6,5 @@ def topological_sort_as_sets(
|
|
|
6
6
|
dependency_graph: dict[Operation, set[Operation]]
|
|
7
7
|
) -> Iterator[set[Operation]]: ...
|
|
8
8
|
def stable_topological_sort(
|
|
9
|
-
l: list[Operation], dependency_graph: dict[Operation, set[Operation]]
|
|
9
|
+
l: list[Operation], dependency_graph: dict[Operation, set[Operation]]
|
|
10
10
|
) -> list[Operation]: ...
|
|
@@ -8,6 +8,7 @@ from .aggregates import Count as Count
|
|
|
8
8
|
from .aggregates import Max as Max
|
|
9
9
|
from .aggregates import Min as Min
|
|
10
10
|
from .aggregates import StdDev as StdDev
|
|
11
|
+
from .aggregates import StringAgg as StringAgg
|
|
11
12
|
from .aggregates import Sum as Sum
|
|
12
13
|
from .aggregates import Variance as Variance
|
|
13
14
|
from .base import Model as Model
|
|
@@ -78,10 +79,12 @@ from .fields import TextField as TextField
|
|
|
78
79
|
from .fields import TimeField as TimeField
|
|
79
80
|
from .fields import URLField as URLField
|
|
80
81
|
from .fields import UUIDField as UUIDField
|
|
82
|
+
from .fields.composite import CompositePrimaryKey as CompositePrimaryKey
|
|
81
83
|
from .fields.files import FieldFile as FieldFile
|
|
82
84
|
from .fields.files import FileDescriptor as FileDescriptor
|
|
83
85
|
from .fields.files import FileField as FileField
|
|
84
86
|
from .fields.files import ImageField as ImageField
|
|
87
|
+
from .fields.generated import GeneratedField as GeneratedField
|
|
85
88
|
from .fields.json import JSONField as JSONField
|
|
86
89
|
from .fields.proxy import OrderWrt as OrderWrt
|
|
87
90
|
from .fields.related import ForeignKey as ForeignKey
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
from typing import Any
|
|
2
2
|
|
|
3
|
-
from django.db.models.expressions import Func
|
|
3
|
+
from django.db.models.expressions import Combinable, Func
|
|
4
4
|
|
|
5
5
|
class Aggregate(Func):
|
|
6
6
|
filter_template: str = ...
|
|
@@ -19,5 +19,9 @@ class Count(Aggregate): ...
|
|
|
19
19
|
class Max(Aggregate): ...
|
|
20
20
|
class Min(Aggregate): ...
|
|
21
21
|
class StdDev(Aggregate): ...
|
|
22
|
+
|
|
23
|
+
class StringAgg(Aggregate):
|
|
24
|
+
def __init__(self, expression: Combinable | str, delimiter: Combinable | str, **extra: Any) -> None: ...
|
|
25
|
+
|
|
22
26
|
class Sum(Aggregate): ...
|
|
23
27
|
class Variance(Aggregate): ...
|
django-stubs/db/models/base.pyi
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
from collections.abc import Callable, Collection, Iterable
|
|
2
2
|
from typing import Any, ClassVar
|
|
3
|
-
from typing_extensions import Self
|
|
4
3
|
|
|
5
4
|
from django.core.checks.messages import CheckMessage
|
|
6
5
|
from django.core.exceptions import (
|
|
@@ -10,6 +9,7 @@ from django.core.exceptions import ObjectDoesNotExist, ValidationError
|
|
|
10
9
|
from django.db.models.manager import BaseManager
|
|
11
10
|
from django.db.models.options import Options
|
|
12
11
|
from django.db.models.query import QuerySet
|
|
12
|
+
from typing_extensions import Self
|
|
13
13
|
|
|
14
14
|
class ModelStateFieldsCacheDescriptor: ...
|
|
15
15
|
|
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
from collections.abc import Sequence
|
|
2
2
|
from enum import Enum
|
|
3
|
-
from typing import Any
|
|
4
|
-
from typing_extensions import Self
|
|
3
|
+
from typing import Any, cast, overload
|
|
4
|
+
from typing_extensions import Self, deprecated
|
|
5
5
|
|
|
6
6
|
from django.db.backends.base.schema import BaseDatabaseSchemaEditor
|
|
7
7
|
from django.db.models.base import Model
|
|
8
8
|
from django.db.models.expressions import BaseExpression, Combinable
|
|
9
9
|
from django.db.models.query_utils import Q
|
|
10
|
+
from typing_extensions import Self
|
|
10
11
|
|
|
11
12
|
class Deferrable(Enum):
|
|
12
|
-
DEFERRED
|
|
13
|
-
IMMEDIATE
|
|
13
|
+
DEFERRED = cast(str, ...)
|
|
14
|
+
IMMEDIATE = cast(str, ...)
|
|
14
15
|
|
|
15
16
|
class BaseConstraint:
|
|
16
17
|
name: str
|
|
@@ -39,27 +40,65 @@ class BaseConstraint:
|
|
|
39
40
|
def clone(self) -> Self: ...
|
|
40
41
|
|
|
41
42
|
class CheckConstraint(BaseConstraint):
|
|
42
|
-
check: Q
|
|
43
|
+
check: Q | BaseExpression
|
|
44
|
+
condition: Q | BaseExpression
|
|
45
|
+
|
|
46
|
+
@overload
|
|
47
|
+
@deprecated(
|
|
48
|
+
"check keyword argument is deprecated in favor of condition and will be removed in Django 6.0"
|
|
49
|
+
)
|
|
43
50
|
def __init__(
|
|
44
51
|
self,
|
|
45
52
|
*,
|
|
46
|
-
check: Q,
|
|
47
53
|
name: str,
|
|
48
|
-
|
|
54
|
+
condition: None = None,
|
|
55
|
+
check: Q | BaseExpression,
|
|
56
|
+
violation_error_code: str | None = None,
|
|
57
|
+
violation_error_message: str | None = None,
|
|
58
|
+
) -> None: ...
|
|
59
|
+
@overload
|
|
60
|
+
def __init__(
|
|
61
|
+
self,
|
|
62
|
+
*,
|
|
63
|
+
name: str,
|
|
64
|
+
condition: Q | BaseExpression,
|
|
65
|
+
check: None = None,
|
|
66
|
+
violation_error_code: str | None = None,
|
|
67
|
+
violation_error_message: str | None = None,
|
|
49
68
|
) -> None: ...
|
|
50
69
|
|
|
51
70
|
class UniqueConstraint(BaseConstraint):
|
|
52
|
-
|
|
71
|
+
expressions: Sequence[BaseExpression | Combinable]
|
|
72
|
+
fields: Sequence[str]
|
|
53
73
|
condition: Q | None
|
|
74
|
+
deferrable: Deferrable | None
|
|
75
|
+
nulls_distinct: bool | None
|
|
76
|
+
|
|
77
|
+
@overload
|
|
54
78
|
def __init__(
|
|
55
79
|
self,
|
|
56
|
-
*expressions:
|
|
57
|
-
fields:
|
|
58
|
-
name: str | None =
|
|
59
|
-
condition: Q | None =
|
|
60
|
-
deferrable: Deferrable | None =
|
|
61
|
-
include:
|
|
62
|
-
opclasses: Sequence[
|
|
63
|
-
|
|
64
|
-
|
|
80
|
+
*expressions: str | BaseExpression | Combinable,
|
|
81
|
+
fields: None = None,
|
|
82
|
+
name: str | None = None,
|
|
83
|
+
condition: Q | None = None,
|
|
84
|
+
deferrable: Deferrable | None = None,
|
|
85
|
+
include: Sequence[str] | None = None,
|
|
86
|
+
opclasses: Sequence[Any] = (),
|
|
87
|
+
nulls_distinct: bool | None = None,
|
|
88
|
+
violation_error_code: str | None = None,
|
|
89
|
+
violation_error_message: str | None = None,
|
|
90
|
+
) -> None: ...
|
|
91
|
+
@overload
|
|
92
|
+
def __init__(
|
|
93
|
+
self,
|
|
94
|
+
*,
|
|
95
|
+
fields: Sequence[str],
|
|
96
|
+
name: str | None = None,
|
|
97
|
+
condition: Q | None = None,
|
|
98
|
+
deferrable: Deferrable | None = None,
|
|
99
|
+
include: Sequence[str] | None = None,
|
|
100
|
+
opclasses: Sequence[Any] = (),
|
|
101
|
+
nulls_distinct: bool | None = None,
|
|
102
|
+
violation_error_code: str | None = None,
|
|
103
|
+
violation_error_message: str | None = None,
|
|
65
104
|
) -> None: ...
|
django-stubs/db/models/enums.pyi
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import enum
|
|
2
2
|
from collections.abc import Sequence
|
|
3
|
-
from typing import Any, TypeVar
|
|
3
|
+
from typing import Any, TypeAlias, TypeVar
|
|
4
4
|
|
|
5
5
|
_EnumMemberT = TypeVar("_EnumMemberT")
|
|
6
6
|
|
|
@@ -13,6 +13,8 @@ class ChoicesMeta(enum.EnumMeta):
|
|
|
13
13
|
@property
|
|
14
14
|
def choices(self: type[_EnumMemberT]) -> Sequence[tuple[_EnumMemberT, str]]: ...
|
|
15
15
|
|
|
16
|
+
ChoicesType: TypeAlias = ChoicesMeta
|
|
17
|
+
|
|
16
18
|
class Choices(enum.Enum, metaclass=ChoicesMeta):
|
|
17
19
|
def __str__(self) -> Any: ...
|
|
18
20
|
@property
|
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
from collections.abc import Callable, Iterable, Iterator, Sequence
|
|
2
2
|
from datetime import datetime, timedelta
|
|
3
3
|
from decimal import Decimal
|
|
4
|
-
from typing import Any
|
|
5
|
-
from typing_extensions import Self
|
|
4
|
+
from typing import Any, TypeAlias
|
|
6
5
|
|
|
7
6
|
from django.db.models import Q, QuerySet
|
|
8
7
|
from django.db.models.fields import Field
|
|
9
8
|
from django.db.models.lookups import Lookup
|
|
10
9
|
from django.db.models.query import _BaseQuerySet
|
|
11
10
|
from django.db.models.sql.compiler import SQLCompiler
|
|
11
|
+
from typing_extensions import Self
|
|
12
12
|
|
|
13
|
-
_OutputField = Field[Any, Any] | str
|
|
13
|
+
_OutputField: TypeAlias = Field[Any, Any] | str
|
|
14
14
|
|
|
15
15
|
class SQLiteNumericMixin:
|
|
16
16
|
def as_sqlite(
|
|
17
17
|
self, compiler: SQLCompiler, connection: Any, **extra_context: Any
|
|
18
18
|
) -> tuple[str, list[float]]: ...
|
|
19
19
|
|
|
20
|
-
_Numeric = float | Decimal
|
|
20
|
+
_Numeric: TypeAlias = float | Decimal
|
|
21
21
|
|
|
22
22
|
class Combinable:
|
|
23
23
|
ADD: str = ...
|
|
@@ -40,11 +40,11 @@ class Combinable:
|
|
|
40
40
|
def __itruediv__(self, other: Combinable | _Numeric) -> Self: ...
|
|
41
41
|
def __mod__(self, other: int | Combinable) -> Self: ...
|
|
42
42
|
def __pow__(self, other: _Numeric | Combinable) -> Self: ...
|
|
43
|
-
def __and__(self, other: Combinable) -> Self: ...
|
|
43
|
+
def __and__(self, other: Combinable | Q) -> Self: ...
|
|
44
44
|
def bitand(self, other: int) -> Self: ...
|
|
45
45
|
def bitleftshift(self, other: int) -> Self: ...
|
|
46
46
|
def bitrightshift(self, other: int) -> Self: ...
|
|
47
|
-
def __or__(self, other: Combinable) -> Self: ...
|
|
47
|
+
def __or__(self, other: Combinable | Q) -> Self: ...
|
|
48
48
|
def bitor(self, other: int) -> Self: ...
|
|
49
49
|
def __radd__(
|
|
50
50
|
self, other: datetime | _Numeric | Combinable | None
|
|
@@ -99,7 +99,7 @@ class BaseExpression:
|
|
|
99
99
|
def as_sqlite(self, compiler: SQLCompiler, connection: Any) -> Any: ...
|
|
100
100
|
def as_sql(
|
|
101
101
|
self, compiler: SQLCompiler, connection: Any, **extra_context: Any
|
|
102
|
-
) -> Any: ...
|
|
102
|
+
) -> tuple[str, list[Any] | tuple[Any]]: ...
|
|
103
103
|
def as_mysql(self, compiler: Any, connection: Any) -> Any: ...
|
|
104
104
|
def as_postgresql(self, compiler: Any, connection: Any) -> Any: ...
|
|
105
105
|
def as_oracle(self, compiler: Any, connection: Any) -> Any: ...
|