63 Commits

Author SHA1 Message Date
Maxim Kurnikov
540e28f4c6 bump version to 1.3.0 2019-12-06 23:37:19 +03:00
Maksim Kurnikov
4ac43c6ed6 Add Django 3.0 testing to CI (#246)
* add Django 3.0 testing to CI

* remove importlib_metadata usage

* conditionally load choices module for tests
2019-12-06 23:36:24 +03:00
Maksim Kurnikov
cadd6c963b fix model's on_cascade= parameter for test, update to latest gdal (#247) 2019-12-06 03:40:55 +03:00
Konstantin Alekseev
041754f817 Fix smtp backend open (#240) 2019-12-01 20:46:11 +03:00
Konstantin Alekseev
c0c5d1e588 Cleanup EmailMessage types (#208)
* Cleanup EmailMessage types

* Typecheck email module tests.
2019-12-01 17:14:16 +03:00
Maksim Kurnikov
f824003cc4 remove unused ignore pattern (#239) 2019-12-01 00:09:36 +03:00
Youssef Moussaoui
58f1833cab Declare is_relation and related_model on Field (#230) 2019-11-30 22:40:22 +03:00
Maksim Kurnikov
cbb6a7a9ac Merge pull request #238 from mkurnikov/mypy-750
Mypy 0.750 support
2019-11-30 22:27:50 +03:00
Maxim Kurnikov
2c4827bbaf properly change type of self for methods on custom manager classes 2019-11-30 22:08:16 +03:00
Maxim Kurnikov
5a151bf851 update django tests branch 2019-11-30 20:56:31 +03:00
Konstantin Alekseev
cbc7159995 Support mypy 0.750 2019-11-30 13:39:28 +03:00
Patrick Gingras
df4c17a947 added base_fields and declared_fields properties to Form (#235) 2019-11-27 22:48:05 +03:00
yaegassy
445abc046c README.md Fix: sample code for "Notes" (#234) 2019-11-26 15:40:21 +03:00
Anthony Ricaud
557b7a4fa3 Add new View.setup method introduced in Django 2.2 (#233)
https://docs.djangoproject.com/en/2.2/ref/class-based-views/base/#django.views.generic.base.View.setup
https://github.com/django/django/blob/2.2/django/views/generic/base.py#L83-L87
2019-11-20 23:49:38 +03:00
Maksim Kurnikov
8343d76895 Fix has_perm() methods for auth backend, and for contrib.auth.models (#232)
* fix has_perm() methods

* lint
2019-11-19 04:54:17 +03:00
Maksim Kurnikov
8d986a0f43 remove catch-all __getattr__ for Manager, fix some issues with manager methods (#227) 2019-11-12 20:36:07 +03:00
Pilifer
e9a90ebff0 More precise annotations of utils.timezone functions that return instances of tzinfo subclasses. (#209)
* fix annotations of utils.timezone

* use intermediary tzinfo subclass exposed in pytz typeshed

* fix annotations of get_fixed_timezone as it returns datetime.timezone in Django 2.2

* add explanatory comment to get_current_timezone annotations

* black utils.timezone.pyi
2019-11-12 18:27:54 +03:00
Christopher Sabater Cordero
7b74a6944a Add a few missing types to the stubfiles (#214)
* Add types to stub files.

* Fix black and flake8 errors.
2019-11-12 18:25:31 +03:00
Seth Yastrov
83f11a0fc6 Add Tags.translation to stub (#226) 2019-11-12 18:23:29 +03:00
Seth Yastrov
2829faf1af Both CSRF_COOKIE_SAMESITE and SESSION_COOKIE_SAMESITE should be Optional (#216) 2019-11-12 16:13:16 +03:00
src
d061e84cc7 Add HttpResponsePermanentRedirect to django.shortcuts (#211) 2019-11-12 16:12:36 +03:00
Anna Sidwell
3a9263dc62 Two small improvements (#217)
* Add return type for admin.SimpleListFilter.lookups

* force_login() can take any user, not just builtin
2019-11-12 13:31:24 +03:00
Yngve Høiseth
14aea2b4d4 Allow returning bool from test_func (#220) 2019-11-12 05:52:23 +03:00
Maksim Kurnikov
287c64d6fb Pin to 0.740 and fix CI (#225)
* update django sources

* pin mypy version, update to 0.740

* fix tests typechecking

* fix lint
2019-11-12 05:17:36 +03:00
Nikita Sobolev
6601121db2 Fixes travis url 2019-10-21 23:47:06 +03:00
Andrey
87d59c7c1a Fix django.contrib.admin.options.BaseModelAdmin.has_add_permission (#205)
* Fix `django.contrib.admin.options.BaseModelAdmin.has_add_permission` (#203).

* Add `django.db.models.base.Model.unique_error_message` (#204).
2019-10-11 12:16:21 +03:00
Maxim Kurnikov
8402e7c53e improve annotations in some places (#202)
* improve annotations in some places

* linting
2019-10-07 14:50:45 +03:00
Maxim Kurnikov
dceb075152 fix annotation for BaseCommand.handle() (#201) 2019-10-05 21:36:41 +03:00
Maxim Kurnikov
7e3f4bfa02 Fix ForeignKey type for self-reference defined in the abstract model (#200) 2019-10-05 21:36:29 +03:00
Maxim Kurnikov
db9ff6aaf6 Fix crash if model from same app referenced in RelatedField cannot be resolved (#199)
* do not crash if model from same app refd in ForeignKey cannot be resolved

* bump to 1.2.0
2019-10-05 20:00:51 +03:00
Maxim Kurnikov
717be5940f Reorganize code a bit, add current directory to sys.path (#198)
* reorganize code a bit

* add current directory to sys.path

* remove PYTHONPATH mention from the docs

* linting
2019-10-05 19:44:29 +03:00
Nikita Sobolev
b939bc96b7 Improves README with new example repo, python version matrix (#195) 2019-10-01 15:24:48 +03:00
Maxim Kurnikov
02bdf5be95 add support for typechecking of filter/get/exclude arguments (#183)
* add support for typechecking of filter/get/exclude arguments

* linting
2019-09-30 03:05:40 +03:00
Maxim Kurnikov
4d4b0003bd Fix Paginator properties mistyped as Callables (#193)
Co-authored-by: Nick Sweeting <git@sweeting.me>
2019-09-28 22:16:20 +03:00
Maxim Kurnikov
e143ba568c add mypy compatibility table (#190)
* add mypy compatibility table

* add django versions to compatibility table
2019-09-28 22:14:16 +03:00
Maxim Kurnikov
32c0cbca45 add some diagnostic for unused ignores for tests typechecking (#191) 2019-09-28 21:38:56 +03:00
Anthony Ricaud
acc3ca4205 Contexts can contain Any data (#192) 2019-09-28 21:38:04 +03:00
Maxim Kurnikov
be3fc259d5 fix compatibility with 0.730 (#189) 2019-09-28 05:23:55 +03:00
Maxim Kurnikov
7725b416b6 add unused ignores reporting (#188) 2019-09-28 04:48:44 +03:00
Maxim Kurnikov
2c23d8e70f Use runtime information to determine whether class is a models.Model subclass (#182) 2019-09-28 04:05:54 +03:00
Anthony Ricaud
5910bd1b25 resolve_template accepts Sequences of str (#187)
- resolve_template is checking for lists or tuples so let's use a generic Sequence
- Union[Template, Template] seemed redundant
2019-09-25 23:32:23 +03:00
Maxim Kurnikov
963d50c717 add linting stubs with flake8-pyi and check for unused imports (#186) 2019-09-25 02:20:23 +03:00
Maxim Kurnikov
7407b93151 Fix type annotations for django.utils.safestring (#179)
* Add/fix types for django.utils.safestring.mark_safe

Django code ref: 964dd4f4f2/django/utils/safestring.py (L71-L84)

* add generic annotations for mark_safe, remove SafeBytes as it is basically deprecated

Co-authored-by: Daniel Hahler <github@thequod.de>
2019-09-23 21:17:17 +03:00
Daniel Hahler
afcd0d9293 Bump isort, use --diff (#164)
* dev-requirements: bump isort: 4.3.4 => 4.3.21

* isort: use --diff

* known_first_party = mypy_django_plugin

* Run isort
2019-09-23 20:45:43 +03:00
Maxim Kurnikov
a85dbff793 update import_all test, add some stubs for postgres (#178) 2019-09-23 19:47:11 +03:00
Maxim Kurnikov
68aebe2528 Add django.contrib.gis.db.models and django.contrib.gis.db.models.fields (#177)
* add django.contrib.gis.db.models and django.contrib.gis.db.models.fields

* install gdal in ci

* add sudo to apt

* add apt update
2019-09-23 19:30:32 +03:00
Peter Law
d3dca5b408 related_name is Optional[str] (#176)
In the current Django (2.1, 2.2), the `related_name` parameter to
`OneToOneField` and `ForeignKey` classes (much like `ManyToManyField`
and the base `ForeignObject` classes) is `Optional[str]`. While
it's true that most authors won't pass `None` here, derived field
types will want to be able to do so.
2019-09-23 17:38:34 +03:00
Peter Law
c69090ec5b Options.verbose_name_raw is always a string (#175)
At least in the current implementation.
2019-09-21 16:07:55 +03:00
Maxim Kurnikov
29ac1c3017 Split AddManagers for model in separate stages to process IncompleteDefnException properly (#171) 2019-09-18 02:20:20 +03:00
Maxim Kurnikov
23ad65033b add custom Field processing for mixins used in the Model subclasses (#167) 2019-09-18 01:40:41 +03:00
Maxim Kurnikov
64720f492c add proper stubs for django.contrib.auth.models model fields (#170) 2019-09-18 01:40:15 +03:00
Maxim Kurnikov
a8fdd4c673 cleanup some stubs in contrib.admin, contrib.admindocs (#169) 2019-09-17 23:30:49 +03:00
Maxim Kurnikov
813dd8cc1a make types for generic mixins less strict (#168) 2019-09-17 23:30:07 +03:00
Maxim Kurnikov
2b53fa5a1a Fix typecheck tests ci (#165)
* remove mention of mypy newsemanal to prepare for 0.730

* make typecheck_tests CI really work

* fix lints

* fix intentional error

* merge stderr in stdout to preserve order

Co-authored-by: Daniel Hahler <github@thequod.de>
2019-09-16 14:35:13 +03:00
Daniel Hahler
e3ea84143f WIP: fix scripts/typecheck_tests.py (#162)
* WIP: fix scripts/typecheck_tests.py

Exit non-zero if it fails to run.

Currently it fails on CI, but goes unnoticed:
https://travis-ci.com/typeddjango/django-stubs/jobs/235296115

* exit on unexpected rc, and output on stderr

* Fix

* scripts/mypy.ini: django_settings_module=scripts.django_tests_settings
2019-09-14 22:23:45 +03:00
Daniel Hahler
82e3aa5464 ci: minor cleanup (#161)
* ci: Travis: remove unnecessary option with black

Already in config, adding a final newline there.

* .travis.yml: minor cleanup
2019-09-14 21:49:13 +03:00
Daniel Hahler
5b9a467cf0 flake8: ignore certain errors for .pyi files (#159) 2019-09-14 10:52:52 +03:00
Nikita Sobolev
4a4dc53c4d Adds syntax highlight 2019-09-08 12:31:30 +03:00
Nikita Sobolev
77fd46987d Adds gitter icon 2019-09-08 12:30:41 +03:00
Nikita Sobolev
9291164a6b Adds github tempaltes, refs #112 (#155) 2019-09-06 09:16:44 +03:00
Wlises R
0c3e06e875 Solve issue 154: Fix wrong type for size in File. (#156) 2019-09-06 09:16:19 +03:00
Jared Kerim
b8379d4fe6 Add property to forms.changed_data fixes #148 (#149) 2019-08-30 11:18:24 +03:00
Nikita Sobolev
caa0e60743 Fixes travis badge 2019-08-25 20:42:00 +03:00
190 changed files with 2372 additions and 905 deletions

35
.github/ISSUE_TEMPLATE/bug.md vendored Normal file
View File

@@ -0,0 +1,35 @@
---
name: Bug
about: Create a report of something is not working
labels: 'bug'
---
# Bug report
<!--
Hi, thanks for submitting a bug. We appreciate that.
But, we will need some information about what's wrong to help you.
-->
## What's wrong
<!--
Describe what is not working.
Please, attach a traceback.
We would also appreciate a failing test case.
That is EXTREMELY helpful!
-->
## How is that should be
<!-- Describe how it should work. -->
## System information
- OS:
- `python` version:
- `django` version:
- `mypy` version:
- `django-stubs` version:

29
.github/pull_request_template.md vendored Normal file
View File

@@ -0,0 +1,29 @@
# I have made things!
<!--
Hi, thanks for submitting a Pull Request. We appreciate it.
Please, fill in all the required information
to make our review and merging processes easier.
Cheers!
-->
## Related issues
<!--
Mark what issues this Pull Request closes or references.
Format is:
- Closes #issue-number
- Refs #issue-number
Example. Refs #0
Documentation: https://blog.github.com/2013-05-14-closing-issues-via-pull-requests/
-->
<!--
If you have any feedback, just write it here.
It can be whatever you want!
-->

2
.gitignore vendored
View File

@@ -9,3 +9,5 @@ build/
dist/ dist/
pip-wheel-metadata/ pip-wheel-metadata/
.pytest_cache/ .pytest_cache/
/.envrc
/.direnv

4
.gitmodules vendored
View File

@@ -1,4 +0,0 @@
[submodule "django-sources"]
path = django-sources
url = https://github.com/django/django.git
branch = stable/2.2.x

View File

@@ -6,17 +6,25 @@ jobs:
include: include:
- 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: 'pytest'
set -e
pytest
- name: Typecheck Django test suite with python 3.7 - name: Typecheck Django 3.0 test suite with python 3.7
python: 3.7 python: 3.7
script: 'python ./scripts/typecheck_tests.py' script: |
pip install Django==3.0.*
python ./scripts/typecheck_tests.py --django_version=3.0
- name: Typecheck Django test suite with python 3.6 - name: Typecheck Django 3.0 test suite with python 3.6
python: 3.6 python: 3.6
script: 'python ./scripts/typecheck_tests.py' script: |
pip install Django==3.0.*
python ./scripts/typecheck_tests.py --django_version=3.0
- name: Typecheck Django 2.2 test suite with python 3.7
python: 3.7
script: |
pip install Django==2.2.*
python ./scripts/typecheck_tests.py --django_version=2.2
- name: Mypy for plugin code - name: Mypy for plugin code
python: 3.7 python: 3.7
@@ -24,18 +32,24 @@ jobs:
- 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 django-stubs/'
- name: Lint plugin code with flake8 - name: Lint plugin code with flake8
python: 3.7 python: 3.7
script: 'flake8' script: 'flake8'
- name: Lint stubs with flake8-pyi and check for unused imports
python: 3.7
script: 'flake8 --config flake8-pyi.ini'
- name: Lint plugin code with isort - name: Lint plugin code with isort
python: 3.7 python: 3.7
script: 'isort --check' script: 'isort --check --diff'
before_install: | before_install: |
# Upgrade pip, setuptools, and wheel sudo add-apt-repository ppa:ubuntugis/ubuntugis-unstable -y
sudo apt-get update
sudo apt-get install -y binutils libproj-dev gdal-bin
pip install -U pip setuptools wheel pip install -U pip setuptools wheel
install: | install: |
pip install -r ./dev-requirements.txt pip install -r ./dev-requirements.txt

View File

@@ -2,70 +2,84 @@
# pep484 stubs for Django framework # pep484 stubs for Django framework
[![Build Status](https://travis-ci.org/mkurnikov/django-stubs.svg?branch=master)](https://travis-ci.org/mkurnikov/django-stubs) [![Build Status](https://travis-ci.com/typeddjango/django-stubs.svg?branch=master)](https://travis-ci.com/typeddjango/django-stubs)
[![Checked with mypy](http://www.mypy-lang.org/static/mypy_badge.svg)](http://mypy-lang.org/) [![Checked with mypy](http://www.mypy-lang.org/static/mypy_badge.svg)](http://mypy-lang.org/)
[![Gitter](https://badges.gitter.im/mypy-django/Lobby.svg)](https://gitter.im/mypy-django/Lobby)
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/2.2.
Could be run on earlier versions of Django, but expect some missing imports warnings. Could be run on earlier versions of Django, but expect some missing imports warnings.
## Installation ## Installation
``` ```bash
pip install django-stubs pip install django-stubs
``` ```
### WARNING: All configuration from pre-1.0.0 versions is dropped, use one below.
### WARNING: 1.0.0 breaks `dmypy`, if you need it, stay on the 0.12.x series. ## Mypy compatibility
| django-stubs | mypy version | django version | python version
| ------------ | ---- | ---- | ---- |
| 1.3.0 | 0.750 | 2.2.x | ^3.6
| 1.2.0 | 0.730 | 2.2.x | ^3.6
| 1.1.0 | 0.720 | 2.2.x | ^3.6
| 0.12.x | old semantic analyzer (<0.711), dmypy support | 2.1.x | ^3.6
## Configuration
To make mypy aware of the plugin, you need to add To make mypy aware of the plugin, you need to add
``` ```ini
[mypy] [mypy]
plugins = plugins =
mypy_django_plugin.main mypy_django_plugin.main
``` ```
in your `mypy.ini` file. in your `mypy.ini` or `setup.cfg` [file](https://mypy.readthedocs.io/en/latest/config_file.html).
Plugin requires Django settings module (what you put into `DJANGO_SETTINGS_MODULE` variable) to be specified inside `mypy.ini` file. Plugin also requires Django settings module (what you put into `DJANGO_SETTINGS_MODULE` variable) to be specified.
```
```ini
[mypy] [mypy]
strict_optional = True strict_optional = True
; this one is new # This one is new:
[mypy.plugins.django-stubs] [mypy.plugins.django-stubs]
django_settings_module = mysettings django_settings_module = mysettings
``` ```
where `mysettings` is a value of `DJANGO_SETTINGS_MODULE` (with or without quotes)
Do you have trouble with mypy / the django plugin not finding your settings module? Try adding the root path of your project to your PYTHONPATH environment variable. If you use pipenv you can add the following to an `.env` file in your project root which pipenv will run automatically before executing any commands.: Where `mysettings` is a value of `DJANGO_SETTINGS_MODULE` (with or without quotes)
```
PYTHONPATH=${PYTHONPATH}:${PWD}
```
New implementation uses Django runtime to extract models information, so it will crash, if your installed apps `models.py` is not correct. For this same reason, you cannot use `reveal_type` inside global scope of any Python file that will be executed for `django.setup()`. Current implementation uses Django runtime to extract models information, so it will crash, if your installed apps `models.py` is not correct. For this same reason, you cannot use `reveal_type` inside global scope of any Python file that will be executed for `django.setup()`.
In other words, if your `manage.py runserver` crashes, mypy will crash too. In other words, if your `manage.py runserver` crashes, mypy will crash too.
This fully working [typed boilerplate](https://github.com/wemake-services/wemake-django-template) can serve you as an example.
## Notes ## Notes
Implementation monkey-patches Django to add `__class_getitem__` to the `Manager` class. If you'd use Python3.7 and do that too in your code, you can make things like Type implementation monkey-patches Django to add `__class_getitem__` to the `Manager` class.
``` If you would use Python3.7 and do that too in your code, you can make things like
```python
class MyUserManager(models.Manager['MyUser']): class MyUserManager(models.Manager['MyUser']):
pass pass
class MyUser(models.Model): class MyUser(models.Model):
objects = UserManager() objects = MyUserManager()
``` ```
work, which should make a error messages a bit better. work, which should make a error messages a bit better.
Otherwise, custom type will be created in mypy, named `MyUser__MyUserManager`, which will rewrite base manager as `models.Manager[User]` to make methods like `get_queryset()` and others return properly typed `QuerySet`. Otherwise, custom type will be created in mypy, named `MyUser__MyUserManager`, which will rewrite base manager as `models.Manager[User]` to make methods like `get_queryset()` and others return properly typed `QuerySet`.
## To get help ## To get help
We have Gitter here https://gitter.im/mypy-django/Lobby. We have Gitter here: <https://gitter.im/mypy-django/Lobby>
If you think you have more generic typing issue, please refer to https://github.com/python/mypy and their Gitter. If you think you have more generic typing issue, please refer to https://github.com/python/mypy and their Gitter.

View File

@@ -1,6 +1,8 @@
black black
pytest-mypy-plugins==1.0.3 pytest-mypy-plugins==1.1.0
psycopg2 psycopg2
flake8 flake8==3.7.8
isort==4.3.4 flake8-pyi==19.3.0
isort==4.3.21
gitpython==3.0.5
-e . -e .

Submodule django-sources deleted from 4d6449e125

View File

@@ -1,5 +1,6 @@
from typing import Any, Iterator, Type, Optional, Dict from typing import Any, Iterator, Type, Optional, Dict
from django.apps.registry import Apps
from django.db.models.base import Model from django.db.models.base import Model
MODELS_MODULE_NAME: str MODELS_MODULE_NAME: str
@@ -7,11 +8,11 @@ MODELS_MODULE_NAME: str
class AppConfig: class AppConfig:
name: str = ... name: str = ...
module: Optional[Any] = ... module: Optional[Any] = ...
apps: None = ... apps: Optional[Apps] = ...
label: str = ... label: str = ...
verbose_name: str = ... verbose_name: str = ...
path: str = ... path: str = ...
models_module: None = ... models_module: Optional[str] = ...
models: 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

View File

@@ -1,6 +1,6 @@
import threading import threading
from collections import OrderedDict from collections import OrderedDict
from typing import Any, Callable, List, Optional, Tuple, Type, Union, Iterable, DefaultDict, Dict from typing import Any, Callable, DefaultDict, Dict, Iterable, List, Optional, Tuple, Type, Union
from django.db.migrations.state import AppConfigStub from django.db.migrations.state import AppConfigStub
from django.db.models.base import Model from django.db.models.base import Model
@@ -8,8 +8,8 @@ from django.db.models.base import Model
from .config import AppConfig from .config import AppConfig
class Apps: class Apps:
all_models: "Dict[str, OrderedDict[str, Type[Model]]]" = ... all_models: Dict[str, OrderedDict[str, Type[Model]]] = ...
app_configs: "OrderedDict[str, AppConfig]" = ... app_configs: OrderedDict[str, AppConfig] = ...
stored_app_configs: List[Any] = ... stored_app_configs: List[Any] = ...
apps_ready: bool = ... apps_ready: bool = ...
ready_event: threading.Event = ... ready_event: threading.Event = ...

View File

@@ -345,7 +345,7 @@ SESSION_COOKIE_PATH = "/"
SESSION_COOKIE_HTTPONLY = True SESSION_COOKIE_HTTPONLY = True
# Whether to set the flag restricting cookie leaks on cross-site requests. # Whether to set the flag restricting cookie leaks on cross-site requests.
# This can be 'Lax', 'Strict', or None to disable the flag. # This can be 'Lax', 'Strict', or None to disable the flag.
SESSION_COOKIE_SAMESITE = "Lax" SESSION_COOKIE_SAMESITE: Optional[str] = ...
# Whether to save the session data on every request. # Whether to save the session data on every request.
SESSION_SAVE_EVERY_REQUEST = False SESSION_SAVE_EVERY_REQUEST = False
# Whether a user's session cookie expires when the Web browser is closed. # Whether a user's session cookie expires when the Web browser is closed.
@@ -413,7 +413,7 @@ CSRF_COOKIE_DOMAIN = None
CSRF_COOKIE_PATH = "/" CSRF_COOKIE_PATH = "/"
CSRF_COOKIE_SECURE = False CSRF_COOKIE_SECURE = False
CSRF_COOKIE_HTTPONLY = False CSRF_COOKIE_HTTPONLY = False
CSRF_COOKIE_SAMESITE = "Lax" CSRF_COOKIE_SAMESITE: Optional[str] = ...
CSRF_HEADER_NAME = "HTTP_X_CSRFTOKEN" CSRF_HEADER_NAME = "HTTP_X_CSRFTOKEN"
CSRF_TRUSTED_ORIGINS: List[str] = ... CSRF_TRUSTED_ORIGINS: List[str] = ...
CSRF_USE_SESSIONS = False CSRF_USE_SESSIONS = False

View File

@@ -1,6 +1,6 @@
from typing import Any, List, Union from typing import Any, List, Union
from django.contrib.admin.options import BaseModelAdmin, InlineModelAdmin, ModelAdmin from django.contrib.admin.options import BaseModelAdmin
from django.core.checks.messages import Error from django.core.checks.messages import Error
_CheckError = Union[str, Error] _CheckError = Union[str, Error]

View File

@@ -1,3 +1,5 @@
from typing import Any, Callable, Optional from typing import Any, Callable, Optional, Type
def register(*models: Any, site: Optional[Any] = ...) -> Callable: ... from django.db.models.base import Model
def register(*models: Type[Model], site: Optional[Any] = ...) -> Callable: ...

View File

@@ -24,7 +24,7 @@ class SimpleListFilter(ListFilter):
parameter_name: Any = ... parameter_name: Any = ...
lookup_choices: Any = ... lookup_choices: Any = ...
def value(self) -> Optional[str]: ... def value(self) -> Optional[str]: ...
def lookups(self, request: Any, model_admin: Any) -> None: ... def lookups(self, request: Any, model_admin: Any) -> List[Tuple[Any, str]]: ...
class FieldListFilter(ListFilter): class FieldListFilter(ListFilter):
field: Field = ... field: Field = ...

View File

@@ -1,4 +1,4 @@
from typing import Any, Callable, Dict, Iterator, List, Optional, Tuple, Union from typing import Any, Callable, Dict, Iterator, List, Optional, Tuple, Union, Iterable
from django.contrib.auth.forms import AdminPasswordChangeForm from django.contrib.auth.forms import AdminPasswordChangeForm
from django.forms.boundfield import BoundField from django.forms.boundfield import BoundField
@@ -26,7 +26,7 @@ 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: Any = ..., readonly_fields: Optional[Iterable[Any]] = ...,
model_admin: Any = ..., model_admin: Any = ...,
) -> None: ... ) -> None: ...
def __iter__(self) -> Iterator[Fieldset]: ... def __iter__(self) -> Iterator[Fieldset]: ...
@@ -47,7 +47,7 @@ class Fieldset:
self, self,
form: Any, form: Any,
name: Optional[Any] = ..., name: Optional[Any] = ...,
readonly_fields: Any = ..., readonly_fields: Optional[Iterable[Any]] = ...,
fields: Any = ..., fields: Any = ...,
classes: Any = ..., classes: Any = ...,
description: Optional[Any] = ..., description: Optional[Any] = ...,
@@ -64,7 +64,7 @@ class Fieldline:
model_admin: Any = ... model_admin: Any = ...
readonly_fields: Any = ... readonly_fields: Any = ...
def __init__( def __init__(
self, form: Any, field: Any, readonly_fields: Optional[Any] = ..., model_admin: Optional[Any] = ... self, form: Any, field: Any, readonly_fields: Optional[Iterable[Any]] = ..., model_admin: Optional[Any] = ...
) -> None: ... ) -> None: ...
def __iter__(self) -> Iterator[Union[AdminField, AdminReadonlyField]]: ... def __iter__(self) -> Iterator[Union[AdminField, AdminReadonlyField]]: ...
def errors(self) -> SafeText: ... def errors(self) -> SafeText: ...

View File

@@ -56,7 +56,6 @@ class BaseModelAdmin:
show_full_result_count: bool = ... show_full_result_count: bool = ...
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 formfield_for_dbfield( def formfield_for_dbfield(
self, db_field: Field, request: Optional[HttpRequest], **kwargs: Any self, db_field: Field, request: Optional[HttpRequest], **kwargs: Any
) -> Optional[Field]: ... ) -> Optional[Field]: ...
@@ -87,14 +86,13 @@ class BaseModelAdmin:
def get_sortable_by(self, request: HttpRequest) -> 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: HttpRequest, to_field: str) -> bool: ... def to_field_allowed(self, request: HttpRequest, to_field: str) -> bool: ...
def has_add_permission(self, request: HttpRequest, obj: Optional[Model] = ...) -> bool: ... def has_add_permission(self, request: HttpRequest) -> bool: ...
def has_change_permission(self, request: HttpRequest, obj: Optional[Model] = ...) -> bool: ... def has_change_permission(self, request: HttpRequest, obj: Optional[Model] = ...) -> bool: ...
def has_delete_permission(self, request: HttpRequest, obj: Optional[Model] = ...) -> bool: ... def has_delete_permission(self, request: HttpRequest, obj: Optional[Model] = ...) -> bool: ...
def has_view_permission(self, request: HttpRequest, obj: Optional[Model] = ...) -> bool: ... def has_view_permission(self, request: HttpRequest, obj: Optional[Model] = ...) -> bool: ...
def has_module_permission(self, request: HttpRequest) -> bool: ... def has_module_permission(self, request: HttpRequest) -> bool: ...
class ModelAdmin(BaseModelAdmin): class ModelAdmin(BaseModelAdmin):
formfield_overrides: Any
list_display: Sequence[Union[str, Callable]] = ... list_display: Sequence[Union[str, Callable]] = ...
list_display_links: Optional[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]]]] = ...
@@ -122,7 +120,6 @@ class ModelAdmin(BaseModelAdmin):
actions_on_top: bool = ... actions_on_top: bool = ...
actions_on_bottom: bool = ... actions_on_bottom: bool = ...
actions_selection_counter: bool = ... actions_selection_counter: bool = ...
checks_class: Any = ...
model: Type[Model] = ... model: Type[Model] = ...
opts: Options = ... opts: Options = ...
admin_site: AdminSite = ... admin_site: AdminSite = ...

View File

@@ -1,11 +1,11 @@
from typing import Any, Callable, Dict, List, Optional, Tuple, Type, Union from typing import Any, Callable, Dict, Iterable, List, Optional, Tuple, Type, Union
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
from django.db.models.base import Model from django.db.models.base import Model
from django.http.response import HttpResponse from django.http.response import HttpResponse
from django.template.response import TemplateResponse from django.template.response import TemplateResponse
from django.urls.resolvers import URLPattern, URLResolver from django.urls.resolvers import URLResolver
from django.utils.functional import LazyObject from django.utils.functional import LazyObject
all_sites: Any all_sites: Any
@@ -31,11 +31,11 @@ class AdminSite:
def check(self, app_configs: None) -> List[Any]: ... def check(self, app_configs: None) -> List[Any]: ...
def register( def register(
self, self,
model_or_iterable: Union[List[Type[Model]], Tuple[Type[Model]], Type[Model]], model_or_iterable: Union[Type[Model], Iterable[Type[Model]]],
admin_class: Optional[Type[ModelAdmin]] = ..., admin_class: Optional[Type[ModelAdmin]] = ...,
**options: Any **options: Any
) -> None: ... ) -> None: ...
def unregister(self, model_or_iterable: Type[Model]) -> None: ... def unregister(self, model_or_iterable: Union[Type[Model], Iterable[Type[Model]]]) -> None: ...
def is_registered(self, model: Type[Model]) -> bool: ... def is_registered(self, model: Type[Model]) -> bool: ...
def add_action(self, action: Callable, name: None = ...) -> None: ... def add_action(self, action: Callable, name: None = ...) -> None: ...
def disable_action(self, name: str) -> None: ... def disable_action(self, name: str) -> None: ...

View File

@@ -27,7 +27,7 @@ class ResultList(list):
def results(cl: ChangeList) -> Iterator[ResultList]: ... def results(cl: ChangeList) -> Iterator[ResultList]: ...
def result_hidden_fields(cl: ChangeList) -> Iterator[BoundField]: ... def result_hidden_fields(cl: ChangeList) -> Iterator[BoundField]: ...
def result_list( def result_list(
cl: ChangeList cl: ChangeList,
) -> Dict[ ) -> Dict[
str, Union[List[Dict[str, Optional[Union[int, str]]]], List[ResultList], List[BoundField], ChangeList, int] str, Union[List[Dict[str, Optional[Union[int, str]]]], List[ResultList], List[BoundField], ChangeList, int]
]: ... ]: ...

View File

@@ -1,7 +1,6 @@
from typing import Any, Optional from typing import Any
from django.contrib.admin.helpers import InlineAdminForm from django.contrib.admin.helpers import InlineAdminForm
from django.contrib.admin.templatetags.base import InclusionAdminNode
from django.template.base import Parser, Token from django.template.base import Parser, Token
from django.template.context import Context, RequestContext from django.template.context import Context, RequestContext

View File

@@ -1,4 +1,4 @@
from typing import Any, Optional from typing import Any
register: Any register: Any

View File

@@ -1,5 +1,7 @@
from typing import Any, Callable, Optional from typing import Callable, TypeVar, overload
def staff_member_required( _C = TypeVar("_C", bound=Callable)
view_func: Optional[Callable] = ..., redirect_field_name: str = ..., login_url: str = ... @overload
) -> Callable: ... def staff_member_required(view_func: _C = ..., redirect_field_name: str = ..., login_url: str = ...) -> _C: ...
@overload
def staff_member_required(view_func: None = ..., redirect_field_name: str = ..., login_url: str = ...) -> Callable: ...

View File

@@ -2,7 +2,11 @@ from collections import OrderedDict
from typing import Any, Callable, Dict, List, Optional, Tuple, Type, Union from typing import Any, Callable, Dict, List, Optional, Tuple, Type, Union
from django.contrib.admin.filters import ListFilter, SimpleListFilter from django.contrib.admin.filters import ListFilter, SimpleListFilter
from django.contrib.admin.options import ModelAdmin, IS_POPUP_VAR as IS_POPUP_VAR, TO_FIELD_VAR as TO_FIELD_VAR from django.contrib.admin.options import ( # noqa: F401
ModelAdmin,
IS_POPUP_VAR as IS_POPUP_VAR,
TO_FIELD_VAR as TO_FIELD_VAR,
)
from django.core.handlers.wsgi import WSGIRequest from django.core.handlers.wsgi import WSGIRequest
from django.db.models.base import Model from django.db.models.base import Model
from django.db.models.expressions import Combinable, CombinedExpression, OrderBy from django.db.models.expressions import Combinable, CombinedExpression, OrderBy
@@ -77,9 +81,7 @@ class ChangeList:
paginator: Any = ... paginator: Any = ...
def get_results(self, request: WSGIRequest) -> None: ... def get_results(self, request: WSGIRequest) -> None: ...
def get_ordering_field(self, field_name: Union[Callable, str]) -> Optional[Union[CombinedExpression, str]]: ... def get_ordering_field(self, field_name: Union[Callable, str]) -> Optional[Union[CombinedExpression, str]]: ...
def get_ordering( def get_ordering(self, request: WSGIRequest, queryset: QuerySet) -> List[Union[OrderBy, Combinable, str]]: ...
self, request: WSGIRequest, queryset: QuerySet
) -> Union[List[Union[Combinable, str]], List[Union[OrderBy, str]]]: ...
def get_ordering_field_columns(self) -> OrderedDict: ... def get_ordering_field_columns(self) -> OrderedDict: ...
def get_queryset(self, request: WSGIRequest) -> QuerySet: ... def get_queryset(self, request: WSGIRequest) -> QuerySet: ...
def apply_select_related(self, qs: QuerySet) -> QuerySet: ... def apply_select_related(self, qs: QuerySet) -> QuerySet: ...

View File

@@ -3,46 +3,17 @@ from typing import Any, Optional, Union
from django.db.models.fields import Field from django.db.models.fields import Field
from django.views.generic import TemplateView from django.views.generic import TemplateView
from .utils import get_view_name
MODEL_METHODS_EXCLUDE: Any MODEL_METHODS_EXCLUDE: Any
class BaseAdminDocsView(TemplateView): class BaseAdminDocsView(TemplateView): ...
template_name: str = ... class BookmarkletsView(BaseAdminDocsView): ...
def dispatch(self, request: Any, *args: Any, **kwargs: Any): ... class TemplateTagIndexView(BaseAdminDocsView): ...
def get_context_data(self, **kwargs: Any): ... class TemplateFilterIndexView(BaseAdminDocsView): ...
class ViewIndexView(BaseAdminDocsView): ...
class BookmarkletsView(BaseAdminDocsView): class ViewDetailView(BaseAdminDocsView): ...
template_name: str = ... class ModelIndexView(BaseAdminDocsView): ...
def get_context_data(self, **kwargs: Any): ... class ModelDetailView(BaseAdminDocsView): ...
class TemplateDetailView(BaseAdminDocsView): ...
class TemplateTagIndexView(BaseAdminDocsView):
template_name: str = ...
def get_context_data(self, **kwargs: Any): ...
class TemplateFilterIndexView(BaseAdminDocsView):
template_name: str = ...
def get_context_data(self, **kwargs: Any): ...
class ViewIndexView(BaseAdminDocsView):
template_name: str = ...
def get_context_data(self, **kwargs: Any): ...
class ViewDetailView(BaseAdminDocsView):
template_name: str = ...
def get_context_data(self, **kwargs: Any): ...
class ModelIndexView(BaseAdminDocsView):
template_name: str = ...
def get_context_data(self, **kwargs: Any): ...
class ModelDetailView(BaseAdminDocsView):
template_name: str = ...
def get_context_data(self, **kwargs: Any): ...
class TemplateDetailView(BaseAdminDocsView):
template_name: str = ...
def get_context_data(self, **kwargs: Any): ...
def get_return_data_type(func_name: Any): ... def get_return_data_type(func_name: Any): ...
def get_readable_field_data_type(field: Union[Field, str]) -> str: ... def get_readable_field_data_type(field: Union[Field, str]) -> str: ...

View File

@@ -3,20 +3,22 @@ from typing import Any, Optional, Set, Union
from django.contrib.auth.base_user import AbstractBaseUser from django.contrib.auth.base_user import AbstractBaseUser
from django.contrib.auth.models import AnonymousUser, User from django.contrib.auth.models import AnonymousUser, User
from django.db.models.base import Model
_AnyUser = Union[Model, AnonymousUser]
UserModel: Any UserModel: Any
class ModelBackend: class ModelBackend:
def authenticate( def authenticate(
self, request: Any, username: Optional[Union[int, str]] = ..., password: Optional[str] = ..., **kwargs: Any self, request: Any, username: Optional[str] = ..., password: Optional[str] = ..., **kwargs: Any
) -> Optional[AbstractBaseUser]: ... ) -> Optional[AbstractBaseUser]: ...
def user_can_authenticate(self, user: Optional[AbstractBaseUser]) -> bool: ... def user_can_authenticate(self, user: Optional[_AnyUser]) -> bool: ...
def get_user_permissions(self, user_obj: AbstractBaseUser, obj: None = ...) -> Set[str]: ... def get_user_permissions(self, user_obj: _AnyUser, obj: Optional[Model] = ...) -> Set[str]: ...
def get_group_permissions(self, user_obj: AbstractBaseUser, obj: None = ...) -> Set[str]: ... def get_group_permissions(self, user_obj: _AnyUser, obj: Optional[Model] = ...) -> Set[str]: ...
def get_all_permissions(self, user_obj: AbstractBaseUser, obj: Optional[str] = ...) -> Set[str]: ... def get_all_permissions(self, user_obj: _AnyUser, obj: Optional[Model] = ...) -> Set[str]: ...
def has_perm( def has_perm(self, user_obj: _AnyUser, perm: str, obj: Optional[Model] = ...) -> bool: ...
self, user_obj: Union[AbstractBaseUser, AnonymousUser], perm: str, obj: Optional[str] = ... def has_module_perms(self, user_obj: _AnyUser, app_label: str) -> bool: ...
) -> bool: ...
def has_module_perms(self, user_obj: Union[AbstractBaseUser, AnonymousUser], app_label: str) -> bool: ...
def get_user(self, user_id: int) -> AbstractBaseUser: ... def get_user(self, user_id: int) -> AbstractBaseUser: ...
class AllowAllUsersModelBackend(ModelBackend): ... class AllowAllUsersModelBackend(ModelBackend): ...

View File

@@ -13,14 +13,12 @@ class BaseUserManager(models.Manager[_T]):
def get_by_natural_key(self, username: Optional[str]) -> _T: ... def get_by_natural_key(self, username: Optional[str]) -> _T: ...
class AbstractBaseUser(models.Model): class AbstractBaseUser(models.Model):
password: models.CharField = ... password = models.CharField(max_length=128)
last_login: models.DateTimeField = ... last_login = models.DateTimeField(blank=True, null=True)
is_active: models.BooleanField = ...
REQUIRED_FIELDS: List[str] = ... REQUIRED_FIELDS: List[str] = ...
class Meta: ... class Meta: ...
def get_username(self) -> str: ... def get_username(self) -> str: ...
def clean(self) -> None: ...
def save(self, *args: Any, **kwargs: Any) -> None: ...
def natural_key(self) -> Tuple[str]: ... def natural_key(self) -> Tuple[str]: ...
@property @property
def is_anonymous(self) -> bool: ... def is_anonymous(self) -> bool: ...

View File

@@ -1,6 +1,6 @@
from typing import Any, Callable, List, Optional, Set, Union from typing import Callable, List, Optional, Set, Union
from django.contrib.auth import REDIRECT_FIELD_NAME as REDIRECT_FIELD_NAME from django.contrib.auth import REDIRECT_FIELD_NAME as REDIRECT_FIELD_NAME # noqa: F401
def user_passes_test( def user_passes_test(
test_func: Callable, login_url: Optional[str] = ..., redirect_field_name: str = ... test_func: Callable, login_url: Optional[str] = ..., redirect_field_name: str = ...

View File

@@ -1,4 +1,4 @@
from typing import Any, Dict, Optional from typing import Any, Dict
UserModel: Any UserModel: Any

View File

@@ -1,4 +1,4 @@
import getpass as getpass import getpass as getpass # noqa: F401
from typing import Any from typing import Any
from django.core.management.base import BaseCommand from django.core.management.base import BaseCommand

View File

@@ -23,6 +23,6 @@ class PermissionRequiredMixin(AccessMixin):
def dispatch(self, request: http.HttpRequest, *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) -> Optional[bool]: ...
def get_test_func(self) -> Callable: ... def get_test_func(self) -> Callable: ...
def dispatch(self, request: http.HttpRequest, *args: Any, **kwargs: Any) -> HttpResponse: ... def dispatch(self, request: http.HttpRequest, *args: Any, **kwargs: Any) -> HttpResponse: ...

View File

@@ -1,4 +1,4 @@
from typing import Any, Collection, Optional, Set, Tuple, Type, TypeVar from typing import Any, Collection, Optional, Set, Tuple, Type, TypeVar, Union
from django.contrib.auth.base_user import AbstractBaseUser as AbstractBaseUser, BaseUserManager as BaseUserManager from django.contrib.auth.base_user import AbstractBaseUser as AbstractBaseUser, BaseUserManager as BaseUserManager
from django.contrib.auth.validators import UnicodeUsernameValidator from django.contrib.auth.validators import UnicodeUsernameValidator
@@ -8,24 +8,30 @@ from django.db.models.manager import EmptyManager
from django.db import models from django.db import models
_AnyUser = Union[Model, "AnonymousUser"]
def update_last_login(sender: Type[AbstractBaseUser], user: AbstractBaseUser, **kwargs: Any) -> None: ... def update_last_login(sender: Type[AbstractBaseUser], user: AbstractBaseUser, **kwargs: Any) -> None: ...
class PermissionManager(models.Manager): class PermissionManager(models.Manager["Permission"]):
def get_by_natural_key(self, codename: str, app_label: str, model: str) -> Permission: ... def get_by_natural_key(self, codename: str, app_label: str, model: str) -> Permission: ...
class Permission(models.Model): class Permission(models.Model):
content_type_id: int content_type_id: int
name: models.CharField = ... objects: PermissionManager
content_type: models.ForeignKey = models.ForeignKey(ContentType, on_delete=models.CASCADE)
codename: models.CharField = ... name = models.CharField(max_length=255)
content_type = models.ForeignKey(ContentType, on_delete=models.CASCADE)
codename = models.CharField(max_length=100)
def natural_key(self) -> Tuple[str, str, str]: ... def natural_key(self) -> Tuple[str, str, str]: ...
class GroupManager(models.Manager): class GroupManager(models.Manager["Group"]):
def get_by_natural_key(self, name: str) -> Group: ... def get_by_natural_key(self, name: str) -> Group: ...
class Group(models.Model): class Group(models.Model):
name: models.CharField = ... objects: GroupManager
permissions: models.ManyToManyField = models.ManyToManyField(Permission)
name = models.CharField(max_length=150)
permissions = models.ManyToManyField(Permission)
def natural_key(self): ... def natural_key(self): ...
_T = TypeVar("_T", bound=Model) _T = TypeVar("_T", bound=Model)
@@ -39,26 +45,28 @@ class UserManager(BaseUserManager[_T]):
) -> _T: ... ) -> _T: ...
class PermissionsMixin(models.Model): class PermissionsMixin(models.Model):
is_superuser: models.BooleanField = ... is_superuser = models.BooleanField()
groups: models.ManyToManyField = models.ManyToManyField(Group) groups = models.ManyToManyField(Group)
user_permissions: models.ManyToManyField = models.ManyToManyField(Permission) user_permissions = models.ManyToManyField(Permission)
def get_group_permissions(self, obj: None = ...) -> Set[str]: ... def get_group_permissions(self, obj: Optional[_AnyUser] = ...) -> Set[str]: ...
def get_all_permissions(self, obj: Optional[str] = ...) -> Set[str]: ... def get_all_permissions(self, obj: Optional[_AnyUser] = ...) -> Set[str]: ...
def has_perm(self, perm: str, obj: Optional[str] = ...) -> bool: ... def has_perm(self, perm: str, obj: Optional[_AnyUser] = ...) -> bool: ...
def has_perms(self, perm_list: Collection[str], obj: None = ...) -> bool: ... def has_perms(self, perm_list: Collection[str], obj: Optional[_AnyUser] = ...) -> bool: ...
def has_module_perms(self, app_label: str) -> bool: ... def has_module_perms(self, app_label: str) -> bool: ...
class AbstractUser(AbstractBaseUser, PermissionsMixin): # type: ignore class AbstractUser(AbstractBaseUser, PermissionsMixin): # type: ignore
username_validator: UnicodeUsernameValidator = ... username_validator: UnicodeUsernameValidator = ...
username: models.CharField = ...
first_name: models.CharField = ... username = models.CharField(max_length=150)
last_name: models.CharField = ... first_name = models.CharField(max_length=30, blank=True)
email: models.EmailField = ... last_name = models.CharField(max_length=150, blank=True)
is_staff: models.BooleanField = ... email = models.EmailField(blank=True)
date_joined: models.DateTimeField = ... is_staff = models.BooleanField()
is_active = models.BooleanField()
date_joined = models.DateTimeField()
EMAIL_FIELD: str = ... EMAIL_FIELD: str = ...
USERNAME_FIELD: str = ... USERNAME_FIELD: str = ...
def clean(self) -> None: ...
def get_full_name(self) -> str: ... def get_full_name(self) -> str: ...
def get_short_name(self) -> str: ... def get_short_name(self) -> str: ...
def email_user(self, subject: str, message: str, from_email: str = ..., **kwargs: Any) -> None: ... def email_user(self, subject: str, message: str, from_email: str = ..., **kwargs: Any) -> None: ...
@@ -80,10 +88,10 @@ class AnonymousUser:
def groups(self) -> EmptyManager: ... def groups(self) -> EmptyManager: ...
@property @property
def user_permissions(self) -> EmptyManager: ... def user_permissions(self) -> EmptyManager: ...
def get_group_permissions(self, obj: None = ...) -> Set[Any]: ... def get_group_permissions(self, obj: Optional[_AnyUser] = ...) -> Set[Any]: ...
def get_all_permissions(self, obj: Any = ...) -> Set[str]: ... def get_all_permissions(self, obj: Optional[_AnyUser] = ...) -> Set[str]: ...
def has_perm(self, perm: str, obj: None = ...) -> bool: ... def has_perm(self, perm: str, obj: Optional[_AnyUser] = ...) -> bool: ...
def has_perms(self, perm_list: Collection[str], obj: None = ...) -> bool: ... def has_perms(self, perm_list: Collection[str], obj: Optional[_AnyUser] = ...) -> bool: ...
def has_module_perms(self, module: str) -> bool: ... def has_module_perms(self, module: str) -> bool: ...
@property @property
def is_anonymous(self) -> bool: ... def is_anonymous(self) -> bool: ...

View File

@@ -1,7 +1,6 @@
from pathlib import Path, PosixPath from pathlib import Path, PosixPath
from typing import Any, List, Mapping, Optional, Protocol, Sequence, Set, Union from typing import Any, List, Mapping, Optional, Protocol, Sequence, Set, Union
from django.contrib.auth.base_user import AbstractBaseUser
from django.db.models.base import Model from django.db.models.base import Model
_UserModel = Model _UserModel = Model

View File

@@ -1,4 +1,4 @@
from typing import Any, List, Optional from typing import Any, List
def check_generic_foreign_keys(app_configs: None = ..., **kwargs: Any) -> List[Any]: ... def check_generic_foreign_keys(app_configs: None = ..., **kwargs: Any) -> List[Any]: ...
def check_model_name_lengths(app_configs: None = ..., **kwargs: Any) -> List[Any]: ... def check_model_name_lengths(app_configs: None = ..., **kwargs: Any) -> List[Any]: ...

View File

@@ -1,19 +1,19 @@
from typing import Any, Callable, Dict, List, Optional, Tuple, Type, Union, Generic from typing import Any, Callable, Dict, List, Optional, Tuple, Type, Union
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.db.models.base import Model from django.db.models.base import Model
from django.db.models.expressions import Combinable
from django.db.models.fields.mixins import FieldCacheMixin
from django.db.models.fields.related import ForeignObject from django.db.models.fields.related import ForeignObject
from django.db.models.fields.related_descriptors import ReverseManyToOneDescriptor from django.db.models.fields.related_descriptors import ReverseManyToOneDescriptor
from django.db.models.fields.reverse_related import ForeignObjectRel from django.db.models.fields.reverse_related import ForeignObjectRel
from django.db.models.expressions import Combinable
from django.db.models.fields import Field, PositiveIntegerField
from django.db.models.fields.mixins import FieldCacheMixin
from django.db.models.query import QuerySet from django.db.models.query import QuerySet
from django.db.models.query_utils import FilteredRelation, PathInfo from django.db.models.query_utils import FilteredRelation, PathInfo
from django.db.models.sql.where import WhereNode from django.db.models.sql.where import WhereNode
from django.db.models.fields import Field, PositiveIntegerField
class GenericForeignKey(FieldCacheMixin): class GenericForeignKey(FieldCacheMixin):
# django-stubs implementation only fields # django-stubs implementation only fields
_pyi_private_set_type: Union[Any, Combinable] _pyi_private_set_type: Union[Any, Combinable]

View File

@@ -1,4 +1,4 @@
from typing import Any, Optional, Union from typing import Union
from django.http.request import HttpRequest from django.http.request import HttpRequest
from django.http.response import HttpResponseRedirect from django.http.response import HttpResponseRedirect

View File

@@ -1,5 +1,3 @@
from typing import Any, Optional
from django.contrib.flatpages.models import FlatPage from django.contrib.flatpages.models import FlatPage
from django.core.handlers.wsgi import WSGIRequest from django.core.handlers.wsgi import WSGIRequest
from django.http.response import HttpResponse from django.http.response import HttpResponse

View File

View File

View File

@@ -0,0 +1,13 @@
from django.db.models import *
from .fields import (
GeometryField as GeometryField,
LineStringField as LineStringField,
MultiLineStringField as MultiLineStringField,
MultiPointField as MultiPointField,
MultiPolygonField as MultiPolygonField,
PointField as PointField,
PolygonField as PolygonField,
GeometryCollectionField as GeometryCollectionField,
RasterField as RasterField,
)

View File

@@ -0,0 +1,91 @@
from typing import Any, Iterable, NamedTuple, Optional, TypeVar, Union, Tuple
from django.db.models.fields import Field, _ErrorMessagesToOverride, _FieldChoices, _ValidatorCallable
_Connection = Any
# __set__ value type
_ST = TypeVar("_ST")
# __get__ return type
_GT = TypeVar("_GT")
class SRIDCacheEntry(NamedTuple):
units: Any
units_name: str
geodetic: bool
spheroid: str
def get_srid_info(srid: int, connection: _Connection) -> SRIDCacheEntry: ...
class BaseSpatialField(Field[_ST, _GT]):
def __init__(
self,
verbose_name: Optional[Union[str, bytes]] = ...,
srid: int = ...,
spatial_index: bool = ...,
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] = ...,
): ...
def spheroid(self, connection: _Connection) -> str: ...
def units(self, connection: _Connection) -> Any: ...
def units_name(self, connection: _Connection) -> str: ...
def geodetic(self, connection: _Connection) -> bool: ...
class GeometryField(BaseSpatialField):
def __init__(
self,
verbose_name: Optional[Union[str, bytes]] = ...,
dim: int = ...,
geography: bool = ...,
extent: Tuple[float, float, float, float] = ...,
tolerance: float = ...,
srid: int = ...,
spatial_index: bool = ...,
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 PointField(GeometryField): ...
class LineStringField(GeometryField): ...
class PolygonField(GeometryField): ...
class MultiPointField(GeometryField): ...
class MultiLineStringField(GeometryField): ...
class MultiPolygonField(GeometryField): ...
class GeometryCollectionField(GeometryField): ...
class RasterField(BaseSpatialField): ...

View File

@@ -1,4 +1,4 @@
from typing import Any, Dict, List, Optional, Union from typing import Any, Dict, List, Union
from django.contrib.messages.storage.base import BaseStorage from django.contrib.messages.storage.base import BaseStorage
from django.http.request import HttpRequest from django.http.request import HttpRequest

View File

@@ -1,4 +1,4 @@
from typing import Any, List, Optional, Union from typing import Any, List, Optional
from django.http.request import HttpRequest from django.http.request import HttpRequest
from django.http.response import HttpResponseBase from django.http.response import HttpResponseBase

View File

@@ -1,3 +1,3 @@
from typing import Dict, Optional from typing import Dict
def get_level_tags() -> Dict[int, str]: ... def get_level_tags() -> Dict[int, str]: ...

View File

@@ -1,4 +1,4 @@
from typing import Any, Dict, Optional from typing import Dict
from django.forms.forms import BaseForm from django.forms.forms import BaseForm
from django.http.response import HttpResponse from django.http.response import HttpResponse

View File

@@ -0,0 +1,24 @@
from .general import (
ArrayAgg as ArrayAgg,
BitAnd as BitAnd,
BitOr as BitOr,
BoolAnd as BoolAnd,
BoolOr as BoolOr,
JSONBAgg as JSONBAgg,
StringAgg as StringAgg,
)
from .statistics import (
Corr as Corr,
CovarPop as CovarPop,
RegrAvgX as RegrAvgX,
RegrAvgY as RegrAvgY,
RegrCount as RegrCount,
RegrIntercept as RegrIntercept,
RegrR2 as RegrR2,
RegrSlope as RegrSlope,
RegrSXX as RegrSXX,
RegrSXY as RegrSXY,
RegrSYY as RegrSYY,
StatAggregate as StatAggregate,
)

View File

@@ -0,0 +1,11 @@
from django.db.models.aggregates import Aggregate
from .mixins import OrderableAggMixin
class ArrayAgg(OrderableAggMixin, Aggregate): ...
class BitAnd(Aggregate): ...
class BitOr(Aggregate): ...
class BoolAnd(Aggregate): ...
class BoolOr(Aggregate): ...
class JSONBAgg(Aggregate): ...
class StringAgg(OrderableAggMixin, Aggregate): ...

View File

@@ -0,0 +1 @@
class OrderableAggMixin: ...

View File

@@ -0,0 +1,14 @@
from django.db.models.aggregates import Aggregate
class StatAggregate(Aggregate): ...
class Corr(StatAggregate): ...
class CovarPop(StatAggregate): ...
class RegrAvgX(StatAggregate): ...
class RegrAvgY(StatAggregate): ...
class RegrCount(StatAggregate): ...
class RegrIntercept(StatAggregate): ...
class RegrR2(StatAggregate): ...
class RegrSlope(StatAggregate): ...
class RegrSXX(StatAggregate): ...
class RegrSXY(StatAggregate): ...
class RegrSYY(StatAggregate): ...

View File

@@ -1,29 +1,82 @@
from typing import Any, Optional from typing import Optional, Sequence
from django.db.models.query_utils import Q
from django.db.models import Index from django.db.models import Index
class PostgresIndex(Index): class PostgresIndex(Index): ...
@property
def max_name_length(self) -> int: ...
class BrinIndex(PostgresIndex): class BrinIndex(PostgresIndex):
def __init__( def __init__(
self, *, autosummarize: Optional[bool] = ..., pages_per_range: Optional[int] = ..., **kwargs: Any self,
*,
autosummarize: Optional[bool] = ...,
pages_per_range: Optional[int] = ...,
fields: Sequence[str] = ...,
name: Optional[str] = ...,
db_tablespace: Optional[str] = ...,
opclasses: Sequence[str] = ...,
condition: Optional[Q] = ...
) -> None: ... ) -> None: ...
class BTreeIndex(PostgresIndex): class BTreeIndex(PostgresIndex):
def __init__(self, *, fillfactor: Optional[int] = ..., **kwargs: Any): ... def __init__(
self,
*,
fillfactor: Optional[int] = ...,
fields: Sequence[str] = ...,
name: Optional[str] = ...,
db_tablespace: Optional[str] = ...,
opclasses: Sequence[str] = ...,
condition: Optional[Q] = ...
) -> None: ...
class GinIndex(PostgresIndex): class GinIndex(PostgresIndex):
def __init__( def __init__(
self, *, fastupdate: Optional[bool] = ..., gin_pending_list_limit: Optional[int] = ..., **kwargs: Any self,
*,
fastupdate: Optional[bool] = ...,
gin_pending_list_limit: Optional[int] = ...,
fields: Sequence[str] = ...,
name: Optional[str] = ...,
db_tablespace: Optional[str] = ...,
opclasses: Sequence[str] = ...,
condition: Optional[Q] = ...
) -> None: ... ) -> None: ...
class GistIndex(PostgresIndex): class GistIndex(PostgresIndex):
def __init__(self, *, buffering: Optional[bool] = ..., fillfactor: Optional[int] = ..., **kwargs: Any) -> None: ... def __init__(
self,
*,
buffering: Optional[bool] = ...,
fillfactor: Optional[int] = ...,
fields: Sequence[str] = ...,
name: Optional[str] = ...,
db_tablespace: Optional[str] = ...,
opclasses: Sequence[str] = ...,
condition: Optional[Q] = ...
) -> None: ...
class HashIndex(PostgresIndex): class HashIndex(PostgresIndex):
def __init__(self, *, fillfactor: Optional[int] = ..., **kwargs: Any) -> None: ... def __init__(
self,
*,
fillfactor: Optional[int] = ...,
fields: Sequence[str] = ...,
name: Optional[str] = ...,
db_tablespace: Optional[str] = ...,
opclasses: Sequence[str] = ...,
condition: Optional[Q] = ...
) -> None: ...
class SpGistIndex(PostgresIndex): class SpGistIndex(PostgresIndex):
def __init__(self, *, fillfactor: Optional[int] = ..., **kwargs: Any) -> None: ... def __init__(
self,
*,
fillfactor: Optional[int] = ...,
fields: Sequence[str] = ...,
name: Optional[str] = ...,
db_tablespace: Optional[str] = ...,
opclasses: Sequence[str] = ...,
condition: Optional[Q] = ...
) -> None: ...

View File

@@ -0,0 +1,18 @@
from django.db.models.lookups import Exact
from django.db.models import Lookup, Transform
from .search import SearchVectorExact
class PostgresSimpleLookup(Lookup):
operator: str
class DataContains(PostgresSimpleLookup): ...
class ContainedBy(PostgresSimpleLookup): ...
class Overlap(PostgresSimpleLookup): ...
class HasKey(PostgresSimpleLookup): ...
class HasKeys(PostgresSimpleLookup): ...
class HasAnyKeys(HasKeys): ...
class Unaccent(Transform): ...
class SearchLookup(SearchVectorExact): ...
class TrigramSimilar(PostgresSimpleLookup): ...
class JSONExact(Exact): ...

View File

@@ -1,10 +1,12 @@
from typing import Any, Dict, Optional, TypeVar, Union from typing import Any, Dict, Optional, TypeVar, Union
from django.db.models.expressions import Combinable, CombinedExpression, Func, Value from django.db.models.expressions import Combinable, CombinedExpression, Func, Value, _OutputField
from django.db.models.lookups import Lookup from django.db.models.lookups import Lookup
from django.db.models import Field from django.db.models import Field
_Expression = Union[str, Combinable, "SearchQueryCombinable"]
class SearchVectorExact(Lookup): ... class SearchVectorExact(Lookup): ...
class SearchVectorField(Field): ... class SearchVectorField(Field): ...
class SearchQueryField(Field): ... class SearchQueryField(Field): ...
@@ -14,10 +16,12 @@ class SearchVectorCombinable:
class SearchVector(SearchVectorCombinable, Func): class SearchVector(SearchVectorCombinable, Func):
config: Optional[Any] = ... config: Optional[Any] = ...
def __init__(self, *expressions: Union[str, Combinable], **extra: Any): ... def __init__(self, *expressions: _Expression, **extra: Any): ...
class CombinedSearchVector(SearchVectorCombinable, CombinedExpression): class CombinedSearchVector(SearchVectorCombinable, CombinedExpression):
def __init__(self, lhs, connector, rhs, config, output_field: Optional[Field, str] = ...): ... def __init__(
self, lhs, connector, rhs, config: Optional[_Expression] = ..., output_field: Optional[_OutputField] = ...
): ...
_T = TypeVar("_T", bound="SearchQueryCombinable") _T = TypeVar("_T", bound="SearchQueryCombinable")
@@ -29,19 +33,31 @@ class SearchQueryCombinable:
def __and__(self: _T, other: SearchQueryCombinable) -> _T: ... def __and__(self: _T, other: SearchQueryCombinable) -> _T: ...
def __rand__(self: _T, other: SearchQueryCombinable) -> _T: ... def __rand__(self: _T, other: SearchQueryCombinable) -> _T: ...
class SearchQuery(SearchQueryCombinable, Value): class SearchQuery(SearchQueryCombinable, Value): # type: ignore
SEARCH_TYPES: Dict[str, str] = {"plain": "plainto_tsquery", "phrase": "phraseto_tsquery", "raw": "to_tsquery"} SEARCH_TYPES: Dict[str, str] = ...
def __init__(self, value, output_field=..., *, config=..., invert=False, search_type="plain"): ... def __init__(
self,
value: str,
output_field: Optional[_OutputField] = ...,
*,
config: Optional[_Expression] = ...,
invert: bool = ...,
search_type: str = ...
): ...
def __invert__(self: _T) -> _T: ... def __invert__(self: _T) -> _T: ...
class CombinedSearchQuery(SearchQueryCombinable, CombinedExpression): class CombinedSearchQuery(SearchQueryCombinable, CombinedExpression): # type: ignore
def __init__(self, lhs, connector, rhs, config, output_field=...) -> None: ... def __init__(
self, lhs, connector, rhs, config: Optional[_Expression] = ..., output_field: Optional[_OutputField] = ...
) -> None: ...
class SearchRank(Func): class SearchRank(Func):
def __init__(self, vector, query, **extra: Any) -> None: ... def __init__(
self, vector: Union[SearchVector, _Expression], query: Union[SearchQuery, _Expression], **extra: Any
) -> None: ...
class TrigramBase(Func): class TrigramBase(Func):
def __init__(self, expression, string, **extra: Any) -> None: ... def __init__(self, expression: _Expression, string, **extra: Any) -> None: ...
class TrigramSimilarity(TrigramBase): ... class TrigramSimilarity(TrigramBase): ...
class TrigramDistance(TrigramBase): ... class TrigramDistance(TrigramBase): ...

View File

@@ -6,15 +6,16 @@ from django.db import models
SITE_CACHE: Any SITE_CACHE: Any
class SiteManager(models.Manager): class SiteManager(models.Manager["Site"]):
def get_current(self, request: Optional[HttpRequest] = ...) -> Site: ... def get_current(self, request: Optional[HttpRequest] = ...) -> Site: ...
def clear_cache(self) -> None: ... def clear_cache(self) -> None: ...
def get_by_natural_key(self, domain: str) -> Site: ... def get_by_natural_key(self, domain: str) -> Site: ...
class Site(models.Model): class Site(models.Model):
domain: models.CharField = ... objects: SiteManager
name: models.CharField = ...
objects: SiteManager = ... domain = models.CharField(max_length=100)
name = models.CharField(max_length=50)
def natural_key(self) -> Tuple[str]: ... def natural_key(self) -> Tuple[str]: ...
def clear_site_cache(sender: Type[Site], **kwargs: Any) -> None: ... def clear_site_cache(sender: Type[Site], **kwargs: Any) -> None: ...

View File

@@ -1,4 +1,4 @@
from typing import Any, List, Optional from typing import Any, List
from django.core.checks.messages import Error from django.core.checks.messages import Error

View File

@@ -37,7 +37,7 @@ def get_finders() -> Iterator[BaseFinder]: ...
def get_finder(import_path: Literal["django.contrib.staticfiles.finders.FileSystemFinder"]) -> FileSystemFinder: ... def get_finder(import_path: Literal["django.contrib.staticfiles.finders.FileSystemFinder"]) -> FileSystemFinder: ...
@overload @overload
def get_finder( def get_finder(
import_path: Literal["django.contrib.staticfiles.finders.AppDirectoriesFinder"] import_path: Literal["django.contrib.staticfiles.finders.AppDirectoriesFinder"],
) -> AppDirectoriesFinder: ... ) -> AppDirectoriesFinder: ...
@overload @overload
def get_finder(import_path: str) -> BaseFinder: ... def get_finder(import_path: str) -> BaseFinder: ...

View File

@@ -4,7 +4,6 @@ from typing import Any, Callable, Iterator, Optional, Tuple
from django.core.files.base import File from django.core.files.base import File
from django.core.files.storage import FileSystemStorage from django.core.files.storage import FileSystemStorage
from django.utils.functional import LazyObject from django.utils.functional import LazyObject
from django.utils.safestring import SafeText
class StaticFilesStorage(FileSystemStorage): class StaticFilesStorage(FileSystemStorage):
base_location: Any = ... base_location: Any = ...

View File

@@ -1,4 +1,4 @@
from typing import Any, Optional from typing import Any
from django.template.base import Parser, Token from django.template.base import Parser, Token
from django.templatetags.static import StaticNode from django.templatetags.static import StaticNode

View File

@@ -0,0 +1,3 @@
from django.test import LiveServerTestCase
class StaticLiveServerTestCase(LiveServerTestCase): ...

View File

@@ -1,5 +1,5 @@
from collections import OrderedDict from collections import OrderedDict
from typing import Any, Iterator, List, Optional, Tuple, Union from typing import Iterator, List, Optional, Tuple, Union
from django.core.files.storage import FileSystemStorage from django.core.files.storage import FileSystemStorage

View File

@@ -1,4 +1,4 @@
from typing import Any, Optional from typing import Any
from django.core.handlers.wsgi import WSGIRequest from django.core.handlers.wsgi import WSGIRequest
from django.http.response import FileResponse from django.http.response import FileResponse

View File

@@ -1,4 +1,4 @@
from typing import Any, Dict, List, Optional from typing import Any, Dict, List
from django.core.exceptions import ObjectDoesNotExist from django.core.exceptions import ObjectDoesNotExist
from django.core.handlers.wsgi import WSGIRequest from django.core.handlers.wsgi import WSGIRequest

View File

@@ -1,4 +1,4 @@
from typing import Any, List, Optional from typing import Any, List
from django.core.checks.messages import Error from django.core.checks.messages import Error

View File

@@ -1,3 +1,3 @@
from typing import Any, List, Optional from typing import Any, List
def check_database_backends(*args: Any, **kwargs: Any) -> List[Any]: ... def check_database_backends(*args: Any, **kwargs: Any) -> List[Any]: ...

View File

@@ -12,6 +12,7 @@ class Tags:
security: str = ... security: str = ...
signals: str = ... signals: str = ...
templates: str = ... templates: str = ...
translation: str = ...
urls: str = ... urls: str = ...
class CheckRegistry: class CheckRegistry:

View File

@@ -1,4 +1,4 @@
from typing import Any, List, Optional from typing import Any, List
from django.core.checks.messages import Warning from django.core.checks.messages import Warning

View File

@@ -1,4 +1,4 @@
from typing import Any, List, Optional from typing import Any, List
from django.core.checks.messages import Warning from django.core.checks.messages import Warning

View File

@@ -1,4 +1,4 @@
from typing import Any, List, Optional from typing import Any, List
from django.core.checks.messages import Warning from django.core.checks.messages import Warning

View File

@@ -1,4 +1,4 @@
from typing import Any, List, Optional from typing import Any, List
from django.core.checks.messages import Error from django.core.checks.messages import Error

View File

@@ -1,4 +1,4 @@
from typing import Any, Callable, List, Optional, Tuple, Union from typing import Any, Callable, List, Tuple, Union
from django.core.checks.messages import CheckMessage, Error, Warning from django.core.checks.messages import CheckMessage, Error, Warning
from django.urls.resolvers import URLPattern, URLResolver from django.urls.resolvers import URLPattern, URLResolver

View File

@@ -14,6 +14,7 @@ class File(FileProxyMixin, IO[Any]):
def __init__(self, file: Any, name: Optional[str] = ...) -> None: ... def __init__(self, file: Any, name: Optional[str] = ...) -> None: ...
def __bool__(self) -> bool: ... def __bool__(self) -> bool: ...
def __len__(self) -> int: ... def __len__(self) -> int: ...
@property
def size(self) -> int: ... def size(self) -> int: ...
def chunks(self, chunk_size: Optional[int] = ...) -> Iterator[bytes]: ... def chunks(self, chunk_size: Optional[int] = ...) -> Iterator[bytes]: ...
def multiple_chunks(self, chunk_size: Optional[int] = ...) -> bool: ... def multiple_chunks(self, chunk_size: Optional[int] = ...) -> bool: ...

View File

@@ -8,8 +8,8 @@ from django.utils.datastructures import MultiValueDict
class UploadFileException(Exception): ... class UploadFileException(Exception): ...
class StopUpload(UploadFileException): class StopUpload(UploadFileException):
connection_reset = ... # type: bool connection_reset: bool = ...
def __init__(self, connection_reset: bool = False) -> None: ... def __init__(self, connection_reset: bool = ...) -> None: ...
class SkipFile(UploadFileException): ... class SkipFile(UploadFileException): ...
class StopFutureHandlers(UploadFileException): ... class StopFutureHandlers(UploadFileException): ...

View File

@@ -1,5 +1,5 @@
import types import types
from typing import Any, TypeVar, Type, Iterable from typing import Any, TypeVar, Type, Iterable, Optional
from django.core.mail.message import EmailMessage from django.core.mail.message import EmailMessage
@@ -7,7 +7,7 @@ _T = TypeVar("_T", bound="BaseEmailBackend")
class BaseEmailBackend: class BaseEmailBackend:
def __init__(self, fail_silently: bool = ..., **kwargs: Any) -> None: ... def __init__(self, fail_silently: bool = ..., **kwargs: Any) -> None: ...
def open(self) -> bool: ... def open(self) -> Optional[bool]: ...
def close(self) -> None: ... def close(self) -> None: ...
def __enter__(self: _T) -> _T: ... def __enter__(self: _T) -> _T: ...
def __exit__( def __exit__(

View File

@@ -0,0 +1,3 @@
from django.core.mail.backends.base import BaseEmailBackend
class EmailBackend(BaseEmailBackend): ...

View File

@@ -0,0 +1,3 @@
from django.core.mail.backends.base import BaseEmailBackend
class EmailBackend(BaseEmailBackend): ...

View File

@@ -0,0 +1,3 @@
from django.core.mail.backends.base import BaseEmailBackend
class EmailBackend(BaseEmailBackend): ...

View File

@@ -0,0 +1,3 @@
from django.core.mail.backends.base import BaseEmailBackend
class EmailBackend(BaseEmailBackend): ...

View File

@@ -0,0 +1,18 @@
import smtplib
import threading
from typing import Optional, Union
from django.core.mail.backends.base import BaseEmailBackend
class EmailBackend(BaseEmailBackend):
host: str = ...
port: int = ...
username: str = ...
password: str = ...
use_tls: bool = ...
use_ssl: bool = ...
timeout: Optional[int] = ...
ssl_keyfile: Optional[str] = ...
ssl_certfile: Optional[str] = ...
connection: Union[smtplib.SMTP_SSL, smtplib.SMTP, None] = ...
_lock: threading.RLock = ...

View File

@@ -1,8 +1,10 @@
from email._policybase import Policy # type: ignore from email._policybase import Policy # type: ignore
from email.message import Message
from email.mime.base import MIMEBase
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, Sequence, Tuple, Union from typing import Any, Dict, List, Optional, Sequence, Tuple, Union, overload
utf8_charset: Any utf8_charset: Any
utf8_charset_qp: Any utf8_charset_qp: Any
@@ -43,6 +45,11 @@ class SafeMIMEMultipart(MIMEMixin, MIMEMultipart):
self, _subtype: str = ..., boundary: None = ..., _subparts: None = ..., encoding: str = ..., **_params: Any self, _subtype: str = ..., boundary: None = ..., _subparts: None = ..., encoding: str = ..., **_params: Any
) -> None: ... ) -> None: ...
_AttachmentContent = Union[bytes, EmailMessage, Message, SafeMIMEText, str]
_AttachmentTuple = Union[
Tuple[str, _AttachmentContent], Tuple[Optional[str], _AttachmentContent, str], Tuple[str, _AttachmentContent, None]
]
class EmailMessage: class EmailMessage:
content_subtype: str = ... content_subtype: str = ...
mixed_subtype: str = ... mixed_subtype: str = ...
@@ -62,42 +69,42 @@ class EmailMessage:
subject: str = ..., subject: str = ...,
body: Optional[str] = ..., body: Optional[str] = ...,
from_email: Optional[str] = ..., from_email: Optional[str] = ...,
to: Optional[Union[Sequence[str], str]] = ..., to: Optional[Sequence[str]] = ...,
bcc: Optional[Union[Sequence[str], str]] = ..., bcc: Optional[Sequence[str]] = ...,
connection: Optional[Any] = ..., connection: Optional[Any] = ...,
attachments: Optional[Union[List[Tuple[str, Union[str, bytes], str]], List[MIMEText]]] = ..., attachments: Optional[Sequence[Union[MIMEBase, _AttachmentTuple]]] = ...,
headers: Optional[Dict[str, str]] = ..., headers: Optional[Dict[str, str]] = ...,
cc: Optional[Union[Sequence[str], str]] = ..., cc: Optional[Sequence[str]] = ...,
reply_to: Optional[Union[List[Optional[str]], str]] = ..., reply_to: Optional[Sequence[str]] = ...,
) -> None: ... ) -> None: ...
def get_connection(self, fail_silently: bool = ...) -> Any: ... def get_connection(self, fail_silently: bool = ...) -> Any: ...
# TODO: when typeshed gets more types for email.Message, move it to MIMEMessage, now it has too many false-positives # TODO: when typeshed gets more types for email.Message, move it to MIMEMessage, now it has too many false-positives
def message(self) -> Any: ... def message(self) -> Any: ...
def recipients(self) -> List[str]: ... def recipients(self) -> List[str]: ...
def send(self, fail_silently: bool = ...) -> int: ... def send(self, fail_silently: bool = ...) -> int: ...
def attach( @overload
self, def attach(self, filename: MIMEText = ...) -> None: ...
filename: Optional[Union[MIMEText, str]] = ..., @overload
content: Optional[Union[bytes, EmailMessage, SafeMIMEText, str]] = ..., def attach(self, filename: None = ..., content: _AttachmentContent = ..., mimetype: str = ...) -> None: ...
mimetype: Optional[str] = ..., @overload
) -> None: ... def attach(self, filename: str = ..., content: _AttachmentContent = ..., mimetype: Optional[str] = ...) -> None: ...
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):
alternative_subtype: str = ... alternative_subtype: str = ...
alternatives: Any = ... alternatives: Sequence[Tuple[_AttachmentContent, str]] = ...
def __init__( def __init__(
self, self,
subject: str = ..., subject: str = ...,
body: str = ..., body: str = ...,
from_email: Optional[str] = ..., from_email: Optional[str] = ...,
to: Optional[List[str]] = ..., to: Optional[Sequence[str]] = ...,
bcc: Optional[List[str]] = ..., bcc: Optional[Sequence[str]] = ...,
connection: Optional[Any] = ..., connection: Optional[Any] = ...,
attachments: None = ..., attachments: Optional[Sequence[Union[MIMEBase, _AttachmentTuple]]] = ...,
headers: Optional[Dict[str, str]] = ..., headers: Optional[Dict[str, str]] = ...,
alternatives: Optional[List[Tuple[str, str]]] = ..., alternatives: Optional[Sequence[Tuple[_AttachmentContent, str]]] = ...,
cc: None = ..., cc: Optional[Sequence[str]] = ...,
reply_to: None = ..., reply_to: Optional[Sequence[str]] = ...,
) -> None: ... ) -> None: ...
def attach_alternative(self, content: str, mimetype: str) -> None: ... def attach_alternative(self, content: _AttachmentContent, mimetype: str) -> None: ...

View File

@@ -63,7 +63,7 @@ class BaseCommand:
fail_level: int = ..., fail_level: int = ...,
) -> None: ... ) -> None: ...
def check_migrations(self) -> None: ... def check_migrations(self) -> None: ...
def handle(self, *args: Any, **options: Any) -> None: ... def handle(self, *args: Any, **options: Any) -> Optional[str]: ...
class AppCommand(BaseCommand): class AppCommand(BaseCommand):
missing_args_message: str = ... missing_args_message: str = ...

View File

@@ -1,5 +1,3 @@
from collections import Callable
def supports_color() -> bool: ... def supports_color() -> bool: ...
class Style: class Style:

View File

@@ -1,13 +1,6 @@
import os from typing import Any, Optional, Pattern, Type
import re
from typing import Any, Pattern, Type, Optional
from django.core.management.base import BaseCommand from django.core.management.base import BaseCommand
from django.utils.functional import cached_property
from django.utils.jslex import prepare_js_for_gettext
from django.conf import settings
from django.utils.translation import templatize
plural_forms_re: Pattern = ... plural_forms_re: Pattern = ...
STATUS_OK: int = ... STATUS_OK: int = ...

View File

@@ -1,4 +1,4 @@
from typing import Dict, List, Optional, Union, Iterable, Sequence, Protocol, Any from typing import Dict, List, Optional, Protocol, Sequence, Union
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
@@ -32,7 +32,9 @@ class Paginator:
def validate_number(self, number: Optional[Union[float, str]]) -> int: ... def validate_number(self, number: Optional[Union[float, str]]) -> int: ...
def get_page(self, number: Optional[int]) -> Page: ... def get_page(self, number: Optional[int]) -> Page: ...
def page(self, number: Union[int, str]) -> Page: ... def page(self, number: Union[int, str]) -> Page: ...
@property
def count(self) -> int: ... def count(self) -> int: ...
@property
def num_pages(self) -> int: ... def num_pages(self) -> int: ...
@property @property
def page_range(self) -> range: ... def page_range(self) -> range: ...

View File

@@ -4,7 +4,7 @@ from typing import Any, Dict
from wsgiref import simple_server from wsgiref import simple_server
from django.core.handlers.wsgi import WSGIRequest, WSGIHandler from django.core.handlers.wsgi import WSGIRequest, WSGIHandler
from django.core.wsgi import get_wsgi_application as get_wsgi_application from django.core.wsgi import get_wsgi_application as get_wsgi_application # noqa: F401
class WSGIServer(simple_server.WSGIServer): class WSGIServer(simple_server.WSGIServer):
request_queue_size: int = ... request_queue_size: int = ...

View File

@@ -1,7 +1,5 @@
from datetime import datetime, timedelta from datetime import timedelta
from typing import Any, Dict, List, Optional, Type, Union, Protocol from typing import Any, Dict, Optional, Protocol, Type, Union
from django.contrib.sessions.serializers import PickleSerializer
class BadSignature(Exception): ... class BadSignature(Exception): ...
class SignatureExpired(BadSignature): ... class SignatureExpired(BadSignature): ...

View File

@@ -5,7 +5,7 @@ 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
from django.core.exceptions import ValidationError as ValidationError from django.core.exceptions import ValidationError as ValidationError # noqa: F401
EMPTY_VALUES: Any EMPTY_VALUES: Any

View File

@@ -20,7 +20,7 @@ class BaseDatabaseWrapper:
ops: Any = ... ops: Any = ...
vendor: str = ... vendor: str = ...
display_name: str = ... display_name: str = ...
SchemaEditorClass: Any = ... SchemaEditorClass: Optional[BaseDatabaseSchemaEditor] = ...
client_class: Any = ... client_class: Any = ...
creation_class: Any = ... creation_class: Any = ...
features_class: Any = ... features_class: Any = ...

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

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

View File

@@ -1,5 +1,5 @@
from collections import namedtuple from collections import namedtuple
from typing import Any, Dict, List, Optional, Set, Tuple, Type, Union from typing import Any, Dict, List, Optional, Set, Type
from django.db.backends.base.base import BaseDatabaseWrapper from django.db.backends.base.base import BaseDatabaseWrapper
from django.db.backends.utils import CursorWrapper from django.db.backends.utils import CursorWrapper
@@ -13,7 +13,7 @@ class BaseDatabaseIntrospection:
data_types_reverse: Any = ... data_types_reverse: Any = ...
connection: Any = ... connection: Any = ...
def __init__(self, connection: BaseDatabaseWrapper) -> None: ... def __init__(self, connection: BaseDatabaseWrapper) -> None: ...
def get_field_type(self, data_type: str, description: FieldInfo) -> Union[Tuple[str, Dict[str, int]], str]: ... def get_field_type(self, data_type: str, description: FieldInfo) -> str: ...
def table_name_converter(self, name: str) -> str: ... def table_name_converter(self, name: str) -> str: ...
def column_name_converter(self, name: str) -> str: ... def column_name_converter(self, name: str) -> str: ...
def table_names(self, cursor: Optional[CursorWrapper] = ..., include_views: bool = ...) -> List[str]: ... def table_names(self, cursor: Optional[CursorWrapper] = ..., include_views: bool = ...) -> List[str]: ...

View File

@@ -1,17 +1,19 @@
from datetime import date, datetime, timedelta from datetime import date, datetime, timedelta, time
from decimal import Decimal from decimal import Decimal
from typing import Any, List, Optional, Set, Tuple, Type, Union, Sequence from typing import Any, List, Optional, Sequence, Tuple, Type, Union
from django.core.management.color import Style from django.core.management.color import Style
from django.db import DefaultConnectionProxy
from django.db.backends.base.base import BaseDatabaseWrapper from django.db.backends.base.base import BaseDatabaseWrapper
from django.db.backends.sqlite3.base import DatabaseWrapper
from django.db.backends.utils import CursorWrapper from django.db.backends.utils import CursorWrapper
from django.db.models.base import Model from django.db.models.base import Model
from django.db.models.expressions import Case, Expression from django.db.models.expressions import Case, Expression
from django.db.models.fields import Field
from django.db.models.sql.compiler import SQLCompiler from django.db.models.sql.compiler import SQLCompiler
from django.db import DefaultConnectionProxy
from django.db.models.fields import Field
_Connection = Union[DefaultConnectionProxy, BaseDatabaseWrapper]
class BaseDatabaseOperations: class BaseDatabaseOperations:
compiler_module: str = ... compiler_module: str = ...
integer_field_ranges: Any = ... integer_field_ranges: Any = ...
@@ -24,8 +26,8 @@ class BaseDatabaseOperations:
UNBOUNDED_FOLLOWING: Any = ... UNBOUNDED_FOLLOWING: Any = ...
CURRENT_ROW: str = ... CURRENT_ROW: str = ...
explain_prefix: Any = ... explain_prefix: Any = ...
connection: Any = ... connection: _Connection = ...
def __init__(self, connection: Optional[Union[DefaultConnectionProxy, BaseDatabaseWrapper]]) -> None: ... def __init__(self, connection: Optional[_Connection]) -> None: ...
def autoinc_sql(self, table: str, column: str) -> None: ... def autoinc_sql(self, table: str, column: str) -> None: ...
def bulk_batch_size(self, fields: Any, objs: Any): ... def bulk_batch_size(self, fields: Any, objs: Any): ...
def cache_key_culling_sql(self) -> str: ... def cache_key_culling_sql(self) -> str: ...
@@ -74,10 +76,10 @@ class BaseDatabaseOperations:
def prep_for_like_query(self, x: str) -> str: ... def prep_for_like_query(self, x: str) -> str: ...
prep_for_iexact_query: Any = ... prep_for_iexact_query: Any = ...
def validate_autopk_value(self, value: int) -> int: ... def validate_autopk_value(self, value: int) -> int: ...
def adapt_unknown_value(self, value: Union[datetime, Decimal, int, str]) -> Union[int, str]: ... def adapt_unknown_value(self, value: Any) -> Any: ...
def adapt_datefield_value(self, value: Optional[date]) -> Optional[str]: ... def adapt_datefield_value(self, value: Optional[date]) -> Optional[str]: ...
def adapt_datetimefield_value(self, value: None) -> None: ... def adapt_datetimefield_value(self, value: Optional[datetime]) -> Optional[str]: ...
def adapt_timefield_value(self, value: Optional[datetime]) -> Optional[str]: ... def adapt_timefield_value(self, value: Optional[Union[datetime, time]]) -> Optional[str]: ...
def adapt_decimalfield_value( def adapt_decimalfield_value(
self, value: Optional[Decimal], max_digits: Optional[int] = ..., decimal_places: Optional[int] = ... self, value: Optional[Decimal], max_digits: Optional[int] = ..., decimal_places: Optional[int] = ...
) -> Optional[str]: ... ) -> Optional[str]: ...
@@ -86,19 +88,17 @@ class BaseDatabaseOperations:
def year_lookup_bounds_for_datetime_field(self, value: int) -> List[str]: ... def year_lookup_bounds_for_datetime_field(self, value: int) -> List[str]: ...
def get_db_converters(self, expression: Expression) -> List[Any]: ... def get_db_converters(self, expression: Expression) -> List[Any]: ...
def convert_durationfield_value( def convert_durationfield_value(
self, value: Optional[float], expression: Expression, connection: DatabaseWrapper self, value: Optional[float], expression: Expression, connection: _Connection
) -> Optional[timedelta]: ... ) -> Optional[timedelta]: ...
def check_expression_support(self, expression: Any) -> None: ... def check_expression_support(self, expression: Any) -> None: ...
def combine_expression(self, connector: str, sub_expressions: List[str]) -> str: ... def combine_expression(self, connector: str, sub_expressions: List[str]) -> str: ...
def combine_duration_expression(self, connector: Any, sub_expressions: Any): ... def combine_duration_expression(self, connector: Any, sub_expressions: Any): ...
def binary_placeholder_sql(self, value: Optional[Case]) -> str: ... def binary_placeholder_sql(self, value: Optional[Case]) -> str: ...
def modify_insert_params( def modify_insert_params(self, placeholder: str, params: Any) -> Any: ...
self, placeholder: str, params: Union[List[None], List[bool], List[float], List[str]]
) -> Union[List[None], List[bool], List[float], List[str]]: ...
def integer_field_range(self, internal_type: Any): ... def integer_field_range(self, internal_type: Any): ...
def subtract_temporals(self, internal_type: Any, lhs: Any, rhs: Any): ... def subtract_temporals(self, internal_type: Any, lhs: Any, rhs: Any): ...
def window_frame_start(self, start: Any): ... def window_frame_start(self, start: Any): ...
def window_frame_end(self, end: Any): ... def window_frame_end(self, end: Any): ...
def window_frame_rows_start_end(self, start: None = ..., end: None = ...) -> Any: ... def window_frame_rows_start_end(self, start: Optional[int] = ..., end: Optional[int] = ...) -> Any: ...
def window_frame_range_start_end(self, start: Optional[Any] = ..., end: Optional[Any] = ...): ... def window_frame_range_start_end(self, start: Optional[int] = ..., end: Optional[int] = ...) -> Any: ...
def explain_query_prefix(self, format: Optional[str] = ..., **options: Any) -> str: ... def explain_query_prefix(self, format: Optional[str] = ..., **options: Any) -> str: ...

View File

@@ -48,7 +48,7 @@ class BaseDatabaseSchemaEditor(ContextManager[Any]):
def quote_name(self, name: str) -> str: ... def quote_name(self, name: str) -> str: ...
def column_sql( def column_sql(
self, model: Type[Model], field: Field, include_default: bool = ... self, model: Type[Model], field: Field, include_default: bool = ...
) -> Union[Tuple[None, None], Tuple[str, List[Any]]]: ... ) -> Tuple[Optional[str], Optional[List[Any]]]: ...
def skip_default(self, field: Any): ... def skip_default(self, field: Any): ...
def prepare_default(self, value: Any) -> None: ... def prepare_default(self, value: Any) -> None: ...
def effective_default(self, field: Field) -> Optional[Union[int, str]]: ... def effective_default(self, field: Field) -> Optional[Union[int, str]]: ...

View File

@@ -1,6 +1,7 @@
from typing import Any, List, Optional from typing import Any, List
from django.db.backends.base.base import BaseDatabaseWrapper from django.db.backends.base.base import BaseDatabaseWrapper
from django.db.models.fields import Field from django.db.models.fields import Field
class BaseDatabaseValidation: class BaseDatabaseValidation:

View File

@@ -1,4 +1,4 @@
from typing import Any, Dict, List, Optional, Union from typing import Dict, List, Optional, Union
from django.db.backends.base.client import BaseDatabaseClient from django.db.backends.base.client import BaseDatabaseClient

View File

@@ -1,4 +1,4 @@
from typing import Any, Dict, Optional from typing import Dict
from django.db.backends.base.client import BaseDatabaseClient from django.db.backends.base.client import BaseDatabaseClient

View File

@@ -1,6 +1,5 @@
from sqlite3 import dbapi2 as Database from sqlite3 import dbapi2 as Database
from sqlite3 import dbapi2 as Database from typing import Any, Callable
from typing import Any, Callable, Iterator
from django.db.backends.base.base import BaseDatabaseWrapper from django.db.backends.base.base import BaseDatabaseWrapper

View File

@@ -1,4 +1,4 @@
from typing import Any, Dict, Optional, Tuple, Union from typing import Any, Optional
from django.db.backends.base.introspection import BaseDatabaseIntrospection from django.db.backends.base.introspection import BaseDatabaseIntrospection
@@ -8,6 +8,6 @@ def get_field_size(name: str) -> Optional[int]: ...
class FlexibleFieldLookupDict: class FlexibleFieldLookupDict:
base_data_types_reverse: Any = ... base_data_types_reverse: Any = ...
def __getitem__(self, key: str) -> Union[Tuple[str, Dict[str, int]], str]: ... def __getitem__(self, key: str) -> Any: ...
class DatabaseIntrospection(BaseDatabaseIntrospection): ... class DatabaseIntrospection(BaseDatabaseIntrospection): ...

View File

@@ -1,7 +1,7 @@
import types import types
from datetime import date, datetime, time from datetime import date, datetime, time
from decimal import Decimal from decimal import Decimal
from typing import Any, Dict, Iterator, List, Mapping, Optional, Sequence, Tuple, Union, Type from typing import Any, Dict, List, Mapping, Optional, Sequence, Tuple, Type, Union
from uuid import UUID from uuid import UUID
logger: Any logger: Any

View File

@@ -1,4 +1,4 @@
from typing import Any, Optional, Tuple from typing import Optional, Tuple
from django.db.migrations.migration import Migration from django.db.migrations.migration import Migration
from django.db.utils import DatabaseError from django.db.utils import DatabaseError

View File

@@ -1,4 +1,4 @@
from typing import Any, Callable, List, Optional, Tuple, Union, Set, Dict from typing import Any, Dict, List, Optional, Set, Tuple, Union
from django.db.migrations.migration import Migration, SwappableTuple from django.db.migrations.migration import Migration, SwappableTuple
from django.db.migrations.state import ProjectState from django.db.migrations.state import ProjectState

View File

@@ -1,4 +1,4 @@
from typing import Any, Tuple, Type, List from typing import Any, List, Tuple
from django.db.backends.base.schema import BaseDatabaseSchemaEditor from django.db.backends.base.schema import BaseDatabaseSchemaEditor
from django.db.migrations.state import ProjectState from django.db.migrations.state import ProjectState

View File

@@ -1,4 +1,4 @@
from typing import Any, Iterable, Union, Optional, List from typing import Any
COMPILED_REGEX_TYPE: Any COMPILED_REGEX_TYPE: Any

View File

@@ -40,6 +40,7 @@ from .fields import (
DurationField as DurationField, DurationField as DurationField,
BigAutoField as BigAutoField, BigAutoField as BigAutoField,
CommaSeparatedIntegerField as CommaSeparatedIntegerField, CommaSeparatedIntegerField as CommaSeparatedIntegerField,
NOT_PROVIDED as NOT_PROVIDED,
) )
from .fields.related import ( from .fields.related import (
@@ -128,3 +129,5 @@ from .constraints import (
CheckConstraint as CheckConstraint, CheckConstraint as CheckConstraint,
UniqueConstraint as UniqueConstraint, UniqueConstraint as UniqueConstraint,
) )
from .enums import Choices as Choices, IntegerChoices as IntegerChoices, TextChoices as TextChoices

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