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
|
@@ -1,37 +1,44 @@
|
|
|
1
|
-
|
|
2
|
-
from
|
|
1
|
+
import threading
|
|
2
|
+
from collections.abc import Callable, Hashable, MutableMapping
|
|
3
|
+
from logging import Logger
|
|
4
|
+
from typing import Any, TypeVar
|
|
3
5
|
|
|
4
|
-
NONE_ID:
|
|
6
|
+
NONE_ID: int
|
|
5
7
|
NO_RECEIVERS: Any
|
|
6
8
|
|
|
9
|
+
logger: Logger
|
|
10
|
+
|
|
7
11
|
class Signal:
|
|
8
|
-
receivers: Any
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
def __init__(
|
|
14
|
-
self, providing_args: list[str] = ..., use_caching: bool = ...
|
|
15
|
-
) -> None: ...
|
|
12
|
+
receivers: list[Any]
|
|
13
|
+
lock: threading.Lock
|
|
14
|
+
use_caching: bool
|
|
15
|
+
sender_receivers_cache: MutableMapping[Any, Any]
|
|
16
|
+
|
|
17
|
+
def __init__(self, use_caching: bool = False) -> None: ...
|
|
16
18
|
def connect(
|
|
17
19
|
self,
|
|
18
20
|
receiver: Callable[..., Any],
|
|
19
|
-
sender: object | None =
|
|
20
|
-
weak: bool =
|
|
21
|
-
dispatch_uid:
|
|
21
|
+
sender: object | None = None,
|
|
22
|
+
weak: bool = True,
|
|
23
|
+
dispatch_uid: Hashable | None = None,
|
|
22
24
|
) -> None: ...
|
|
23
25
|
def disconnect(
|
|
24
|
-
self,
|
|
25
|
-
receiver: Callable[..., Any] | None = ...,
|
|
26
|
-
sender: object | None = ...,
|
|
27
|
-
dispatch_uid: str | None = ...,
|
|
26
|
+
self, receiver: Callable[..., Any] | None = None, sender: object | None = None, dispatch_uid: str | None = None
|
|
28
27
|
) -> bool: ...
|
|
29
|
-
def has_listeners(self, sender: Any =
|
|
30
|
-
def send(
|
|
31
|
-
|
|
32
|
-
) -> list[tuple[Callable[..., Any],
|
|
33
|
-
def
|
|
34
|
-
|
|
35
|
-
|
|
28
|
+
def has_listeners(self, sender: Any | None = None) -> bool: ...
|
|
29
|
+
def send(self, sender: Any, **named: Any) -> list[tuple[Callable[..., Any], str | None]]: ...
|
|
30
|
+
async def asend(self, sender: Any, **named: Any) -> list[tuple[Callable[..., Any], str | None]]: ...
|
|
31
|
+
def send_robust(self, sender: Any, **named: Any) -> list[tuple[Callable[..., Any], Exception | Any]]: ...
|
|
32
|
+
async def asend_robust(self, sender: Any, **named: Any) -> list[tuple[Callable[..., Any], Exception | Any]]: ...
|
|
33
|
+
def _live_receivers(self, sender: Any) -> tuple[list[Callable[..., Any]], list[Callable[..., Any]]]: ...
|
|
34
|
+
|
|
35
|
+
_F = TypeVar("_F", bound=Callable[..., Any])
|
|
36
36
|
|
|
37
|
-
def receiver(
|
|
37
|
+
def receiver(
|
|
38
|
+
signal: list[Signal] | tuple[Signal, ...] | Signal,
|
|
39
|
+
*,
|
|
40
|
+
sender: object | None = ...,
|
|
41
|
+
weak: bool = ...,
|
|
42
|
+
dispatch_uid: Hashable | None = ...,
|
|
43
|
+
**named: Any,
|
|
44
|
+
) -> Callable[[_F], _F]: ...
|
django-stubs/forms/fields.pyi
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
from collections.abc import Callable, Iterable, Sequence
|
|
2
2
|
from datetime import datetime, timedelta
|
|
3
3
|
from re import Pattern
|
|
4
|
-
from typing import Any
|
|
4
|
+
from typing import Any, TypeAlias
|
|
5
5
|
|
|
6
6
|
from django.core.validators import BaseValidator
|
|
7
7
|
from django.forms.boundfield import BoundField
|
|
8
8
|
from django.forms.forms import BaseForm
|
|
9
9
|
from django.forms.widgets import Widget
|
|
10
10
|
|
|
11
|
-
_Choice = tuple[Any, str]
|
|
12
|
-
_ChoiceNamedGroup = tuple[str, Iterable[_Choice]]
|
|
13
|
-
_FieldChoices = Iterable[_Choice | _ChoiceNamedGroup]
|
|
11
|
+
_Choice: TypeAlias = tuple[Any, str]
|
|
12
|
+
_ChoiceNamedGroup: TypeAlias = tuple[str, Iterable[_Choice]]
|
|
13
|
+
_FieldChoices: TypeAlias = Iterable[_Choice | _ChoiceNamedGroup]
|
|
14
14
|
|
|
15
15
|
class Field:
|
|
16
16
|
initial: Any
|
django-stubs/forms/models.pyi
CHANGED
|
@@ -7,7 +7,7 @@ from collections.abc import (
|
|
|
7
7
|
Sequence,
|
|
8
8
|
)
|
|
9
9
|
from datetime import datetime
|
|
10
|
-
from typing import Any, ClassVar, Literal, Protocol, TypeVar
|
|
10
|
+
from typing import Any, ClassVar, Literal, Protocol, TypeAlias, TypeVar
|
|
11
11
|
from unittest.mock import MagicMock
|
|
12
12
|
from uuid import UUID
|
|
13
13
|
|
|
@@ -26,9 +26,9 @@ from django.forms.widgets import Input, Widget
|
|
|
26
26
|
|
|
27
27
|
ALL_FIELDS: str
|
|
28
28
|
|
|
29
|
-
_Fields = list[Callable[..., Any] | str] | Sequence[str] | Literal["__all__"]
|
|
30
|
-
_Labels = dict[str, str]
|
|
31
|
-
_ErrorMessages = dict[str, dict[str, str]]
|
|
29
|
+
_Fields: TypeAlias = list[Callable[..., Any] | str] | Sequence[str] | Literal["__all__"]
|
|
30
|
+
_Labels: TypeAlias = dict[str, str]
|
|
31
|
+
_ErrorMessages: TypeAlias = dict[str, dict[str, str]]
|
|
32
32
|
|
|
33
33
|
_M = TypeVar("_M", bound=Model)
|
|
34
34
|
|
django-stubs/forms/renderers.pyi
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
from collections.abc import Mapping
|
|
2
2
|
from typing import Any
|
|
3
|
-
from typing_extensions import override
|
|
4
3
|
|
|
5
4
|
from django.http.request import HttpRequest
|
|
6
5
|
from django.template.backends.base import BaseEngine, _BaseTemplate
|
|
7
6
|
from django.template.backends.django import Template as DjangoTemplate
|
|
8
7
|
from django.template.backends.jinja2 import Template as Jinja2Template
|
|
9
8
|
from django.utils.safestring import SafeText
|
|
9
|
+
from typing_extensions import override
|
|
10
10
|
|
|
11
11
|
def get_default_renderer() -> BaseRenderer: ...
|
|
12
12
|
|
django-stubs/forms/widgets.pyi
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
from collections.abc import Callable, Iterable, Iterator, Mapping, Sequence
|
|
2
2
|
from decimal import Decimal
|
|
3
3
|
from itertools import chain
|
|
4
|
-
from typing import Any
|
|
4
|
+
from typing import Any, TypeAlias
|
|
5
5
|
|
|
6
6
|
from django.core.files.base import File
|
|
7
7
|
from django.forms.renderers import BaseRenderer
|
|
8
8
|
from django.utils.safestring import SafeText
|
|
9
9
|
|
|
10
|
-
_OptAttrs = dict[str, Any]
|
|
10
|
+
_OptAttrs: TypeAlias = dict[str, Any]
|
|
11
11
|
|
|
12
12
|
class MediaOrderConflictWarning(RuntimeWarning): ...
|
|
13
13
|
|
django-stubs/http/request.pyi
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
from collections.abc import Iterable, Mapping
|
|
2
2
|
from re import Pattern
|
|
3
|
-
from typing import Any, BinaryIO, TypeVar, overload
|
|
4
|
-
from typing_extensions import Self
|
|
3
|
+
from typing import Any, BinaryIO, TypeAlias, TypeVar, overload
|
|
5
4
|
|
|
6
5
|
from django.contrib.auth.models import _AnyUser
|
|
7
6
|
from django.contrib.sessions.backends.base import SessionBase
|
|
@@ -13,6 +12,7 @@ from django.utils.datastructures import (
|
|
|
13
12
|
ImmutableList,
|
|
14
13
|
MultiValueDict,
|
|
15
14
|
)
|
|
15
|
+
from typing_extensions import Self
|
|
16
16
|
|
|
17
17
|
RAISE_ERROR: object = ...
|
|
18
18
|
host_validation_re: Pattern[str] = ...
|
|
@@ -20,7 +20,7 @@ host_validation_re: Pattern[str] = ...
|
|
|
20
20
|
class UnreadablePostError(OSError): ...
|
|
21
21
|
class RawPostDataException(Exception): ...
|
|
22
22
|
|
|
23
|
-
UploadHandlerList = (
|
|
23
|
+
UploadHandlerList: TypeAlias = (
|
|
24
24
|
list[uploadhandler.FileUploadHandler]
|
|
25
25
|
| ImmutableList[uploadhandler.FileUploadHandler]
|
|
26
26
|
)
|
|
@@ -59,6 +59,7 @@ class HttpRequest:
|
|
|
59
59
|
def __init__(self) -> None: ...
|
|
60
60
|
@property
|
|
61
61
|
def accepted_types(self) -> list[MediaType]: ...
|
|
62
|
+
def get_preferred_type(self, media_types: list[str]) -> str | None: ...
|
|
62
63
|
def accepts(self, media_type: str) -> bool: ...
|
|
63
64
|
def get_host(self) -> str: ...
|
|
64
65
|
def get_port(self) -> str: ...
|
django-stubs/http/response.pyi
CHANGED
|
@@ -3,7 +3,6 @@ from collections.abc import AsyncIterable, AsyncIterator, Iterable, Iterator
|
|
|
3
3
|
from io import BytesIO
|
|
4
4
|
from json import JSONEncoder
|
|
5
5
|
from typing import Any, overload
|
|
6
|
-
from typing_extensions import Never
|
|
7
6
|
|
|
8
7
|
from django.core.handlers.wsgi import WSGIRequest
|
|
9
8
|
from django.http.cookie import SimpleCookie
|
|
@@ -11,6 +10,7 @@ from django.template import Context, Template
|
|
|
11
10
|
from django.test.client import Client
|
|
12
11
|
from django.urls import ResolverMatch
|
|
13
12
|
from django.utils.datastructures import CaseInsensitiveMapping
|
|
13
|
+
from typing_extensions import Never
|
|
14
14
|
|
|
15
15
|
class ResponseHeaders(CaseInsensitiveMapping[str]):
|
|
16
16
|
def pop(self, key: str, default: str | None = ...) -> str: ...
|
|
@@ -19,7 +19,7 @@ class ResponseHeaders(CaseInsensitiveMapping[str]):
|
|
|
19
19
|
class BadHeaderError(ValueError): ...
|
|
20
20
|
|
|
21
21
|
class HttpResponseBase:
|
|
22
|
-
cookies: SimpleCookie
|
|
22
|
+
cookies: SimpleCookie
|
|
23
23
|
headers: ResponseHeaders
|
|
24
24
|
status_code: int
|
|
25
25
|
closed: bool
|
|
@@ -82,6 +82,8 @@ class HttpResponse(HttpResponseBase, Iterable[bytes]):
|
|
|
82
82
|
def serialize(self) -> bytes: ...
|
|
83
83
|
@property
|
|
84
84
|
def content(self) -> bytes: ...
|
|
85
|
+
@property
|
|
86
|
+
def text(self) -> str: ...
|
|
85
87
|
def __iter__(self) -> Iterator[bytes]: ...
|
|
86
88
|
def write(self, content: str | bytes) -> None: ...
|
|
87
89
|
def tell(self) -> int: ...
|
|
@@ -111,6 +113,8 @@ class StreamingHttpResponse(HttpResponseBase, Iterable[bytes], AsyncIterable[byt
|
|
|
111
113
|
def getvalue(self) -> bytes: ...
|
|
112
114
|
@property
|
|
113
115
|
def content(self) -> Never: ...
|
|
116
|
+
@property
|
|
117
|
+
def text(self) -> Never: ...
|
|
114
118
|
def __iter__(self) -> Iterator[bytes]: ...
|
|
115
119
|
def __aiter__(self) -> AsyncIterator[bytes]: ...
|
|
116
120
|
|
|
@@ -125,7 +129,9 @@ class FileResponse(StreamingHttpResponse):
|
|
|
125
129
|
|
|
126
130
|
class HttpResponseRedirectBase(HttpResponse):
|
|
127
131
|
allowed_schemes: list[str] = ...
|
|
128
|
-
def __init__(
|
|
132
|
+
def __init__(
|
|
133
|
+
self, redirect_to: str, preserve_request: bool = ..., *args: Any, **kwargs: Any
|
|
134
|
+
) -> None: ...
|
|
129
135
|
@property
|
|
130
136
|
def url(self) -> str: ...
|
|
131
137
|
|
django-stubs/shortcuts.pyi
CHANGED
|
@@ -1,63 +1,48 @@
|
|
|
1
1
|
from collections.abc import Callable, Mapping, Sequence
|
|
2
|
-
from typing import Any, Literal, Protocol, TypeVar, overload
|
|
2
|
+
from typing import Any, Literal, Protocol, TypeVar, overload, type_check_only
|
|
3
3
|
|
|
4
4
|
from django.db.models import Manager, QuerySet
|
|
5
5
|
from django.db.models.base import Model
|
|
6
6
|
from django.http import HttpRequest
|
|
7
|
-
from django.http.response import HttpResponse
|
|
8
|
-
from django.http.response import (
|
|
9
|
-
HttpResponsePermanentRedirect as HttpResponsePermanentRedirect,
|
|
10
|
-
)
|
|
11
|
-
from django.http.response import HttpResponseRedirect as HttpResponseRedirect
|
|
7
|
+
from django.http.response import HttpResponse, HttpResponsePermanentRedirect, HttpResponseRedirect
|
|
12
8
|
|
|
13
|
-
def render_to_response(
|
|
14
|
-
template_name: str | Sequence[str],
|
|
15
|
-
context: Mapping[str, Any] | None = ...,
|
|
16
|
-
content_type: str | None = ...,
|
|
17
|
-
status: int | None = ...,
|
|
18
|
-
using: str | None = ...,
|
|
19
|
-
) -> HttpResponse: ...
|
|
20
9
|
def render(
|
|
21
|
-
request: HttpRequest,
|
|
10
|
+
request: HttpRequest | None,
|
|
22
11
|
template_name: str | Sequence[str],
|
|
23
12
|
context: Mapping[str, Any] | None = ...,
|
|
24
13
|
content_type: str | None = ...,
|
|
25
14
|
status: int | None = ...,
|
|
26
15
|
using: str | None = ...,
|
|
27
16
|
) -> HttpResponse: ...
|
|
28
|
-
|
|
29
|
-
class SupportsGetAbsoluteUrl(Protocol):
|
|
17
|
+
@type_check_only
|
|
18
|
+
class SupportsGetAbsoluteUrl(Protocol):
|
|
19
|
+
def get_absolute_url(self) -> str: ...
|
|
30
20
|
|
|
31
21
|
@overload
|
|
32
22
|
def redirect(
|
|
33
23
|
to: Callable[..., Any] | str | SupportsGetAbsoluteUrl,
|
|
34
24
|
*args: Any,
|
|
35
25
|
permanent: Literal[True],
|
|
36
|
-
|
|
26
|
+
preserve_request: bool = False,
|
|
27
|
+
**kwargs: Any,
|
|
37
28
|
) -> HttpResponsePermanentRedirect: ...
|
|
38
29
|
@overload
|
|
39
30
|
def redirect(
|
|
40
31
|
to: Callable[..., Any] | str | SupportsGetAbsoluteUrl,
|
|
41
32
|
*args: Any,
|
|
42
|
-
permanent: Literal[False],
|
|
43
|
-
|
|
33
|
+
permanent: Literal[False] = False,
|
|
34
|
+
preserve_request: bool = False,
|
|
35
|
+
**kwargs: Any,
|
|
44
36
|
) -> HttpResponseRedirect: ...
|
|
45
37
|
@overload
|
|
46
38
|
def redirect(
|
|
47
|
-
to: Callable[..., Any] | str | SupportsGetAbsoluteUrl,
|
|
48
|
-
*args: Any,
|
|
49
|
-
permanent: bool = ...,
|
|
50
|
-
**kwargs: Any
|
|
39
|
+
to: Callable[..., Any] | str | SupportsGetAbsoluteUrl, *args: Any, permanent: bool, **kwargs: Any
|
|
51
40
|
) -> HttpResponseRedirect | HttpResponsePermanentRedirect: ...
|
|
52
41
|
|
|
53
42
|
_T = TypeVar("_T", bound=Model)
|
|
54
43
|
|
|
55
|
-
def get_object_or_404(
|
|
56
|
-
|
|
57
|
-
) -> _T: ...
|
|
58
|
-
def
|
|
59
|
-
|
|
60
|
-
) -> list[_T]: ...
|
|
61
|
-
def resolve_url(
|
|
62
|
-
to: Callable[..., Any] | Model | str, *args: Any, **kwargs: Any
|
|
63
|
-
) -> str: ...
|
|
44
|
+
def get_object_or_404(klass: type[_T] | Manager[_T] | QuerySet[_T], *args: Any, **kwargs: Any) -> _T: ...
|
|
45
|
+
async def aget_object_or_404(klass: type[_T] | Manager[_T] | QuerySet[_T], *args: Any, **kwargs: Any) -> _T: ...
|
|
46
|
+
def get_list_or_404(klass: type[_T] | Manager[_T] | QuerySet[_T], *args: Any, **kwargs: Any) -> list[_T]: ...
|
|
47
|
+
async def aget_list_or_404(klass: type[_T] | Manager[_T] | QuerySet[_T], *args: Any, **kwargs: Any) -> list[_T]: ...
|
|
48
|
+
def resolve_url(to: Callable[..., Any] | Model | str, *args: Any, **kwargs: Any) -> str: ...
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
from collections.abc import Iterator, Mapping
|
|
2
2
|
from typing import Any, NoReturn
|
|
3
|
-
from typing_extensions import override
|
|
4
3
|
|
|
5
4
|
from django.http.request import HttpRequest
|
|
6
5
|
from django.template import base
|
|
7
6
|
from django.template.engine import Engine
|
|
8
7
|
from django.template.exceptions import TemplateDoesNotExist
|
|
9
8
|
from django.utils.safestring import SafeText
|
|
9
|
+
from typing_extensions import override
|
|
10
10
|
|
|
11
11
|
from .base import BaseEngine
|
|
12
12
|
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
from collections.abc import Callable, Mapping
|
|
2
2
|
from typing import Any
|
|
3
|
-
from typing_extensions import override
|
|
4
3
|
|
|
5
4
|
from django.http.request import HttpRequest
|
|
6
5
|
from django.template import base
|
|
7
6
|
from django.template.exceptions import TemplateSyntaxError
|
|
8
7
|
from django.utils.safestring import SafeText
|
|
8
|
+
from typing_extensions import override
|
|
9
9
|
|
|
10
10
|
from .base import BaseEngine
|
|
11
11
|
|
django-stubs/template/base.pyi
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
from collections.abc import Callable, Iterator, Mapping, Sequence
|
|
2
2
|
from enum import Enum
|
|
3
|
-
from typing import Any
|
|
3
|
+
from typing import Any, cast
|
|
4
4
|
|
|
5
5
|
from django.http.request import HttpRequest
|
|
6
6
|
from django.template.context import Context as Context
|
|
@@ -26,10 +26,10 @@ tag_re: Any
|
|
|
26
26
|
logger: Any
|
|
27
27
|
|
|
28
28
|
class TokenType(Enum):
|
|
29
|
-
TEXT
|
|
30
|
-
VAR
|
|
31
|
-
BLOCK
|
|
32
|
-
COMMENT
|
|
29
|
+
TEXT = cast(int, ...)
|
|
30
|
+
VAR = cast(int, ...)
|
|
31
|
+
BLOCK = cast(int, ...)
|
|
32
|
+
COMMENT = cast(int, ...)
|
|
33
33
|
|
|
34
34
|
class VariableDoesNotExist(Exception):
|
|
35
35
|
msg: str = ...
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
from collections.abc import Callable, Iterable, Iterator
|
|
2
|
-
from
|
|
2
|
+
from types import TracebackType
|
|
3
|
+
from typing import Any, TypeAlias
|
|
3
4
|
|
|
4
5
|
from django.http.request import HttpRequest
|
|
5
6
|
from django.template.base import Node, Origin, Template
|
|
6
7
|
from django.template.defaulttags import IfChangedNode
|
|
7
8
|
from django.template.loader_tags import IncludeNode
|
|
8
9
|
|
|
9
|
-
_ContextValues = dict[str, Any] | Context
|
|
10
|
+
_ContextValues: TypeAlias = dict[str, Any] | Context
|
|
10
11
|
|
|
11
12
|
class ContextPopException(Exception): ...
|
|
12
13
|
|
|
@@ -14,7 +15,12 @@ class ContextDict(dict[Any, Any]):
|
|
|
14
15
|
context: BaseContext = ...
|
|
15
16
|
def __init__(self, context: BaseContext, *args: Any, **kwargs: Any) -> None: ...
|
|
16
17
|
def __enter__(self) -> ContextDict: ...
|
|
17
|
-
def __exit__(
|
|
18
|
+
def __exit__(
|
|
19
|
+
self,
|
|
20
|
+
exc_type: type[BaseException] | None,
|
|
21
|
+
exc_value: BaseException | None,
|
|
22
|
+
traceback: TracebackType | None,
|
|
23
|
+
) -> None: ...
|
|
18
24
|
|
|
19
25
|
class BaseContext(Iterable[Any]):
|
|
20
26
|
def __init__(self, dict_: Any = ...) -> None: ...
|
|
@@ -4,7 +4,7 @@ from datetime import datetime
|
|
|
4
4
|
from datetime import time as _time
|
|
5
5
|
from typing import Any
|
|
6
6
|
|
|
7
|
-
from django.utils.html import escape as escape
|
|
7
|
+
from django.utils.html import escape as escape
|
|
8
8
|
from django.utils.safestring import SafeText
|
|
9
9
|
|
|
10
10
|
register: Any
|
django-stubs/template/engine.pyi
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
from collections.abc import Callable, Sequence
|
|
2
|
-
from typing import Any
|
|
2
|
+
from typing import Any, TypeAlias
|
|
3
3
|
|
|
4
4
|
from django.template.base import Origin
|
|
5
5
|
from django.template.library import Library
|
|
@@ -8,7 +8,7 @@ from django.utils.safestring import SafeText
|
|
|
8
8
|
|
|
9
9
|
from .base import Template
|
|
10
10
|
|
|
11
|
-
_Loader = Any
|
|
11
|
+
_Loader: TypeAlias = Any
|
|
12
12
|
|
|
13
13
|
class Engine:
|
|
14
14
|
template_context_processors: tuple[Callable[..., Any]]
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
from collections.abc import Callable
|
|
2
2
|
from typing import Any, TypeVar, overload
|
|
3
|
-
from typing_extensions import ParamSpec
|
|
4
3
|
|
|
5
4
|
from django.template.base import FilterExpression, Origin, Parser, Token
|
|
6
5
|
from django.template.context import Context
|
|
7
6
|
from django.utils.safestring import SafeText
|
|
7
|
+
from typing_extensions import ParamSpec
|
|
8
8
|
|
|
9
9
|
from .base import Node, Template
|
|
10
10
|
|
django-stubs/template/loader.pyi
CHANGED
|
@@ -2,12 +2,10 @@ from typing import Any
|
|
|
2
2
|
|
|
3
3
|
from django.http.request import HttpRequest
|
|
4
4
|
from django.template.backends.base import _BaseTemplate
|
|
5
|
-
from django.template.exceptions import
|
|
6
|
-
TemplateDoesNotExist as TemplateDoesNotExist,
|
|
7
|
-
)
|
|
5
|
+
from django.template.exceptions import TemplateDoesNotExist as TemplateDoesNotExist
|
|
8
6
|
from django.utils.safestring import SafeText
|
|
9
7
|
|
|
10
|
-
from . import engines as engines
|
|
8
|
+
from . import engines as engines
|
|
11
9
|
|
|
12
10
|
def get_template(template_name: str, using: str | None = ...) -> _BaseTemplate: ...
|
|
13
11
|
def select_template(
|
|
@@ -15,7 +15,7 @@ class ContentNotRenderedError(Exception): ...
|
|
|
15
15
|
class SimpleTemplateResponse(HttpResponse):
|
|
16
16
|
content: Any = ...
|
|
17
17
|
closed: bool
|
|
18
|
-
cookies: SimpleCookie
|
|
18
|
+
cookies: SimpleCookie
|
|
19
19
|
status_code: int
|
|
20
20
|
rendering_attrs: Any = ...
|
|
21
21
|
template_name: list[str] | Template | str = ...
|
|
@@ -49,7 +49,7 @@ class TemplateResponse(SimpleTemplateResponse):
|
|
|
49
49
|
closed: bool
|
|
50
50
|
context: RequestContext # pyright: ignore[reportIncompatibleVariableOverride]
|
|
51
51
|
context_data: dict[str, Any] | None
|
|
52
|
-
cookies: SimpleCookie
|
|
52
|
+
cookies: SimpleCookie
|
|
53
53
|
csrf_cookie_set: bool
|
|
54
54
|
json: functools.partial[Any]
|
|
55
55
|
redirect_chain: list[tuple[str, int]]
|
django-stubs/test/client.pyi
CHANGED
|
@@ -3,7 +3,7 @@ from io import BytesIO
|
|
|
3
3
|
from json import JSONEncoder
|
|
4
4
|
from re import Pattern
|
|
5
5
|
from types import TracebackType
|
|
6
|
-
from typing import Any
|
|
6
|
+
from typing import Any, TypeAlias
|
|
7
7
|
|
|
8
8
|
from django.contrib.auth.base_user import AbstractBaseUser
|
|
9
9
|
from django.contrib.sessions.backends.base import SessionBase
|
|
@@ -47,12 +47,12 @@ class AsyncClientHandler(BaseHandler):
|
|
|
47
47
|
def encode_multipart(boundary: str, data: dict[str, Any]) -> bytes: ...
|
|
48
48
|
def encode_file(boundary: str, key: str, file: Any) -> list[bytes]: ...
|
|
49
49
|
|
|
50
|
-
_RequestData = Any | None
|
|
50
|
+
_RequestData: TypeAlias = Any | None
|
|
51
51
|
|
|
52
52
|
class RequestFactory:
|
|
53
53
|
json_encoder: type[JSONEncoder]
|
|
54
54
|
defaults: dict[str, str]
|
|
55
|
-
cookies: SimpleCookie
|
|
55
|
+
cookies: SimpleCookie
|
|
56
56
|
errors: BytesIO
|
|
57
57
|
def __init__(
|
|
58
58
|
self,
|
django-stubs/test/html.pyi
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
from collections.abc import Sequence
|
|
2
2
|
from html.parser import HTMLParser
|
|
3
|
-
from typing import Any
|
|
3
|
+
from typing import Any, TypeAlias
|
|
4
4
|
|
|
5
5
|
WHITESPACE: Any
|
|
6
6
|
|
|
7
7
|
def normalize_whitespace(string: str) -> str: ...
|
|
8
8
|
|
|
9
|
-
_ElementAttribute = tuple[str, str | None]
|
|
9
|
+
_ElementAttribute: TypeAlias = tuple[str, str | None]
|
|
10
10
|
|
|
11
11
|
class Element:
|
|
12
12
|
name: str | None = ...
|
django-stubs/test/signals.pyi
CHANGED
django-stubs/test/testcases.pyi
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import threading
|
|
2
2
|
import unittest
|
|
3
3
|
from collections.abc import Callable, Iterable
|
|
4
|
+
from types import TracebackType
|
|
4
5
|
from typing import Any, ClassVar, TypeVar, overload
|
|
5
6
|
|
|
6
7
|
from django.core.exceptions import ImproperlyConfigured
|
|
7
8
|
from django.core.handlers.wsgi import WSGIHandler
|
|
8
9
|
from django.core.servers.basehttp import ThreadedWSGIServer, WSGIRequestHandler
|
|
9
|
-
from django.db import connections as connections
|
|
10
|
+
from django.db import connections as connections
|
|
10
11
|
from django.db.backends.sqlite3.base import DatabaseWrapper
|
|
11
12
|
from django.db.models import Model
|
|
12
13
|
from django.db.models.query import ValuesQuerySet, _BaseQuerySet
|
|
@@ -35,7 +36,12 @@ class _AssertTemplateUsedContext:
|
|
|
35
36
|
def test(self) -> Any: ...
|
|
36
37
|
def message(self) -> Any: ...
|
|
37
38
|
def __enter__(self) -> Any: ...
|
|
38
|
-
def __exit__(
|
|
39
|
+
def __exit__(
|
|
40
|
+
self,
|
|
41
|
+
exc_type: type[BaseException] | None,
|
|
42
|
+
exc_value: BaseException | None,
|
|
43
|
+
traceback: TracebackType | None,
|
|
44
|
+
) -> None: ...
|
|
39
45
|
|
|
40
46
|
class _AssertTemplateNotUsedContext(_AssertTemplateUsedContext): ...
|
|
41
47
|
|
|
@@ -74,8 +80,8 @@ class SimpleTestCase(unittest.TestCase):
|
|
|
74
80
|
) -> None: ...
|
|
75
81
|
def assertNotContains(
|
|
76
82
|
self,
|
|
77
|
-
response:
|
|
78
|
-
text: bytes | str,
|
|
83
|
+
response: HttpResponseBase,
|
|
84
|
+
text: bytes | int | str,
|
|
79
85
|
status_code: int = ...,
|
|
80
86
|
msg_prefix: str = ...,
|
|
81
87
|
html: bool = ...,
|
django-stubs/test/utils.pyi
CHANGED
|
@@ -3,8 +3,7 @@ from collections.abc import Callable, Iterable, Iterator, Mapping
|
|
|
3
3
|
from contextlib import AbstractContextManager
|
|
4
4
|
from decimal import Decimal
|
|
5
5
|
from types import TracebackType
|
|
6
|
-
from typing import Any, TypeVar, overload
|
|
7
|
-
from typing_extensions import Self
|
|
6
|
+
from typing import Any, TypeAlias, TypeVar, overload
|
|
8
7
|
|
|
9
8
|
from django.apps.registry import Apps
|
|
10
9
|
from django.conf import LazySettings, Settings
|
|
@@ -12,9 +11,10 @@ from django.core.checks.registry import CheckRegistry
|
|
|
12
11
|
from django.db import DefaultConnectionProxy
|
|
13
12
|
from django.test.runner import DiscoverRunner
|
|
14
13
|
from django.test.testcases import SimpleTestCase
|
|
14
|
+
from typing_extensions import Self
|
|
15
15
|
|
|
16
|
-
_TestClass = type[SimpleTestCase]
|
|
17
|
-
_DecoratedTest = Callable[..., Any] | _TestClass
|
|
16
|
+
_TestClass: TypeAlias = type[SimpleTestCase]
|
|
17
|
+
_DecoratedTest: TypeAlias = Callable[..., Any] | _TestClass
|
|
18
18
|
_C = TypeVar("_C", bound=Callable[..., Any])
|
|
19
19
|
_T = TypeVar("_T")
|
|
20
20
|
_U = TypeVar("_U")
|
|
@@ -61,8 +61,8 @@ class TestContextDecorator:
|
|
|
61
61
|
def __enter__(self) -> Any | None: ...
|
|
62
62
|
def __exit__(
|
|
63
63
|
self,
|
|
64
|
-
exc_type: type[
|
|
65
|
-
exc_value:
|
|
64
|
+
exc_type: type[BaseException] | None,
|
|
65
|
+
exc_value: BaseException | None,
|
|
66
66
|
traceback: TracebackType | None,
|
|
67
67
|
) -> None: ...
|
|
68
68
|
def decorate_class(self, cls: _TestClassGeneric) -> _TestClassGeneric: ...
|
|
@@ -110,7 +110,12 @@ class CaptureQueriesContext:
|
|
|
110
110
|
@property
|
|
111
111
|
def captured_queries(self) -> list[dict[str, str]]: ...
|
|
112
112
|
def __enter__(self) -> Self: ...
|
|
113
|
-
def __exit__(
|
|
113
|
+
def __exit__(
|
|
114
|
+
self,
|
|
115
|
+
exc_type: type[BaseException] | None,
|
|
116
|
+
exc_value: BaseException | None,
|
|
117
|
+
traceback: TracebackType | None,
|
|
118
|
+
) -> None: ...
|
|
114
119
|
|
|
115
120
|
class ignore_warnings(TestContextDecorator):
|
|
116
121
|
ignore_kwargs: dict[str, Any] = ...
|
django-stubs/urls/conf.pyi
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
from collections.abc import Callable, Coroutine
|
|
2
|
-
from typing import Any, overload
|
|
2
|
+
from typing import Any, TypeAlias, overload
|
|
3
3
|
|
|
4
4
|
from ..conf.urls import IncludedURLConf
|
|
5
5
|
from ..http.response import HttpResponseBase
|
|
6
6
|
from .resolvers import URLPattern, URLResolver
|
|
7
7
|
|
|
8
|
-
_ResponseType = (
|
|
8
|
+
_ResponseType: TypeAlias = (
|
|
9
9
|
HttpResponseBase | Coroutine[Any, Any, HttpResponseBase] | Coroutine[Any, Any, None]
|
|
10
10
|
)
|
|
11
11
|
|