django-types 0.19.0__py3-none-any.whl → 0.20.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- django-stubs/contrib/admin/__init__.pyi +1 -0
- django-stubs/contrib/admin/options.pyi +63 -35
- django-stubs/contrib/admin/templatetags/base.pyi +1 -1
- django-stubs/contrib/admin/views/main.pyi +2 -1
- django-stubs/contrib/auth/__init__.pyi +14 -4
- django-stubs/contrib/auth/base_user.pyi +1 -1
- django-stubs/contrib/auth/models.pyi +28 -26
- django-stubs/contrib/contenttypes/fields.pyi +1 -1
- django-stubs/contrib/contenttypes/models.pyi +3 -1
- django-stubs/contrib/postgres/fields/array.pyi +5 -3
- django-stubs/contrib/postgres/fields/citext.pyi +12 -6
- django-stubs/contrib/postgres/fields/hstore.pyi +4 -2
- django-stubs/core/cache/backends/base.pyi +9 -0
- django-stubs/core/exceptions.pyi +16 -11
- django-stubs/core/files/base.pyi +1 -1
- django-stubs/core/files/storage.pyi +2 -2
- django-stubs/core/mail/message.pyi +6 -6
- django-stubs/core/serializers/json.pyi +1 -1
- django-stubs/core/servers/basehttp.pyi +2 -2
- django-stubs/db/migrations/recorder.pyi +1 -1
- django-stubs/db/models/base.pyi +0 -1
- django-stubs/db/models/constraints.pyi +1 -0
- django-stubs/db/models/enums.pyi +9 -19
- django-stubs/db/models/expressions.pyi +1 -1
- django-stubs/db/models/fields/__init__.pyi +225 -75
- django-stubs/db/models/fields/files.pyi +2 -2
- django-stubs/db/models/fields/json.pyi +9 -5
- django-stubs/db/models/fields/related.pyi +40 -18
- django-stubs/db/models/fields/related_descriptors.pyi +3 -3
- django-stubs/db/models/functions/__init__.pyi +2 -0
- django-stubs/db/models/functions/comparison.pyi +8 -0
- django-stubs/db/models/manager.pyi +11 -6
- django-stubs/db/models/query.pyi +4 -1
- django-stubs/db/models/query_utils.pyi +1 -0
- django-stubs/db/transaction.pyi +7 -1
- django-stubs/forms/boundfield.pyi +3 -1
- django-stubs/forms/forms.pyi +28 -35
- django-stubs/forms/formsets.pyi +98 -63
- django-stubs/forms/models.pyi +20 -14
- django-stubs/forms/renderers.pyi +26 -13
- django-stubs/forms/utils.pyi +38 -11
- django-stubs/http/cookie.pyi +3 -1
- django-stubs/http/request.pyi +37 -14
- django-stubs/http/response.pyi +38 -30
- django-stubs/template/backends/base.pyi +14 -5
- django-stubs/template/backends/django.pyi +24 -3
- django-stubs/template/backends/dummy.pyi +7 -6
- django-stubs/template/backends/jinja2.pyi +20 -2
- django-stubs/template/backends/utils.pyi +3 -3
- django-stubs/template/base.pyi +1 -1
- django-stubs/template/context.pyi +2 -2
- django-stubs/template/library.pyi +79 -15
- django-stubs/template/loader.pyi +5 -3
- django-stubs/template/response.pyi +3 -3
- django-stubs/template/utils.pyi +6 -4
- django-stubs/test/client.pyi +176 -20
- django-stubs/test/testcases.pyi +2 -2
- django-stubs/test/utils.pyi +41 -55
- django-stubs/urls/conf.pyi +7 -0
- django-stubs/utils/datastructures.pyi +3 -3
- django-stubs/utils/deconstruct.pyi +10 -2
- django-stubs/utils/log.pyi +1 -1
- django-stubs/utils/six.pyi +1 -1
- django-stubs/views/decorators/csrf.pyi +1 -1
- {django_types-0.19.0.dist-info → django_types-0.20.0.dist-info}/METADATA +8 -3
- {django_types-0.19.0.dist-info → django_types-0.20.0.dist-info}/RECORD +68 -68
- {django_types-0.19.0.dist-info → django_types-0.20.0.dist-info}/WHEEL +1 -1
- {django_types-0.19.0.dist-info → django_types-0.20.0.dist-info}/LICENSE.txt +0 -0
django-stubs/test/testcases.pyi
CHANGED
|
@@ -9,7 +9,7 @@ from django.core.servers.basehttp import ThreadedWSGIServer, WSGIRequestHandler
|
|
|
9
9
|
from django.db import connections as connections # noqa: F401
|
|
10
10
|
from django.db.backends.sqlite3.base import DatabaseWrapper
|
|
11
11
|
from django.db.models import Model
|
|
12
|
-
from django.db.models.query import
|
|
12
|
+
from django.db.models.query import ValuesQuerySet, _BaseQuerySet
|
|
13
13
|
from django.forms.fields import EmailField
|
|
14
14
|
from django.http.response import HttpResponse, HttpResponseBase
|
|
15
15
|
from django.template.base import Template
|
|
@@ -27,7 +27,7 @@ class _AssertTemplateUsedContext:
|
|
|
27
27
|
template_name: str = ...
|
|
28
28
|
rendered_templates: list[Template] = ...
|
|
29
29
|
rendered_template_names: list[str] = ...
|
|
30
|
-
context: ContextList = ...
|
|
30
|
+
context: ContextList[Any] = ...
|
|
31
31
|
def __init__(self, test_case: Any, template_name: Any) -> None: ...
|
|
32
32
|
def on_template_render(
|
|
33
33
|
self, sender: Any, signal: Any, template: Any, context: Any, **kwargs: Any
|
django-stubs/test/utils.pyi
CHANGED
|
@@ -1,21 +1,24 @@
|
|
|
1
1
|
import decimal
|
|
2
2
|
from collections.abc import Callable, Iterable, Iterator, Mapping
|
|
3
|
-
from contextlib import AbstractContextManager
|
|
3
|
+
from contextlib import AbstractContextManager
|
|
4
4
|
from decimal import Decimal
|
|
5
|
-
from
|
|
6
|
-
from typing import Any, TypeVar
|
|
5
|
+
from types import TracebackType
|
|
6
|
+
from typing import Any, TypeVar, overload
|
|
7
|
+
from typing_extensions import Self
|
|
7
8
|
|
|
8
9
|
from django.apps.registry import Apps
|
|
9
10
|
from django.conf import LazySettings, Settings
|
|
10
11
|
from django.core.checks.registry import CheckRegistry
|
|
11
|
-
from django.db
|
|
12
|
-
from django.db.models.query_utils import RegisterLookupMixin
|
|
12
|
+
from django.db import DefaultConnectionProxy
|
|
13
13
|
from django.test.runner import DiscoverRunner
|
|
14
14
|
from django.test.testcases import SimpleTestCase
|
|
15
15
|
|
|
16
16
|
_TestClass = type[SimpleTestCase]
|
|
17
17
|
_DecoratedTest = Callable[..., Any] | _TestClass
|
|
18
18
|
_C = TypeVar("_C", bound=Callable[..., Any])
|
|
19
|
+
_T = TypeVar("_T")
|
|
20
|
+
_U = TypeVar("_U")
|
|
21
|
+
_TestClassGeneric = TypeVar("_TestClassGeneric", bound=_TestClass)
|
|
19
22
|
|
|
20
23
|
TZ_SUPPORT: bool = ...
|
|
21
24
|
|
|
@@ -24,14 +27,25 @@ class Approximate:
|
|
|
24
27
|
places: int = ...
|
|
25
28
|
def __init__(self, val: Decimal | float, places: int = ...) -> None: ...
|
|
26
29
|
|
|
27
|
-
class ContextList(list[
|
|
28
|
-
def get(self, key: str, default:
|
|
30
|
+
class ContextList(list[Mapping[str, _T]]):
|
|
31
|
+
def get(self, key: str, default: _U | None = ...) -> _T | _U | None: ...
|
|
29
32
|
def keys(self) -> set[str]: ...
|
|
30
33
|
|
|
31
34
|
class _TestState: ...
|
|
32
35
|
|
|
33
36
|
def setup_test_environment(debug: bool | None = ...) -> None: ...
|
|
34
37
|
def teardown_test_environment() -> None: ...
|
|
38
|
+
def setup_databases(
|
|
39
|
+
verbosity: int,
|
|
40
|
+
interactive: bool,
|
|
41
|
+
*,
|
|
42
|
+
time_keeper: Any | None = ...,
|
|
43
|
+
keepdb: bool = ...,
|
|
44
|
+
debug_sql: bool = ...,
|
|
45
|
+
parallel: int = ...,
|
|
46
|
+
aliases: Iterable[str] | None = ...,
|
|
47
|
+
**kwargs: Any
|
|
48
|
+
) -> list[tuple[DefaultConnectionProxy, str, bool]]: ...
|
|
35
49
|
def get_runner(
|
|
36
50
|
settings: LazySettings, test_runner_class: str | None = ...
|
|
37
51
|
) -> type[DiscoverRunner]: ...
|
|
@@ -42,39 +56,47 @@ class TestContextDecorator:
|
|
|
42
56
|
def __init__(
|
|
43
57
|
self, attr_name: str | None = ..., kwarg_name: str | None = ...
|
|
44
58
|
) -> None: ...
|
|
45
|
-
def enable(self) -> Any: ...
|
|
59
|
+
def enable(self) -> Any | None: ...
|
|
46
60
|
def disable(self) -> None: ...
|
|
47
|
-
def __enter__(self) ->
|
|
48
|
-
def __exit__(
|
|
49
|
-
|
|
61
|
+
def __enter__(self) -> Any | None: ...
|
|
62
|
+
def __exit__(
|
|
63
|
+
self,
|
|
64
|
+
exc_type: type[Exception] | None,
|
|
65
|
+
exc_value: Exception | None,
|
|
66
|
+
traceback: TracebackType | None,
|
|
67
|
+
) -> None: ...
|
|
68
|
+
def decorate_class(self, cls: _TestClassGeneric) -> _TestClassGeneric: ...
|
|
50
69
|
def decorate_callable(self, func: _C) -> _C: ...
|
|
51
|
-
|
|
70
|
+
@overload
|
|
71
|
+
def __call__(self, decorated: _TestClassGeneric) -> _TestClassGeneric: ...
|
|
72
|
+
@overload
|
|
73
|
+
def __call__(self, decorated: _C) -> _C: ...
|
|
52
74
|
|
|
53
75
|
class override_settings(TestContextDecorator):
|
|
76
|
+
enable_exception: bool | None = ...
|
|
77
|
+
wrapped: Settings = ...
|
|
54
78
|
options: dict[str, Any] = ...
|
|
55
79
|
def __init__(self, **kwargs: Any) -> None: ...
|
|
56
|
-
wrapped: Settings = ...
|
|
57
80
|
def save_options(self, test_func: _DecoratedTest) -> None: ...
|
|
58
|
-
def decorate_class(self, cls: type) -> type: ...
|
|
59
81
|
|
|
60
82
|
class modify_settings(override_settings):
|
|
61
83
|
wrapped: Settings
|
|
62
84
|
operations: list[tuple[str, dict[str, list[str] | str]]] = ...
|
|
85
|
+
options: dict[str, list[tuple[str, str] | str]] = ...
|
|
63
86
|
def __init__(self, *args: Any, **kwargs: Any) -> None: ...
|
|
64
87
|
def save_options(self, test_func: _DecoratedTest) -> None: ...
|
|
65
|
-
options: dict[str, list[tuple[str, str] | str]] = ...
|
|
66
88
|
|
|
67
89
|
class override_system_checks(TestContextDecorator):
|
|
68
90
|
registry: CheckRegistry = ...
|
|
69
91
|
new_checks: list[Callable[..., Any]] = ...
|
|
70
92
|
deployment_checks: list[Callable[..., Any]] | None = ...
|
|
93
|
+
old_checks: set[Callable[..., Any]] = ...
|
|
94
|
+
old_deployment_checks: set[Callable[..., Any]] = ...
|
|
71
95
|
def __init__(
|
|
72
96
|
self,
|
|
73
97
|
new_checks: list[Callable[..., Any]],
|
|
74
98
|
deployment_checks: list[Callable[..., Any]] | None = ...,
|
|
75
99
|
) -> None: ...
|
|
76
|
-
old_checks: set[Callable[..., Any]] = ...
|
|
77
|
-
old_deployment_checks: set[Callable[..., Any]] = ...
|
|
78
100
|
|
|
79
101
|
class CaptureQueriesContext:
|
|
80
102
|
connection: Any = ...
|
|
@@ -87,7 +109,7 @@ class CaptureQueriesContext:
|
|
|
87
109
|
def __len__(self) -> int: ...
|
|
88
110
|
@property
|
|
89
111
|
def captured_queries(self) -> list[dict[str, str]]: ...
|
|
90
|
-
def __enter__(self) ->
|
|
112
|
+
def __enter__(self) -> Self: ...
|
|
91
113
|
def __exit__(self, exc_type: None, exc_value: None, traceback: None) -> None: ...
|
|
92
114
|
|
|
93
115
|
class ignore_warnings(TestContextDecorator):
|
|
@@ -117,40 +139,4 @@ class isolate_apps(TestContextDecorator):
|
|
|
117
139
|
def __init__(self, *installed_apps: Any, **kwargs: Any) -> None: ...
|
|
118
140
|
old_apps: Apps = ...
|
|
119
141
|
|
|
120
|
-
|
|
121
|
-
def extend_sys_path(*paths: str) -> Iterator[None]: ...
|
|
122
|
-
@contextmanager
|
|
123
|
-
def captured_output(stream_name: Any) -> Iterator[StringIO]: ...
|
|
124
|
-
@contextmanager
|
|
125
|
-
def captured_stdin() -> Iterator[StringIO]: ...
|
|
126
|
-
@contextmanager
|
|
127
|
-
def captured_stdout() -> Iterator[StringIO]: ...
|
|
128
|
-
@contextmanager
|
|
129
|
-
def captured_stderr() -> Iterator[StringIO]: ...
|
|
130
|
-
@contextmanager
|
|
131
|
-
def freeze_time(t: float) -> Iterator[None]: ...
|
|
132
|
-
def tag(*tags: str) -> Any: ...
|
|
133
|
-
|
|
134
|
-
_Signature = str
|
|
135
|
-
_TestDatabase = tuple[str, list[str]]
|
|
136
|
-
|
|
137
|
-
def dependency_ordered(
|
|
138
|
-
test_databases: Iterable[tuple[_Signature, _TestDatabase]],
|
|
139
|
-
dependencies: Mapping[str, list[str]],
|
|
140
|
-
) -> list[tuple[_Signature, _TestDatabase]]: ...
|
|
141
|
-
def get_unique_databases_and_mirrors() -> (
|
|
142
|
-
tuple[dict[_Signature, _TestDatabase], dict[str, Any]]
|
|
143
|
-
): ...
|
|
144
|
-
def teardown_databases(
|
|
145
|
-
old_config: Iterable[tuple[Any, str, bool]],
|
|
146
|
-
verbosity: int,
|
|
147
|
-
parallel: int = ...,
|
|
148
|
-
keepdb: bool = ...,
|
|
149
|
-
) -> None: ...
|
|
150
|
-
def require_jinja2(test_func: _C) -> _C: ...
|
|
151
|
-
@contextmanager
|
|
152
|
-
def register_lookup(
|
|
153
|
-
field: type[RegisterLookupMixin],
|
|
154
|
-
*lookups: type[Lookup[Any] | Transform],
|
|
155
|
-
lookup_name: str | None = ...
|
|
156
|
-
) -> Iterator[None]: ...
|
|
142
|
+
def tag(*tags: str) -> Callable[[_T], _T]: ...
|
django-stubs/urls/conf.pyi
CHANGED
|
@@ -32,6 +32,13 @@ def path(
|
|
|
32
32
|
kwargs: dict[str, Any] = ...,
|
|
33
33
|
name: str = ...,
|
|
34
34
|
) -> URLResolver: ...
|
|
35
|
+
@overload
|
|
36
|
+
def path(
|
|
37
|
+
route: str,
|
|
38
|
+
view: tuple[list[URLResolver | URLPattern], str, str],
|
|
39
|
+
kwargs: dict[str, Any] = ...,
|
|
40
|
+
name: str = ...,
|
|
41
|
+
) -> URLResolver: ...
|
|
35
42
|
|
|
36
43
|
# re_path()
|
|
37
44
|
@overload
|
|
@@ -76,9 +76,9 @@ class DictWrapper(dict[str, _V]):
|
|
|
76
76
|
self, data: Iterable[tuple[str, _V]], func: Callable[[_V], _V], prefix: str
|
|
77
77
|
) -> None: ...
|
|
78
78
|
|
|
79
|
-
class CaseInsensitiveMapping(Mapping[
|
|
79
|
+
class CaseInsensitiveMapping(Mapping[str, _V]):
|
|
80
80
|
def __init__(self, data: Any) -> None: ...
|
|
81
|
-
def __getitem__(self, key:
|
|
81
|
+
def __getitem__(self, key: str) -> Any: ...
|
|
82
82
|
def __len__(self) -> int: ...
|
|
83
|
-
def __iter__(self) -> Iterator[
|
|
83
|
+
def __iter__(self) -> Iterator[str]: ...
|
|
84
84
|
def copy(self) -> Self: ...
|
|
@@ -1,3 +1,11 @@
|
|
|
1
|
-
from
|
|
1
|
+
from collections.abc import Callable
|
|
2
|
+
from typing import Any, TypeVar, overload
|
|
2
3
|
|
|
3
|
-
|
|
4
|
+
T = TypeVar("T")
|
|
5
|
+
|
|
6
|
+
@overload
|
|
7
|
+
def deconstructible(klass: type[T]) -> type[T]: ...
|
|
8
|
+
@overload
|
|
9
|
+
def deconstructible(
|
|
10
|
+
*args: Any, path: str | None = ...
|
|
11
|
+
) -> Callable[[type[T]], type[T]]: ...
|
django-stubs/utils/log.pyi
CHANGED
|
@@ -36,7 +36,7 @@ class RequireDebugTrue(logging.Filter):
|
|
|
36
36
|
def filter(self, record: str | LogRecord) -> bool: ...
|
|
37
37
|
|
|
38
38
|
class ServerFormatter(logging.Formatter):
|
|
39
|
-
datefmt: None
|
|
39
|
+
datefmt: None # pyright: ignore[reportIncompatibleVariableOverride]
|
|
40
40
|
style: Style = ...
|
|
41
41
|
def __init__(self, *args: Any, **kwargs: Any) -> None: ...
|
|
42
42
|
def uses_server_time(self) -> bool: ...
|
django-stubs/utils/six.pyi
CHANGED
|
@@ -43,7 +43,7 @@ def get_method_function(meth: types.MethodType) -> types.FunctionType: ...
|
|
|
43
43
|
def get_method_self(meth: types.MethodType) -> object | None: ...
|
|
44
44
|
def get_function_closure(
|
|
45
45
|
fun: types.FunctionType,
|
|
46
|
-
) -> tuple[types._Cell, ...] | None: ...
|
|
46
|
+
) -> tuple[types._Cell, ...] | None: ... # pyright: ignore[reportAttributeAccessIssue]
|
|
47
47
|
def get_function_code(fun: types.FunctionType) -> types.CodeType: ...
|
|
48
48
|
def get_function_defaults(fun: types.FunctionType) -> tuple[Any, ...] | None: ...
|
|
49
49
|
def get_function_globals(fun: types.FunctionType) -> dict[str, Any]: ...
|
|
@@ -12,7 +12,7 @@ class _EnsureCsrfToken(CsrfViewMiddleware): ...
|
|
|
12
12
|
def requires_csrf_token(__view: _F) -> _F: ...
|
|
13
13
|
|
|
14
14
|
class _EnsureCsrfCookie(CsrfViewMiddleware):
|
|
15
|
-
get_response: None
|
|
15
|
+
get_response: None # pyright: ignore[reportIncompatibleVariableOverride]
|
|
16
16
|
def process_view(
|
|
17
17
|
self, request: Any, callback: Any, callback_args: Any, callback_kwargs: Any
|
|
18
18
|
) -> Any: ...
|
|
@@ -1,20 +1,21 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: django-types
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.20.0
|
|
4
4
|
Summary: Type stubs for Django
|
|
5
5
|
Home-page: https://github.com/sbdchd/django-types
|
|
6
6
|
License: MIT
|
|
7
7
|
Keywords: django,types,mypy,stubs
|
|
8
8
|
Author: Steve Dignam
|
|
9
9
|
Author-email: steve@dignam.xyz
|
|
10
|
-
Requires-Python: >=3.
|
|
10
|
+
Requires-Python: >=3.8,<4.0
|
|
11
11
|
Classifier: License :: OSI Approved :: MIT License
|
|
12
12
|
Classifier: Programming Language :: Python :: 3
|
|
13
|
-
Classifier: Programming Language :: Python :: 3.7
|
|
14
13
|
Classifier: Programming Language :: Python :: 3.8
|
|
15
14
|
Classifier: Programming Language :: Python :: 3.9
|
|
16
15
|
Classifier: Programming Language :: Python :: 3.10
|
|
17
16
|
Classifier: Programming Language :: Python :: 3.11
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
18
19
|
Requires-Dist: types-psycopg2 (>=2.9.21.13)
|
|
19
20
|
Project-URL: Repository, https://github.com/sbdchd/django-types
|
|
20
21
|
Description-Content-Type: text/markdown
|
|
@@ -275,3 +276,7 @@ def activity(request: HttpRequest, team_id: str) -> HttpResponse:
|
|
|
275
276
|
- <https://github.com/sbdchd/mongo-types>
|
|
276
277
|
- <https://github.com/sbdchd/msgpack-types>
|
|
277
278
|
|
|
279
|
+
## Releasing a new version
|
|
280
|
+
1. Navigate to https://github.com/sbdchd/django-types/actions/workflows/bump_version.yml and click "Run workflow".
|
|
281
|
+
2. Select the version level you wish to increase and click "Run workflow" to bump the version and publish to PyPI.
|
|
282
|
+
|