91 Commits

Author SHA1 Message Date
Maxim Kurnikov
304cb19de6 really drop universal 2019-04-01 01:43:14 +03:00
Maxim Kurnikov
c57f4f7152 only python3.6+ are supported 2019-04-01 01:08:46 +03:00
Maxim Kurnikov
8a826fee1e bump version 2019-04-01 00:54:36 +03:00
Maxim Kurnikov
37d85c2ca6 pin mypy version, django-stubs not yet supports mypyc 2019-04-01 00:54:15 +03:00
Seth Yastrov
71fb0432f3 52/model subtypes dont typecheck (#55)
* Fix problem where Model instancess are not considered subtypes of each other due to fallback_to_any = True. Fixes #52.

- Added a stub for __getstate__ to Model.
- Added a stub for clean() to Model.
- Correct arg type for sort_dependencies so they are covariant (Iterable rather than List).

Test ignores:
- Added some test ignores in cases where a model inherits from 2 different base models.
- Added some test ignores for cases that MyPy flags as errors due to variable redefinitions or imports that are incompatible types.

* Address review comment.
2019-03-28 23:13:02 +03:00
Maxim Kurnikov
9288c34648 fix @classproperty return type (#58) 2019-03-27 23:13:10 +03:00
Maxim Kurnikov
70050f28b9 drop --universal 2019-03-26 03:23:25 +03:00
Maxim Kurnikov
4338c17970 bump version 2019-03-25 14:22:17 +03:00
Maxim Kurnikov
91f789c38c fix SessionBase.exists() return type (#57) 2019-03-25 14:21:12 +03:00
Maxim Kurnikov
0f5b45fba1 bump version 2019-03-25 13:31:41 +03:00
Seth Yastrov
5b455b729a Specific return types for values and values list (#53)
* Instead of using Literal types, overload QuerySet.values_list in the plugin. Fixes #43.

- Add a couple of extra type checks that Django makes:
  1) 'flat' and 'named' can't be used together.
  2) 'flat' is not valid when values_list is called with more than one field.

* Determine better row types for values_list/values based on fields specified.

- In the case of values_list, we use a Row type with either a single primitive, Tuple, or NamedTuple.
- In the case of values, we use a TypedDict.
- In both cases, Any is used as a fallback for individual fields if those fields cannot be resolved.

A couple other fixes I made along the way:
- Don't create reverse relation for ForeignKeys with related_name='+'
- Don't skip creating other related managers in AddRelatedManagers if a dynamic value is encountered
  for related_name parameter, or if the type cannot be determined.

* Fix for TypedDict so that they are considered anonymous.

* Clean up some comments.

* Implement making TypedDict anonymous in a way that doesn't crash sometimes.

* Fix flake8 errors.

* Remove even uglier hack about making TypedDict anonymous.

* Address review comments. Write a few better comments inside tests.

* Fix crash when running with mypyc ("interpreted classes cannot inherit from compiled") due to the way I extended TypedDictType.

- Implemented the hack in another way that works on mypyc.
- Added a couple extra tests of accessing 'id' / 'pk' via values_list.

* Fix flake8 errors.

* Support annotation expressions (use type Any) for TypedDicts row types returned by values_list.

- Bonus points: handle values_list gracefully (use type Any) where Tuples are returned
  where some of the fields arguments are not string literals.
2019-03-25 12:53:09 +03:00
Maxim Kurnikov
5c6be7ad12 Add test to import all modules to check validity of stubs (#56)
* add import_all.test builder

* fix errors

* fix typechecking errors

* fix migrations typechecking
2019-03-25 01:57:34 +03:00
Maxim Kurnikov
5d0ee40ada Fix errors in db.models.expressions and db.models.functions.* (#54)
* fix errors at db.models.expressions and db.models.functions.*

* catch KeyError if QuerySet has not been loaded
2019-03-24 02:54:10 +03:00
Konstantin Alekseev
77f15d7478 Configure black using pyproject.toml (#50) 2019-03-18 16:53:12 +03:00
Konstantin Alekseev
4f83d8d1bb Use less specific types in validators args (#49) 2019-03-18 13:31:35 +03:00
Seth Yastrov
b1a04d2f7d Instead of using Literal types, overload QuerySet.values_list in the plugin. Fixes #43. (#44)
- Add a couple of extra type checks that Django makes:
  1) 'flat' and 'named' can't be used together.
  2) 'flat' is not valid when values_list is called with more than one field.
2019-03-13 22:10:37 +03:00
Maxim Kurnikov
7c57143310 forms/__init__ reimports 2019-03-10 21:14:15 +03:00
Maxim Kurnikov
c3d76f9a1e bump version 2019-03-10 20:03:00 +03:00
Maxim Kurnikov
fde071b883 fix classonlymethod, replace with six from typeshed 2019-03-10 19:56:54 +03:00
Seth Yastrov
324b961d74 Support returning the correct values for the different QuerySet methods when using .values() and .values_list(). (#33)
* Support returning the correct values for the different QuerySet methods when using .values() and .values_list().

* Fix slicing on QuerySet. Fix django queries test, and remove some ignored errors that are no longer needed.

* Remove accidental change in RawQuerySet.

* Readded some still-necessary ignores to aggregation django test.

* Add more tests of first/last/earliest/last/__getitem__, per mkurnikov's comments.

- Fix .iterator()

* Re-add Iterator as base-class of QuerySet.

* Make QuerySet a Collection.

* - Fix return type for QuerySet.select_for_update().
- Use correct return type for QuerySet.dates() / QuerySet.datetimes().
- Use correct type params in return type for QuerySet.__and__ / QuerySet.__or__
- Re-add Sized as base class for QuerySet.
- Add test of .all() for all _Row types.
- Add test of .get() for all _Row types.
- Remove some redundant QuerySet method tests.

* Automatically fill in second type parameter for QuerySet.

... if second parameter is omitted.
2019-03-10 12:13:50 +03:00
Seth Yastrov
86c63d790b Fix type errors on other models' managers when using objects = models.Manager() in Model. (#34)
* Fix bug where models with a class variable using a manager defined would interfere with other managers.

- Fill in the type argument for that particular instance of the manager, rather than modifying the bases of the Manager type.
- Instantiate a new Instance from determine_proper_manager_type so The code doesn't crash under mypy-mypyc.

* Use helpers.reparametrize_instance per review comment.

* Updated ignored errors in Django test for get_objects_or_404.

- For some reason, `Manager[nothing]` is now removed from expected types.
  However, I think this makes sense anyway, as Manager is a subclass of QuerySet.
2019-03-08 12:30:38 +03:00
Matt Basta
050c1b8887 Add gzip_page decorator (#41)
* Add gzip_page decorator

* Update to preserve Callable
2019-03-06 21:16:24 +03:00
Maxim Kurnikov
8978ad471f bump version 2019-03-06 12:05:24 +03:00
Richard Eames
f7dfbefbd6 Make CharField(blank=True) not be considered nullable (#39)
* Make CharField(blank=True) not be considered nullable

The documentation on [blank](https://docs.djangoproject.com/en/2.1/ref/models/fields/#blank) says that it "will allow the entry of an empty value", which for a string is just a 0-length string. This patch allows `CharField(blank=True,...)` to no longer be considered `Optional`.

closes #38

* fixed tests for `CharField(blank=True)`

* allow blank CharField to be nullable in the constructor, but the underlying type
is str (unless `null=True`)
2019-03-06 01:37:44 +03:00
Maxim Kurnikov
627daa55f5 fix extension of django.views __init__ file 2019-03-06 01:28:42 +03:00
Maxim Kurnikov
194489ee8d bump version 2019-03-05 20:21:43 +03:00
Maxim Kurnikov
1d2c7fb805 Remove _Val alias for MultiValueDict so that generic evaluate (#36)
* remove _Val alias for MultiValueDict so that generic evaluate

* fix multivaluedict init argument
2019-03-05 20:16:24 +03:00
Maxim Kurnikov
18c908bf98 set plugin_generated on new symbol nodes 2019-03-05 20:15:46 +03:00
Maxim Kurnikov
e0e8814804 Revert "dont convert to optional, if anytype"
This reverts commit 53f5d2214b.
2019-03-05 19:11:02 +03:00
Maxim Kurnikov
53f5d2214b dont convert to optional, if anytype 2019-03-05 18:43:10 +03:00
Maxim Kurnikov
9e4ed70fc5 Disable note: messages (#35)
* add global note: ignore
2019-03-01 05:15:05 +03:00
Maxim Kurnikov
18445f686f set fallback= for ini parser 2019-03-01 02:25:15 +03:00
Maxim Kurnikov
c962b8ac68 attempt to add flake8 and isort 2019-03-01 02:07:53 +03:00
Maxim Kurnikov
70c3126348 add plugin testing for python3.6 2019-02-27 18:12:29 +03:00
Maxim Kurnikov
af8ecc5520 remove django from dependencies, it's not required for static analysis 2019-02-27 18:11:54 +03:00
Maxim Kurnikov
64f8870d0b bump version 2019-02-27 17:59:04 +03:00
Maxim Kurnikov
df5c70c703 fixes for FormMixin's get_form/get_form_class 2019-02-25 04:01:36 +03:00
Maxim Kurnikov
c09a97e005 Merge pull request #29 from syastrov/queryset_in_bulk
QuerySet.in_bulk returns Dict with values of correct model type.
2019-02-22 23:23:36 +03:00
Seth Yastrov
0e30821ad3 Add possibility to pass list of test names as command-line arguments to typecheck_tests.py script. 2019-02-22 20:03:30 +01:00
Seth Yastrov
2dadd681ff Change in_bulk id_list param to Iterable rather than Sequence. 2019-02-22 20:03:20 +01:00
Seth Yastrov
2dec3b4325 Merge branch 'master' into queryset_in_bulk 2019-02-22 08:16:48 +01:00
Seth Yastrov
3b8c5d08e8 QuerySet.in_bulk fixes.
- Made id_list of type Sequence[Any], rather than Any, according to mkurnikov's review.
- Removed **kwargs.
- Made returned Dict keys of type Any rather than int or str as it depends on the provided field's type.
- Added test with examples from Django docs.
2019-02-22 08:13:31 +01:00
Maxim Kurnikov
eaee3d390f fix HttpResponse stubs by removing AnyStr 2019-02-22 03:22:11 +03:00
Maxim Kurnikov
b686751f19 fix some stubs 2019-02-22 02:55:49 +03:00
Maxim Kurnikov
73ea682356 rework django.views 2019-02-22 01:50:52 +03:00
Maxim Kurnikov
9ea25f3e56 bump version 2019-02-22 00:13:59 +03:00
Maxim Kurnikov
dacf88c692 optimize hooks a bit 2019-02-22 00:12:23 +03:00
Maxim Kurnikov
3d14d07e4e incremental = True for plugin tests should be fixed now 2019-02-21 17:35:46 +03:00
Maxim Kurnikov
6e6d1645d3 enable incremental mode for tests, disable it for one so that it would pass 2019-02-21 00:06:09 +03:00
Seth Yastrov
cda703a94b QuerySet.in_bulk returns Dict with values of correct model type.
- The keys are still Union[int, str] which doesn't cover all
possibilities, but it's not possible to cover without handling this in
the plugin, because the type of the Dict keys are dynamic depending on
which value for field_name you pass in.
2019-02-20 20:51:43 +01:00
Maxim Kurnikov
2bd018951b forms, generic views fixes 2019-02-20 22:24:26 +03:00
Maxim Kurnikov
14ea848dd7 add nested Meta inheritance support for forms 2019-02-20 21:52:28 +03:00
Maxim Kurnikov
2d3b5492f0 fix form errors in CI 2019-02-20 21:24:49 +03:00
Maxim Kurnikov
194258ab8e Merge pull request #23 from syastrov/better-types-for-transaction-atomic
Add better typings plus test for transaction.atomic.
2019-02-20 21:12:14 +03:00
Maxim Kurnikov
116aa2c539 clean up forms 2019-02-20 15:22:46 +03:00
Seth Yastrov
67c99434e5 Add better typings plus test for transaction.atomic.
- All cases are handled, including bare decorator (@transaction.atomic).
- Decorated function's signature is preserved when type-checking.
2019-02-20 06:40:22 +01:00
Maxim Kurnikov
5d8cdbcf29 fix integer set type 2019-02-20 02:38:45 +03:00
Maxim Kurnikov
78810f55b6 Merge pull request #26 from roderik333/supertype-processformview
*args and **kwargs changed from 'object' to 'str' and 'any' in post()…
2019-02-19 15:23:50 +03:00
Rune Steinnes
36662896bc *args and **kwargs changed from 'object' to 'str' and 'any' in post(), put() and get() 2019-02-19 12:48:07 +01:00
Maxim Kurnikov
e54dbb79c9 Merge pull request #24 from roderik333/replace-wsgirequest-in-loginrequiredmixin
Replaced WSGIRequest with http.HttpRequest in mixin:LoginRequiredMixin
2019-02-19 13:54:43 +03:00
Rune Steinnes
41f283552a Replaced WSGIRequest with http.HttpRequest in mixin:LoginRequiredMixin 2019-02-19 11:16:27 +01:00
Maxim Kurnikov
ab73d53ae5 add support for models defined in the same module be specified as name of class in related fields 2019-02-19 00:43:27 +03:00
Maxim Kurnikov
d24be4b35f add supported versions to README 2019-02-19 00:42:12 +03:00
Maxim Kurnikov
9d60b472df fix *args, **kwargs for views.generic.base 2019-02-18 15:45:01 +03:00
Maxim Kurnikov
632e063e22 back to incremental = True for tests 2019-02-18 02:16:13 +03:00
Maxim Kurnikov
66224416b5 bump version 2019-02-18 01:47:45 +03:00
Maxim Kurnikov
e5b2496eb5 update django tests sources to latest commit 2019-02-18 01:05:57 +03:00
Maxim Kurnikov
f980311be0 finish strict_optional support, enable it for typechecking of django tests 2019-02-18 00:52:56 +03:00
Maxim Kurnikov
400a0f0486 silence some false positives 2019-02-17 20:20:33 +03:00
Maxim Kurnikov
882ec71d23 remove redundant test 2019-02-17 18:08:58 +03:00
Maxim Kurnikov
e9f9202ed1 preliminary support for strict_optional 2019-02-17 18:07:53 +03:00
Maxim Kurnikov
6763217a80 some strict optional fixes 2019-02-16 21:28:37 +03:00
Maxim Kurnikov
6da5ead6f0 move to pypi version of pytest plugin 2019-02-15 22:01:35 +03:00
Maxim Kurnikov
c382d6aa2f fix redefining field with name id with different than int type 2019-02-15 21:54:40 +03:00
Maxim Kurnikov
63a14f7107 chmod +x 2019-02-15 20:06:13 +03:00
Maxim Kurnikov
dc33dd9493 fix setup.py definition 2019-02-15 20:03:55 +03:00
Maxim Kurnikov
4cb10390cf bump version 2019-02-14 03:34:49 +03:00
Maxim Kurnikov
c1640b619f fix stale import 2019-02-14 03:21:11 +03:00
Maxim Kurnikov
a08ad80a0d fix star import parsing for settings 2019-02-14 03:16:07 +03:00
Maxim Kurnikov
f30cd092f1 add default for MYPY_DJANGO_CONFIG 2019-02-13 23:02:49 +03:00
Maxim Kurnikov
dcd9ee0bb8 enable 'validation' test folder 2019-02-13 21:12:58 +03:00
Maxim Kurnikov
26a80a8279 add properly typed FOREIGN_KEY_FIELD_NAME_id fields to models 2019-02-13 21:05:02 +03:00
Maxim Kurnikov
82de0a8791 lint 2019-02-13 20:00:42 +03:00
Maxim Kurnikov
79ebe20f2e add more test folders 2019-02-13 19:44:25 +03:00
Maxim Kurnikov
587c2c484b more accurate types for from_queryset() 2019-02-13 17:55:50 +03:00
Maxim Kurnikov
4a22da29cb add support for default related managers, fixes #18 2019-02-13 17:11:22 +03:00
Maxim Kurnikov
70378b8f40 preserve fallback to Any for unrecognized field types for init/create 2019-02-13 17:00:35 +03:00
Maxim Kurnikov
b7f7713c5a add support for get_user_model(), fixes #16 2019-02-13 15:56:21 +03:00
Maxim Kurnikov
2720b74242 add proper generic support for get_object_or_404/get_list_or_404, fixes #22 2019-02-13 14:52:10 +03:00
Maxim Kurnikov
563c0add5e add release script 2019-02-13 14:36:33 +03:00
Maxim Kurnikov
3191740c6b bump version 2019-02-13 14:36:17 +03:00
213 changed files with 4491 additions and 3377 deletions

View File

@@ -4,20 +4,34 @@ dist: xenial
sudo: required sudo: required
jobs: jobs:
include: include:
- name: Typecheck Django test suite
python: 3.7
script: 'python ./scripts/typecheck_tests.py'
- name: Run plugin test suite with python 3.7 - name: Run plugin test suite with python 3.7
python: 3.7 python: 3.7
script: | script: |
set -e set -e
pytest pytest
- name: Run plugin test suite with python 3.6
python: 3.6
script: |
set -e
pytest
- name: Typecheck Django test suite
python: 3.7
script: 'python ./scripts/typecheck_tests.py'
- name: Lint with black - name: Lint with black
python: 3.7 python: 3.7
script: 'black --check --line-length=120 django-stubs/' script: 'black --check --line-length=120 django-stubs/'
- name: Lint plugin code with flake8
python: 3.7
script: 'flake8'
- name: Lint plugin code with isort
python: 3.7
script: 'isort --check'
before_install: | before_install: |
# Upgrade pip, setuptools, and wheel # Upgrade pip, setuptools, and wheel
pip install -U pip setuptools wheel pip install -U pip setuptools wheel

View File

@@ -7,6 +7,10 @@
This package contains type stubs and mypy plugin to provide more precise static types and type inference for Django framework. Django uses some Python "magic" that makes having precise types for some code patterns problematic. This is why we need to accompany the stubs with mypy plugins. The final goal is to be able to get precise types for most common patterns. This package contains type stubs and mypy plugin to provide more precise static types and type inference for Django framework. Django uses some Python "magic" that makes having precise types for some code patterns problematic. This is why we need to accompany the stubs with mypy plugins. The final goal is to be able to get precise types for most common patterns.
Supports Python 3.6/3.7, and Django 2.1.x series.
Could be run on earlier versions of Django, but expect some missing imports warnings.
## Installation ## Installation
``` ```
@@ -26,7 +30,7 @@ in your `mypy.ini` file.
## Configuration ## Configuration
In order to specify config file, set `MYPY_DJANGO_CONFIG` environment variable with path to the config file. In order to specify config file, set `MYPY_DJANGO_CONFIG` environment variable with path to the config file. Default is `./mypy_django.ini`
Config file format (.ini): Config file format (.ini):
``` ```

View File

@@ -1,3 +1,5 @@
black black
-e git+https://github.com/mkurnikov/pytest-mypy-plugins.git#egg=pytest-mypy-plugins pytest-mypy-plugins
flake8
isort==4.3.4
-e . -e .

View File

@@ -1,7 +1,12 @@
from typing import Any from typing import Any, NamedTuple
from .utils.version import get_version as get_version from .utils.version import get_version as get_version
VERSION: Any VERSION: Any
__version__: str __version__: str
def setup(set_prefix: bool = ...) -> None: ... def setup(set_prefix: bool = ...) -> None: ...
# Used by mypy_django_plugin when returning a QuerySet row that is a NamedTuple where the field names are unknown
class _NamedTupleAnyAttr(NamedTuple):
def __getattr__(self, item: str) -> Any: ...
def __setattr__(self, item: str, value: Any) -> None: ...

View File

@@ -12,7 +12,7 @@ class AppConfig:
verbose_name: str = ... verbose_name: str = ...
path: str = ... path: str = ...
models_module: None = ... models_module: None = ...
models: Optional[Dict[str, Type[Model]]] = ... models: Dict[str, Type[Model]] = ...
def __init__(self, app_name: str, app_module: Optional[Any]) -> None: ... def __init__(self, app_name: str, app_module: Optional[Any]) -> None: ...
@classmethod @classmethod
def create(cls, entry: str) -> AppConfig: ... def create(cls, entry: str) -> AppConfig: ...

View File

@@ -5,7 +5,7 @@ by the DJANGO_SETTINGS_MODULE environment variable.
# This is defined here as a do-nothing function because we can't import # This is defined here as a do-nothing function because we can't import
# django.utils.translation -- that module depends on the settings. # django.utils.translation -- that module depends on the settings.
from typing import Any, Dict, List, Optional, Pattern, Tuple, Protocol, Union, Callable, TYPE_CHECKING from typing import Any, Dict, List, Optional, Pattern, Tuple, Protocol, Union, Callable, TYPE_CHECKING, Sequence
#################### ####################
# CORE # # CORE #
@@ -377,7 +377,7 @@ CACHE_MIDDLEWARE_ALIAS = "default"
AUTH_USER_MODEL: str = ... AUTH_USER_MODEL: str = ...
AUTHENTICATION_BACKENDS: List[str] = ... AUTHENTICATION_BACKENDS: Sequence[str] = ...
LOGIN_URL = "/accounts/login/" LOGIN_URL = "/accounts/login/"

View File

@@ -1,25 +1,6 @@
from typing import Any
from django.apps import AppConfig from django.apps import AppConfig
class SimpleAdminConfig(AppConfig): class SimpleAdminConfig(AppConfig):
apps: None
label: str
models: None
models_module: None
module: Any
path: str
default_site: str = ... default_site: str = ...
name: str = ...
verbose_name: Any = ...
def ready(self) -> None: ...
class AdminConfig(SimpleAdminConfig): class AdminConfig(SimpleAdminConfig): ...
apps: None
label: str
models: None
models_module: None
module: Any
name: str
path: str
def ready(self) -> None: ...

View File

@@ -1,4 +1,4 @@
from typing import Any, Callable, Dict, List, Optional, Tuple, Type from typing import Any, Callable, Dict, List, Optional, Tuple, Type, Iterator
from django.contrib.admin.options import ModelAdmin from django.contrib.admin.options import ModelAdmin
from django.core.handlers.wsgi import WSGIRequest from django.core.handlers.wsgi import WSGIRequest
@@ -16,7 +16,7 @@ class ListFilter:
self, request: WSGIRequest, params: Dict[str, str], model: Type[Model], model_admin: ModelAdmin self, request: WSGIRequest, params: Dict[str, str], model: Type[Model], model_admin: ModelAdmin
) -> None: ... ) -> None: ...
def has_output(self) -> bool: ... def has_output(self) -> bool: ...
def choices(self, changelist: Any) -> None: ... def choices(self, changelist: Any) -> Optional[Iterator[Dict[str, Any]]]: ...
def queryset(self, request: Any, queryset: QuerySet) -> Optional[QuerySet]: ... def queryset(self, request: Any, queryset: QuerySet) -> Optional[QuerySet]: ...
def expected_parameters(self) -> Optional[List[str]]: ... def expected_parameters(self) -> Optional[List[str]]: ...

View File

@@ -1,33 +1,7 @@
from typing import Any, Dict
from django.contrib.auth.forms import AuthenticationForm, PasswordChangeForm from django.contrib.auth.forms import AuthenticationForm, PasswordChangeForm
from django.contrib.auth.models import User
class AdminAuthenticationForm(AuthenticationForm): class AdminAuthenticationForm(AuthenticationForm):
auto_id: str
data: Dict[str, str]
empty_permitted: bool
error_class: type
fields: Dict[Any, Any]
files: Dict[Any, Any]
initial: Dict[Any, Any]
is_bound: bool
label_suffix: str
request: None
user_cache: None
error_messages: Any = ...
required_css_class: str = ... required_css_class: str = ...
def confirm_login_allowed(self, user: User) -> None: ...
class AdminPasswordChangeForm(PasswordChangeForm): class AdminPasswordChangeForm(PasswordChangeForm):
auto_id: str
data: Dict[Any, Any]
empty_permitted: bool
error_class: type
fields: Dict[Any, Any]
files: Dict[Any, Any]
initial: Dict[Any, Any]
is_bound: bool
label_suffix: str
user: Any
required_css_class: str = ... required_css_class: str = ...

View File

@@ -1,27 +1,17 @@
import collections from typing import Any, Callable, Dict, Iterator, List, Optional, Tuple, Union
from typing import Any, Callable, Dict, Iterator, List, Optional, Tuple, Union, Type
from django import forms
from django.contrib.auth.forms import AdminPasswordChangeForm from django.contrib.auth.forms import AdminPasswordChangeForm
from django.db.models.fields import AutoField from django.forms.boundfield import BoundField
from django.forms.utils import ErrorDict, ErrorList from django.forms.utils import ErrorDict
from django.forms.widgets import Media, Widget from django.forms.widgets import Media, Widget
from django.utils.safestring import SafeText from django.utils.safestring import SafeText
from django.forms.boundfield import BoundField from django import forms
from django.db.models.fields import AutoField
ACTION_CHECKBOX_NAME: str ACTION_CHECKBOX_NAME: str
class ActionForm(forms.Form): class ActionForm(forms.Form):
auto_id: None
data: Dict[Any, Any]
empty_permitted: bool
error_class: Type[ErrorList]
fields: collections.OrderedDict
files: Dict[Any, Any]
initial: Dict[Any, Any]
is_bound: bool
label_suffix: str
action: Any = ... action: Any = ...
select_across: Any = ... select_across: Any = ...
@@ -36,8 +26,8 @@ class AdminForm:
form: AdminPasswordChangeForm, form: AdminPasswordChangeForm,
fieldsets: List[Tuple[None, Dict[str, List[str]]]], fieldsets: List[Tuple[None, Dict[str, List[str]]]],
prepopulated_fields: Dict[Any, Any], prepopulated_fields: Dict[Any, Any],
readonly_fields: None = ..., readonly_fields: Any = ...,
model_admin: None = ..., model_admin: Any = ...,
) -> None: ... ) -> None: ...
def __iter__(self) -> Iterator[Fieldset]: ... def __iter__(self) -> Iterator[Fieldset]: ...
@property @property
@@ -137,7 +127,6 @@ class InlineAdminFormSet:
class InlineAdminForm(AdminForm): class InlineAdminForm(AdminForm):
formset: Any = ... formset: Any = ...
model_admin: Any = ...
original: Any = ... original: Any = ...
show_url: Any = ... show_url: Any = ...
absolute_url: Any = ... absolute_url: Any = ...
@@ -152,7 +141,6 @@ class InlineAdminForm(AdminForm):
model_admin: Optional[Any] = ..., model_admin: Optional[Any] = ...,
view_on_site_url: Optional[Any] = ..., view_on_site_url: Optional[Any] = ...,
) -> None: ... ) -> None: ...
def __iter__(self) -> Iterator[InlineFieldset]: ...
def needs_explicit_pk_field(self) -> Union[bool, AutoField]: ... def needs_explicit_pk_field(self) -> Union[bool, AutoField]: ...
def pk_field(self) -> AdminField: ... def pk_field(self) -> AdminField: ...
def fk_field(self) -> AdminField: ... def fk_field(self) -> AdminField: ...
@@ -162,9 +150,6 @@ class InlineAdminForm(AdminForm):
class InlineFieldset(Fieldset): class InlineFieldset(Fieldset):
formset: Any = ... formset: Any = ...
def __init__(self, formset: Any, *args: Any, **kwargs: Any) -> None: ... def __init__(self, formset: Any, *args: Any, **kwargs: Any) -> None: ...
def __iter__(self) -> Iterator[Fieldline]: ...
class AdminErrorList(forms.utils.ErrorList): class AdminErrorList(forms.utils.ErrorList):
data: List[Any]
error_class: str
def __init__(self, form: Any, inline_formsets: Any) -> None: ... def __init__(self, form: Any, inline_formsets: Any) -> None: ...

View File

@@ -25,7 +25,7 @@ class LogEntryManager(models.Manager["LogEntry"]):
class LogEntry(models.Model): class LogEntry(models.Model):
action_time: models.DateTimeField = ... action_time: models.DateTimeField = ...
user: models.ForeignKey = ... user: models.ForeignKey = ...
content_type: models.ForeignKey[ContentType] = ... content_type: models.ForeignKey = models.ForeignKey(ContentType, on_delete=models.CASCADE)
object_id: models.TextField = ... object_id: models.TextField = ...
object_repr: models.CharField = ... object_repr: models.CharField = ...
action_flag: models.PositiveSmallIntegerField = ... action_flag: models.PositiveSmallIntegerField = ...

View File

@@ -1,5 +1,5 @@
from collections import OrderedDict from collections import OrderedDict
from typing import Any, Callable, Dict, List, Optional, Sequence, Set, Tuple, Type, Union, Iterator from typing import Any, Callable, Dict, Iterator, List, Optional, Sequence, Set, Tuple, Type, Union
from django.contrib.admin.filters import ListFilter from django.contrib.admin.filters import ListFilter
from django.contrib.admin.models import LogEntry from django.contrib.admin.models import LogEntry
@@ -8,7 +8,6 @@ from django.contrib.admin.views.main import ChangeList
from django.contrib.auth.forms import AdminPasswordChangeForm from django.contrib.auth.forms import AdminPasswordChangeForm
from django.contrib.contenttypes.models import ContentType from django.contrib.contenttypes.models import ContentType
from django.core.checks.messages import Error from django.core.checks.messages import Error
from django.core.handlers.wsgi import WSGIRequest
from django.core.paginator import Paginator from django.core.paginator import Paginator
from django.db.models.base import Model from django.db.models.base import Model
from django.db.models.fields.related import ForeignKey, ManyToManyField, RelatedField from django.db.models.fields.related import ForeignKey, ManyToManyField, RelatedField
@@ -17,12 +16,13 @@ from django.db.models.query import QuerySet
from django.forms.fields import TypedChoiceField from django.forms.fields import TypedChoiceField
from django.forms.models import ModelChoiceField, ModelMultipleChoiceField from django.forms.models import ModelChoiceField, ModelMultipleChoiceField
from django.forms.widgets import Media from django.forms.widgets import Media
from django.http.request import HttpRequest
from django.http.response import HttpResponse, HttpResponseBase, HttpResponseRedirect, JsonResponse from django.http.response import HttpResponse, HttpResponseBase, HttpResponseRedirect, JsonResponse
from django.template.response import TemplateResponse
from django.urls.resolvers import URLPattern from django.urls.resolvers import URLPattern
from django.utils.safestring import SafeText from django.utils.safestring import SafeText
from django.db.models.fields import Field from django.db.models.fields import Field
from django.template.response import TemplateResponse
IS_POPUP_VAR: str IS_POPUP_VAR: str
TO_FIELD_VAR: str TO_FIELD_VAR: str
@@ -57,40 +57,46 @@ class BaseModelAdmin:
checks_class: Any = ... checks_class: Any = ...
def check(self, **kwargs: Any) -> List[Union[str, Error]]: ... def check(self, **kwargs: Any) -> List[Union[str, Error]]: ...
def __init__(self) -> None: ... def __init__(self) -> None: ...
def formfield_for_dbfield(self, db_field: Field, request: WSGIRequest, **kwargs: Any) -> Optional[Field]: ... def formfield_for_dbfield(
def formfield_for_choice_field(self, db_field: Field, request: WSGIRequest, **kwargs: Any) -> TypedChoiceField: ... self, db_field: Field, request: Optional[HttpRequest], **kwargs: Any
def get_field_queryset(self, db: None, db_field: RelatedField, request: WSGIRequest) -> Optional[QuerySet]: ... ) -> Optional[Field]: ...
def formfield_for_choice_field(
self, db_field: Field, request: Optional[HttpRequest], **kwargs: Any
) -> TypedChoiceField: ...
def get_field_queryset(
self, db: None, db_field: RelatedField, request: Optional[HttpRequest]
) -> Optional[QuerySet]: ...
def formfield_for_foreignkey( def formfield_for_foreignkey(
self, db_field: ForeignKey, request: WSGIRequest, **kwargs: Any self, db_field: ForeignKey, request: Optional[HttpRequest], **kwargs: Any
) -> Optional[ModelChoiceField]: ... ) -> Optional[ModelChoiceField]: ...
def formfield_for_manytomany( def formfield_for_manytomany(
self, db_field: ManyToManyField, request: WSGIRequest, **kwargs: Any self, db_field: ManyToManyField, request: Optional[HttpRequest], **kwargs: Any
) -> ModelMultipleChoiceField: ... ) -> ModelMultipleChoiceField: ...
def get_autocomplete_fields(self, request: WSGIRequest) -> Tuple: ... def get_autocomplete_fields(self, request: HttpRequest) -> Tuple: ...
def get_view_on_site_url(self, obj: Optional[Model] = ...) -> Optional[str]: ... def get_view_on_site_url(self, obj: Optional[Model] = ...) -> Optional[str]: ...
def get_empty_value_display(self) -> SafeText: ... def get_empty_value_display(self) -> SafeText: ...
def get_exclude(self, request: WSGIRequest, obj: Optional[Model] = ...) -> Any: ... def get_exclude(self, request: HttpRequest, obj: Optional[Model] = ...) -> Any: ...
def get_fields(self, request: WSGIRequest, obj: Optional[Model] = ...) -> Sequence[Union[Callable, str]]: ... def get_fields(self, request: HttpRequest, obj: Optional[Model] = ...) -> Sequence[Union[Callable, str]]: ...
def get_fieldsets( def get_fieldsets(
self, request: WSGIRequest, obj: Optional[Model] = ... self, request: HttpRequest, obj: Optional[Model] = ...
) -> List[Tuple[Optional[str], Dict[str, Any]]]: ... ) -> List[Tuple[Optional[str], Dict[str, Any]]]: ...
def get_ordering(self, request: WSGIRequest) -> Union[List[str], Tuple]: ... def get_ordering(self, request: HttpRequest) -> Union[List[str], Tuple]: ...
def get_readonly_fields(self, request: WSGIRequest, obj: Optional[Model] = ...) -> Union[List[str], Tuple]: ... def get_readonly_fields(self, request: HttpRequest, obj: Optional[Model] = ...) -> Union[List[str], Tuple]: ...
def get_prepopulated_fields(self, request: WSGIRequest, obj: Optional[Model] = ...) -> Dict[str, Tuple[str]]: ... def get_prepopulated_fields(self, request: HttpRequest, obj: Optional[Model] = ...) -> Dict[str, Tuple[str]]: ...
def get_queryset(self, request: WSGIRequest) -> QuerySet: ... def get_queryset(self, request: HttpRequest) -> QuerySet: ...
def get_sortable_by(self, request: WSGIRequest) -> Union[List[Callable], List[str], Tuple]: ... def get_sortable_by(self, request: HttpRequest) -> Union[List[Callable], List[str], Tuple]: ...
def lookup_allowed(self, lookup: str, value: str) -> bool: ... def lookup_allowed(self, lookup: str, value: str) -> bool: ...
def to_field_allowed(self, request: WSGIRequest, to_field: str) -> bool: ... def to_field_allowed(self, request: HttpRequest, to_field: str) -> bool: ...
def has_add_permission(self, request: WSGIRequest, obj: Optional[Model] = ...) -> bool: ... def has_add_permission(self, request: HttpRequest, obj: Optional[Model] = ...) -> bool: ...
def has_change_permission(self, request: WSGIRequest, obj: Optional[Model] = ...) -> bool: ... def has_change_permission(self, request: HttpRequest, obj: Optional[Model] = ...) -> bool: ...
def has_delete_permission(self, request: WSGIRequest, obj: Optional[Model] = ...) -> bool: ... def has_delete_permission(self, request: HttpRequest, obj: Optional[Model] = ...) -> bool: ...
def has_view_permission(self, request: WSGIRequest, obj: Optional[Model] = ...) -> bool: ... def has_view_permission(self, request: HttpRequest, obj: Optional[Model] = ...) -> bool: ...
def has_module_permission(self, request: WSGIRequest) -> bool: ... def has_module_permission(self, request: HttpRequest) -> bool: ...
class ModelAdmin(BaseModelAdmin): class ModelAdmin(BaseModelAdmin):
formfield_overrides: Any formfield_overrides: Any
list_display: Sequence[Union[str, Callable]] = ... list_display: Sequence[Union[str, Callable]] = ...
list_display_links: Sequence[Union[str, Callable]] = ... list_display_links: Optional[Sequence[Union[str, Callable]]] = ...
list_filter: Sequence[Union[str, Type[ListFilter], Tuple[str, Type[ListFilter]]]] = ... list_filter: Sequence[Union[str, Type[ListFilter], Tuple[str, Type[ListFilter]]]] = ...
list_select_related: Union[bool, Sequence[str]] = ... list_select_related: Union[bool, Sequence[str]] = ...
list_per_page: int = ... list_per_page: int = ...
@@ -121,54 +127,54 @@ class ModelAdmin(BaseModelAdmin):
opts: Options = ... opts: Options = ...
admin_site: AdminSite = ... admin_site: AdminSite = ...
def __init__(self, model: Type[Model], admin_site: Optional[AdminSite]) -> None: ... def __init__(self, model: Type[Model], admin_site: Optional[AdminSite]) -> None: ...
def get_inline_instances(self, request: WSGIRequest, obj: Optional[Model] = ...) -> List[InlineModelAdmin]: ... def get_inline_instances(self, request: HttpRequest, obj: Optional[Model] = ...) -> List[InlineModelAdmin]: ...
def get_urls(self) -> List[URLPattern]: ... def get_urls(self) -> List[URLPattern]: ...
@property @property
def urls(self) -> List[URLPattern]: ... def urls(self) -> List[URLPattern]: ...
@property @property
def media(self) -> Media: ... def media(self) -> Media: ...
def get_model_perms(self, request: WSGIRequest) -> Dict[str, bool]: ... def get_model_perms(self, request: HttpRequest) -> Dict[str, bool]: ...
def get_form(self, request: Any, obj: Optional[Any] = ..., change: bool = ..., **kwargs: Any): ... def get_form(self, request: Any, obj: Optional[Any] = ..., change: bool = ..., **kwargs: Any): ...
def get_changelist(self, request: WSGIRequest, **kwargs: Any) -> Type[ChangeList]: ... def get_changelist(self, request: HttpRequest, **kwargs: Any) -> Type[ChangeList]: ...
def get_changelist_instance(self, request: WSGIRequest) -> ChangeList: ... def get_changelist_instance(self, request: HttpRequest) -> ChangeList: ...
def get_object(self, request: WSGIRequest, object_id: str, from_field: None = ...) -> Optional[Model]: ... def get_object(self, request: HttpRequest, object_id: str, from_field: None = ...) -> Optional[Model]: ...
def get_changelist_form(self, request: Any, **kwargs: Any): ... def get_changelist_form(self, request: Any, **kwargs: Any): ...
def get_changelist_formset(self, request: Any, **kwargs: Any): ... def get_changelist_formset(self, request: Any, **kwargs: Any): ...
def get_formsets_with_inlines(self, request: WSGIRequest, obj: Optional[Model] = ...) -> Iterator[Any]: ... def get_formsets_with_inlines(self, request: HttpRequest, obj: Optional[Model] = ...) -> Iterator[Any]: ...
def get_paginator( def get_paginator(
self, self,
request: WSGIRequest, request: HttpRequest,
queryset: QuerySet, queryset: QuerySet,
per_page: int, per_page: int,
orphans: int = ..., orphans: int = ...,
allow_empty_first_page: bool = ..., allow_empty_first_page: bool = ...,
) -> Paginator: ... ) -> Paginator: ...
def log_addition(self, request: WSGIRequest, object: Model, message: Any) -> LogEntry: ... def log_addition(self, request: HttpRequest, object: Model, message: Any) -> LogEntry: ...
def log_change(self, request: WSGIRequest, object: Model, message: Any) -> LogEntry: ... def log_change(self, request: HttpRequest, object: Model, message: Any) -> LogEntry: ...
def log_deletion(self, request: WSGIRequest, object: Model, object_repr: str) -> LogEntry: ... def log_deletion(self, request: HttpRequest, object: Model, object_repr: str) -> LogEntry: ...
def action_checkbox(self, obj: Model) -> SafeText: ... def action_checkbox(self, obj: Model) -> SafeText: ...
def get_actions(self, request: WSGIRequest) -> OrderedDict: ... def get_actions(self, request: HttpRequest) -> OrderedDict: ...
def get_action_choices( def get_action_choices(
self, request: WSGIRequest, default_choices: List[Tuple[str, str]] = ... self, request: HttpRequest, default_choices: List[Tuple[str, str]] = ...
) -> List[Tuple[str, str]]: ... ) -> List[Tuple[str, str]]: ...
def get_action(self, action: Union[Callable, str]) -> Tuple[Callable, str, str]: ... def get_action(self, action: Union[Callable, str]) -> Tuple[Callable, str, str]: ...
def get_list_display(self, request: WSGIRequest) -> Sequence[str]: ... def get_list_display(self, request: HttpRequest) -> Sequence[str]: ...
def get_list_display_links(self, request: WSGIRequest, list_display: Sequence[str]) -> Optional[Sequence[str]]: ... def get_list_display_links(self, request: HttpRequest, list_display: Sequence[str]) -> Optional[Sequence[str]]: ...
def get_list_filter(self, request: WSGIRequest) -> Sequence[str]: ... def get_list_filter(self, request: HttpRequest) -> Sequence[str]: ...
def get_list_select_related(self, request: WSGIRequest) -> Sequence[str]: ... def get_list_select_related(self, request: HttpRequest) -> Sequence[str]: ...
def get_search_fields(self, request: WSGIRequest) -> List[str]: ... def get_search_fields(self, request: HttpRequest) -> List[str]: ...
def get_search_results( def get_search_results(
self, request: WSGIRequest, queryset: QuerySet, search_term: str self, request: HttpRequest, queryset: QuerySet, search_term: str
) -> Tuple[QuerySet, bool]: ... ) -> Tuple[QuerySet, bool]: ...
def get_preserved_filters(self, request: WSGIRequest) -> str: ... def get_preserved_filters(self, request: HttpRequest) -> str: ...
def _get_edited_object_pks(self, request: WSGIRequest, prefix: str) -> List[str]: ... def _get_edited_object_pks(self, request: HttpRequest, prefix: str) -> List[str]: ...
def _get_list_editable_queryset(self, request: WSGIRequest, prefix: str) -> QuerySet: ... def _get_list_editable_queryset(self, request: HttpRequest, prefix: str) -> QuerySet: ...
def construct_change_message( def construct_change_message(
self, request: WSGIRequest, form: AdminPasswordChangeForm, formsets: None, add: bool = ... self, request: HttpRequest, form: AdminPasswordChangeForm, formsets: None, add: bool = ...
) -> List[Dict[str, Dict[str, List[str]]]]: ... ) -> List[Dict[str, Dict[str, List[str]]]]: ...
def message_user( def message_user(
self, self,
request: WSGIRequest, request: HttpRequest,
message: str, message: str,
level: Union[int, str] = ..., level: Union[int, str] = ...,
extra_tags: str = ..., extra_tags: str = ...,
@@ -176,8 +182,8 @@ class ModelAdmin(BaseModelAdmin):
) -> None: ... ) -> None: ...
def save_form(self, request: Any, form: Any, change: Any): ... def save_form(self, request: Any, form: Any, change: Any): ...
def save_model(self, request: Any, obj: Any, form: Any, change: Any) -> None: ... def save_model(self, request: Any, obj: Any, form: Any, change: Any) -> None: ...
def delete_model(self, request: WSGIRequest, obj: Model) -> None: ... def delete_model(self, request: HttpRequest, obj: Model) -> None: ...
def delete_queryset(self, request: WSGIRequest, queryset: QuerySet) -> None: ... def delete_queryset(self, request: HttpRequest, queryset: QuerySet) -> None: ...
def save_formset(self, request: Any, form: Any, formset: Any, change: Any) -> None: ... def save_formset(self, request: Any, form: Any, formset: Any, change: Any) -> None: ...
def save_related(self, request: Any, form: Any, formsets: Any, change: Any) -> None: ... def save_related(self, request: Any, form: Any, formsets: Any, change: Any) -> None: ...
def render_change_form( def render_change_form(
@@ -190,52 +196,51 @@ class ModelAdmin(BaseModelAdmin):
obj: Optional[Any] = ..., obj: Optional[Any] = ...,
): ... ): ...
def response_add( def response_add(
self, request: WSGIRequest, obj: Model, post_url_continue: Optional[str] = ... self, request: HttpRequest, obj: Model, post_url_continue: Optional[str] = ...
) -> HttpResponse: ... ) -> HttpResponse: ...
def response_change(self, request: WSGIRequest, obj: Model) -> HttpResponse: ... def response_change(self, request: HttpRequest, obj: Model) -> HttpResponse: ...
def response_post_save_add(self, request: WSGIRequest, obj: Model) -> HttpResponseRedirect: ... def response_post_save_add(self, request: HttpRequest, obj: Model) -> HttpResponseRedirect: ...
def response_post_save_change(self, request: WSGIRequest, obj: Model) -> HttpResponseRedirect: ... def response_post_save_change(self, request: HttpRequest, obj: Model) -> HttpResponseRedirect: ...
def response_action(self, request: WSGIRequest, queryset: QuerySet) -> Optional[HttpResponseBase]: ... def response_action(self, request: HttpRequest, queryset: QuerySet) -> Optional[HttpResponseBase]: ...
def response_delete(self, request: WSGIRequest, obj_display: str, obj_id: int) -> HttpResponse: ... def response_delete(self, request: HttpRequest, obj_display: str, obj_id: int) -> HttpResponse: ...
def render_delete_form(self, request: Any, context: Any): ... def render_delete_form(self, request: Any, context: Any): ...
def get_inline_formsets( def get_inline_formsets(
self, request: WSGIRequest, formsets: List[Any], inline_instances: List[Any], obj: Optional[Model] = ... self, request: HttpRequest, formsets: List[Any], inline_instances: List[Any], obj: Optional[Model] = ...
) -> List[Any]: ... ) -> List[Any]: ...
def get_changeform_initial_data(self, request: WSGIRequest) -> Dict[str, str]: ... def get_changeform_initial_data(self, request: HttpRequest) -> Dict[str, str]: ...
def changeform_view( def changeform_view(
self, self,
request: WSGIRequest, request: HttpRequest,
object_id: Optional[str] = ..., object_id: Optional[str] = ...,
form_url: str = ..., form_url: str = ...,
extra_context: Optional[Dict[str, bool]] = ..., extra_context: Optional[Dict[str, bool]] = ...,
) -> Any: ... ) -> Any: ...
def autocomplete_view(self, request: WSGIRequest) -> JsonResponse: ... def autocomplete_view(self, request: HttpRequest) -> JsonResponse: ...
def add_view(self, request: WSGIRequest, form_url: str = ..., extra_context: None = ...) -> HttpResponse: ... def add_view(self, request: HttpRequest, form_url: str = ..., extra_context: None = ...) -> HttpResponse: ...
def change_view( def change_view(
self, request: WSGIRequest, object_id: str, form_url: str = ..., extra_context: Optional[Dict[str, bool]] = ... self, request: HttpRequest, object_id: str, form_url: str = ..., extra_context: Optional[Dict[str, bool]] = ...
) -> HttpResponse: ... ) -> HttpResponse: ...
def changelist_view( def changelist_view(
self, request: WSGIRequest, extra_context: Optional[Dict[str, str]] = ... self, request: HttpRequest, extra_context: Optional[Dict[str, str]] = ...
) -> TemplateResponse: ... ) -> TemplateResponse: ...
def get_deleted_objects( def get_deleted_objects(
self, objs: QuerySet, request: WSGIRequest self, objs: QuerySet, request: HttpRequest
) -> Tuple[List[Any], Dict[Any, Any], Set[Any], List[Any]]: ... ) -> Tuple[List[Any], Dict[Any, Any], Set[Any], List[Any]]: ...
def delete_view(self, request: WSGIRequest, object_id: str, extra_context: None = ...) -> Any: ... def delete_view(self, request: HttpRequest, object_id: str, extra_context: None = ...) -> Any: ...
def history_view(self, request: WSGIRequest, object_id: str, extra_context: None = ...) -> HttpResponse: ... def history_view(self, request: HttpRequest, object_id: str, extra_context: None = ...) -> HttpResponse: ...
class InlineModelAdmin(BaseModelAdmin): class InlineModelAdmin(BaseModelAdmin):
model: Any = ... model: Any = ...
fk_name: Any = ... fk_name: Any = ...
formset: Any = ... formset: Any = ...
extra: int = ... extra: int = ...
min_num: Any = ... min_num: Optional[int] = ...
max_num: Any = ... max_num: Optional[int] = ...
template: Any = ... template: str = ...
verbose_name: Any = ... verbose_name: Optional[str] = ...
verbose_name_plural: Any = ... verbose_name_plural: Optional[str] = ...
can_delete: bool = ... can_delete: bool = ...
show_change_link: bool = ... show_change_link: bool = ...
checks_class: Any = ...
classes: Any = ... classes: Any = ...
admin_site: Any = ... admin_site: Any = ...
parent_model: Any = ... parent_model: Any = ...
@@ -244,18 +249,10 @@ class InlineModelAdmin(BaseModelAdmin):
def __init__(self, parent_model: Union[Type[Model], Model], admin_site: AdminSite) -> None: ... def __init__(self, parent_model: Union[Type[Model], Model], admin_site: AdminSite) -> None: ...
@property @property
def media(self) -> Media: ... def media(self) -> Media: ...
def get_extra(self, request: WSGIRequest, obj: Optional[Model] = ..., **kwargs: Any) -> int: ... def get_extra(self, request: HttpRequest, obj: Optional[Model] = ..., **kwargs: Any) -> int: ...
def get_min_num(self, request: WSGIRequest, obj: Optional[Model] = ..., **kwargs: Any) -> None: ... def get_min_num(self, request: HttpRequest, obj: Optional[Model] = ..., **kwargs: Any) -> Optional[int]: ...
def get_max_num(self, request: WSGIRequest, obj: Optional[Model] = ..., **kwargs: Any) -> Optional[int]: ... def get_max_num(self, request: HttpRequest, obj: Optional[Model] = ..., **kwargs: Any) -> Optional[int]: ...
fields: Any = ...
def get_formset(self, request: Any, obj: Optional[Any] = ..., **kwargs: Any): ... def get_formset(self, request: Any, obj: Optional[Any] = ..., **kwargs: Any): ...
def get_queryset(self, request: WSGIRequest) -> QuerySet: ...
def has_change_permission(self, request: WSGIRequest, obj: Optional[Model] = ...) -> bool: ...
def has_delete_permission(self, request: WSGIRequest, obj: Optional[Model] = ...) -> bool: ...
def has_view_permission(self, request: WSGIRequest, obj: Optional[Model] = ...) -> bool: ...
class StackedInline(InlineModelAdmin): class StackedInline(InlineModelAdmin): ...
template: str = ... class TabularInline(InlineModelAdmin): ...
class TabularInline(InlineModelAdmin):
template: str = ...

View File

@@ -43,7 +43,7 @@ class NestedObjects(Collector):
def add_edge(self, source: Optional[Model], target: Model) -> None: ... def add_edge(self, source: Optional[Model], target: Model) -> None: ...
def collect( def collect(
self, self,
objs: Union[Sequence[Model], QuerySet], objs: Union[Sequence[Optional[Model]], QuerySet],
source: Optional[Type[Model]] = ..., source: Optional[Type[Model]] = ...,
source_attr: Optional[str] = ..., source_attr: Optional[str] = ...,
**kwargs: Any **kwargs: Any

View File

@@ -1,18 +1,10 @@
from typing import Any, Optional from typing import Any
from django.contrib.admin.options import ModelAdmin
from django.core.handlers.wsgi import WSGIRequest from django.core.handlers.wsgi import WSGIRequest
from django.core.paginator import Paginator
from django.db.models.query import QuerySet
from django.http.response import JsonResponse
from django.views.generic.list import BaseListView from django.views.generic.list import BaseListView
class AutocompleteJsonView(BaseListView): class AutocompleteJsonView(BaseListView):
paginate_by: int = ...
model_admin: ModelAdmin = ... model_admin: ModelAdmin = ...
term: Any = ... term: Any = ...
paginator_class: Any = ...
object_list: Any = ...
def get(self, request: WSGIRequest, *args: Any, **kwargs: Any) -> JsonResponse: ...
def get_paginator(self, *args: Any, **kwargs: Any) -> Paginator: ...
def get_queryset(self) -> QuerySet: ...
def has_perm(self, request: WSGIRequest, obj: None = ...) -> bool: ... def has_perm(self, request: WSGIRequest, obj: None = ...) -> bool: ...

View File

@@ -1,18 +1,12 @@
from collections import OrderedDict from typing import Any, Dict, List, Optional, Set, Tuple, Union
from datetime import datetime
from typing import Any, Callable, Dict, List, Optional, Set, Tuple, Union
from uuid import UUID from uuid import UUID
from django.contrib.admin.sites import AdminSite
from django.db.models.fields.reverse_related import ForeignObjectRel, ManyToOneRel
from django.forms.models import ModelChoiceIterator from django.forms.models import ModelChoiceIterator
from django.forms.widgets import ChoiceWidget, Media
from django import forms from django import forms
from django.contrib.admin.sites import AdminSite
from django.db.models.fields.reverse_related import ForeignObjectRel, ManyToOneRel, ManyToManyRel
from django.db.models.query_utils import Q
from django.forms.fields import Field
from django.forms.widgets import ChoiceWidget, Media, Widget, DateTimeBaseInput
from django.http.request import QueryDict
from django.utils.datastructures import MultiValueDict
class FilteredSelectMultiple(forms.SelectMultiple): class FilteredSelectMultiple(forms.SelectMultiple):
@property @property
@@ -20,109 +14,34 @@ class FilteredSelectMultiple(forms.SelectMultiple):
verbose_name: Any = ... verbose_name: Any = ...
is_stacked: Any = ... is_stacked: Any = ...
def __init__(self, verbose_name: str, is_stacked: bool, attrs: None = ..., choices: Tuple = ...) -> None: ... def __init__(self, verbose_name: str, is_stacked: bool, attrs: None = ..., choices: Tuple = ...) -> None: ...
def get_context(
self, name: str, value: Union[List[Any], str], attrs: Optional[Dict[str, str]]
) -> Dict[
str,
Union[
Dict[
str,
Union[
Dict[str, Union[int, str]],
List[Tuple[None, List[Dict[str, Union[Dict[Any, Any], int, str]]], int]],
bool,
str,
],
],
Dict[str, Union[Dict[str, Union[int, str]], List[str], bool, str]],
],
]: ...
class AdminDateWidget(forms.DateInput): class AdminDateWidget(forms.DateInput):
attrs: Dict[str, str]
input_type: str
@property @property
def media(self) -> Media: ... def media(self) -> Media: ...
def __init__(self, attrs: Optional[Dict[str, Union[int, str]]] = ..., format: None = ...) -> None: ...
class AdminTimeWidget(forms.TimeInput): class AdminTimeWidget(forms.TimeInput):
attrs: Dict[str, str]
input_type: str
@property @property
def media(self) -> Media: ... def media(self) -> Media: ...
def __init__(self, attrs: Optional[Dict[str, Union[int, str]]] = ..., format: None = ...) -> None: ...
class AdminSplitDateTime(forms.SplitDateTimeWidget): class AdminSplitDateTime(forms.SplitDateTimeWidget): ...
attrs: Dict[Any, Any] class AdminRadioSelect(forms.RadioSelect): ...
widgets: List[DateTimeBaseInput] class AdminFileWidget(forms.ClearableFileInput): ...
template_name: str = ...
def __init__(self, attrs: None = ...) -> None: ...
def get_context(
self, name: str, value: Optional[Union[List[str], datetime]], attrs: Optional[Dict[str, Union[bool, str]]]
) -> Dict[
str,
Union[
Dict[
str,
Optional[
Union[
Dict[str, Union[bool, str]],
List[Dict[str, Optional[Union[Dict[str, Union[bool, str]], bool, str]]]],
bool,
str,
]
],
],
str,
],
]: ...
class AdminRadioSelect(forms.RadioSelect): def url_params_from_lookup_dict(lookups: Any) -> Dict[str, str]: ...
attrs: Dict[str, str]
template_name: str = ...
class AdminFileWidget(forms.ClearableFileInput):
attrs: Dict[Any, Any]
template_name: str = ...
def url_params_from_lookup_dict(
lookups: Union[
Dict[str, Callable], Dict[str, List[str]], Dict[str, Tuple[str, str]], Dict[str, bool], Dict[str, str], Q
]
) -> Dict[str, str]: ...
class ForeignKeyRawIdWidget(forms.TextInput): class ForeignKeyRawIdWidget(forms.TextInput):
attrs: Dict[Any, Any]
template_name: str = ...
rel: ManyToOneRel = ... rel: ManyToOneRel = ...
admin_site: AdminSite = ... admin_site: AdminSite = ...
db: None = ... db: None = ...
def __init__(self, rel: ForeignObjectRel, admin_site: AdminSite, attrs: None = ..., using: None = ...) -> None: ... def __init__(self, rel: ForeignObjectRel, admin_site: AdminSite, attrs: None = ..., using: None = ...) -> None: ...
def get_context(
self, name: str, value: Optional[Union[List[int], int, str, UUID]], attrs: Optional[Dict[str, Union[bool, str]]]
) -> Dict[str, Union[Dict[str, Optional[Union[Dict[str, Union[bool, str]], bool, str]]], str]]: ...
def base_url_parameters(self) -> Dict[str, str]: ... def base_url_parameters(self) -> Dict[str, str]: ...
def url_parameters(self) -> Dict[str, str]: ... def url_parameters(self) -> Dict[str, str]: ...
def label_and_url_for_value(self, value: Union[int, str, UUID]) -> Tuple[str, str]: ... def label_and_url_for_value(self, value: Union[int, str, UUID]) -> Tuple[str, str]: ...
class ManyToManyRawIdWidget(ForeignKeyRawIdWidget): class ManyToManyRawIdWidget(ForeignKeyRawIdWidget): ...
admin_site: AdminSite
attrs: Dict[Any, Any]
db: None
rel: ManyToManyRel
template_name: str = ...
def get_context(
self, name: str, value: Optional[List[int]], attrs: Optional[Dict[str, str]]
) -> Dict[str, Union[Dict[str, Union[Dict[str, str], bool, str]], str]]: ...
def url_parameters(self) -> Dict[Any, Any]: ...
def label_and_url_for_value(self, value: List[int]) -> Tuple[str, str]: ...
def value_from_datadict(self, data: QueryDict, files: MultiValueDict, name: str) -> None: ...
def format_value(self, value: Optional[List[int]]) -> str: ...
class RelatedFieldWidgetWrapper(forms.Widget): class RelatedFieldWidgetWrapper(forms.Widget):
template_name: str = ... template_name: str = ...
needs_multipart_form: bool = ...
attrs: Dict[Any, Any] = ...
choices: ModelChoiceIterator = ... choices: ModelChoiceIterator = ...
widget: AutocompleteSelect = ... widget: AutocompleteSelect = ...
rel: ManyToOneRel = ... rel: ManyToOneRel = ...
@@ -141,54 +60,19 @@ class RelatedFieldWidgetWrapper(forms.Widget):
can_delete_related: bool = ..., can_delete_related: bool = ...,
can_view_related: bool = ..., can_view_related: bool = ...,
) -> None: ... ) -> None: ...
def __deepcopy__(
self, memo: Dict[int, Union[List[Union[Field, Widget]], OrderedDict, Field, Widget]]
) -> RelatedFieldWidgetWrapper: ...
@property
def is_hidden(self) -> bool: ...
@property @property
def media(self) -> Media: ... def media(self) -> Media: ...
def get_related_url(self, info: Tuple[str, str], action: str, *args: Any) -> str: ... def get_related_url(self, info: Tuple[str, str], action: str, *args: Any) -> str: ...
def get_context(
self, name: str, value: Optional[Union[int, str]], attrs: Optional[Dict[str, Union[bool, str]]]
) -> Dict[str, Union[bool, str]]: ...
def value_from_datadict(
self, data: QueryDict, files: MultiValueDict, name: str
) -> Optional[Union[List[str], str]]: ...
def value_omitted_from_data(self, data: Dict[Any, Any], files: Dict[Any, Any], name: str) -> bool: ...
def id_for_label(self, id_: str) -> str: ...
class AdminTextareaWidget(forms.Textarea): class AdminTextareaWidget(forms.Textarea): ...
attrs: Dict[str, str] class AdminTextInputWidget(forms.TextInput): ...
def __init__(self, attrs: None = ...) -> None: ... class AdminEmailInputWidget(forms.EmailInput): ...
class AdminURLFieldWidget(forms.URLInput): ...
class AdminTextInputWidget(forms.TextInput):
attrs: Dict[str, str]
input_type: str
def __init__(self, attrs: None = ...) -> None: ...
class AdminEmailInputWidget(forms.EmailInput):
attrs: Dict[str, str]
input_type: str
def __init__(self, attrs: None = ...) -> None: ...
class AdminURLFieldWidget(forms.URLInput):
attrs: Dict[str, str]
input_type: str
template_name: str = ...
def __init__(self, attrs: None = ...) -> None: ...
def get_context(
self, name: str, value: Optional[str], attrs: Optional[Dict[str, str]]
) -> Dict[str, Union[Dict[str, Optional[Union[Dict[str, str], bool, str]]], str]]: ...
class AdminIntegerFieldWidget(forms.NumberInput): class AdminIntegerFieldWidget(forms.NumberInput):
attrs: Dict[str, str]
input_type: str
class_name: str = ... class_name: str = ...
def __init__(self, attrs: None = ...) -> None: ...
class AdminBigIntegerFieldWidget(AdminIntegerFieldWidget): class AdminBigIntegerFieldWidget(AdminIntegerFieldWidget): ...
class_name: str = ...
SELECT2_TRANSLATIONS: Any SELECT2_TRANSLATIONS: Any
@@ -208,12 +92,6 @@ class AutocompleteMixin:
using: None = ..., using: None = ...,
) -> None: ... ) -> None: ...
def get_url(self) -> str: ... def get_url(self) -> str: ...
def build_attrs(
self, base_attrs: Dict[str, str], extra_attrs: Optional[Dict[str, Union[bool, str]]] = ...
) -> Dict[str, Union[bool, str]]: ...
def optgroups(
self, name: str, value: List[str], attr: Dict[str, Union[bool, str]] = ...
) -> List[Tuple[None, List[Dict[str, Union[Dict[str, bool], Set[str], int, str]]], int]]: ...
@property @property
def media(self) -> Media: ... def media(self) -> Media: ...

View File

@@ -1,54 +1,18 @@
from typing import Any, Dict, List, Optional, Tuple, Type from typing import Any
from django.contrib.auth.models import User, Group
from django.core.handlers.wsgi import WSGIRequest from django.core.handlers.wsgi import WSGIRequest
from django.db.models.fields.related import ManyToManyField
from django.forms.models import ModelMultipleChoiceField
from django.http.response import HttpResponse from django.http.response import HttpResponse
from django.urls.resolvers import URLPattern
from django.contrib import admin from django.contrib import admin
from django.contrib.admin.sites import AdminSite
csrf_protect_m: Any csrf_protect_m: Any
sensitive_post_parameters_m: Any sensitive_post_parameters_m: Any
class GroupAdmin(admin.ModelAdmin): class GroupAdmin(admin.ModelAdmin): ...
admin_site: AdminSite
formfield_overrides: Any
model: Type[Group]
opts: Options
search_fields: Any = ...
ordering: Any = ...
filter_horizontal: Any = ...
def formfield_for_manytomany(
self, db_field: ManyToManyField, request: WSGIRequest = ..., **kwargs: Any
) -> ModelMultipleChoiceField: ...
class UserAdmin(admin.ModelAdmin): class UserAdmin(admin.ModelAdmin):
admin_site: AdminSite
formfield_overrides: Dict[
Type[Union[django.db.models.fields.DateTimeCheckMixin, Field]],
Dict[str, Type[Union[django.forms.fields.SplitDateTimeField, Widget]]],
]
model: Type[User]
opts: Options
add_form_template: str = ...
change_user_password_template: Any = ... change_user_password_template: Any = ...
fieldsets: Any = ...
add_fieldsets: Any = ... add_fieldsets: Any = ...
form: Any = ...
add_form: Any = ... add_form: Any = ...
change_password_form: Any = ... change_password_form: Any = ...
list_display: Any = ...
list_filter: Any = ...
search_fields: Any = ...
ordering: Any = ...
filter_horizontal: Any = ...
def get_fieldsets(self, request: WSGIRequest, obj: None = ...) -> Tuple[Tuple[None, Dict[str, Tuple[str]]]]: ...
def get_form(self, request: Any, obj: Optional[Any] = ..., **kwargs: Any): ...
def get_urls(self) -> List[URLPattern]: ...
def lookup_allowed(self, lookup: str, value: str) -> bool: ...
def add_view(self, request: WSGIRequest, form_url: str = ..., extra_context: None = ...) -> Any: ...
def user_change_password(self, request: WSGIRequest, id: str, form_url: str = ...) -> HttpResponse: ... def user_change_password(self, request: WSGIRequest, id: str, form_url: str = ...) -> HttpResponse: ...
def response_add(self, request: WSGIRequest, obj: User, post_url_continue: None = ...) -> HttpResponse: ...

View File

@@ -1,18 +1,3 @@
from typing import Any, Optional
from django.apps import AppConfig from django.apps import AppConfig
from .checks import check_models_permissions, check_user_model class AuthConfig(AppConfig): ...
from .management import create_permissions
from .signals import user_logged_in
class AuthConfig(AppConfig):
apps: None
label: str
models: None
models_module: None
module: Any
path: str
name: str = ...
verbose_name: Any = ...
def ready(self) -> None: ...

View File

@@ -1,4 +1,4 @@
from typing import Any, Optional, Tuple, List from typing import Any, Optional, Tuple, List, overload
from django.db import models from django.db import models
@@ -30,4 +30,8 @@ class AbstractBaseUser(models.Model):
@classmethod @classmethod
def get_email_field_name(cls) -> str: ... def get_email_field_name(cls) -> str: ...
@classmethod @classmethod
@overload
def normalize_username(cls, username: str) -> str: ... def normalize_username(cls, username: str) -> str: ...
@classmethod
@overload
def normalize_username(cls, username: Any) -> Any: ...

View File

@@ -1,8 +1,6 @@
from typing import Any, List, Optional from typing import Any, List
from django.core.checks.messages import CheckMessage from django.core.checks.messages import CheckMessage
from .management import _get_builtin_permissions
def check_user_model(app_configs: None = ..., **kwargs: Any) -> List[CheckMessage]: ... def check_user_model(app_configs: None = ..., **kwargs: Any) -> List[CheckMessage]: ...
def check_models_permissions(app_configs: None = ..., **kwargs: Any) -> List[Any]: ... def check_models_permissions(app_configs: None = ..., **kwargs: Any) -> List[Any]: ...

View File

@@ -1,22 +1,20 @@
from typing import Any, Dict, Optional, Union from typing import Any, Dict
from django.contrib.auth.models import AnonymousUser, User
from django.http.request import HttpRequest from django.http.request import HttpRequest
from django.utils.functional import SimpleLazyObject
class PermLookupDict: class PermLookupDict:
app_label: django.utils.safestring.SafeText app_label: str
user: SimpleLazyObject user: Any
def __init__(self, user: SimpleLazyObject, app_label: str) -> None: ... def __init__(self, user: Any, app_label: str) -> None: ...
def __getitem__(self, perm_name: str) -> bool: ... def __getitem__(self, perm_name: str) -> bool: ...
def __iter__(self) -> Any: ... def __iter__(self) -> Any: ...
def __bool__(self) -> bool: ... def __bool__(self) -> bool: ...
class PermWrapper: class PermWrapper:
user: SimpleLazyObject = ... user: Any = ...
def __init__(self, user: Union[AnonymousUser, User]) -> None: ... def __init__(self, user: Any) -> None: ...
def __getitem__(self, app_label: str) -> PermLookupDict: ... def __getitem__(self, app_label: str) -> PermLookupDict: ...
def __iter__(self) -> Any: ... def __iter__(self) -> Any: ...
def __contains__(self, perm_name: Union[bool, str]) -> bool: ... def __contains__(self, perm_name: Any) -> bool: ...
def auth(request: HttpRequest) -> Dict[str, Union[PermWrapper, AnonymousUser, User]]: ... def auth(request: HttpRequest) -> Dict[str, Any]: ...

View File

@@ -1,76 +1,36 @@
import collections from typing import Any, Dict, Iterator, Optional
import datetime
from typing import Any, Dict, Iterator, List, Optional, Union, Type
from django.contrib.auth.base_user import AbstractBaseUser from django.contrib.auth.base_user import AbstractBaseUser
from django.contrib.auth.models import AbstractUser, User from django.contrib.auth.models import AbstractUser, User
from django.contrib.auth.tokens import PasswordResetTokenGenerator from django.contrib.auth.tokens import PasswordResetTokenGenerator
from django.core.exceptions import ValidationError from django.core.exceptions import ValidationError
from django.core.handlers.wsgi import WSGIRequest from django.core.handlers.wsgi import WSGIRequest
from django.forms.utils import ErrorList
from django.http.request import QueryDict
from django.utils.datastructures import MultiValueDict
from django import forms from django import forms
UserModel: Any UserModel: Any
class ReadOnlyPasswordHashWidget(forms.Widget): class ReadOnlyPasswordHashWidget(forms.Widget):
attrs: Dict[Any, Any]
template_name: str = ... template_name: str = ...
class ReadOnlyPasswordHashField(forms.Field): class ReadOnlyPasswordHashField(forms.Field):
widget: Any = ...
def __init__(self, *args: Any, **kwargs: Any) -> None: ... def __init__(self, *args: Any, **kwargs: Any) -> None: ...
def bound_data(self, data: None, initial: str) -> str: ...
def has_changed(self, initial: str, data: Optional[str]) -> bool: ...
class UsernameField(forms.CharField): class UsernameField(forms.CharField): ...
def to_python(self, value: Optional[str]) -> str: ...
class UserCreationForm(forms.ModelForm): class UserCreationForm(forms.ModelForm):
auto_id: str
data: Dict[str, str]
empty_permitted: bool
error_class: Type[ErrorList]
fields: collections.OrderedDict
files: Dict[Any, Any]
initial: Dict[Any, Any]
instance: User
is_bound: bool
label_suffix: str
error_messages: Any = ... error_messages: Any = ...
password1: Any = ... password1: Any = ...
password2: Any = ... password2: Any = ...
def __init__(self, *args: Any, **kwargs: Any) -> None: ... def __init__(self, *args: Any, **kwargs: Any) -> None: ...
def clean_password2(self) -> str: ... def clean_password2(self) -> str: ...
def save(self, commit: bool = ...) -> User: ...
class UserChangeForm(forms.ModelForm): class UserChangeForm(forms.ModelForm):
auto_id: str
data: Dict[Any, Any]
empty_permitted: bool
error_class: Type[ErrorList]
fields: collections.OrderedDict
files: Dict[Any, Any]
initial: Dict[str, Optional[Union[List[Any], datetime.datetime, int, str]]]
instance: User
is_bound: bool
label_suffix: str
password: Any = ... password: Any = ...
def __init__(self, *args: Any, **kwargs: Any) -> None: ... def __init__(self, *args: Any, **kwargs: Any) -> None: ...
def clean_password(self) -> str: ... def clean_password(self) -> str: ...
class AuthenticationForm(forms.Form): class AuthenticationForm(forms.Form):
auto_id: str
data: QueryDict
empty_permitted: bool
error_class: Type[ErrorList]
fields: collections.OrderedDict
files: MultiValueDict
initial: Dict[Any, Any]
is_bound: bool
label_suffix: str
username: Any = ... username: Any = ...
password: Any = ... password: Any = ...
error_messages: Any = ... error_messages: Any = ...
@@ -83,21 +43,12 @@ class AuthenticationForm(forms.Form):
def get_invalid_login_error(self) -> ValidationError: ... def get_invalid_login_error(self) -> ValidationError: ...
class PasswordResetForm(forms.Form): class PasswordResetForm(forms.Form):
auto_id: str
data: Dict[Any, Any]
empty_permitted: bool
error_class: Type[ErrorList]
fields: collections.OrderedDict
files: Dict[Any, Any]
initial: Dict[Any, Any]
is_bound: bool
label_suffix: str
email: Any = ... email: Any = ...
def send_mail( def send_mail(
self, self,
subject_template_name: str, subject_template_name: str,
email_template_name: str, email_template_name: str,
context: Dict[str, Union[AbstractBaseUser, str]], context: Dict[str, Any],
from_email: Optional[str], from_email: Optional[str],
to_email: str, to_email: str,
html_email_template_name: Optional[str] = ..., html_email_template_name: Optional[str] = ...,
@@ -117,15 +68,6 @@ class PasswordResetForm(forms.Form):
) -> None: ... ) -> None: ...
class SetPasswordForm(forms.Form): class SetPasswordForm(forms.Form):
auto_id: str
data: Dict[Any, Any]
empty_permitted: bool
error_class: Type[ErrorList]
fields: collections.OrderedDict
files: Dict[Any, Any]
initial: Dict[Any, Any]
is_bound: bool
label_suffix: str
error_messages: Any = ... error_messages: Any = ...
new_password1: Any = ... new_password1: Any = ...
new_password2: Any = ... new_password2: Any = ...
@@ -135,31 +77,10 @@ class SetPasswordForm(forms.Form):
def save(self, commit: bool = ...) -> AbstractBaseUser: ... def save(self, commit: bool = ...) -> AbstractBaseUser: ...
class PasswordChangeForm(SetPasswordForm): class PasswordChangeForm(SetPasswordForm):
auto_id: str
data: Dict[Any, Any]
empty_permitted: bool
error_class: Type[ErrorList]
fields: collections.OrderedDict
files: Dict[Any, Any]
initial: Dict[Any, Any]
is_bound: bool
label_suffix: str
user: User
error_messages: Any = ...
old_password: Any = ... old_password: Any = ...
field_order: Any = ...
def clean_old_password(self) -> str: ... def clean_old_password(self) -> str: ...
class AdminPasswordChangeForm(forms.Form): class AdminPasswordChangeForm(forms.Form):
auto_id: str
data: Dict[Any, Any]
empty_permitted: bool
error_class: Type[ErrorList]
fields: collections.OrderedDict
files: Dict[Any, Any]
initial: Dict[Any, Any]
is_bound: bool
label_suffix: str
error_messages: Any = ... error_messages: Any = ...
required_css_class: str = ... required_css_class: str = ...
password1: Any = ... password1: Any = ...
@@ -168,5 +89,3 @@ class AdminPasswordChangeForm(forms.Form):
def __init__(self, user: AbstractUser, *args: Any, **kwargs: Any) -> None: ... def __init__(self, user: AbstractUser, *args: Any, **kwargs: Any) -> None: ...
def clean_password2(self) -> str: ... def clean_password2(self) -> str: ...
def save(self, commit: bool = ...) -> AbstractUser: ... def save(self, commit: bool = ...) -> AbstractUser: ...
@property
def changed_data(self) -> List[str]: ...

View File

@@ -1,6 +1,6 @@
from typing import Any, Callable, List, Optional from typing import Any, Callable, List, Optional
from django.core.handlers.wsgi import WSGIRequest from django import http
from django.http.response import HttpResponse, HttpResponseRedirect from django.http.response import HttpResponse, HttpResponseRedirect
class AccessMixin: class AccessMixin:
@@ -14,15 +14,15 @@ class AccessMixin:
def handle_no_permission(self) -> HttpResponseRedirect: ... def handle_no_permission(self) -> HttpResponseRedirect: ...
class LoginRequiredMixin(AccessMixin): class LoginRequiredMixin(AccessMixin):
def dispatch(self, request: WSGIRequest, *args: Any, **kwargs: Any) -> HttpResponse: ... def dispatch(self, request: http.HttpRequest, *args: Any, **kwargs: Any) -> HttpResponse: ...
class PermissionRequiredMixin(AccessMixin): class PermissionRequiredMixin(AccessMixin):
permission_required: Any = ... permission_required: Any = ...
def get_permission_required(self) -> List[str]: ... def get_permission_required(self) -> List[str]: ...
def has_permission(self) -> bool: ... def has_permission(self) -> bool: ...
def dispatch(self, request: WSGIRequest, *args: Any, **kwargs: Any) -> HttpResponse: ... def dispatch(self, request: http.HttpRequest, *args: Any, **kwargs: Any) -> HttpResponse: ...
class UserPassesTestMixin(AccessMixin): class UserPassesTestMixin(AccessMixin):
def test_func(self) -> None: ... def test_func(self) -> None: ...
def get_test_func(self) -> Callable: ... def get_test_func(self) -> Callable: ...
def dispatch(self, request: WSGIRequest, *args: Any, **kwargs: Any) -> HttpResponse: ... def dispatch(self, request: http.HttpRequest, *args: Any, **kwargs: Any) -> HttpResponse: ...

View File

@@ -15,7 +15,7 @@ class PermissionManager(models.Manager):
class Permission(models.Model): class Permission(models.Model):
content_type_id: int content_type_id: int
name: models.CharField = ... name: models.CharField = ...
content_type: models.ForeignKey[ContentType] = ... content_type: models.ForeignKey = models.ForeignKey(ContentType, on_delete=models.CASCADE)
codename: models.CharField = ... codename: models.CharField = ...
def natural_key(self) -> Tuple[str, str, str]: ... def natural_key(self) -> Tuple[str, str, str]: ...
@@ -24,7 +24,7 @@ class GroupManager(models.Manager):
class Group(models.Model): class Group(models.Model):
name: models.CharField = ... name: models.CharField = ...
permissions: models.ManyToManyField[Permission] = ... permissions: models.ManyToManyField = models.ManyToManyField(Permission)
def natural_key(self): ... def natural_key(self): ...
class UserManager(BaseUserManager): class UserManager(BaseUserManager):
@@ -37,8 +37,8 @@ class UserManager(BaseUserManager):
class PermissionsMixin(models.Model): class PermissionsMixin(models.Model):
is_superuser: models.BooleanField = ... is_superuser: models.BooleanField = ...
groups: models.ManyToManyField[Group] = ... groups: models.ManyToManyField = models.ManyToManyField(Group)
user_permissions: models.ManyToManyField[Permission] = ... user_permissions: models.ManyToManyField = models.ManyToManyField(Permission)
def get_group_permissions(self, obj: None = ...) -> Set[str]: ... def get_group_permissions(self, obj: None = ...) -> Set[str]: ...
def get_all_permissions(self, obj: Optional[str] = ...) -> Set[str]: ... def get_all_permissions(self, obj: Optional[str] = ...) -> Set[str]: ...
def has_perm(self, perm: Union[Tuple[str, Any], str], obj: Optional[str] = ...) -> bool: ... def has_perm(self, perm: Union[Tuple[str, Any], str], obj: Optional[str] = ...) -> bool: ...

View File

@@ -1,15 +1,10 @@
from typing import Any, Dict, Optional, Set, Type, Union from typing import Any, Optional, Set
from django.contrib.auth.base_user import AbstractBaseUser from django.contrib.auth.base_user import AbstractBaseUser
from django.contrib.auth.forms import AuthenticationForm, PasswordChangeForm, PasswordResetForm, SetPasswordForm
from django.contrib.auth.models import User
from django.contrib.sites.models import Site
from django.contrib.sites.requests import RequestSite
from django.core.handlers.wsgi import WSGIRequest from django.core.handlers.wsgi import WSGIRequest
from django.http.request import HttpRequest from django.http.request import HttpRequest
from django.http.response import HttpResponse, HttpResponseRedirect from django.http.response import HttpResponseRedirect
from django.template.response import TemplateResponse from django.template.response import TemplateResponse
from django.utils.datastructures import MultiValueDict
from django.views.generic.base import TemplateView from django.views.generic.base import TemplateView
from django.views.generic.edit import FormView from django.views.generic.edit import FormView
@@ -20,29 +15,18 @@ class SuccessURLAllowedHostsMixin:
def get_success_url_allowed_hosts(self) -> Set[str]: ... def get_success_url_allowed_hosts(self) -> Set[str]: ...
class LoginView(SuccessURLAllowedHostsMixin, FormView): class LoginView(SuccessURLAllowedHostsMixin, FormView):
form_class: Any = ...
authentication_form: Any = ... authentication_form: Any = ...
redirect_field_name: Any = ... redirect_field_name: Any = ...
template_name: str = ...
redirect_authenticated_user: bool = ... redirect_authenticated_user: bool = ...
extra_context: Any = ... extra_context: Any = ...
def dispatch(self, request: HttpRequest, *args: Any, **kwargs: Any) -> HttpResponse: ...
def get_success_url(self) -> str: ...
def get_redirect_url(self) -> str: ... def get_redirect_url(self) -> str: ...
def get_form_class(self) -> Type[AuthenticationForm]: ...
def get_form_kwargs(self) -> Dict[str, Optional[Union[Dict[str, str], HttpRequest, MultiValueDict]]]: ...
def form_valid(self, form: AuthenticationForm) -> HttpResponseRedirect: ...
def get_context_data(self, **kwargs: Any) -> Dict[str, Any]: ...
class LogoutView(SuccessURLAllowedHostsMixin, TemplateView): class LogoutView(SuccessURLAllowedHostsMixin, TemplateView):
next_page: Any = ... next_page: Any = ...
redirect_field_name: Any = ... redirect_field_name: Any = ...
template_name: str = ...
extra_context: Any = ... extra_context: Any = ...
def dispatch(self, request: HttpRequest, *args: Any, **kwargs: Any) -> HttpResponse: ...
def post(self, request: WSGIRequest, *args: Any, **kwargs: Any) -> TemplateResponse: ... def post(self, request: WSGIRequest, *args: Any, **kwargs: Any) -> TemplateResponse: ...
def get_next_page(self) -> Optional[str]: ... def get_next_page(self) -> Optional[str]: ...
def get_context_data(self, **kwargs: Any): ...
def logout_then_login(request: HttpRequest, login_url: Optional[str] = ...) -> HttpResponseRedirect: ... def logout_then_login(request: HttpRequest, login_url: Optional[str] = ...) -> HttpResponseRedirect: ...
def redirect_to_login( def redirect_to_login(
@@ -56,55 +40,32 @@ class PasswordContextMixin:
class PasswordResetView(PasswordContextMixin, FormView): class PasswordResetView(PasswordContextMixin, FormView):
email_template_name: str = ... email_template_name: str = ...
extra_email_context: Any = ... extra_email_context: Any = ...
form_class: Any = ...
from_email: Any = ... from_email: Any = ...
html_email_template_name: Any = ... html_email_template_name: Any = ...
subject_template_name: str = ... subject_template_name: str = ...
success_url: Any = ...
template_name: str = ...
title: Any = ... title: Any = ...
token_generator: Any = ... token_generator: Any = ...
def dispatch(self, *args: Any, **kwargs: Any) -> HttpResponse: ...
def form_valid(self, form: PasswordResetForm) -> HttpResponseRedirect: ...
INTERNAL_RESET_URL_TOKEN: str INTERNAL_RESET_URL_TOKEN: str
INTERNAL_RESET_SESSION_TOKEN: str INTERNAL_RESET_SESSION_TOKEN: str
class PasswordResetDoneView(PasswordContextMixin, TemplateView): class PasswordResetDoneView(PasswordContextMixin, TemplateView):
template_name: str = ...
title: Any = ... title: Any = ...
class PasswordResetConfirmView(PasswordContextMixin, FormView): class PasswordResetConfirmView(PasswordContextMixin, FormView):
form_class: Any = ...
post_reset_login: bool = ... post_reset_login: bool = ...
post_reset_login_backend: Any = ... post_reset_login_backend: Any = ...
success_url: Any = ...
template_name: str = ...
title: Any = ... title: Any = ...
token_generator: Any = ... token_generator: Any = ...
validlink: bool = ... validlink: bool = ...
user: Any = ... user: Any = ...
def dispatch(self, *args: Any, **kwargs: Any) -> HttpResponse: ...
def get_user(self, uidb64: str) -> Optional[AbstractBaseUser]: ... def get_user(self, uidb64: str) -> Optional[AbstractBaseUser]: ...
def get_form_kwargs(self) -> Dict[str, Optional[Union[Dict[Any, Any], AbstractBaseUser, MultiValueDict]]]: ...
def form_valid(self, form: SetPasswordForm) -> HttpResponseRedirect: ...
def get_context_data(self, **kwargs: Any): ...
class PasswordResetCompleteView(PasswordContextMixin, TemplateView): class PasswordResetCompleteView(PasswordContextMixin, TemplateView):
template_name: str = ...
title: Any = ... title: Any = ...
def get_context_data(self, **kwargs: Any): ...
class PasswordChangeView(PasswordContextMixin, FormView): class PasswordChangeView(PasswordContextMixin, FormView):
form_class: Any = ...
success_url: Any = ...
template_name: str = ...
title: Any = ... title: Any = ...
def dispatch(self, *args: Any, **kwargs: Any) -> HttpResponse: ...
def get_form_kwargs(self) -> Dict[str, Optional[Union[Dict[Any, Any], User, MultiValueDict]]]: ...
def form_valid(self, form: PasswordChangeForm) -> HttpResponseRedirect: ...
class PasswordChangeDoneView(PasswordContextMixin, TemplateView): class PasswordChangeDoneView(PasswordContextMixin, TemplateView):
template_name: str = ...
title: Any = ... title: Any = ...
def dispatch(self, *args: Any, **kwargs: Any) -> TemplateResponse: ...

View File

@@ -1,16 +1,3 @@
from typing import Any, Optional
from django.apps import AppConfig from django.apps import AppConfig
from .management import create_contenttypes, inject_rename_contenttypes_operations class ContentTypesConfig(AppConfig): ...
class ContentTypesConfig(AppConfig):
apps: None
label: str
models: None
models_module: None
module: Any
path: str
name: str = ...
verbose_name: Any = ...
def ready(self) -> None: ...

View File

@@ -1,4 +1,4 @@
from typing import Any, Callable, Dict, List, Optional, Tuple, Type, Union from typing import Any, Callable, Dict, List, Optional, Tuple, Type, Union, Generic
from django.contrib.contenttypes.models import ContentType from django.contrib.contenttypes.models import ContentType
from django.core.checks.messages import Error from django.core.checks.messages import Error

View File

@@ -1,20 +1,13 @@
from typing import Any, Optional from typing import Any, Dict, List
from django.core.management import BaseCommand
from django.core.management.base import CommandParser
from django.db.models.deletion import Collector from django.db.models.deletion import Collector
from ...management import get_contenttypes_and_models from django.core.management import BaseCommand
class Command(BaseCommand): class Command(BaseCommand): ...
stderr: django.core.management.base.OutputWrapper
stdout: django.core.management.base.OutputWrapper
style: django.core.management.color.Style
def add_arguments(self, parser: CommandParser) -> None: ...
def handle(self, **options: Any) -> None: ...
class NoFastDeleteCollector(Collector): class NoFastDeleteCollector(Collector):
data: collections.OrderedDict data: Dict[str, Any]
dependencies: Dict[Any, Any] dependencies: Dict[Any, Any]
fast_deletes: List[Any] fast_deletes: List[Any]
field_updates: Dict[Any, Any] field_updates: Dict[Any, Any]

View File

@@ -4,12 +4,7 @@ from django.db import models
from django.db.models.base import Model from django.db.models.base import Model
from django.db.models.query import QuerySet from django.db.models.query import QuerySet
class ContentTypeManager(models.Manager): class ContentTypeManager(models.Manager["ContentType"]):
creation_counter: int
model: None
name: None
use_in_migrations: bool = ...
def __init__(self, *args: Any, **kwargs: Any) -> None: ...
def get_by_natural_key(self, app_label: str, model: str) -> ContentType: ... def get_by_natural_key(self, app_label: str, model: str) -> ContentType: ...
def get_for_model(self, model: Union[Type[Model], Model], for_concrete_model: bool = ...) -> ContentType: ... def get_for_model(self, model: Union[Type[Model], Model], for_concrete_model: bool = ...) -> ContentType: ...
def get_for_models(self, *models: Any, for_concrete_models: bool = ...) -> Dict[Type[Model], ContentType]: ... def get_for_models(self, *models: Any, for_concrete_models: bool = ...) -> Dict[Type[Model], ContentType]: ...
@@ -18,9 +13,9 @@ class ContentTypeManager(models.Manager):
class ContentType(models.Model): class ContentType(models.Model):
id: int id: int
app_label: str = ... app_label: models.CharField = ...
model: str = ... model: models.CharField = ...
objects: Any = ... objects: ContentTypeManager = ...
@property @property
def name(self) -> str: ... def name(self) -> str: ...
def model_class(self) -> Optional[Type[Model]]: ... def model_class(self) -> Optional[Type[Model]]: ...

View File

@@ -1,19 +1,7 @@
from typing import Any, Dict, Optional, Union from typing import Any
from django import forms from django import forms
from django.db.models.query import QuerySet
class FlatpageForm(forms.ModelForm): class FlatpageForm(forms.ModelForm):
auto_id: str
data: Dict[str, Union[List[int], str]]
empty_permitted: bool
error_class: Type[ErrorList]
fields: collections.OrderedDict
files: Dict[Any, Any]
initial: Dict[str, Union[List[django.contrib.sites.models.Site], int, str]]
instance: django.contrib.flatpages.models.FlatPage
is_bound: bool
label_suffix: str
url: Any = ... url: Any = ...
def clean_url(self) -> str: ... def clean_url(self) -> str: ...
def clean(self) -> Dict[str, Union[bool, QuerySet, str]]: ...

View File

@@ -1,14 +1,13 @@
from typing import Any, Optional from django.contrib.sites.models import Site
from django.db import models from django.db import models
class FlatPage(models.Model): class FlatPage(models.Model):
id: None url: models.CharField = ...
url: str = ... title: models.CharField = ...
title: str = ... content: models.TextField = ...
content: str = ... enable_comments: models.BooleanField = ...
enable_comments: bool = ... template_name: models.CharField = ...
template_name: str = ... registration_required: models.BooleanField = ...
registration_required: bool = ... sites: models.ManyToManyField[Site, Site] = ...
sites: Any = ...
def get_absolute_url(self) -> str: ... def get_absolute_url(self) -> str: ...

View File

@@ -1,7 +1,3 @@
from typing import Optional
from django.contrib.sitemaps import Sitemap from django.contrib.sitemaps import Sitemap
from django.db.models.query import QuerySet
class FlatPageSitemap(Sitemap): class FlatPageSitemap(Sitemap): ...
def items(self) -> QuerySet: ...

View File

@@ -0,0 +1,11 @@
from typing import Dict
DEBUG: int = ...
INFO: int = ...
SUCCESS: int = ...
WARNING: int = ...
ERROR: int = ...
DEFAULT_TAGS: Dict[int, str] = ...
DEFAULT_LEVELS: Dict[str, int] = ...

View File

@@ -16,7 +16,7 @@ class Message:
def level_tag(self) -> str: ... def level_tag(self) -> str: ...
class BaseStorage: class BaseStorage:
request: Any = ... request: HttpRequest = ...
used: bool = ... used: bool = ...
added_new: bool = ... added_new: bool = ...
def __init__(self, request: HttpRequest, *args: Any, **kwargs: Any) -> None: ... def __init__(self, request: HttpRequest, *args: Any, **kwargs: Any) -> None: ...

View File

@@ -1,49 +1,20 @@
import json import json
from typing import Any, Dict, List, Optional, Union from typing import Any
from django.contrib.messages.storage.base import BaseStorage, Message from django.contrib.messages.storage.base import BaseStorage
class MessageEncoder(json.JSONEncoder): class MessageEncoder(json.JSONEncoder):
allow_nan: bool allow_nan: bool
check_circular: bool check_circular: bool
ensure_ascii: bool ensure_ascii: bool
indent: None
item_separator: str
key_separator: str
skipkeys: bool skipkeys: bool
sort_keys: bool sort_keys: bool
message_key: str = ... message_key: str = ...
def default(self, obj: Message) -> List[Union[int, str]]: ...
class MessageDecoder(json.JSONDecoder): class MessageDecoder(json.JSONDecoder):
def process_messages( def process_messages(self, obj: Any) -> Any: ...
self,
obj: Union[
Dict[
str, Union[List[Union[Dict[str, List[Union[int, str]]], List[Union[int, str]]]], List[Union[int, str]]]
],
List[Union[List[Union[int, str]], str]],
str,
],
) -> Union[
Dict[str, Union[List[Union[Dict[str, Message], Message]], Message]],
List[Union[Dict[str, Union[List[Union[Dict[str, Message], Message]], Message]], Message]],
List[Union[Message, str]],
Message,
str,
]: ...
def decode(
self, s: str, **kwargs: Any
) -> Union[
List[Union[Dict[str, Union[List[Union[Dict[str, Message], Message]], Message]], Message]],
List[Union[Message, str]],
Message,
]: ...
class CookieStorage(BaseStorage): class CookieStorage(BaseStorage):
added_new: bool
request: WSGIRequest
used: bool
cookie_name: str = ... cookie_name: str = ...
max_cookie_size: int = ... max_cookie_size: int = ...
not_finished: str = ... not_finished: str = ...

View File

@@ -1,11 +1,8 @@
from typing import Any, Optional from typing import Any
from django.contrib.messages.storage.base import BaseStorage from django.contrib.messages.storage.base import BaseStorage
class FallbackStorage(BaseStorage): class FallbackStorage(BaseStorage):
added_new: bool
request: WSGIRequest
used: bool
storage_classes: Any = ... storage_classes: Any = ...
storages: Any = ... storages: Any = ...
def __init__(self, *args: Any, **kwargs: Any) -> None: ... def __init__(self, *args: Any, **kwargs: Any) -> None: ...

View File

@@ -1,15 +1,10 @@
from typing import Any, List, Optional, Union from typing import Any, List, Optional, Sequence, Union
from django.contrib.messages.storage.base import BaseStorage, Message from django.contrib.messages.storage.base import BaseStorage
from django.http.request import HttpRequest from django.http.request import HttpRequest
class SessionStorage(BaseStorage): class SessionStorage(BaseStorage):
added_new: bool
request: WSGIRequest
used: bool
session_key: str = ... session_key: str = ...
def __init__(self, request: HttpRequest, *args: Any, **kwargs: Any) -> None: ... def __init__(self, request: HttpRequest, *args: Any, **kwargs: Any) -> None: ...
def serialize_messages(self, messages: Union[List[Message], List[str]]) -> str: ... def serialize_messages(self, messages: Sequence[Any]) -> str: ...
def deserialize_messages( def deserialize_messages(self, data: Optional[Union[List[Any], str]]) -> Optional[List[Any]]: ...
self, data: Optional[Union[List[Any], str]]
) -> Optional[Union[List[Message], List[str]]]: ...

View File

@@ -1,20 +1,51 @@
from typing import Any, Generic, List, Optional, Sequence, TypeVar from typing import Any, Iterable, List, Optional, Sequence, TypeVar, Union
from django.db.models.expressions import Combinable
from django.db.models.fields import Field, _ErrorMessagesToOverride, _FieldChoices, _ValidatorCallable
from django.db.models.fields import Field
from .mixins import CheckFieldDefaultMixin from .mixins import CheckFieldDefaultMixin
_T = TypeVar("_T", bound=Field) # __set__ value type
_ST = TypeVar("_ST")
# __get__ return type
_GT = TypeVar("_GT")
class ArrayField(CheckFieldDefaultMixin, Field[_ST, _GT]):
_pyi_private_set_type: Union[Sequence[Any], Combinable]
_pyi_private_get_type: List[Any]
class ArrayField(CheckFieldDefaultMixin, Field, Generic[_T]):
empty_strings_allowed: bool = ... empty_strings_allowed: bool = ...
default_error_messages: Any = ... default_error_messages: Any = ...
base_field: Any = ... base_field: Any = ...
size: Any = ... size: Any = ...
default_validators: Any = ... default_validators: Any = ...
from_db_value: Any = ... from_db_value: Any = ...
def __init__(self, base_field: _T, size: Optional[int] = ..., **kwargs: Any) -> None: ... def __init__(
self,
base_field: Field,
size: Optional[int] = ...,
verbose_name: Optional[Union[str, bytes]] = ...,
name: Optional[str] = ...,
primary_key: bool = ...,
max_length: Optional[int] = ...,
unique: bool = ...,
blank: bool = ...,
null: bool = ...,
db_index: bool = ...,
default: Any = ...,
editable: bool = ...,
auto_created: bool = ...,
serialize: bool = ...,
unique_for_date: Optional[str] = ...,
unique_for_month: Optional[str] = ...,
unique_for_year: Optional[str] = ...,
choices: Optional[_FieldChoices] = ...,
help_text: str = ...,
db_column: Optional[str] = ...,
db_tablespace: Optional[str] = ...,
validators: Iterable[_ValidatorCallable] = ...,
error_messages: Optional[_ErrorMessagesToOverride] = ...,
) -> None: ...
@property @property
def description(self): ... def description(self): ...
def get_transform(self, name: Any): ... def get_transform(self, name: Any): ...
def __set__(self, instance, value: Sequence[_T]) -> None: ...
def __get__(self, instance, owner) -> List[_T]: ...

View File

@@ -1,10 +1,10 @@
from typing import Any from typing import Any
from django.core.handlers.wsgi import WSGIRequest from django.http.request import HttpRequest
from django.http.response import HttpResponse from django.http.response import HttpResponse
from django.utils.deprecation import MiddlewareMixin from django.utils.deprecation import MiddlewareMixin
class RedirectFallbackMiddleware(MiddlewareMixin): class RedirectFallbackMiddleware(MiddlewareMixin):
response_gone_class: Any = ... response_gone_class: Any = ...
response_redirect_class: Any = ... response_redirect_class: Any = ...
def process_response(self, request: WSGIRequest, response: HttpResponse) -> HttpResponse: ... def process_response(self, request: HttpRequest, response: HttpResponse) -> HttpResponse: ...

View File

@@ -1,8 +1,6 @@
from datetime import datetime from datetime import datetime
from typing import Any, Dict, Optional, Union from typing import Any, Dict, Optional, Union
from django.db.models.base import Model
VALID_KEY_CHARS: Any VALID_KEY_CHARS: Any
class CreateError(Exception): ... class CreateError(Exception): ...
@@ -18,8 +16,8 @@ class SessionBase(Dict[str, Any]):
def set_test_cookie(self) -> None: ... def set_test_cookie(self) -> None: ...
def test_cookie_worked(self) -> bool: ... def test_cookie_worked(self) -> bool: ...
def delete_test_cookie(self) -> None: ... def delete_test_cookie(self) -> None: ...
def encode(self, session_dict: Dict[str, Model]) -> str: ... def encode(self, session_dict: Dict[str, Any]) -> str: ...
def decode(self, session_data: Union[bytes, str]) -> Dict[str, Model]: ... def decode(self, session_data: Union[bytes, str]) -> Dict[str, Any]: ...
def has_key(self, key: Any): ... def has_key(self, key: Any): ...
def keys(self): ... def keys(self): ...
def values(self): ... def values(self): ...
@@ -33,7 +31,7 @@ class SessionBase(Dict[str, Any]):
def get_expire_at_browser_close(self) -> bool: ... def get_expire_at_browser_close(self) -> bool: ...
def flush(self) -> None: ... def flush(self) -> None: ...
def cycle_key(self) -> None: ... def cycle_key(self) -> None: ...
def exists(self, session_key: str) -> None: ... def exists(self, session_key: str) -> bool: ...
def create(self) -> None: ... def create(self) -> None: ...
def save(self, must_create: bool = ...) -> None: ... def save(self, must_create: bool = ...) -> None: ...
def delete(self, session_key: Optional[Any] = ...) -> None: ... def delete(self, session_key: Optional[Any] = ...) -> None: ...

View File

@@ -1,23 +1,11 @@
from typing import Any, Dict, Optional from typing import Any, Optional
from django.contrib.sessions.backends.base import SessionBase from django.contrib.sessions.backends.base import SessionBase
from django.contrib.sessions.serializers import JSONSerializer
KEY_PREFIX: str KEY_PREFIX: str
class SessionStore(SessionBase): class SessionStore(SessionBase):
accessed: bool
serializer: JSONSerializer
cache_key_prefix: Any = ... cache_key_prefix: Any = ...
def __init__(self, session_key: Optional[str] = ...) -> None: ... def __init__(self, session_key: Optional[str] = ...) -> None: ...
@property @property
def cache_key(self) -> str: ... def cache_key(self) -> str: ...
def load(self) -> Dict[str, str]: ...
modified: bool = ...
def create(self) -> None: ...
def save(self, must_create: bool = ...) -> None: ...
def exists(self, session_key: Optional[str]) -> bool: ...
def delete(self, session_key: Optional[str] = ...) -> None: ...
@classmethod
def clear_expired(cls) -> None: ...

View File

@@ -1,19 +1,11 @@
from typing import Any, Dict, Optional from typing import Any, Optional
from django.contrib.sessions.backends.db import SessionStore as DBStore from django.contrib.sessions.backends.db import SessionStore as DBStore
KEY_PREFIX: str KEY_PREFIX: str
class SessionStore(DBStore): class SessionStore(DBStore):
accessed: bool
modified: bool
serializer: Type[django.core.signing.JSONSerializer]
cache_key_prefix: Any = ... cache_key_prefix: Any = ...
def __init__(self, session_key: Optional[str] = ...) -> None: ... def __init__(self, session_key: Optional[str] = ...) -> None: ...
@property @property
def cache_key(self) -> str: ... def cache_key(self) -> str: ...
def load(self) -> Dict[str, str]: ...
def exists(self, session_key: Optional[str]) -> bool: ...
def save(self, must_create: bool = ...) -> None: ...
def delete(self, session_key: Optional[str] = ...) -> None: ...
def flush(self) -> None: ...

View File

@@ -1,24 +1,13 @@
from typing import Dict, Optional, Type, Union from typing import Dict, Optional, Type
from django.contrib.sessions.backends.base import SessionBase from django.contrib.sessions.backends.base import SessionBase
from django.contrib.sessions.base_session import AbstractBaseSession from django.contrib.sessions.base_session import AbstractBaseSession
from django.contrib.sessions.models import Session from django.contrib.sessions.models import Session
from django.core.signing import Serializer
from django.db.models.base import Model from django.db.models.base import Model
class SessionStore(SessionBase): class SessionStore(SessionBase):
accessed: bool
serializer: Type[Serializer]
def __init__(self, session_key: Optional[str] = ...) -> None: ... def __init__(self, session_key: Optional[str] = ...) -> None: ...
@classmethod @classmethod
def get_model_class(cls) -> Type[Session]: ... def get_model_class(cls) -> Type[Session]: ...
def model(self) -> Type[AbstractBaseSession]: ... def model(self) -> Type[AbstractBaseSession]: ...
def load(self) -> Dict[str, Union[Model, int, str]]: ...
def exists(self, session_key: Optional[str]) -> bool: ...
modified: bool = ...
def create(self) -> None: ...
def create_model_instance(self, data: Dict[str, Model]) -> AbstractBaseSession: ... def create_model_instance(self, data: Dict[str, Model]) -> AbstractBaseSession: ...
def save(self, must_create: bool = ...) -> None: ...
def delete(self, session_key: Optional[str] = ...) -> None: ...
@classmethod
def clear_expired(cls) -> None: ...

View File

@@ -1,19 +1,9 @@
from typing import Any, Dict, Optional, Union from typing import Optional
from django.contrib.sessions.backends.base import SessionBase from django.contrib.sessions.backends.base import SessionBase
class SessionStore(SessionBase): class SessionStore(SessionBase):
accessed: bool
serializer: Type[django.core.signing.JSONSerializer]
storage_path: str = ... storage_path: str = ...
file_prefix: str = ... file_prefix: str = ...
def __init__(self, session_key: Optional[str] = ...) -> None: ... def __init__(self, session_key: Optional[str] = ...) -> None: ...
def load(self) -> Dict[str, Union[int, str]]: ...
modified: bool = ...
def create(self) -> None: ...
def save(self, must_create: bool = ...) -> None: ...
def exists(self, session_key: Optional[str]) -> bool: ...
def delete(self, session_key: Optional[str] = ...) -> None: ...
def clean(self) -> None: ... def clean(self) -> None: ...
@classmethod
def clear_expired(cls) -> None: ...

View File

@@ -1,17 +1,3 @@
from datetime import datetime
from typing import Any, Dict, Optional, Union
from django.contrib.sessions.backends.base import SessionBase from django.contrib.sessions.backends.base import SessionBase
class SessionStore(SessionBase): class SessionStore(SessionBase): ...
accessed: bool
serializer: Type[django.core.signing.JSONSerializer]
def load(self) -> Dict[str, Union[datetime, str]]: ...
modified: bool = ...
def create(self) -> None: ...
def save(self, must_create: bool = ...) -> None: ...
def exists(self, session_key: Optional[str] = ...) -> bool: ...
def delete(self, session_key: Optional[str] = ...) -> None: ...
def cycle_key(self) -> None: ...
@classmethod
def clear_expired(cls) -> None: ...

View File

@@ -1,20 +1,19 @@
from datetime import datetime from datetime import datetime
from typing import Any, Dict, Optional from typing import Any, Dict, Optional, Type
from django.contrib.sessions.backends.base import SessionBase
from django.db import models from django.db import models
class BaseSessionManager(models.Manager): class BaseSessionManager(models.Manager):
creation_counter: int
model: None
name: None
def encode(self, session_dict: Dict[str, int]) -> str: ... def encode(self, session_dict: Dict[str, int]) -> str: ...
def save(self, session_key: str, session_dict: Dict[str, int], expire_date: datetime) -> AbstractBaseSession: ... def save(self, session_key: str, session_dict: Dict[str, int], expire_date: datetime) -> AbstractBaseSession: ...
class AbstractBaseSession(models.Model): class AbstractBaseSession(models.Model):
session_key: Any = ... expire_date: datetime
session_data: Any = ... session_data: str
expire_date: Any = ... session_key: str
objects: Any = ... objects: Any = ...
@classmethod @classmethod
def get_session_store_class(cls) -> None: ... def get_session_store_class(cls) -> Optional[Type[SessionBase]]: ...
def get_decoded(self) -> Dict[str, int]: ... def get_decoded(self) -> Dict[str, int]: ...

View File

@@ -1,10 +1,3 @@
from typing import Any, Optional
from django.core.management.base import BaseCommand from django.core.management.base import BaseCommand
class Command(BaseCommand): class Command(BaseCommand): ...
stderr: django.core.management.base.OutputWrapper
stdout: django.core.management.base.OutputWrapper
style: django.core.management.color.Style
help: str = ...
def handle(self, **options: Any) -> None: ...

View File

@@ -1,18 +1,4 @@
from typing import Any, Optional, Type
from django.contrib.sessions.backends.db import SessionStore
from django.contrib.sessions.base_session import AbstractBaseSession, BaseSessionManager from django.contrib.sessions.base_session import AbstractBaseSession, BaseSessionManager
class SessionManager(BaseSessionManager): class SessionManager(BaseSessionManager): ...
creation_counter: int class Session(AbstractBaseSession): ...
model: None
name: None
use_in_migrations: bool = ...
class Session(AbstractBaseSession):
expire_date: datetime.datetime
session_data: str
session_key: str
objects: Any = ...
@classmethod
def get_session_store_class(cls) -> Type[SessionStore]: ...

View File

@@ -1,4 +1,4 @@
from typing import Any, Dict, Optional from typing import Dict
from django.core.signing import JSONSerializer as BaseJSONSerializer from django.core.signing import JSONSerializer as BaseJSONSerializer
from django.db.models.base import Model from django.db.models.base import Model

View File

@@ -11,25 +11,24 @@ PING_URL: str
class SitemapNotFound(Exception): ... class SitemapNotFound(Exception): ...
def ping_google(sitemap_url: None = ..., ping_url: str = ...) -> None: ... def ping_google(sitemap_url: Optional[str] = ..., ping_url: str = ...) -> None: ...
class Sitemap: class Sitemap:
limit: int = ... limit: int = ...
protocol: Any = ... protocol: Optional[str] = ...
def items(self) -> List[Any]: ... def items(self) -> List[Any]: ...
def location(self, obj: Model) -> str: ... def location(self, obj: Model) -> str: ...
@property @property
def paginator(self) -> Paginator: ... def paginator(self) -> Paginator: ...
def get_urls( def get_urls(
self, page: Union[int, str] = ..., site: Optional[Union[Site, RequestSite]] = ..., protocol: Optional[str] = ... self, page: Union[int, str] = ..., site: Optional[Union[Site, RequestSite]] = ..., protocol: Optional[str] = ...
) -> List[Dict[str, Optional[Union[datetime, Model, str]]]]: ... ) -> List[Dict[str, Any]]: ...
class GenericSitemap(Sitemap): class GenericSitemap(Sitemap):
priority: None = ... priority: Optional[float] = ...
changefreq: None = ... changefreq: Optional[str] = ...
queryset: QuerySet = ... queryset: QuerySet = ...
date_field: None = ... date_field: None = ...
protocol: None = ...
def __init__( def __init__(
self, self,
info_dict: Dict[str, Union[datetime, QuerySet, str]], info_dict: Dict[str, Union[datetime, QuerySet, str]],
@@ -37,7 +36,6 @@ class GenericSitemap(Sitemap):
changefreq: Optional[str] = ..., changefreq: Optional[str] = ...,
protocol: Optional[str] = ..., protocol: Optional[str] = ...,
) -> None: ... ) -> None: ...
def items(self) -> QuerySet: ...
def lastmod(self, item: Model) -> Optional[datetime]: ... def lastmod(self, item: Model) -> Optional[datetime]: ...
default_app_config: str default_app_config: str

View File

@@ -1,20 +1,21 @@
from collections import OrderedDict from collections import OrderedDict
from typing import Any, Callable, Dict, Optional, Type, Union from typing import Callable, Dict, Optional, Type, Union
from django.http.request import HttpRequest
from django.template.response import TemplateResponse
from django.contrib.sitemaps import GenericSitemap, Sitemap from django.contrib.sitemaps import GenericSitemap, Sitemap
from django.core.handlers.wsgi import WSGIRequest
from django.template.response import TemplateResponse
def x_robots_tag(func: Callable) -> Callable: ... def x_robots_tag(func: Callable) -> Callable: ...
def index( def index(
request: WSGIRequest, request: HttpRequest,
sitemaps: Dict[str, Union[Type[Sitemap], Sitemap]], sitemaps: Dict[str, Union[Type[Sitemap], Sitemap]],
template_name: str = ..., template_name: str = ...,
content_type: str = ..., content_type: str = ...,
sitemap_url_name: str = ..., sitemap_url_name: str = ...,
) -> TemplateResponse: ... ) -> TemplateResponse: ...
def sitemap( def sitemap(
request: WSGIRequest, request: HttpRequest,
sitemaps: Union[Dict[str, Type[Sitemap]], Dict[str, GenericSitemap], OrderedDict], sitemaps: Union[Dict[str, Type[Sitemap]], Dict[str, GenericSitemap], OrderedDict],
section: Optional[str] = ..., section: Optional[str] = ...,
template_name: str = ..., template_name: str = ...,

View File

@@ -1,14 +1,3 @@
from typing import Any
from django.apps import AppConfig from django.apps import AppConfig
class SitesConfig(AppConfig): class SitesConfig(AppConfig): ...
apps: None
label: str
models: None
models_module: None
module: Any
path: str
name: str = ...
verbose_name: Any = ...
def ready(self) -> None: ...

View File

@@ -1,15 +1,6 @@
from typing import Any, Optional from typing import Any
from django.apps import AppConfig from django.apps import AppConfig
class StaticFilesConfig(AppConfig): class StaticFilesConfig(AppConfig):
apps: None
label: str
models: None
models_module: None
module: Any
path: str
name: str = ...
verbose_name: Any = ...
ignore_patterns: Any = ... ignore_patterns: Any = ...
def ready(self) -> None: ...

View File

@@ -1,25 +1,21 @@
from typing import Any, Iterator, List, Optional, Tuple, Union, Mapping, overload from typing import Any, Iterable, Iterator, List, Mapping, Optional, Union, overload
from django.contrib.staticfiles.storage import StaticFilesStorage
from django.core.checks.messages import Error from django.core.checks.messages import Error
from django.core.files.storage import DefaultStorage, FileSystemStorage, Storage from django.core.files.storage import Storage
from typing_extensions import Literal from typing_extensions import Literal
searched_locations: Any searched_locations: Any
class BaseFinder: class BaseFinder:
def check(self, **kwargs: Any) -> Any: ... def check(self, **kwargs: Any) -> List[Error]: ...
def find(self, path: Any, all: bool = ...) -> None: ... def find(self, path: str, all: bool = ...) -> Optional[Any]: ...
def list(self, ignore_patterns: Any) -> None: ... def list(self, ignore_patterns: Any) -> Iterable[Any]: ...
class FileSystemFinder(BaseFinder): class FileSystemFinder(BaseFinder):
locations: List[Any] = ... locations: List[Any] = ...
storages: Mapping[str, Any] = ... storages: Mapping[str, Any] = ...
def __init__(self, app_names: None = ..., *args: Any, **kwargs: Any) -> None: ... def __init__(self, app_names: None = ..., *args: Any, **kwargs: Any) -> None: ...
def check(self, **kwargs: Any) -> List[Error]: ...
def find(self, path: str, all: bool = ...) -> Union[List[str], str]: ...
def find_location(self, root: str, path: str, prefix: str = ...) -> Optional[str]: ... def find_location(self, root: str, path: str, prefix: str = ...) -> Optional[str]: ...
def list(self, ignore_patterns: List[str]) -> Iterator[Tuple[str, FileSystemStorage]]: ...
class AppDirectoriesFinder(BaseFinder): class AppDirectoriesFinder(BaseFinder):
storage_class: Any = ... storage_class: Any = ...
@@ -27,15 +23,11 @@ class AppDirectoriesFinder(BaseFinder):
apps: List[str] = ... apps: List[str] = ...
storages: Mapping[str, Any] = ... storages: Mapping[str, Any] = ...
def __init__(self, app_names: None = ..., *args: Any, **kwargs: Any) -> None: ... def __init__(self, app_names: None = ..., *args: Any, **kwargs: Any) -> None: ...
def list(self, ignore_patterns: List[str]) -> Iterator[Tuple[str, FileSystemStorage]]: ...
def find(self, path: str, all: bool = ...) -> Union[List[str], str]: ...
def find_in_app(self, app: str, path: str) -> Optional[str]: ... def find_in_app(self, app: str, path: str) -> Optional[str]: ...
class BaseStorageFinder(BaseFinder): class BaseStorageFinder(BaseFinder):
storage: Storage = ... storage: Storage = ...
def __init__(self, storage: Optional[Storage] = ..., *args: Any, **kwargs: Any) -> None: ... def __init__(self, storage: Optional[Storage] = ..., *args: Any, **kwargs: Any) -> None: ...
def find(self, path: str, all: bool = ...) -> Union[List[str], str]: ...
def list(self, ignore_patterns: List[str]) -> Iterator[Tuple[str, DefaultStorage]]: ...
class DefaultStorageFinder(BaseStorageFinder): ... class DefaultStorageFinder(BaseStorageFinder): ...

View File

@@ -1,4 +1,4 @@
from typing import Any, Optional from typing import Any
from django.core.handlers.wsgi import WSGIHandler, WSGIRequest from django.core.handlers.wsgi import WSGIHandler, WSGIRequest
@@ -7,9 +7,6 @@ class StaticFilesHandler(WSGIHandler):
application: WSGIHandler = ... application: WSGIHandler = ...
base_url: Any = ... base_url: Any = ...
def __init__(self, application: WSGIHandler) -> None: ... def __init__(self, application: WSGIHandler) -> None: ...
def load_middleware(self) -> None: ...
def get_base_url(self) -> str: ... def get_base_url(self) -> str: ...
def file_path(self, url: str) -> str: ... def file_path(self, url: str) -> str: ...
def serve(self, request: WSGIRequest) -> Any: ... def serve(self, request: WSGIRequest) -> Any: ...
def get_response(self, request: WSGIRequest) -> Any: ...
def __call__(self, environ: Any, start_response: Any): ...

View File

@@ -1,22 +1,16 @@
from typing import Any, Dict, List, Optional from typing import Any, Dict, List
from django.core.files.storage import FileSystemStorage from django.core.files.storage import FileSystemStorage
from django.core.management.base import BaseCommand, CommandParser from django.core.management.base import BaseCommand
class Command(BaseCommand): class Command(BaseCommand):
stderr: django.core.management.base.OutputWrapper
stdout: django.core.management.base.OutputWrapper
help: str = ...
requires_system_checks: bool = ...
copied_files: Any = ... copied_files: Any = ...
symlinked_files: Any = ... symlinked_files: Any = ...
unmodified_files: Any = ... unmodified_files: Any = ...
post_processed_files: Any = ... post_processed_files: Any = ...
storage: Any = ... storage: Any = ...
style: django.core.management.color.Style = ...
def __init__(self, *args: Any, **kwargs: Any) -> None: ... def __init__(self, *args: Any, **kwargs: Any) -> None: ...
def local(self) -> bool: ... def local(self) -> bool: ...
def add_arguments(self, parser: CommandParser) -> None: ...
interactive: Any = ... interactive: Any = ...
verbosity: Any = ... verbosity: Any = ...
symlink: Any = ... symlink: Any = ...
@@ -26,7 +20,6 @@ class Command(BaseCommand):
post_process: Any = ... post_process: Any = ...
def set_options(self, **options: Any) -> None: ... def set_options(self, **options: Any) -> None: ...
def collect(self) -> Dict[str, List[str]]: ... def collect(self) -> Dict[str, List[str]]: ...
def handle(self, **options: Any) -> Optional[str]: ...
def log(self, msg: str, level: int = ...) -> None: ... def log(self, msg: str, level: int = ...) -> None: ...
def is_local_storage(self) -> bool: ... def is_local_storage(self) -> bool: ...
def clear_dir(self, path: str) -> None: ... def clear_dir(self, path: str) -> None: ...

View File

@@ -1,12 +1,3 @@
from typing import Any, Optional from django.core.management.base import LabelCommand
from django.core.management.base import CommandParser, LabelCommand class Command(LabelCommand): ...
class Command(LabelCommand):
stderr: django.core.management.base.OutputWrapper
stdout: django.core.management.base.OutputWrapper
style: django.core.management.color.Style
help: str = ...
label: str = ...
def add_arguments(self, parser: CommandParser) -> None: ...
def handle_label(self, path: str, **options: Any) -> str: ...

View File

@@ -1,13 +1,3 @@
from typing import Any, Optional from django.core.management.commands.runserver import Command as RunserverCommand # type: ignore
from django.contrib.staticfiles.handlers import StaticFilesHandler class Command(RunserverCommand): ...
from django.core.management.base import CommandParser
from django.core.management.commands.runserver import Command as RunserverCommand
class Command(RunserverCommand):
stderr: django.core.management.base.OutputWrapper
stdout: django.core.management.base.OutputWrapper
style: django.core.management.color.Style
help: str = ...
def add_arguments(self, parser: CommandParser) -> None: ...
def get_handler(self, *args: Any, **options: Any) -> StaticFilesHandler: ...

View File

@@ -20,7 +20,6 @@ class HashedFilesMixin:
def __init__(self, *args: Any, **kwargs: Any) -> None: ... def __init__(self, *args: Any, **kwargs: Any) -> None: ...
def file_hash(self, name: str, content: File = ...) -> str: ... def file_hash(self, name: str, content: File = ...) -> str: ...
def hashed_name(self, name: str, content: Optional[File] = ..., filename: Optional[str] = ...) -> str: ... def hashed_name(self, name: str, content: Optional[File] = ..., filename: Optional[str] = ...) -> str: ...
def url(self, name: SafeText, force: bool = ...) -> str: ...
def url_converter(self, name: str, hashed_files: OrderedDict, template: str = ...) -> Callable: ... def url_converter(self, name: str, hashed_files: OrderedDict, template: str = ...) -> Callable: ...
def post_process( def post_process(
self, paths: OrderedDict, dry_run: bool = ..., **options: Any self, paths: OrderedDict, dry_run: bool = ..., **options: Any
@@ -33,16 +32,13 @@ class ManifestFilesMixin(HashedFilesMixin):
manifest_version: str = ... manifest_version: str = ...
manifest_name: str = ... manifest_name: str = ...
manifest_strict: bool = ... manifest_strict: bool = ...
hashed_files: Any = ...
def __init__(self, *args: Any, **kwargs: Any) -> None: ... def __init__(self, *args: Any, **kwargs: Any) -> None: ...
def read_manifest(self) -> Any: ... def read_manifest(self) -> Any: ...
def load_manifest(self) -> OrderedDict: ... def load_manifest(self) -> OrderedDict: ...
def post_process(self, *args: Any, **kwargs: Any) -> None: ...
def save_manifest(self) -> None: ... def save_manifest(self) -> None: ...
def stored_name(self, name: str) -> str: ...
class _MappingCache: class _MappingCache:
cache: django.core.cache.DefaultCacheProxy = ... cache: Any = ...
def __init__(self, cache: Any) -> None: ... def __init__(self, cache: Any) -> None: ...
def __setitem__(self, key: Any, value: Any) -> None: ... def __setitem__(self, key: Any, value: Any) -> None: ...
def __getitem__(self, key: Any): ... def __getitem__(self, key: Any): ...
@@ -51,9 +47,7 @@ class _MappingCache:
def get(self, key: Any, default: Optional[Any] = ...): ... def get(self, key: Any, default: Optional[Any] = ...): ...
class CachedFilesMixin(HashedFilesMixin): class CachedFilesMixin(HashedFilesMixin):
hashed_files: Any = ...
def __init__(self, *args: Any, **kwargs: Any) -> None: ... def __init__(self, *args: Any, **kwargs: Any) -> None: ...
def hash_key(self, name: str) -> str: ...
class CachedStaticFilesStorage(CachedFilesMixin, StaticFilesStorage): ... class CachedStaticFilesStorage(CachedFilesMixin, StaticFilesStorage): ...
class ManifestStaticFilesStorage(ManifestFilesMixin, StaticFilesStorage): ... class ManifestStaticFilesStorage(ManifestFilesMixin, StaticFilesStorage): ...

View File

@@ -1,7 +1,7 @@
from collections import OrderedDict from collections import OrderedDict
from typing import Any, Callable, Dict, Union from typing import Any, Callable, Dict, Union
from django.core.cache.backends.base import BaseCache as BaseCache from .backends.base import BaseCache as BaseCache
DEFAULT_CACHE_ALIAS: str DEFAULT_CACHE_ALIAS: str

View File

@@ -1,5 +1,4 @@
from collections import OrderedDict from typing import Any, Callable, Dict, Iterable, List, Optional, Union
from typing import Any, Callable, Dict, List, Optional, Union
from django.core.exceptions import ImproperlyConfigured from django.core.exceptions import ImproperlyConfigured
@@ -9,7 +8,7 @@ class CacheKeyWarning(RuntimeWarning): ...
DEFAULT_TIMEOUT: Any DEFAULT_TIMEOUT: Any
MEMCACHE_MAX_KEY_LENGTH: int MEMCACHE_MAX_KEY_LENGTH: int
def default_key_func(key: Union[int, str], key_prefix: str, version: Union[int, str]) -> str: ... def default_key_func(key: Any, key_prefix: str, version: Any) -> str: ...
def get_key_func(key_func: Optional[Union[Callable, str]]) -> Callable: ... def get_key_func(key_func: Optional[Union[Callable, str]]) -> Callable: ...
class BaseCache: class BaseCache:
@@ -17,9 +16,9 @@ class BaseCache:
key_prefix: str = ... key_prefix: str = ...
version: int = ... version: int = ...
key_func: Callable = ... key_func: Callable = ...
def __init__(self, params: Dict[str, Optional[Union[Callable, Dict[str, int], int, str]]]) -> None: ... def __init__(self, params: Dict[str, Any]) -> None: ...
def get_backend_timeout(self, timeout: Any = ...) -> Optional[float]: ... def get_backend_timeout(self, timeout: Any = ...) -> Optional[float]: ...
def make_key(self, key: Union[int, str], version: Optional[Union[int, str]] = ...) -> str: ... def make_key(self, key: Any, version: Optional[Any] = ...) -> str: ...
def add(self, key: Any, value: Any, timeout: Any = ..., version: Optional[Any] = ...) -> None: ... def add(self, key: Any, value: Any, timeout: Any = ..., version: Optional[Any] = ...) -> None: ...
def get(self, key: Any, default: Optional[Any] = ..., version: Optional[Any] = ...) -> Any: ... def get(self, key: Any, default: Optional[Any] = ..., version: Optional[Any] = ...) -> Any: ...
def set(self, key: Any, value: Any, timeout: Any = ..., version: Optional[Any] = ...) -> None: ... def set(self, key: Any, value: Any, timeout: Any = ..., version: Optional[Any] = ...) -> None: ...
@@ -27,19 +26,14 @@ class BaseCache:
def delete(self, key: Any, version: Optional[Any] = ...) -> None: ... def delete(self, key: Any, version: Optional[Any] = ...) -> None: ...
def get_many(self, keys: List[str], version: Optional[int] = ...) -> Dict[str, Union[int, str]]: ... def get_many(self, keys: List[str], version: Optional[int] = ...) -> Dict[str, Union[int, str]]: ...
def get_or_set( def get_or_set(
self, key: str, default: Optional[Union[Callable, int, str]], timeout: Any = ..., version: Optional[int] = ... self, key: Any, default: Optional[Any], timeout: Any = ..., version: Optional[int] = ...
) -> Optional[Union[int, str]]: ... ) -> Optional[Any]: ...
def has_key(self, key: Any, version: Optional[Any] = ...): ... def has_key(self, key: Any, version: Optional[Any] = ...): ...
def incr(self, key: str, delta: int = ..., version: Optional[int] = ...) -> int: ... def incr(self, key: str, delta: int = ..., version: Optional[int] = ...) -> int: ...
def decr(self, key: str, delta: int = ..., version: Optional[int] = ...) -> int: ... def decr(self, key: str, delta: int = ..., version: Optional[int] = ...) -> int: ...
def __contains__(self, key: str) -> bool: ... def __contains__(self, key: str) -> bool: ...
def set_many( def set_many(self, data: Dict[str, Any], timeout: Any = ..., version: Optional[Any] = ...) -> List[Any]: ...
self, def delete_many(self, keys: Iterable[Any], version: Optional[Any] = ...) -> None: ...
data: Union[Dict[str, bytes], Dict[str, int], Dict[str, str], OrderedDict],
timeout: Any = ...,
version: Optional[Union[int, str]] = ...,
) -> List[Any]: ...
def delete_many(self, keys: Union[Dict[str, str], List[str]], version: None = ...) -> None: ...
def clear(self) -> None: ... def clear(self) -> None: ...
def validate_key(self, key: str) -> None: ... def validate_key(self, key: str) -> None: ...
def incr_version(self, key: str, delta: int = ..., version: Optional[int] = ...) -> int: ... def incr_version(self, key: str, delta: int = ..., version: Optional[int] = ...) -> int: ...

View File

@@ -1,4 +1,4 @@
from typing import Any, Callable, Dict, Optional, Union from typing import Any, Dict
from django.core.cache.backends.base import BaseCache from django.core.cache.backends.base import BaseCache
@@ -16,24 +16,7 @@ class Options:
def __init__(self, table: str) -> None: ... def __init__(self, table: str) -> None: ...
class BaseDatabaseCache(BaseCache): class BaseDatabaseCache(BaseCache):
default_timeout: int
key_func: Callable
key_prefix: str
version: int
cache_model_class: Any = ... cache_model_class: Any = ...
def __init__(self, table: str, params: Dict[str, Union[Callable, Dict[str, int], int, str]]) -> None: ... def __init__(self, table: str, params: Dict[str, Any]) -> None: ...
class DatabaseCache(BaseDatabaseCache): class DatabaseCache(BaseDatabaseCache): ...
default_timeout: int
key_func: Callable
key_prefix: str
version: int
def get(self, key: str, default: Optional[Union[int, str]] = ..., version: Optional[int] = ...) -> Any: ...
def set(self, key: str, value: Any, timeout: Any = ..., version: Optional[int] = ...) -> None: ...
def add(
self, key: str, value: Union[Dict[str, int], bytes, int, str], timeout: Any = ..., version: Optional[int] = ...
) -> bool: ...
def touch(self, key: str, timeout: Any = ..., version: None = ...) -> bool: ...
def delete(self, key: str, version: Optional[int] = ...) -> None: ...
def has_key(self, key: str, version: Optional[int] = ...) -> Any: ...
def clear(self) -> None: ...

View File

@@ -1,19 +1,6 @@
from typing import Any, Dict, Optional, Union, Callable from typing import Any
from django.core.cache.backends.base import BaseCache from django.core.cache.backends.base import BaseCache
class DummyCache(BaseCache): class DummyCache(BaseCache):
default_timeout: int
key_func: Callable
key_prefix: str
version: int
def __init__(self, host: str, *args: Any, **kwargs: Any) -> None: ... def __init__(self, host: str, *args: Any, **kwargs: Any) -> None: ...
def add(self, key: str, value: str, timeout: Any = ..., version: None = ...) -> bool: ...
def get(self, key: str, default: Optional[str] = ..., version: Optional[int] = ...) -> Optional[str]: ...
def set(
self, key: str, value: Union[Dict[str, Any], int, str], timeout: Any = ..., version: Optional[str] = ...
) -> None: ...
def touch(self, key: str, timeout: Any = ..., version: None = ...) -> bool: ...
def delete(self, key: str, version: None = ...) -> None: ...
def has_key(self, key: str, version: None = ...) -> bool: ...
def clear(self) -> None: ...

View File

@@ -1,22 +1,7 @@
from typing import Any, Callable, Dict, Optional, Union from typing import Any, Dict
from django.core.cache.backends.base import BaseCache from django.core.cache.backends.base import BaseCache
class FileBasedCache(BaseCache): class FileBasedCache(BaseCache):
default_timeout: int
key_func: Callable
key_prefix: str
version: int
cache_suffix: str = ... cache_suffix: str = ...
def __init__(self, dir: str, params: Dict[str, Union[Callable, Dict[str, int], int, str]]) -> None: ... def __init__(self, dir: str, params: Dict[str, Any]) -> None: ...
def add(
self, key: str, value: Union[Dict[str, int], bytes, int, str], timeout: Any = ..., version: Optional[int] = ...
) -> bool: ...
def get(
self, key: str, default: Optional[Union[int, str]] = ..., version: Optional[int] = ...
) -> Optional[str]: ...
def set(self, key: str, value: Any, timeout: Any = ..., version: Optional[int] = ...) -> None: ...
def touch(self, key: str, timeout: Any = ..., version: None = ...) -> bool: ...
def delete(self, key: str, version: Optional[int] = ...) -> None: ...
def has_key(self, key: str, version: Optional[int] = ...) -> bool: ...
def clear(self) -> None: ...

View File

@@ -1,5 +1,5 @@
from typing import Any, List, Optional, Union from typing import Any, Iterable, Optional
TEMPLATE_FRAGMENT_KEY_TEMPLATE: str TEMPLATE_FRAGMENT_KEY_TEMPLATE: str
def make_template_fragment_key(fragment_name: str, vary_on: Optional[Union[List[int], List[str]]] = ...) -> str: ... def make_template_fragment_key(fragment_name: str, vary_on: Optional[Iterable[Any]] = ...) -> str: ...

View File

@@ -1,6 +1,5 @@
from typing import Any, Dict, Iterator, List, Optional, Tuple, Type, Union from typing import Any, Dict, Iterator, List, Mapping, Optional, Tuple, Union
from django.db.models.base import Model
from django.forms.utils import ErrorDict from django.forms.utils import ErrorDict
class FieldDoesNotExist(Exception): ... class FieldDoesNotExist(Exception): ...
@@ -31,20 +30,13 @@ class ValidationError(Exception):
message: Any = ... message: Any = ...
code: Any = ... code: Any = ...
params: Any = ... params: Any = ...
def __init__( def __init__(self, message: Any, code: Optional[str] = ..., params: Optional[Mapping[str, Any]] = ...) -> None: ...
self,
message: Any,
code: Optional[str] = ...,
params: Optional[
Union[Dict[str, Union[Tuple[str], Type[Model], Model, str]], Dict[str, Union[int, str]]]
] = ...,
) -> None: ...
@property @property
def message_dict(self) -> Dict[str, List[str]]: ... def message_dict(self) -> Dict[str, List[str]]: ...
@property @property
def messages(self) -> List[str]: ... def messages(self) -> List[str]: ...
def update_error_dict( def update_error_dict(
self, error_dict: Union[Dict[str, List[ValidationError]], ErrorDict] self, error_dict: Mapping[str, Any]
) -> Union[Dict[str, List[ValidationError]], ErrorDict]: ... ) -> Union[Dict[str, List[ValidationError]], ErrorDict]: ...
def __iter__(self) -> Iterator[Union[Tuple[str, List[str]], str]]: ... def __iter__(self) -> Iterator[Union[Tuple[str, List[str]], str]]: ...

View File

@@ -1,17 +1,15 @@
from ctypes import Structure, c_int64, c_ulong, c_void_p from ctypes import Structure, Union
from io import BufferedRandom, TextIOWrapper from typing import Any
from typing import Union
LOCK_SH: int LOCK_SH: int
LOCK_NB: int LOCK_NB: int
LOCK_EX: int LOCK_EX: int
ULONG_PTR = c_int64 ULONG_PTR: Any = ...
ULONG_PTR = c_ulong PVOID: Any = ...
PVOID = c_void_p
class _OFFSET(Structure): ... class _OFFSET(Structure): ...
class _OFFSET_UNION(Union): ... class _OFFSET_UNION(Union): ...
class OVERLAPPED(Structure): ... class OVERLAPPED(Structure): ...
def lock(f: Union[BufferedRandom, TextIOWrapper, int], flags: int) -> bool: ... def lock(f: Any, flags: int) -> bool: ...
def unlock(f: Union[BufferedRandom, int]) -> bool: ... def unlock(f: Any) -> bool: ...

View File

@@ -1,15 +1,12 @@
from datetime import datetime from datetime import datetime
from io import StringIO, TextIOWrapper from typing import Any, IO, List, Optional, Tuple
from typing import Any, List, Optional, Tuple, Union
from django.core.files.base import File from django.core.files.base import File
from django.utils.functional import LazyObject from django.utils.functional import LazyObject
class Storage: class Storage:
def open(self, name: str, mode: str = ...) -> File: ... def open(self, name: str, mode: str = ...) -> File: ...
def save( def save(self, name: Optional[str], content: IO[Any], max_length: Optional[int] = ...) -> str: ...
self, name: Optional[str], content: Union[StringIO, TextIOWrapper, File], max_length: Optional[int] = ...
) -> str: ...
def get_valid_name(self, name: str) -> str: ... def get_valid_name(self, name: str) -> str: ...
def get_available_name(self, name: str, max_length: Optional[int] = ...) -> str: ... def get_available_name(self, name: str, max_length: Optional[int] = ...) -> str: ...
def generate_filename(self, filename: str) -> str: ... def generate_filename(self, filename: str) -> str: ...

View File

@@ -1,45 +1,48 @@
# Stubs for django.core.files.uploadedfile (Python 3.5)
from typing import Any, Dict, IO, Iterator, Optional, Union from typing import Any, Dict, IO, Iterator, Optional, Union
from django.core.files import temp as tempfile from django.core.files import temp as tempfile
from django.core.files.base import File from django.core.files.base import File
class UploadedFile(File): class UploadedFile(File):
content_type = ... # type: Optional[str] content_type: Optional[str] = ...
charset = ... # type: Optional[str] charset: Optional[str] = ...
content_type_extra = ... # type: Optional[Dict[str, str]] content_type_extra: Optional[Dict[str, str]] = ...
def __init__( def __init__(
self, self,
file: IO, file: Optional[IO] = ...,
name: str = None, name: Optional[str] = ...,
content_type: str = None, content_type: Optional[str] = ...,
size: int = None, size: Optional[int] = ...,
charset: str = None, charset: Optional[str] = ...,
content_type_extra: Dict[str, str] = None, content_type_extra: Optional[Dict[str, str]] = ...,
) -> None: ... ) -> None: ...
class TemporaryUploadedFile(UploadedFile): class TemporaryUploadedFile(UploadedFile):
def __init__( def __init__(
self, name: str, content_type: str, size: int, charset: str, content_type_extra: Dict[str, str] = None self,
name: Optional[str],
content_type: Optional[str],
size: Optional[int],
charset: Optional[str],
content_type_extra: Optional[Dict[str, str]] = ...,
) -> None: ... ) -> None: ...
def temporary_file_path(self) -> str: ... def temporary_file_path(self) -> str: ...
class InMemoryUploadedFile(UploadedFile): class InMemoryUploadedFile(UploadedFile):
field_name = ... # type: Optional[str] field_name: Optional[str] = ...
def __init__( def __init__(
self, self,
file: IO, file: IO,
field_name: Optional[str], field_name: Optional[str],
name: str, name: Optional[str],
content_type: Optional[str], content_type: Optional[str],
size: int, size: Optional[int],
charset: Optional[str], charset: Optional[str],
content_type_extra: Dict[str, str] = None, content_type_extra: Dict[str, str] = ...,
) -> None: ... ) -> None: ...
def chunks(self, chunk_size: int = None) -> Iterator[bytes]: ... def chunks(self, chunk_size: Optional[int] = ...) -> Iterator[bytes]: ...
def multiple_chunks(self, chunk_size: int = None) -> bool: ... def multiple_chunks(self, chunk_size: Optional[int] = ...) -> bool: ...
class SimpleUploadedFile(InMemoryUploadedFile): class SimpleUploadedFile(InMemoryUploadedFile):
def __init__(self, name: str, content: bytes, content_type: str = "") -> None: ... def __init__(self, name: str, content: Optional[Union[bytes, str]], content_type: str = ...) -> None: ...
@classmethod @classmethod
def from_dict(cls: Any, file_dict: Dict[str, Union[str, bytes]]) -> None: ... def from_dict(cls: Any, file_dict: Dict[str, Union[str, bytes]]) -> None: ...

View File

@@ -1,6 +1,6 @@
from typing import Any, Callable from typing import Any, Callable
from django.core.handlers.wsgi import WSGIRequest from django.http.request import HttpRequest
from django.http.response import HttpResponse, HttpResponseBase from django.http.response import HttpResponse, HttpResponseBase
logger: Any logger: Any
@@ -13,5 +13,5 @@ class BaseHandler:
def load_middleware(self) -> None: ... def load_middleware(self) -> None: ...
def make_view_atomic(self, view: Callable) -> Callable: ... def make_view_atomic(self, view: Callable) -> Callable: ...
def get_exception_response(self, request: Any, resolver: Any, status_code: Any, exception: Any): ... def get_exception_response(self, request: Any, resolver: Any, status_code: Any, exception: Any): ...
def get_response(self, request: WSGIRequest) -> HttpResponseBase: ... def get_response(self, request: HttpRequest) -> HttpResponseBase: ...
def process_exception_by_middleware(self, exception: Exception, request: WSGIRequest) -> HttpResponse: ... def process_exception_by_middleware(self, exception: Exception, request: HttpRequest) -> HttpResponse: ...

View File

@@ -1,12 +1,12 @@
from typing import Any, Callable from typing import Any, Callable
from django.core.handlers.wsgi import WSGIRequest from django.http.request import HttpRequest
from django.http.response import HttpResponse from django.http.response import HttpResponse
from django.urls.resolvers import URLResolver from django.urls.resolvers import URLResolver
def convert_exception_to_response(get_response: Callable) -> Callable: ... def convert_exception_to_response(get_response: Callable) -> Callable: ...
def response_for_exception(request: WSGIRequest, exc: Exception) -> HttpResponse: ... def response_for_exception(request: HttpRequest, exc: Exception) -> HttpResponse: ...
def get_exception_response( def get_exception_response(
request: WSGIRequest, resolver: URLResolver, status_code: int, exception: Exception, sender: None = ... request: HttpRequest, resolver: URLResolver, status_code: int, exception: Exception, sender: None = ...
) -> HttpResponse: ... ) -> HttpResponse: ...
def handle_uncaught_exception(request: Any, resolver: Any, exc_info: Any): ... def handle_uncaught_exception(request: Any, resolver: Any, exc_info: Any): ...

View File

@@ -1,48 +1,48 @@
from typing import Any, List, Optional, Tuple from typing import Any, List, Optional, Tuple
from django.core.mail.backends.base import BaseEmailBackend from .message import (
from django.core.mail.message import DEFAULT_ATTACHMENT_MIME_TYPE as DEFAULT_ATTACHMENT_MIME_TYPE BadHeaderError as BadHeaderError,
from django.core.mail.message import BadHeaderError as BadHeaderError DEFAULT_ATTACHMENT_MIME_TYPE as DEFAULT_ATTACHMENT_MIME_TYPE,
from django.core.mail.message import EmailMessage as EmailMessage EmailMessage as EmailMessage,
from django.core.mail.message import EmailMultiAlternatives as EmailMultiAlternatives EmailMultiAlternatives as EmailMultiAlternatives,
from django.core.mail.message import SafeMIMEMultipart as SafeMIMEMultipart SafeMIMEMultipart as SafeMIMEMultipart,
from django.core.mail.message import SafeMIMEText as SafeMIMEText SafeMIMEText as SafeMIMEText,
from django.core.mail.message import forbid_multi_line_headers as forbid_multi_line_headers forbid_multi_line_headers as forbid_multi_line_headers,
from django.core.mail.utils import DNS_NAME as DNS_NAME )
from django.core.mail.utils import CachedDnsName as CachedDnsName from .utils import CachedDnsName as CachedDnsName, DNS_NAME as DNS_NAME
def get_connection(backend: Optional[str] = ..., fail_silently: bool = ..., **kwds: Any) -> BaseEmailBackend: ... def get_connection(backend: Optional[str] = ..., fail_silently: bool = ..., **kwds: Any) -> Any: ...
def send_mail( def send_mail(
subject: str, subject: str,
message: str, message: str,
from_email: Optional[str], from_email: Optional[str],
recipient_list: List[str], recipient_list: List[str],
fail_silently: bool = ..., fail_silently: bool = ...,
auth_user: None = ..., auth_user: Optional[str] = ...,
auth_password: None = ..., auth_password: Optional[str] = ...,
connection: Optional[BaseEmailBackend] = ..., connection: Optional[Any] = ...,
html_message: Optional[str] = ..., html_message: Optional[str] = ...,
) -> int: ... ) -> int: ...
def send_mass_mail( def send_mass_mail(
datatuple: List[Tuple[str, str, str, List[str]]], datatuple: List[Tuple[str, str, str, List[str]]],
fail_silently: bool = ..., fail_silently: bool = ...,
auth_user: None = ..., auth_user: Optional[str] = ...,
auth_password: None = ..., auth_password: Optional[str] = ...,
connection: BaseEmailBackend = ..., connection: Optional[Any] = ...,
) -> int: ... ) -> int: ...
def mail_admins( def mail_admins(
subject: str, subject: str,
message: str, message: str,
fail_silently: bool = ..., fail_silently: bool = ...,
connection: Optional[BaseEmailBackend] = ..., connection: Optional[Any] = ...,
html_message: Optional[str] = ..., html_message: Optional[str] = ...,
) -> None: ... ) -> None: ...
def mail_managers( def mail_managers(
subject: str, subject: str,
message: str, message: str,
fail_silently: bool = ..., fail_silently: bool = ...,
connection: Optional[BaseEmailBackend] = ..., connection: Optional[Any] = ...,
html_message: Optional[str] = ..., html_message: Optional[str] = ...,
) -> None: ... ) -> None: ...
outbox = [EmailMessage()] outbox: List[EmailMessage] = ...

View File

@@ -1,11 +1,8 @@
import email from email._policybase import Policy # type: ignore
from email.mime.message import MIMEMessage from email.mime.message import MIMEMessage
from email.mime.multipart import MIMEMultipart from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText from email.mime.text import MIMEText
from typing import Any, Dict, List, Optional, Tuple, Union from typing import Any, Dict, List, Optional, Sequence, Tuple, Union
from django.core.mail.backends.base import BaseEmailBackend
from django.utils.safestring import SafeText
utf8_charset: Any utf8_charset: Any
utf8_charset_qp: Any utf8_charset_qp: Any
@@ -20,37 +17,31 @@ def forbid_multi_line_headers(name: str, val: str, encoding: str) -> Tuple[str,
def split_addr(addr: str, encoding: str) -> Tuple[str, str]: ... def split_addr(addr: str, encoding: str) -> Tuple[str, str]: ...
def sanitize_address(addr: Union[Tuple[str, str], str], encoding: str) -> str: ... def sanitize_address(addr: Union[Tuple[str, str], str], encoding: str) -> str: ...
class MIMEMixin: class MIMEMixin: ...
def as_string(self, unixfrom: bool = ..., linesep: str = ...) -> str: ...
def as_bytes(self, unixfrom: bool = ..., linesep: str = ...) -> bytes: ...
class SafeMIMEMessage(MIMEMixin, MIMEMessage): class SafeMIMEMessage(MIMEMixin, MIMEMessage):
defects: List[Any] defects: List[Any]
epilogue: None epilogue: None
policy: email._policybase.Compat32 policy: Policy
preamble: None preamble: None
def __setitem__(self, name: str, val: str) -> None: ...
class SafeMIMEText(MIMEMixin, MIMEText): class SafeMIMEText(MIMEMixin, MIMEText):
defects: List[Any] defects: List[Any]
epilogue: None epilogue: None
policy: email._policybase.Compat32 policy: Policy
preamble: None preamble: None
encoding: str = ... encoding: str = ...
def __init__(self, _text: str, _subtype: str = ..., _charset: str = ...) -> None: ... def __init__(self, _text: str, _subtype: str = ..., _charset: str = ...) -> None: ...
def __setitem__(self, name: str, val: str) -> None: ...
def set_payload(self, payload: str, charset: str = ...) -> None: ...
class SafeMIMEMultipart(MIMEMixin, MIMEMultipart): class SafeMIMEMultipart(MIMEMixin, MIMEMultipart):
defects: List[Any] defects: List[Any]
epilogue: None epilogue: None
policy: email._policybase.Compat32 policy: Policy
preamble: None preamble: None
encoding: str = ... encoding: str = ...
def __init__( def __init__(
self, _subtype: str = ..., boundary: None = ..., _subparts: None = ..., encoding: str = ..., **_params: Any self, _subtype: str = ..., boundary: None = ..., _subparts: None = ..., encoding: str = ..., **_params: Any
) -> None: ... ) -> None: ...
def __setitem__(self, name: str, val: str) -> None: ...
class EmailMessage: class EmailMessage:
content_subtype: str = ... content_subtype: str = ...
@@ -65,21 +56,21 @@ class EmailMessage:
body: str = ... body: str = ...
attachments: List[Any] = ... attachments: List[Any] = ...
extra_headers: Dict[Any, Any] = ... extra_headers: Dict[Any, Any] = ...
connection: None = ... connection: Any = ...
def __init__( def __init__(
self, self,
subject: str = ..., subject: str = ...,
body: Optional[str] = ..., body: Optional[str] = ...,
from_email: Optional[str] = ..., from_email: Optional[str] = ...,
to: Optional[Union[List[str], Tuple[str, str], str]] = ..., to: Optional[Union[Sequence[str], str]] = ...,
bcc: Optional[Union[List[str], Tuple[str], str]] = ..., bcc: Optional[Union[Sequence[str], str]] = ...,
connection: Optional[BaseEmailBackend] = ..., connection: Optional[Any] = ...,
attachments: Optional[Union[List[Tuple[str, str]], List[MIMEText]]] = ..., attachments: Optional[Union[List[Tuple[str, str]], List[MIMEText]]] = ...,
headers: Optional[Dict[str, str]] = ..., headers: Optional[Dict[str, str]] = ...,
cc: Optional[Union[List[str], Tuple[str, str], str]] = ..., cc: Optional[Union[Sequence[str], str]] = ...,
reply_to: Optional[Union[List[Optional[str]], str]] = ..., reply_to: Optional[Union[List[Optional[str]], str]] = ...,
) -> None: ... ) -> None: ...
def get_connection(self, fail_silently: bool = ...) -> BaseEmailBackend: ... def get_connection(self, fail_silently: bool = ...) -> Any: ...
def message(self) -> MIMEMixin: ... def message(self) -> MIMEMixin: ...
def recipients(self) -> List[str]: ... def recipients(self) -> List[str]: ...
def send(self, fail_silently: bool = ...) -> int: ... def send(self, fail_silently: bool = ...) -> int: ...
@@ -92,16 +83,6 @@ class EmailMessage:
def attach_file(self, path: str, mimetype: Optional[str] = ...) -> None: ... def attach_file(self, path: str, mimetype: Optional[str] = ...) -> None: ...
class EmailMultiAlternatives(EmailMessage): class EmailMultiAlternatives(EmailMessage):
attachments: List[Any]
bcc: List[Any]
body: SafeText
cc: List[Any]
connection: None
extra_headers: Dict[Any, Any]
from_email: str
reply_to: List[Any]
subject: str
to: List[str]
alternative_subtype: str = ... alternative_subtype: str = ...
alternatives: Any = ... alternatives: Any = ...
def __init__( def __init__(
@@ -111,7 +92,7 @@ class EmailMultiAlternatives(EmailMessage):
from_email: Optional[str] = ..., from_email: Optional[str] = ...,
to: Optional[List[str]] = ..., to: Optional[List[str]] = ...,
bcc: Optional[List[str]] = ..., bcc: Optional[List[str]] = ...,
connection: Optional[BaseEmailBackend] = ..., connection: Optional[Any] = ...,
attachments: None = ..., attachments: None = ...,
headers: Optional[Dict[str, str]] = ..., headers: Optional[Dict[str, str]] = ...,
alternatives: Optional[List[Tuple[str, str]]] = ..., alternatives: Optional[List[Tuple[str, str]]] = ...,

View File

@@ -1,16 +1,13 @@
from typing import Any, Optional from typing import Any
from django.core.management.base import BaseCommand, CommandParser from django.core.management.base import BaseCommand
class TemplateCommand(BaseCommand): class TemplateCommand(BaseCommand):
requires_system_checks: bool = ...
url_schemes: Any = ... url_schemes: Any = ...
rewrite_template_suffixes: Any = ... rewrite_template_suffixes: Any = ...
def add_arguments(self, parser: CommandParser) -> None: ...
app_or_project: Any = ... app_or_project: Any = ...
paths_to_remove: Any = ... paths_to_remove: Any = ...
verbosity: Any = ... verbosity: Any = ...
def handle(self, app_or_project: Any, name: Any, target: Optional[Any] = ..., **options: Any): ...
def handle_template(self, template: Any, subdir: Any): ... def handle_template(self, template: Any, subdir: Any): ...
def validate_name(self, name: Any, app_or_project: Any) -> None: ... def validate_name(self, name: Any, app_or_project: Any) -> None: ...
def download(self, url: Any): ... def download(self, url: Any): ...

View File

@@ -1,5 +1,4 @@
from collections import OrderedDict from typing import Any, Callable, Dict, Iterator, List, Optional, Tuple, Type, Union, Iterable
from typing import Any, Callable, Dict, Iterator, List, Optional, Tuple, Type, Union
from django.apps.config import AppConfig from django.apps.config import AppConfig
from django.db.models.base import Model from django.db.models.base import Model
@@ -33,5 +32,5 @@ def serialize(
) -> Optional[Union[bytes, str]]: ... ) -> Optional[Union[bytes, str]]: ...
def deserialize(format: str, stream_or_string: Any, **options: Any) -> Union[Iterator[Any], Deserializer]: ... def deserialize(format: str, stream_or_string: Any, **options: Any) -> Union[Iterator[Any], Deserializer]: ...
def sort_dependencies( def sort_dependencies(
app_list: Union[List[Tuple[AppConfig, None]], List[Tuple[str, List[Type[Model]]]]] app_list: Union[Iterable[Tuple[AppConfig, None]], Iterable[Tuple[str, Iterable[Type[Model]]]]]
) -> List[Type[Model]]: ... ) -> List[Type[Model]]: ...

View File

@@ -1,7 +1,7 @@
from datetime import datetime from datetime import datetime
from decimal import Decimal from decimal import Decimal
from re import RegexFlag from re import RegexFlag
from typing import Any, Dict, List, Optional, Union, Pattern from typing import Any, Dict, List, Optional, Union, Pattern, Collection
from uuid import UUID from uuid import UUID
from django.core.files.base import File from django.core.files.base import File
@@ -38,7 +38,7 @@ class URLValidator(RegexValidator):
tld_re: Any = ... tld_re: Any = ...
host_re: Any = ... host_re: Any = ...
schemes: Any = ... schemes: Any = ...
def __init__(self, schemes: Optional[List[str]] = ..., **kwargs: Any) -> None: ... def __init__(self, schemes: Optional[Collection[str]] = ..., **kwargs: Any) -> None: ...
integer_validator: Any integer_validator: Any
@@ -52,7 +52,7 @@ class EmailValidator:
literal_regex: Any = ... literal_regex: Any = ...
domain_whitelist: Any = ... domain_whitelist: Any = ...
def __init__( def __init__(
self, message: Optional[str] = ..., code: Optional[str] = ..., whitelist: Optional[List[str]] = ... self, message: Optional[str] = ..., code: Optional[str] = ..., whitelist: Optional[Collection[str]] = ...
) -> None: ... ) -> None: ...
def __call__(self, value: Optional[str]) -> None: ... def __call__(self, value: Optional[str]) -> None: ...
def validate_domain_part(self, domain_part: str) -> bool: ... def validate_domain_part(self, domain_part: str) -> bool: ...
@@ -119,7 +119,10 @@ class FileExtensionValidator:
code: str = ... code: str = ...
allowed_extensions: List[str] = ... allowed_extensions: List[str] = ...
def __init__( def __init__(
self, allowed_extensions: Optional[List[str]] = ..., message: Optional[str] = ..., code: Optional[str] = ... self,
allowed_extensions: Optional[Collection[str]] = ...,
message: Optional[str] = ...,
code: Optional[str] = ...,
) -> None: ... ) -> None: ...
def __call__(self, value: File) -> None: ... def __call__(self, value: File) -> None: ...

View File

@@ -1,9 +1,16 @@
from typing import Any, Callable, Dict, Iterator, List, Optional from typing import Any, Callable, Dict, Iterator, List, Optional
from django.db.backends.base.client import BaseDatabaseClient
from django.db.backends.base.creation import BaseDatabaseCreation
from django.db.backends.base.validation import BaseDatabaseValidation
from django.db.backends.utils import CursorDebugWrapper, CursorWrapper from django.db.backends.utils import CursorDebugWrapper, CursorWrapper
from django.db.backends.base.schema import BaseDatabaseSchemaEditor from django.db.backends.base.schema import BaseDatabaseSchemaEditor
from django.db.backends.base.features import BaseDatabaseFeatures
from django.db.backends.base.introspection import BaseDatabaseIntrospection
NO_DB_ALIAS: str NO_DB_ALIAS: str
class BaseDatabaseWrapper: class BaseDatabaseWrapper:
@@ -23,7 +30,7 @@ class BaseDatabaseWrapper:
queries_limit: int = ... queries_limit: int = ...
connection: Any = ... connection: Any = ...
settings_dict: Any = ... settings_dict: Any = ...
alias: Any = ... alias: str = ...
queries_log: Any = ... queries_log: Any = ...
force_debug_cursor: bool = ... force_debug_cursor: bool = ...
autocommit: bool = ... autocommit: bool = ...
@@ -32,18 +39,18 @@ class BaseDatabaseWrapper:
savepoint_ids: Any = ... savepoint_ids: Any = ...
commit_on_exit: bool = ... commit_on_exit: bool = ...
needs_rollback: bool = ... needs_rollback: bool = ...
close_at: Any = ... close_at: Optional[Any] = ...
closed_in_transaction: bool = ... closed_in_transaction: bool = ...
errors_occurred: bool = ... errors_occurred: bool = ...
allow_thread_sharing: Any = ... allow_thread_sharing: bool = ...
run_on_commit: Any = ... run_on_commit: List[Any] = ...
run_commit_hooks_on_set_autocommit_on: bool = ... run_commit_hooks_on_set_autocommit_on: bool = ...
execute_wrappers: Any = ... execute_wrappers: List[Any] = ...
client: Any = ... client: BaseDatabaseClient = ...
creation: Any = ... creation: BaseDatabaseCreation = ...
features: Any = ... features: BaseDatabaseFeatures = ...
introspection: Any = ... introspection: BaseDatabaseIntrospection = ...
validation: Any = ... validation: BaseDatabaseValidation = ...
def __init__( def __init__(
self, settings_dict: Dict[str, Dict[str, str]], alias: str = ..., allow_thread_sharing: bool = ... self, settings_dict: Dict[str, Dict[str, str]], alias: str = ..., allow_thread_sharing: bool = ...
) -> None: ... ) -> None: ...

View File

@@ -1,13 +1,14 @@
from typing import Any, List, Optional, Tuple, Type, Union from typing import Any, ContextManager, List, Optional, Sequence, Tuple, Type, Union
from django.db.backends.ddl_references import Statement from django.db.backends.ddl_references import Statement
from django.db.models.base import Model from django.db.models.base import Model
from django.db.models.fields import Field
from django.db.models.indexes import Index from django.db.models.indexes import Index
from django.db.models.fields import Field
logger: Any logger: Any
class BaseDatabaseSchemaEditor: class BaseDatabaseSchemaEditor(ContextManager[Any]):
sql_create_table: str = ... sql_create_table: str = ...
sql_rename_table: str = ... sql_rename_table: str = ...
sql_retablespace_table: str = ... sql_retablespace_table: str = ...
@@ -27,7 +28,7 @@ class BaseDatabaseSchemaEditor:
sql_create_unique: str = ... sql_create_unique: str = ...
sql_delete_unique: str = ... sql_delete_unique: str = ...
sql_create_fk: str = ... sql_create_fk: str = ...
sql_create_inline_fk: Any = ... sql_create_inline_fk: str = ...
sql_delete_fk: str = ... sql_delete_fk: str = ...
sql_create_index: str = ... sql_create_index: str = ...
sql_delete_index: str = ... sql_delete_index: str = ...
@@ -35,14 +36,14 @@ class BaseDatabaseSchemaEditor:
sql_delete_pk: str = ... sql_delete_pk: str = ...
sql_delete_procedure: str = ... sql_delete_procedure: str = ...
connection: Any = ... connection: Any = ...
collect_sql: Any = ... collect_sql: bool = ...
collected_sql: Any = ... collected_sql: Any = ...
atomic_migration: Any = ... atomic_migration: Any = ...
def __init__(self, connection: Any, collect_sql: bool = ..., atomic: bool = ...) -> None: ... def __init__(self, connection: Any, collect_sql: bool = ..., atomic: bool = ...) -> None: ...
deferred_sql: Any = ... deferred_sql: Any = ...
atomic: Any = ... atomic: Any = ...
def __enter__(self) -> BaseDatabaseSchemaEditor: ... def __enter__(self) -> BaseDatabaseSchemaEditor: ...
def __exit__(self, exc_type: None, exc_value: None, traceback: None) -> None: ... def __exit__(self, exc_type: Any, exc_value: Any, traceback: Any) -> None: ...
def execute(self, sql: Union[Statement, str], params: Optional[Union[List[int], Tuple]] = ...) -> None: ... def execute(self, sql: Union[Statement, str], params: Optional[Union[List[int], Tuple]] = ...) -> None: ...
def quote_name(self, name: str) -> str: ... def quote_name(self, name: str) -> str: ...
def column_sql( def column_sql(
@@ -59,14 +60,14 @@ class BaseDatabaseSchemaEditor:
def alter_unique_together( def alter_unique_together(
self, self,
model: Type[Model], model: Type[Model],
old_unique_together: Union[List[List[str]], Tuple[Tuple[str, str]]], old_unique_together: Sequence[Sequence[str]],
new_unique_together: Union[List[List[str]], Tuple[Tuple[str, str]]], new_unique_together: Sequence[Sequence[str]],
) -> None: ... ) -> None: ...
def alter_index_together( def alter_index_together(
self, self,
model: Type[Model], model: Type[Model],
old_index_together: Union[List[List[str]], List[Tuple[str, str]]], old_index_together: Sequence[Sequence[str]],
new_index_together: Union[List[List[str]], List[Tuple[str, str]]], new_index_together: Sequence[Sequence[str]],
) -> None: ... ) -> None: ...
def alter_db_table(self, model: Type[Model], old_db_table: str, new_db_table: str) -> None: ... def alter_db_table(self, model: Type[Model], old_db_table: str, new_db_table: str) -> None: ...
def alter_db_tablespace(self, model: Any, old_db_tablespace: Any, new_db_tablespace: Any) -> None: ... def alter_db_tablespace(self, model: Any, old_db_tablespace: Any, new_db_tablespace: Any) -> None: ...

View File

@@ -1,4 +1,4 @@
from typing import Any, Optional from typing import Any
from django.db.backends.base.base import BaseDatabaseWrapper from django.db.backends.base.base import BaseDatabaseWrapper
from django.db.backends.base.client import BaseDatabaseClient from django.db.backends.base.client import BaseDatabaseClient
@@ -10,20 +10,16 @@ def complain(*args: Any, **kwargs: Any) -> Any: ...
def ignore(*args: Any, **kwargs: Any) -> None: ... def ignore(*args: Any, **kwargs: Any) -> None: ...
class DatabaseOperations(BaseDatabaseOperations): class DatabaseOperations(BaseDatabaseOperations):
connection: django.db.backends.dummy.base.DatabaseWrapper
quote_name: Any = ... quote_name: Any = ...
class DatabaseClient(BaseDatabaseClient): class DatabaseClient(BaseDatabaseClient):
connection: django.db.backends.dummy.base.DatabaseWrapper
runshell: Any = ... runshell: Any = ...
class DatabaseCreation(BaseDatabaseCreation): class DatabaseCreation(BaseDatabaseCreation):
connection: django.db.backends.dummy.base.DatabaseWrapper
create_test_db: Any = ... create_test_db: Any = ...
destroy_test_db: Any = ... destroy_test_db: Any = ...
class DatabaseIntrospection(BaseDatabaseIntrospection): class DatabaseIntrospection(BaseDatabaseIntrospection):
connection: django.db.backends.dummy.base.DatabaseWrapper
get_table_list: Any = ... get_table_list: Any = ...
get_table_description: Any = ... get_table_description: Any = ...
get_relations: Any = ... get_relations: Any = ...
@@ -31,35 +27,5 @@ class DatabaseIntrospection(BaseDatabaseIntrospection):
get_key_columns: Any = ... get_key_columns: Any = ...
class DatabaseWrapper(BaseDatabaseWrapper): class DatabaseWrapper(BaseDatabaseWrapper):
alias: str
allow_thread_sharing: bool
autocommit: bool
client: django.db.backends.dummy.base.DatabaseClient
close_at: None
closed_in_transaction: bool
commit_on_exit: bool
connection: None
creation: django.db.backends.dummy.base.DatabaseCreation
errors_occurred: bool
execute_wrappers: List[Any]
features: django.db.backends.dummy.features.DummyDatabaseFeatures
force_debug_cursor: bool
in_atomic_block: bool
introspection: django.db.backends.dummy.base.DatabaseIntrospection
needs_rollback: bool
ops: django.db.backends.dummy.base.DatabaseOperations
queries_log: collections.deque
run_commit_hooks_on_set_autocommit_on: bool
run_on_commit: List[Any]
savepoint_ids: List[Any]
savepoint_state: int
settings_dict: Dict[str, Optional[Union[Dict[str, None], int, str]]]
validation: django.db.backends.base.validation.BaseDatabaseValidation
operators: Any = ... operators: Any = ...
ensure_connection: Any = ... ensure_connection: Any = ...
client_class: Any = ...
creation_class: Any = ...
features_class: Any = ...
introspection_class: Any = ...
ops_class: Any = ...
def is_usable(self): ...

View File

@@ -1,25 +1,3 @@
from typing import Any, Optional, Type, Union
from django.db.backends.base.schema import BaseDatabaseSchemaEditor from django.db.backends.base.schema import BaseDatabaseSchemaEditor
from django.db.models.base import Model
from django.db.models.fields import Field
class DatabaseSchemaEditor(BaseDatabaseSchemaEditor): class DatabaseSchemaEditor(BaseDatabaseSchemaEditor): ...
atomic_migration: bool
collect_sql: bool
connection: Any
sql_delete_table: str = ...
sql_create_fk: Any = ...
sql_create_inline_fk: str = ...
sql_create_unique: str = ...
sql_delete_unique: str = ...
def __enter__(self) -> DatabaseSchemaEditor: ...
def __exit__(self, exc_type: None, exc_value: None, traceback: None) -> None: ...
def quote_value(self, value: Optional[Union[int, str]]) -> str: ...
def alter_db_table(
self, model: Type[Model], old_db_table: str, new_db_table: str, disable_constraints: bool = ...
) -> None: ...
def alter_field(self, model: Type[Model], old_field: Field, new_field: Field, strict: bool = ...) -> None: ...
def delete_model(self, model: Type[Model], handle_autom2m: bool = ...) -> None: ...
def add_field(self, model: Type[Model], field: Field) -> None: ...
def remove_field(self, model: Type[Model], field: Field) -> None: ...

View File

@@ -11,7 +11,6 @@ class Node:
parents: Set[Any] = ... parents: Set[Any] = ...
def __init__(self, key: Tuple[str, str]) -> None: ... def __init__(self, key: Tuple[str, str]) -> None: ...
def __lt__(self, other: Union[Tuple[str, str], Node]) -> bool: ... def __lt__(self, other: Union[Tuple[str, str], Node]) -> bool: ...
def __hash__(self) -> int: ...
def __getitem__(self, item: int) -> str: ... def __getitem__(self, item: int) -> str: ...
def add_child(self, child: Node) -> None: ... def add_child(self, child: Node) -> None: ...
def add_parent(self, parent: Node) -> None: ... def add_parent(self, parent: Node) -> None: ...
@@ -19,13 +18,9 @@ class Node:
def descendants(self) -> List[Tuple[str, str]]: ... def descendants(self) -> List[Tuple[str, str]]: ...
class DummyNode(Node): class DummyNode(Node):
children: Set[Any]
key: Tuple[str, str]
parents: Set[Any]
origin: Any = ... origin: Any = ...
error_message: Any = ... error_message: Any = ...
def __init__(self, key: Tuple[str, str], origin: Union[Migration, str], error_message: str) -> None: ... def __init__(self, key: Tuple[str, str], origin: Union[Migration, str], error_message: str) -> None: ...
__class__: Any = ...
def promote(self) -> None: ... def promote(self) -> None: ...
def raise_error(self) -> None: ... def raise_error(self) -> None: ...

View File

@@ -1,9 +1,6 @@
from typing import Any, Dict, Optional, Set, Tuple, Union, Sequence from typing import Any, Dict, Optional, Sequence, Set, Tuple, Union
from django.db import DefaultConnectionProxy from django.db.migrations.migration import Migration
from django.db.backends.base.base import BaseDatabaseWrapper
from django.db.backends.sqlite3.base import DatabaseWrapper
from django.db.migrations.migration import Migration, SwappableTuple
from django.db.migrations.state import ProjectState from django.db.migrations.state import ProjectState
MIGRATIONS_MODULE_NAME: str MIGRATIONS_MODULE_NAME: str
@@ -13,12 +10,7 @@ class MigrationLoader:
disk_migrations: Dict[Tuple[str, str], Migration] = ... disk_migrations: Dict[Tuple[str, str], Migration] = ...
applied_migrations: None = ... applied_migrations: None = ...
ignore_no_migrations: bool = ... ignore_no_migrations: bool = ...
def __init__( def __init__(self, connection: Any, load: bool = ..., ignore_no_migrations: bool = ...) -> None: ...
self,
connection: Optional[Union[DefaultConnectionProxy, BaseDatabaseWrapper]],
load: bool = ...,
ignore_no_migrations: bool = ...,
) -> None: ...
@classmethod @classmethod
def migrations_module(cls, app_label: str) -> Tuple[Optional[str], bool]: ... def migrations_module(cls, app_label: str) -> Tuple[Optional[str], bool]: ...
unmigrated_apps: Set[str] = ... unmigrated_apps: Set[str] = ...
@@ -26,7 +18,7 @@ class MigrationLoader:
def load_disk(self) -> None: ... def load_disk(self) -> None: ...
def get_migration(self, app_label: str, name_prefix: str) -> Migration: ... def get_migration(self, app_label: str, name_prefix: str) -> Migration: ...
def get_migration_by_prefix(self, app_label: str, name_prefix: str) -> Migration: ... def get_migration_by_prefix(self, app_label: str, name_prefix: str) -> Migration: ...
def check_key(self, key: Union[Tuple[str, str], SwappableTuple], current_app: str) -> Optional[Tuple[str, str]]: ... def check_key(self, key: Tuple[str, str], current_app: str) -> Optional[Tuple[str, str]]: ...
def add_internal_dependencies(self, key: Tuple[str, str], migration: Migration) -> None: ... def add_internal_dependencies(self, key: Tuple[str, str], migration: Migration) -> None: ...
def add_external_dependencies(self, key: Tuple[str, str], migration: Migration) -> None: ... def add_external_dependencies(self, key: Tuple[str, str], migration: Migration) -> None: ...
graph: Any = ... graph: Any = ...
@@ -35,5 +27,5 @@ class MigrationLoader:
def check_consistent_history(self, connection: Any) -> None: ... def check_consistent_history(self, connection: Any) -> None: ...
def detect_conflicts(self) -> Dict[str, Set[str]]: ... def detect_conflicts(self) -> Dict[str, Set[str]]: ...
def project_state( def project_state(
self, nodes: Optional[Tuple[str, str], Sequence[Tuple[str, str]]] = ..., at_end: bool = ... self, nodes: Optional[Union[Tuple[str, str], Sequence[Tuple[str, str]]]] = ..., at_end: bool = ...
) -> ProjectState: ... ) -> ProjectState: ...

View File

@@ -13,7 +13,6 @@ class Migration:
name: str = ... name: str = ...
app_label: str = ... app_label: str = ...
def __init__(self, name: str, app_label: str) -> None: ... def __init__(self, name: str, app_label: str) -> None: ...
def __hash__(self) -> int: ...
def mutate_state(self, project_state: ProjectState, preserve: bool = ...) -> ProjectState: ... def mutate_state(self, project_state: ProjectState, preserve: bool = ...) -> ProjectState: ...
def apply( def apply(
self, project_state: ProjectState, schema_editor: BaseDatabaseSchemaEditor, collect_sql: bool = ... self, project_state: ProjectState, schema_editor: BaseDatabaseSchemaEditor, collect_sql: bool = ...
@@ -22,8 +21,8 @@ class Migration:
self, project_state: ProjectState, schema_editor: BaseDatabaseSchemaEditor, collect_sql: bool = ... self, project_state: ProjectState, schema_editor: BaseDatabaseSchemaEditor, collect_sql: bool = ...
) -> ProjectState: ... ) -> ProjectState: ...
class SwappableTuple(tuple): class SwappableTuple(Tuple[str, str]):
setting: str = ... setting: str = ...
def __new__(cls: Type[SwappableTuple], value: Tuple[str, str], setting: str) -> SwappableTuple: ... def __new__(cls, value: Tuple[str, str], setting: str) -> SwappableTuple: ...
def swappable_dependency(value: str) -> SwappableTuple: ... def swappable_dependency(value: str) -> SwappableTuple: ...

View File

@@ -1,7 +1,3 @@
# Stubs for django.db.migrations.operations (Python 3.6)
#
# NOTE: This dynamically typed stub was automatically generated by stubgen.
from .fields import ( from .fields import (
AddField as AddField, AddField as AddField,
AlterField as AlterField, AlterField as AlterField,

View File

@@ -1,4 +1,4 @@
from typing import Any, List, Optional, Type from typing import Any, List
class Operation: class Operation:
reversible: bool = ... reversible: bool = ...
@@ -6,7 +6,6 @@ class Operation:
atomic: bool = ... atomic: bool = ...
elidable: bool = ... elidable: bool = ...
serialization_expand_args: Any = ... serialization_expand_args: Any = ...
def __new__(cls: Type[Operation], *args: Any, **kwargs: Any) -> Operation: ...
def deconstruct(self): ... def deconstruct(self): ...
def state_forwards(self, app_label: Any, state: Any) -> None: ... def state_forwards(self, app_label: Any, state: Any) -> None: ...
def database_forwards(self, app_label: Any, schema_editor: Any, from_state: Any, to_state: Any) -> None: ... def database_forwards(self, app_label: Any, schema_editor: Any, from_state: Any, to_state: Any) -> None: ...

View File

@@ -12,7 +12,6 @@ class ModelOperation(Operation):
def name_lower(self) -> str: ... def name_lower(self) -> str: ...
class CreateModel(ModelOperation): class CreateModel(ModelOperation):
serialization_expand_args: Any = ...
fields: Sequence[Tuple[str, Field]] = ... fields: Sequence[Tuple[str, Field]] = ...
options: Any = ... options: Any = ...
bases: Optional[Sequence[Union[type, str]]] = ... bases: Optional[Sequence[Union[type, str]]] = ...
@@ -46,12 +45,12 @@ class FieldRelatedOptionOperation(ModelOptionOperation): ...
class AlterUniqueTogether(FieldRelatedOptionOperation): class AlterUniqueTogether(FieldRelatedOptionOperation):
option_name: str = ... option_name: str = ...
unique_together: Collection[Sequence[str]] = ... unique_together: Collection[Sequence[str]] = ...
def __init__(self, name: str, unique_together: Collection[Sequence[str]]) -> None: ... def __init__(self, name: str, unique_together: Optional[Collection[Sequence[str]]]) -> None: ...
class AlterIndexTogether(FieldRelatedOptionOperation): class AlterIndexTogether(FieldRelatedOptionOperation):
option_name: str = ... option_name: str = ...
index_together: Collection[Sequence[str]] = ... index_together: Collection[Sequence[str]] = ...
def __init__(self, name: str, index_together: Collection[Sequence[str]]) -> None: ... def __init__(self, name: str, index_together: Optional[Collection[Sequence[str]]]) -> None: ...
class AlterOrderWithRespectTo(FieldRelatedOptionOperation): class AlterOrderWithRespectTo(FieldRelatedOptionOperation):
order_with_respect_to: str = ... order_with_respect_to: str = ...
@@ -63,7 +62,6 @@ class AlterModelOptions(ModelOptionOperation):
def __init__(self, name: str, options: Dict[str, Any]) -> None: ... def __init__(self, name: str, options: Dict[str, Any]) -> None: ...
class AlterModelManagers(ModelOptionOperation): class AlterModelManagers(ModelOptionOperation):
serialization_expand_args: Any = ...
managers: Any = ... managers: Any = ...
def __init__(self, name: Any, managers: Any) -> None: ... def __init__(self, name: Any, managers: Any) -> None: ...

View File

@@ -1,4 +1,4 @@
from typing import Any, Callable, Optional, Sequence, Dict from typing import Any, Callable, Dict, Optional, Sequence
from django.db.backends.base.schema import BaseDatabaseSchemaEditor from django.db.backends.base.schema import BaseDatabaseSchemaEditor
from django.db.migrations.state import StateApps from django.db.migrations.state import StateApps
@@ -6,7 +6,6 @@ from django.db.migrations.state import StateApps
from .base import Operation from .base import Operation
class SeparateDatabaseAndState(Operation): class SeparateDatabaseAndState(Operation):
serialization_expand_args: Any = ...
database_operations: Sequence[Operation] = ... database_operations: Sequence[Operation] = ...
state_operations: Sequence[Operation] = ... state_operations: Sequence[Operation] = ...
def __init__( def __init__(
@@ -19,7 +18,6 @@ class RunSQL(Operation):
reverse_sql: Any = ... reverse_sql: Any = ...
state_operations: Any = ... state_operations: Any = ...
hints: Any = ... hints: Any = ...
elidable: Any = ...
def __init__( def __init__(
self, self,
sql: Any, sql: Any,
@@ -30,12 +28,9 @@ class RunSQL(Operation):
) -> None: ... ) -> None: ...
class RunPython(Operation): class RunPython(Operation):
reduces_to_sql: bool = ...
atomic: bool = ...
code: Callable = ... code: Callable = ...
reverse_code: Optional[Callable] = ... reverse_code: Optional[Callable] = ...
hints: Optional[Dict[str, Any]] = ... hints: Optional[Dict[str, Any]] = ...
elidable: bool = ...
def __init__( def __init__(
self, self,
code: Callable, code: Callable,

View File

@@ -1,6 +1,5 @@
from typing import Any, Optional
from django.db.migrations.state import ProjectState from django.db.migrations.state import ProjectState
from django.db.models.fields import Field from django.db.models.fields import Field
def is_referenced_by_foreign_key(state: ProjectState, model_name_lower: str, field: Field, field_name: str) -> bool: ... def is_referenced_by_foreign_key(state: ProjectState, model_name_lower: str, field: Field, field_name: str) -> bool: ...

View File

@@ -1,7 +1,7 @@
from typing import Any, List, Optional from typing import List, Optional
from django.db.migrations.operations.base import Operation from django.db.migrations.operations.base import Operation
class MigrationOptimizer: class MigrationOptimizer:
def optimize(self, operations: List[Operation], app_label: str = ...) -> List[Operation]: ... def optimize(self, operations: List[Operation], app_label: Optional[str] = ...) -> List[Operation]: ...
def optimize_inner(self, operations: List[Operation], app_label: str = ...) -> List[Operation]: ... def optimize_inner(self, operations: List[Operation], app_label: Optional[str] = ...) -> List[Operation]: ...

View File

@@ -1,14 +1,13 @@
from typing import Any, Dict, Optional, Set from typing import Any, Dict, Optional, Set
from django.db.migrations.state import ModelState from django.db.migrations.state import ModelState
from django.db.models.fields import Field from django.db.models.fields import Field
from .loader import MigrationLoader
class MigrationQuestioner: class MigrationQuestioner:
defaults: Dict[Any, Any] = ... defaults: Dict[str, Any] = ...
specified_apps: Set[Any] = ... specified_apps: Set[str] = ...
dry_run: None = ... dry_run: Optional[bool] = ...
def __init__( def __init__(
self, self,
defaults: Optional[Dict[str, bool]] = ..., defaults: Optional[Dict[str, bool]] = ...,
@@ -23,21 +22,5 @@ class MigrationQuestioner:
def ask_merge(self, app_label: str) -> bool: ... def ask_merge(self, app_label: str) -> bool: ...
def ask_auto_now_add_addition(self, field_name: str, model_name: str) -> None: ... def ask_auto_now_add_addition(self, field_name: str, model_name: str) -> None: ...
class InteractiveMigrationQuestioner(MigrationQuestioner): class InteractiveMigrationQuestioner(MigrationQuestioner): ...
defaults: Dict[Any, Any] class NonInteractiveMigrationQuestioner(MigrationQuestioner): ...
dry_run: bool
specified_apps: Set[str]
def ask_not_null_addition(self, field_name: str, model_name: str) -> None: ...
def ask_not_null_alteration(self, field_name: Any, model_name: Any): ...
def ask_rename(self, model_name: Any, old_name: Any, new_name: Any, field_instance: Any): ...
def ask_rename_model(self, old_model_state: Any, new_model_state: Any): ...
def ask_merge(self, app_label: str) -> bool: ...
def ask_auto_now_add_addition(self, field_name: str, model_name: str) -> int: ...
class NonInteractiveMigrationQuestioner(MigrationQuestioner):
defaults: Dict[Any, Any]
dry_run: bool
specified_apps: Set[str]
def ask_not_null_addition(self, field_name: Any, model_name: Any) -> None: ...
def ask_not_null_alteration(self, field_name: Any, model_name: Any): ...
def ask_auto_now_add_addition(self, field_name: Any, model_name: Any) -> None: ...

View File

@@ -1,9 +1,10 @@
from typing import Any, Optional, Set, Tuple, Union from typing import Any, Optional, Set, Tuple
from django.db import models
from django.db.backends.base.base import BaseDatabaseWrapper from django.db.backends.base.base import BaseDatabaseWrapper
from django.db.models.query import QuerySet from django.db.models.query import QuerySet
from django.db import models
class MigrationRecorder: class MigrationRecorder:
class Migration(models.Model): class Migration(models.Model):
app: Any = ... app: Any = ...

View File

@@ -1,88 +1,40 @@
from typing import Any, Callable, Dict, List, Set, Tuple, Union from typing import Any, Callable, Dict, List, Set, Tuple, Union
from django.db.models.fields import Field
class BaseSerializer: class BaseSerializer:
value: Any = ... value: Any = ...
def __init__(self, value: Any) -> None: ... def __init__(self, value: Any) -> None: ...
def serialize(self) -> None: ... def serialize(self) -> Any: ...
class BaseSequenceSerializer(BaseSerializer): class BaseSequenceSerializer(BaseSerializer): ...
def serialize(self) -> Tuple[str, Set[str]]: ... class BaseSimpleSerializer(BaseSerializer): ...
class DatetimeSerializer(BaseSerializer): ...
class BaseSimpleSerializer(BaseSerializer): class DateSerializer(BaseSerializer): ...
value: str class DecimalSerializer(BaseSerializer): ...
def serialize(self) -> Tuple[str, Set[Any]]: ...
class DatetimeSerializer(BaseSerializer):
value: Any = ...
def serialize(self): ...
class DateSerializer(BaseSerializer):
def serialize(self): ...
class DecimalSerializer(BaseSerializer):
def serialize(self): ...
class DeconstructableSerializer(BaseSerializer): class DeconstructableSerializer(BaseSerializer):
@staticmethod @staticmethod
def serialize_deconstructed( def serialize_deconstructed(
path: str, args: List[Any], kwargs: Dict[str, Union[Callable, int, str]] path: str, args: List[Any], kwargs: Dict[str, Union[Callable, int, str]]
) -> Tuple[str, Set[str]]: ... ) -> Tuple[str, Set[str]]: ...
def serialize(self): ...
class DictionarySerializer(BaseSerializer):
def serialize(self): ...
class EnumSerializer(BaseSerializer):
def serialize(self): ...
class FloatSerializer(BaseSimpleSerializer):
def serialize(self): ...
class DictionarySerializer(BaseSerializer): ...
class EnumSerializer(BaseSerializer): ...
class FloatSerializer(BaseSimpleSerializer): ...
class FrozensetSerializer(BaseSequenceSerializer): ... class FrozensetSerializer(BaseSequenceSerializer): ...
class FunctionTypeSerializer(BaseSerializer): ...
class FunctionTypeSerializer(BaseSerializer): class FunctoolsPartialSerializer(BaseSerializer): ...
value: Callable class IterableSerializer(BaseSerializer): ...
def serialize(self) -> Tuple[str, Set[str]]: ... class ModelFieldSerializer(DeconstructableSerializer): ...
class ModelManagerSerializer(DeconstructableSerializer): ...
class FunctoolsPartialSerializer(BaseSerializer): class OperationSerializer(BaseSerializer): ...
def serialize(self): ... class RegexSerializer(BaseSerializer): ...
class IterableSerializer(BaseSerializer):
def serialize(self): ...
class ModelFieldSerializer(DeconstructableSerializer):
value: Field
def serialize(self) -> Tuple[str, Set[str]]: ...
class ModelManagerSerializer(DeconstructableSerializer):
def serialize(self): ...
class OperationSerializer(BaseSerializer):
def serialize(self): ...
class RegexSerializer(BaseSerializer):
def serialize(self): ...
class SequenceSerializer(BaseSequenceSerializer): ... class SequenceSerializer(BaseSequenceSerializer): ...
class SetSerializer(BaseSequenceSerializer): ... class SetSerializer(BaseSequenceSerializer): ...
class SettingsReferenceSerializer(BaseSerializer): ...
class SettingsReferenceSerializer(BaseSerializer): class TimedeltaSerializer(BaseSerializer): ...
def serialize(self): ... class TimeSerializer(BaseSerializer): ...
class TimedeltaSerializer(BaseSerializer):
def serialize(self): ...
class TimeSerializer(BaseSerializer):
def serialize(self): ...
class TupleSerializer(BaseSequenceSerializer): ... class TupleSerializer(BaseSequenceSerializer): ...
class TypeSerializer(BaseSerializer): ...
class TypeSerializer(BaseSerializer): class UUIDSerializer(BaseSerializer): ...
def serialize(self): ...
class UUIDSerializer(BaseSerializer):
def serialize(self): ...
def serializer_factory(value: Any) -> BaseSerializer: ... def serializer_factory(value: Any) -> BaseSerializer: ...

View File

@@ -1,9 +1,8 @@
from typing import Any, Dict, Iterator, List, Optional, Tuple, Type, DefaultDict, Union, Sequence from typing import Any, DefaultDict, Dict, Iterator, List, Optional, Sequence, Tuple, Type, Union
from django.apps.registry import Apps from django.apps.registry import Apps
from django.db.models.base import Model from django.db.models.base import Model
from django.db.models.manager import Manager from django.db.models.manager import Manager
from django.utils.functional import cached_property
from django.db.models.fields import Field from django.db.models.fields import Field
@@ -22,9 +21,9 @@ class ModelState:
name: str name: str
app_label: str app_label: str
fields: List[Tuple[str, Field]] fields: List[Tuple[str, Field]]
options: Optional[Dict[str, Any]] = ... options: Dict[str, Any] = ...
bases: Optional[Tuple[Type[Model]]] = ... bases: Tuple[Type[Model]] = ...
managers: Optional[List[Tuple[str, Manager]]] = ... managers: List[Tuple[str, Manager]] = ...
def __init__( def __init__(
self, self,
app_label: str, app_label: str,

View File

@@ -1,4 +1,4 @@
from typing import Any, Dict, Iterator, List, Optional, Set from typing import Dict, Iterator, List, Set
from django.db.migrations.operations.base import Operation from django.db.migrations.operations.base import Operation

View File

@@ -1,12 +1,10 @@
from typing import Any, Optional from typing import Any
from django.utils.functional import SimpleLazyObject
COMPILED_REGEX_TYPE: Any COMPILED_REGEX_TYPE: Any
class RegexObject: class RegexObject:
pattern: str = ... pattern: str = ...
flags: int = ... flags: int = ...
def __init__(self, obj: SimpleLazyObject) -> None: ... def __init__(self, obj: Any) -> None: ...
def get_migration_name_timestamp() -> str: ... def get_migration_name_timestamp() -> str: ...

View File

@@ -1,13 +1,10 @@
from typing import Any, Optional, Set, Tuple, Type, List, Union from typing import Any, List, Set, Tuple, Union
from django.db.migrations.migration import Migration from django.db.migrations.migration import Migration
from django.db.migrations.operations.base import Operation from django.db.migrations.operations.base import Operation
from django.db.migrations.operations.models import CreateModel from django.db.migrations.operations.models import CreateModel
class SettingsReference(str): class SettingsReference(str):
def __new__(self: Type[SettingsReference], value: str, setting_name: str) -> SettingsReference: ...
setting_name: str = ...
def __init__(self, value: str, setting_name: str) -> None: ... def __init__(self, value: str, setting_name: str) -> None: ...
class OperationWriter: class OperationWriter:

View File

@@ -8,6 +8,7 @@ _Self = TypeVar("_Self", bound="Model")
class Model(metaclass=ModelBase): class Model(metaclass=ModelBase):
class DoesNotExist(Exception): ... class DoesNotExist(Exception): ...
class MultipleObjectsReturned(Exception): ...
class Meta: ... class Meta: ...
_meta: Any _meta: Any
_default_manager: Manager[Model] _default_manager: Manager[Model]
@@ -15,6 +16,7 @@ class Model(metaclass=ModelBase):
def __init__(self: _Self, *args, **kwargs) -> None: ... def __init__(self: _Self, *args, **kwargs) -> None: ...
def delete(self, using: Any = ..., keep_parents: bool = ...) -> Tuple[int, Dict[str, int]]: ... def delete(self, using: Any = ..., keep_parents: bool = ...) -> Tuple[int, Dict[str, int]]: ...
def full_clean(self, exclude: Optional[List[str]] = ..., validate_unique: bool = ...) -> None: ... def full_clean(self, exclude: Optional[List[str]] = ..., validate_unique: bool = ...) -> None: ...
def clean(self) -> None: ...
def clean_fields(self, exclude: List[str] = ...) -> None: ... def clean_fields(self, exclude: List[str] = ...) -> None: ...
def validate_unique(self, exclude: List[str] = ...) -> None: ... def validate_unique(self, exclude: List[str] = ...) -> None: ...
def save( def save(
@@ -34,6 +36,7 @@ class Model(metaclass=ModelBase):
): ... ): ...
def refresh_from_db(self: _Self, using: Optional[str] = ..., fields: Optional[List[str]] = ...) -> _Self: ... def refresh_from_db(self: _Self, using: Optional[str] = ..., fields: Optional[List[str]] = ...) -> _Self: ...
def get_deferred_fields(self) -> Set[str]: ... def get_deferred_fields(self) -> Set[str]: ...
def __getstate__(self) -> dict: ...
class ModelStateFieldsCacheDescriptor: ... class ModelStateFieldsCacheDescriptor: ...

View File

@@ -1,20 +1,18 @@
from collections import OrderedDict
from datetime import datetime, timedelta from datetime import datetime, timedelta
from typing import Any, Callable, Dict, Iterator, List, Optional, Sequence, Set, Tuple, Type, Union, TypeVar from typing import Any, Callable, Dict, Iterator, List, Optional, Sequence, Set, Tuple, Type, TypeVar, Union
from django.db.models.lookups import Lookup from django.db.models.lookups import Lookup
from django.db.models.sql.compiler import SQLCompiler from django.db.models.sql.compiler import SQLCompiler
from django.db.models import Q, QuerySet from django.db.models import Q, QuerySet
from django.db.models.fields import Field, FloatField from django.db.models.fields import Field
from django.db.models.sql import Query
_OutputField = Union[Field, str] _OutputField = Union[Field, str]
class SQLiteNumericMixin: class SQLiteNumericMixin:
def as_sqlite(self, compiler: SQLCompiler, connection: Any, **extra_context: Any) -> Tuple[str, List[float]]: ... def as_sqlite(self, compiler: SQLCompiler, connection: Any, **extra_context: Any) -> Tuple[str, List[float]]: ...
_SelfCombinable = TypeVar("_SelfCombinable", bound="Combinable") _Self = TypeVar("_Self")
class Combinable: class Combinable:
ADD: str = ... ADD: str = ...
@@ -27,22 +25,20 @@ class Combinable:
BITOR: str = ... BITOR: str = ...
BITLEFTSHIFT: str = ... BITLEFTSHIFT: str = ...
BITRIGHTSHIFT: str = ... BITRIGHTSHIFT: str = ...
def __neg__(self: _SelfCombinable) -> _SelfCombinable: ... def __neg__(self: _Self) -> _Self: ...
def __add__( def __add__(self: _Self, other: Optional[Union[timedelta, Combinable, float, str]]) -> _Self: ...
self: _SelfCombinable, other: Optional[Union[timedelta, Combinable, float, str]] def __sub__(self: _Self, other: Union[timedelta, Combinable, float]) -> _Self: ...
) -> _SelfCombinable: ... def __mul__(self: _Self, other: Union[timedelta, Combinable, float]) -> _Self: ...
def __sub__(self: _SelfCombinable, other: Union[timedelta, Combinable, float]) -> _SelfCombinable: ... def __truediv__(self: _Self, other: Union[Combinable, float]) -> _Self: ...
def __mul__(self: _SelfCombinable, other: Union[timedelta, Combinable, float]) -> _SelfCombinable: ... def __itruediv__(self: _Self, other: Union[Combinable, float]) -> _Self: ...
def __truediv__(self: _SelfCombinable, other: Union[Combinable, float]) -> _SelfCombinable: ... def __mod__(self: _Self, other: Union[int, Combinable]) -> _Self: ...
def __itruediv__(self: _SelfCombinable, other: Union[Combinable, float]) -> _SelfCombinable: ... def __pow__(self: _Self, other: Union[float, Combinable]) -> _Self: ...
def __mod__(self: _SelfCombinable, other: Union[int, Combinable]) -> _SelfCombinable: ... def __and__(self: _Self, other: Combinable) -> _Self: ...
def __pow__(self: _SelfCombinable, other: Union[float, Combinable]) -> _SelfCombinable: ... def bitand(self: _Self, other: int) -> _Self: ...
def __and__(self: _SelfCombinable, other: Combinable) -> _SelfCombinable: ... def bitleftshift(self: _Self, other: int) -> _Self: ...
def bitand(self: _SelfCombinable, other: int) -> _SelfCombinable: ... def bitrightshift(self: _Self, other: int) -> _Self: ...
def bitleftshift(self: _SelfCombinable, other: int) -> _SelfCombinable: ... def __or__(self: _Self, other: Combinable) -> _Self: ...
def bitrightshift(self: _SelfCombinable, other: int) -> _SelfCombinable: ... def bitor(self: _Self, other: int) -> _Self: ...
def __or__(self: _SelfCombinable, other: Combinable) -> _SelfCombinable: ...
def bitor(self: _SelfCombinable, other: int) -> _SelfCombinable: ...
def __radd__(self, other: Optional[Union[datetime, float, Combinable]]) -> Combinable: ... def __radd__(self, other: Optional[Union[datetime, float, Combinable]]) -> Combinable: ...
def __rsub__(self, other: Union[float, Combinable]) -> Combinable: ... def __rsub__(self, other: Union[float, Combinable]) -> Combinable: ...
def __rmul__(self, other: Union[float, Combinable]) -> Combinable: ... def __rmul__(self, other: Union[float, Combinable]) -> Combinable: ...
@@ -52,43 +48,45 @@ class Combinable:
def __rand__(self, other: Any) -> Combinable: ... def __rand__(self, other: Any) -> Combinable: ...
def __ror__(self, other: Any) -> Combinable: ... def __ror__(self, other: Any) -> Combinable: ...
_SelfBaseExpression = TypeVar("_SelfBaseExpression", bound="BaseExpression")
class BaseExpression: class BaseExpression:
is_summary: bool = ... is_summary: bool = ...
filterable: bool = ... filterable: bool = ...
window_compatible: bool = ... window_compatible: bool = ...
output_field: Any
def __init__(self, output_field: Optional[_OutputField] = ...) -> None: ... def __init__(self, output_field: Optional[_OutputField] = ...) -> None: ...
def get_db_converters(self, connection: Any) -> List[Callable]: ... def get_db_converters(self, connection: Any) -> List[Callable]: ...
def get_source_expressions(self) -> List[Any]: ... def get_source_expressions(self) -> List[Any]: ...
def set_source_expressions(self, exprs: List[Any]) -> None: ... def set_source_expressions(self, exprs: Sequence[Combinable]) -> None: ...
@property
def contains_aggregate(self) -> bool: ... def contains_aggregate(self) -> bool: ...
@property
def contains_over_clause(self) -> bool: ... def contains_over_clause(self) -> bool: ...
@property
def contains_column_references(self) -> bool: ... def contains_column_references(self) -> bool: ...
def resolve_expression( def resolve_expression(
self, self: _Self,
query: Any = ..., query: Any = ...,
allow_joins: bool = ..., allow_joins: bool = ...,
reuse: Optional[Set[str]] = ..., reuse: Optional[Set[str]] = ...,
summarize: bool = ..., summarize: bool = ...,
for_save: bool = ..., for_save: bool = ...,
) -> BaseExpression: ... ) -> _Self: ...
@property @property
def field(self) -> Field: ... def field(self) -> Field: ...
@property @property
def output_field(self) -> Field: ... def output_field(self) -> Field: ...
@property
def convert_value(self) -> Callable: ... def convert_value(self) -> Callable: ...
def get_lookup(self, lookup: str) -> Optional[Type[Lookup]]: ... def get_lookup(self, lookup: str) -> Optional[Type[Lookup]]: ...
def get_transform(self, name: str) -> Optional[Type[Expression]]: ... def get_transform(self, name: str) -> Optional[Type[Expression]]: ...
def relabeled_clone(self, change_map: Dict[Optional[str], str]) -> Expression: ... def relabeled_clone(self, change_map: Dict[Optional[str], str]) -> Expression: ...
def copy(self) -> BaseExpression: ... def copy(self) -> BaseExpression: ...
def get_group_by_cols(self: _SelfBaseExpression) -> List[_SelfBaseExpression]: ... def get_group_by_cols(self: _Self) -> List[_Self]: ...
def get_source_fields(self) -> List[Optional[Field]]: ... def get_source_fields(self) -> List[Optional[Field]]: ...
def asc(self, **kwargs: Any) -> Expression: ... def asc(self, **kwargs: Any) -> Expression: ...
def desc(self, **kwargs: Any) -> Expression: ... def desc(self, **kwargs: Any) -> Expression: ...
def reverse_ordering(self): ... def reverse_ordering(self): ...
def flatten(self) -> Iterator[Expression]: ... def flatten(self) -> Iterator[Expression]: ...
def __hash__(self) -> int: ...
def deconstruct(self) -> Any: ... def deconstruct(self) -> Any: ...
def as_sqlite(self, compiler: SQLCompiler, connection: Any) -> Any: ... def as_sqlite(self, compiler: SQLCompiler, connection: Any) -> Any: ...
def as_sql(self, compiler: SQLCompiler, connection: Any, **extra_context: Any) -> Any: ... def as_sql(self, compiler: SQLCompiler, connection: Any, **extra_context: Any) -> Any: ...
@@ -105,28 +103,18 @@ class CombinedExpression(SQLiteNumericMixin, Expression):
def __init__( def __init__(
self, lhs: Combinable, connector: str, rhs: Combinable, output_field: Optional[_OutputField] = ... self, lhs: Combinable, connector: str, rhs: Combinable, output_field: Optional[_OutputField] = ...
) -> None: ... ) -> None: ...
def get_source_expressions(self) -> Union[List[Combinable], List[SQLiteNumericMixin]]: ...
def set_source_expressions(self, exprs: List[Combinable]) -> None: ...
def resolve_expression(
self,
query: Any = ...,
allow_joins: bool = ...,
reuse: Optional[Set[str]] = ...,
summarize: bool = ...,
for_save: bool = ...,
) -> CombinedExpression: ...
class F(Combinable): class F(Combinable):
name: str name: str
def __init__(self, name: str): ... def __init__(self, name: str): ...
def resolve_expression( def resolve_expression(
self, self: _Self,
query: Any = ..., query: Any = ...,
allow_joins: bool = ..., allow_joins: bool = ...,
reuse: Optional[Set[str]] = ..., reuse: Optional[Set[str]] = ...,
summarize: bool = ..., summarize: bool = ...,
for_save: bool = ..., for_save: bool = ...,
) -> Expression: ... ) -> _Self: ...
def asc(self, **kwargs) -> OrderBy: ... def asc(self, **kwargs) -> OrderBy: ...
def desc(self, **kwargs) -> OrderBy: ... def desc(self, **kwargs) -> OrderBy: ...
def deconstruct(self) -> Any: ... def deconstruct(self) -> Any: ...
@@ -141,8 +129,6 @@ class Subquery(Expression):
def __init__(self, queryset: QuerySet, output_field: Optional[_OutputField] = ..., **extra: Any) -> None: ... def __init__(self, queryset: QuerySet, output_field: Optional[_OutputField] = ..., **extra: Any) -> None: ...
class Exists(Subquery): class Exists(Subquery):
extra: Dict[Any, Any]
template: str = ...
negated: bool = ... negated: bool = ...
def __init__(self, *args: Any, negated: bool = ..., **kwargs: Any) -> None: ... def __init__(self, *args: Any, negated: bool = ..., **kwargs: Any) -> None: ...
def __invert__(self) -> Exists: ... def __invert__(self) -> Exists: ...
@@ -162,30 +148,19 @@ class Value(Expression):
def __init__(self, value: Any, output_field: Optional[_OutputField] = ...) -> None: ... def __init__(self, value: Any, output_field: Optional[_OutputField] = ...) -> None: ...
class RawSQL(Expression): class RawSQL(Expression):
output_field: Field
params: List[Any] params: List[Any]
sql: str sql: str
def __init__(self, sql: str, params: Sequence[Any], output_field: Optional[_OutputField] = ...) -> None: ... def __init__(self, sql: str, params: Sequence[Any], output_field: Optional[_OutputField] = ...) -> None: ...
class Func(SQLiteNumericMixin, Expression): class Func(SQLiteNumericMixin, Expression):
function: Any = ... function: str = ...
name: str = ...
template: str = ... template: str = ...
arg_joiner: str = ... arg_joiner: str = ...
arity: Any = ... arity: int = ...
source_expressions: List[Expression] = ... source_expressions: List[Combinable] = ...
extra: Any = ... extra: Dict[Any, Any] = ...
def __init__(self, *expressions: Any, output_field: Optional[_OutputField] = ..., **extra: Any) -> None: ... def __init__(self, *expressions: Any, output_field: Optional[_OutputField] = ..., **extra: Any) -> None: ...
def get_source_expressions(self) -> List[Combinable]: ...
def set_source_expressions(self, exprs: List[Expression]) -> None: ...
def resolve_expression(
self,
query: Query = ...,
allow_joins: bool = ...,
reuse: Optional[Set[Any]] = ...,
summarize: bool = ...,
for_save: bool = ...,
) -> Func: ...
def copy(self) -> Func: ...
class When(Expression): class When(Expression):
template: str = ... template: str = ...
@@ -205,8 +180,6 @@ class Case(Expression):
class ExpressionWrapper(Expression): class ExpressionWrapper(Expression):
def __init__(self, expression: Union[Q, Combinable], output_field: _OutputField): ... def __init__(self, expression: Union[Q, Combinable], output_field: _OutputField): ...
def set_source_expressions(self, exprs: Sequence[Expression]) -> None: ...
def get_source_expressions(self) -> List[Expression]: ...
class Col(Expression): class Col(Expression):
def __init__(self, alias: str, target: str, output_field: Optional[_OutputField] = ...): ... def __init__(self, alias: str, target: str, output_field: Optional[_OutputField] = ...): ...
@@ -214,8 +187,7 @@ class Col(Expression):
class ExpressionList(Func): class ExpressionList(Func):
def __init__(self, *expressions: Union[BaseExpression, Combinable], **extra: Any) -> None: ... def __init__(self, *expressions: Union[BaseExpression, Combinable], **extra: Any) -> None: ...
class Random(Expression): class Random(Expression): ...
output_field: FloatField
class Ref(Expression): class Ref(Expression):
def __init__(self, refs: str, source: Expression): ... def __init__(self, refs: str, source: Expression): ...

View File

@@ -1,16 +1,14 @@
import uuid
from datetime import date, time, datetime, timedelta
from typing import Any, Optional, Tuple, Iterable, Callable, Dict, Union, Type, TypeVar, Generic
import decimal import decimal
import uuid
from typing_extensions import Literal from datetime import date, datetime, time, timedelta
from typing import Any, Callable, Dict, Generic, Iterable, Optional, Tuple, Type, TypeVar, Union
from django.db.models import Model from django.db.models import Model
from django.db.models.query_utils import RegisterLookupMixin
from django.db.models.expressions import F, Combinable
from django.core.exceptions import FieldDoesNotExist as FieldDoesNotExist from django.core.exceptions import FieldDoesNotExist as FieldDoesNotExist
from django.forms import Widget, Field as FormField from django.db.models.expressions import Combinable
from django.db.models.query_utils import RegisterLookupMixin
from django.forms import Field as FormField, Widget
from .mixins import NOT_PROVIDED as NOT_PROVIDED from .mixins import NOT_PROVIDED as NOT_PROVIDED
_Choice = Tuple[Any, Any] _Choice = Tuple[Any, Any]
@@ -20,7 +18,15 @@ _FieldChoices = Iterable[Union[_Choice, _ChoiceNamedGroup]]
_ValidatorCallable = Callable[..., None] _ValidatorCallable = Callable[..., None]
_ErrorMessagesToOverride = Dict[str, Any] _ErrorMessagesToOverride = Dict[str, Any]
class Field(RegisterLookupMixin): # __set__ value type
_ST = TypeVar("_ST")
# __get__ return type
_GT = TypeVar("_GT")
class Field(RegisterLookupMixin, Generic[_ST, _GT]):
_pyi_private_set_type: Any
_pyi_private_get_type: Any
widget: Widget widget: Widget
help_text: str help_text: str
db_table: str db_table: str
@@ -52,7 +58,8 @@ class Field(RegisterLookupMixin):
validators: Iterable[_ValidatorCallable] = ..., validators: Iterable[_ValidatorCallable] = ...,
error_messages: Optional[_ErrorMessagesToOverride] = ..., error_messages: Optional[_ErrorMessagesToOverride] = ...,
): ... ): ...
def __get__(self, instance, owner) -> Any: ... def __set__(self, instance, value: _ST) -> None: ...
def __get__(self, instance, owner) -> _GT: ...
def deconstruct(self) -> Any: ... def deconstruct(self) -> Any: ...
def set_attributes_from_name(self, name: str) -> None: ... def set_attributes_from_name(self, name: str) -> None: ...
def db_type(self, connection: Any) -> str: ... def db_type(self, connection: Any) -> str: ...
@@ -63,23 +70,25 @@ class Field(RegisterLookupMixin):
def contribute_to_class(self, cls: Type[Model], name: str, private_only: bool = ...) -> None: ... def contribute_to_class(self, cls: Type[Model], name: str, private_only: bool = ...) -> None: ...
def to_python(self, value: Any) -> Any: ... def to_python(self, value: Any) -> Any: ...
class IntegerField(Field): class IntegerField(Field[_ST, _GT]):
def __set__(self, instance, value: Union[int, Combinable, Literal[""]]) -> None: ... _pyi_private_set_type: Union[float, int, str, Combinable]
def __get__(self, instance, owner) -> int: ... _pyi_private_get_type: int
class PositiveIntegerRelDbTypeMixin: class PositiveIntegerRelDbTypeMixin:
def rel_db_type(self, connection: Any): ... def rel_db_type(self, connection: Any): ...
class PositiveIntegerField(PositiveIntegerRelDbTypeMixin, IntegerField): ... class PositiveIntegerField(PositiveIntegerRelDbTypeMixin, IntegerField[_ST, _GT]): ...
class PositiveSmallIntegerField(PositiveIntegerRelDbTypeMixin, IntegerField): ... class PositiveSmallIntegerField(PositiveIntegerRelDbTypeMixin, IntegerField[_ST, _GT]): ...
class SmallIntegerField(IntegerField): ... class SmallIntegerField(IntegerField[_ST, _GT]): ...
class BigIntegerField(IntegerField): ... class BigIntegerField(IntegerField[_ST, _GT]): ...
class FloatField(Field): class FloatField(Field[_ST, _GT]):
def __set__(self, instance, value: Union[float, int, str, Combinable]) -> float: ... _pyi_private_set_type: Union[float, int, str, Combinable]
def __get__(self, instance, owner) -> float: ... _pyi_private_get_type: float
class DecimalField(Field): class DecimalField(Field[_ST, _GT]):
_pyi_private_set_type: Union[str, float, decimal.Decimal, Combinable]
_pyi_private_get_type: decimal.Decimal
def __init__( def __init__(
self, self,
verbose_name: Optional[Union[str, bytes]] = ..., verbose_name: Optional[Union[str, bytes]] = ...,
@@ -102,13 +111,14 @@ class DecimalField(Field):
validators: Iterable[_ValidatorCallable] = ..., validators: Iterable[_ValidatorCallable] = ...,
error_messages: Optional[_ErrorMessagesToOverride] = ..., error_messages: Optional[_ErrorMessagesToOverride] = ...,
): ... ): ...
def __set__(self, instance, value: Union[str, float, decimal.Decimal, Combinable]) -> decimal.Decimal: ...
def __get__(self, instance, owner) -> decimal.Decimal: ...
class AutoField(Field): class AutoField(Field[_ST, _GT]):
def __get__(self, instance, owner) -> int: ... _pyi_private_set_type: Union[Combinable, int, str]
_pyi_private_get_type: int
class CharField(Field): class CharField(Field[_ST, _GT]):
_pyi_private_set_type: Union[str, int, Combinable]
_pyi_private_get_type: str
def __init__( def __init__(
self, self,
verbose_name: Optional[Union[str, bytes]] = ..., verbose_name: Optional[Union[str, bytes]] = ...,
@@ -133,10 +143,8 @@ class CharField(Field):
validators: Iterable[_ValidatorCallable] = ..., validators: Iterable[_ValidatorCallable] = ...,
error_messages: Optional[_ErrorMessagesToOverride] = ..., error_messages: Optional[_ErrorMessagesToOverride] = ...,
): ... ): ...
def __set__(self, instance, value: Union[str, int, Combinable]) -> None: ...
def __get__(self, instance, owner) -> str: ...
class SlugField(CharField): class SlugField(CharField[_ST, _GT]):
def __init__( def __init__(
self, self,
verbose_name: Optional[Union[str, bytes]] = ..., verbose_name: Optional[Union[str, bytes]] = ...,
@@ -163,25 +171,29 @@ class SlugField(CharField):
error_messages: Optional[_ErrorMessagesToOverride] = ..., error_messages: Optional[_ErrorMessagesToOverride] = ...,
): ... ): ...
class EmailField(CharField): ... class EmailField(CharField[_ST, _GT]): ...
class URLField(CharField): ... class URLField(CharField[_ST, _GT]): ...
class TextField(Field): class TextField(Field[_ST, _GT]):
def __set__(self, instance, value: Union[str, Combinable]) -> None: ... _pyi_private_set_type: Union[str, Combinable]
def __get__(self, instance, owner) -> str: ... _pyi_private_get_type: str
class BooleanField(Field): class BooleanField(Field[_ST, _GT]):
def __set__(self, instance, value: Union[bool, Combinable]) -> None: ... _pyi_private_set_type: Union[bool, Combinable]
def __get__(self, instance, owner) -> bool: ... _pyi_private_get_type: bool
class NullBooleanField(Field): class NullBooleanField(Field[_ST, _GT]):
def __set__(self, instance, value: Optional[Union[bool, Combinable]]) -> None: ... _pyi_private_set_type: Optional[Union[bool, Combinable]]
def __get__(self, instance, owner) -> Optional[bool]: ... _pyi_private_get_type: Optional[bool]
class IPAddressField(Field): class IPAddressField(Field[_ST, _GT]):
def __get__(self, instance, owner) -> str: ... _pyi_private_set_type: Union[str, Combinable]
_pyi_private_get_type: str
class GenericIPAddressField(Field[_ST, _GT]):
_pyi_private_set_type: Union[str, int, Callable[..., Any], Combinable]
_pyi_private_get_type: str
class GenericIPAddressField(Field):
default_error_messages: Any = ... default_error_messages: Any = ...
unpack_ipv4: Any = ... unpack_ipv4: Any = ...
protocol: Any = ... protocol: Any = ...
@@ -207,11 +219,12 @@ class GenericIPAddressField(Field):
validators: Iterable[_ValidatorCallable] = ..., validators: Iterable[_ValidatorCallable] = ...,
error_messages: Optional[_ErrorMessagesToOverride] = ..., error_messages: Optional[_ErrorMessagesToOverride] = ...,
) -> None: ... ) -> None: ...
def __get__(self, instance, owner) -> str: ...
class DateTimeCheckMixin: ... class DateTimeCheckMixin: ...
class DateField(DateTimeCheckMixin, Field): class DateField(DateTimeCheckMixin, Field[_ST, _GT]):
_pyi_private_set_type: Union[str, date, Combinable]
_pyi_private_get_type: date
def __init__( def __init__(
self, self,
verbose_name: Optional[Union[str, bytes]] = ..., verbose_name: Optional[Union[str, bytes]] = ...,
@@ -235,10 +248,10 @@ class DateField(DateTimeCheckMixin, Field):
validators: Iterable[_ValidatorCallable] = ..., validators: Iterable[_ValidatorCallable] = ...,
error_messages: Optional[_ErrorMessagesToOverride] = ..., error_messages: Optional[_ErrorMessagesToOverride] = ...,
): ... ): ...
def __set__(self, instance, value: Union[str, date, Combinable]) -> None: ...
def __get__(self, instance, owner) -> date: ...
class TimeField(DateTimeCheckMixin, Field): class TimeField(DateTimeCheckMixin, Field[_ST, _GT]):
_pyi_private_set_type: Union[str, time, datetime, Combinable]
_pyi_private_get_type: time
def __init__( def __init__(
self, self,
verbose_name: Optional[Union[str, bytes]] = ..., verbose_name: Optional[Union[str, bytes]] = ...,
@@ -261,18 +274,15 @@ class TimeField(DateTimeCheckMixin, Field):
validators: Iterable[_ValidatorCallable] = ..., validators: Iterable[_ValidatorCallable] = ...,
error_messages: Optional[_ErrorMessagesToOverride] = ..., error_messages: Optional[_ErrorMessagesToOverride] = ...,
): ... ): ...
def __set__(self, instance, value: Union[str, time, datetime, Combinable]) -> None: ...
def __get__(self, instance, owner) -> time: ...
class DateTimeField(DateField): class DateTimeField(DateField[_ST, _GT]):
def __set__(self, instance, value: Union[str, date, datetime, Combinable]) -> None: ... _pyi_private_get_type: datetime
def __get__(self, instance, owner) -> datetime: ...
class UUIDField(Field): class UUIDField(Field[_ST, _GT]):
def __set__(self, instance, value: Any) -> None: ... _pyi_private_set_type: Union[str, uuid.UUID]
def __get__(self, instance, owner) -> uuid.UUID: ... _pyi_private_get_type: uuid.UUID
class FilePathField(Field): class FilePathField(Field[_ST, _GT]):
path: str = ... path: str = ...
match: Optional[Any] = ... match: Optional[Any] = ...
recursive: bool = ... recursive: bool = ...
@@ -305,10 +315,10 @@ class FilePathField(Field):
error_messages: Optional[_ErrorMessagesToOverride] = ..., error_messages: Optional[_ErrorMessagesToOverride] = ...,
): ... ): ...
class BinaryField(Field): ... class BinaryField(Field[_ST, _GT]): ...
class DurationField(Field): class DurationField(Field[_ST, _GT]):
def __get__(self, instance, owner) -> timedelta: ... _pyi_private_get_type: timedelta
class BigAutoField(AutoField): ... class BigAutoField(AutoField[_ST, _GT]): ...
class CommaSeparatedIntegerField(CharField): ... class CommaSeparatedIntegerField(CharField[_ST, _GT]): ...

View File

@@ -33,7 +33,7 @@ from django.db.models.fields.reverse_related import (
) )
from django.db.models.query_utils import PathInfo, Q from django.db.models.query_utils import PathInfo, Q
from django.db.models.expressions import F from django.db.models.expressions import Combinable
if TYPE_CHECKING: if TYPE_CHECKING:
from django.db.models.manager import RelatedManager from django.db.models.manager import RelatedManager
@@ -49,7 +49,12 @@ _ErrorMessagesToOverride = Dict[str, Any]
RECURSIVE_RELATIONSHIP_CONSTANT: str = ... RECURSIVE_RELATIONSHIP_CONSTANT: str = ...
class RelatedField(FieldCacheMixin, Field): # __set__ value type
_ST = TypeVar("_ST")
# __get__ return type
_GT = TypeVar("_GT")
class RelatedField(FieldCacheMixin, Field[_ST, _GT]):
one_to_many: bool = ... one_to_many: bool = ...
one_to_one: bool = ... one_to_one: bool = ...
many_to_many: bool = ... many_to_many: bool = ...
@@ -83,6 +88,7 @@ class ForeignObject(RelatedField):
related_query_name: None = ..., related_query_name: None = ...,
limit_choices_to: Optional[Union[Dict[str, Any], Callable[[], Any]]] = ..., limit_choices_to: Optional[Union[Dict[str, Any], Callable[[], Any]]] = ...,
parent_link: bool = ..., parent_link: bool = ...,
db_constraint: bool = ...,
swappable: bool = ..., swappable: bool = ...,
verbose_name: Optional[str] = ..., verbose_name: Optional[str] = ...,
name: Optional[str] = ..., name: Optional[str] = ...,
@@ -103,16 +109,82 @@ class ForeignObject(RelatedField):
error_messages: Optional[_ErrorMessagesToOverride] = ..., error_messages: Optional[_ErrorMessagesToOverride] = ...,
): ... ): ...
class ForeignKey(RelatedField, Generic[_T]): class ForeignKey(RelatedField[_ST, _GT]):
def __init__(self, to: Union[Type[_T], str], on_delete: Any, related_name: str = ..., **kwargs): ... _pyi_private_set_type: Union[Any, Combinable]
def __set__(self, instance, value: Union[Model, F]) -> None: ... _pyi_private_get_type: Any
def __get__(self, instance, owner) -> _T: ... def __init__(
self,
to: Union[Type[Model], str],
on_delete: Callable[..., None],
to_field: Optional[str] = ...,
related_name: str = ...,
related_query_name: Optional[str] = ...,
limit_choices_to: Optional[Union[Dict[str, Any], Callable[[], Any], Q]] = ...,
parent_link: bool = ...,
db_constraint: bool = ...,
verbose_name: Optional[Union[str, bytes]] = ...,
name: Optional[str] = ...,
primary_key: bool = ...,
max_length: Optional[int] = ...,
unique: bool = ...,
blank: bool = ...,
null: bool = ...,
db_index: bool = ...,
default: Any = ...,
editable: bool = ...,
auto_created: bool = ...,
serialize: bool = ...,
unique_for_date: Optional[str] = ...,
unique_for_month: Optional[str] = ...,
unique_for_year: Optional[str] = ...,
choices: Optional[_FieldChoices] = ...,
help_text: str = ...,
db_column: Optional[str] = ...,
db_tablespace: Optional[str] = ...,
validators: Iterable[_ValidatorCallable] = ...,
error_messages: Optional[_ErrorMessagesToOverride] = ...,
): ...
class OneToOneField(RelatedField, Generic[_T]): class OneToOneField(RelatedField[_ST, _GT]):
def __init__(self, to: Union[Type[_T], str], on_delete: Any, related_name: str = ..., **kwargs): ... _pyi_private_set_type: Union[Any, Combinable]
def __get__(self, instance, owner) -> _T: ... _pyi_private_get_type: Any
def __init__(
self,
to: Union[Type[Model], str],
on_delete: Any,
to_field: Optional[str] = ...,
related_name: str = ...,
related_query_name: Optional[str] = ...,
limit_choices_to: Optional[Union[Dict[str, Any], Callable[[], Any], Q]] = ...,
parent_link: bool = ...,
db_constraint: bool = ...,
verbose_name: Optional[Union[str, bytes]] = ...,
name: Optional[str] = ...,
primary_key: bool = ...,
max_length: Optional[int] = ...,
unique: bool = ...,
blank: bool = ...,
null: bool = ...,
db_index: bool = ...,
default: Any = ...,
editable: bool = ...,
auto_created: bool = ...,
serialize: bool = ...,
unique_for_date: Optional[str] = ...,
unique_for_month: Optional[str] = ...,
unique_for_year: Optional[str] = ...,
choices: Optional[_FieldChoices] = ...,
help_text: str = ...,
db_column: Optional[str] = ...,
db_tablespace: Optional[str] = ...,
validators: Iterable[_ValidatorCallable] = ...,
error_messages: Optional[_ErrorMessagesToOverride] = ...,
): ...
class ManyToManyField(RelatedField[_ST, _GT]):
_pyi_private_set_type: Sequence[Any]
_pyi_private_get_type: RelatedManager[Any]
class ManyToManyField(RelatedField, Generic[_T]):
many_to_many: bool = ... many_to_many: bool = ...
many_to_one: bool = ... many_to_one: bool = ...
one_to_many: bool = ... one_to_many: bool = ...
@@ -126,17 +198,35 @@ class ManyToManyField(RelatedField, Generic[_T]):
to: Union[Type[_T], str], to: Union[Type[_T], str],
related_name: Optional[str] = ..., related_name: Optional[str] = ...,
related_query_name: Optional[str] = ..., related_query_name: Optional[str] = ...,
limit_choices_to: Optional[Union[Dict[str, Any], Callable[[], Any]]] = ..., limit_choices_to: Optional[Union[Dict[str, Any], Callable[[], Any], Q]] = ...,
symmetrical: Optional[bool] = ..., symmetrical: Optional[bool] = ...,
through: Optional[Union[str, Type[Model]]] = ..., through: Optional[Union[str, Type[Model]]] = ...,
through_fields: Optional[Tuple[str, str]] = ..., through_fields: Optional[Tuple[str, str]] = ...,
db_constraint: bool = ..., db_constraint: bool = ...,
db_table: Optional[str] = ..., db_table: Optional[str] = ...,
swappable: bool = ..., swappable: bool = ...,
**kwargs: Any verbose_name: Optional[Union[str, bytes]] = ...,
name: Optional[str] = ...,
primary_key: bool = ...,
max_length: Optional[int] = ...,
unique: bool = ...,
blank: bool = ...,
null: bool = ...,
db_index: bool = ...,
default: Any = ...,
editable: bool = ...,
auto_created: bool = ...,
serialize: bool = ...,
unique_for_date: Optional[str] = ...,
unique_for_month: Optional[str] = ...,
unique_for_year: Optional[str] = ...,
choices: Optional[_FieldChoices] = ...,
help_text: str = ...,
db_column: Optional[str] = ...,
db_tablespace: Optional[str] = ...,
validators: Iterable[_ValidatorCallable] = ...,
error_messages: Optional[_ErrorMessagesToOverride] = ...,
) -> None: ... ) -> None: ...
def __set__(self, instance, value: Sequence[_T]) -> None: ...
def __get__(self, instance, owner) -> RelatedManager[_T]: ...
def check(self, **kwargs: Any) -> List[Any]: ... def check(self, **kwargs: Any) -> List[Any]: ...
def deconstruct(self) -> Tuple[Optional[str], str, List[Any], Dict[str, str]]: ... def deconstruct(self) -> Tuple[Optional[str], str, List[Any], Dict[str, str]]: ...
def get_path_info(self, filtered_relation: None = ...) -> List[PathInfo]: ... def get_path_info(self, filtered_relation: None = ...) -> List[PathInfo]: ...

View File

@@ -1,51 +1,11 @@
from datetime import date from typing import Any, Union
from decimal import Decimal
from typing import Any, Callable, Dict, List, Union
from django.db.models.expressions import Combinable, Expression
from django.db.models import Func from django.db.models import Func
from django.db.models.fields import Field from django.db.models.fields import Field
class Cast(Func): class Cast(Func):
contains_aggregate: bool def __init__(self, expression: Any, output_field: Union[str, Field]) -> None: ...
convert_value: Callable
extra: Dict[Any, Any]
is_summary: bool
output_field: Field
source_expressions: List[Combinable]
function: str = ...
template: str = ...
def __init__(self, expression: Union[date, Decimal, Expression, str], output_field: Union[str, Field]) -> None: ...
class Coalesce(Func): class Coalesce(Func): ...
contains_aggregate: bool class Greatest(Func): ...
convert_value: Callable class Least(Func): ...
extra: Dict[Any, Any]
is_summary: bool
output_field: Field
source_expressions: List[Combinable]
function: str = ...
def __init__(self, *expressions: Any, **extra: Any) -> None: ...
class Greatest(Func):
contains_aggregate: bool
contains_over_clause: bool
convert_value: Callable
extra: Dict[Any, Any]
is_summary: bool
output_field: Field
source_expressions: List[Combinable]
function: str = ...
def __init__(self, *expressions: Any, **extra: Any) -> None: ...
class Least(Func):
contains_aggregate: bool
contains_over_clause: bool
convert_value: Callable
extra: Dict[Any, Any]
is_summary: bool
output_field: Field
source_expressions: List[Combinable]
function: str = ...
def __init__(self, *expressions: Any, **extra: Any) -> None: ...

Some files were not shown because too many files have changed in this diff Show More