From 409612995cc817e6fe418b0c4e45dc210fa6aa3c Mon Sep 17 00:00:00 2001 From: Steve Dignam Date: Wed, 25 Nov 2020 14:58:49 -0500 Subject: [PATCH 01/88] cut: mypy plugin and monkey patching pkg --- django-sources | 1 - django_stubs_ext/README.md | 49 --- django_stubs_ext/django_stubs_ext/__init__.py | 3 - django_stubs_ext/django_stubs_ext/patch.py | 58 --- django_stubs_ext/release.sh | 17 - django_stubs_ext/setup.cfg | 2 - django_stubs_ext/setup.py | 42 -- django_stubs_ext/tests/test_monkeypatching.py | 67 --- mypy.ini | 41 +- mypy_django_plugin/__init__.py | 0 mypy_django_plugin/django/__init__.py | 0 mypy_django_plugin/django/context.py | 377 ----------------- mypy_django_plugin/lib/__init__.py | 0 mypy_django_plugin/lib/fullnames.py | 34 -- mypy_django_plugin/lib/helpers.py | 394 ------------------ mypy_django_plugin/main.py | 287 ------------- mypy_django_plugin/transformers/__init__.py | 0 mypy_django_plugin/transformers/fields.py | 151 ------- mypy_django_plugin/transformers/forms.py | 52 --- .../transformers/init_create.py | 76 ---- mypy_django_plugin/transformers/managers.py | 72 ---- mypy_django_plugin/transformers/meta.py | 51 --- mypy_django_plugin/transformers/models.py | 357 ---------------- .../transformers/orm_lookups.py | 54 --- mypy_django_plugin/transformers/querysets.py | 194 --------- mypy_django_plugin/transformers/request.py | 37 -- mypy_django_plugin/transformers/settings.py | 49 --- pytest.ini | 3 - tests/plugins.ini | 5 - 29 files changed, 28 insertions(+), 2445 deletions(-) delete mode 160000 django-sources delete mode 100644 django_stubs_ext/README.md delete mode 100644 django_stubs_ext/django_stubs_ext/__init__.py delete mode 100644 django_stubs_ext/django_stubs_ext/patch.py delete mode 100644 django_stubs_ext/release.sh delete mode 100644 django_stubs_ext/setup.cfg delete mode 100644 django_stubs_ext/setup.py delete mode 100644 django_stubs_ext/tests/test_monkeypatching.py delete mode 100644 mypy_django_plugin/__init__.py delete mode 100644 mypy_django_plugin/django/__init__.py delete mode 100644 mypy_django_plugin/django/context.py delete mode 100644 mypy_django_plugin/lib/__init__.py delete mode 100644 mypy_django_plugin/lib/fullnames.py delete mode 100644 mypy_django_plugin/lib/helpers.py delete mode 100644 mypy_django_plugin/main.py delete mode 100644 mypy_django_plugin/transformers/__init__.py delete mode 100644 mypy_django_plugin/transformers/fields.py delete mode 100644 mypy_django_plugin/transformers/forms.py delete mode 100644 mypy_django_plugin/transformers/init_create.py delete mode 100644 mypy_django_plugin/transformers/managers.py delete mode 100644 mypy_django_plugin/transformers/meta.py delete mode 100644 mypy_django_plugin/transformers/models.py delete mode 100644 mypy_django_plugin/transformers/orm_lookups.py delete mode 100644 mypy_django_plugin/transformers/querysets.py delete mode 100644 mypy_django_plugin/transformers/request.py delete mode 100644 mypy_django_plugin/transformers/settings.py delete mode 100644 tests/plugins.ini diff --git a/django-sources b/django-sources deleted file mode 160000 index aa28213eb..000000000 --- a/django-sources +++ /dev/null @@ -1 +0,0 @@ -Subproject commit aa28213eb51ba26b349c2e51f2defcc7cc87780e diff --git a/django_stubs_ext/README.md b/django_stubs_ext/README.md deleted file mode 100644 index c2165031e..000000000 --- a/django_stubs_ext/README.md +++ /dev/null @@ -1,49 +0,0 @@ -# Extensions and monkey-patching for 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/) -[![Gitter](https://badges.gitter.im/mypy-django/Lobby.svg)](https://gitter.im/mypy-django/Lobby) - - -This package contains extensions and monkey-patching functions for the [django-stubs](https://github.com/typeddjango/django-stubs) package. Certain features of django-stubs (i.e. generic django classes that don't define the `__class_getitem__` method) require runtime monkey-patching, which can't be done with type stubs. These extensions were split into a separate package so library consumers don't need `mypy` as a runtime dependency ([#526](https://github.com/typeddjango/django-stubs/pull/526#pullrequestreview-525798031)). - -## Installation - -```bash -pip install django-stubs-ext -``` - -## Usage - -In your Django application, use the following code: - -```py -import django_stubs_ext - -django_stubs_ext.monkeypath() -``` - -This only needs to be called once, so the call to `monkeypatch` should be placed in your top-level urlconf. - -## Version compatibility - -Since django-stubs supports multiple Django versions, this package takes care to only monkey-patch the features needed by your django version, and decides which features to patch at runtime. This is completely safe, as (currently) we only add a `__class_getitem__` method that does nothing: - -```py -@classmethod -def __class_getitem__(cls, *args, **kwargs): - return cls -``` - -## To get help - -For help with django-stubs, please view the main repository at - -We have a Gitter chat here: -If you think you have a more generic typing issue, please refer to and their Gitter. - -## Contributing - -The django-stubs-ext package is part of the [django-stubs](https://github.com/typeddjango/django-stubs) monorepo. If you would like to contribute, please view the django-stubs [contribution guide](https://github.com/typeddjango/django-stubs/blob/master/CONTRIBUTING.md). - -You can always also reach out in gitter to discuss your contributions! diff --git a/django_stubs_ext/django_stubs_ext/__init__.py b/django_stubs_ext/django_stubs_ext/__init__.py deleted file mode 100644 index 33e82d427..000000000 --- a/django_stubs_ext/django_stubs_ext/__init__.py +++ /dev/null @@ -1,3 +0,0 @@ -from .patch import monkeypatch as monkeypatch - -__all__ = ["monkeypatch"] diff --git a/django_stubs_ext/django_stubs_ext/patch.py b/django_stubs_ext/django_stubs_ext/patch.py deleted file mode 100644 index bf4e25d34..000000000 --- a/django_stubs_ext/django_stubs_ext/patch.py +++ /dev/null @@ -1,58 +0,0 @@ -from typing import Any, Generic, List, Optional, Tuple, Type, TypeVar - -from django import VERSION as VERSION -from django.contrib.admin import ModelAdmin -from django.contrib.admin.options import BaseModelAdmin -from django.db.models.manager import BaseManager -from django.db.models.query import QuerySet -from django.views.generic.edit import FormMixin - -_T = TypeVar("_T") -_VersionSpec = Tuple[int, int] - - -class MPGeneric(Generic[_T]): - """Create a data class to hold metadata about the gneric classes needing monkeypatching. - - The `version` param is optional, and a value of `None` means that the monkeypatch is - version-independent. - - This is slightly overkill for our purposes, but useful for future-proofing against any - possible issues we may run into with this method. - """ - - def __init__(self, cls: Type[_T], version: Optional[_VersionSpec] = None): - """Set the data fields, basic constructor.""" - self.version = version - self.cls = cls - - def __repr__(self) -> str: - """Better representation in tests and debug.""" - return "".format(self.cls, self.version or "all") - - -# certain django classes need to be generic, but lack the __class_getitem__ dunder needed to -# annotate them: https://github.com/typeddjango/django-stubs/issues/507 -# this list stores them so `monkeypatch` can fix them when called -_need_generic: List[MPGeneric[Any]] = [ - MPGeneric(ModelAdmin), - MPGeneric(FormMixin), - MPGeneric(BaseModelAdmin), - # These types do have native `__class_getitem__` method since django 3.1: - MPGeneric(QuerySet, (3, 1)), - MPGeneric(BaseManager, (3, 1)), -] - - -# currently just adds the __class_getitem__ dunder. if more monkeypatching is needed, add it here -def monkeypatch() -> None: - """Monkey patch django as necessary to work properly with mypy.""" - suited_for_this_version = filter( - lambda spec: spec.version is None or VERSION[:2] <= spec.version, - _need_generic, - ) - for el in suited_for_this_version: - el.cls.__class_getitem__ = classmethod(lambda cls, *args, **kwargs: cls) - - -__all__ = ["monkeypatch"] diff --git a/django_stubs_ext/release.sh b/django_stubs_ext/release.sh deleted file mode 100644 index 52810ef45..000000000 --- a/django_stubs_ext/release.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/usr/bin/env bash -set -ex - -if [[ -z $(git status -s) ]] -then - if [[ "$VIRTUAL_ENV" != "" ]] - then - pip install --upgrade setuptools wheel twine - python setup.py sdist bdist_wheel - twine upload dist/* - rm -rf dist/ build/ - else - echo "this script must be executed inside an active virtual env, aborting" - fi -else - echo "git working tree is not clean, aborting" -fi diff --git a/django_stubs_ext/setup.cfg b/django_stubs_ext/setup.cfg deleted file mode 100644 index c41389377..000000000 --- a/django_stubs_ext/setup.cfg +++ /dev/null @@ -1,2 +0,0 @@ -[metadata] -license_file = ../LICENSE.txt diff --git a/django_stubs_ext/setup.py b/django_stubs_ext/setup.py deleted file mode 100644 index 91212cb34..000000000 --- a/django_stubs_ext/setup.py +++ /dev/null @@ -1,42 +0,0 @@ -from distutils.core import setup - -from setuptools import find_packages - -with open("README.md") as f: - readme = f.read() - -dependencies = [ - "django", -] - -setup( - name="django-stubs-ext", - version="0.1.0", - description="Monkey-patching and extensions for django-stubs", - long_description=readme, - long_description_content_type="text/markdown", - license="MIT", - url="https://github.com/typeddjango/django-stubs", - author="Simula Proxy", - author_email="3nki.nam.shub@gmail.com", - py_modules=[], - python_requires=">=3.6", - install_requires=dependencies, - packages=["django_stubs_ext", *find_packages(exclude=["scripts"])], - classifiers=[ - "License :: OSI Approved :: MIT License", - "Operating System :: OS Independent", - "Programming Language :: Python :: 3.6", - "Programming Language :: Python :: 3.7", - "Programming Language :: Python :: 3.8", - "Programming Language :: Python :: 3.9", - "Typing :: Typed", - "Framework :: Django", - "Framework :: Django :: 2.2", - "Framework :: Django :: 3.0", - "Framework :: Django :: 3.1", - ], - project_urls={ - "Release notes": "https://github.com/typeddjango/django-stubs/releases", - }, -) diff --git a/django_stubs_ext/tests/test_monkeypatching.py b/django_stubs_ext/tests/test_monkeypatching.py deleted file mode 100644 index dbda872e5..000000000 --- a/django_stubs_ext/tests/test_monkeypatching.py +++ /dev/null @@ -1,67 +0,0 @@ -from contextlib import suppress -from typing import Optional - -import pytest -from _pytest.fixtures import FixtureRequest -from _pytest.monkeypatch import MonkeyPatch -from typing_extensions import Protocol - -import django_stubs_ext -from django_stubs_ext import patch -from django_stubs_ext.patch import _need_generic, _VersionSpec - - -class _MakeGenericClasses(Protocol): - """Used to represent a type of ``make_generic_classes`` fixture.""" - - def __call__(self, django_version: Optional[_VersionSpec] = None) -> None: - ... - - -@pytest.fixture(scope="function") -def make_generic_classes( - request: FixtureRequest, - monkeypatch: MonkeyPatch, -) -> _MakeGenericClasses: - def fin() -> None: - for el in _need_generic: - with suppress(AttributeError): - delattr(el.cls, "__class_getitem__") - - def factory(django_version: Optional[_VersionSpec] = None) -> None: - if django_version is not None: - monkeypatch.setattr(patch, "VERSION", django_version) - django_stubs_ext.monkeypatch() - - request.addfinalizer(fin) - return factory - - -def test_patched_generics(make_generic_classes: _MakeGenericClasses) -> None: - """Test that the generics actually get patched.""" - make_generic_classes() - - for el in _need_generic: - if el.version is None: - assert el.cls[type] is el.cls # `type` is arbitrary - - -@pytest.mark.parametrize( - "django_version", - [ - (2, 2), - (3, 0), - (3, 1), - (3, 2), - ], -) -def test_patched_version_specific( - django_version: _VersionSpec, - make_generic_classes: _MakeGenericClasses, -) -> None: - """Test version speicific types.""" - make_generic_classes(django_version) - - for el in _need_generic: - if el.version is not None and django_version <= el.version: - assert el.cls[int] is el.cls diff --git a/mypy.ini b/mypy.ini index c6f0e1763..02d33c30c 100644 --- a/mypy.ini +++ b/mypy.ini @@ -1,14 +1,29 @@ [mypy] -strict_optional = True -ignore_missing_imports = True -check_untyped_defs = True -warn_no_return = False -show_traceback = True -allow_redefinition = True -incremental = True - -plugins = - mypy_django_plugin.main - -[mypy.plugins.django-stubs] -django_settings_module = scripts.django_tests_settings +show_column_numbers=True +pretty=False + +disallow_any_unimported=True +disallow_any_expr=False +disallow_any_decorated=True +disallow_any_explicit=True +disallow_any_generics=True +disallow_subclassing_any=True + +disallow_untyped_calls=True +disallow_untyped_defs=True +disallow_incomplete_defs=True +check_untyped_defs=True +disallow_untyped_decorators=True + +no_implicit_optional=True +strict_optional=True + +warn_redundant_casts=True +warn_unused_ignores=True +warn_no_return=True +warn_return_any=False +warn_unreachable=False + +strict_equality=True + +ignore_missing_imports=False diff --git a/mypy_django_plugin/__init__.py b/mypy_django_plugin/__init__.py deleted file mode 100644 index e69de29bb..000000000 diff --git a/mypy_django_plugin/django/__init__.py b/mypy_django_plugin/django/__init__.py deleted file mode 100644 index e69de29bb..000000000 diff --git a/mypy_django_plugin/django/context.py b/mypy_django_plugin/django/context.py deleted file mode 100644 index 09c6e9667..000000000 --- a/mypy_django_plugin/django/context.py +++ /dev/null @@ -1,377 +0,0 @@ -import os -import sys -from collections import defaultdict -from contextlib import contextmanager -from typing import TYPE_CHECKING, Dict, Iterable, Iterator, Optional, Set, Tuple, Type, Union - -from django.core.exceptions import FieldError -from django.db import models -from django.db.models.base import Model -from django.db.models.fields import AutoField, CharField, Field -from django.db.models.fields.related import ForeignKey, RelatedField -from django.db.models.fields.reverse_related import ForeignObjectRel -from django.db.models.lookups import Exact -from django.db.models.sql.query import Query -from django.utils.functional import cached_property -from mypy.checker import TypeChecker -from mypy.plugin import MethodContext -from mypy.types import AnyType, Instance -from mypy.types import Type as MypyType -from mypy.types import TypeOfAny, UnionType - -from mypy_django_plugin.lib import fullnames, helpers - -try: - from django.contrib.postgres.fields import ArrayField -except ImportError: - - class ArrayField: # type: ignore - pass - - -if TYPE_CHECKING: - from django.apps.registry import Apps # noqa: F401 - from django.conf import LazySettings # noqa: F401 - - -@contextmanager -def temp_environ(): - """Allow the ability to set os.environ temporarily""" - environ = dict(os.environ) - try: - yield - finally: - os.environ.clear() - os.environ.update(environ) - - -def initialize_django(settings_module: str) -> Tuple["Apps", "LazySettings"]: - with temp_environ(): - os.environ["DJANGO_SETTINGS_MODULE"] = settings_module - - # add current directory to sys.path - sys.path.append(os.getcwd()) - - def noop_class_getitem(cls, key): - return cls - - from django.db import models - - models.QuerySet.__class_getitem__ = classmethod(noop_class_getitem) # type: ignore - models.Manager.__class_getitem__ = classmethod(noop_class_getitem) # type: ignore - - from django.apps import apps - from django.conf import settings - - apps.get_models.cache_clear() # type: ignore - apps.get_swappable_settings_name.cache_clear() # type: ignore - - if not settings.configured: - settings._setup() - - apps.populate(settings.INSTALLED_APPS) - - assert apps.apps_ready - assert settings.configured - - return apps, settings - - -class LookupsAreUnsupported(Exception): - pass - - -class DjangoContext: - def __init__(self, django_settings_module: str) -> None: - self.django_settings_module = django_settings_module - - apps, settings = initialize_django(self.django_settings_module) - self.apps_registry = apps - self.settings = settings - - @cached_property - def model_modules(self) -> Dict[str, Set[Type[Model]]]: - """ All modules that contain Django models. """ - if self.apps_registry is None: - return {} - - modules: Dict[str, Set[Type[Model]]] = defaultdict(set) - for concrete_model_cls in self.apps_registry.get_models(): - modules[concrete_model_cls.__module__].add(concrete_model_cls) - # collect abstract=True models - for model_cls in concrete_model_cls.mro()[1:]: - if issubclass(model_cls, Model) and hasattr(model_cls, "_meta") and model_cls._meta.abstract: - modules[model_cls.__module__].add(model_cls) - return modules - - def get_model_class_by_fullname(self, fullname: str) -> Optional[Type[Model]]: - # Returns None if Model is abstract - module, _, model_cls_name = fullname.rpartition(".") - for model_cls in self.model_modules.get(module, set()): - if model_cls.__name__ == model_cls_name: - return model_cls - return None - - def get_model_fields(self, model_cls: Type[Model]) -> Iterator[Field]: - for field in model_cls._meta.get_fields(): - if isinstance(field, Field): - yield field - - def get_model_relations(self, model_cls: Type[Model]) -> Iterator[ForeignObjectRel]: - for field in model_cls._meta.get_fields(): - if isinstance(field, ForeignObjectRel): - yield field - - def get_field_lookup_exact_type(self, api: TypeChecker, field: Union[Field, ForeignObjectRel]) -> MypyType: - if isinstance(field, (RelatedField, ForeignObjectRel)): - related_model_cls = field.related_model - primary_key_field = self.get_primary_key_field(related_model_cls) - primary_key_type = self.get_field_get_type(api, primary_key_field, method="init") - - rel_model_info = helpers.lookup_class_typeinfo(api, related_model_cls) - if rel_model_info is None: - return AnyType(TypeOfAny.explicit) - - model_and_primary_key_type = UnionType.make_union([Instance(rel_model_info, []), primary_key_type]) - return helpers.make_optional(model_and_primary_key_type) - - field_info = helpers.lookup_class_typeinfo(api, field.__class__) - if field_info is None: - return AnyType(TypeOfAny.explicit) - return helpers.get_private_descriptor_type(field_info, "_pyi_lookup_exact_type", is_nullable=field.null) - - def get_primary_key_field(self, model_cls: Type[Model]) -> Field: - for field in model_cls._meta.get_fields(): - if isinstance(field, Field): - if field.primary_key: - return field - raise ValueError("No primary key defined") - - def get_expected_types(self, api: TypeChecker, model_cls: Type[Model], *, method: str) -> Dict[str, MypyType]: - contenttypes_in_apps = self.apps_registry.is_installed("django.contrib.contenttypes") - if contenttypes_in_apps: - from django.contrib.contenttypes.fields import GenericForeignKey - - expected_types = {} - # add pk if not abstract=True - if not model_cls._meta.abstract: - primary_key_field = self.get_primary_key_field(model_cls) - field_set_type = self.get_field_set_type(api, primary_key_field, method=method) - expected_types["pk"] = field_set_type - - for field in model_cls._meta.get_fields(): - if isinstance(field, Field): - field_name = field.attname - field_set_type = self.get_field_set_type(api, field, method=method) - expected_types[field_name] = field_set_type - - if isinstance(field, ForeignKey): - field_name = field.name - foreign_key_info = helpers.lookup_class_typeinfo(api, field.__class__) - if foreign_key_info is None: - # maybe there's no type annotation for the field - expected_types[field_name] = AnyType(TypeOfAny.unannotated) - continue - - related_model = self.get_field_related_model_cls(field) - if related_model is None: - expected_types[field_name] = AnyType(TypeOfAny.from_error) - continue - - if related_model._meta.proxy_for_model is not None: - related_model = related_model._meta.proxy_for_model - - related_model_info = helpers.lookup_class_typeinfo(api, related_model) - if related_model_info is None: - expected_types[field_name] = AnyType(TypeOfAny.unannotated) - continue - - is_nullable = self.get_field_nullability(field, method) - foreign_key_set_type = helpers.get_private_descriptor_type( - foreign_key_info, "_pyi_private_set_type", is_nullable=is_nullable - ) - model_set_type = helpers.convert_any_to_type(foreign_key_set_type, Instance(related_model_info, [])) - - expected_types[field_name] = model_set_type - - elif contenttypes_in_apps and isinstance(field, GenericForeignKey): - # it's generic, so cannot set specific model - field_name = field.name - gfk_info = helpers.lookup_class_typeinfo(api, field.__class__) - gfk_set_type = helpers.get_private_descriptor_type(gfk_info, "_pyi_private_set_type", is_nullable=True) - expected_types[field_name] = gfk_set_type - - return expected_types - - @cached_property - def all_registered_model_classes(self) -> Set[Type[models.Model]]: - model_classes = self.apps_registry.get_models() - - all_model_bases = set() - for model_cls in model_classes: - for base_cls in model_cls.mro(): - if issubclass(base_cls, models.Model): - all_model_bases.add(base_cls) - - return all_model_bases - - @cached_property - def all_registered_model_class_fullnames(self) -> Set[str]: - return {helpers.get_class_fullname(cls) for cls in self.all_registered_model_classes} - - def get_attname(self, field: Field) -> str: - attname = field.attname - return attname - - def get_field_nullability(self, field: Union[Field, ForeignObjectRel], method: Optional[str]) -> bool: - nullable = field.null - if not nullable and isinstance(field, CharField) and field.blank: - return True - if method == "__init__": - if (isinstance(field, Field) and field.primary_key) or isinstance(field, ForeignKey): - return True - if method == "create": - if isinstance(field, AutoField): - return True - if isinstance(field, Field) and field.has_default(): - return True - return nullable - - def get_field_set_type(self, api: TypeChecker, field: Union[Field, ForeignObjectRel], *, method: str) -> MypyType: - """ Get a type of __set__ for this specific Django field. """ - target_field = field - if isinstance(field, ForeignKey): - target_field = field.target_field - - field_info = helpers.lookup_class_typeinfo(api, target_field.__class__) - if field_info is None: - return AnyType(TypeOfAny.from_error) - - field_set_type = helpers.get_private_descriptor_type( - field_info, "_pyi_private_set_type", is_nullable=self.get_field_nullability(field, method) - ) - if isinstance(target_field, ArrayField): - argument_field_type = self.get_field_set_type(api, target_field.base_field, method=method) - field_set_type = helpers.convert_any_to_type(field_set_type, argument_field_type) - return field_set_type - - def get_field_get_type(self, api: TypeChecker, field: Union[Field, ForeignObjectRel], *, method: str) -> MypyType: - """ Get a type of __get__ for this specific Django field. """ - field_info = helpers.lookup_class_typeinfo(api, field.__class__) - if field_info is None: - return AnyType(TypeOfAny.unannotated) - - is_nullable = self.get_field_nullability(field, method) - if isinstance(field, RelatedField): - related_model_cls = self.get_field_related_model_cls(field) - if related_model_cls is None: - return AnyType(TypeOfAny.from_error) - - if method == "values": - primary_key_field = self.get_primary_key_field(related_model_cls) - return self.get_field_get_type(api, primary_key_field, method=method) - - model_info = helpers.lookup_class_typeinfo(api, related_model_cls) - if model_info is None: - return AnyType(TypeOfAny.unannotated) - - return Instance(model_info, []) - else: - return helpers.get_private_descriptor_type(field_info, "_pyi_private_get_type", is_nullable=is_nullable) - - def get_field_related_model_cls(self, field: Union[RelatedField, ForeignObjectRel]) -> Optional[Type[Model]]: - if isinstance(field, RelatedField): - related_model_cls = field.remote_field.model - else: - related_model_cls = field.field.model - - if isinstance(related_model_cls, str): - if related_model_cls == "self": - # same model - related_model_cls = field.model - elif "." not in related_model_cls: - # same file model - related_model_fullname = field.model.__module__ + "." + related_model_cls - related_model_cls = self.get_model_class_by_fullname(related_model_fullname) - else: - related_model_cls = self.apps_registry.get_model(related_model_cls) - - return related_model_cls - - def _resolve_field_from_parts( - self, field_parts: Iterable[str], model_cls: Type[Model] - ) -> Union[Field, ForeignObjectRel]: - currently_observed_model = model_cls - field = None - for field_part in field_parts: - if field_part == "pk": - field = self.get_primary_key_field(currently_observed_model) - continue - - field = currently_observed_model._meta.get_field(field_part) - if isinstance(field, RelatedField): - currently_observed_model = field.related_model - model_name = currently_observed_model._meta.model_name - if model_name is not None and field_part == (model_name + "_id"): - field = self.get_primary_key_field(currently_observed_model) - - if isinstance(field, ForeignObjectRel): - currently_observed_model = field.related_model - - assert field is not None - return field - - def resolve_lookup_into_field(self, model_cls: Type[Model], lookup: str) -> Union[Field, ForeignObjectRel]: - query = Query(model_cls) - lookup_parts, field_parts, is_expression = query.solve_lookup_type(lookup) - if lookup_parts: - raise LookupsAreUnsupported() - - return self._resolve_field_from_parts(field_parts, model_cls) - - def resolve_lookup_expected_type(self, ctx: MethodContext, model_cls: Type[Model], lookup: str) -> MypyType: - query = Query(model_cls) - try: - lookup_parts, field_parts, is_expression = query.solve_lookup_type(lookup) - if is_expression: - return AnyType(TypeOfAny.explicit) - except FieldError as exc: - ctx.api.fail(exc.args[0], ctx.context) - return AnyType(TypeOfAny.from_error) - - field = self._resolve_field_from_parts(field_parts, model_cls) - - lookup_cls = None - if lookup_parts: - lookup = lookup_parts[-1] - lookup_cls = field.get_lookup(lookup) - if lookup_cls is None: - # unknown lookup - return AnyType(TypeOfAny.explicit) - - if lookup_cls is None or isinstance(lookup_cls, Exact): - return self.get_field_lookup_exact_type(helpers.get_typechecker_api(ctx), field) - - assert lookup_cls is not None - - lookup_info = helpers.lookup_class_typeinfo(helpers.get_typechecker_api(ctx), lookup_cls) - if lookup_info is None: - return AnyType(TypeOfAny.explicit) - - for lookup_base in helpers.iter_bases(lookup_info): - if lookup_base.args and isinstance(lookup_base.args[0], Instance): - lookup_type: MypyType = lookup_base.args[0] - # if it's Field, consider lookup_type a __get__ of current field - if isinstance(lookup_type, Instance) and lookup_type.type.fullname == fullnames.FIELD_FULLNAME: - field_info = helpers.lookup_class_typeinfo(helpers.get_typechecker_api(ctx), field.__class__) - if field_info is None: - return AnyType(TypeOfAny.explicit) - lookup_type = helpers.get_private_descriptor_type( - field_info, "_pyi_private_get_type", is_nullable=field.null - ) - return lookup_type - - return AnyType(TypeOfAny.explicit) - - def resolve_f_expression_type(self, f_expression_type: Instance) -> MypyType: - return AnyType(TypeOfAny.explicit) diff --git a/mypy_django_plugin/lib/__init__.py b/mypy_django_plugin/lib/__init__.py deleted file mode 100644 index e69de29bb..000000000 diff --git a/mypy_django_plugin/lib/fullnames.py b/mypy_django_plugin/lib/fullnames.py deleted file mode 100644 index 798a0804f..000000000 --- a/mypy_django_plugin/lib/fullnames.py +++ /dev/null @@ -1,34 +0,0 @@ -MODEL_CLASS_FULLNAME = "django.db.models.base.Model" -FIELD_FULLNAME = "django.db.models.fields.Field" -CHAR_FIELD_FULLNAME = "django.db.models.fields.CharField" -ARRAY_FIELD_FULLNAME = "django.contrib.postgres.fields.array.ArrayField" -AUTO_FIELD_FULLNAME = "django.db.models.fields.AutoField" -GENERIC_FOREIGN_KEY_FULLNAME = "django.contrib.contenttypes.fields.GenericForeignKey" -FOREIGN_KEY_FULLNAME = "django.db.models.fields.related.ForeignKey" -ONETOONE_FIELD_FULLNAME = "django.db.models.fields.related.OneToOneField" -MANYTOMANY_FIELD_FULLNAME = "django.db.models.fields.related.ManyToManyField" -DUMMY_SETTINGS_BASE_CLASS = "django.conf._DjangoConfLazyObject" - -QUERYSET_CLASS_FULLNAME = "django.db.models.query.QuerySet" -BASE_MANAGER_CLASS_FULLNAME = "django.db.models.manager.BaseManager" -MANAGER_CLASS_FULLNAME = "django.db.models.manager.Manager" -RELATED_MANAGER_CLASS = "django.db.models.manager.RelatedManager" - -BASEFORM_CLASS_FULLNAME = "django.forms.forms.BaseForm" -FORM_CLASS_FULLNAME = "django.forms.forms.Form" -MODELFORM_CLASS_FULLNAME = "django.forms.models.ModelForm" - -FORM_MIXIN_CLASS_FULLNAME = "django.views.generic.edit.FormMixin" - -MANAGER_CLASSES = { - MANAGER_CLASS_FULLNAME, - BASE_MANAGER_CLASS_FULLNAME, -} - -RELATED_FIELDS_CLASSES = {FOREIGN_KEY_FULLNAME, ONETOONE_FIELD_FULLNAME, MANYTOMANY_FIELD_FULLNAME} - -MIGRATION_CLASS_FULLNAME = "django.db.migrations.migration.Migration" -OPTIONS_CLASS_FULLNAME = "django.db.models.options.Options" -HTTPREQUEST_CLASS_FULLNAME = "django.http.request.HttpRequest" - -F_EXPRESSION_FULLNAME = "django.db.models.expressions.F" diff --git a/mypy_django_plugin/lib/helpers.py b/mypy_django_plugin/lib/helpers.py deleted file mode 100644 index e13b0ecfd..000000000 --- a/mypy_django_plugin/lib/helpers.py +++ /dev/null @@ -1,394 +0,0 @@ -from collections import OrderedDict -from typing import TYPE_CHECKING, Any, Dict, Iterable, Iterator, List, Optional, Set, Tuple, Union - -from django.db.models.fields import Field -from django.db.models.fields.related import RelatedField -from django.db.models.fields.reverse_related import ForeignObjectRel -from mypy import checker -from mypy.checker import TypeChecker -from mypy.mro import calculate_mro -from mypy.nodes import ( - GDEF, - MDEF, - Argument, - Block, - ClassDef, - Expression, - FuncDef, - MemberExpr, - MypyFile, - NameExpr, - PlaceholderNode, - StrExpr, - SymbolNode, - SymbolTable, - SymbolTableNode, - TypeInfo, - Var, -) -from mypy.plugin import ( - AttributeContext, - CheckerPluginInterface, - ClassDefContext, - DynamicClassDefContext, - FunctionContext, - MethodContext, -) -from mypy.plugins.common import add_method -from mypy.semanal import SemanticAnalyzer -from mypy.types import AnyType, CallableType, Instance, NoneTyp, TupleType -from mypy.types import Type as MypyType -from mypy.types import TypedDictType, TypeOfAny, UnionType - -from mypy_django_plugin.lib import fullnames - -if TYPE_CHECKING: - from mypy_django_plugin.django.context import DjangoContext - - -def get_django_metadata(model_info: TypeInfo) -> Dict[str, Any]: - return model_info.metadata.setdefault("django", {}) - - -class IncompleteDefnException(Exception): - pass - - -def lookup_fully_qualified_sym(fullname: str, all_modules: Dict[str, MypyFile]) -> Optional[SymbolTableNode]: - if "." not in fullname: - return None - module, cls_name = fullname.rsplit(".", 1) - - module_file = all_modules.get(module) - if module_file is None: - return None - sym = module_file.names.get(cls_name) - if sym is None: - return None - return sym - - -def lookup_fully_qualified_generic(name: str, all_modules: Dict[str, MypyFile]) -> Optional[SymbolNode]: - sym = lookup_fully_qualified_sym(name, all_modules) - if sym is None: - return None - return sym.node - - -def lookup_fully_qualified_typeinfo(api: Union[TypeChecker, SemanticAnalyzer], fullname: str) -> Optional[TypeInfo]: - node = lookup_fully_qualified_generic(fullname, api.modules) - if not isinstance(node, TypeInfo): - return None - return node - - -def lookup_class_typeinfo(api: TypeChecker, klass: type) -> Optional[TypeInfo]: - fullname = get_class_fullname(klass) - field_info = lookup_fully_qualified_typeinfo(api, fullname) - return field_info - - -def reparametrize_instance(instance: Instance, new_args: List[MypyType]) -> Instance: - return Instance(instance.type, args=new_args, line=instance.line, column=instance.column) - - -def get_class_fullname(klass: type) -> str: - return klass.__module__ + "." + klass.__qualname__ - - -def get_call_argument_by_name(ctx: Union[FunctionContext, MethodContext], name: str) -> Optional[Expression]: - """ - Return the expression for the specific argument. - This helper should only be used with non-star arguments. - """ - if name not in ctx.callee_arg_names: - return None - idx = ctx.callee_arg_names.index(name) - args = ctx.args[idx] - if len(args) != 1: - # Either an error or no value passed. - return None - return args[0] - - -def get_call_argument_type_by_name(ctx: Union[FunctionContext, MethodContext], name: str) -> Optional[MypyType]: - """Return the type for the specific argument. - - This helper should only be used with non-star arguments. - """ - if name not in ctx.callee_arg_names: - return None - idx = ctx.callee_arg_names.index(name) - arg_types = ctx.arg_types[idx] - if len(arg_types) != 1: - # Either an error or no value passed. - return None - return arg_types[0] - - -def make_optional(typ: MypyType) -> MypyType: - return UnionType.make_union([typ, NoneTyp()]) - - -def parse_bool(expr: Expression) -> Optional[bool]: - if isinstance(expr, NameExpr): - if expr.fullname == "builtins.True": - return True - if expr.fullname == "builtins.False": - return False - return None - - -def has_any_of_bases(info: TypeInfo, bases: Iterable[str]) -> bool: - for base_fullname in bases: - if info.has_base(base_fullname): - return True - return False - - -def iter_bases(info: TypeInfo) -> Iterator[Instance]: - for base in info.bases: - yield base - yield from iter_bases(base.type) - - -def get_private_descriptor_type(type_info: TypeInfo, private_field_name: str, is_nullable: bool) -> MypyType: - """ Return declared type of type_info's private_field_name (used for private Field attributes)""" - sym = type_info.get(private_field_name) - if sym is None: - return AnyType(TypeOfAny.explicit) - - node = sym.node - if isinstance(node, Var): - descriptor_type = node.type - if descriptor_type is None: - return AnyType(TypeOfAny.explicit) - - if is_nullable: - descriptor_type = make_optional(descriptor_type) - return descriptor_type - return AnyType(TypeOfAny.explicit) - - -def get_field_lookup_exact_type(api: TypeChecker, field: Field) -> MypyType: - if isinstance(field, (RelatedField, ForeignObjectRel)): - lookup_type_class = field.related_model - rel_model_info = lookup_class_typeinfo(api, lookup_type_class) - if rel_model_info is None: - return AnyType(TypeOfAny.from_error) - return make_optional(Instance(rel_model_info, [])) - - field_info = lookup_class_typeinfo(api, field.__class__) - if field_info is None: - return AnyType(TypeOfAny.explicit) - return get_private_descriptor_type(field_info, "_pyi_lookup_exact_type", is_nullable=field.null) - - -def get_nested_meta_node_for_current_class(info: TypeInfo) -> Optional[TypeInfo]: - metaclass_sym = info.names.get("Meta") - if metaclass_sym is not None and isinstance(metaclass_sym.node, TypeInfo): - return metaclass_sym.node - return None - - -def add_new_class_for_module( - module: MypyFile, name: str, bases: List[Instance], fields: Optional[Dict[str, MypyType]] = None -) -> TypeInfo: - new_class_unique_name = checker.gen_unique_name(name, module.names) - - # make new class expression - classdef = ClassDef(new_class_unique_name, Block([])) - classdef.fullname = module.fullname + "." + new_class_unique_name - - # make new TypeInfo - new_typeinfo = TypeInfo(SymbolTable(), classdef, module.fullname) - new_typeinfo.bases = bases - calculate_mro(new_typeinfo) - new_typeinfo.calculate_metaclass_type() - - # add fields - if fields: - for field_name, field_type in fields.items(): - var = Var(field_name, type=field_type) - var.info = new_typeinfo - var._fullname = new_typeinfo.fullname + "." + field_name - new_typeinfo.names[field_name] = SymbolTableNode(MDEF, var, plugin_generated=True) - - classdef.info = new_typeinfo - module.names[new_class_unique_name] = SymbolTableNode(GDEF, new_typeinfo, plugin_generated=True) - return new_typeinfo - - -def get_current_module(api: TypeChecker) -> MypyFile: - current_module = None - for item in reversed(api.scope.stack): - if isinstance(item, MypyFile): - current_module = item - break - assert current_module is not None - return current_module - - -def make_oneoff_named_tuple(api: TypeChecker, name: str, fields: "OrderedDict[str, MypyType]") -> TupleType: - current_module = get_current_module(api) - namedtuple_info = add_new_class_for_module( - current_module, name, bases=[api.named_generic_type("typing.NamedTuple", [])], fields=fields - ) - return TupleType(list(fields.values()), fallback=Instance(namedtuple_info, [])) - - -def make_tuple(api: "TypeChecker", fields: List[MypyType]) -> TupleType: - # fallback for tuples is any builtins.tuple instance - fallback = api.named_generic_type("builtins.tuple", [AnyType(TypeOfAny.special_form)]) - return TupleType(fields, fallback=fallback) - - -def convert_any_to_type(typ: MypyType, referred_to_type: MypyType) -> MypyType: - if isinstance(typ, UnionType): - converted_items = [] - for item in typ.items: - converted_items.append(convert_any_to_type(item, referred_to_type)) - return UnionType.make_union(converted_items, line=typ.line, column=typ.column) - if isinstance(typ, Instance): - args = [] - for default_arg in typ.args: - if isinstance(default_arg, AnyType): - args.append(referred_to_type) - else: - args.append(default_arg) - return reparametrize_instance(typ, args) - - if isinstance(typ, AnyType): - return referred_to_type - - return typ - - -def make_typeddict( - api: CheckerPluginInterface, fields: "OrderedDict[str, MypyType]", required_keys: Set[str] -) -> TypedDictType: - object_type = api.named_generic_type("mypy_extensions._TypedDict", []) - typed_dict_type = TypedDictType(fields, required_keys=required_keys, fallback=object_type) - return typed_dict_type - - -def resolve_string_attribute_value(attr_expr: Expression, django_context: "DjangoContext") -> Optional[str]: - if isinstance(attr_expr, StrExpr): - return attr_expr.value - - # support extracting from settings, in general case it's unresolvable yet - if isinstance(attr_expr, MemberExpr): - member_name = attr_expr.name - if isinstance(attr_expr.expr, NameExpr) and attr_expr.expr.fullname == "django.conf.settings": - if hasattr(django_context.settings, member_name): - return getattr(django_context.settings, member_name) - return None - - -def get_semanal_api(ctx: Union[ClassDefContext, DynamicClassDefContext]) -> SemanticAnalyzer: - if not isinstance(ctx.api, SemanticAnalyzer): - raise ValueError("Not a SemanticAnalyzer") - return ctx.api - - -def get_typechecker_api(ctx: Union[AttributeContext, MethodContext, FunctionContext]) -> TypeChecker: - if not isinstance(ctx.api, TypeChecker): - raise ValueError("Not a TypeChecker") - return ctx.api - - -def is_model_subclass_info(info: TypeInfo, django_context: "DjangoContext") -> bool: - return info.fullname in django_context.all_registered_model_class_fullnames or info.has_base( - fullnames.MODEL_CLASS_FULLNAME - ) - - -def check_types_compatible( - ctx: Union[FunctionContext, MethodContext], *, expected_type: MypyType, actual_type: MypyType, error_message: str -) -> None: - api = get_typechecker_api(ctx) - api.check_subtype(actual_type, expected_type, ctx.context, error_message, "got", "expected") - - -def add_new_sym_for_info(info: TypeInfo, *, name: str, sym_type: MypyType) -> None: - # type=: type of the variable itself - var = Var(name=name, type=sym_type) - # var.info: type of the object variable is bound to - var.info = info - var._fullname = info.fullname + "." + name - var.is_initialized_in_class = True - var.is_inferred = True - info.names[name] = SymbolTableNode(MDEF, var, plugin_generated=True) - - -def build_unannotated_method_args(method_node: FuncDef) -> Tuple[List[Argument], MypyType]: - prepared_arguments = [] - try: - arguments = method_node.arguments[1:] - except AttributeError: - arguments = [] - for argument in arguments: - argument.type_annotation = AnyType(TypeOfAny.unannotated) - prepared_arguments.append(argument) - return_type = AnyType(TypeOfAny.unannotated) - return prepared_arguments, return_type - - -def copy_method_to_another_class( - ctx: ClassDefContext, self_type: Instance, new_method_name: str, method_node: FuncDef -) -> None: - semanal_api = get_semanal_api(ctx) - if method_node.type is None: - if not semanal_api.final_iteration: - semanal_api.defer() - return - - arguments, return_type = build_unannotated_method_args(method_node) - add_method(ctx, new_method_name, args=arguments, return_type=return_type, self_type=self_type) - return - - method_type = method_node.type - if not isinstance(method_type, CallableType): - if not semanal_api.final_iteration: - semanal_api.defer() - return - - arguments = [] - bound_return_type = semanal_api.anal_type(method_type.ret_type, allow_placeholder=True) - - assert bound_return_type is not None - - if isinstance(bound_return_type, PlaceholderNode): - return - - try: - original_arguments = method_node.arguments[1:] - except AttributeError: - original_arguments = [] - - for arg_name, arg_type, original_argument in zip( - method_type.arg_names[1:], method_type.arg_types[1:], original_arguments - ): - bound_arg_type = semanal_api.anal_type(arg_type, allow_placeholder=True) - if bound_arg_type is None and not semanal_api.final_iteration: - semanal_api.defer() - return - - assert bound_arg_type is not None - - if isinstance(bound_arg_type, PlaceholderNode): - return - - var = Var(name=original_argument.variable.name, type=arg_type) - var.line = original_argument.variable.line - var.column = original_argument.variable.column - argument = Argument( - variable=var, - type_annotation=bound_arg_type, - initializer=original_argument.initializer, - kind=original_argument.kind, - ) - argument.set_line(original_argument) - arguments.append(argument) - - add_method(ctx, new_method_name, args=arguments, return_type=bound_return_type, self_type=self_type) diff --git a/mypy_django_plugin/main.py b/mypy_django_plugin/main.py deleted file mode 100644 index 9ca2a93da..000000000 --- a/mypy_django_plugin/main.py +++ /dev/null @@ -1,287 +0,0 @@ -import configparser -import sys -from functools import partial -from typing import Callable, Dict, List, NoReturn, Optional, Tuple, cast - -from django.db.models.fields.related import RelatedField -from mypy.modulefinder import mypy_path -from mypy.nodes import MypyFile, TypeInfo -from mypy.options import Options -from mypy.plugin import ( - AttributeContext, - ClassDefContext, - DynamicClassDefContext, - FunctionContext, - MethodContext, - Plugin, -) -from mypy.types import Type as MypyType - -import mypy_django_plugin.transformers.orm_lookups -from mypy_django_plugin.django.context import DjangoContext -from mypy_django_plugin.lib import fullnames, helpers -from mypy_django_plugin.transformers import fields, forms, init_create, meta, querysets, request, settings -from mypy_django_plugin.transformers.managers import create_new_manager_class_from_from_queryset_method -from mypy_django_plugin.transformers.models import process_model_class - - -def transform_model_class(ctx: ClassDefContext, django_context: DjangoContext) -> None: - sym = ctx.api.lookup_fully_qualified_or_none(fullnames.MODEL_CLASS_FULLNAME) - - if sym is not None and isinstance(sym.node, TypeInfo): - helpers.get_django_metadata(sym.node)["model_bases"][ctx.cls.fullname] = 1 - else: - if not ctx.api.final_iteration: - ctx.api.defer() - return - - process_model_class(ctx, django_context) - - -def transform_form_class(ctx: ClassDefContext) -> None: - sym = ctx.api.lookup_fully_qualified_or_none(fullnames.BASEFORM_CLASS_FULLNAME) - if sym is not None and isinstance(sym.node, TypeInfo): - helpers.get_django_metadata(sym.node)["baseform_bases"][ctx.cls.fullname] = 1 - - forms.make_meta_nested_class_inherit_from_any(ctx) - - -def add_new_manager_base(ctx: ClassDefContext) -> None: - sym = ctx.api.lookup_fully_qualified_or_none(fullnames.MANAGER_CLASS_FULLNAME) - if sym is not None and isinstance(sym.node, TypeInfo): - helpers.get_django_metadata(sym.node)["manager_bases"][ctx.cls.fullname] = 1 - - -def extract_django_settings_module(config_file_path: Optional[str]) -> str: - def exit(error_type: int) -> NoReturn: - """Using mypy's argument parser, raise `SystemExit` to fail hard if validation fails. - - Considering that the plugin's startup duration is around double as long as mypy's, this aims to - import and construct objects only when that's required - which happens once and terminates the - run. Considering that most of the runs are successful, there's no need for this to linger in the - global scope. - """ - from mypy.main import CapturableArgumentParser - - usage = """(config) - ... - [mypy.plugins.django_stubs] - django_settings_module: str (required) - ... - """.replace( - "\n" + 8 * " ", "\n" - ) - handler = CapturableArgumentParser(prog="(django-stubs) mypy", usage=usage) - messages = { - 1: "mypy config file is not specified or found", - 2: "no section [mypy.plugins.django-stubs]", - 3: "the setting is not provided", - } - handler.error("'django_settings_module' is not set: " + messages[error_type]) - - parser = configparser.ConfigParser() - try: - with open(cast(str, config_file_path)) as handle: - parser.read_file(handle, source=config_file_path) - except (IsADirectoryError, OSError): - exit(1) - - section = "mypy.plugins.django-stubs" - if not parser.has_section(section): - exit(2) - settings = parser.get(section, "django_settings_module", fallback=None) or exit(3) - return cast(str, settings).strip("'\"") - - -class NewSemanalDjangoPlugin(Plugin): - def __init__(self, options: Options) -> None: - super().__init__(options) - django_settings_module = extract_django_settings_module(options.config_file) - # Add paths from MYPYPATH env var - sys.path.extend(mypy_path()) - # Add paths from mypy_path config option - sys.path.extend(options.mypy_path) - self.django_context = DjangoContext(django_settings_module) - - def _get_current_queryset_bases(self) -> Dict[str, int]: - model_sym = self.lookup_fully_qualified(fullnames.QUERYSET_CLASS_FULLNAME) - if model_sym is not None and isinstance(model_sym.node, TypeInfo): - return helpers.get_django_metadata(model_sym.node).setdefault( - "queryset_bases", {fullnames.QUERYSET_CLASS_FULLNAME: 1} - ) - else: - return {} - - def _get_current_manager_bases(self) -> Dict[str, int]: - model_sym = self.lookup_fully_qualified(fullnames.MANAGER_CLASS_FULLNAME) - if model_sym is not None and isinstance(model_sym.node, TypeInfo): - return helpers.get_django_metadata(model_sym.node).setdefault( - "manager_bases", {fullnames.MANAGER_CLASS_FULLNAME: 1} - ) - else: - return {} - - def _get_current_model_bases(self) -> Dict[str, int]: - model_sym = self.lookup_fully_qualified(fullnames.MODEL_CLASS_FULLNAME) - if model_sym is not None and isinstance(model_sym.node, TypeInfo): - return helpers.get_django_metadata(model_sym.node).setdefault( - "model_bases", {fullnames.MODEL_CLASS_FULLNAME: 1} - ) - else: - return {} - - def _get_current_form_bases(self) -> Dict[str, int]: - model_sym = self.lookup_fully_qualified(fullnames.BASEFORM_CLASS_FULLNAME) - if model_sym is not None and isinstance(model_sym.node, TypeInfo): - return helpers.get_django_metadata(model_sym.node).setdefault( - "baseform_bases", - { - fullnames.BASEFORM_CLASS_FULLNAME: 1, - fullnames.FORM_CLASS_FULLNAME: 1, - fullnames.MODELFORM_CLASS_FULLNAME: 1, - }, - ) - else: - return {} - - def _get_typeinfo_or_none(self, class_name: str) -> Optional[TypeInfo]: - sym = self.lookup_fully_qualified(class_name) - if sym is not None and isinstance(sym.node, TypeInfo): - return sym.node - return None - - def _new_dependency(self, module: str) -> Tuple[int, str, int]: - return 10, module, -1 - - def get_additional_deps(self, file: MypyFile) -> List[Tuple[int, str, int]]: - # for settings - if file.fullname == "django.conf" and self.django_context.django_settings_module: - return [self._new_dependency(self.django_context.django_settings_module)] - - # for values / values_list - if file.fullname == "django.db.models": - return [self._new_dependency("mypy_extensions"), self._new_dependency("typing")] - - # for `get_user_model()` - if self.django_context.settings: - if file.fullname == "django.contrib.auth" or file.fullname in {"django.http", "django.http.request"}: - auth_user_model_name = self.django_context.settings.AUTH_USER_MODEL - try: - auth_user_module = self.django_context.apps_registry.get_model(auth_user_model_name).__module__ - except LookupError: - # get_user_model() model app is not installed - return [] - return [self._new_dependency(auth_user_module)] - - # ensure that all mentioned to='someapp.SomeModel' are loaded with corresponding related Fields - defined_model_classes = self.django_context.model_modules.get(file.fullname) - if not defined_model_classes: - return [] - deps = set() - for model_class in defined_model_classes: - # forward relations - for field in self.django_context.get_model_fields(model_class): - if isinstance(field, RelatedField): - related_model_cls = self.django_context.get_field_related_model_cls(field) - if related_model_cls is None: - continue - related_model_module = related_model_cls.__module__ - if related_model_module != file.fullname: - deps.add(self._new_dependency(related_model_module)) - # reverse relations - for relation in model_class._meta.related_objects: - related_model_cls = self.django_context.get_field_related_model_cls(relation) - related_model_module = related_model_cls.__module__ - if related_model_module != file.fullname: - deps.add(self._new_dependency(related_model_module)) - return list(deps) - - def get_function_hook(self, fullname: str) -> Optional[Callable[[FunctionContext], MypyType]]: - if fullname == "django.contrib.auth.get_user_model": - return partial(settings.get_user_model_hook, django_context=self.django_context) - - manager_bases = self._get_current_manager_bases() - if fullname in manager_bases: - return querysets.determine_proper_manager_type - - info = self._get_typeinfo_or_none(fullname) - if info: - if info.has_base(fullnames.FIELD_FULLNAME): - return partial(fields.transform_into_proper_return_type, django_context=self.django_context) - - if helpers.is_model_subclass_info(info, self.django_context): - return partial(init_create.redefine_and_typecheck_model_init, django_context=self.django_context) - return None - - def get_method_hook(self, fullname: str) -> Optional[Callable[[MethodContext], MypyType]]: - class_fullname, _, method_name = fullname.rpartition(".") - if method_name == "get_form_class": - info = self._get_typeinfo_or_none(class_fullname) - if info and info.has_base(fullnames.FORM_MIXIN_CLASS_FULLNAME): - return forms.extract_proper_type_for_get_form_class - - if method_name == "get_form": - info = self._get_typeinfo_or_none(class_fullname) - if info and info.has_base(fullnames.FORM_MIXIN_CLASS_FULLNAME): - return forms.extract_proper_type_for_get_form - - if method_name == "values": - info = self._get_typeinfo_or_none(class_fullname) - if info and info.has_base(fullnames.QUERYSET_CLASS_FULLNAME): - return partial(querysets.extract_proper_type_queryset_values, django_context=self.django_context) - - if method_name == "values_list": - info = self._get_typeinfo_or_none(class_fullname) - if info and info.has_base(fullnames.QUERYSET_CLASS_FULLNAME): - return partial(querysets.extract_proper_type_queryset_values_list, django_context=self.django_context) - - if method_name == "get_field": - info = self._get_typeinfo_or_none(class_fullname) - if info and info.has_base(fullnames.OPTIONS_CLASS_FULLNAME): - return partial(meta.return_proper_field_type_from_get_field, django_context=self.django_context) - - manager_classes = self._get_current_manager_bases() - if class_fullname in manager_classes and method_name == "create": - return partial(init_create.redefine_and_typecheck_model_create, django_context=self.django_context) - if class_fullname in manager_classes and method_name in {"filter", "get", "exclude"}: - return partial( - mypy_django_plugin.transformers.orm_lookups.typecheck_queryset_filter, - django_context=self.django_context, - ) - return None - - def get_base_class_hook(self, fullname: str) -> Optional[Callable[[ClassDefContext], None]]: - if ( - fullname in self.django_context.all_registered_model_class_fullnames - or fullname in self._get_current_model_bases() - ): - return partial(transform_model_class, django_context=self.django_context) - - if fullname in self._get_current_manager_bases(): - return add_new_manager_base - - if fullname in self._get_current_form_bases(): - return transform_form_class - return None - - def get_attribute_hook(self, fullname: str) -> Optional[Callable[[AttributeContext], MypyType]]: - class_name, _, attr_name = fullname.rpartition(".") - if class_name == fullnames.DUMMY_SETTINGS_BASE_CLASS: - return partial(settings.get_type_of_settings_attribute, django_context=self.django_context) - - info = self._get_typeinfo_or_none(class_name) - if info and info.has_base(fullnames.HTTPREQUEST_CLASS_FULLNAME) and attr_name == "user": - return partial(request.set_auth_user_model_as_type_for_request_user, django_context=self.django_context) - return None - - def get_dynamic_class_hook(self, fullname: str) -> Optional[Callable[[DynamicClassDefContext], None]]: - if fullname.endswith("from_queryset"): - class_name, _, _ = fullname.rpartition(".") - info = self._get_typeinfo_or_none(class_name) - if info and info.has_base(fullnames.BASE_MANAGER_CLASS_FULLNAME): - return create_new_manager_class_from_from_queryset_method - return None - - -def plugin(version): - return NewSemanalDjangoPlugin diff --git a/mypy_django_plugin/transformers/__init__.py b/mypy_django_plugin/transformers/__init__.py deleted file mode 100644 index e69de29bb..000000000 diff --git a/mypy_django_plugin/transformers/fields.py b/mypy_django_plugin/transformers/fields.py deleted file mode 100644 index a2f68fe0f..000000000 --- a/mypy_django_plugin/transformers/fields.py +++ /dev/null @@ -1,151 +0,0 @@ -from typing import Optional, Tuple, cast - -from django.db.models.fields import Field -from django.db.models.fields.related import RelatedField -from mypy.nodes import AssignmentStmt, NameExpr, TypeInfo -from mypy.plugin import FunctionContext -from mypy.types import AnyType, Instance -from mypy.types import Type as MypyType -from mypy.types import TypeOfAny - -from mypy_django_plugin.django.context import DjangoContext -from mypy_django_plugin.lib import fullnames, helpers - - -def _get_current_field_from_assignment(ctx: FunctionContext, django_context: DjangoContext) -> Optional[Field]: - outer_model_info = helpers.get_typechecker_api(ctx).scope.active_class() - if outer_model_info is None or not helpers.is_model_subclass_info(outer_model_info, django_context): - return None - - field_name = None - for stmt in outer_model_info.defn.defs.body: - if isinstance(stmt, AssignmentStmt): - if stmt.rvalue == ctx.context: - if not isinstance(stmt.lvalues[0], NameExpr): - return None - field_name = stmt.lvalues[0].name - break - if field_name is None: - return None - - model_cls = django_context.get_model_class_by_fullname(outer_model_info.fullname) - if model_cls is None: - return None - - current_field = model_cls._meta.get_field(field_name) - return current_field - - -def reparametrize_related_field_type(related_field_type: Instance, set_type, get_type) -> Instance: - args = [ - helpers.convert_any_to_type(related_field_type.args[0], set_type), - helpers.convert_any_to_type(related_field_type.args[1], get_type), - ] - return helpers.reparametrize_instance(related_field_type, new_args=args) - - -def fill_descriptor_types_for_related_field(ctx: FunctionContext, django_context: DjangoContext) -> MypyType: - current_field = _get_current_field_from_assignment(ctx, django_context) - if current_field is None: - return AnyType(TypeOfAny.from_error) - - assert isinstance(current_field, RelatedField) - - related_model_cls = django_context.get_field_related_model_cls(current_field) - if related_model_cls is None: - return AnyType(TypeOfAny.from_error) - - default_related_field_type = set_descriptor_types_for_field(ctx) - - # self reference with abstract=True on the model where ForeignKey is defined - current_model_cls = current_field.model - if current_model_cls._meta.abstract and current_model_cls == related_model_cls: - # for all derived non-abstract classes, set variable with this name to - # __get__/__set__ of ForeignKey of derived model - for model_cls in django_context.all_registered_model_classes: - if issubclass(model_cls, current_model_cls) and not model_cls._meta.abstract: - derived_model_info = helpers.lookup_class_typeinfo(helpers.get_typechecker_api(ctx), model_cls) - if derived_model_info is not None: - fk_ref_type = Instance(derived_model_info, []) - derived_fk_type = reparametrize_related_field_type( - default_related_field_type, set_type=fk_ref_type, get_type=fk_ref_type - ) - helpers.add_new_sym_for_info(derived_model_info, name=current_field.name, sym_type=derived_fk_type) - - related_model = related_model_cls - related_model_to_set = related_model_cls - if related_model_to_set._meta.proxy_for_model is not None: - related_model_to_set = related_model_to_set._meta.proxy_for_model - - typechecker_api = helpers.get_typechecker_api(ctx) - - related_model_info = helpers.lookup_class_typeinfo(typechecker_api, related_model) - if related_model_info is None: - # maybe no type stub - related_model_type = AnyType(TypeOfAny.unannotated) - else: - related_model_type = Instance(related_model_info, []) # type: ignore - - related_model_to_set_info = helpers.lookup_class_typeinfo(typechecker_api, related_model_to_set) - if related_model_to_set_info is None: - # maybe no type stub - related_model_to_set_type = AnyType(TypeOfAny.unannotated) - else: - related_model_to_set_type = Instance(related_model_to_set_info, []) # type: ignore - - # replace Any with referred_to_type - return reparametrize_related_field_type( - default_related_field_type, set_type=related_model_to_set_type, get_type=related_model_type - ) - - -def get_field_descriptor_types(field_info: TypeInfo, is_nullable: bool) -> Tuple[MypyType, MypyType]: - set_type = helpers.get_private_descriptor_type(field_info, "_pyi_private_set_type", is_nullable=is_nullable) - get_type = helpers.get_private_descriptor_type(field_info, "_pyi_private_get_type", is_nullable=is_nullable) - return set_type, get_type - - -def set_descriptor_types_for_field(ctx: FunctionContext) -> Instance: - default_return_type = cast(Instance, ctx.default_return_type) - - is_nullable = False - null_expr = helpers.get_call_argument_by_name(ctx, "null") - if null_expr is not None: - is_nullable = helpers.parse_bool(null_expr) or False - - set_type, get_type = get_field_descriptor_types(default_return_type.type, is_nullable) - return helpers.reparametrize_instance(default_return_type, [set_type, get_type]) - - -def determine_type_of_array_field(ctx: FunctionContext, django_context: DjangoContext) -> MypyType: - default_return_type = set_descriptor_types_for_field(ctx) - - base_field_arg_type = helpers.get_call_argument_type_by_name(ctx, "base_field") - if not base_field_arg_type or not isinstance(base_field_arg_type, Instance): - return default_return_type - - base_type = base_field_arg_type.args[1] # extract __get__ type - args = [] - for default_arg in default_return_type.args: - args.append(helpers.convert_any_to_type(default_arg, base_type)) - - return helpers.reparametrize_instance(default_return_type, args) - - -def transform_into_proper_return_type(ctx: FunctionContext, django_context: DjangoContext) -> MypyType: - default_return_type = ctx.default_return_type - assert isinstance(default_return_type, Instance) - - outer_model_info = helpers.get_typechecker_api(ctx).scope.active_class() - if outer_model_info is None or not helpers.is_model_subclass_info(outer_model_info, django_context): - return ctx.default_return_type - - assert isinstance(outer_model_info, TypeInfo) - - if helpers.has_any_of_bases(default_return_type.type, fullnames.RELATED_FIELDS_CLASSES): - return fill_descriptor_types_for_related_field(ctx, django_context) - - if default_return_type.type.has_base(fullnames.ARRAY_FIELD_FULLNAME): - return determine_type_of_array_field(ctx, django_context) - - return set_descriptor_types_for_field(ctx) diff --git a/mypy_django_plugin/transformers/forms.py b/mypy_django_plugin/transformers/forms.py deleted file mode 100644 index 34ac97770..000000000 --- a/mypy_django_plugin/transformers/forms.py +++ /dev/null @@ -1,52 +0,0 @@ -from typing import Optional - -from mypy.plugin import ClassDefContext, MethodContext -from mypy.types import CallableType, Instance, NoneTyp -from mypy.types import Type as MypyType -from mypy.types import TypeType - -from mypy_django_plugin.lib import helpers - - -def make_meta_nested_class_inherit_from_any(ctx: ClassDefContext) -> None: - meta_node = helpers.get_nested_meta_node_for_current_class(ctx.cls.info) - if meta_node is None: - if not ctx.api.final_iteration: - ctx.api.defer() - else: - meta_node.fallback_to_any = True - - -def get_specified_form_class(object_type: Instance) -> Optional[TypeType]: - form_class_sym = object_type.type.get("form_class") - if form_class_sym and isinstance(form_class_sym.type, CallableType): - return TypeType(form_class_sym.type.ret_type) - return None - - -def extract_proper_type_for_get_form(ctx: MethodContext) -> MypyType: - object_type = ctx.type - assert isinstance(object_type, Instance) - - form_class_type = helpers.get_call_argument_type_by_name(ctx, "form_class") - if form_class_type is None or isinstance(form_class_type, NoneTyp): - form_class_type = get_specified_form_class(object_type) - - if isinstance(form_class_type, TypeType) and isinstance(form_class_type.item, Instance): - return form_class_type.item - - if isinstance(form_class_type, CallableType) and isinstance(form_class_type.ret_type, Instance): - return form_class_type.ret_type - - return ctx.default_return_type - - -def extract_proper_type_for_get_form_class(ctx: MethodContext) -> MypyType: - object_type = ctx.type - assert isinstance(object_type, Instance) - - form_class_type = get_specified_form_class(object_type) - if form_class_type is None: - return ctx.default_return_type - - return form_class_type diff --git a/mypy_django_plugin/transformers/init_create.py b/mypy_django_plugin/transformers/init_create.py deleted file mode 100644 index 916176601..000000000 --- a/mypy_django_plugin/transformers/init_create.py +++ /dev/null @@ -1,76 +0,0 @@ -from typing import List, Tuple, Type, Union - -from django.db.models.base import Model -from mypy.plugin import FunctionContext, MethodContext -from mypy.types import Instance -from mypy.types import Type as MypyType - -from mypy_django_plugin.django.context import DjangoContext -from mypy_django_plugin.lib import helpers - - -def get_actual_types( - ctx: Union[MethodContext, FunctionContext], expected_keys: List[str] -) -> List[Tuple[str, MypyType]]: - actual_types = [] - # positionals - for pos, (actual_name, actual_type) in enumerate(zip(ctx.arg_names[0], ctx.arg_types[0])): - if actual_name is None: - if ctx.callee_arg_names[0] == "kwargs": - # unpacked dict as kwargs is not supported - continue - actual_name = expected_keys[pos] - actual_types.append((actual_name, actual_type)) - # kwargs - if len(ctx.callee_arg_names) > 1: - for actual_name, actual_type in zip(ctx.arg_names[1], ctx.arg_types[1]): - if actual_name is None: - # unpacked dict as kwargs is not supported - continue - actual_types.append((actual_name, actual_type)) - return actual_types - - -def typecheck_model_method( - ctx: Union[FunctionContext, MethodContext], django_context: DjangoContext, model_cls: Type[Model], method: str -) -> MypyType: - typechecker_api = helpers.get_typechecker_api(ctx) - expected_types = django_context.get_expected_types(typechecker_api, model_cls, method=method) - expected_keys = [key for key in expected_types.keys() if key != "pk"] - - for actual_name, actual_type in get_actual_types(ctx, expected_keys): - if actual_name not in expected_types: - ctx.api.fail(f'Unexpected attribute "{actual_name}" for model "{model_cls.__name__}"', ctx.context) - continue - helpers.check_types_compatible( - ctx, - expected_type=expected_types[actual_name], - actual_type=actual_type, - error_message=f'Incompatible type for "{actual_name}" of "{model_cls.__name__}"', - ) - - return ctx.default_return_type - - -def redefine_and_typecheck_model_init(ctx: FunctionContext, django_context: DjangoContext) -> MypyType: - assert isinstance(ctx.default_return_type, Instance) - - model_fullname = ctx.default_return_type.type.fullname - model_cls = django_context.get_model_class_by_fullname(model_fullname) - if model_cls is None: - return ctx.default_return_type - - return typecheck_model_method(ctx, django_context, model_cls, "__init__") - - -def redefine_and_typecheck_model_create(ctx: MethodContext, django_context: DjangoContext) -> MypyType: - if not isinstance(ctx.default_return_type, Instance): - # only work with ctx.default_return_type = model Instance - return ctx.default_return_type - - model_fullname = ctx.default_return_type.type.fullname - model_cls = django_context.get_model_class_by_fullname(model_fullname) - if model_cls is None: - return ctx.default_return_type - - return typecheck_model_method(ctx, django_context, model_cls, "create") diff --git a/mypy_django_plugin/transformers/managers.py b/mypy_django_plugin/transformers/managers.py deleted file mode 100644 index 4914cea66..000000000 --- a/mypy_django_plugin/transformers/managers.py +++ /dev/null @@ -1,72 +0,0 @@ -from mypy.nodes import GDEF, FuncDef, MemberExpr, NameExpr, RefExpr, StrExpr, SymbolTableNode, TypeInfo -from mypy.plugin import ClassDefContext, DynamicClassDefContext -from mypy.types import AnyType, Instance, TypeOfAny - -from mypy_django_plugin.lib import fullnames, helpers - - -def create_new_manager_class_from_from_queryset_method(ctx: DynamicClassDefContext) -> None: - semanal_api = helpers.get_semanal_api(ctx) - - callee = ctx.call.callee - assert isinstance(callee, MemberExpr) - assert isinstance(callee.expr, RefExpr) - - base_manager_info = callee.expr.node - if base_manager_info is None: - if not semanal_api.final_iteration: - semanal_api.defer() - return - - assert isinstance(base_manager_info, TypeInfo) - new_manager_info = semanal_api.basic_new_typeinfo( - ctx.name, basetype_or_fallback=Instance(base_manager_info, [AnyType(TypeOfAny.unannotated)]) - ) - new_manager_info.line = ctx.call.line - new_manager_info.defn.line = ctx.call.line - new_manager_info.metaclass_type = new_manager_info.calculate_metaclass_type() - - current_module = semanal_api.cur_mod_node - current_module.names[ctx.name] = SymbolTableNode(GDEF, new_manager_info, plugin_generated=True) - passed_queryset = ctx.call.args[0] - assert isinstance(passed_queryset, NameExpr) - - derived_queryset_fullname = passed_queryset.fullname - assert derived_queryset_fullname is not None - - sym = semanal_api.lookup_fully_qualified_or_none(derived_queryset_fullname) - assert sym is not None - if sym.node is None: - if not semanal_api.final_iteration: - semanal_api.defer() - else: - # inherit from Any to prevent false-positives, if queryset class cannot be resolved - new_manager_info.fallback_to_any = True - return - - derived_queryset_info = sym.node - assert isinstance(derived_queryset_info, TypeInfo) - - if len(ctx.call.args) > 1: - expr = ctx.call.args[1] - assert isinstance(expr, StrExpr) - custom_manager_generated_name = expr.value - else: - custom_manager_generated_name = base_manager_info.name + "From" + derived_queryset_info.name - - custom_manager_generated_fullname = ".".join(["django.db.models.manager", custom_manager_generated_name]) - if "from_queryset_managers" not in base_manager_info.metadata: - base_manager_info.metadata["from_queryset_managers"] = {} - base_manager_info.metadata["from_queryset_managers"][custom_manager_generated_fullname] = new_manager_info.fullname - - class_def_context = ClassDefContext(cls=new_manager_info.defn, reason=ctx.call, api=semanal_api) - self_type = Instance(new_manager_info, []) - # we need to copy all methods in MRO before django.db.models.query.QuerySet - for class_mro_info in derived_queryset_info.mro: - if class_mro_info.fullname == fullnames.QUERYSET_CLASS_FULLNAME: - break - for name, sym in class_mro_info.names.items(): - if isinstance(sym.node, FuncDef): - helpers.copy_method_to_another_class( - class_def_context, self_type, new_method_name=name, method_node=sym.node - ) diff --git a/mypy_django_plugin/transformers/meta.py b/mypy_django_plugin/transformers/meta.py deleted file mode 100644 index ea6a4e3bd..000000000 --- a/mypy_django_plugin/transformers/meta.py +++ /dev/null @@ -1,51 +0,0 @@ -from django.core.exceptions import FieldDoesNotExist -from mypy.plugin import MethodContext -from mypy.types import AnyType, Instance -from mypy.types import Type as MypyType -from mypy.types import TypeOfAny - -from mypy_django_plugin.django.context import DjangoContext -from mypy_django_plugin.lib import helpers - - -def _get_field_instance(ctx: MethodContext, field_fullname: str) -> MypyType: - field_info = helpers.lookup_fully_qualified_typeinfo(helpers.get_typechecker_api(ctx), field_fullname) - if field_info is None: - return AnyType(TypeOfAny.unannotated) - return Instance(field_info, [AnyType(TypeOfAny.explicit), AnyType(TypeOfAny.explicit)]) - - -def return_proper_field_type_from_get_field(ctx: MethodContext, django_context: DjangoContext) -> MypyType: - # Options instance - assert isinstance(ctx.type, Instance) - - # bail if list of generic params is empty - if len(ctx.type.args) == 0: - return ctx.default_return_type - - model_type = ctx.type.args[0] - if not isinstance(model_type, Instance): - return ctx.default_return_type - - model_cls = django_context.get_model_class_by_fullname(model_type.type.fullname) - if model_cls is None: - return ctx.default_return_type - - field_name_expr = helpers.get_call_argument_by_name(ctx, "field_name") - if field_name_expr is None: - return ctx.default_return_type - - field_name = helpers.resolve_string_attribute_value(field_name_expr, django_context) - if field_name is None: - return ctx.default_return_type - - try: - field = model_cls._meta.get_field(field_name) - except FieldDoesNotExist as exc: - # if model is abstract, do not raise exception, skip false positives - if not model_cls._meta.abstract: - ctx.api.fail(exc.args[0], ctx.context) - return AnyType(TypeOfAny.from_error) - - field_fullname = helpers.get_class_fullname(field.__class__) - return _get_field_instance(ctx, field_fullname) diff --git a/mypy_django_plugin/transformers/models.py b/mypy_django_plugin/transformers/models.py deleted file mode 100644 index 4c1b49219..000000000 --- a/mypy_django_plugin/transformers/models.py +++ /dev/null @@ -1,357 +0,0 @@ -from typing import Dict, List, Optional, Type, cast - -from django.db.models.base import Model -from django.db.models.fields import DateField, DateTimeField -from django.db.models.fields.related import ForeignKey -from django.db.models.fields.reverse_related import ManyToManyRel, ManyToOneRel, OneToOneRel -from mypy.nodes import ARG_STAR2, Argument, Context, FuncDef, TypeInfo, Var -from mypy.plugin import ClassDefContext -from mypy.plugins import common -from mypy.semanal import SemanticAnalyzer -from mypy.types import AnyType, Instance -from mypy.types import Type as MypyType -from mypy.types import TypeOfAny - -from mypy_django_plugin.django.context import DjangoContext -from mypy_django_plugin.lib import fullnames, helpers -from mypy_django_plugin.transformers import fields -from mypy_django_plugin.transformers.fields import get_field_descriptor_types - - -class ModelClassInitializer: - api: SemanticAnalyzer - - def __init__(self, ctx: ClassDefContext, django_context: DjangoContext): - self.api = cast(SemanticAnalyzer, ctx.api) - self.model_classdef = ctx.cls - self.django_context = django_context - self.ctx = ctx - - def lookup_typeinfo(self, fullname: str) -> Optional[TypeInfo]: - return helpers.lookup_fully_qualified_typeinfo(self.api, fullname) - - def lookup_typeinfo_or_incomplete_defn_error(self, fullname: str) -> TypeInfo: - info = self.lookup_typeinfo(fullname) - if info is None: - raise helpers.IncompleteDefnException(f"No {fullname!r} found") - return info - - def lookup_class_typeinfo_or_incomplete_defn_error(self, klass: type) -> TypeInfo: - fullname = helpers.get_class_fullname(klass) - field_info = self.lookup_typeinfo_or_incomplete_defn_error(fullname) - return field_info - - def create_new_var(self, name: str, typ: MypyType) -> Var: - # type=: type of the variable itself - var = Var(name=name, type=typ) - # var.info: type of the object variable is bound to - var.info = self.model_classdef.info - var._fullname = self.model_classdef.info.fullname + "." + name - var.is_initialized_in_class = True - var.is_inferred = True - return var - - def add_new_node_to_model_class(self, name: str, typ: MypyType) -> None: - helpers.add_new_sym_for_info(self.model_classdef.info, name=name, sym_type=typ) - - def add_new_class_for_current_module(self, name: str, bases: List[Instance]) -> TypeInfo: - current_module = self.api.modules[self.model_classdef.info.module_name] - new_class_info = helpers.add_new_class_for_module(current_module, name=name, bases=bases) - return new_class_info - - def run(self) -> None: - model_cls = self.django_context.get_model_class_by_fullname(self.model_classdef.fullname) - if model_cls is None: - return - self.run_with_model_cls(model_cls) - - def run_with_model_cls(self, model_cls): - pass - - -class InjectAnyAsBaseForNestedMeta(ModelClassInitializer): - """ - Replaces - class MyModel(models.Model): - class Meta: - pass - with - class MyModel(models.Model): - class Meta(Any): - pass - to get around incompatible Meta inner classes for different models. - """ - - def run(self) -> None: - meta_node = helpers.get_nested_meta_node_for_current_class(self.model_classdef.info) - if meta_node is None: - return None - meta_node.fallback_to_any = True - - -class AddDefaultPrimaryKey(ModelClassInitializer): - def run_with_model_cls(self, model_cls: Type[Model]) -> None: - auto_field = model_cls._meta.auto_field - if auto_field and not self.model_classdef.info.has_readable_member(auto_field.attname): - # autogenerated field - auto_field_fullname = helpers.get_class_fullname(auto_field.__class__) - auto_field_info = self.lookup_typeinfo_or_incomplete_defn_error(auto_field_fullname) - - set_type, get_type = fields.get_field_descriptor_types(auto_field_info, is_nullable=False) - self.add_new_node_to_model_class(auto_field.attname, Instance(auto_field_info, [set_type, get_type])) - - -class AddRelatedModelsId(ModelClassInitializer): - def run_with_model_cls(self, model_cls: Type[Model]) -> None: - for field in model_cls._meta.get_fields(): - if isinstance(field, ForeignKey): - related_model_cls = self.django_context.get_field_related_model_cls(field) - if related_model_cls is None: - error_context: Context = self.ctx.cls - field_sym = self.ctx.cls.info.get(field.name) - if field_sym is not None and field_sym.node is not None: - error_context = field_sym.node - self.api.fail( - f"Cannot find model {field.related_model!r} " f"referenced in field {field.name!r} ", - ctx=error_context, - ) - self.add_new_node_to_model_class(field.attname, AnyType(TypeOfAny.explicit)) - continue - - if related_model_cls._meta.abstract: - continue - - rel_primary_key_field = self.django_context.get_primary_key_field(related_model_cls) - try: - field_info = self.lookup_class_typeinfo_or_incomplete_defn_error(rel_primary_key_field.__class__) - except helpers.IncompleteDefnException as exc: - if not self.api.final_iteration: - raise exc - else: - continue - - is_nullable = self.django_context.get_field_nullability(field, None) - set_type, get_type = get_field_descriptor_types(field_info, is_nullable) - self.add_new_node_to_model_class(field.attname, Instance(field_info, [set_type, get_type])) - - -class AddManagers(ModelClassInitializer): - def has_any_parametrized_manager_as_base(self, info: TypeInfo) -> bool: - for base in helpers.iter_bases(info): - if self.is_any_parametrized_manager(base): - return True - return False - - def is_any_parametrized_manager(self, typ: Instance) -> bool: - return typ.type.fullname in fullnames.MANAGER_CLASSES and isinstance(typ.args[0], AnyType) - - def get_generated_manager_mappings(self, base_manager_fullname: str) -> Dict[str, str]: - base_manager_info = self.lookup_typeinfo(base_manager_fullname) - if base_manager_info is None or "from_queryset_managers" not in base_manager_info.metadata: - return {} - return base_manager_info.metadata["from_queryset_managers"] - - def create_new_model_parametrized_manager(self, name: str, base_manager_info: TypeInfo) -> Instance: - bases = [] - for original_base in base_manager_info.bases: - if self.is_any_parametrized_manager(original_base): - if original_base.type is None: - raise helpers.IncompleteDefnException() - - original_base = helpers.reparametrize_instance(original_base, [Instance(self.model_classdef.info, [])]) - bases.append(original_base) - - new_manager_info = self.add_new_class_for_current_module(name, bases) - # copy fields to a new manager - new_cls_def_context = ClassDefContext(cls=new_manager_info.defn, reason=self.ctx.reason, api=self.api) - custom_manager_type = Instance(new_manager_info, [Instance(self.model_classdef.info, [])]) - - for name, sym in base_manager_info.names.items(): - # replace self type with new class, if copying method - if isinstance(sym.node, FuncDef): - helpers.copy_method_to_another_class( - new_cls_def_context, self_type=custom_manager_type, new_method_name=name, method_node=sym.node - ) - continue - - new_sym = sym.copy() - if isinstance(new_sym.node, Var): - new_var = Var(name, type=sym.type) - new_var.info = new_manager_info - new_var._fullname = new_manager_info.fullname + "." + name - new_sym.node = new_var - new_manager_info.names[name] = new_sym - - return custom_manager_type - - def run_with_model_cls(self, model_cls: Type[Model]) -> None: - for manager_name, manager in model_cls._meta.managers_map.items(): - manager_class_name = manager.__class__.__name__ - manager_fullname = helpers.get_class_fullname(manager.__class__) - try: - manager_info = self.lookup_typeinfo_or_incomplete_defn_error(manager_fullname) - except helpers.IncompleteDefnException as exc: - if not self.api.final_iteration: - raise exc - else: - base_manager_fullname = helpers.get_class_fullname(manager.__class__.__bases__[0]) - generated_managers = self.get_generated_manager_mappings(base_manager_fullname) - if manager_fullname not in generated_managers: - # not a generated manager, continue with the loop - continue - real_manager_fullname = generated_managers[manager_fullname] - manager_info = self.lookup_typeinfo(real_manager_fullname) # type: ignore - if manager_info is None: - continue - manager_class_name = real_manager_fullname.rsplit(".", maxsplit=1)[1] - - if manager_name not in self.model_classdef.info.names: - manager_type = Instance(manager_info, [Instance(self.model_classdef.info, [])]) - self.add_new_node_to_model_class(manager_name, manager_type) - else: - # creates new MODELNAME_MANAGERCLASSNAME class that represents manager parametrized with current model - if not self.has_any_parametrized_manager_as_base(manager_info): - continue - - custom_model_manager_name = manager.model.__name__ + "_" + manager_class_name - try: - custom_manager_type = self.create_new_model_parametrized_manager( - custom_model_manager_name, base_manager_info=manager_info - ) - except helpers.IncompleteDefnException: - continue - - self.add_new_node_to_model_class(manager_name, custom_manager_type) - - -class AddDefaultManagerAttribute(ModelClassInitializer): - def run_with_model_cls(self, model_cls: Type[Model]) -> None: - # add _default_manager - if "_default_manager" not in self.model_classdef.info.names: - default_manager_fullname = helpers.get_class_fullname(model_cls._meta.default_manager.__class__) - default_manager_info = self.lookup_typeinfo_or_incomplete_defn_error(default_manager_fullname) - default_manager = Instance(default_manager_info, [Instance(self.model_classdef.info, [])]) - self.add_new_node_to_model_class("_default_manager", default_manager) - - -class AddRelatedManagers(ModelClassInitializer): - def run_with_model_cls(self, model_cls: Type[Model]) -> None: - # add related managers - for relation in self.django_context.get_model_relations(model_cls): - attname = relation.get_accessor_name() - if attname is None: - # no reverse accessor - continue - - related_model_cls = self.django_context.get_field_related_model_cls(relation) - if related_model_cls is None: - continue - - try: - related_model_info = self.lookup_class_typeinfo_or_incomplete_defn_error(related_model_cls) - except helpers.IncompleteDefnException as exc: - if not self.api.final_iteration: - raise exc - else: - continue - - if isinstance(relation, OneToOneRel): - self.add_new_node_to_model_class(attname, Instance(related_model_info, [])) - continue - - if isinstance(relation, (ManyToOneRel, ManyToManyRel)): - try: - related_manager_info = self.lookup_typeinfo_or_incomplete_defn_error( - fullnames.RELATED_MANAGER_CLASS - ) # noqa: E501 - if "objects" not in related_model_info.names: - raise helpers.IncompleteDefnException() - except helpers.IncompleteDefnException as exc: - if not self.api.final_iteration: - raise exc - else: - continue - - # create new RelatedManager subclass - parametrized_related_manager_type = Instance(related_manager_info, [Instance(related_model_info, [])]) - default_manager_type = related_model_info.names["objects"].type - if ( - default_manager_type is None - or not isinstance(default_manager_type, Instance) - or default_manager_type.type.fullname == fullnames.MANAGER_CLASS_FULLNAME - ): - self.add_new_node_to_model_class(attname, parametrized_related_manager_type) - continue - - name = related_model_cls.__name__ + "_" + "RelatedManager" - bases = [parametrized_related_manager_type, default_manager_type] - new_related_manager_info = self.add_new_class_for_current_module(name, bases) - - self.add_new_node_to_model_class(attname, Instance(new_related_manager_info, [])) - - -class AddExtraFieldMethods(ModelClassInitializer): - def run_with_model_cls(self, model_cls: Type[Model]) -> None: - # get_FOO_display for choices - for field in self.django_context.get_model_fields(model_cls): - if field.choices: - info = self.lookup_typeinfo_or_incomplete_defn_error("builtins.str") - return_type = Instance(info, []) - common.add_method(self.ctx, name=f"get_{field.attname}_display", args=[], return_type=return_type) - - # get_next_by, get_previous_by for Date, DateTime - for field in self.django_context.get_model_fields(model_cls): - if isinstance(field, (DateField, DateTimeField)) and not field.null: - return_type = Instance(self.model_classdef.info, []) - common.add_method( - self.ctx, - name=f"get_next_by_{field.attname}", - args=[ - Argument( - Var("kwargs", AnyType(TypeOfAny.explicit)), - AnyType(TypeOfAny.explicit), - initializer=None, - kind=ARG_STAR2, - ) - ], - return_type=return_type, - ) - common.add_method( - self.ctx, - name=f"get_previous_by_{field.attname}", - args=[ - Argument( - Var("kwargs", AnyType(TypeOfAny.explicit)), - AnyType(TypeOfAny.explicit), - initializer=None, - kind=ARG_STAR2, - ) - ], - return_type=return_type, - ) - - -class AddMetaOptionsAttribute(ModelClassInitializer): - def run_with_model_cls(self, model_cls: Type[Model]) -> None: - if "_meta" not in self.model_classdef.info.names: - options_info = self.lookup_typeinfo_or_incomplete_defn_error(fullnames.OPTIONS_CLASS_FULLNAME) - self.add_new_node_to_model_class("_meta", Instance(options_info, [Instance(self.model_classdef.info, [])])) - - -def process_model_class(ctx: ClassDefContext, django_context: DjangoContext) -> None: - initializers = [ - InjectAnyAsBaseForNestedMeta, - AddDefaultPrimaryKey, - AddRelatedModelsId, - AddManagers, - AddDefaultManagerAttribute, - AddRelatedManagers, - AddExtraFieldMethods, - AddMetaOptionsAttribute, - ] - for initializer_cls in initializers: - try: - initializer_cls(ctx, django_context).run() - except helpers.IncompleteDefnException: - if not ctx.api.final_iteration: - ctx.api.defer() diff --git a/mypy_django_plugin/transformers/orm_lookups.py b/mypy_django_plugin/transformers/orm_lookups.py deleted file mode 100644 index 91c55c99a..000000000 --- a/mypy_django_plugin/transformers/orm_lookups.py +++ /dev/null @@ -1,54 +0,0 @@ -from mypy.plugin import MethodContext -from mypy.types import AnyType, Instance -from mypy.types import Type as MypyType -from mypy.types import TypeOfAny - -from mypy_django_plugin.django.context import DjangoContext -from mypy_django_plugin.lib import fullnames, helpers - - -def typecheck_queryset_filter(ctx: MethodContext, django_context: DjangoContext) -> MypyType: - lookup_kwargs = ctx.arg_names[1] - provided_lookup_types = ctx.arg_types[1] - - assert isinstance(ctx.type, Instance) - - if not ctx.type.args or not isinstance(ctx.type.args[0], Instance): - return ctx.default_return_type - - model_cls_fullname = ctx.type.args[0].type.fullname - model_cls = django_context.get_model_class_by_fullname(model_cls_fullname) - if model_cls is None: - return ctx.default_return_type - - for lookup_kwarg, provided_type in zip(lookup_kwargs, provided_lookup_types): - if lookup_kwarg is None: - continue - if isinstance(provided_type, Instance) and provided_type.type.has_base( - "django.db.models.expressions.Combinable" - ): - provided_type = resolve_combinable_type(provided_type, django_context) - - lookup_type = django_context.resolve_lookup_expected_type(ctx, model_cls, lookup_kwarg) - # Managers as provided_type is not supported yet - if isinstance(provided_type, Instance) and helpers.has_any_of_bases( - provided_type.type, (fullnames.MANAGER_CLASS_FULLNAME, fullnames.QUERYSET_CLASS_FULLNAME) - ): - return ctx.default_return_type - - helpers.check_types_compatible( - ctx, - expected_type=lookup_type, - actual_type=provided_type, - error_message=f"Incompatible type for lookup {lookup_kwarg!r}:", - ) - - return ctx.default_return_type - - -def resolve_combinable_type(combinable_type: Instance, django_context: DjangoContext) -> MypyType: - if combinable_type.type.fullname != fullnames.F_EXPRESSION_FULLNAME: - # Combinables aside from F expressions are unsupported - return AnyType(TypeOfAny.explicit) - - return django_context.resolve_f_expression_type(combinable_type) diff --git a/mypy_django_plugin/transformers/querysets.py b/mypy_django_plugin/transformers/querysets.py deleted file mode 100644 index 69a6e30d0..000000000 --- a/mypy_django_plugin/transformers/querysets.py +++ /dev/null @@ -1,194 +0,0 @@ -from collections import OrderedDict -from typing import List, Optional, Sequence, Type - -from django.core.exceptions import FieldError -from django.db.models.base import Model -from django.db.models.fields.related import RelatedField -from django.db.models.fields.reverse_related import ForeignObjectRel -from mypy.nodes import Expression, NameExpr -from mypy.plugin import FunctionContext, MethodContext -from mypy.types import AnyType, Instance -from mypy.types import Type as MypyType -from mypy.types import TypeOfAny - -from mypy_django_plugin.django.context import DjangoContext, LookupsAreUnsupported -from mypy_django_plugin.lib import fullnames, helpers - - -def _extract_model_type_from_queryset(queryset_type: Instance) -> Optional[Instance]: - for base_type in [queryset_type, *queryset_type.type.bases]: - if ( - len(base_type.args) - and isinstance(base_type.args[0], Instance) - and base_type.args[0].type.has_base(fullnames.MODEL_CLASS_FULLNAME) - ): - return base_type.args[0] - return None - - -def determine_proper_manager_type(ctx: FunctionContext) -> MypyType: - default_return_type = ctx.default_return_type - assert isinstance(default_return_type, Instance) - - outer_model_info = helpers.get_typechecker_api(ctx).scope.active_class() - if outer_model_info is None or not outer_model_info.has_base(fullnames.MODEL_CLASS_FULLNAME): - return default_return_type - - return helpers.reparametrize_instance(default_return_type, [Instance(outer_model_info, [])]) - - -def get_field_type_from_lookup( - ctx: MethodContext, django_context: DjangoContext, model_cls: Type[Model], *, method: str, lookup: str -) -> Optional[MypyType]: - try: - lookup_field = django_context.resolve_lookup_into_field(model_cls, lookup) - except FieldError as exc: - ctx.api.fail(exc.args[0], ctx.context) - return None - except LookupsAreUnsupported: - return AnyType(TypeOfAny.explicit) - - if (isinstance(lookup_field, RelatedField) and lookup_field.column == lookup) or isinstance( - lookup_field, ForeignObjectRel - ): - related_model_cls = django_context.get_field_related_model_cls(lookup_field) - if related_model_cls is None: - return AnyType(TypeOfAny.from_error) - lookup_field = django_context.get_primary_key_field(related_model_cls) - - field_get_type = django_context.get_field_get_type(helpers.get_typechecker_api(ctx), lookup_field, method=method) - return field_get_type - - -def get_values_list_row_type( - ctx: MethodContext, django_context: DjangoContext, model_cls: Type[Model], flat: bool, named: bool -) -> MypyType: - field_lookups = resolve_field_lookups(ctx.args[0], django_context) - if field_lookups is None: - return AnyType(TypeOfAny.from_error) - - typechecker_api = helpers.get_typechecker_api(ctx) - if len(field_lookups) == 0: - if flat: - primary_key_field = django_context.get_primary_key_field(model_cls) - lookup_type = get_field_type_from_lookup( - ctx, django_context, model_cls, lookup=primary_key_field.attname, method="values_list" - ) - assert lookup_type is not None - return lookup_type - elif named: - column_types: "OrderedDict[str, MypyType]" = OrderedDict() - for field in django_context.get_model_fields(model_cls): - column_type = django_context.get_field_get_type(typechecker_api, field, method="values_list") - column_types[field.attname] = column_type - return helpers.make_oneoff_named_tuple(typechecker_api, "Row", column_types) - else: - # flat=False, named=False, all fields - field_lookups = [] - for field in django_context.get_model_fields(model_cls): - field_lookups.append(field.attname) - - if len(field_lookups) > 1 and flat: - typechecker_api.fail("'flat' is not valid when 'values_list' is called with more than one field", ctx.context) - return AnyType(TypeOfAny.from_error) - - column_types = OrderedDict() - for field_lookup in field_lookups: - lookup_field_type = get_field_type_from_lookup( - ctx, django_context, model_cls, lookup=field_lookup, method="values_list" - ) - if lookup_field_type is None: - return AnyType(TypeOfAny.from_error) - column_types[field_lookup] = lookup_field_type - - if flat: - assert len(column_types) == 1 - row_type = next(iter(column_types.values())) - elif named: - row_type = helpers.make_oneoff_named_tuple(typechecker_api, "Row", column_types) - else: - row_type = helpers.make_tuple(typechecker_api, list(column_types.values())) - - return row_type - - -def extract_proper_type_queryset_values_list(ctx: MethodContext, django_context: DjangoContext) -> MypyType: - # called on the Instance, returns QuerySet of something - assert isinstance(ctx.type, Instance) - assert isinstance(ctx.default_return_type, Instance) - - model_type = _extract_model_type_from_queryset(ctx.type) - if model_type is None: - return AnyType(TypeOfAny.from_omitted_generics) - - model_cls = django_context.get_model_class_by_fullname(model_type.type.fullname) - if model_cls is None: - return ctx.default_return_type - - flat_expr = helpers.get_call_argument_by_name(ctx, "flat") - if flat_expr is not None and isinstance(flat_expr, NameExpr): - flat = helpers.parse_bool(flat_expr) - else: - flat = False - - named_expr = helpers.get_call_argument_by_name(ctx, "named") - if named_expr is not None and isinstance(named_expr, NameExpr): - named = helpers.parse_bool(named_expr) - else: - named = False - - if flat and named: - ctx.api.fail("'flat' and 'named' can't be used together", ctx.context) - return helpers.reparametrize_instance(ctx.default_return_type, [model_type, AnyType(TypeOfAny.from_error)]) - - # account for possible None - flat = flat or False - named = named or False - - row_type = get_values_list_row_type(ctx, django_context, model_cls, flat=flat, named=named) - return helpers.reparametrize_instance(ctx.default_return_type, [model_type, row_type]) - - -def resolve_field_lookups(lookup_exprs: Sequence[Expression], django_context: DjangoContext) -> Optional[List[str]]: - field_lookups = [] - for field_lookup_expr in lookup_exprs: - field_lookup = helpers.resolve_string_attribute_value(field_lookup_expr, django_context) - if field_lookup is None: - return None - field_lookups.append(field_lookup) - return field_lookups - - -def extract_proper_type_queryset_values(ctx: MethodContext, django_context: DjangoContext) -> MypyType: - # called on QuerySet, return QuerySet of something - assert isinstance(ctx.type, Instance) - assert isinstance(ctx.default_return_type, Instance) - - model_type = _extract_model_type_from_queryset(ctx.type) - if model_type is None: - return AnyType(TypeOfAny.from_omitted_generics) - - model_cls = django_context.get_model_class_by_fullname(model_type.type.fullname) - if model_cls is None: - return ctx.default_return_type - - field_lookups = resolve_field_lookups(ctx.args[0], django_context) - if field_lookups is None: - return AnyType(TypeOfAny.from_error) - - if len(field_lookups) == 0: - for field in django_context.get_model_fields(model_cls): - field_lookups.append(field.attname) - - column_types: "OrderedDict[str, MypyType]" = OrderedDict() - for field_lookup in field_lookups: - field_lookup_type = get_field_type_from_lookup( - ctx, django_context, model_cls, lookup=field_lookup, method="values" - ) - if field_lookup_type is None: - return helpers.reparametrize_instance(ctx.default_return_type, [model_type, AnyType(TypeOfAny.from_error)]) - - column_types[field_lookup] = field_lookup_type - - row_type = helpers.make_typeddict(ctx.api, column_types, set(column_types.keys())) - return helpers.reparametrize_instance(ctx.default_return_type, [model_type, row_type]) diff --git a/mypy_django_plugin/transformers/request.py b/mypy_django_plugin/transformers/request.py deleted file mode 100644 index 41327968f..000000000 --- a/mypy_django_plugin/transformers/request.py +++ /dev/null @@ -1,37 +0,0 @@ -from mypy.plugin import AttributeContext -from mypy.types import Instance -from mypy.types import Type as MypyType -from mypy.types import UnionType - -from mypy_django_plugin.django.context import DjangoContext -from mypy_django_plugin.lib import helpers - - -def set_auth_user_model_as_type_for_request_user(ctx: AttributeContext, django_context: DjangoContext) -> MypyType: - if not django_context.apps_registry.is_installed("django.contrib.auth"): - return ctx.default_attr_type - - # Imported here because django isn't properly loaded yet when module is loaded - from django.contrib.auth.base_user import AbstractBaseUser - from django.contrib.auth.models import AnonymousUser - - abstract_base_user_info = helpers.lookup_class_typeinfo(helpers.get_typechecker_api(ctx), AbstractBaseUser) - anonymous_user_info = helpers.lookup_class_typeinfo(helpers.get_typechecker_api(ctx), AnonymousUser) - - # This shouldn't be able to happen, as we managed to import the models above. - assert abstract_base_user_info is not None - assert anonymous_user_info is not None - - if ctx.default_attr_type != UnionType([Instance(abstract_base_user_info, []), Instance(anonymous_user_info, [])]): - # Type has been changed from the default in django-stubs. - # I.e. HttpRequest has been subclassed and user-type overridden, so let's leave it as is. - return ctx.default_attr_type - - auth_user_model = django_context.settings.AUTH_USER_MODEL - user_cls = django_context.apps_registry.get_model(auth_user_model) - user_info = helpers.lookup_class_typeinfo(helpers.get_typechecker_api(ctx), user_cls) - - if user_info is None: - return ctx.default_attr_type - - return UnionType([Instance(user_info, []), Instance(anonymous_user_info, [])]) diff --git a/mypy_django_plugin/transformers/settings.py b/mypy_django_plugin/transformers/settings.py deleted file mode 100644 index 463a08fe7..000000000 --- a/mypy_django_plugin/transformers/settings.py +++ /dev/null @@ -1,49 +0,0 @@ -from mypy.nodes import MemberExpr -from mypy.plugin import AttributeContext, FunctionContext -from mypy.types import AnyType, Instance -from mypy.types import Type as MypyType -from mypy.types import TypeOfAny, TypeType - -from mypy_django_plugin.django.context import DjangoContext -from mypy_django_plugin.lib import helpers - - -def get_user_model_hook(ctx: FunctionContext, django_context: DjangoContext) -> MypyType: - auth_user_model = django_context.settings.AUTH_USER_MODEL - model_cls = django_context.apps_registry.get_model(auth_user_model) - model_cls_fullname = helpers.get_class_fullname(model_cls) - - model_info = helpers.lookup_fully_qualified_typeinfo(helpers.get_typechecker_api(ctx), model_cls_fullname) - if model_info is None: - return AnyType(TypeOfAny.unannotated) - - return TypeType(Instance(model_info, [])) - - -def get_type_of_settings_attribute(ctx: AttributeContext, django_context: DjangoContext) -> MypyType: - assert isinstance(ctx.context, MemberExpr) - setting_name = ctx.context.name - if not hasattr(django_context.settings, setting_name): - ctx.api.fail(f"'Settings' object has no attribute {setting_name!r}", ctx.context) - return ctx.default_attr_type - - typechecker_api = helpers.get_typechecker_api(ctx) - - # first look for the setting in the project settings file, then global settings - settings_module = typechecker_api.modules.get(django_context.django_settings_module) - global_settings_module = typechecker_api.modules.get("django.conf.global_settings") - for module in [settings_module, global_settings_module]: - if module is not None: - sym = module.names.get(setting_name) - if sym is not None and sym.type is not None: - return sym.type - - # if by any reason it isn't present there, get type from django settings - value = getattr(django_context.settings, setting_name) - value_fullname = helpers.get_class_fullname(value.__class__) - - value_info = helpers.lookup_fully_qualified_typeinfo(typechecker_api, value_fullname) - if value_info is None: - return ctx.default_attr_type - - return Instance(value_info, []) diff --git a/pytest.ini b/pytest.ini index b8743652e..3dd3f065f 100644 --- a/pytest.ini +++ b/pytest.ini @@ -1,11 +1,8 @@ [pytest] testpaths = ./tests - ./django_stubs_ext/tests addopts = --tb=native -s -v --cache-clear - --mypy-ini-file=./tests/plugins.ini - --mypy-extension-hook=scripts.tests_extension_hook.django_plugin_hook diff --git a/tests/plugins.ini b/tests/plugins.ini deleted file mode 100644 index b7b510bb6..000000000 --- a/tests/plugins.ini +++ /dev/null @@ -1,5 +0,0 @@ -[mypy] -incremental = True -strict_optional = True -plugins = - mypy_django_plugin.main From 64a5b3b118fe07d9b3eba16af4c18ecbd5bb8f1e Mon Sep 17 00:00:00 2001 From: Steve Dignam Date: Wed, 25 Nov 2020 15:28:11 -0500 Subject: [PATCH 02/88] ref: fields to not use plugin and handle nullability for some fields Previously the types required a mypy plugin to handle the generics, now we're using the builtin typing functionality. Probably more verbose, but it should work with type checkers besides mypy. Also remove `objects: BaseManager[Any]` from the base `Model` so subclasses will be required to explicitly declare it. Avoids uses having `.filter().first()` returning `Optional[Any]` instead of `Optional[T]`. --- .gitignore | 1 + django-stubs/db/models/__init__.pyi | 2 + django-stubs/db/models/base.pyi | 4 +- django-stubs/db/models/fields/__init__.pyi | 242 ++++++++++++++------- django-stubs/db/models/fields/related.pyi | 57 ++++- 5 files changed, 218 insertions(+), 88 deletions(-) diff --git a/.gitignore b/.gitignore index cf90aa3c1..510e31bcb 100644 --- a/.gitignore +++ b/.gitignore @@ -10,3 +10,4 @@ out/ pip-wheel-metadata/ stubgen/ build/ +dist/ diff --git a/django-stubs/db/models/__init__.pyi b/django-stubs/db/models/__init__.pyi index 1e1012645..e1e0f2baa 100644 --- a/django-stubs/db/models/__init__.pyi +++ b/django-stubs/db/models/__init__.pyi @@ -1,5 +1,7 @@ from .base import Model as Model +from django.db.models import functions as functions + from .aggregates import ( Aggregate as Aggregate, Avg as Avg, diff --git a/django-stubs/db/models/base.pyi b/django-stubs/db/models/base.pyi index eeaa27246..a8ffa0705 100644 --- a/django-stubs/db/models/base.pyi +++ b/django-stubs/db/models/base.pyi @@ -26,7 +26,9 @@ class Model(metaclass=ModelBase): class Meta: ... _meta: Options[Any] _default_manager: BaseManager[Model] - objects: BaseManager[Any] + # NOTE(sbdchd): we don't include the objects property since we want + # to force subclasses to specify the property with an explicit type. + # objects: BaseManager[Any] pk: Any = ... _state: ModelState def __init__(self: _Self, *args, **kwargs) -> None: ... diff --git a/django-stubs/db/models/fields/__init__.pyi b/django-stubs/db/models/fields/__init__.pyi index fff986921..c928a3bae 100644 --- a/django-stubs/db/models/fields/__init__.pyi +++ b/django-stubs/db/models/fields/__init__.pyi @@ -24,6 +24,7 @@ from django.core.exceptions import FieldDoesNotExist as FieldDoesNotExist from django.db.models.expressions import Combinable, Col from django.db.models.query_utils import RegisterLookupMixin from django.forms import Field as FormField, Widget +from typing_extensions import Literal class NOT_PROVIDED: ... @@ -43,9 +44,6 @@ _ST = TypeVar("_ST") _GT = TypeVar("_GT") class Field(RegisterLookupMixin, Generic[_ST, _GT]): - _pyi_private_set_type: Any - _pyi_private_get_type: Any - _pyi_lookup_exact_type: Any widget: Widget help_text: str @@ -143,28 +141,18 @@ class Field(RegisterLookupMixin, Generic[_ST, _GT]): def value_from_object(self, obj: Model) -> _GT: ... def get_attname(self) -> str: ... -class IntegerField(Field[_ST, _GT]): - _pyi_private_set_type: Union[float, int, str, Combinable] - _pyi_private_get_type: int - _pyi_lookup_exact_type: Union[str, int] +class IntegerField(Field[Union[float, int, str, Combinable], int]): ... class PositiveIntegerRelDbTypeMixin: def rel_db_type(self, connection: Any): ... -class PositiveIntegerField(PositiveIntegerRelDbTypeMixin, IntegerField[_ST, _GT]): ... -class PositiveSmallIntegerField(PositiveIntegerRelDbTypeMixin, IntegerField[_ST, _GT]): ... -class SmallIntegerField(IntegerField[_ST, _GT]): ... -class BigIntegerField(IntegerField[_ST, _GT]): ... +class PositiveIntegerField(PositiveIntegerRelDbTypeMixin, IntegerField): ... +class PositiveSmallIntegerField(PositiveIntegerRelDbTypeMixin, IntegerField): ... +class SmallIntegerField(IntegerField): ... +class BigIntegerField(IntegerField): ... +class FloatField(Field[Union[float, int, str, Combinable], float]): ... -class FloatField(Field[_ST, _GT]): - _pyi_private_set_type: Union[float, int, str, Combinable] - _pyi_private_get_type: float - _pyi_lookup_exact_type: float - -class DecimalField(Field[_ST, _GT]): - _pyi_private_set_type: Union[str, float, decimal.Decimal, Combinable] - _pyi_private_get_type: decimal.Decimal - _pyi_lookup_exact_type: Union[str, decimal.Decimal] +class DecimalField(Field[Union[str, float, decimal.Decimal, Combinable], decimal.Decimal]): # attributes max_digits: int = ... decimal_places: int = ... @@ -191,25 +179,21 @@ class DecimalField(Field[_ST, _GT]): error_messages: Optional[_ErrorMessagesToOverride] = ..., ): ... -class AutoField(Field[_ST, _GT]): - _pyi_private_set_type: Union[Combinable, int, str] - _pyi_private_get_type: int - _pyi_lookup_exact_type: Union[str, int] +class AutoField(Field[Union[Combinable, int, str], int]): ... + +_C = TypeVar("_C", bound=Optional[str]) -class CharField(Field[_ST, _GT]): - _pyi_private_set_type: Union[str, int, Combinable] - _pyi_private_get_type: str - # objects are converted to string before comparison - _pyi_lookup_exact_type: Any +class CharField(Generic[_C], Field[str, str]): + @overload def __init__( - self, + self: CharField[str], verbose_name: Optional[Union[str, bytes]] = ..., name: Optional[str] = ..., primary_key: bool = ..., max_length: Optional[int] = ..., unique: bool = ..., blank: bool = ..., - null: bool = ..., + null: Literal[False] = ..., db_index: bool = ..., default: Any = ..., editable: bool = ..., @@ -224,9 +208,36 @@ class CharField(Field[_ST, _GT]): db_tablespace: Optional[str] = ..., validators: Iterable[_ValidatorCallable] = ..., error_messages: Optional[_ErrorMessagesToOverride] = ..., - ): ... + ) -> None: ... + @overload + def __init__( + self: CharField[Optional[str]], + verbose_name: Optional[Union[str, bytes]] = ..., + name: Optional[str] = ..., + primary_key: bool = ..., + max_length: Optional[int] = ..., + unique: bool = ..., + blank: bool = ..., + null: Literal[True] = ..., + db_index: bool = ..., + default: Any = ..., + editable: bool = ..., + auto_created: bool = ..., + serialize: bool = ..., + unique_for_date: Optional[str] = ..., + unique_for_month: Optional[str] = ..., + unique_for_year: Optional[str] = ..., + choices: Optional[_FieldChoices] = ..., + help_text: str = ..., + db_column: Optional[str] = ..., + db_tablespace: Optional[str] = ..., + validators: Iterable[_ValidatorCallable] = ..., + error_messages: Optional[_ErrorMessagesToOverride] = ..., + ) -> None: ... + def __get__(self: CharField[_C], instance: Any, owner: Any) -> _C: ... + def __set__(self, instance: Any, value: _C) -> None: ... -class SlugField(CharField[_ST, _GT]): +class SlugField(CharField): def __init__( self, verbose_name: Optional[Union[str, bytes]] = ..., @@ -253,32 +264,68 @@ class SlugField(CharField[_ST, _GT]): error_messages: Optional[_ErrorMessagesToOverride] = ..., ): ... -class EmailField(CharField[_ST, _GT]): ... -class URLField(CharField[_ST, _GT]): ... - -class TextField(Field[_ST, _GT]): - _pyi_private_set_type: Union[str, Combinable] - _pyi_private_get_type: str - # objects are converted to string before comparison - _pyi_lookup_exact_type: Any - -class BooleanField(Field[_ST, _GT]): - _pyi_private_set_type: Union[bool, Combinable] - _pyi_private_get_type: bool - _pyi_lookup_exact_type: bool +class EmailField(CharField): ... +class URLField(CharField): ... -class NullBooleanField(Field[_ST, _GT]): - _pyi_private_set_type: Optional[Union[bool, Combinable]] - _pyi_private_get_type: Optional[bool] - _pyi_lookup_exact_type: Optional[bool] +class TextField(Generic[_C], Field[str, str]): + @overload + def __init__( + self: TextField[Optional[str]], + verbose_name: Optional[Union[str, bytes]] = ..., + name: Optional[str] = ..., + primary_key: bool = ..., + max_length: Optional[int] = ..., + unique: bool = ..., + blank: bool = ..., + null: Literal[True] = ..., + db_index: bool = ..., + default: Any = ..., + editable: bool = ..., + auto_created: bool = ..., + serialize: bool = ..., + unique_for_date: Optional[str] = ..., + unique_for_month: Optional[str] = ..., + unique_for_year: Optional[str] = ..., + choices: Optional[_FieldChoices] = ..., + help_text: str = ..., + db_column: Optional[str] = ..., + db_tablespace: Optional[str] = ..., + validators: Iterable[_ValidatorCallable] = ..., + error_messages: Optional[_ErrorMessagesToOverride] = ..., + ) -> None: ... + @overload + def __init__( + self: TextField[str], + verbose_name: Optional[Union[str, bytes]] = ..., + name: Optional[str] = ..., + primary_key: bool = ..., + max_length: Optional[int] = ..., + unique: bool = ..., + blank: bool = ..., + null: Literal[False] = ..., + db_index: bool = ..., + default: Any = ..., + editable: bool = ..., + auto_created: bool = ..., + serialize: bool = ..., + unique_for_date: Optional[str] = ..., + unique_for_month: Optional[str] = ..., + unique_for_year: Optional[str] = ..., + choices: Optional[_FieldChoices] = ..., + help_text: str = ..., + db_column: Optional[str] = ..., + db_tablespace: Optional[str] = ..., + validators: Iterable[_ValidatorCallable] = ..., + error_messages: Optional[_ErrorMessagesToOverride] = ..., + ) -> None: ... + def __get__(self: TextField[_C], instance: Any, owner: Any) -> _C: ... + def __set__(self, instance: Any, value: _C) -> None: ... -class IPAddressField(Field[_ST, _GT]): - _pyi_private_set_type: Union[str, Combinable] - _pyi_private_get_type: str +class BooleanField(Field[Union[bool, Combinable], bool]): ... +class NullBooleanField(Field[Optional[Union[bool, Combinable]], Optional[bool]]): ... +class IPAddressField(Field[Union[str, Combinable], str]): ... -class GenericIPAddressField(Field[_ST, _GT]): - _pyi_private_set_type: Union[str, int, Callable[..., Any], Combinable] - _pyi_private_get_type: str +class GenericIPAddressField(Field[Union[str, int, Callable[..., Any], Combinable], str]): default_error_messages: Any = ... unpack_ipv4: Any = ... @@ -308,10 +355,7 @@ class GenericIPAddressField(Field[_ST, _GT]): class DateTimeCheckMixin: ... -class DateField(DateTimeCheckMixin, Field[_ST, _GT]): - _pyi_private_set_type: Union[str, date, Combinable] - _pyi_private_get_type: date - _pyi_lookup_exact_type: Union[str, date] +class DateField(DateTimeCheckMixin, Field[Union[str, date, Combinable], date]): def __init__( self, verbose_name: Optional[Union[str, bytes]] = ..., @@ -336,9 +380,7 @@ class DateField(DateTimeCheckMixin, Field[_ST, _GT]): error_messages: Optional[_ErrorMessagesToOverride] = ..., ): ... -class TimeField(DateTimeCheckMixin, Field[_ST, _GT]): - _pyi_private_set_type: Union[str, time, datetime, Combinable] - _pyi_private_get_type: time +class TimeField(DateTimeCheckMixin, Field[Union[str, time, datetime, Combinable], time]): def __init__( self, verbose_name: Optional[Union[str, bytes]] = ..., @@ -362,15 +404,63 @@ class TimeField(DateTimeCheckMixin, Field[_ST, _GT]): error_messages: Optional[_ErrorMessagesToOverride] = ..., ): ... -class DateTimeField(DateField[_ST, _GT]): - _pyi_private_get_type: datetime - _pyi_lookup_exact_type: Union[str, datetime] +_DT = TypeVar("_DT", bound=Optional[datetime]) + +class DateTimeField(Generic[_DT], DateTimeCheckMixin, Field[Union[str, datetime], datetime]): + @overload + def __init__( + self: DateTimeField[datetime], + verbose_name: Optional[Union[str, bytes]] = ..., + name: Optional[str] = ..., + auto_now: bool = ..., + auto_now_add: bool = ..., + primary_key: bool = ..., + max_length: Optional[int] = ..., + unique: bool = ..., + blank: bool = ..., + null: Literal[False] = ..., + db_index: bool = ..., + default: Any = ..., + editable: bool = ..., + auto_created: bool = ..., + serialize: bool = ..., + choices: Optional[_FieldChoices] = ..., + help_text: str = ..., + db_column: Optional[str] = ..., + db_tablespace: Optional[str] = ..., + validators: Iterable[_ValidatorCallable] = ..., + error_messages: Optional[_ErrorMessagesToOverride] = ..., + ) -> None: ... + @overload + def __init__( + self: DateTimeField[Optional[datetime]], + verbose_name: Optional[Union[str, bytes]] = ..., + name: Optional[str] = ..., + auto_now: bool = ..., + auto_now_add: bool = ..., + primary_key: bool = ..., + max_length: Optional[int] = ..., + unique: bool = ..., + blank: bool = ..., + null: Literal[True] = ..., + db_index: bool = ..., + default: Any = ..., + editable: bool = ..., + auto_created: bool = ..., + serialize: bool = ..., + choices: Optional[_FieldChoices] = ..., + help_text: str = ..., + db_column: Optional[str] = ..., + db_tablespace: Optional[str] = ..., + validators: Iterable[_ValidatorCallable] = ..., + error_messages: Optional[_ErrorMessagesToOverride] = ..., + ) -> None: ... + def __get__(self, instance: Any, owner: Any) -> _DT: ... + def __set__(self, instance: Any, value: _DT) -> None: ... -class UUIDField(Field[_ST, _GT]): - _pyi_private_set_type: Union[str, uuid.UUID] - _pyi_private_get_type: uuid.UUID +class UUIDField(Field[Union[str, uuid.UUID], uuid.UUID]): ... -class FilePathField(Field[_ST, _GT]): +class FilePathField(Field[str, str]): path: Any = ... match: Optional[str] = ... recursive: bool = ... @@ -403,11 +493,7 @@ class FilePathField(Field[_ST, _GT]): error_messages: Optional[_ErrorMessagesToOverride] = ..., ): ... -class BinaryField(Field[_ST, _GT]): - _pyi_private_get_type: bytes - -class DurationField(Field[_ST, _GT]): - _pyi_private_get_type: timedelta - -class BigAutoField(AutoField[_ST, _GT]): ... -class CommaSeparatedIntegerField(CharField[_ST, _GT]): ... +class BinaryField(Field[Union[bytes, bytearray, memoryview], bytes]): ... +class DurationField(Field[timedelta, timedelta]): ... +class BigAutoField(AutoField): ... +class CommaSeparatedIntegerField(CharField): ... diff --git a/django-stubs/db/models/fields/related.pyi b/django-stubs/db/models/fields/related.pyi index ae03ea71f..9c448e229 100644 --- a/django-stubs/db/models/fields/related.pyi +++ b/django-stubs/db/models/fields/related.pyi @@ -21,6 +21,7 @@ from django.db.models.fields.reverse_related import ( # noqa: F401 ManyToOneRel as ManyToOneRel, ManyToManyRel as ManyToManyRel, ) +from typing_extensions import Literal _T = TypeVar("_T", bound=models.Model) _F = TypeVar("_F", bound=models.Field) @@ -56,10 +57,12 @@ class RelatedField(FieldCacheMixin, Field[_ST, _GT]): @property def target_field(self) -> Field: ... -class ForeignObject(RelatedField[_ST, _GT]): +_M = TypeVar("_M", bound=Model) + +class ForeignObject(RelatedField[_M, _M]): def __init__( self, - to: Union[Type[Model], str], + to: Union[Type[_M], str], on_delete: Callable[..., None], from_fields: Sequence[str], to_fields: Sequence[str], @@ -89,12 +92,11 @@ class ForeignObject(RelatedField[_ST, _GT]): error_messages: Optional[_ErrorMessagesToOverride] = ..., ): ... -class ForeignKey(ForeignObject[_ST, _GT]): - _pyi_private_set_type: Union[Any, Combinable] - _pyi_private_get_type: Any +class ForeignKey(Generic[_M], ForeignObject[_M, _M]): + @overload def __init__( - self, - to: Union[Type[Model], str], + self: ForeignKey[_M], + to: Union[Type[_M], str], on_delete: Callable[..., None], to_field: Optional[str] = ..., related_name: Optional[str] = ..., @@ -108,7 +110,40 @@ class ForeignKey(ForeignObject[_ST, _GT]): max_length: Optional[int] = ..., unique: bool = ..., blank: bool = ..., - null: bool = ..., + null: Literal[False] = ..., + 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] = ..., + ): ... + @overload + def __init__( + self: ForeignKey[Optional[_M]], + to: Union[Type[_M], str], + on_delete: Callable[..., None], + to_field: Optional[str] = ..., + related_name: Optional[str] = ..., + related_query_name: Optional[str] = ..., + limit_choices_to: Optional[Union[Dict[str, Any], Callable[[], Any], Q]] = ..., + parent_link: bool = ..., + db_constraint: bool = ..., + verbose_name: Optional[Union[str, bytes]] = ..., + name: Optional[str] = ..., + primary_key: bool = ..., + max_length: Optional[int] = ..., + unique: bool = ..., + blank: bool = ..., + null: Literal[True] = ..., db_index: bool = ..., default: Any = ..., editable: bool = ..., @@ -129,7 +164,11 @@ class ForeignKey(ForeignObject[_ST, _GT]): def __get__(self, instance: None, owner) -> ForwardManyToOneDescriptor: ... # Model instance access @overload - def __get__(self, instance: Model, owner) -> _GT: ... + def __get__( + self: ForeignKey[Optional[_M]], instance: Any, owner: Any + ) -> Optional[_M]: ... + @overload + def __get__(self: ForeignKey[_M], instance: Any, owner: Any) -> _M: ... # non-Model instances @overload def __get__(self: _F, instance, owner) -> _F: ... From dcdb0be4f11e3696d85f5f23fa0564528307e2e4 Mon Sep 17 00:00:00 2001 From: Steve Dignam Date: Wed, 25 Nov 2020 15:45:24 -0500 Subject: [PATCH 03/88] cut more config --- .editorconfig | 10 ------- .pre-commit-config.yaml | 46 ------------------------------ dev-requirements.txt | 12 -------- setup.cfg | 11 -------- setup.py | 62 +++-------------------------------------- 5 files changed, 4 insertions(+), 137 deletions(-) delete mode 100644 .editorconfig delete mode 100644 .pre-commit-config.yaml delete mode 100644 dev-requirements.txt delete mode 100644 setup.cfg diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 49fd62e47..000000000 --- a/.editorconfig +++ /dev/null @@ -1,10 +0,0 @@ -# Check http://editorconfig.org for more information -# This is the main config file for this project: -root = true - -[*] -charset = utf-8 -end_of_line = lf -insert_final_newline = true -indent_style = space -trim_trailing_whitespace = true diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml deleted file mode 100644 index 71ce3de1a..000000000 --- a/.pre-commit-config.yaml +++ /dev/null @@ -1,46 +0,0 @@ -# See https://pre-commit.com for more information -# See https://pre-commit.com/hooks.html for more hooks -default_language_version: - python: python3.9 -repos: - - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v3.3.0 - hooks: - - id: check-yaml - - id: trailing-whitespace - - id: check-executables-have-shebangs - - id: debug-statements - - id: check-merge-conflict - - repo: https://github.com/asottile/pyupgrade - rev: v2.7.3 - hooks: - - id: pyupgrade - args: ["--py36-plus"] - - repo: https://github.com/pre-commit/mirrors-isort - rev: v5.6.4 - hooks: - - id: isort - - repo: https://github.com/psf/black - rev: 20.8b1 - hooks: - - id: black - - repo: https://gitlab.com/pycqa/flake8 - rev: 3.8.4 - hooks: - - id: flake8 - - repo: local - hooks: - - id: mypy - name: mypy - entry: mypy - language: system - types: [ python ] - exclude: "scripts/|django_stubs_ext/" - args: [ "--config=mypy.ini", "--cache-dir=/dev/null", "--no-incremental" ] - - id: mypy - name: mypy (django_stubs_ext) - entry: mypy - language: system - types: [ python ] - files: "django_stubs_ext/|django_stubs_ext/tests/" - args: [ "--config=mypy.ini", "--cache-dir=/dev/null", "--no-incremental", "--strict" ] diff --git a/dev-requirements.txt b/dev-requirements.txt deleted file mode 100644 index e56d9edff..000000000 --- a/dev-requirements.txt +++ /dev/null @@ -1,12 +0,0 @@ -wheel -mypy==0.790 -requests==2.24.0 -coreapi==2.3.3 -typing-extensions==3.7.4.3 -gitpython==3.1.9 -pre-commit==2.7.1 -pytest==6.1.1 -pytest-mypy-plugins==1.6.1 -psycopg2-binary --e ./django_stubs_ext --e . diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index 842d130f1..000000000 --- a/setup.cfg +++ /dev/null @@ -1,11 +0,0 @@ -[flake8] -exclude = .*/ -select = F401, Y -max_line_length = 120 -per-file-ignores = - *__init__.pyi: F401 - base_user.pyi: Y003 - models.pyi: Y003 - -[metadata] -license_file = LICENSE.txt diff --git a/setup.py b/setup.py index 144872731..7af09bd68 100644 --- a/setup.py +++ b/setup.py @@ -1,61 +1,7 @@ -import os -from distutils.core import setup -from typing import List - from setuptools import find_packages +# This allows for the pip install -e . to work so that mypy can check the types +# of the examples. Since the stubs aren't using valid python package names, +# mypy can't check the types normally. -def find_stub_files(name: str) -> List[str]: - result = [] - for root, dirs, files in os.walk(name): - for file in files: - if file.endswith(".pyi"): - if os.path.sep in root: - sub_root = root.split(os.path.sep, 1)[-1] - file = os.path.join(sub_root, file) - result.append(file) - return result - - -with open("README.md") as f: - readme = f.read() - -dependencies = [ - "mypy>=0.790", - "typing-extensions", - "django", - "django-stubs-ext", -] - -setup( - name="django-stubs", - version="1.7.0", - description="Mypy stubs for Django", - long_description=readme, - long_description_content_type="text/markdown", - license="MIT", - url="https://github.com/typeddjango/django-stubs", - author="Maksim Kurnikov", - author_email="maxim.kurnikov@gmail.com", - py_modules=[], - python_requires=">=3.6", - install_requires=dependencies, - packages=["django-stubs", *find_packages(exclude=["scripts"])], - package_data={"django-stubs": find_stub_files("django-stubs")}, - classifiers=[ - "License :: OSI Approved :: MIT License", - "Operating System :: OS Independent", - "Programming Language :: Python :: 3.6", - "Programming Language :: Python :: 3.7", - "Programming Language :: Python :: 3.8", - "Programming Language :: Python :: 3.9", - "Typing :: Typed", - "Framework :: Django", - "Framework :: Django :: 2.2", - "Framework :: Django :: 3.0", - "Framework :: Django :: 3.1", - ], - project_urls={ - "Release notes": "https://github.com/typeddjango/django-stubs/releases", - }, -) +setup(name="django-stubs") From dc037540ec6856128c7fd38a9ef0c9e23368638b Mon Sep 17 00:00:00 2001 From: Steve Dignam Date: Wed, 25 Nov 2020 16:45:57 -0500 Subject: [PATCH 04/88] cut old file --- CONTRIBUTING.md | 112 ------------------------------------------------ 1 file changed, 112 deletions(-) delete mode 100644 CONTRIBUTING.md diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md deleted file mode 100644 index 9733440cd..000000000 --- a/CONTRIBUTING.md +++ /dev/null @@ -1,112 +0,0 @@ -# Contribution Guide - -This project is open source and community driven. As such we encourage code contributions of all kinds. Some areas you can contribute in: - -1. Improve the stubs -2. Sync stubs with the latest version of Django -3. Improve plugin code and extend its capabilities -4. Write tests -5. Update dependencies - -## Tutorials - -If you want to start working on this project, you will need to get familiar with python typings. -The Mypy documentation offers an excellent resource for this, as well as the python official documentation: - -- [Mypy typing documentation](https://mypy.readthedocs.io/en/stable/#overview-type-system-reference) -- [Python official typing documentation](https://docs.python.org/3/library/typing.html) -- [Typing in Python](https://inventwithpython.com/blog/2019/11/24/type-hints-for-busy-python-programmers/) article - -Additionally, the following resources might be useful: - -- [How to write custom mypy plugins](https://mypy.readthedocs.io/en/stable/extending_mypy.html) -- [Typechecking Django and DRF](https://sobolevn.me/2019/08/typechecking-django-and-drf) guide -- [Testing mypy stubs, plugins, and types](https://sobolevn.me/2019/08/testing-mypy-types) guide -- [Awesome Python Typing](https://github.com/typeddjango/awesome-python-typing) list - -## Dev setup - -### Repository Setup - -As a first step you will need to fork this repository and clone your fork locally. -In order to be able to continously sync your fork with the origin repository's master branch, you will need to set up an upstream master. To do so follow this [official github guide](https://docs.github.com/en/free-pro-team@latest/github/collaborating-with-issues-and-pull-requests/syncing-a-fork). - -### Dependency Setup - -After your repository is setup you will then need to create and activate a git ignored virtual env, e.g.: - -```bash -python3 -m venv .venv -source .venv/bin/activate -``` - -Then install the dev requirements: - -```bash -pip install -r ./dev-requirements.txt -``` - -Finally, install the pre-commit hooks: - -```bash -pre-commit install -``` - -### Testing and Linting - -We use `mypy`, `pytest`, `flake8`, and `black` for quality control. All tools except pytest are executed using pre-commit when you make a commit. -To ensure there are not formatting or typing issues in the entire repository you can run: - -```bash -pre-commit run --all-files -``` - -NOTE: This command will not only lint but also modify files - so make sure to commit whatever changes you've made before hand. -You can also run pre-commit per file or for a specific path, simply replace "--all-files" with a target (see [this guide](https://codeburst.io/tool-your-django-project-pre-commit-hooks-e1799d84551f) for more info). - -To execute the unit tests, simply run: - -```bash -pytest -``` - -We also test the stubs against the Django's own test suite. This is done in CI but you can also do this locally. -To execute the script run: - -```bash -python ./scripts/typecheck_tests.py --django_version 3.0 -``` - - -### Generating Stubs using Stubgen - -The stubs are based on auto-generated code created by Mypy's stubgen tool (see: [the stubgen docs](https://mypy.readthedocs.io/en/stable/stubgen.html)). -To make life easier we have a helper script that auto generates these stubs. To use it you can run: - -```bash -python ./scripts/stubgen-django.py --django_version 3.1 -``` - -You can also pass an optional commit hash as a second kwarg to checkout a specific commit, e.g. - -```bash -python ./scripts/stubgen-django.py --django_version 3.1 --commit_sha -``` - -The output for this is a gitignored folder called "stubgen" in the repo's root. - -## Submission Guidelines - -The workflow for contributions is fairly simple: - -1. fork and setup the repository as in the previous step. -2. create a local branch. -3. make whatever changes you want to contribute. -4. ensure your contribution does not introduce linting issues or breaks the tests by linting and testing the code. -5. make a pull request with an adequate description. - -## A Note About Generics - -As Django uses a lot of the more dynamic features of Python (i.e. metaobjects), statically typing it requires heavy use of generics. Unfortunately, the syntax for generics is also valid python syntax. For instance, the statement `class SomeClass(SuperType[int])` implicitly translates to `class SomeClass(SuperType.__class_getitem__(int))`. If `SuperType` doesn't define the `__class_getitem__` method, this causes a runtime error, even if the code typechecks. - -When adding a new generic class, or changing an existing class to use generics, run a quick test to see if it causes a runtime error. If it does, please add the new generic class to the `_need_generic` list in the [django_stubs_ext monkeypatch function](https://github.com/typeddjango/django-stubs/tree/master/django_stubs_ext/django_stubs_ext/monkeypatch.py) From 74a4d012ff52d3700b4239f0545c52de02629b31 Mon Sep 17 00:00:00 2001 From: Steve Dignam Date: Wed, 25 Nov 2020 16:48:45 -0500 Subject: [PATCH 05/88] update readme with initial version & use poetry --- README.md | 185 +++++++++++++++------------------- poetry.lock | 266 +++++++++++++++++++++++++++++++++++++++++++++++++ pyproject.toml | 34 ++++++- 3 files changed, 377 insertions(+), 108 deletions(-) create mode 100644 poetry.lock diff --git a/README.md b/README.md index 91afceeeb..4d49d530d 100644 --- a/README.md +++ b/README.md @@ -1,145 +1,122 @@ -mypy logo +# django-types -# pep484 stubs for Django +Type stubs for [Django](https://www.djangoproject.com). -[![Build status](https://github.com/typeddjango/django-stubs/workflows/test/badge.svg?branch=master&event=push)](https://github.com/typeddjango/django-stubs/actions?query=workflow%3Atest) -[![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) +> Note: this project was forked from +> with the goal of removing the +> [`mypy`](https://github.com/python/mypy) plugin dependency so that `mypy` +> can't [crash due to Django +> config](https://github.com/typeddjango/django-stubs/issues/318), and that +> non-`mypy` type checkers like +> [`pyright`](https://github.com/microsoft/pyright) will work better with +> Django. - -This package contains [type stubs](https://www.python.org/dev/peps/pep-0561/) and a custom 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 this project. The final goal is to be able to get precise types for most common patterns. - - -## Installation +## install ```bash -pip install django-stubs -``` - -To make mypy aware of the plugin, you need to add - -```ini -[mypy] -plugins = - mypy_django_plugin.main - -[mypy.plugins.django-stubs] -django_settings_module = "myproject.settings" +pip install django-types ``` -in your `mypy.ini` or `setup.cfg` [file](https://mypy.readthedocs.io/en/latest/config_file.html). - -Two things happeining here: - -1. We need to explicitly list our plugin to be loaded by `mypy` -2. Our plugin also requires `django` settings module (what you put into `DJANGO_SETTINGS_MODULE` variable) to be specified - -This fully working [typed boilerplate](https://github.com/wemake-services/wemake-django-template) can serve you as an example. - -## Version compatibility - -We rely on different `django` and `mypy` versions: - -| django-stubs | mypy version | django version | python version -| ------------ | ---- | ---- | ---- | -| 1.7.0 | 0.790 | 2.2.x \|\| 3.x | ^3.6 -| 1.6.0 | 0.780 | 2.2.x \|\| 3.x | ^3.6 -| 1.5.0 | 0.770 | 2.2.x \|\| 3.x | ^3.6 -| 1.4.0 | 0.760 | 2.2.x \|\| 3.x | ^3.6 -| 1.3.0 | 0.750 | 2.2.x \|\| 3.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 - - -## FAQ - -### Is this an official Django project? +If you're on a Django version < 3.1, you'll need to monkey patch Django's +`QuerySet` and `Manager` classes so we can index into them with a generic +argument. You can either use [`django-stubs-ext`](https://pypi.org/project/django-stubs-ext/`) or do this yourself manually: -No, it is not. We are independent from Django at the moment. -There's a [proposal](https://github.com/django/deps/pull/65) to merge our project into the Django itself. -You can show your support by liking the PR. - -### Is it safe to use this in production? +```python +import types +from django.db.models.manager import BaseManager +from django.db.models.query import QuerySet -Yes, it is! This project does not affect your runtime at all. -It only affects `mypy` type checking process. +def no_op(self, x): + return self -But, it does not make any sense to use this project without `mypy`. +QuerySet.__class_getitem__ = types.MethodType(no_op, QuerySet) +BaseManager.__class_getitem__ = types.MethodType(no_op, BaseManager) +``` -### mypy crashes when I run it with this plugin installed +## usage -Current implementation uses Django runtime to extract models information, so it will crash, if your installed apps or `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()`. +### getting `objects` to work -In other words, if your `manage.py runserver` crashes, mypy will crash too. -You can also run `mypy` with [`--tb`](https://mypy.readthedocs.io/en/stable/command_line.html#cmdoption-mypy-show-traceback) -option to get extra information about the error. +By default the base `Model` class doesn't have `objects` defined, so you'll +have to explicitly type the property. -### I cannot use QuerySet or Manager with type annotations +```python +from django.db import connection, models +from django.db.models.manager import Manager -You can get a `TypeError: 'type' object is not subscriptable` -when you will try to use `QuerySet[MyModel]`, `Manager[MyModel]` or some other Django-based Generic types. +class User(models.Model): + title = models.CharField(max_length=255) -This happens because these Django classes do not support [`__class_getitem__`](https://www.python.org/dev/peps/pep-0560/#class-getitem) magic method in runtime. + objects = Manager["User"]() -1. You can go with our [`django_stubs_ext`](https://github.com/typeddjango/django-stubs/tree/master/django_stubs_ext) helper, that patches all the types we use as Generic in django. +reveal_type(User.objects.all().first()) +# note: Revealed type is 'Optional[User]' +``` -Install it: +### `HttpRequest`'s `user` property -```bash -pip install django-stubs-ext # as a production dependency -``` +The `HttpRequest`'s `user` property has a type of `Union[AbstractBaseUser, AnonymousUser]`, +but for most of your views you'll probably want either an authed user or an +`AnonymousUser`. -And then place in your `manage.py`, `wsgi.py`, and `asgi.py` files: +So we can define a subclass for each case: ```python -import django_stubs_ext - -django_stubs_ext.monkeypath() +class AuthedHttpRequest(HttpRequest): + user: User # type: ignore [assignment] ``` -2. You can use strings instead: `'QuerySet[MyModel]'` and `'Manager[MyModel]'`, this way it will work as a type for `mypy` and as a regular `str` in runtime. +And then you can use it in your views: -### How can I create a HttpRequest that's guaranteed to have an authenticated user? - -Django's built in `HttpRequest` has the attribute `user` that resolves to the type ```python -Union[User, AnonymousUser] +@auth.login_required +def activity(request: AuthedHttpRequest, team_id: str) -> HttpResponse: + ... ``` -where `User` is the user model specified by the `AUTH_USER_MODEL` setting. -If you want a `HttpRequest` that you can type-annotate with where you know that the user is authenticated you can subclass the normal `HttpRequest` class like so: -```python -from django.http import HttpRequest -from my_user_app.models import MyUser +You can also get more strict with your `login_required` decorator so that the +first argument of the fuction it is decorating is `AuthedHttpRequest`: -class AuthenticatedHttpRequest(HttpRequest): - user: MyUser -``` +```python +from typing import Any, Union, TypeVar, cast +from django.http import HttpRequest, HttpResponse +from typing_extensions import Protocol +from functools import wraps -And then use `AuthenticatedHttpRequest` instead of the standard `HttpRequest` for when you know that the user is authenticated. For example in views using the `@login_required` decorator. +class RequestHandler1(Protocol): + def __call__(self, request: AuthedHttpRequest) -> HttpResponse: + ... -## Related projects +class RequestHandler2(Protocol): + def __call__(self, request: AuthedHttpRequest, __arg1: Any) -> HttpResponse: + ... -- [`awesome-python-typing`](https://github.com/typeddjango/awesome-python-typing) - Awesome list of all typing-related things in Python. -- [`djangorestframework-stubs`](https://github.com/typeddjango/djangorestframework-stubs) - Stubs for Django REST Framework. -- [`pytest-mypy-plugins`](https://github.com/typeddjango/pytest-mypy-plugins) - `pytest` plugin that we use for testing `mypy` stubs and plugins. -- [`wemake-django-template`](https://github.com/wemake-services/wemake-django-template) - Create new typed Django projects in seconds. +RequestHandler = Union[RequestHandler1, RequestHandler2] -## To get help +# Verbose bound arg due to limitations of Python typing. +# see: https://github.com/python/mypy/issues/5876 +_F = TypeVar("_F", bound=RequestHandler) -We have Gitter here: -If you think you have more generic typing issue, please refer to and their Gitter. -## Contributing +def login_required(view_func: _F) -> _F: + @wraps(view_func) + def wrapped_view( + request: AuthedHttpRequest, *args: object, **kwargs: object + ) -> HttpResponse: + if request.user.is_authenticated: + return view_func(request, *args, **kwargs) # type: ignore [call-arg] + raise AuthenticationRequired -This project is open source and community driven. As such we encourage contributions big and small. You can contribute by doing any of the following: + return cast(_F, wrapped_view) +``` -1. Contribute code (e.g. improve stubs, add plugin capabilities, write tests etc) - to do so please follow the [contribution guide](./CONTRIBUTING.md). -2. Assist in code reviews and discussions in issues. -3. Identify bugs and issues and report these +Then the following will type error: -You can always also reach out in gitter to discuss your contributions! +```python +@auth.login_required +def activity(request: HttpRequest, team_id: str) -> HttpResponse: + ... +``` diff --git a/poetry.lock b/poetry.lock new file mode 100644 index 000000000..72a8580fb --- /dev/null +++ b/poetry.lock @@ -0,0 +1,266 @@ +[[package]] +category = "dev" +description = "A small Python module for determining appropriate platform-specific dirs, e.g. a \"user data dir\"." +name = "appdirs" +optional = false +python-versions = "*" +version = "1.4.4" + +[[package]] +category = "dev" +description = "Atomic file writes." +marker = "sys_platform == \"win32\"" +name = "atomicwrites" +optional = false +python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" +version = "1.4.0" + +[[package]] +category = "dev" +description = "Classes Without Boilerplate" +name = "attrs" +optional = false +python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" +version = "20.3.0" + +[[package]] +category = "dev" +description = "The uncompromising code formatter." +name = "black" +optional = false +python-versions = ">=3.6" +version = "20.8b1" + +[package.dependencies] +appdirs = "*" +click = ">=7.1.2" +mypy-extensions = ">=0.4.3" +pathspec = ">=0.6,<1" +regex = ">=2020.1.8" +toml = ">=0.10.1" +typed-ast = ">=1.4.0" +typing-extensions = ">=3.7.4" + +[[package]] +category = "dev" +description = "Composable command line interface toolkit" +name = "click" +optional = false +python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*" +version = "7.1.2" + +[[package]] +category = "dev" +description = "Cross-platform colored terminal text." +marker = "sys_platform == \"win32\"" +name = "colorama" +optional = false +python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*" +version = "0.4.4" + +[[package]] +category = "dev" +description = "Read metadata from Python packages" +marker = "python_version < \"3.8\"" +name = "importlib-metadata" +optional = false +python-versions = ">=3.6" +version = "3.1.0" + +[package.dependencies] +zipp = ">=0.5" + +[[package]] +category = "dev" +description = "iniconfig: brain-dead simple config-ini parsing" +name = "iniconfig" +optional = false +python-versions = "*" +version = "1.1.1" + +[[package]] +category = "dev" +description = "A Python utility / library to sort Python imports." +name = "isort" +optional = false +python-versions = ">=3.6,<4.0" +version = "5.6.4" + +[[package]] +category = "dev" +description = "Optional static typing for Python" +name = "mypy" +optional = false +python-versions = ">=3.5" +version = "0.790" + +[package.dependencies] +mypy-extensions = ">=0.4.3,<0.5.0" +typed-ast = ">=1.4.0,<1.5.0" +typing-extensions = ">=3.7.4" + +[[package]] +category = "dev" +description = "Experimental type system extensions for programs checked with the mypy typechecker." +name = "mypy-extensions" +optional = false +python-versions = "*" +version = "0.4.3" + +[[package]] +category = "dev" +description = "Core utilities for Python packages" +name = "packaging" +optional = false +python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" +version = "20.4" + +[package.dependencies] +pyparsing = ">=2.0.2" +six = "*" + +[[package]] +category = "dev" +description = "Utility library for gitignore style pattern matching of file paths." +name = "pathspec" +optional = false +python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*" +version = "0.8.1" + +[[package]] +category = "dev" +description = "plugin and hook calling mechanisms for python" +name = "pluggy" +optional = false +python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" +version = "0.13.1" + +[package.dependencies] +[package.dependencies.importlib-metadata] +python = "<3.8" +version = ">=0.12" + +[[package]] +category = "dev" +description = "library with cross-python path, ini-parsing, io, code, log facilities" +name = "py" +optional = false +python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" +version = "1.9.0" + +[[package]] +category = "dev" +description = "Python parsing module" +name = "pyparsing" +optional = false +python-versions = ">=2.6, !=3.0.*, !=3.1.*, !=3.2.*" +version = "2.4.7" + +[[package]] +category = "dev" +description = "pytest: simple powerful testing with Python" +name = "pytest" +optional = false +python-versions = ">=3.5" +version = "6.1.2" + +[package.dependencies] +atomicwrites = ">=1.0" +attrs = ">=17.4.0" +colorama = "*" +iniconfig = "*" +packaging = "*" +pluggy = ">=0.12,<1.0" +py = ">=1.8.2" +toml = "*" + +[package.dependencies.importlib-metadata] +python = "<3.8" +version = ">=0.12" + +[[package]] +category = "dev" +description = "Alternative regular expression module, to replace re." +name = "regex" +optional = false +python-versions = "*" +version = "2020.11.13" + +[[package]] +category = "dev" +description = "Python 2 and 3 compatibility utilities" +name = "six" +optional = false +python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*" +version = "1.15.0" + +[[package]] +category = "dev" +description = "Python Library for Tom's Obvious, Minimal Language" +name = "toml" +optional = false +python-versions = ">=2.6, !=3.0.*, !=3.1.*, !=3.2.*" +version = "0.10.2" + +[[package]] +category = "dev" +description = "a fork of Python 2 and 3 ast modules with type comment support" +name = "typed-ast" +optional = false +python-versions = "*" +version = "1.4.1" + +[[package]] +category = "dev" +description = "Backported and Experimental Type Hints for Python 3.5+" +name = "typing-extensions" +optional = false +python-versions = "*" +version = "3.7.4.3" + +[[package]] +category = "dev" +description = "A built-package format for Python" +name = "wheel" +optional = false +python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,>=2.7" +version = "0.35.1" + +[[package]] +category = "dev" +description = "Backport of pathlib-compatible object wrapper for zip files" +marker = "python_version < \"3.8\"" +name = "zipp" +optional = false +python-versions = ">=3.6" +version = "3.4.0" + +[metadata] +content-hash = "96d8f4fd61efd5e2f3e619f9856998444f41f52b1a22dc41085aadc7cef08b96" +python-versions = "^3.7" + +[metadata.hashes] +appdirs = ["7d5d0167b2b1ba821647616af46a749d1c653740dd0d2415100fe26e27afdf41", "a841dacd6b99318a741b166adb07e19ee71a274450e68237b4650ca1055ab128"] +atomicwrites = ["6d1784dea7c0c8d4a5172b6c620f40b6e4cbfdf96d783691f2e1302a7b88e197", "ae70396ad1a434f9c7046fd2dd196fc04b12f9e91ffb859164193be8b6168a7a"] +attrs = ["31b2eced602aa8423c2aea9c76a724617ed67cf9513173fd3a4f03e3a929c7e6", "832aa3cde19744e49938b91fea06d69ecb9e649c93ba974535d08ad92164f700"] +black = ["1c02557aa099101b9d21496f8a914e9ed2222ef70336404eeeac8edba836fbea"] +click = ["d2b5255c7c6349bc1bd1e59e08cd12acbbd63ce649f2588755783aa94dfb6b1a", "dacca89f4bfadd5de3d7489b7c8a566eee0d3676333fbb50030263894c38c0dc"] +colorama = ["5941b2b48a20143d2267e95b1c2a7603ce057ee39fd88e7329b0c292aa16869b", "9f47eda37229f68eee03b24b9748937c7dc3868f906e8ba69fbcbdd3bc5dc3e2"] +importlib-metadata = ["590690d61efdd716ff82c39ca9a9d4209252adfe288a4b5721181050acbd4175", "d9b8a46a0885337627a6430db287176970fff18ad421becec1d64cfc763c2099"] +iniconfig = ["011e24c64b7f47f6ebd835bb12a743f2fbe9a26d4cecaa7f53bc4f35ee9da8b3", "bc3af051d7d14b2ee5ef9969666def0cd1a000e121eaea580d4a313df4b37f32"] +isort = ["dcab1d98b469a12a1a624ead220584391648790275560e1a43e54c5dceae65e7", "dcaeec1b5f0eca77faea2a35ab790b4f3680ff75590bfcb7145986905aab2f58"] +mypy = ["0a0d102247c16ce93c97066443d11e2d36e6cc2a32d8ccc1f705268970479324", "0d34d6b122597d48a36d6c59e35341f410d4abfa771d96d04ae2c468dd201abc", "2170492030f6faa537647d29945786d297e4862765f0b4ac5930ff62e300d802", "2842d4fbd1b12ab422346376aad03ff5d0805b706102e475e962370f874a5122", "2b21ba45ad9ef2e2eb88ce4aeadd0112d0f5026418324176fd494a6824b74975", "72060bf64f290fb629bd4a67c707a66fd88ca26e413a91384b18db3876e57ed7", "af4e9ff1834e565f1baa74ccf7ae2564ae38c8df2a85b057af1dbbc958eb6666", "bd03b3cf666bff8d710d633d1c56ab7facbdc204d567715cb3b9f85c6e94f669", "c614194e01c85bb2e551c421397e49afb2872c88b5830e3554f0519f9fb1c178", "cf4e7bf7f1214826cf7333627cb2547c0db7e3078723227820d0a2490f117a01", "da56dedcd7cd502ccd3c5dddc656cb36113dd793ad466e894574125945653cea", "e86bdace26c5fe9cf8cb735e7cedfe7850ad92b327ac5d797c656717d2ca66de", "e97e9c13d67fbe524be17e4d8025d51a7dca38f90de2e462243ab8ed8a9178d1", "eea260feb1830a627fb526d22fbb426b750d9f5a47b624e8d5e7e004359b219c"] +mypy-extensions = ["090fedd75945a69ae91ce1303b5824f428daf5a028d2f6ab8a299250a846f15d", "2d82818f5bb3e369420cb3c4060a7970edba416647068eb4c5343488a6c604a8"] +packaging = ["4357f74f47b9c12db93624a82154e9b120fa8293699949152b22065d556079f8", "998416ba6962ae7fbd6596850b80e17859a5753ba17c32284f67bfff33784181"] +pathspec = ["86379d6b86d75816baba717e64b1a3a3469deb93bb76d613c9ce79edc5cb68fd", "aa0cb481c4041bf52ffa7b0d8fa6cd3e88a2ca4879c533c9153882ee2556790d"] +pluggy = ["15b2acde666561e1298d71b523007ed7364de07029219b604cf808bfa1c765b0", "966c145cd83c96502c3c3868f50408687b38434af77734af1e9ca461a4081d2d"] +py = ["366389d1db726cd2fcfc79732e75410e5fe4d31db13692115529d34069a043c2", "9ca6883ce56b4e8da7e79ac18787889fa5206c79dcc67fb065376cd2fe03f342"] +pyparsing = ["c203ec8783bf771a155b207279b9bccb8dea02d8f0c9e5f8ead507bc3246ecc1", "ef9d7589ef3c200abe66653d3f1ab1033c3c419ae9b9bdb1240a85b024efc88b"] +pytest = ["4288fed0d9153d9646bfcdf0c0428197dba1ecb27a33bb6e031d002fa88653fe", "c0a7e94a8cdbc5422a51ccdad8e6f1024795939cc89159a0ae7f0b316ad3823e"] +regex = ["02951b7dacb123d8ea6da44fe45ddd084aa6777d4b2454fa0da61d569c6fa538", "0d08e71e70c0237883d0bef12cad5145b84c3705e9c6a588b2a9c7080e5af2a4", "1862a9d9194fae76a7aaf0150d5f2a8ec1da89e8b55890b1786b8f88a0f619dc", "1ab79fcb02b930de09c76d024d279686ec5d532eb814fd0ed1e0051eb8bd2daa", "1fa7ee9c2a0e30405e21031d07d7ba8617bc590d391adfc2b7f1e8b99f46f444", "262c6825b309e6485ec2493ffc7e62a13cf13fb2a8b6d212f72bd53ad34118f1", "2a11a3e90bd9901d70a5b31d7dd85114755a581a5da3fc996abfefa48aee78af", "2c99e97d388cd0a8d30f7c514d67887d8021541b875baf09791a3baad48bb4f8", "3128e30d83f2e70b0bed9b2a34e92707d0877e460b402faca908c6667092ada9", "38c8fd190db64f513fe4e1baa59fed086ae71fa45083b6936b52d34df8f86a88", "3bddc701bdd1efa0d5264d2649588cbfda549b2899dc8d50417e47a82e1387ba", "4902e6aa086cbb224241adbc2f06235927d5cdacffb2425c73e6570e8d862364", "49cae022fa13f09be91b2c880e58e14b6da5d10639ed45ca69b85faf039f7a4e", "56e01daca75eae420bce184edd8bb341c8eebb19dd3bce7266332258f9fb9dd7", "5862975b45d451b6db51c2e654990c1820523a5b07100fc6903e9c86575202a0", "6a8ce43923c518c24a2579fda49f093f1397dad5d18346211e46f134fc624e31", "6c54ce4b5d61a7129bad5c5dc279e222afd00e721bf92f9ef09e4fae28755683", "6e4b08c6f8daca7d8f07c8d24e4331ae7953333dbd09c648ed6ebd24db5a10ee", "717881211f46de3ab130b58ec0908267961fadc06e44f974466d1887f865bd5b", "749078d1eb89484db5f34b4012092ad14b327944ee7f1c4f74d6279a6e4d1884", "7913bd25f4ab274ba37bc97ad0e21c31004224ccb02765ad984eef43e04acc6c", "7a25fcbeae08f96a754b45bdc050e1fb94b95cab046bf56b016c25e9ab127b3e", "83d6b356e116ca119db8e7c6fc2983289d87b27b3fac238cfe5dca529d884562", "8b882a78c320478b12ff024e81dc7d43c1462aa4a3341c754ee65d857a521f85", "8f6a2229e8ad946e36815f2a03386bb8353d4bde368fdf8ca5f0cb97264d3b5c", "9801c4c1d9ae6a70aeb2128e5b4b68c45d4f0af0d1535500884d644fa9b768c6", "a15f64ae3a027b64496a71ab1f722355e570c3fac5ba2801cafce846bf5af01d", "a3d748383762e56337c39ab35c6ed4deb88df5326f97a38946ddd19028ecce6b", "a63f1a07932c9686d2d416fb295ec2c01ab246e89b4d58e5fa468089cab44b70", "b2b1a5ddae3677d89b686e5c625fc5547c6e492bd755b520de5332773a8af06b", "b2f4007bff007c96a173e24dcda236e5e83bde4358a557f9ccf5e014439eae4b", "baf378ba6151f6e272824b86a774326f692bc2ef4cc5ce8d5bc76e38c813a55f", "bafb01b4688833e099d79e7efd23f99172f501a15c44f21ea2118681473fdba0", "bba349276b126947b014e50ab3316c027cac1495992f10e5682dc677b3dfa0c5", "c084582d4215593f2f1d28b65d2a2f3aceff8342aa85afd7be23a9cad74a0de5", "d1ebb090a426db66dd80df8ca85adc4abfcbad8a7c2e9a5ec7513ede522e0a8f", "d2d8ce12b7c12c87e41123997ebaf1a5767a5be3ec545f64675388970f415e2e", "e32f5f3d1b1c663af7f9c4c1e72e6ffe9a78c03a31e149259f531e0fed826512", "e3faaf10a0d1e8e23a9b51d1900b72e1635c2d5b0e1bea1c18022486a8e2e52d", "f7d29a6fc4760300f86ae329e3b6ca28ea9c20823df123a2ea8693e967b29917", "f8f295db00ef5f8bae530fc39af0b40486ca6068733fb860b42115052206466f"] +six = ["30639c035cdb23534cd4aa2dd52c3bf48f06e5f4a941509c8bafd8ce11080259", "8b74bedcbbbaca38ff6d7491d76f2b06b3592611af620f8426e82dddb04a5ced"] +toml = ["806143ae5bfb6a3c6e736a764057db0e6a0e05e338b5630894a5f779cabb4f9b", "b3bda1d108d5dd99f4a20d24d9c348e91c4db7ab1b749200bded2f839ccbe68f"] +typed-ast = ["0666aa36131496aed8f7be0410ff974562ab7eeac11ef351def9ea6fa28f6355", "0c2c07682d61a629b68433afb159376e24e5b2fd4641d35424e462169c0a7919", "249862707802d40f7f29f6e1aad8d84b5aa9e44552d2cc17384b209f091276aa", "24995c843eb0ad11a4527b026b4dde3da70e1f2d8806c99b7b4a7cf491612652", "269151951236b0f9a6f04015a9004084a5ab0d5f19b57de779f908621e7d8b75", "4083861b0aa07990b619bd7ddc365eb7fa4b817e99cf5f8d9cf21a42780f6e01", "498b0f36cc7054c1fead3d7fc59d2150f4d5c6c56ba7fb150c013fbc683a8d2d", "4e3e5da80ccbebfff202a67bf900d081906c358ccc3d5e3c8aea42fdfdfd51c1", "6daac9731f172c2a22ade6ed0c00197ee7cc1221aa84cfdf9c31defeb059a907", "715ff2f2df46121071622063fc7543d9b1fd19ebfc4f5c8895af64a77a8c852c", "73d785a950fc82dd2a25897d525d003f6378d1cb23ab305578394694202a58c3", "8c8aaad94455178e3187ab22c8b01a3837f8ee50e09cf31f1ba129eb293ec30b", "8ce678dbaf790dbdb3eba24056d5364fb45944f33553dd5869b7580cdbb83614", "aaee9905aee35ba5905cfb3c62f3e83b3bec7b39413f0a7f19be4e547ea01ebb", "bcd3b13b56ea479b3650b82cabd6b5343a625b0ced5429e4ccad28a8973f301b", "c9e348e02e4d2b4a8b2eedb48210430658df6951fa484e59de33ff773fbd4b41", "d205b1b46085271b4e15f670058ce182bd1199e56b317bf2ec004b6a44f911f6", "d43943ef777f9a1c42bf4e552ba23ac77a6351de620aa9acf64ad54933ad4d34", "d5d33e9e7af3b34a40dc05f498939f0ebf187f07c385fd58d591c533ad8562fe", "fc0fea399acb12edbf8a628ba8d2312f583bdbdb3335635db062fa98cf71fca4", "fe460b922ec15dd205595c9b5b99e2f056fd98ae8f9f56b888e7a17dc2b757e7"] +typing-extensions = ["7cb407020f00f7bfc3cb3e7881628838e69d8f3fcab2f64742a5e76b2f841918", "99d4073b617d30288f569d3f13d2bd7548c3a7e4c8de87db09a9d29bb3a4a60c", "dafc7639cde7f1b6e1acc0f457842a83e722ccca8eef5270af2d74792619a89f"] +wheel = ["497add53525d16c173c2c1c733b8f655510e909ea78cc0e29d374243544b77a2", "99a22d87add3f634ff917310a3d87e499f19e663413a52eb9232c447aa646c9f"] +zipp = ["102c24ef8f171fd729d46599845e95c7ab894a4cf45f5de11a44cc7444fb1108", "ed5eee1974372595f9e416cc7bbeeb12335201d8081ca8a0743c954d4446e5cb"] diff --git a/pyproject.toml b/pyproject.toml index 6fd75a033..82fa9384c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,8 +1,34 @@ +[tool.poetry] +name = "django-types" +version = "0.1.0" +description = "Type subs for Django" +repository = "https://github.com/sbdchd/django-types" +readme = "README.md" +authors = ["Steve Dignam "] +license = "MIT" +keywords = ["django", "types", "mypy", "stubs"] + +packages = [ + { include = "django-stubs" }, +] + +[tool.poetry.dependencies] +python = "^3.7" + +[tool.poetry.dev-dependencies] +black = {version = "20.8b1",allows-prereleases = true} +pytest = "^6.1" +wheel = "^0.35.1" +mypy = "^0.790.0" +isort = "^5.6" + [tool.black] -line-length = 120 +line-length = 88 include = '\.pyi?$' [tool.isort] -line_length = 120 -multi_line_output = 3 -include_trailing_comma = true +profile="black" + +[build-system] +requires = ["poetry>=0.12"] +build-backend = "poetry.masonry.api" From 19cbd79c87f7d031ddfab13670e62f53d9f177d9 Mon Sep 17 00:00:00 2001 From: Steve Dignam Date: Wed, 25 Nov 2020 16:53:49 -0500 Subject: [PATCH 06/88] remove old CI --- .github/ISSUE_TEMPLATE/bug.md | 35 ----------------- .github/pull_request_template.md | 29 -------------- .github/workflows/misspel.yml | 20 ---------- .github/workflows/test.yml | 67 -------------------------------- 4 files changed, 151 deletions(-) delete mode 100644 .github/ISSUE_TEMPLATE/bug.md delete mode 100644 .github/pull_request_template.md delete mode 100644 .github/workflows/misspel.yml delete mode 100644 .github/workflows/test.yml diff --git a/.github/ISSUE_TEMPLATE/bug.md b/.github/ISSUE_TEMPLATE/bug.md deleted file mode 100644 index d919c65ca..000000000 --- a/.github/ISSUE_TEMPLATE/bug.md +++ /dev/null @@ -1,35 +0,0 @@ ---- -name: Bug -about: Create a report of something is not working -labels: 'bug' ---- - -# Bug report - - - -## What's wrong - - - -## How is that should be - - - -## System information - -- OS: -- `python` version: -- `django` version: -- `mypy` version: -- `django-stubs` version: diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md deleted file mode 100644 index 82e2bfce4..000000000 --- a/.github/pull_request_template.md +++ /dev/null @@ -1,29 +0,0 @@ -# I have made things! - - - -## Related issues - - - - diff --git a/.github/workflows/misspel.yml b/.github/workflows/misspel.yml deleted file mode 100644 index b0bcb2bed..000000000 --- a/.github/workflows/misspel.yml +++ /dev/null @@ -1,20 +0,0 @@ -name: misspell - -on: - workflow_dispatch: - schedule: - - cron: '0 0 * * *' - -jobs: - build: - - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v2 - - uses: sobolevn/misspell-fixer-action@0.1.0 - - uses: peter-evans/create-pull-request@v3 - with: - token: ${{ secrets.GITHUB_TOKEN }} - commit-message: 'Fixes by misspell-fixer' - title: 'Typos fix by misspell-fixer' diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml deleted file mode 100644 index 4054c0411..000000000 --- a/.github/workflows/test.yml +++ /dev/null @@ -1,67 +0,0 @@ -name: test - -on: [push, pull_request, workflow_dispatch] - - -jobs: - lint: - runs-on: ubuntu-latest - strategy: - matrix: - python-version: ['3.9'] - steps: - - uses: actions/checkout@v2 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v2 - with: - python-version: ${{ matrix.python-version }} - - name: Install dependencies - run: | - pip install -U pip setuptools wheel - pip install -r ./dev-requirements.txt - - - name: Run pre-commit - run: pre-commit install && pre-commit run --all-files - - test: - runs-on: ubuntu-latest - strategy: - matrix: - python-version: ['3.7'] - steps: - - uses: actions/checkout@v2 - - name: Setup system dependencies - run: sudo apt-get install binutils libproj-dev gdal-bin - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v2 - with: - python-version: ${{ matrix.python-version }} - - name: Install dependencies - run: | - pip install -U pip setuptools wheel - pip install -r ./dev-requirements.txt - - - name: Run tests - run: pytest - - typecheck: - runs-on: ubuntu-latest - strategy: - matrix: - python-version: ['3.6', '3.7', '3.8', '3.9'] - django-version: ['2.2', '3.0'] - steps: - - uses: actions/checkout@v2 - - name: Setup system dependencies - run: sudo apt-get install binutils libproj-dev gdal-bin - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v2 - with: - python-version: ${{ matrix.python-version }} - - name: Install dependencies - run: | - pip install -U pip setuptools wheel - pip install -r ./dev-requirements.txt - - - name: Run tests - run: python ./scripts/typecheck_tests.py --django_version="${{ matrix.django-version }}" From f145fbc1c31d5c98d0e4319e0f1ac653e001e336 Mon Sep 17 00:00:00 2001 From: Steve Dignam Date: Wed, 25 Nov 2020 16:55:10 -0500 Subject: [PATCH 07/88] update license --- LICENSE.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/LICENSE.txt b/LICENSE.txt index 3ebfb5177..4d02ed5ee 100644 --- a/LICENSE.txt +++ b/LICENSE.txt @@ -1,3 +1,4 @@ +Copyright (c) Steve Dignam Copyright (c) Maxim Kurnikov. All rights reserved. From 60b286cb203d61e909a4e4462be166dde83ec0bd Mon Sep 17 00:00:00 2001 From: Steve Dignam Date: Wed, 25 Nov 2020 20:53:10 -0500 Subject: [PATCH 08/88] delete unused scripts, fix setup.py --- s/lint | 23 + scripts/__init__.py | 0 scripts/django_tests_settings.py | 237 ------ scripts/enabled_test_modules.py | 523 -------------- scripts/git_helpers.py | 31 - scripts/paths.py | 4 - scripts/stubgen-django.py | 15 - scripts/tests_extension_hook.py | 29 - scripts/typecheck_tests.py | 117 --- setup.py | 2 +- tests/test_error_handling.py | 72 -- .../typecheck/contrib/admin/test_options.yml | 148 ---- .../contrib/auth/test_decorators.yml | 43 -- tests/typecheck/contrib/auth/test_misc.yml | 15 - tests/typecheck/db/models/test_init.yml | 26 - tests/typecheck/db/test_transaction.yml | 28 - tests/typecheck/fields/test_base.yml | 153 ---- .../fields/test_generic_foreign_key.yml | 21 - tests/typecheck/fields/test_nullable.yml | 70 -- .../typecheck/fields/test_postgres_fields.yml | 35 - tests/typecheck/fields/test_related.yml | 674 ------------------ .../managers/querysets/test_basic_methods.yml | 47 -- .../managers/querysets/test_filter.yml | 256 ------- .../managers/querysets/test_from_queryset.yml | 181 ----- .../managers/querysets/test_values.yml | 126 ---- .../managers/querysets/test_values_list.yml | 243 ------- tests/typecheck/managers/test_managers.yml | 359 ---------- .../typecheck/models/test_contrib_models.yml | 28 - tests/typecheck/models/test_create.yml | 113 --- tests/typecheck/models/test_extra_methods.yml | 56 -- tests/typecheck/models/test_inheritance.yml | 115 --- tests/typecheck/models/test_init.yml | 257 ------- tests/typecheck/models/test_meta_options.yml | 58 -- tests/typecheck/models/test_proxy_models.yml | 21 - tests/typecheck/models/test_state.yml | 14 - tests/typecheck/test/test_testcase.yml | 12 - tests/typecheck/test_config.yml | 67 -- tests/typecheck/test_forms.yml | 70 -- tests/typecheck/test_helpers.yml | 62 -- tests/typecheck/test_import_all.yml | 442 ------------ tests/typecheck/test_request.yml | 72 -- tests/typecheck/test_settings.yml | 50 -- tests/typecheck/test_shortcuts.yml | 59 -- tests/typecheck/test_views.yml | 12 - tests/typecheck/utils/test_decorators.yml | 20 - tests/typecheck/utils/test_functional.yml | 18 - 46 files changed, 24 insertions(+), 5000 deletions(-) create mode 100755 s/lint delete mode 100644 scripts/__init__.py delete mode 100644 scripts/django_tests_settings.py delete mode 100644 scripts/enabled_test_modules.py delete mode 100644 scripts/git_helpers.py delete mode 100644 scripts/paths.py delete mode 100644 scripts/stubgen-django.py delete mode 100644 scripts/tests_extension_hook.py delete mode 100644 scripts/typecheck_tests.py delete mode 100644 tests/test_error_handling.py delete mode 100644 tests/typecheck/contrib/admin/test_options.yml delete mode 100644 tests/typecheck/contrib/auth/test_decorators.yml delete mode 100644 tests/typecheck/contrib/auth/test_misc.yml delete mode 100644 tests/typecheck/db/models/test_init.yml delete mode 100644 tests/typecheck/db/test_transaction.yml delete mode 100644 tests/typecheck/fields/test_base.yml delete mode 100644 tests/typecheck/fields/test_generic_foreign_key.yml delete mode 100644 tests/typecheck/fields/test_nullable.yml delete mode 100644 tests/typecheck/fields/test_postgres_fields.yml delete mode 100644 tests/typecheck/fields/test_related.yml delete mode 100644 tests/typecheck/managers/querysets/test_basic_methods.yml delete mode 100644 tests/typecheck/managers/querysets/test_filter.yml delete mode 100644 tests/typecheck/managers/querysets/test_from_queryset.yml delete mode 100644 tests/typecheck/managers/querysets/test_values.yml delete mode 100644 tests/typecheck/managers/querysets/test_values_list.yml delete mode 100644 tests/typecheck/managers/test_managers.yml delete mode 100644 tests/typecheck/models/test_contrib_models.yml delete mode 100644 tests/typecheck/models/test_create.yml delete mode 100644 tests/typecheck/models/test_extra_methods.yml delete mode 100644 tests/typecheck/models/test_inheritance.yml delete mode 100644 tests/typecheck/models/test_init.yml delete mode 100644 tests/typecheck/models/test_meta_options.yml delete mode 100644 tests/typecheck/models/test_proxy_models.yml delete mode 100644 tests/typecheck/models/test_state.yml delete mode 100644 tests/typecheck/test/test_testcase.yml delete mode 100644 tests/typecheck/test_config.yml delete mode 100644 tests/typecheck/test_forms.yml delete mode 100644 tests/typecheck/test_helpers.yml delete mode 100644 tests/typecheck/test_import_all.yml delete mode 100644 tests/typecheck/test_request.yml delete mode 100644 tests/typecheck/test_settings.yml delete mode 100644 tests/typecheck/test_shortcuts.yml delete mode 100644 tests/typecheck/test_views.yml delete mode 100644 tests/typecheck/utils/test_decorators.yml delete mode 100644 tests/typecheck/utils/test_functional.yml diff --git a/s/lint b/s/lint new file mode 100755 index 000000000..30d3c44f6 --- /dev/null +++ b/s/lint @@ -0,0 +1,23 @@ +#!/bin/sh + +set -ex + +if [[ ! -f ./.venv/lib/python3.7/site-packages/django-types.egg-link ]]; then + ./.venv/bin/pip install -e . +fi + + +# format code +if [[ $CI ]]; then + ./.venv/bin/black --check . + ./.venv/bin/isort --check-only . +else + ./.venv/bin/black . + ./.venv/bin/isort . +fi + +# type check code +./.venv/bin/mypy tests + +# lint +./.venv/bin/flake8 tests diff --git a/scripts/__init__.py b/scripts/__init__.py deleted file mode 100644 index e69de29bb..000000000 diff --git a/scripts/django_tests_settings.py b/scripts/django_tests_settings.py deleted file mode 100644 index cd0cdc501..000000000 --- a/scripts/django_tests_settings.py +++ /dev/null @@ -1,237 +0,0 @@ -import os - -import django - -SECRET_KEY = "1" -SITE_ID = 1 - -INSTALLED_APPS = [ - "django.contrib.contenttypes", - "django.contrib.auth", - "django.contrib.sites", - "django.contrib.sessions", - "django.contrib.messages", - "django.contrib.admin.apps.SimpleAdminConfig", - "django.contrib.staticfiles", -] - -test_modules = [ - "absolute_url_overrides", - "admin_autodiscover", - "admin_changelist", - "admin_checks", - "admin_custom_urls", - "admin_default_site", - "admin_docs", - "admin_filters", - "admin_inlines", - "admin_ordering", - "admin_registration", - "admin_scripts", - "admin_utils", - "admin_views", - "admin_widgets", - "aggregation", - "aggregation_regress", - "annotations", - "app_loading", - "apps", - "auth_tests", - "backends", - "base", - "bash_completion", - "basic", - "builtin_server", - "bulk_create", - "cache", - "check_framework", - "conditional_processing", - "constraints", - "contenttypes_tests", - "context_processors", - "csrf_tests", - "custom_columns", - "custom_lookups", - "custom_managers", - "custom_methods", - "custom_migration_operations", - "custom_pk", - "datatypes", - "dates", - "datetimes", - "db_functions", - "db_typecasts", - "db_utils", - "dbshell", - "decorators", - "defer", - "defer_regress", - "delete", - "delete_regress", - "deprecation", - "dispatch", - "distinct_on_fields", - "empty", - "expressions", - "expressions_case", - "expressions_window", - "extra_regress", - "field_deconstruction", - "field_defaults", - "field_subclassing", - "file_storage", - "file_uploads", - "files", - "filtered_relation", - "fixtures", - "fixtures_model_package", - "fixtures_regress", - "flatpages_tests", - "force_insert_update", - "foreign_object", - "forms_tests", - "from_db_value", - "generic_inline_admin", - "generic_relations", - "generic_relations_regress", - "generic_views", - "get_earliest_or_latest", - "get_object_or_404", - "get_or_create", - "gis_tests", - "handlers", - "httpwrappers", - "humanize_tests", - "i18n", - "import_error_package", - "indexes", - "inline_formsets", - "inspectdb", - "introspection", - "invalid_models_tests", - "known_related_objects", - "logging_tests", - "lookup", - "m2m_and_m2o", - "m2m_intermediary", - "m2m_multiple", - "m2m_recursive", - "m2m_regress", - "m2m_signals", - "m2m_through", - "m2m_through_regress", - "m2o_recursive", - "mail", - "managers_regress", - "many_to_many", - "many_to_one", - "many_to_one_null", - "max_lengths", - "messages_tests", - "middleware", - "middleware_exceptions", - "migrate_signals", - "migration_test_data_persistence", - "migrations", - "migrations2", - "model_fields", - "model_forms", - "model_formsets", - "model_formsets_regress", - "model_indexes", - "model_inheritance", - "model_inheritance_regress", - "model_meta", - "model_options", - "model_package", - "model_regress", - "modeladmin", - "multiple_database", - "mutually_referential", - "nested_foreign_keys", - "no_models", - "null_fk", - "null_fk_ordering", - "null_queries", - "one_to_one", - "or_lookups", - "order_with_respect_to", - "ordering", - "pagination", - "postgres_tests", - "prefetch_related", - "project_template", - "properties", - "proxy_model_inheritance", - "proxy_models", - "queries", - "queryset_pickle", - "raw_query", - "redirects_tests", - "requests", - "reserved_names", - "resolve_url", - "responses", - "reverse_lookup", - "save_delete_hooks", - "schema", - "select_for_update", - "select_related", - "select_related_onetoone", - "select_related_regress", - "serializers", - "servers", - "sessions_tests", - "settings_tests", - "shell", - "shortcuts", - "signals", - "signed_cookies_tests", - "signing", - "sitemaps_tests", - "sites_framework", - "sites_tests", - "staticfiles_tests", - "str", - "string_lookup", - "swappable_models", - "syndication_tests", - "template_backends", - "template_loader", - "template_tests", - "test_client", - "test_client_regress", - "test_exceptions", - "test_runner", - "test_runner_apps", - "test_utils", - "timezones", - "transaction_hooks", - "transactions", - "unmanaged_models", - "update", - "update_only_fields", - "urlpatterns", - "urlpatterns_reverse", - "user_commands", - "utils_tests", - "validation", - "validators", - "version", - "view_tests", - "wsgi", -] - -if django.VERSION[0] == 2: - test_modules += ["choices"] - -invalid_apps = { - "import_error_package", -} - -for app in invalid_apps: - test_modules.remove(app) - - -if os.environ.get("TYPECHECK_TESTS"): - INSTALLED_APPS += test_modules diff --git a/scripts/enabled_test_modules.py b/scripts/enabled_test_modules.py deleted file mode 100644 index c4414f17d..000000000 --- a/scripts/enabled_test_modules.py +++ /dev/null @@ -1,523 +0,0 @@ -# Some errors occur for the test suite itself, and cannot be addressed via django-stubs. They should be ignored -# using this constant. -import re - -IGNORED_MODULES = { - "schema", - "gis_tests", - "admin_widgets", - "admin_filters", - "sitemaps_tests", - "staticfiles_tests", - "modeladmin", - "generic_views", - "forms_tests", - "flatpages_tests", - "admin_ordering", - "admin_changelist", - "admin_views", - "invalid_models_tests", - "i18n", - "model_formsets", - "template_tests", - "template_backends", - "test_runner", - "admin_scripts", - "inline_formsets", - "foreign_object", - "cache", -} - -MOCK_OBJECTS = [ - "MockRequest", - "MockCompiler", - "MockModelAdmin", - "modelz", - "call_count", - "call_args_list", - "call_args", - "MockUser", - "Xtemplate", - "DummyRequest", - "DummyUser", - "MinimalUser", - "DummyNode", -] -EXTERNAL_MODULES = [ - "psycopg2", - "PIL", - "selenium", - "oracle", - "mysql", - "sqlparse", - "tblib", - "numpy", - "bcrypt", - "argon2", - "xml.dom", -] -IGNORED_ERRORS = { - "__common__": [ - *MOCK_OBJECTS, - *EXTERNAL_MODULES, - "Need type annotation for", - 'has no attribute "getvalue"', - "Cannot assign to a method", - "already defined", - "Cannot assign to a type", - '"HttpResponseBase" has no attribute', - '"object" has no attribute', - re.compile(r'"Callable\[.+, Any\]" has no attribute'), - 'has no attribute "deconstruct"', - # private members - re.compile(r'has no attribute ("|\')_[a-zA-Z_]+("|\')'), - "'Settings' object has no attribute", - "**Dict", - 'has incompatible type "object"', - "undefined in superclass", - "Argument after ** must be a mapping", - "note:", - re.compile(r'Item "None" of "[a-zA-Z_ ,\[\]]+" has no attribute'), - '"Callable[..., None]" has no attribute', - "does not return a value", - 'has no attribute "alternatives"', - "gets multiple values for keyword argument", - '"Handler" has no attribute', - "Module has no attribute", - "namedtuple", - # TODO: see test in managers/test_managers.yml - "Cannot determine type of", - "cache_clear", - "cache_info", - 'Incompatible types in assignment (expression has type "None", variable has type Module)', - "Module 'django.contrib.messages.storage.fallback' has no attribute 'CookieStorage'", - # TODO: not supported yet - "GenericRelation", - "RelatedObjectDoesNotExist", - re.compile( - r'"Field\[Any, Any\]" has no attribute ' - r'"(through|field_name|field|get_related_field|related_model|related_name' - r'|get_accessor_name|empty_strings_allowed|many_to_many)"' - ), - # TODO: multitable inheritance - "ptr", - 'Incompatible types in assignment (expression has type "Callable[', - "SimpleLazyObject", - "Test", - 'Mixin" has no attribute', - "Incompatible types in string interpolation", - '"None" has no attribute', - 'has no attribute "assert', - "Unsupported dynamic base class", - 'error: "HttpResponse" has no attribute "streaming_content"', - 'error: "HttpResponse" has no attribute "context_data"', - ], - "admin_checks": ['Argument 1 to "append" of "list" has incompatible type "str"; expected "CheckMessage"'], - "admin_inlines": [ - 'error: "HttpResponse" has no attribute "rendered_content"', - ], - "admin_utils": [ - '"Article" has no attribute "non_field"', - ], - "aggregation": [ - re.compile(r'got "Optional\[(Author|Publisher)\]", expected "Union\[(Author|Publisher), Combinable\]"'), - 'Argument 2 for "super" not an instance of argument 1', - ], - "annotations": [ - 'Incompatible type for "store" of "Employee" (got "Optional[Store]", expected "Union[Store, Combinable]")' - ], - "apps": [ - 'Incompatible types in assignment (expression has type "str", target has type "type")', - ], - "auth_tests": [ - '"PasswordValidator" has no attribute "min_length"', - "AbstractBaseUser", - 'Argument "password_validators" to "password_changed" has incompatible type "Tuple[Validator]"; ' - + 'expected "Optional[Sequence[PasswordValidator]]"', - 'Unsupported right operand type for in ("object")', - "mock_getpass", - 'Unsupported left operand type for + ("Sequence[str]")', - "AuthenticationFormWithInactiveUsersOkay", - 'Incompatible types in assignment (expression has type "Dict[str, Any]", variable has type "QueryDict")', - 'No overload variant of "int" matches argument type "AnonymousUser"', - 'expression has type "AnonymousUser", variable has type "User"', - ], - "basic": [ - 'Unexpected keyword argument "unknown_kwarg" for "refresh_from_db" of "Model"', - 'Unexpected attribute "foo" for model "Article"', - 'has no attribute "touched"', - 'Incompatible types in assignment (expression has type "Type[CustomQuerySet]"', - '"Manager[Article]" has no attribute "do_something"', - ], - "backends": ['"DatabaseError" has no attribute "pgcode"'], - "builtin_server": [ - '"ServerHandler" has no attribute', - 'Incompatible types in assignment (expression has type "Tuple[BytesIO, BytesIO]"', - ], - "bulk_create": [ - 'has incompatible type "List[Country]"; expected "Iterable[TwoFields]"', - 'List item 1 has incompatible type "Country"; expected "ProxyCountry"', - ], - "check_framework": [ - 'base class "Model" defined the type as "Callable', - 'Value of type "Collection[str]" is not indexable', - "Unsupported target for indexed assignment", - ], - "constraints": ['Argument "condition" to "UniqueConstraint" has incompatible type "str"; expected "Optional[Q]"'], - "contenttypes_tests": [ - '"FooWithBrokenAbsoluteUrl" has no attribute "unknown_field"', - "contenttypes_tests.models.Site", - 'Argument 1 to "set" of "RelatedManager" has incompatible type "SiteManager[Site]"', - ], - "custom_lookups": [ - 'in base class "SQLFuncMixin"', - 'has no attribute "name"', - ], - "custom_columns": [ - "Cannot resolve keyword 'firstname' into field", - ], - "custom_pk": [ - '"Employee" has no attribute "id"', - ], - "custom_managers": [ - 'Incompatible types in assignment (expression has type "CharField', - 'Item "Book" of "Optional[Book]" has no attribute "favorite_avg"', - ], - "csrf_tests": [ - 'expression has type "property", base class "HttpRequest" defined the type as "QueryDict"', - 'expression has type "Dict[, ]", variable has type "SessionBase"', - ], - "dates": [ - 'Too few arguments for "dates" of', - ], - "dbshell": [ - 'Incompatible types in assignment (expression has type "None"', - ], - "defer": ['Too many arguments for "refresh_from_db" of "Model"'], - "delete": [ - 'Incompatible type for lookup \'pk\': (got "Optional[int]", expected "Union[str, int]")', - ], - "dispatch": ['Item "str" of "Union[ValueError, str]" has no attribute "args"'], - "deprecation": ['"Manager" has no attribute "old"', '"Manager" has no attribute "new"'], - "db_functions": [ - '"FloatModel" has no attribute', - 'Incompatible types in assignment (expression has type "Optional[Any]", variable has type "FloatModel")', - ], - "decorators": [ - '"Type[object]" has no attribute "method"', - 'Value of type variable "_T" of function cannot be "descriptor_wrapper"', - ], - "expressions_window": ['has incompatible type "str"'], - "file_uploads": [ - 'has no attribute "content_type"', - ], - "file_storage": [ - 'Incompatible types in assignment (expression has type "None", variable has type "str")', - 'Property "base_url" defined in "FileSystemStorage" is read-only', - ], - "files": [ - 'Incompatible types in assignment (expression has type "IOBase", variable has type "File")', - 'Argument 1 to "TextIOWrapper" has incompatible type "File"; expected "BinaryIO"', - 'Incompatible types in assignment (expression has type "BinaryIO", variable has type "File")', - ], - "filtered_relation": [ - 'has no attribute "name"', - ], - "fixtures": [ - 'Incompatible types in assignment (expression has type "int", target has type "Iterable[str]")', - 'Incompatible types in assignment (expression has type "SpyManager[Spy]"', - ], - "fixtures_regress": [ - 'Unsupported left operand type for + ("None")', - ], - "from_db_value": [ - '"Cash" has no attribute', - '"__str__" of "Decimal"', - ], - "get_object_or_404": [ - 'Argument 1 to "get_object_or_404" has incompatible type "str"; ' - + 'expected "Union[Type[], QuerySet[]]"', - 'Argument 1 to "get_list_or_404" has incompatible type "List[Type[Article]]"; ' - + 'expected "Union[Type[], QuerySet[]]"', - "CustomClass", - ], - "generic_relations": [ - "Cannot resolve keyword 'vegetable' into field", - ], - "generic_relations_regress": [ - '"Link" has no attribute', - ], - "httpwrappers": [ - 'Argument 2 to "appendlist" of "QueryDict"', - 'Incompatible types in assignment (expression has type "int", target has type "Union[str, List[str]]")', - 'Argument 1 to "fromkeys" of "QueryDict" has incompatible type "int"', - ], - "humanize_tests": [ - 'Argument 1 to "append" of "list" has incompatible type "None"; expected "str"', - ], - "lookup": [ - 'Unexpected keyword argument "headline__startswith" for "in_bulk" of', - "is called with more than one field", - "Cannot resolve keyword 'pub_date_year' into field", - "Cannot resolve keyword 'blahblah' into field", - ], - "logging_tests": [ - re.compile(r'Argument [0-9] to "makeRecord" of "Logger"'), - '"LogRecord" has no attribute "request"', - ], - "m2m_regress": [ - "Cannot resolve keyword 'porcupine' into field", - 'Argument 1 to "set" of "RelatedManager" has incompatible type "int"', - ], - "mail": [ - 'List item 1 has incompatible type "None"; expected "str"', - "Incompatible types in assignment " - + '(expression has type "bool", variable has type "Union[SMTP_SSL, SMTP, None]")', - ], - "messages_tests": [ - 'List item 0 has incompatible type "Dict[str, Message]"; expected "Message"', - "Too many arguments", - "CustomRequest", - ], - "middleware": [ - re.compile(r'"(HttpRequest|WSGIRequest)" has no attribute'), - 'Incompatible types in assignment (expression has type "HttpResponseBase", variable has type "HttpResponse")', - ], - "many_to_many": [ - '(expression has type "List[Article]", variable has type "Article_RelatedManager2', - '"add" of "RelatedManager" has incompatible type "Article"; expected "Union[Publication, int]"', - ], - "many_to_one": [ - 'Incompatible type for "parent" of "Child" (got "None", expected "Union[Parent, Combinable]")', - 'Incompatible type for "parent" of "Child" (got "Child", expected "Union[Parent, Combinable]")', - 'expression has type "List[]", variable has type "RelatedManager[Article]"', - '"Reporter" has no attribute "cached_query"', - 'to "add" of "RelatedManager" has incompatible type "Reporter"; expected "Union[Article, int]"', - ], - "middleware_exceptions": [ - 'Argument 1 to "append" of "list" has incompatible type "Tuple[Any, Any]"; expected "str"' - ], - "migrate_signals": [ - 'Value of type "Optional[Any]" is not indexable', - 'Argument 1 to "set" has incompatible type "Optional[Any]"; expected "Iterable[Any]"', - ], - "migrations": [ - "FakeMigration", - "FakeLoader", - '"Manager[Any]" has no attribute "args"', - 'Dict entry 0 has incompatible type "Any"', - 'Argument 1 to "append" of "list" has incompatible type', - 'base class "Model" defined the type as "BaseManager[Any]"', - 'Argument 1 to "RunPython" has incompatible type "str"', - ], - "model_fields": [ - 'Item "Field[Any, Any]" of "Union[Field[Any, Any], ForeignObjectRel]" has no attribute', - 'Incompatible types in assignment (expression has type "Type[Person', - 'Incompatible types in assignment (expression has type "FloatModel", variable has type', - '"ImageFile" has no attribute "was_opened"', - 'Incompatible type for "size" of "FloatModel" (got "object", expected "Union[float, int, str, Combinable]")', - 'Incompatible type for "value" of "IntegerModel" (got "object", expected', - '"Child" has no attribute "get_foo_display"', - ], - "model_forms": [ - '"render" of "Widget"', - "Module 'django.core.validators' has no attribute 'ValidationError'", - "Incompatible types in assignment", - "NewForm", - '"type" has no attribute "base_fields"', - 'Argument "instance" to "InvalidModelForm" has incompatible type "Type[Category]"', - ], - "model_indexes": ['Argument "condition" to "Index" has incompatible type "str"; expected "Optional[Q]"'], - "model_inheritance": [ - 'base class "AbstractBase" defined', - 'base class "AbstractModel" defined', - 'Definition of "name" in base class "ConcreteParent"', - ' Definition of "name" in base class "AbstractParent"', - "referent_references", - "Cannot resolve keyword 'attached_comment_set' into field", - ], - "model_meta": ['List item 0 has incompatible type "str"; expected "Union[Field[Any, Any], ForeignObjectRel]"'], - "model_regress": [ - 'Incompatible type for "department" of "Worker"', - '"PickledModel" has no attribute', - '"Department" has no attribute "evaluate"', - "Unsupported target for indexed assignment", - ], - "model_formsets_regress": [ - 'Incompatible types in assignment (expression has type "int", target has type "str")', - ], - "model_options": [ - 'expression has type "Dict[str, Type[Model]]", target has type "OrderedDict', - ], - "model_enums": [ - "'bool' is not a valid base class", - ], - "null_queries": ["Cannot resolve keyword 'foo' into field"], - "order_with_respect_to": [ - '"Dimension" has no attribute "set_component_order"', - ], - "one_to_one": [ - 'expression has type "None", variable has type "UndergroundBar"', - 'Item "OneToOneField[Union[Place, Combinable], Place]" ' - + 'of "Union[OneToOneField[Union[Place, Combinable], Place], Any]"', - ], - "pagination": [ - '"int" not callable', - ], - "postgres_tests": [ - "DummyArrayField", - "DummyJSONField", - 'Incompatible types in assignment (expression has type "Type[Field[Any, Any]]', - 'Argument "encoder" to "JSONField" has incompatible type "DjangoJSONEncoder";', - '("None" and "SearchQuery")', - ], - "properties": [re.compile('Unexpected attribute "(full_name|full_name_2)" for model "Person"')], - "prefetch_related": [ - '"Person" has no attribute "houses_lst"', - '"Book" has no attribute "first_authors"', - '"Book" has no attribute "the_authors"', - 'Incompatible types in assignment (expression has type "List[Room]", variable has type "Manager[Room]")', - 'Item "Room" of "Optional[Room]" has no attribute "house_attr"', - 'Item "Room" of "Optional[Room]" has no attribute "main_room_of_attr"', - 'Argument 2 to "Prefetch" has incompatible type "ValuesQuerySet', - ], - "proxy_models": ["Incompatible types in assignment", 'in base class "User"'], - "queries": [ - 'Incompatible types in assignment (expression has type "None", variable has type "str")', - 'Invalid index type "Optional[str]" for "Dict[str, int]"; expected type "str"', - 'Unsupported operand types for & ("Manager[Author]" and "Manager[Tag]")', - 'Unsupported operand types for | ("Manager[Author]" and "Manager[Tag]")', - "ObjectA", - "'flat' and 'named' can't be used together", - '"Collection[Any]" has no attribute "explain"', - "Cannot resolve keyword 'unknown_field' into field", - 'Incompatible type for lookup \'tag\': (got "str", expected "Union[Tag, int, None]")', - 'No overload variant of "__getitem__" of "QuerySet" matches argument type "str"', - ], - "requests": [ - 'Incompatible types in assignment (expression has type "Dict[str, str]", variable has type "QueryDict")' - ], - "responses": [ - 'Argument 1 to "TextIOWrapper" has incompatible type "HttpResponse"; expected "IO[bytes]"', - '"FileLike" has no attribute "closed"', - 'Argument 1 to "TextIOWrapper" has incompatible type "HttpResponse"; expected "BinaryIO"', - ], - "reverse_lookup": ["Cannot resolve keyword 'choice' into field"], - "settings_tests": ['Argument 1 to "Settings" has incompatible type "Optional[str]"; expected "str"'], - "shortcuts": [ - 'error: "Context" has no attribute "request"', - ], - "signals": ['Argument 1 to "append" of "list" has incompatible type "Tuple[Any, Any, Optional[Any], Any]";'], - "sites_framework": [ - 'expression has type "CurrentSiteManager[CustomArticle]", base class "AbstractArticle"', - "Name 'Optional' is not defined", - ], - "sites_tests": [ - '"RequestSite" of "Union[Site, RequestSite]" has no attribute "id"', - ], - "syndication_tests": [ - 'Argument 1 to "add_domain" has incompatible type "*Tuple[object, ...]"', - ], - "sessions_tests": [ - 'Incompatible types in assignment (expression has type "None", variable has type "int")', - '"AbstractBaseSession" has no attribute', - '"None" not callable', - ], - "select_for_update": ['"Thread" has no attribute "isAlive"'], - "select_related": [ - 'Item "ForeignKey[Union[Genus, Combinable], Genus]" ' - + 'of "Union[ForeignKey[Union[Genus, Combinable], Genus], Any]"' - ], - "select_related_onetoone": [ - 'Incompatible types in assignment (expression has type "Parent2", variable has type "Parent1")', - '"Parent1" has no attribute', - ], - "servers": [ - re.compile('Argument [0-9] to "WSGIRequestHandler"'), - '"HTTPResponse" has no attribute', - '"type" has no attribute', - '"WSGIRequest" has no attribute "makefile"', - "LiveServerAddress", - '"Stub" has no attribute "makefile"', - ], - "serializers": [ - '"Model" has no attribute "data"', - '"Iterable[Any]" has no attribute "content"', - re.compile(r'Argument 1 to "(serialize|deserialize)" has incompatible type "None"; expected "str"'), - ], - "string_lookup": [ - '"Bar" has no attribute "place"', - ], - "test_utils": [ - '"PossessedCar" has no attribute "color"', - 'expression has type "None", variable has type "List[str]"', - ], - "test_client": ['(expression has type "HttpResponse", variable has type "StreamingHttpResponse")'], - "test_client_regress": [ - '(expression has type "Dict[, ]", variable has type "SessionBase")', - 'Unsupported left operand type for + ("None")', - 'Argument 1 to "len" has incompatible type "Context"; expected "Sized"', - ], - "transactions": [ - 'Incompatible types in assignment (expression has type "Thread", variable has type "Callable[[], Any]")' - ], - "urlpatterns": [ - '"object" not callable', - '"None" not callable', - 'Argument 2 to "path" has incompatible type "Callable[[Any], None]"', - 'Incompatible return value type (got "None", expected "HttpResponseBase")', - ], - "urlpatterns_reverse": [ - 'No overload variant of "path" matches argument types "str", "None"', - 'No overload variant of "zip" matches argument types "Any", "object"', - 'Argument 1 to "get_callable" has incompatible type "int"', - ], - "utils_tests": [ - 'Argument 1 to "activate" has incompatible type "None"; expected "Union[tzinfo, str]"', - 'Argument 1 to "activate" has incompatible type "Optional[str]"; expected "str"', - 'Incompatible types in assignment (expression has type "None", base class "object" defined the type as', - "Class", - 'has no attribute "cp"', - 'Argument "name" to "cached_property" has incompatible type "int"; expected "Optional[str]"', - 'has no attribute "sort"', - "Unsupported target for indexed assignment", - 'defined the type as "None"', - 'Argument 1 to "Path" has incompatible type "Optional[str]"', - '"None" not callable', - '"WSGIRequest" has no attribute "process_response_content"', - 'No overload variant of "join" matches argument types "str", "None"', - 'Argument 1 to "Archive" has incompatible type "None"; expected "str"', - 'Argument 1 to "to_path" has incompatible type "int"; expected "Union[Path, str]"', - 'Cannot infer type argument 1 of "cached_property"', - ], - "view_tests": [ - "Module 'django.views.debug' has no attribute 'Path'", - 'Value of type "Optional[List[str]]" is not indexable', - "ExceptionUser", - "view_tests.tests.test_debug.User", - "Exception must be derived from BaseException", - "No binding for nonlocal 'tb_frames' found", - ], - "validation": [ - 'has no attribute "name"', - ], - "wsgi": [ - '"HttpResponse" has no attribute "block_size"', - ], -} - - -def check_if_custom_ignores_are_covered_by_common() -> None: - from scripts.typecheck_tests import is_pattern_fits - - common_ignore_patterns = IGNORED_ERRORS["__common__"] - for module_name, patterns in IGNORED_ERRORS.items(): - if module_name == "__common__": - continue - for pattern in patterns: - for common_pattern in common_ignore_patterns: - if isinstance(pattern, str) and is_pattern_fits(common_pattern, pattern): - print(f'pattern "{module_name}: {pattern!r}" is covered by pattern {common_pattern!r}') - - -check_if_custom_ignores_are_covered_by_common() diff --git a/scripts/git_helpers.py b/scripts/git_helpers.py deleted file mode 100644 index a6bee59ea..000000000 --- a/scripts/git_helpers.py +++ /dev/null @@ -1,31 +0,0 @@ -import shutil -from typing import Optional - -from git import RemoteProgress, Repo - -from scripts.paths import DJANGO_SOURCE_DIRECTORY - - -class ProgressPrinter(RemoteProgress): - def line_dropped(self, line: str) -> None: - print(line) - - def update(self, op_code, cur_count, max_count=None, message=""): - print(self._cur_line) - - -def checkout_django_branch(django_version: str, commit_sha: Optional[str]) -> Repo: - branch = f"stable/{django_version}.x" - if DJANGO_SOURCE_DIRECTORY.exists(): - shutil.rmtree(DJANGO_SOURCE_DIRECTORY) - DJANGO_SOURCE_DIRECTORY.mkdir(exist_ok=True, parents=False) - repo = Repo.clone_from( - "https://github.com/django/django.git", - DJANGO_SOURCE_DIRECTORY, - progress=ProgressPrinter(), - branch=branch, - depth=100, - ) - if commit_sha and repo.head.commit.hexsha != commit_sha: - repo.remote("origin").fetch(branch, progress=ProgressPrinter(), depth=100) - repo.git.checkout(commit_sha) diff --git a/scripts/paths.py b/scripts/paths.py deleted file mode 100644 index 3e98cb8ac..000000000 --- a/scripts/paths.py +++ /dev/null @@ -1,4 +0,0 @@ -from pathlib import Path - -PROJECT_DIRECTORY = Path(__file__).parent.parent -DJANGO_SOURCE_DIRECTORY = PROJECT_DIRECTORY / "django-source" # type: Path diff --git a/scripts/stubgen-django.py b/scripts/stubgen-django.py deleted file mode 100644 index 226cc230c..000000000 --- a/scripts/stubgen-django.py +++ /dev/null @@ -1,15 +0,0 @@ -from argparse import ArgumentParser - -from mypy.stubgen import generate_stubs, parse_options - -from scripts.git_helpers import checkout_django_branch -from scripts.paths import DJANGO_SOURCE_DIRECTORY - -if __name__ == "__main__": - parser = ArgumentParser() - parser.add_argument("--django_version", required=True) - parser.add_argument("--commit_sha", required=False) - args = parser.parse_args() - checkout_django_branch(args.django_version, args.commit_sha) - stubgen_options = parse_options([f"{DJANGO_SOURCE_DIRECTORY}", "-o=stubgen"]) - generate_stubs(stubgen_options) diff --git a/scripts/tests_extension_hook.py b/scripts/tests_extension_hook.py deleted file mode 100644 index 21b1786c4..000000000 --- a/scripts/tests_extension_hook.py +++ /dev/null @@ -1,29 +0,0 @@ -from pytest_mypy_plugins.collect import File -from pytest_mypy_plugins.item import YamlTestItem - - -def django_plugin_hook(test_item: YamlTestItem) -> None: - custom_settings = test_item.parsed_test_data.get("custom_settings", "") - installed_apps = test_item.parsed_test_data.get("installed_apps", None) - - if installed_apps and custom_settings: - raise ValueError('"installed_apps" and "custom_settings" are not compatible, please use one or the other') - - if installed_apps is not None: - # custom_settings is empty, add INSTALLED_APPS - installed_apps += ["django.contrib.contenttypes"] - installed_apps_as_str = "(" + ",".join([repr(app) for app in installed_apps]) + ",)" - custom_settings += "INSTALLED_APPS = " + installed_apps_as_str - - if "SECRET_KEY" not in custom_settings: - custom_settings = 'SECRET_KEY = "1"\n' + custom_settings - - django_settings_section = "\n[mypy.plugins.django-stubs]\n" "django_settings_module = mysettings" - if not test_item.additional_mypy_config: - test_item.additional_mypy_config = django_settings_section - else: - if "[mypy.plugins.django-stubs]" not in test_item.additional_mypy_config: - test_item.additional_mypy_config += django_settings_section - - mysettings_file = File(path="mysettings.py", content=custom_settings) - test_item.files.append(mysettings_file) diff --git a/scripts/typecheck_tests.py b/scripts/typecheck_tests.py deleted file mode 100644 index dd4358f86..000000000 --- a/scripts/typecheck_tests.py +++ /dev/null @@ -1,117 +0,0 @@ -import itertools -import shutil -import subprocess -import sys -from argparse import ArgumentParser -from collections import defaultdict -from distutils import spawn -from typing import Dict, List, Pattern, Union - -from scripts.enabled_test_modules import EXTERNAL_MODULES, IGNORED_ERRORS, IGNORED_MODULES, MOCK_OBJECTS -from scripts.git_helpers import checkout_django_branch -from scripts.paths import DJANGO_SOURCE_DIRECTORY, PROJECT_DIRECTORY - -DJANGO_COMMIT_REFS: Dict[str, str] = { - "2.2": "8093aaa8ff9dd7386a069c6eb49fcc1c5980c033", - "3.0": "44da7abda848f05caaed74f6a749038c87dedfda", -} - - -def get_unused_ignores(ignored_message_freq: Dict[str, Dict[Union[str, Pattern], int]]) -> List[str]: - unused_ignores = [] - for root_key, patterns in IGNORED_ERRORS.items(): - for pattern in patterns: - if ignored_message_freq[root_key][pattern] == 0 and pattern not in itertools.chain( - EXTERNAL_MODULES, MOCK_OBJECTS - ): - unused_ignores.append(f"{root_key}: {pattern}") - return unused_ignores - - -def is_pattern_fits(pattern: Union[Pattern, str], line: str): - if isinstance(pattern, Pattern): - if pattern.search(line): - return True - else: - if pattern in line: - return True - return False - - -def is_ignored(line: str, test_folder_name: str, *, ignored_message_freqs: Dict[str, Dict[str, int]]) -> bool: - if "runtests" in line: - return True - - if test_folder_name in IGNORED_MODULES: - return True - - for pattern in IGNORED_ERRORS.get(test_folder_name, []): - if is_pattern_fits(pattern, line): - ignored_message_freqs[test_folder_name][pattern] += 1 - return True - - for pattern in IGNORED_ERRORS["__common__"]: - if is_pattern_fits(pattern, line): - ignored_message_freqs["__common__"][pattern] += 1 - return True - - return False - - -if __name__ == "__main__": - parser = ArgumentParser() - parser.add_argument("--django_version", default="3.0") - django_version = parser.parse_args().django_version - subprocess.check_call([sys.executable, "-m", "pip", "install", f"Django=={django_version}.*"]) - commit_sha = DJANGO_COMMIT_REFS[django_version] - repo = checkout_django_branch(django_version, commit_sha) - mypy_config_file = (PROJECT_DIRECTORY / "mypy.ini").absolute() - mypy_cache_dir = PROJECT_DIRECTORY / ".mypy_cache" - tests_root = DJANGO_SOURCE_DIRECTORY / "tests" - global_rc = 0 - - try: - mypy_options = [ - "--cache-dir", - str(mypy_cache_dir), - "--config-file", - str(mypy_config_file), - "--show-traceback", - "--no-error-summary", - "--hide-error-context", - ] - mypy_options += [str(tests_root)] - mypy_executable = spawn.find_executable("mypy") - mypy_argv = [mypy_executable, *mypy_options] - completed = subprocess.run( - mypy_argv, - env={"PYTHONPATH": str(tests_root), "TYPECHECK_TESTS": "1"}, - stdout=subprocess.PIPE, - stderr=subprocess.STDOUT, - ) - output = completed.stdout.decode() - - ignored_message_freqs = defaultdict(lambda: defaultdict(int)) - - sorted_lines = sorted(output.splitlines()) - for line in sorted_lines: - try: - path_to_error = line.split(":")[0] - test_folder_name = path_to_error.split("/")[2] - except IndexError: - test_folder_name = "unknown" - - if not is_ignored(line, test_folder_name, ignored_message_freqs=ignored_message_freqs): - global_rc = 1 - print(line) - - unused_ignores = get_unused_ignores(ignored_message_freqs) - if unused_ignores: - print("UNUSED IGNORES ------------------------------------------------") - print("\n".join(unused_ignores)) - - sys.exit(global_rc) - - except BaseException as exc: - shutil.rmtree(mypy_cache_dir, ignore_errors=True) - raise exc diff --git a/setup.py b/setup.py index 7af09bd68..08624a8d4 100644 --- a/setup.py +++ b/setup.py @@ -1,4 +1,4 @@ -from setuptools import find_packages +from setuptools import setup # This allows for the pip install -e . to work so that mypy can check the types # of the examples. Since the stubs aren't using valid python package names, diff --git a/tests/test_error_handling.py b/tests/test_error_handling.py deleted file mode 100644 index 1d02ce96a..000000000 --- a/tests/test_error_handling.py +++ /dev/null @@ -1,72 +0,0 @@ -import tempfile -import typing - -import pytest - -from mypy_django_plugin.main import extract_django_settings_module - -TEMPLATE = """usage: (config) -... -[mypy.plugins.django_stubs] - django_settings_module: str (required) -... -(django-stubs) mypy: error: 'django_settings_module' is not set: {} -""" - - -@pytest.mark.parametrize( - "config_file_contents,message_part", - [ - pytest.param( - None, - "mypy config file is not specified or found", - id="missing-file", - ), - pytest.param( - ["[not-really-django-stubs]"], - "no section [mypy.plugins.django-stubs]", - id="missing-section", - ), - pytest.param( - ["[mypy.plugins.django-stubs]", "\tnot_django_not_settings_module = badbadmodule"], - "the setting is not provided", - id="missing-settings-module", - ), - pytest.param( - ["[mypy.plugins.django-stubs]"], - "the setting is not provided", - id="no-settings-given", - ), - ], -) -def test_misconfiguration_handling(capsys, config_file_contents, message_part): - # type: (typing.Any, typing.List[str], str) -> None - """Invalid configuration raises `SystemExit` with a precise error message.""" - with tempfile.NamedTemporaryFile(mode="w+") as config_file: - if not config_file_contents: - config_file.close() - else: - config_file.write("\n".join(config_file_contents).expandtabs(4)) - config_file.seek(0) - - with pytest.raises(SystemExit, match="2"): - extract_django_settings_module(config_file.name) - - error_message = TEMPLATE.format(message_part) - assert error_message == capsys.readouterr().err - - -def test_correct_configuration() -> None: - """Django settings module gets extracted given valid configuration.""" - config_file_contents = [ - "[mypy.plugins.django-stubs]", - "\tsome_other_setting = setting", - "\tdjango_settings_module = my.module", - ] - with tempfile.NamedTemporaryFile(mode="w+") as config_file: - config_file.write("\n".join(config_file_contents).expandtabs(4)) - config_file.seek(0) - - extracted = extract_django_settings_module(config_file.name) - - assert extracted == "my.module" diff --git a/tests/typecheck/contrib/admin/test_options.yml b/tests/typecheck/contrib/admin/test_options.yml deleted file mode 100644 index aa205cd6a..000000000 --- a/tests/typecheck/contrib/admin/test_options.yml +++ /dev/null @@ -1,148 +0,0 @@ -# "Happy path" test for model admin, trying to cover as many valid -# configurations as possible. -- case: test_full_admin - main: | - from django.contrib import admin - from django.forms import Form, Textarea - from django.db import models - from django.core.paginator import Paginator - from django.contrib.admin.sites import AdminSite - from django.db.models.options import Options - from django.http.request import HttpRequest - from django.db.models.query import QuerySet - - def an_action(modeladmin: admin.ModelAdmin, request: HttpRequest, queryset: QuerySet) -> None: - pass - - class TestModel(models.Model): - pass - - class A(admin.ModelAdmin[TestModel]): - # BaseModelAdmin - autocomplete_fields = ("strs",) - raw_id_fields = ["strs"] - fields = ( - "a field", - ["a", "list of", "fields"], - ) - exclude = ("a", "b") - fieldsets = [ - (None, {"fields": ["a", "b"]}), - ("group", {"fields": ("c",), "classes": ("a",), "description": "foo"}), - ] - form = Form - filter_vertical = ("fields",) - filter_horizontal = ("plenty", "of", "fields") - radio_fields = { - "some_field": admin.VERTICAL, - "another_field": admin.HORIZONTAL, - } - prepopulated_fields = {"slug": ("title",)} - formfield_overrides = {models.TextField: {"widget": Textarea}} - readonly_fields = ("date_modified",) - ordering = ("-pk", "date_modified") - sortable_by = ["pk"] - view_on_site = True - show_full_result_count = False - - # ModelAdmin - list_display = ("pk",) - list_display_links = ("str",) - list_filter = ("str", admin.SimpleListFilter, ("str", admin.SimpleListFilter)) - list_select_related = True - list_per_page = 1 - list_max_show_all = 2 - list_editable = ("a", "b") - search_fields = ("c", "d") - date_hirearchy = "f" - save_as = False - save_as_continue = True - save_on_top = False - paginator = Paginator - presserve_filters = False - inlines = (admin.TabularInline, admin.StackedInline) - add_form_template = "template" - change_form_template = "template" - change_list_template = "template" - delete_confirmation_template = "template" - delete_selected_confirmation_template = "template" - object_history_template = "template" - popup_response_template = "template" - actions = (an_action, "a_method_action") - actions_on_top = True - actions_on_bottom = False - actions_selection_counter = True - admin_site = AdminSite() - - # test generic ModelAdmin - # https://github.com/typeddjango/django-stubs/pull/504 - # this will fail if `model` has a type other than the generic specified in the class declaration - model = TestModel - - def a_method_action(self, request, queryset): - pass - -# This test is here to make sure we're not running into a mypy issue which is -# worked around using a somewhat complicated _ListOrTuple union type. Once the -# issue is solved upstream this test should pass even with the workaround -# replaced by a simpler Sequence type. -# https://github.com/python/mypy/issues/8921 -- case: test_fieldset_workaround_regression - main: | - from django.contrib import admin - - class A(admin.ModelAdmin): - fieldsets = ( - (None, { - 'fields': ('name',), - }), - ) -- case: errors_on_omitting_fields_from_fieldset_opts - main: | - from django.contrib import admin - - class A(admin.ModelAdmin): - fieldsets = [ # type: ignore - (None, {}), # E: Key 'fields' missing for TypedDict "_FieldOpts" - ] -- case: errors_on_invalid_radio_fields - main: | - from django.contrib import admin - - class A(admin.ModelAdmin): - radio_fields = {"some_field": 0} # E: Dict entry 0 has incompatible type "str": "Literal[0]"; expected "str": "Union[Literal[1], Literal[2]]" - - class B(admin.ModelAdmin): - radio_fields = {1: admin.VERTICAL} # E: Dict entry 0 has incompatible type "int": "Literal[2]"; expected "str": "Union[Literal[1], Literal[2]]" -- case: errors_for_invalid_formfield_overrides - main: | - from django.contrib import admin - from django.forms import Textarea - - class A(admin.ModelAdmin): - formfield_overrides = { - "not a field": { # E: Dict entry 0 has incompatible type "str": "Dict[str, Any]"; expected "Type[Field[Any, Any]]": "Mapping[str, Any]" - "widget": Textarea - } - } -- case: errors_for_invalid_action_signature - main: | - from django.contrib import admin - from django.http.request import HttpRequest - from django.db.models.query import QuerySet - - def an_action(modeladmin: None) -> None: - pass - - class A(admin.ModelAdmin): - actions = [an_action] # E: List item 0 has incompatible type "Callable[[None], None]"; expected "Union[Callable[[ModelAdmin[Any], HttpRequest, QuerySet[Any]], None], str]" -- case: errors_for_invalid_model_admin_generic - main: | - from django.contrib.admin import ModelAdmin - from django.db.models import Model - - class TestModel(Model): - pass - - class A(ModelAdmin[TestModel]): - model = int # E: Incompatible types in assignment (expression has type "Type[int]", base class "ModelAdmin" defined the type as "Type[TestModel]") diff --git a/tests/typecheck/contrib/auth/test_decorators.yml b/tests/typecheck/contrib/auth/test_decorators.yml deleted file mode 100644 index 616e007a4..000000000 --- a/tests/typecheck/contrib/auth/test_decorators.yml +++ /dev/null @@ -1,43 +0,0 @@ -- case: login_required_bare - main: | - from django.contrib.auth.decorators import login_required - @login_required - def view_func(request): ... - reveal_type(view_func) # N: Revealed type is 'def (request: Any) -> Any' -- case: login_required_fancy - main: | - from django.contrib.auth.decorators import login_required - from django.core.handlers.wsgi import WSGIRequest - from django.http import HttpResponse - @login_required(redirect_field_name='a', login_url='b') - def view_func(request: WSGIRequest, arg: str) -> HttpResponse: ... - reveal_type(view_func) # N: Revealed type is 'def (request: django.core.handlers.wsgi.WSGIRequest, arg: builtins.str) -> django.http.response.HttpResponse' -- case: login_required_weird - main: | - from django.contrib.auth.decorators import login_required - # This is non-conventional usage, but covered in Django tests, so we allow it. - def view_func(request): ... - wrapped_view = login_required(view_func, redirect_field_name='a', login_url='b') - reveal_type(wrapped_view) # N: Revealed type is 'def (request: Any) -> Any' -- case: login_required_incorrect_return - main: | - from django.contrib.auth.decorators import login_required - @login_required() # E: Value of type variable "_VIEW" of function cannot be "Callable[[Any], str]" - def view_func2(request) -> str: ... -- case: user_passes_test - main: | - from django.contrib.auth.decorators import user_passes_test - @user_passes_test(lambda u: u.username.startswith('super')) - def view_func(request): ... - reveal_type(view_func) # N: Revealed type is 'def (request: Any) -> Any' -- case: user_passes_test_bare_is_error - main: | - from django.http.response import HttpResponse - from django.contrib.auth.decorators import user_passes_test - @user_passes_test # E: Argument 1 to "user_passes_test" has incompatible type "Callable[[Any], HttpResponse]"; expected "Callable[[AbstractUser], bool]" - def view_func(request) -> HttpResponse: ... -- case: permission_required - main: | - from django.contrib.auth.decorators import permission_required - @permission_required('polls.can_vote') - def view_func(request): ... diff --git a/tests/typecheck/contrib/auth/test_misc.yml b/tests/typecheck/contrib/auth/test_misc.yml deleted file mode 100644 index b9207ceee..000000000 --- a/tests/typecheck/contrib/auth/test_misc.yml +++ /dev/null @@ -1,15 +0,0 @@ -- case: test_request_session - main: | - from django.contrib.auth import get_user - from django.contrib.sessions.middleware import SessionMiddleware - from django.http import HttpRequest - - request = HttpRequest() - SessionMiddleware().process_request(request) - get_user(request) -- case: test_client_session - main: | - from django.contrib.auth import get_user - from django.test import Client - - get_user(Client()) diff --git a/tests/typecheck/db/models/test_init.yml b/tests/typecheck/db/models/test_init.yml deleted file mode 100644 index afa5b5f4b..000000000 --- a/tests/typecheck/db/models/test_init.yml +++ /dev/null @@ -1,26 +0,0 @@ -- case: field_to_many_and_to_one_attrs_bool_or_none_in_field_base_class - main: | - from django.db.models import Field - - field: Field - my_bool: bool - - my_bool = field.one_to_many - my_bool = field.one_to_one - my_bool = field.many_to_many - my_bool = field.many_to_one - - # Narrowing the types should give us bool - assert field.one_to_many is not None - my_bool = field.one_to_many - assert field.one_to_one is not None - my_bool = field.one_to_one - assert field.many_to_many is not None - my_bool = field.many_to_many - assert field.many_to_one is not None - my_bool = field.many_to_one - out: | - main:6: error: Incompatible types in assignment (expression has type "Optional[bool]", variable has type "bool") - main:7: error: Incompatible types in assignment (expression has type "Optional[bool]", variable has type "bool") - main:8: error: Incompatible types in assignment (expression has type "Optional[bool]", variable has type "bool") - main:9: error: Incompatible types in assignment (expression has type "Optional[bool]", variable has type "bool") diff --git a/tests/typecheck/db/test_transaction.yml b/tests/typecheck/db/test_transaction.yml deleted file mode 100644 index 446dfc427..000000000 --- a/tests/typecheck/db/test_transaction.yml +++ /dev/null @@ -1,28 +0,0 @@ -- case: atomic_bare - main: | - from django.db.transaction import atomic - @atomic - def func(x: int) -> list: ... - reveal_type(func) # N: Revealed type is 'def (x: builtins.int) -> builtins.list[Any]' -- case: atomic_args - main: | - from django.db.transaction import atomic - @atomic(using='bla', savepoint=False) - def func(x: int) -> list: ... - reveal_type(func) # N: Revealed type is 'def (x: builtins.int) -> builtins.list[Any]' -- case: non_atomic_requests_bare - main: | - from django.db.transaction import non_atomic_requests - @non_atomic_requests - def view_func(request): ... - reveal_type(view_func) # N: Revealed type is 'def (request: Any) -> Any' - -- case: non_atomic_requests_args - main: | - from django.http.request import HttpRequest - from django.http.response import HttpResponse - from django.db.transaction import non_atomic_requests - @non_atomic_requests - def view_func(request: HttpRequest, arg: str) -> HttpResponse: ... - reveal_type(view_func) # N: Revealed type is 'def (request: django.http.request.HttpRequest, arg: builtins.str) -> django.http.response.HttpResponse' - diff --git a/tests/typecheck/fields/test_base.yml b/tests/typecheck/fields/test_base.yml deleted file mode 100644 index 48ce577e2..000000000 --- a/tests/typecheck/fields/test_base.yml +++ /dev/null @@ -1,153 +0,0 @@ -- case: test_model_fields_classes_present_as_primitives - main: | - from myapp.models import User - user = User(small_int=1, name='user', slug='user', text='user') - reveal_type(user.id) # N: Revealed type is 'builtins.int*' - reveal_type(user.small_int) # N: Revealed type is 'builtins.int*' - reveal_type(user.name) # N: Revealed type is 'builtins.str*' - reveal_type(user.slug) # N: Revealed type is 'builtins.str*' - reveal_type(user.text) # N: Revealed type is 'builtins.str*' - installed_apps: - - myapp - files: - - path: myapp/__init__.py - - path: myapp/models.py - content: | - from django.db import models - class User(models.Model): - id = models.AutoField(primary_key=True) - small_int = models.SmallIntegerField() - name = models.CharField(max_length=255) - slug = models.SlugField(max_length=255) - text = models.TextField() - -- case: test_model_field_classes_from_existing_locations - main: | - from myapp.models import Booking - booking = Booking() - reveal_type(booking.id) # N: Revealed type is 'builtins.int*' - reveal_type(booking.time_range) # N: Revealed type is 'Any' - reveal_type(booking.some_decimal) # N: Revealed type is 'decimal.Decimal*' - installed_apps: - - myapp - files: - - path: myapp/__init__.py - - path: myapp/models.py - content: | - from django.db import models - from django.contrib.postgres import fields as pg_fields - from decimal import Decimal - - class Booking(models.Model): - id = models.AutoField(primary_key=True) - time_range = pg_fields.DateTimeRangeField(null=False) - some_decimal = models.DecimalField(max_digits=10, decimal_places=5) - -- case: test_add_id_field_if_no_primary_key_defined - disable_cache: true - main: | - from myapp.models import User - reveal_type(User().id) # N: Revealed type is 'builtins.int*' - installed_apps: - - myapp - files: - - path: myapp/__init__.py - - path: myapp/models.py - content: | - from django.db import models - class User(models.Model): - pass - -- case: test_do_not_add_id_if_field_with_primary_key_True_defined - disable_cache: true - main: | - from myapp.models import User - reveal_type(User().my_pk) # N: Revealed type is 'builtins.int*' - reveal_type(User().id) - out: | - main:3: note: Revealed type is 'Any' - main:3: error: "User" has no attribute "id" - installed_apps: - - myapp - files: - - path: myapp/__init__.py - - path: myapp/models.py - content: | - from django.db import models - class User(models.Model): - my_pk = models.IntegerField(primary_key=True) - -- case: blank_and_null_char_field_allows_none - main: | - from myapp.models import MyModel - MyModel(nulltext="") - MyModel(nulltext=None) - MyModel().nulltext=None - reveal_type(MyModel().nulltext) # N: Revealed type is 'Union[builtins.str, None]' - installed_apps: - - myapp - files: - - path: myapp/__init__.py - - path: myapp/models.py - content: | - from django.db import models - class MyModel(models.Model): - nulltext=models.CharField(max_length=1, blank=True, null=True) - -- case: blank_and_not_null_charfield_does_not_allow_none - main: | - from myapp.models import MyModel - MyModel(notnulltext=None) # Should allow None in constructor - MyModel(notnulltext="") - MyModel().notnulltext = None # E: Incompatible types in assignment (expression has type "None", variable has type "Union[str, int, Combinable]") - reveal_type(MyModel().notnulltext) # N: Revealed type is 'builtins.str*' - installed_apps: - - myapp - files: - - path: myapp/__init__.py - - path: myapp/models.py - content: | - from django.db import models - class MyModel(models.Model): - notnulltext=models.CharField(max_length=1, blank=True, null=False) - -- case: if_field_called_on_class_return_field_itself - main: | - from myapp.models import MyUser - reveal_type(MyUser.name) # N: Revealed type is 'django.db.models.fields.CharField[Union[builtins.str, builtins.int, django.db.models.expressions.Combinable], builtins.str]' - installed_apps: - - myapp - files: - - path: myapp/__init__.py - - path: myapp/models.py - content: | - from django.db import models - class MyUser(models.Model): - name = models.CharField(max_length=100) - -- case: fields_on_non_model_classes_resolve_to_field_type - main: | - from django.db import models - class MyClass: - myfield: models.IntegerField[int, int] - reveal_type(MyClass.myfield) # N: Revealed type is 'django.db.models.fields.IntegerField[builtins.int, builtins.int]' - reveal_type(MyClass().myfield) # N: Revealed type is 'django.db.models.fields.IntegerField[builtins.int, builtins.int]' - -- case: fields_inside_mixins_used_in_model_subclasses_resolved_as_primitives - main: | - from myapp.models import MyModel, AuthMixin - reveal_type(MyModel().username) # N: Revealed type is 'builtins.str*' - installed_apps: - - myapp - files: - - path: myapp/__init__.py - - path: myapp/models.py - content: | - from django.db import models - class AuthMixin(models.Model): - class Meta: - abstract = True - username = models.CharField(max_length=100) - - class MyModel(AuthMixin, models.Model): - pass \ No newline at end of file diff --git a/tests/typecheck/fields/test_generic_foreign_key.yml b/tests/typecheck/fields/test_generic_foreign_key.yml deleted file mode 100644 index d0979a841..000000000 --- a/tests/typecheck/fields/test_generic_foreign_key.yml +++ /dev/null @@ -1,21 +0,0 @@ -- case: generic_foreign_key_could_point_to_any_model_and_is_always_optional - main: | - from myapp.models import Tag, User - myuser = User() - Tag(content_object=None) - Tag(content_object=myuser) - Tag.objects.create(content_object=None) - Tag.objects.create(content_object=myuser) - reveal_type(Tag().content_object) # N: Revealed type is 'Union[Any, None]' - installed_apps: - - myapp - files: - - path: myapp/__init__.py - - path: myapp/models.py - content: | - from django.db import models - from django.contrib.contenttypes import fields - class User(models.Model): - pass - class Tag(models.Model): - content_object = fields.GenericForeignKey() \ No newline at end of file diff --git a/tests/typecheck/fields/test_nullable.yml b/tests/typecheck/fields/test_nullable.yml deleted file mode 100644 index e1430016a..000000000 --- a/tests/typecheck/fields/test_nullable.yml +++ /dev/null @@ -1,70 +0,0 @@ -- case: nullable_field_with_strict_optional_true - main: | - from myapp.models import MyModel - reveal_type(MyModel().text) # N: Revealed type is 'builtins.str*' - reveal_type(MyModel().text_nullable) # N: Revealed type is 'Union[builtins.str, None]' - MyModel().text = None # E: Incompatible types in assignment (expression has type "None", variable has type "Union[str, int, Combinable]") - MyModel().text_nullable = None - installed_apps: - - myapp - files: - - path: myapp/__init__.py - - path: myapp/models.py - content: | - from django.db import models - class MyModel(models.Model): - text_nullable = models.CharField(max_length=100, null=True) - text = models.CharField(max_length=100) - -- case: nullable_array_field - main: | - from myapp.models import MyModel - reveal_type(MyModel().lst) # N: Revealed type is 'Union[builtins.list[builtins.str], None]' - installed_apps: - - myapp - files: - - path: myapp/__init__.py - - path: myapp/models.py - content: | - from django.db import models - from django.contrib.postgres.fields import ArrayField - - class MyModel(models.Model): - lst = ArrayField(base_field=models.CharField(max_length=100), null=True) - -- case: nullable_foreign_key - main: | - from myapp.models import Publisher, Book - reveal_type(Book().publisher) # N: Revealed type is 'Union[myapp.models.Publisher, None]' - Book().publisher = 11 # E: Incompatible types in assignment (expression has type "int", variable has type "Union[Publisher, Combinable, None]") - installed_apps: - - myapp - files: - - path: myapp/__init__.py - - path: myapp/models.py - content: | - from django.db import models - - class Publisher(models.Model): - pass - class Book(models.Model): - publisher = models.ForeignKey(to=Publisher, on_delete=models.CASCADE, null=True) - -- case: nullable_self_foreign_key - main: | - from myapp.models import Inventory - parent = Inventory() - core = Inventory(parent_id=parent.id) - reveal_type(core.parent_id) # N: Revealed type is 'Union[builtins.int, None]' - reveal_type(core.parent) # N: Revealed type is 'Union[myapp.models.Inventory, None]' - Inventory(parent=None) - Inventory(parent_id=None) - installed_apps: - - myapp - files: - - path: myapp/__init__.py - - path: myapp/models.py - content: | - from django.db import models - class Inventory(models.Model): - parent = models.ForeignKey('self', on_delete=models.SET_NULL, null=True) diff --git a/tests/typecheck/fields/test_postgres_fields.yml b/tests/typecheck/fields/test_postgres_fields.yml deleted file mode 100644 index 2d2c0022f..000000000 --- a/tests/typecheck/fields/test_postgres_fields.yml +++ /dev/null @@ -1,35 +0,0 @@ -- case: array_field_descriptor_access - main: | - from myapp.models import User - user = User(array=[]) - reveal_type(user.array) # N: Revealed type is 'builtins.list*[Any]' - installed_apps: - - myapp - files: - - path: myapp/__init__.py - - path: myapp/models.py - content: | - from django.db import models - from django.contrib.postgres.fields import ArrayField - - class User(models.Model): - array = ArrayField(base_field=models.Field()) - -- case: array_field_base_field_parsed_into_generic_typevar - main: | - from myapp.models import User - user = User() - reveal_type(user.members) # N: Revealed type is 'builtins.list*[builtins.int]' - reveal_type(user.members_as_text) # N: Revealed type is 'builtins.list*[builtins.str]' - installed_apps: - - myapp - files: - - path: myapp/__init__.py - - path: myapp/models.py - content: | - from django.db import models - from django.contrib.postgres.fields import ArrayField - - class User(models.Model): - members = ArrayField(base_field=models.IntegerField()) - members_as_text = ArrayField(base_field=models.CharField(max_length=255)) diff --git a/tests/typecheck/fields/test_related.yml b/tests/typecheck/fields/test_related.yml deleted file mode 100644 index 0a79d19b5..000000000 --- a/tests/typecheck/fields/test_related.yml +++ /dev/null @@ -1,674 +0,0 @@ -- case: test_foreign_key_field_with_related_name - main: | - from myapp.models import Book, Publisher - book = Book() - reveal_type(book.publisher) # N: Revealed type is 'myapp.models.Publisher*' - publisher = Publisher() - reveal_type(publisher.books) # N: Revealed type is 'django.db.models.manager.RelatedManager[myapp.models.Book]' - installed_apps: - - myapp - files: - - path: myapp/__init__.py - - path: myapp/models.py - content: | - from django.db import models - class Publisher(models.Model): - pass - class Book(models.Model): - publisher = models.ForeignKey(to=Publisher, on_delete=models.CASCADE, - related_name='books') - -- case: foreign_key_field_creates_attribute_with_underscore_id - main: | - from myapp.models import Book - book = Book() - reveal_type(book.publisher_id) # N: Revealed type is 'builtins.int*' - reveal_type(book.owner_id) # N: Revealed type is 'builtins.int*' - installed_apps: - - django.contrib.auth - - myapp - files: - - path: myapp/__init__.py - - path: myapp/models.py - content: | - from django.db import models - class Publisher(models.Model): - pass - class Book(models.Model): - publisher = models.ForeignKey(to=Publisher, on_delete=models.CASCADE) - owner = models.ForeignKey(db_column='model_id', to='auth.User', on_delete=models.CASCADE) - -- case: foreign_key_field_different_order_of_params - main: | - from myapp.models import Book, Publisher - book = Book() - reveal_type(book.publisher) # N: Revealed type is 'myapp.models.Publisher*' - reveal_type(book.publisher2) # N: Revealed type is 'myapp.models.Publisher*' - - publisher = Publisher() - reveal_type(publisher.books) # N: Revealed type is 'django.db.models.manager.RelatedManager[myapp.models.Book]' - reveal_type(publisher.books2) # N: Revealed type is 'django.db.models.manager.RelatedManager[myapp.models.Book]' - installed_apps: - - myapp - files: - - path: myapp/__init__.py - - path: myapp/models.py - content: | - from django.db import models - class Publisher(models.Model): - pass - class Book(models.Model): - publisher = models.ForeignKey(on_delete=models.CASCADE, to=Publisher, - related_name='books') - publisher2 = models.ForeignKey(to=Publisher, related_name='books2', on_delete=models.CASCADE) - -- case: to_parameter_as_string_with_application_name__model_imported - main: | - from myapp2.models import Book - book = Book() - reveal_type(book.publisher) # N: Revealed type is 'myapp.models.Publisher*' - installed_apps: - - myapp - - myapp2 - files: - - path: myapp/__init__.py - - path: myapp/models.py - content: | - from django.db import models - class Publisher(models.Model): - pass - - path: myapp2/__init__.py - - path: myapp2/models.py - content: | - from django.db import models - class Book(models.Model): - publisher = models.ForeignKey(to='myapp.Publisher', on_delete=models.CASCADE) - -- case: one_to_one_field_no_related_name - main: | - from myapp.models import User, Profile - reveal_type(User().profile) # N: Revealed type is 'myapp.models.Profile' - reveal_type(Profile().user) # N: Revealed type is 'myapp.models.User*' - installed_apps: - - myapp - files: - - path: myapp/__init__.py - - path: myapp/models.py - content: | - from django.db import models - class User(models.Model): - pass - class Profile(models.Model): - user = models.OneToOneField(to=User, on_delete=models.CASCADE) - -- case: test_circular_dependency_in_imports_with_foreign_key - main: | - from myapp import models - installed_apps: - - myapp - files: - - path: myapp/__init__.py - - path: myapp/models.py - content: | - from django.db import models - class App(models.Model): - def method(self) -> None: - reveal_type(self.views) # N: Revealed type is 'django.db.models.manager.RelatedManager[myapp.models.View]' - reveal_type(self.members) # N: Revealed type is 'django.db.models.manager.RelatedManager[myapp.models.Member]' - reveal_type(self.sheets) # N: Revealed type is 'django.db.models.manager.RelatedManager[myapp.models.Sheet]' - reveal_type(self.profile) # N: Revealed type is 'myapp.models.Profile' - class View(models.Model): - app = models.ForeignKey(to=App, related_name='views', on_delete=models.CASCADE) - class Member(models.Model): - app = models.ForeignKey(related_name='members', on_delete=models.CASCADE, to=App) - class Sheet(models.Model): - app = models.ForeignKey(App, related_name='sheets', on_delete=models.CASCADE) - class Profile(models.Model): - app = models.OneToOneField(App, related_name='profile', on_delete=models.CASCADE) - -- case: test_circular_dependency_in_imports_with_string_based - main: | - from myapp.models import View - reveal_type(View().app.views) # N: Revealed type is 'django.db.models.manager.RelatedManager[myapp.models.View]' - reveal_type(View().app.unknown) - out: | - main:3: note: Revealed type is 'Any' - main:3: error: "App" has no attribute "unknown" - installed_apps: - - myapp - - myapp2 - files: - - path: myapp/__init__.py - - path: myapp/models.py - content: | - from django.db import models - from myapp2.models import App - class View(models.Model): - app = models.ForeignKey(to=App, related_name='views', on_delete=models.CASCADE) - - path: myapp2/__init__.py - - path: myapp2/models.py - content: | - from django.db import models - class App(models.Model): - def method(self) -> None: - reveal_type(self.views) # N: Revealed type is 'django.db.models.manager.RelatedManager[myapp.models.View]' - -- case: models_related_managers_work_with_direct_model_inheritance_and_with_inheritance_from_other_model - main: | - from myapp.models import App - reveal_type(App().views) # N: Revealed type is 'django.db.models.manager.RelatedManager[myapp.models.View]' - reveal_type(App().views2) # N: Revealed type is 'django.db.models.manager.RelatedManager[myapp.models.View2]' - installed_apps: - - myapp - files: - - path: myapp/__init__.py - - path: myapp/models.py - content: | - from django.db import models - class App(models.Model): - pass - class View(models.Model): - app = models.ForeignKey(to=App, on_delete=models.CASCADE, related_name='views') - class View2(View): - app2 = models.ForeignKey(to=App, on_delete=models.CASCADE, related_name='views2') - -- case: models_imported_inside_init_file_foreign_key - main: | - from myapp2.models import View - reveal_type(View().app.views) # N: Revealed type is 'django.db.models.manager.RelatedManager[myapp2.models.View]' - installed_apps: - - myapp - - myapp2 - files: - - path: myapp/__init__.py - - path: myapp/models/__init__.py - content: | - from .app import App - - path: myapp/models/app.py - content: | - from django.db import models - class App(models.Model): - pass - - path: myapp2/__init__.py - - path: myapp2/models.py - content: | - from django.db import models - from myapp.models import App - class View(models.Model): - app = models.ForeignKey(to='myapp.App', related_name='views', on_delete=models.CASCADE) - -- case: models_imported_inside_init_file_one_to_one_field - main: | - from myapp2.models import Profile - reveal_type(Profile().user) # N: Revealed type is 'myapp.models.user.User*' - reveal_type(Profile().user.profile) # N: Revealed type is 'myapp2.models.Profile' - installed_apps: - - myapp - - myapp2 - files: - - path: myapp/__init__.py - - path: myapp/models/__init__.py - content: | - from .user import User - - path: myapp/models/user.py - content: | - from django.db import models - class User(models.Model): - pass - - path: myapp2/__init__.py - - path: myapp2/models.py - content: | - from django.db import models - from myapp.models import User - class Profile(models.Model): - user = models.OneToOneField(to='myapp.User', related_name='profile', on_delete=models.CASCADE) - -- case: models_triple_circular_reference - main: | - from myapp.models import App - reveal_type(App().owner) # N: Revealed type is 'myapp.models.user.User*' - reveal_type(App().owner.profile) # N: Revealed type is 'myapp.models.profile.Profile' - installed_apps: - - myapp - files: - - path: myapp/__init__.py - - path: myapp/models/__init__.py - content: | - from .user import User - from .profile import Profile - from .app import App - - path: myapp/models/user.py - content: | - from django.db import models - class User(models.Model): - pass - - path: myapp/models/profile.py - content: | - from django.db import models - class Profile(models.Model): - user = models.OneToOneField(to='myapp.User', related_name='profile', on_delete=models.CASCADE) - - path: myapp/models/app.py - content: | - from django.db import models - class App(models.Model): - owner = models.ForeignKey(to='myapp.User', on_delete=models.CASCADE, related_name='apps') - -- case: many_to_many_field_converts_to_queryset_of_model_type - main: | - from myapp.models import App, Member - reveal_type(Member().apps) # N: Revealed type is 'django.db.models.manager.RelatedManager*[myapp.models.App]' - reveal_type(App().members) # N: Revealed type is 'django.db.models.manager.RelatedManager[myapp.models.Member]' - installed_apps: - - myapp - files: - - path: myapp/__init__.py - - path: myapp/models.py - content: | - from django.db import models - class App(models.Model): - pass - class Member(models.Model): - apps = models.ManyToManyField(to=App, related_name='members') - -- case: many_to_many_works_with_string_if_imported - main: | - from myapp.models import Member - reveal_type(Member().apps) # N: Revealed type is 'django.db.models.manager.RelatedManager*[myapp2.models.App]' - installed_apps: - - myapp - - myapp2 - files: - - path: myapp/__init__.py - - path: myapp/models.py - content: | - from django.db import models - class Member(models.Model): - apps = models.ManyToManyField(to='myapp2.App', related_name='members') - - path: myapp2/__init__.py - - path: myapp2/models.py - content: | - from django.db import models - class App(models.Model): - pass - -- case: foreign_key_with_self - main: | - from myapp.models import User - reveal_type(User().parent) # N: Revealed type is 'myapp.models.User*' - installed_apps: - - myapp - files: - - path: myapp/__init__.py - - path: myapp/models.py - content: | - from django.db import models - class User(models.Model): - parent = models.ForeignKey('self', on_delete=models.CASCADE) - -- case: many_to_many_with_self - main: | - from myapp.models import User - reveal_type(User().friends) # N: Revealed type is 'django.db.models.manager.RelatedManager*[myapp.models.User]' - installed_apps: - - myapp - files: - - path: myapp/__init__.py - - path: myapp/models.py - content: | - from django.db import models - class User(models.Model): - friends = models.ManyToManyField('self') - -- case: recursively_checking_for_base_model_in_to_parameter - main: | - installed_apps: - - myapp - files: - - path: myapp/__init__.py - - path: myapp/models.py - content: | - from django.db import models - - class BaseModel(models.Model): - pass - class ParkingSpot(BaseModel): - pass - class Booking(BaseModel): - parking_spot = models.ForeignKey(to=ParkingSpot, null=True, on_delete=models.SET_NULL) - -- case: if_no_related_name_is_passed_create_default_related_managers - main: | - from myapp.models import Publisher - reveal_type(Publisher().book_set) # N: Revealed type is 'django.db.models.manager.RelatedManager[myapp.models.Book]' - installed_apps: - - myapp - files: - - path: myapp/__init__.py - - path: myapp/models.py - content: | - from django.db import models - class Publisher(models.Model): - pass - class Book(models.Model): - publisher = models.ForeignKey(to=Publisher, on_delete=models.CASCADE) - -- case: underscore_id_attribute_has_set_type_of_primary_key_if_explicit - main: | - import datetime - from myapp.models import Book, Book2 - - reveal_type(Book().publisher_id) # N: Revealed type is 'builtins.str*' - Book(publisher_id=1) - Book(publisher_id='hello') - Book(publisher_id=datetime.datetime.now()) # E: Incompatible type for "publisher_id" of "Book" (got "datetime", expected "Union[str, int, Combinable, None]") - Book.objects.create(publisher_id=1) - Book.objects.create(publisher_id='hello') - - reveal_type(Book2().publisher_id) # N: Revealed type is 'builtins.int*' - Book2(publisher_id=1) - Book2(publisher_id=[]) # E: Incompatible type for "publisher_id" of "Book2" (got "List[Any]", expected "Union[float, int, str, Combinable, None]") - Book2.objects.create(publisher_id=1) - Book2.objects.create(publisher_id=[]) # E: Incompatible type for "publisher_id" of "Book2" (got "List[Any]", expected "Union[float, int, str, Combinable]") - installed_apps: - - myapp - files: - - path: myapp/__init__.py - - path: myapp/models.py - content: | - from django.db import models - import datetime - class Publisher(models.Model): - mypk = models.CharField(max_length=100, primary_key=True) - class Book(models.Model): - publisher = models.ForeignKey(to=Publisher, on_delete=models.CASCADE) - - class Publisher2(models.Model): - mypk = models.IntegerField(primary_key=True) - class Book2(models.Model): - publisher = models.ForeignKey(to=Publisher2, on_delete=models.CASCADE) - -- case: if_model_is_defined_as_name_of_the_class_look_for_it_in_the_same_app - main: | - from myapp.models import Book - reveal_type(Book().publisher) # N: Revealed type is 'myapp.models.publisher.Publisher*' - installed_apps: - - myapp - files: - - path: myapp/__init__.py - - path: myapp/models/__init__.py - content: | - from .publisher import Publisher - from .book import Book - - path: myapp/models/publisher.py - content: | - from django.db import models - class Publisher(models.Model): - pass - - path: myapp/models/book.py - content: | - from django.db import models - class Book(models.Model): - publisher = models.ForeignKey(to='Publisher', on_delete=models.CASCADE) - - -- case: fail_if_no_model_in_the_same_app_models_init_py - main: | - from myapp.models import Book - installed_apps: - - myapp - files: - - path: myapp/__init__.py - - path: myapp/models/__init__.py - content: | - from .book import Book - - path: myapp/models/publisher.py - content: | - from django.db import models - class Publisher(models.Model): - pass - - path: myapp/models/book.py - content: | - from django.db import models - class Book(models.Model): - publisher = models.ForeignKey(to='Publisher', on_delete=models.CASCADE) # E: Cannot find model 'Publisher' referenced in field 'publisher' - - -- case: test_foreign_key_field_without_backwards_relation - main: | - from myapp.models import Book, Publisher - book = Book() - reveal_type(book.publisher) # N: Revealed type is 'myapp.models.Publisher*' - - publisher = Publisher() - reveal_type(publisher.books) - reveal_type(publisher.books2) # N: Revealed type is 'django.db.models.manager.RelatedManager[myapp.models.Book]' - out: | - main:6: error: "Publisher" has no attribute "books"; maybe "books2"? - main:6: note: Revealed type is 'Any' - installed_apps: - - myapp - files: - - path: myapp/__init__.py - - path: myapp/models.py - content: | - from django.db import models - class Publisher(models.Model): - pass - class Book(models.Model): - publisher = models.ForeignKey(to=Publisher, on_delete=models.CASCADE, - related_name='+') - publisher2 = models.ForeignKey(to=Publisher, on_delete=models.CASCADE, - related_name='books2') - -- case: to_parameter_could_be_resolved_if_passed_from_settings - main: | - from myapp.models import Book - book = Book() - reveal_type(book.publisher) # N: Revealed type is 'myapp.models.Publisher*' - custom_settings: | - INSTALLED_APPS = ('django.contrib.contenttypes', 'myapp') - BOOK_RELATED_MODEL = 'myapp.Publisher' - files: - - path: myapp/__init__.py - - path: myapp/models.py - content: | - from django.conf import settings - from django.db import models - - class Publisher(models.Model): - pass - class Book(models.Model): - publisher = models.ForeignKey(to=settings.BOOK_RELATED_MODEL, on_delete=models.CASCADE, - related_name='books') - -- case: foreign_key_with_custom_app_name - main: | - from myapp.models import MyMain - reveal_type(MyMain().user) # N: Revealed type is 'myapp2.models.MyUser*' - installed_apps: - - myapp - - myapp2.apps.MyApp2Config - files: - - path: myapp/__init__.py - - path: myapp/models.py - content: | - from django.db import models - class MyMain(models.Model): - user = models.ForeignKey('myapp2__user.MyUser', on_delete=models.CASCADE) - - path: myapp2/__init__.py - - path: myapp2/models.py - content: | - from django.db import models - class MyUser(models.Model): - pass - - path: myapp2/apps.py - content: | - from django.apps.config import AppConfig - class MyApp2Config(AppConfig): - name = 'myapp2' - label = 'myapp2__user' - - -- case: related_field_to_extracted_from_function - main: | - from myapp.models import Profile - reveal_type(Profile().user) # N: Revealed type is 'myapp.models.User*' - installed_apps: - - myapp - files: - - path: myapp/__init__.py - - path: myapp/models.py - content: | - from django.db import models - class User(models.Model): - pass - def get_user_model_name(): - return 'myapp.User' - class Profile(models.Model): - user = models.ForeignKey(to=get_user_model_name(), on_delete=models.CASCADE) - - -- case: related_manager_name_defined_by_pattern - main: | - from myapp.models import Publisher - reveal_type(Publisher().books) # N: Revealed type is 'django.db.models.manager.RelatedManager[myapp.models.Book]' - reveal_type(Publisher().articles) # N: Revealed type is 'django.db.models.manager.RelatedManager[myapp.models.Article]' - installed_apps: - - myapp - files: - - path: myapp/__init__.py - - path: myapp/models.py - content: | - from django.db import models - class Publisher(models.Model): - pass - class Entry(models.Model): - class Meta: - abstract = True - publisher = models.ForeignKey(to=Publisher, related_name='%(class)ss', on_delete=models.CASCADE) - class Book(Entry): - pass - class Article(Entry): - pass - - -- case: test_related_fields_returned_as_descriptors_from_model_class - main: | - from myapp.models import Author, Blog, Publisher, Profile - reveal_type(Author.blogs) # N: Revealed type is 'django.db.models.fields.related_descriptors.ManyToManyDescriptor' - reveal_type(Blog.publisher) # N: Revealed type is 'django.db.models.fields.related_descriptors.ForwardManyToOneDescriptor' - reveal_type(Publisher.profile) # N: Revealed type is 'django.db.models.fields.related_descriptors.ForwardOneToOneDescriptor' - installed_apps: - - myapp - files: - - path: myapp/__init__.py - - path: myapp/models.py - content: | - from django.db import models - class Profile(models.Model): - pass - class Publisher(models.Model): - profile = models.OneToOneField(Profile, on_delete=models.CASCADE) - class Blog(models.Model): - publisher = models.ForeignKey(Publisher, on_delete=models.CASCADE) - class Author(models.Model): - blogs = models.ManyToManyField(Blog) - file = models.FileField() - - -- case: test_foreign_key_from_superclass_inherits_correctly - main: | - from myapp.models import MyUser, Book, Article, LibraryEntity - reveal_type(Book().registered_by_user) # N: Revealed type is 'myapp.models.MyUser*' - reveal_type(Article().registered_by_user) # N: Revealed type is 'myapp.models.MyUser*' - - user = MyUser() - reveal_type(user.book_set) # N: Revealed type is 'django.db.models.manager.RelatedManager[myapp.models.Book]' - reveal_type(user.article_set) # N: Revealed type is 'django.db.models.manager.RelatedManager[myapp.models.Article]' - installed_apps: - - myapp - files: - - path: myapp/__init__.py - - path: myapp/models.py - content: | - from django.db import models - class MyUser(models.Model): - pass - class LibraryEntity(models.Model): - class Meta: - abstract = True - registered_by_user = models.ForeignKey(MyUser, on_delete=models.CASCADE) - class Book(LibraryEntity): - pass - class Article(LibraryEntity): - pass - - -- case: foreign_key_relationship_for_models_with_custom_manager - main: | - from myapp.models import Transaction - installed_apps: - - myapp - files: - - path: myapp/__init__.py - - path: myapp/models.py - content: | - from django.db import models - class TransactionQuerySet(models.QuerySet): - pass - class Transaction(models.Model): - objects = TransactionQuerySet.as_manager() - def test(self) -> None: - self.transactionlog_set - class TransactionLog(models.Model): - transaction = models.ForeignKey(Transaction, on_delete=models.CASCADE) - - Transaction().test() - - -- case: resolve_primary_keys_for_foreign_keys_with_abstract_self_model - main: | - from myapp.models import User - reveal_type(User().parent) # N: Revealed type is 'myapp.models.User*' - reveal_type(User().parent_id) # N: Revealed type is 'builtins.int*' - - reveal_type(User().parent2) # N: Revealed type is 'Union[myapp.models.User, None]' - reveal_type(User().parent2_id) # N: Revealed type is 'Union[builtins.int, None]' - installed_apps: - - myapp - files: - - path: myapp/__init__.py - - path: myapp/models.py - content: | - from django.db import models - class AbstractUser(models.Model): - parent = models.ForeignKey('self', on_delete=models.CASCADE) - parent2 = models.ForeignKey('self', null=True, on_delete=models.CASCADE) - class Meta: - abstract = True - class User(AbstractUser): - pass - - -- case: related_manager_is_a_subclass_of_default_manager - main: | - from myapp.models import User - reveal_type(User().orders) # N: Revealed type is 'myapp.models.Order_RelatedManager' - reveal_type(User().orders.get()) # N: Revealed type is 'myapp.models.Order*' - reveal_type(User().orders.manager_method()) # N: Revealed type is 'builtins.int' - installed_apps: - - myapp - files: - - path: myapp/__init__.py - - path: myapp/models.py - content: | - from django.db import models - class User(models.Model): - pass - class OrderManager(models.Manager): - def manager_method(self) -> int: - pass - class Order(models.Model): - objects = OrderManager() - user = models.ForeignKey(to=User, on_delete=models.CASCADE, related_name='orders') - diff --git a/tests/typecheck/managers/querysets/test_basic_methods.yml b/tests/typecheck/managers/querysets/test_basic_methods.yml deleted file mode 100644 index 55d4c4ec0..000000000 --- a/tests/typecheck/managers/querysets/test_basic_methods.yml +++ /dev/null @@ -1,47 +0,0 @@ -- case: queryset_basic_methods_return_type - main: | - from myapp.models import Blog - - qs = Blog.objects.all() - reveal_type(qs) # N: Revealed type is 'django.db.models.manager.Manager[myapp.models.Blog]' - reveal_type(qs.get(id=1)) # N: Revealed type is 'myapp.models.Blog*' - reveal_type(iter(qs)) # N: Revealed type is 'typing.Iterator[myapp.models.Blog*]' - reveal_type(qs.iterator()) # N: Revealed type is 'typing.Iterator[myapp.models.Blog*]' - reveal_type(qs.first()) # N: Revealed type is 'Union[myapp.models.Blog*, None]' - reveal_type(qs.earliest()) # N: Revealed type is 'myapp.models.Blog*' - reveal_type(qs[0]) # N: Revealed type is 'myapp.models.Blog*' - reveal_type(qs[:9]) # N: Revealed type is 'django.db.models.manager.Manager[myapp.models.Blog]' - reveal_type(qs.in_bulk()) # N: Revealed type is 'builtins.dict[Any, myapp.models.Blog*]' - - # .dates / .datetimes - reveal_type(Blog.objects.dates("created_at", "day")) # N: Revealed type is 'django.db.models.query.ValuesQuerySet[myapp.models.Blog*, datetime.date]' - reveal_type(Blog.objects.datetimes("created_at", "day")) # N: Revealed type is 'django.db.models.query.ValuesQuerySet[myapp.models.Blog*, datetime.datetime]' - - # AND-ing QuerySets - reveal_type(Blog.objects.all() & Blog.objects.all()) # N: Revealed type is 'django.db.models.manager.Manager[myapp.models.Blog]' - installed_apps: - - myapp - files: - - path: myapp/__init__.py - - path: myapp/models.py - content: | - from django.db import models - - class Blog(models.Model): - created_at = models.DateTimeField() - - -- case: queryset_missing_method - main: | - from myapp.models import User - reveal_type(User.objects) # N: Revealed type is 'django.db.models.manager.Manager[myapp.models.User]' - User.objects.not_existing_method() # E: "Manager[User]" has no attribute "not_existing_method" - installed_apps: - - myapp - files: - - path: myapp/__init__.py - - path: myapp/models.py - content: | - from django.db import models - class User(models.Model): - pass \ No newline at end of file diff --git a/tests/typecheck/managers/querysets/test_filter.yml b/tests/typecheck/managers/querysets/test_filter.yml deleted file mode 100644 index 43056f55a..000000000 --- a/tests/typecheck/managers/querysets/test_filter.yml +++ /dev/null @@ -1,256 +0,0 @@ -- case: filtering_with_proper_types - main: | - from myapp.models import User - User.objects.filter(username='maksim') - User.objects.get(username='maksim') - User.objects.exclude(username='maksim') - installed_apps: - - myapp - files: - - path: myapp/__init__.py - - path: myapp/models.py - content: | - from django.db import models - class User(models.Model): - username = models.CharField(max_length=100) - - -- case: no_such_field_for_filter - main: | - from myapp.models import User - User.objects.filter(unknown_field=True) # E: Cannot resolve keyword 'unknown_field' into field. Choices are: id - installed_apps: - - myapp - files: - - path: myapp/__init__.py - - path: myapp/models.py - content: | - from django.db import models - class User(models.Model): - pass - - -- case: filter_with_invalid_type - main: | - from myapp.models import User - User.objects.filter(age=User()) # E: Incompatible type for lookup 'age': (got "User", expected "Union[str, int]") - installed_apps: - - myapp - files: - - path: myapp/__init__.py - - path: myapp/models.py - content: | - from django.db import models - from django.db import models - class User(models.Model): - age = models.IntegerField() - - -- case: filter_with_multiple_fields - main: | - from myapp.models import User - User.objects.filter(age=User(), gender=User()) - installed_apps: - - myapp - out: | - main:2: error: Incompatible type for lookup 'age': (got "User", expected "Union[str, int]") - main:2: error: Incompatible type for lookup 'gender': (got "User", expected "Union[str, int]") - files: - - path: myapp/__init__.py - - path: myapp/models.py - content: | - from django.db import models - class User(models.Model): - age = models.IntegerField() - gender = models.IntegerField() - - -- case: valid_filter_with_lookup - main: | - from myapp.models import User - User.objects.filter(username__contains='hello') - User.objects.filter(age__gt=1) - installed_apps: - - myapp - files: - - path: myapp/__init__.py - - path: myapp/models.py - content: | - from django.db import models - class User(models.Model): - username = models.CharField(max_length=100) - age = models.IntegerField() - - -- case: invalid_filter_with_lookup - main: | - from myapp.models import User - User.objects.filter(username__contains=1) # E: Incompatible type for lookup 'username__contains': (got "int", expected "str") - User.objects.filter(username__icontains=1) # E: Incompatible type for lookup 'username__icontains': (got "int", expected "str") - User.objects.filter(username__isnull=1) # E: Incompatible type for lookup 'username__isnull': (got "int", expected "bool") - - User.objects.filter(created_at=User()) # E: Incompatible type for lookup 'created_at': (got "User", expected "Union[str, datetime]") - installed_apps: - - myapp - files: - - path: myapp/__init__.py - - path: myapp/models.py - content: | - from django.db import models - class User(models.Model): - username = models.CharField(max_length=100) - age = models.IntegerField() - created_at = models.DateTimeField() - -- case: strings_are_allowed_for_exact_for_dates - main: | - from myapp.models import User - User.objects.filter(created_at='2018') - User.objects.filter(created_at__exact='2018') - installed_apps: - - myapp - files: - - path: myapp/__init__.py - - path: myapp/models.py - content: | - from django.db import models - class User(models.Model): - created_at = models.DateTimeField() - - -- case: related_model_foreign_key_lookups - main: | - from myapp.models import Blog, Publisher - blog = Blog() - publisher = Publisher() - Blog.objects.filter(publisher=publisher) - Blog.objects.filter(publisher_id=1) - Blog.objects.filter(publisher__id=1) - - Blog.objects.filter(publisher=blog) # E: Incompatible type for lookup 'publisher': (got "Blog", expected "Union[Publisher, int, None]") - Blog.objects.filter(publisher_id=blog) # E: Incompatible type for lookup 'publisher_id': (got "Blog", expected "Union[str, int]") - installed_apps: - - myapp - files: - - path: myapp/__init__.py - - path: myapp/models.py - content: | - from django.db import models - class Publisher(models.Model): - pass - class Blog(models.Model): - publisher = models.ForeignKey(Publisher, on_delete=models.CASCADE, related_name='blogs') - - -- case: related_model_reverse_foreign_key_lookup - main: | - from myapp.models import Blog, Publisher - blog = Blog() - publisher = Publisher() - Publisher.objects.filter(blogs=Blog()) - Publisher.objects.filter(blogs__id=1) - - Publisher.objects.filter(blogs=publisher) # E: Incompatible type for lookup 'blogs': (got "Publisher", expected "Union[Blog, int, None]") - Publisher.objects.filter(blogs__id=publisher) # E: Incompatible type for lookup 'blogs__id': (got "Publisher", expected "Union[str, int]") - installed_apps: - - myapp - files: - - path: myapp/__init__.py - - path: myapp/models.py - content: | - from django.db import models - class Publisher(models.Model): - pass - class Blog(models.Model): - publisher = models.ForeignKey(Publisher, on_delete=models.CASCADE, related_name='blogs') - - -- case: many_to_many_lookups - main: | - from myapp.models import Book, Author - book = Book() - author = Author() - - Book.objects.filter(authors=author) - Book.objects.filter(authors=book) # E: Incompatible type for lookup 'authors': (got "Book", expected "Union[Author, int, None]") - Book.objects.filter(authors='hello') # E: Incompatible type for lookup 'authors': (got "str", expected "Union[Author, int, None]") - - Author.objects.filter(books=book) - Author.objects.filter(books=author) # E: Incompatible type for lookup 'books': (got "Author", expected "Union[Book, int, None]") - Author.objects.filter(books='hello') # E: Incompatible type for lookup 'books': (got "str", expected "Union[Book, int, None]") - installed_apps: - - myapp - files: - - path: myapp/__init__.py - - path: myapp/models.py - content: | - from django.db import models - class Book(models.Model): - pass - class Author(models.Model): - books = models.ManyToManyField(Book, related_name='authors') - - -- case: one_to_one_lookups - main: | - from myapp.models import User, Profile - user = User() - profile = Profile() - User.objects.filter(profile=profile) - User.objects.filter(profile=user) # E: Incompatible type for lookup 'profile': (got "User", expected "Union[Profile, int, None]") - User.objects.filter(profile='hello') # E: Incompatible type for lookup 'profile': (got "str", expected "Union[Profile, int, None]") - Profile.objects.filter(user=user) - Profile.objects.filter(user=profile) # E: Incompatible type for lookup 'user': (got "Profile", expected "Union[User, int, None]") - Profile.objects.filter(user='hello') # E: Incompatible type for lookup 'user': (got "str", expected "Union[User, int, None]") - installed_apps: - - myapp - files: - - path: myapp/__init__.py - - path: myapp/models.py - content: | - from django.db import models - class User(models.Model): - pass - class Profile(models.Model): - user = models.OneToOneField(User, on_delete=models.CASCADE, related_name='profile') - - -# TODO -- case: f_expression_simple_case - main: | - from myapp.models import User - from django.db import models - User.objects.filter(username=models.F('username2')) - User.objects.filter(username=models.F('age')) - installed_apps: - - myapp - files: - - path: myapp/__init__.py - - path: myapp/models.py - content: | - from django.db import models - - class User(models.Model): - username = models.TextField() - username2 = models.TextField() - - age = models.IntegerField() - - -# TODO -- case: f_expression_with_expression_math_is_not_supported - main: | - from myapp.models import User - from django.db import models - User.objects.filter(username=models.F('username2') + 'hello') - installed_apps: - - myapp - files: - - path: myapp/__init__.py - - path: myapp/models.py - content: | - from django.db import models - class User(models.Model): - username = models.TextField() - username2 = models.TextField() - age = models.IntegerField() \ No newline at end of file diff --git a/tests/typecheck/managers/querysets/test_from_queryset.yml b/tests/typecheck/managers/querysets/test_from_queryset.yml deleted file mode 100644 index e9f2ad4ff..000000000 --- a/tests/typecheck/managers/querysets/test_from_queryset.yml +++ /dev/null @@ -1,181 +0,0 @@ -- case: from_queryset_with_base_manager - main: | - from myapp.models import MyModel - reveal_type(MyModel().objects) # N: Revealed type is 'myapp.models.MyModel_NewManager[myapp.models.MyModel]' - reveal_type(MyModel().objects.get()) # N: Revealed type is 'myapp.models.MyModel*' - reveal_type(MyModel().objects.queryset_method()) # N: Revealed type is 'builtins.str' - installed_apps: - - myapp - files: - - path: myapp/__init__.py - - path: myapp/models.py - content: | - from django.db import models - from django.db.models.manager import BaseManager - - class ModelQuerySet(models.QuerySet): - def queryset_method(self) -> str: - return 'hello' - NewManager = BaseManager.from_queryset(ModelQuerySet) - class MyModel(models.Model): - objects = NewManager() - -- case: from_queryset_with_manager - main: | - from myapp.models import MyModel - reveal_type(MyModel().objects) # N: Revealed type is 'myapp.models.MyModel_NewManager[myapp.models.MyModel]' - reveal_type(MyModel().objects.get()) # N: Revealed type is 'myapp.models.MyModel*' - reveal_type(MyModel().objects.queryset_method()) # N: Revealed type is 'builtins.str' - installed_apps: - - myapp - files: - - path: myapp/__init__.py - - path: myapp/models.py - content: | - from django.db import models - - class ModelQuerySet(models.QuerySet): - def queryset_method(self) -> str: - return 'hello' - - NewManager = models.Manager.from_queryset(ModelQuerySet) - class MyModel(models.Model): - objects = NewManager() - -- case: from_queryset_returns_intersection_of_manager_and_queryset - main: | - from myapp.models import MyModel, NewManager - reveal_type(NewManager()) # N: Revealed type is 'myapp.models.NewManager' - reveal_type(MyModel.objects) # N: Revealed type is 'myapp.models.MyModel_NewManager[myapp.models.MyModel]' - reveal_type(MyModel.objects.get()) # N: Revealed type is 'Any' - reveal_type(MyModel.objects.manager_only_method()) # N: Revealed type is 'builtins.int' - reveal_type(MyModel.objects.manager_and_queryset_method()) # N: Revealed type is 'builtins.str' - installed_apps: - - myapp - files: - - path: myapp/__init__.py - - path: myapp/models.py - content: | - from django.db import models - class ModelBaseManager(models.Manager): - def manager_only_method(self) -> int: - return 1 - class ModelQuerySet(models.QuerySet): - def manager_and_queryset_method(self) -> str: - return 'hello' - - NewManager = ModelBaseManager.from_queryset(ModelQuerySet) - class MyModel(models.Model): - objects = NewManager() - -- case: from_queryset_with_class_name_provided - main: | - from myapp.models import MyModel, NewManager - reveal_type(NewManager()) # N: Revealed type is 'myapp.models.NewManager' - reveal_type(MyModel.objects) # N: Revealed type is 'myapp.models.MyModel_NewManager[myapp.models.MyModel]' - reveal_type(MyModel.objects.get()) # N: Revealed type is 'Any' - reveal_type(MyModel.objects.manager_only_method()) # N: Revealed type is 'builtins.int' - reveal_type(MyModel.objects.manager_and_queryset_method()) # N: Revealed type is 'builtins.str' - installed_apps: - - myapp - files: - - path: myapp/__init__.py - - path: myapp/models.py - content: | - from django.db import models - class ModelBaseManager(models.Manager): - def manager_only_method(self) -> int: - return 1 - class ModelQuerySet(models.QuerySet): - def manager_and_queryset_method(self) -> str: - return 'hello' - - NewManager = ModelBaseManager.from_queryset(ModelQuerySet, class_name='NewManager') - class MyModel(models.Model): - objects = NewManager() - -- case: from_queryset_with_class_inheritance - main: | - from myapp.models import MyModel - reveal_type(MyModel().objects) # N: Revealed type is 'myapp.models.MyModel_NewManager[myapp.models.MyModel]' - reveal_type(MyModel().objects.get()) # N: Revealed type is 'myapp.models.MyModel*' - reveal_type(MyModel().objects.queryset_method()) # N: Revealed type is 'builtins.str' - installed_apps: - - myapp - files: - - path: myapp/__init__.py - - path: myapp/models.py - content: | - from django.db import models - from django.db.models.manager import BaseManager - class BaseQuerySet(models.QuerySet): - def queryset_method(self) -> str: - return 'hello' - class ModelQuerySet(BaseQuerySet): - pass - - NewManager = BaseManager.from_queryset(ModelQuerySet) - class MyModel(models.Model): - objects = NewManager() - -- case: from_queryset_with_manager_in_another_directory_and_imports - main: | - from myapp.models import MyModel - reveal_type(MyModel().objects) # N: Revealed type is 'myapp.models.MyModel_NewManager[myapp.models.MyModel]' - reveal_type(MyModel().objects.get()) # N: Revealed type is 'myapp.models.MyModel*' - reveal_type(MyModel().objects.queryset_method) # N: Revealed type is 'def (param: Union[builtins.str, None] =) -> Union[builtins.str, None]' - reveal_type(MyModel().objects.queryset_method('str')) # N: Revealed type is 'Union[builtins.str, None]' - installed_apps: - - myapp - files: - - path: myapp/__init__.py - - path: myapp/models.py - content: | - from django.db import models - from myapp.managers import NewManager - - class MyModel(models.Model): - objects = NewManager() - - path: myapp/managers.py - content: | - from typing import Optional - from django.db import models - - class ModelQuerySet(models.QuerySet): - def queryset_method(self, param: Optional[str] = None) -> Optional[str]: - return param - - NewManager = models.Manager.from_queryset(ModelQuerySet) - -- case: from_queryset_with_inherited_manager_and_typing_no_return - disable_cache: true - main: | - from myapp.models import MyModel - reveal_type(MyModel().objects) # N: Revealed type is 'myapp.models.MyModel_NewManager[myapp.models.MyModel]' - reveal_type(MyModel().objects.get()) # N: Revealed type is 'myapp.models.MyModel*' - reveal_type(MyModel().objects.base_queryset_method) # N: Revealed type is 'def (param: Union[builtins.int, builtins.str]) -> ' - reveal_type(MyModel().objects.base_queryset_method(2)) # N: Revealed type is '' - installed_apps: - - myapp - files: - - path: myapp/__init__.py - - path: myapp/models.py - content: | - from django.db import models - from myapp.managers import NewManager - class MyModel(models.Model): - objects = NewManager() - - path: myapp/managers.py - content: | - from django.db import models - from myapp.base_queryset import BaseQuerySet - class ModelQuerySet(BaseQuerySet): - pass - NewManager = models.Manager.from_queryset(ModelQuerySet) - - path: myapp/base_queryset.py - content: | - from typing import NoReturn, Union - from django.db import models - class BaseQuerySet(models.QuerySet): - def base_queryset_method(self, param: Union[int, str]) -> NoReturn: - raise ValueError \ No newline at end of file diff --git a/tests/typecheck/managers/querysets/test_values.yml b/tests/typecheck/managers/querysets/test_values.yml deleted file mode 100644 index 40ffa598f..000000000 --- a/tests/typecheck/managers/querysets/test_values.yml +++ /dev/null @@ -1,126 +0,0 @@ -- case: queryset_values_method_returns_typeddict - main: | - from myapp.models import Blog - values = Blog.objects.values('num_posts', 'text').get() - reveal_type(values) # N: Revealed type is 'TypedDict({'num_posts': builtins.int, 'text': builtins.str})' - reveal_type(values["num_posts"]) # N: Revealed type is 'builtins.int' - reveal_type(values["text"]) # N: Revealed type is 'builtins.str' - - values_pk = Blog.objects.values('pk').get() - reveal_type(values_pk) # N: Revealed type is 'TypedDict({'pk': builtins.int})' - reveal_type(values_pk["pk"]) # N: Revealed type is 'builtins.int' - installed_apps: - - myapp - files: - - path: myapp/__init__.py - - path: myapp/models.py - content: | - from django.db import models - class Blog(models.Model): - num_posts = models.IntegerField() - text = models.CharField(max_length=100) - -- case: queryset_values_all_values - main: | - from myapp.models import Blog - all_values_dict = Blog.objects.values().get() - reveal_type(all_values_dict) # N: Revealed type is 'TypedDict({'id': builtins.int, 'num_posts': builtins.int, 'text': builtins.str})' - reveal_type(all_values_dict["id"]) # N: Revealed type is 'builtins.int' - reveal_type(all_values_dict["num_posts"]) # N: Revealed type is 'builtins.int' - reveal_type(all_values_dict["text"]) # N: Revealed type is 'builtins.str' - installed_apps: - - myapp - files: - - path: myapp/__init__.py - - path: myapp/models.py - content: | - from django.db import models - class Publisher(models.Model): - pass - class Blog(models.Model): - num_posts = models.IntegerField() - text = models.CharField(max_length=100) - -- case: queryset_foreign_key_object_always_a_primary_key - main: | - from myapp.models import Blog - values1 = Blog.objects.values('publisher').get() - reveal_type(values1) # N: Revealed type is 'TypedDict({'publisher': builtins.int})' - reveal_type(values1['publisher']) # N: Revealed type is 'builtins.int' - - values2 = Blog.objects.values('publisher_id').get() - reveal_type(values2) # N: Revealed type is 'TypedDict({'publisher_id': builtins.int})' - reveal_type(values2["publisher_id"]) # N: Revealed type is 'builtins.int' - - # all values return _id version - all_values = Blog.objects.values().get() - reveal_type(all_values) # N: Revealed type is 'TypedDict({'id': builtins.int, 'publisher_id': builtins.int})' - installed_apps: - - myapp - files: - - path: myapp/__init__.py - - path: myapp/models.py - content: | - from django.db import models - class Publisher(models.Model): - pass - class Blog(models.Model): - publisher = models.ForeignKey(to=Publisher, on_delete=models.CASCADE) - -- case: values_with_related_model_fields - main: | - from myapp.models import Entry - values = Entry.objects.values('blog__num_articles', 'blog__publisher__name').get() - reveal_type(values) # N: Revealed type is 'TypedDict({'blog__num_articles': builtins.int, 'blog__publisher__name': builtins.str})' - - pk_values = Entry.objects.values('blog__pk', 'blog__publisher__pk').get() - reveal_type(pk_values) # N: Revealed type is 'TypedDict({'blog__pk': builtins.int, 'blog__publisher__pk': builtins.int})' - installed_apps: - - myapp - files: - - path: myapp/__init__.py - - path: myapp/models.py - content: | - from django.db import models - class Publisher(models.Model): - name = models.CharField(max_length=100) - class Blog(models.Model): - num_articles = models.IntegerField() - publisher = models.ForeignKey(to=Publisher, on_delete=models.CASCADE) - class Entry(models.Model): - blog = models.ForeignKey(Blog, on_delete=models.CASCADE) - -- case: select_all_related_model_values_for_every_current_value - main: | - from myapp.models import Publisher - related_model_values = Publisher.objects.values('id', 'blog__name').get() - reveal_type(related_model_values) # N: Revealed type is 'TypedDict({'id': builtins.int, 'blog__name': builtins.str})' - installed_apps: - - myapp - files: - - path: myapp/__init__.py - - path: myapp/models.py - content: | - from django.db import models - class Publisher(models.Model): - pass - class Blog(models.Model): - name = models.CharField(max_length=100) - publisher = models.ForeignKey(Publisher, on_delete=models.CASCADE) - -- case: values_of_many_to_many_field - main: | - from myapp.models import Author, Book - reveal_type(Book.objects.values('authors')) # N: Revealed type is 'django.db.models.query.ValuesQuerySet[myapp.models.Book, TypedDict({'authors': builtins.int})]' - reveal_type(Author.objects.values('books')) # N: Revealed type is 'django.db.models.query.ValuesQuerySet[myapp.models.Author, TypedDict({'books': builtins.int})]' - installed_apps: - - myapp - files: - - path: myapp/__init__.py - - path: myapp/models.py - content: | - from django.db import models - class Author(models.Model): - pass - class Book(models.Model): - authors = models.ManyToManyField(Author, related_name='books') diff --git a/tests/typecheck/managers/querysets/test_values_list.yml b/tests/typecheck/managers/querysets/test_values_list.yml deleted file mode 100644 index c67f2658d..000000000 --- a/tests/typecheck/managers/querysets/test_values_list.yml +++ /dev/null @@ -1,243 +0,0 @@ -- case: values_list_simple_field_returns_queryset_of_tuples - main: | - from myapp.models import MyUser - reveal_type(MyUser.objects.values_list('name').get()) # N: Revealed type is 'Tuple[builtins.str]' - reveal_type(MyUser.objects.values_list('id', 'name').get()) # N: Revealed type is 'Tuple[builtins.int, builtins.str]' - - values_tuple = MyUser.objects.values_list('name', 'age').get() - reveal_type(values_tuple[0]) # N: Revealed type is 'builtins.str' - reveal_type(values_tuple[1]) # N: Revealed type is 'builtins.int' - - # no fields specified return all fields - all_values_tuple = MyUser.objects.values_list().get() - reveal_type(all_values_tuple) # N: Revealed type is 'Tuple[builtins.int, builtins.str, builtins.int]' - - # pk as field - pk_values = MyUser.objects.values_list('pk').get() - reveal_type(pk_values) # N: # N: Revealed type is 'Tuple[builtins.int]' - installed_apps: - - myapp - files: - - path: myapp/__init__.py - - path: myapp/models.py - content: | - from django.db import models - class MyUser(models.Model): - name = models.CharField(max_length=100) - age = models.IntegerField() - -- case: values_list_related_model_fields - main: | - from myapp.models import Post, Blog - values_tuple = Post.objects.values_list('blog', 'blog__num_posts', 'blog__publisher', 'blog__publisher__name').get() - reveal_type(values_tuple[0]) # N: Revealed type is 'myapp.models.Blog' - reveal_type(values_tuple[1]) # N: Revealed type is 'builtins.int' - reveal_type(values_tuple[2]) # N: Revealed type is 'myapp.models.Publisher' - reveal_type(values_tuple[3]) # N: Revealed type is 'builtins.str' - - reverse_fields_list = Blog.objects.values_list('post__text').get() - reveal_type(reverse_fields_list) # N: Revealed type is 'Tuple[builtins.str]' - installed_apps: - - myapp - files: - - path: myapp/__init__.py - - path: myapp/models.py - content: | - from django.db import models - class Publisher(models.Model): - name = models.CharField(max_length=100) - class Blog(models.Model): - num_posts = models.IntegerField() - publisher = models.ForeignKey(to=Publisher, on_delete=models.CASCADE) - class Post(models.Model): - text = models.CharField(max_length=100) - blog = models.ForeignKey(to=Blog, on_delete=models.CASCADE) - -- case: values_list_flat_true_methods - main: | - from myapp.models import MyUser, MyUser2 - reveal_type(MyUser.objects.values_list('name', flat=True).get()) # N: Revealed type is 'builtins.str*' - reveal_type(MyUser.objects.values_list('name', 'age', flat=True).get()) - - # flat=True without specified fields returns primary key values - reveal_type(MyUser.objects.values_list(flat=True)[0]) # N: Revealed type is 'builtins.int*' - reveal_type(MyUser2.objects.values_list(flat=True)[0]) # N: Revealed type is 'builtins.str*' - out: | - main:3: error: 'flat' is not valid when 'values_list' is called with more than one field - main:3: note: Revealed type is 'Any' - installed_apps: - - myapp - files: - - path: myapp/__init__.py - - path: myapp/models.py - content: | - from django.db import models - class MyUser(models.Model): - name = models.CharField(max_length=100) - age = models.IntegerField() - class MyUser2(models.Model): - name = models.CharField(max_length=100, primary_key=True) - -- case: values_list_named_true - main: | - from myapp.models import MyUser - values_named_tuple = MyUser.objects.values_list('name', 'age', named=True).get() - reveal_type(values_named_tuple) # N: Revealed type is 'Tuple[builtins.str, builtins.int, fallback=main.Row]' - reveal_type(values_named_tuple.name) # N: Revealed type is 'builtins.str' - reveal_type(values_named_tuple.age) # N: Revealed type is 'builtins.int' - - # no fields specified, returns all fields namedtuple - all_values_named_tuple = MyUser.objects.values_list(named=True).get() - reveal_type(all_values_named_tuple.id) # N: Revealed type is 'builtins.int' - reveal_type(all_values_named_tuple.name) # N: Revealed type is 'builtins.str' - reveal_type(all_values_named_tuple.age) # N: Revealed type is 'builtins.int' - reveal_type(all_values_named_tuple.is_admin) # N: Revealed type is 'builtins.bool' - - # pk as field - pk_values = MyUser.objects.values_list('pk', named=True).get() - reveal_type(pk_values) # N: Revealed type is 'Tuple[builtins.int, fallback=main.Row2]' - reveal_type(pk_values.pk) # N: # N: Revealed type is 'builtins.int' - - # values_list(named=True) inside function - def func() -> None: - from myapp.models import MyUser - reveal_type(MyUser.objects.values_list('name', named=True).get()) # N: Revealed type is 'Tuple[builtins.str, fallback=main.Row3]' - installed_apps: - - myapp - files: - - path: myapp/__init__.py - - path: myapp/models.py - content: | - from django.db import models - class MyUser(models.Model): - name = models.CharField(max_length=100) - age = models.IntegerField() - is_admin = models.BooleanField() - -- case: values_list_flat_true_named_true_error - main: | - from myapp.models import MyUser - reveal_type(MyUser.objects.values_list('name', flat=True, named=True).get()) - out: | - main:2: error: 'flat' and 'named' can't be used together - main:2: note: Revealed type is 'Any' - installed_apps: - - myapp - files: - - path: myapp/__init__.py - - path: myapp/models.py - content: | - from django.db import models - class MyUser(models.Model): - name = models.CharField(max_length=100) - -- case: invalid_lookups - main: | - from myapp.models import Blog - reveal_type(Blog.objects.values_list('unknown').get()) - reveal_type(Blog.objects.values_list('unknown', flat=True).get()) - reveal_type(Blog.objects.values_list('unknown', named=True).get()) - reveal_type(Blog.objects.values_list('publisher__unknown').get()) - out: | - main:2: error: Cannot resolve keyword 'unknown' into field. Choices are: id, publisher, publisher_id - main:2: note: Revealed type is 'Any' - main:3: error: Cannot resolve keyword 'unknown' into field. Choices are: id, publisher, publisher_id - main:3: note: Revealed type is 'Any' - main:4: error: Cannot resolve keyword 'unknown' into field. Choices are: id, publisher, publisher_id - main:4: note: Revealed type is 'Any' - main:5: note: Revealed type is 'Tuple[Any]' - installed_apps: - - myapp - files: - - path: myapp/__init__.py - - path: myapp/models.py - content: | - from django.db import models - class Publisher(models.Model): - pass - class Blog(models.Model): - publisher = models.ForeignKey(to=Publisher, on_delete=models.CASCADE) - -- case: named_true_with_related_model_fields - main: | - from myapp.models import Entry, Blog - values = Entry.objects.values_list('blog__num_articles', 'blog__publisher__name', named=True).get() - reveal_type(values.blog__num_articles) # N: Revealed type is 'builtins.int' - reveal_type(values.blog__publisher__name) # N: Revealed type is 'builtins.str' - - pk_values = Entry.objects.values_list('blog__pk', 'blog__publisher__pk', named=True).get() - reveal_type(pk_values.blog__pk) # N: Revealed type is 'builtins.int' - reveal_type(pk_values.blog__publisher__pk) # N: Revealed type is 'builtins.int' - - # reverse relation - reverse_values = Blog.objects.values_list('entry__text', named=True).get() - reveal_type(reverse_values.entry__text) # N: Revealed type is 'builtins.str' - installed_apps: - - myapp - files: - - path: myapp/__init__.py - - path: myapp/models.py - content: | - from django.db import models - class Publisher(models.Model): - name = models.CharField(max_length=100) - class Blog(models.Model): - num_articles = models.IntegerField() - publisher = models.ForeignKey(to=Publisher, on_delete=models.CASCADE) - class Entry(models.Model): - text = models.CharField(max_length=100) - blog = models.ForeignKey(Blog, on_delete=models.CASCADE) - -- case: values_list_flat_true_with_ids - main: | - from myapp.models import Blog, Publisher - reveal_type(Blog.objects.values_list('id', flat=True)) # N: Revealed type is 'django.db.models.query.ValuesQuerySet[myapp.models.Blog, builtins.int]' - reveal_type(Blog.objects.values_list('publisher_id', flat=True)) # N: Revealed type is 'django.db.models.query.ValuesQuerySet[myapp.models.Blog, builtins.int]' - # is Iterable[int] - reveal_type(list(Blog.objects.values_list('id', flat=True))) # N: Revealed type is 'builtins.list[builtins.int*]' - installed_apps: - - myapp - files: - - path: myapp/__init__.py - - path: myapp/models.py - content: | - from django.db import models - class Publisher(models.Model): - pass - class Blog(models.Model): - publisher = models.ForeignKey(to=Publisher, on_delete=models.CASCADE) - -- case: subclass_of_queryset_has_proper_typings_on_methods - main: | - from myapp.models import TransactionQuerySet - reveal_type(TransactionQuerySet()) # N: Revealed type is 'myapp.models.TransactionQuerySet' - reveal_type(TransactionQuerySet().values()) # N: Revealed type is 'django.db.models.query.ValuesQuerySet[myapp.models.Transaction, TypedDict({'id': builtins.int, 'total': builtins.int})]' - reveal_type(TransactionQuerySet().values_list()) # N: Revealed type is 'django.db.models.query.ValuesQuerySet[myapp.models.Transaction, Tuple[builtins.int, builtins.int]]' - installed_apps: - - myapp - files: - - path: myapp/__init__.py - - path: myapp/models.py - content: | - from django.db import models - class TransactionQuerySet(models.QuerySet['Transaction']): - pass - class Transaction(models.Model): - total = models.IntegerField() - -- case: values_list_of_many_to_many_field - main: | - from myapp.models import Author, Book - reveal_type(Book.objects.values_list('authors')) # N: Revealed type is 'django.db.models.query.ValuesQuerySet[myapp.models.Book, Tuple[builtins.int]]' - reveal_type(Author.objects.values_list('books')) # N: Revealed type is 'django.db.models.query.ValuesQuerySet[myapp.models.Author, Tuple[builtins.int]]' - installed_apps: - - myapp - files: - - path: myapp/__init__.py - - path: myapp/models.py - content: | - from django.db import models - class Author(models.Model): - pass - class Book(models.Model): - authors = models.ManyToManyField(Author, related_name='books') \ No newline at end of file diff --git a/tests/typecheck/managers/test_managers.yml b/tests/typecheck/managers/test_managers.yml deleted file mode 100644 index 72d62d246..000000000 --- a/tests/typecheck/managers/test_managers.yml +++ /dev/null @@ -1,359 +0,0 @@ -- case: test_every_model_has_objects_queryset_available - main: | - from myapp.models import User - reveal_type(User.objects) # N: Revealed type is 'django.db.models.manager.Manager[myapp.models.User]' - reveal_type(User.objects.get()) # N: Revealed type is 'myapp.models.User*' - installed_apps: - - myapp - files: - - path: myapp/__init__.py - - path: myapp/models.py - content: | - from django.db import models - class User(models.Model): - pass - -- case: every_model_has_its_own_objects_queryset - main: | - from myapp.models import Parent, Child - reveal_type(Parent.objects) # N: Revealed type is 'django.db.models.manager.Manager[myapp.models.Parent]' - reveal_type(Child.objects) # N: Revealed type is 'django.db.models.manager.Manager[myapp.models.Child]' - installed_apps: - - myapp - files: - - path: myapp/__init__.py - - path: myapp/models.py - content: | - from django.db import models - class Parent(models.Model): - pass - class Child(Parent): - pass - -- case: test_model_objects_attribute_present_in_case_of_model_cls_passed_as_generic_parameter - main: | - from myapp.models import Base, MyModel - base_instance = Base(MyModel) - reveal_type(base_instance.model_cls._default_manager) # N: Revealed type is 'django.db.models.manager.Manager[myapp.models.MyModel]' - installed_apps: - - myapp - files: - - path: myapp/__init__.py - - path: myapp/models.py - content: | - from typing import TypeVar, Generic, Type - from django.db import models - - _T = TypeVar('_T', bound=models.Model) - class Base(Generic[_T]): - def __init__(self, model_cls: Type[_T]): - self.model_cls = model_cls - reveal_type(self.model_cls._default_manager) # N: Revealed type is 'django.db.models.manager.BaseManager[django.db.models.base.Model]' - class MyModel(models.Model): - pass - class Child(Base[MyModel]): - def method(self) -> None: - reveal_type(self.model_cls._default_manager) # N: Revealed type is 'django.db.models.manager.Manager[myapp.models.MyModel]' - -- case: if_custom_manager_defined_it_is_set_to_default_manager - main: | - from myapp.models import MyModel - reveal_type(MyModel._default_manager) # N: Revealed type is 'myapp.models.CustomManager[myapp.models.MyModel]' - installed_apps: - - myapp - files: - - path: myapp/__init__.py - - path: myapp/models.py - content: | - from typing import TypeVar - from django.db import models - _T = TypeVar('_T', bound=models.Model) - class CustomManager(models.Manager[_T]): - pass - class MyModel(models.Model): - manager = CustomManager['MyModel']() - -- case: if_default_manager_name_is_passed_set_default_manager_to_it - main: | - from myapp.models import MyModel - reveal_type(MyModel._default_manager) # N: Revealed type is 'myapp.models.Manager2[myapp.models.MyModel]' - installed_apps: - - myapp - files: - - path: myapp/__init__.py - - path: myapp/models.py - content: | - from typing import TypeVar - from django.db import models - - _T = TypeVar('_T', bound=models.Model) - class Manager1(models.Manager[_T]): - pass - class Manager2(models.Manager[_T]): - pass - class MyModel(models.Model): - class Meta: - default_manager_name = 'm2' - m1 = Manager1['MyModel']() - m2 = Manager2['MyModel']() - -- case: test_leave_as_is_if_objects_is_set_and_fill_typevars_with_outer_class - main: | - from myapp.models import MyUser - reveal_type(MyUser.objects) # N: Revealed type is 'myapp.models.UserManager[myapp.models.MyUser]' - reveal_type(MyUser.objects.get()) # N: Revealed type is 'myapp.models.MyUser*' - reveal_type(MyUser.objects.get_or_404()) # N: Revealed type is 'myapp.models.MyUser' - installed_apps: - - myapp - files: - - path: myapp/__init__.py - - path: myapp/models.py - content: | - from django.db import models - - class UserManager(models.Manager['MyUser']): - def get_or_404(self) -> 'MyUser': - pass - - class MyUser(models.Model): - objects = UserManager() - -- case: model_imported_from_different_file - main: | - from myapp.models import Inventory, Band - reveal_type(Inventory.objects) # N: Revealed type is 'django.db.models.manager.Manager[myapp.models.main.Inventory]' - reveal_type(Band.objects) # N: Revealed type is 'django.db.models.manager.Manager[myapp.models.Band]' - installed_apps: - - myapp - files: - - path: myapp/__init__.py - - path: myapp/models/__init__.py - content: | - from django.db import models - from .main import Inventory - class Band(models.Model): - pass - - path: myapp/models/main.py - content: | - from django.db import models - class Inventory(models.Model): - pass - -- case: managers_that_defined_on_other_models_do_not_influence - main: | - from myapp.models import AbstractPerson, Book - reveal_type(AbstractPerson.abstract_persons) # N: Revealed type is 'django.db.models.manager.Manager[myapp.models.AbstractPerson]' - reveal_type(Book.published_objects) # N: Revealed type is 'myapp.models.PublishedBookManager[myapp.models.Book]' - Book.published_objects.create(title='hello') - reveal_type(Book.annotated_objects) # N: Revealed type is 'myapp.models.AnnotatedBookManager[myapp.models.Book]' - Book.annotated_objects.create(title='hello') - installed_apps: - - myapp - files: - - path: myapp/__init__.py - - path: myapp/models.py - content: | - from django.db import models - - class AbstractPerson(models.Model): - abstract_persons = models.Manager['AbstractPerson']() - class PublishedBookManager(models.Manager['Book']): - pass - class AnnotatedBookManager(models.Manager['Book']): - pass - class Book(models.Model): - title = models.CharField(max_length=50) - published_objects = PublishedBookManager() - annotated_objects = AnnotatedBookManager() - -- case: managers_inherited_from_abstract_classes_multiple_inheritance - main: | - installed_apps: - - myapp - files: - - path: myapp/__init__.py - - path: myapp/models.py - content: | - from django.db import models - class CustomManager1(models.Manager['AbstractBase1']): - pass - class AbstractBase1(models.Model): - class Meta: - abstract = True - name = models.CharField(max_length=50) - manager1 = CustomManager1() - class CustomManager2(models.Manager['AbstractBase2']): - pass - class AbstractBase2(models.Model): - class Meta: - abstract = True - value = models.CharField(max_length=50) - restricted = CustomManager2() - - class Child(AbstractBase1, AbstractBase2): - pass - -- case: model_has_a_manager_of_the_same_type - main: | - from myapp.models import UnrelatedModel, MyModel - reveal_type(UnrelatedModel.objects) # N: Revealed type is 'django.db.models.manager.Manager[myapp.models.UnrelatedModel]' - reveal_type(UnrelatedModel.objects.first()) # N: Revealed type is 'Union[myapp.models.UnrelatedModel*, None]' - - reveal_type(MyModel.objects) # N: Revealed type is 'django.db.models.manager.Manager[myapp.models.MyModel]' - reveal_type(MyModel.objects.first()) # N: Revealed type is 'Union[myapp.models.MyModel*, None]' - installed_apps: - - myapp - files: - - path: myapp/__init__.py - - path: myapp/models.py - content: | - from django.db import models - class UnrelatedModel(models.Model): - objects = models.Manager['UnrelatedModel']() - - class MyModel(models.Model): - pass - -- case: manager_without_annotation_of_the_model_gets_it_from_outer_one - main: | - from myapp.models import UnrelatedModel2, MyModel2 - reveal_type(UnrelatedModel2.objects) # N: Revealed type is 'django.db.models.manager.Manager[myapp.models.UnrelatedModel2]' - reveal_type(UnrelatedModel2.objects.first()) # N: Revealed type is 'Union[myapp.models.UnrelatedModel2*, None]' - - reveal_type(MyModel2.objects) # N: Revealed type is 'django.db.models.manager.Manager[myapp.models.MyModel2]' - reveal_type(MyModel2.objects.first()) # N: Revealed type is 'Union[myapp.models.MyModel2*, None]' - installed_apps: - - myapp - files: - - path: myapp/__init__.py - - path: myapp/models.py - content: | - from django.db import models - class UnrelatedModel2(models.Model): - objects = models.Manager() - - class MyModel2(models.Model): - pass - -- case: inherited_manager_has_the_proper_type_of_model - main: | - from myapp.models import ParentOfMyModel3, MyModel3 - reveal_type(ParentOfMyModel3.objects) # N: Revealed type is 'django.db.models.manager.Manager[myapp.models.ParentOfMyModel3]' - reveal_type(ParentOfMyModel3.objects.first()) # N: Revealed type is 'Union[myapp.models.ParentOfMyModel3*, None]' - - reveal_type(MyModel3.objects) # N: Revealed type is 'django.db.models.manager.Manager[myapp.models.MyModel3]' - reveal_type(MyModel3.objects.first()) # N: Revealed type is 'Union[myapp.models.MyModel3*, None]' - installed_apps: - - myapp - files: - - path: myapp/__init__.py - - path: myapp/models.py - content: | - from django.db import models - class ParentOfMyModel3(models.Model): - objects = models.Manager() - - class MyModel3(ParentOfMyModel3): - pass - -- case: inheritance_with_explicit_type_on_child_manager - main: | - from myapp.models import ParentOfMyModel4, MyModel4 - reveal_type(ParentOfMyModel4.objects) # N: Revealed type is 'django.db.models.manager.Manager[myapp.models.ParentOfMyModel4]' - reveal_type(ParentOfMyModel4.objects.first()) # N: Revealed type is 'Union[myapp.models.ParentOfMyModel4*, None]' - - reveal_type(MyModel4.objects) # N: Revealed type is 'django.db.models.manager.Manager[myapp.models.MyModel4]' - reveal_type(MyModel4.objects.first()) # N: Revealed type is 'Union[myapp.models.MyModel4*, None]' - installed_apps: - - myapp - files: - - path: myapp/__init__.py - - path: myapp/models.py - content: | - from django.db import models - class ParentOfMyModel4(models.Model): - objects = models.Manager() - - class MyModel4(ParentOfMyModel4): - objects = models.Manager['MyModel4']() - -# TODO: make it work someday -#- case: inheritance_of_two_models_with_custom_objects_manager -# main: | -# from myapp.models import MyBaseUser, MyUser -# reveal_type(MyBaseUser.objects) # N: Revealed type is 'myapp.models.MyBaseManager[myapp.models.MyBaseUser]' -# reveal_type(MyBaseUser.objects.get()) # N: Revealed type is 'myapp.models.MyBaseUser' -# -# reveal_type(MyUser.objects) # N: Revealed type is 'myapp.models.MyManager[myapp.models.MyUser]' -# reveal_type(MyUser.objects.get()) # N: Revealed type is 'myapp.models.MyUser' -# installed_apps: -# - myapp -# files: -# - path: myapp/__init__.py -# - path: myapp/models.py -# content: | -# from django.db import models -# -# class MyBaseManager(models.Manager): -# pass -# class MyBaseUser(models.Model): -# objects = MyBaseManager() -# -# class MyManager(models.Manager): -# pass -# class MyUser(MyBaseUser): -# objects = MyManager() - -- case: custom_manager_returns_proper_model_types - main: | - from myapp.models import User - reveal_type(User.objects) # N: Revealed type is 'myapp.models.User_MyManager2[myapp.models.User]' - reveal_type(User.objects.select_related()) # N: Revealed type is 'myapp.models.User_MyManager2[myapp.models.User]' - reveal_type(User.objects.get()) # N: Revealed type is 'myapp.models.User*' - reveal_type(User.objects.get_instance()) # N: Revealed type is 'builtins.int' - reveal_type(User.objects.get_instance_untyped('hello')) # N: Revealed type is 'Any' - - from myapp.models import ChildUser - reveal_type(ChildUser.objects) # N: Revealed type is 'myapp.models.ChildUser_MyManager2[myapp.models.ChildUser]' - reveal_type(ChildUser.objects.select_related()) # N: Revealed type is 'myapp.models.ChildUser_MyManager2[myapp.models.ChildUser]' - reveal_type(ChildUser.objects.get()) # N: Revealed type is 'myapp.models.ChildUser*' - reveal_type(ChildUser.objects.get_instance()) # N: Revealed type is 'builtins.int' - reveal_type(ChildUser.objects.get_instance_untyped('hello')) # N: Revealed type is 'Any' - installed_apps: - - myapp - files: - - path: myapp/__init__.py - - path: myapp/models.py - content: | - from django.db import models - class MyManager(models.Manager): - def get_instance(self) -> int: - pass - def get_instance_untyped(self, name): - pass - class User(models.Model): - objects = MyManager() - class ChildUser(models.Model): - objects = MyManager() - -- case: custom_manager_annotate_method_before_type_declaration - main: | - from myapp.models import ModelA, ModelB, ManagerA - reveal_type(ModelA.objects) # N: Revealed type is 'myapp.models.ModelA_ManagerA1[myapp.models.ModelA]' - reveal_type(ModelA.objects.do_something) # N: Revealed type is 'def (other_obj: myapp.models.ModelB) -> builtins.str' - installed_apps: - - myapp - files: - - path: myapp/__init__.py - - path: myapp/models.py - content: | - from django.db import models - class ManagerA(models.Manager): - def do_something(self, other_obj: "ModelB") -> str: - return 'test' - class ModelA(models.Model): - title = models.TextField() - objects = ManagerA() - class ModelB(models.Model): - movie = models.TextField() - diff --git a/tests/typecheck/models/test_contrib_models.yml b/tests/typecheck/models/test_contrib_models.yml deleted file mode 100644 index 946d2deb6..000000000 --- a/tests/typecheck/models/test_contrib_models.yml +++ /dev/null @@ -1,28 +0,0 @@ -- case: contrib_auth_model_fields - main: | - from django.contrib.auth.models import User - reveal_type(User().username) # N: Revealed type is 'builtins.str*' - reveal_type(User().password) # N: Revealed type is 'builtins.str*' - reveal_type(User().first_name) # N: Revealed type is 'builtins.str*' - reveal_type(User().last_name) # N: Revealed type is 'builtins.str*' - reveal_type(User().email) # N: Revealed type is 'builtins.str*' - reveal_type(User().is_staff) # N: Revealed type is 'builtins.bool*' - reveal_type(User().is_active) # N: Revealed type is 'builtins.bool*' - reveal_type(User().date_joined) # N: Revealed type is 'datetime.datetime*' - reveal_type(User().last_login) # N: Revealed type is 'Union[datetime.datetime, None]' - reveal_type(User().is_authenticated) # N: Revealed type is 'Literal[True]' - reveal_type(User().is_anonymous) # N: Revealed type is 'Literal[False]' - - from django.contrib.auth.models import AnonymousUser - reveal_type(AnonymousUser().is_authenticated) # N: Revealed type is 'Literal[False]' - reveal_type(AnonymousUser().is_anonymous) # N: Revealed type is 'Literal[True]' - - from django.contrib.auth.models import Permission - reveal_type(Permission().name) # N: Revealed type is 'builtins.str*' - reveal_type(Permission().codename) # N: Revealed type is 'builtins.str*' - - from django.contrib.auth.models import PermissionsMixin - reveal_type(PermissionsMixin().is_superuser) # N: Revealed type is 'builtins.bool*' - - from django.contrib.auth.models import Group - reveal_type(Group().name) # N: Revealed type is 'builtins.str*' diff --git a/tests/typecheck/models/test_create.yml b/tests/typecheck/models/test_create.yml deleted file mode 100644 index 37d46bdf8..000000000 --- a/tests/typecheck/models/test_create.yml +++ /dev/null @@ -1,113 +0,0 @@ -- case: default_manager_create_is_typechecked - main: | - from myapp.models import User - User.objects.create(pk=1, name='Max', age=10) - User.objects.create(age=[]) # E: Incompatible type for "age" of "User" (got "List[Any]", expected "Union[float, int, str, Combinable]") - installed_apps: - - myapp - files: - - path: myapp/__init__.py - - path: myapp/models.py - content: | - from django.db import models - - class User(models.Model): - name = models.CharField(max_length=100) - age = models.IntegerField() - -- case: model_recognises_parent_attributes - main: | - from myapp.models import Child - Child.objects.create(name='Maxim', lastname='Maxim2') - installed_apps: - - myapp - files: - - path: myapp/__init__.py - - path: myapp/models.py - content: | - from django.db import models - - class Parent(models.Model): - name = models.CharField(max_length=100) - class Child(Parent): - lastname = models.CharField(max_length=100) - -- case: deep_multiple_inheritance_with_create - main: | - from myapp.models import Child4 - Child4.objects.create(name1='n1', name2='n2', value=1, value4=4) - installed_apps: - - myapp - files: - - path: myapp/__init__.py - - path: myapp/models.py - content: | - from django.db import models - - class Parent1(models.Model): - name1 = models.CharField(max_length=50) - class Parent2(models.Model): - id2 = models.AutoField(primary_key=True) - name2 = models.CharField(max_length=50) - - class Child1(Parent1, Parent2): - value = models.IntegerField() - class Child4(Child1): - value4 = models.IntegerField() - -- case: optional_id_fields_for_create_is_error_if_not_autofield - main: | - from myapp.models import Publisher, Book - - Book.objects.create(id=None) # E: Incompatible type for "id" of "Book" (got "None", expected "Union[float, int, str, Combinable]") - Book.objects.create(publisher=None) # E: Incompatible type for "publisher" of "Book" (got "None", expected "Union[Publisher, Combinable]") - Book.objects.create(publisher_id=None) # E: Incompatible type for "publisher_id" of "Book" (got "None", expected "Union[Combinable, int, str]") - installed_apps: - - myapp - files: - - path: myapp/__init__.py - - path: myapp/models.py - content: | - from django.db import models - class Publisher(models.Model): - pass - class Book(models.Model): - id = models.IntegerField(primary_key=True) - publisher = models.ForeignKey(Publisher, on_delete=models.CASCADE) - -- case: none_for_primary_key_is_allowed_if_field_is_autogenerated - main: | - from myapp.models import Book - Book.objects.create(id=None) - installed_apps: - - myapp - files: - - path: myapp/__init__.py - - path: myapp/models.py - content: | - from django.db import models - class Book(models.Model): - pass - -- case: when_default_for_primary_key_is_specified_allow_none_to_be_set - main: | - from myapp.models import MyModel - MyModel(id=None) - MyModel.objects.create(id=None) - - from myapp.models import MyModel2 - MyModel2(id=None) - MyModel2.objects.create(id=None) # E: Incompatible type for "id" of "MyModel2" (got "None", expected "Union[float, int, str, Combinable]") - installed_apps: - - myapp - files: - - path: myapp/__init__.py - - path: myapp/models.py - content: | - from django.db import models - def return_int(): - return 0 - class MyModel(models.Model): - id = models.IntegerField(primary_key=True, default=return_int) - class MyModel2(models.Model): - id = models.IntegerField(primary_key=True) diff --git a/tests/typecheck/models/test_extra_methods.yml b/tests/typecheck/models/test_extra_methods.yml deleted file mode 100644 index 846e8ab39..000000000 --- a/tests/typecheck/models/test_extra_methods.yml +++ /dev/null @@ -1,56 +0,0 @@ -- case: if_field_has_choices_set_model_has_get_FIELDNAME_display_method - main: | - from myapp.models import MyUser - user = MyUser(name='user', gender='M') - user.get_name_display() # E: "MyUser" has no attribute "get_name_display"; maybe "get_gender_display"? - reveal_type(user.get_gender_display()) # N: Revealed type is 'builtins.str' - installed_apps: - - myapp - files: - - path: myapp/__init__.py - - path: myapp/models.py - content: | - from django.db import models - GENDER_CHOICES = ( - ('M', 'Male'), - ('F', 'Female'), - ) - class MyUser(models.Model): - name = models.CharField(max_length=100) - gender = models.CharField(max_length=100, choices=GENDER_CHOICES) - -- case: date_datetime_fields_have_get_next_by_get_previous_by - main: | - from myapp.models import MyUser - reveal_type(MyUser().get_next_by_date()) # N: Revealed type is 'myapp.models.MyUser' - reveal_type(MyUser().get_next_by_datetime()) # N: Revealed type is 'myapp.models.MyUser' - reveal_type(MyUser().get_previous_by_date()) # N: Revealed type is 'myapp.models.MyUser' - reveal_type(MyUser().get_previous_by_datetime()) # N: Revealed type is 'myapp.models.MyUser' - - # accept arbitrary kwargs - MyUser().get_next_by_date(arg1=1, arg2=2) - installed_apps: - - myapp - files: - - path: myapp/__init__.py - - path: myapp/models.py - content: | - from django.db import models - class MyUser(models.Model): - date = models.DateField() - datetime = models.DateTimeField() - -- case: get_next_by_get_previous_by_absent_if_null_true - main: | - from myapp.models import MyUser - MyUser().get_next_by_date() # E: "MyUser" has no attribute "get_next_by_date" - MyUser().get_previous_by_date() # E: "MyUser" has no attribute "get_previous_by_date" - installed_apps: - - myapp - files: - - path: myapp/__init__.py - - path: myapp/models.py - content: | - from django.db import models - class MyUser(models.Model): - date = models.DateField(null=True) diff --git a/tests/typecheck/models/test_inheritance.yml b/tests/typecheck/models/test_inheritance.yml deleted file mode 100644 index 78366f432..000000000 --- a/tests/typecheck/models/test_inheritance.yml +++ /dev/null @@ -1,115 +0,0 @@ -- case: test_meta_nested_class_allows_subclassing_in_multiple_inheritance - main: | - from typing import Any - from django.db import models - class Mixin1(models.Model): - class Meta: - abstract = True - class Mixin2(models.Model): - class Meta: - abstract = True - class User(Mixin1, Mixin2): - pass - -- case: test_inheritance_from_abstract_model_does_not_fail_if_field_with_id_exists - main: | - from django.db import models - class Abstract(models.Model): - class Meta: - abstract = True - class User(Abstract): - id = models.AutoField(primary_key=True) - -- case: test_typechecking_for_model_subclasses - main: | - from myapp.models import A, B, C - def service(a: A) -> int: - pass - b_instance = B() - service(b_instance) # E: Argument 1 to "service" has incompatible type "B"; expected "A" - a_instance = A() - c_instance = C() - service(a_instance) - service(c_instance) - installed_apps: - - myapp - files: - - path: myapp/__init__.py - - path: myapp/models.py - content: | - from django.db import models - class A(models.Model): - pass - class B(models.Model): - b_attr = 1 - pass - class C(A): - pass - -- case: fail_if_no_such_attribute_on_model - main: | - from myapp.models import B - b_instance = B() - reveal_type(b_instance.b_attr) # N: Revealed type is 'builtins.int' - - reveal_type(b_instance.non_existent_attribute) - b_instance.non_existent_attribute = 2 - out: | - main:5: note: Revealed type is 'Any' - main:5: error: "B" has no attribute "non_existent_attribute" - main:6: error: "B" has no attribute "non_existent_attribute" - installed_apps: - - myapp - files: - - path: myapp/__init__.py - - path: myapp/models.py - content: | - from django.db import models - class B(models.Model): - b_attr = 1 - pass - - -- case: fields_recognized_if_base_model_is_subclass_of_models_model - main: | - from myapp.models import User - reveal_type(User().username) # N: Revealed type is 'builtins.str*' - installed_apps: - - myapp - files: - - path: myapp/__init__.py - - path: myapp/models.py - content: | - from django.db import models - from myapp.utils import MyBaseModel - class User(MyBaseModel): - username = models.CharField(max_length=100) - - path: myapp/utils.py - content: | - from django.db.models import Model - class MyBaseModel(Model): - pass - - -- case: django_contrib_gis_base_model_mixin_inheritance - main: | - from myapp.models import User - reveal_type(User().name) # N: Revealed type is 'builtins.str*' - reveal_type(User().updated_at) # N: Revealed type is 'datetime.datetime*' - installed_apps: - - myapp - files: - - path: myapp/__init__.py - - path: myapp/models.py - content: | - from django.db import models - from django.contrib.gis.db import models as gis_models - class Mixin1(gis_models.Model): - class Meta: - abstract = True - class Mixin2(gis_models.Model): - updated_at = models.DateTimeField(auto_now=True) - class Meta: - abstract = True - class User(Mixin1, Mixin2): - name = models.TextField() \ No newline at end of file diff --git a/tests/typecheck/models/test_init.yml b/tests/typecheck/models/test_init.yml deleted file mode 100644 index 40ac5836c..000000000 --- a/tests/typecheck/models/test_init.yml +++ /dev/null @@ -1,257 +0,0 @@ -- case: arguments_to_init_unexpected_attributes - main: | - from myapp.models import MyUser - user = MyUser(name=1, age=12) - out: | - main:2: error: Unexpected attribute "name" for model "MyUser" - main:2: error: Unexpected attribute "age" for model "MyUser" - installed_apps: - - myapp - files: - - path: myapp/__init__.py - - path: myapp/models.py - content: | - from django.db import models - - class MyUser(models.Model): - pass - -- case: plain_function_which_returns_model - main: | - from myapp.models import MyUser - def func(i: int) -> MyUser: - pass - func("hello") # E: Argument 1 to "func" has incompatible type "str"; expected "int" - installed_apps: - - myapp - files: - - path: myapp/__init__.py - - path: myapp/models.py - content: | - from django.db import models - class MyUser(models.Model): - pass - -- case: arguments_to_init_from_class_incompatible_type - main: | - from myapp.models import MyUser - user = MyUser(name='hello', age=[]) - out: | - main:2: error: Incompatible type for "age" of "MyUser" (got "List[Any]", expected "Union[float, int, str, Combinable]") - installed_apps: - - myapp - files: - - path: myapp/__init__.py - - path: myapp/models.py - content: | - from django.db import models - - class MyUser(models.Model): - name = models.CharField(max_length=100) - age = models.IntegerField() - -- case: arguments_to_init_combined_from_base_classes - main: | - from myapp.models import BaseUser, ChildUser - user = ChildUser(name='Max', age=12, lastname='Lastname') - installed_apps: - - myapp - files: - - path: myapp/__init__.py - - path: myapp/models.py - content: | - from django.db import models - - class BaseUser(models.Model): - name = models.CharField(max_length=100) - age = models.IntegerField() - class ChildUser(BaseUser): - lastname = models.CharField(max_length=100) - -- case: fields_from_abstract_user_propagate_to_init - main: | - from myapp.models import MyUser - user = MyUser(name='Maxim') - installed_apps: - - myapp - files: - - path: myapp/__init__.py - - path: myapp/models.py - content: | - from django.db import models - class AbstractUser(models.Model): - class Meta: - abstract = True - name = models.CharField(max_length=100) - class MyUser(AbstractUser): - pass - -- case: pk_refers_to_primary_key_and_could_be_passed_to_init - main: | - from myapp.models import MyUser1, MyUser2 - user2 = MyUser1(pk='hello') - user3 = MyUser2(pk=1, name='maxim') - installed_apps: - - myapp - files: - - path: myapp/__init__.py - - path: myapp/models.py - content: | - from django.db import models - - class MyUser1(models.Model): - mypk = models.CharField(primary_key=True) - class MyUser2(models.Model): - name = models.CharField(max_length=100) - -- case: typechecking_of_pk - main: | - from myapp.models import MyUser1 - user = MyUser1(pk=[]) # E: Incompatible type for "pk" of "MyUser1" (got "List[Any]", expected "Union[float, int, str, Combinable, None]") - installed_apps: - - myapp - files: - - path: myapp/__init__.py - - path: myapp/models.py - content: | - from django.db import models - - class MyUser1(models.Model): - mypk = models.IntegerField(primary_key=True) - -- case: set_foreign_key_by_its_primary_key - main: | - from datetime import datetime - now = datetime.now() - - from myapp.models import Publisher, PublisherDatetime, Book - Book(publisher_id=1, publisher_dt_id=now) - Book(publisher_id=[], publisher_dt_id=now) # E: Incompatible type for "publisher_id" of "Book" (got "List[Any]", expected "Union[Combinable, int, str, None]") - Book(publisher_id=1, publisher_dt_id=1) # E: Incompatible type for "publisher_dt_id" of "Book" (got "int", expected "Union[str, date, Combinable, None]") - installed_apps: - - myapp - files: - - path: myapp/__init__.py - - path: myapp/models.py - content: | - from django.db import models - - class Publisher(models.Model): - pass - class PublisherDatetime(models.Model): - dt_pk = models.DateTimeField(primary_key=True) - class Book(models.Model): - publisher = models.ForeignKey(Publisher, on_delete=models.CASCADE) - publisher_dt = models.ForeignKey(PublisherDatetime, on_delete=models.CASCADE) - -- case: setting_value_to_an_array_of_ints - main: | - from typing import List, Tuple - from myapp.models import MyModel - array_val: Tuple[int, ...] = (1,) - MyModel(array=array_val) - array_val2: List[int] = [1] - MyModel(array=array_val2) - class NotAValid: - pass - array_val3: List[NotAValid] = [NotAValid()] - MyModel(array=array_val3) # E: Incompatible type for "array" of "MyModel" (got "List[NotAValid]", expected "Union[Sequence[Union[float, int, str, Combinable]], Combinable]") - installed_apps: - - myapp - files: - - path: myapp/__init__.py - - path: myapp/models.py - content: | - from typing import List, Tuple - - from django.db import models - from django.contrib.postgres.fields import ArrayField - - class MyModel(models.Model): - array = ArrayField(base_field=models.IntegerField()) - -- case: if_no_explicit_primary_key_id_can_be_passed - main: | - from myapp.models import MyModel - MyModel(id=1, name='maxim') - installed_apps: - - myapp - files: - - path: myapp/__init__.py - - path: myapp/models.py - content: | - from django.db import models - class MyModel(models.Model): - name = models.CharField(max_length=100) - -- case: arguments_can_be_passed_as_positionals - main: | - from myapp.models import MyModel, MyModel2 - MyModel(1) - MyModel2(1, 12) - MyModel2(1, []) # E: Incompatible type for "name" of "MyModel2" (got "List[Any]", expected "Union[float, int, str, Combinable]") - installed_apps: - - myapp - files: - - path: myapp/__init__.py - - path: myapp/models.py - content: | - from django.db import models - class MyModel(models.Model): - pass - class MyModel2(models.Model): - name = models.IntegerField() - -- case: charfield_with_integer_choices - main: | - from myapp.models import MyModel - MyModel(day=1) - installed_apps: - - myapp - files: - - path: myapp/__init__.py - - path: myapp/models.py - content: | - from django.db import models - class MyModel(models.Model): - day = models.CharField(max_length=3, choices=((1, 'Fri'), (2, 'Sat'))) - -- case: optional_id_fields_allowed_in_init - main: | - from myapp.models import Book, Publisher - Book(id=None) - Book(publisher=None) - Book(publisher_id=None) - installed_apps: - - myapp - files: - - path: myapp/__init__.py - - path: myapp/models.py - content: | - from django.db import models - class Publisher(models.Model): - name = models.CharField(primary_key=True, max_length=100) - class Book(models.Model): - publisher = models.ForeignKey(Publisher, on_delete=models.CASCADE) - - -- case: init_in_abstract_model_classmethod_should_not_throw_error_for_valid_fields - main: | - from myapp.models import MyModel - MyModel.base_init() - installed_apps: - - myapp - files: - - path: myapp/__init__.py - - path: myapp/models.py - content: | - from django.db import models - class AbstractModel(models.Model): - class Meta: - abstract = True - text = models.CharField(max_length=100) - @classmethod - def base_init(cls) -> 'AbstractModel': - return cls(text='mytext') - class MyModel(AbstractModel): - pass \ No newline at end of file diff --git a/tests/typecheck/models/test_meta_options.yml b/tests/typecheck/models/test_meta_options.yml deleted file mode 100644 index 248f4e106..000000000 --- a/tests/typecheck/models/test_meta_options.yml +++ /dev/null @@ -1,58 +0,0 @@ -- case: meta_attribute_has_a_type_of_current_model - main: | - from myapp.models import MyUser - reveal_type(MyUser._meta) # N: Revealed type is 'django.db.models.options.Options[myapp.models.MyUser]' - installed_apps: - - myapp - files: - - path: myapp/__init__.py - - path: myapp/models.py - content: | - from django.db import models - class MyUser(models.Model): - pass - -- case: get_field_returns_proper_field_type - main: | - from myapp.models import MyUser - reveal_type(MyUser._meta.get_field('base_name')) # N: Revealed type is 'django.db.models.fields.CharField[Any, Any]' - reveal_type(MyUser._meta.get_field('name')) # N: Revealed type is 'django.db.models.fields.CharField[Any, Any]' - reveal_type(MyUser._meta.get_field('age')) # N: Revealed type is 'django.db.models.fields.IntegerField[Any, Any]' - reveal_type(MyUser._meta.get_field('unknown')) - reveal_type(MyUser._meta.get_field('to_user')) # N: Revealed type is 'django.db.models.fields.related.ForeignKey[Any, Any]' - out: | - main:5: note: Revealed type is 'Any' - main:5: error: MyUser has no field named 'unknown' - installed_apps: - - myapp - files: - - path: myapp/__init__.py - - path: myapp/models.py - content: | - from django.db import models - class MyBaseUser(models.Model): - base_name = models.CharField(max_length=100) - class MyUser(MyBaseUser): - name = models.CharField(max_length=100) - age = models.IntegerField() - to_user = models.ForeignKey('self', on_delete=models.SET_NULL) - -- case: get_field_with_abstract_inheritance - main: | - from myapp.models import AbstractModel - class MyModel(AbstractModel): - pass - reveal_type(MyModel._meta.get_field('field')) # N: Revealed type is 'Any' - installed_apps: - - myapp - files: - - path: myapp/__init__.py - - path: myapp/models.py - content: | - from django.db import models - from django.contrib.postgres.fields import ArrayField - class AbstractModel(models.Model): - class Meta: - abstract = True - class MyModel(AbstractModel): - field = ArrayField(models.IntegerField(), default=[]) diff --git a/tests/typecheck/models/test_proxy_models.yml b/tests/typecheck/models/test_proxy_models.yml deleted file mode 100644 index ba46845ab..000000000 --- a/tests/typecheck/models/test_proxy_models.yml +++ /dev/null @@ -1,21 +0,0 @@ -- case: foreign_key_to_proxy_model_accepts_first_non_proxy_model - main: | - from myapp.models import Blog, Publisher, PublisherProxy - Blog(publisher=Publisher()) - Blog.objects.create(publisher=Publisher()) - Blog().publisher = Publisher() - reveal_type(Blog().publisher) # N: Revealed type is 'myapp.models.PublisherProxy*' - installed_apps: - - myapp - files: - - path: myapp/__init__.py - - path: myapp/models.py - content: | - from django.db import models - class Publisher(models.Model): - pass - class PublisherProxy(Publisher): - class Meta: - proxy = True - class Blog(models.Model): - publisher = models.ForeignKey(to=PublisherProxy, on_delete=models.CASCADE) diff --git a/tests/typecheck/models/test_state.yml b/tests/typecheck/models/test_state.yml deleted file mode 100644 index c7dd4b84b..000000000 --- a/tests/typecheck/models/test_state.yml +++ /dev/null @@ -1,14 +0,0 @@ -- case: state_attribute_has_a_type_of_model_state - main: | - from myapp.models import MyUser - user = MyUser(pk=1) - reveal_type(user._state) # N: Revealed type is 'django.db.models.base.ModelState' - installed_apps: - - myapp - files: - - path: myapp/__init__.py - - path: myapp/models.py - content: | - from django.db import models - class MyUser(models.Model): - pass diff --git a/tests/typecheck/test/test_testcase.yml b/tests/typecheck/test/test_testcase.yml deleted file mode 100644 index d7125c3a4..000000000 --- a/tests/typecheck/test/test_testcase.yml +++ /dev/null @@ -1,12 +0,0 @@ -- case: testcase_client_attr - main: | - from django.test.testcases import TestCase - - class ExampleTestCase(TestCase): - def test_method(self) -> None: - reveal_type(self.client) # N: Revealed type is 'django.test.client.Client' - resp = self.client.post('/url', {'doit': 'srs'}, 'application/json', False, True, extra='value') - reveal_type(resp.status_code) # N: Revealed type is 'builtins.int' - # Attributes monkey-patched by test Client class: - resp.json() - reveal_type(resp.wsgi_request) # N: Revealed type is 'django.core.handlers.wsgi.WSGIRequest' diff --git a/tests/typecheck/test_config.yml b/tests/typecheck/test_config.yml deleted file mode 100644 index 8cf9961bd..000000000 --- a/tests/typecheck/test_config.yml +++ /dev/null @@ -1,67 +0,0 @@ -- case: pyproject_toml_config - main: | - from myapp.models import MyModel - mymodel = MyModel(user_id=1) - reveal_type(mymodel.id) # N: Revealed type is 'builtins.int*' - reveal_type(mymodel.user) # N: Revealed type is 'django.contrib.auth.models.User*' - reveal_type(mymodel.objects) # N: Revealed type is 'django.db.models.manager.Manager[myapp.models.MyModel]' - mypy_config: | - [mypy.plugins.django-stubs] - django_settings_module = mysettings - custom_settings: | - SECRET_KEY = '1' - INSTALLED_APPS = ('django.contrib.contenttypes', 'django.contrib.auth', 'myapp') - files: - - path: myapp/__init__.py - - path: myapp/models.py - content: | - from typing import TYPE_CHECKING - from django.db import models - class MyModel(models.Model): - user = models.ForeignKey('auth.User', on_delete=models.CASCADE) - if TYPE_CHECKING: - reveal_type(MyModel().user) # N: Revealed type is 'django.contrib.auth.models.User*' - -- case: generate_pyproject_toml_and_settings_file_from_installed_apps_key - main: | - from myapp.models import MyModel - mymodel = MyModel(user_id=1) - reveal_type(mymodel.id) # N: Revealed type is 'builtins.int*' - installed_apps: - - django.contrib.auth - - myapp - files: - - path: myapp/__init__.py - - path: myapp/models.py - content: | - from django.db import models - class MyModel(models.Model): - user = models.ForeignKey('auth.User', on_delete=models.CASCADE) - -- case: add_mypy_path_to_package_search - main: | - import extra_module - mypy_config: | - [mypy] - mypy_path = ./extras - [mypy.plugins.django-stubs] - django_settings_module = mysettings - files: - - path: extras/extra_module.py - content: | - def extra_fn(): - pass - -- case: add_mypypath_env_var_to_package_search - main: | - import extra_module - mypy_config: | - [mypy.plugins.django-stubs] - django_settings_module = mysettings - env: - - MYPYPATH=./extras - files: - - path: extras/extra_module.py - content: | - def extra_fn(): - pass diff --git a/tests/typecheck/test_forms.yml b/tests/typecheck/test_forms.yml deleted file mode 100644 index 141640603..000000000 --- a/tests/typecheck/test_forms.yml +++ /dev/null @@ -1,70 +0,0 @@ -- case: no_incompatible_meta_nested_class_false_positive - main: | - from django import forms - from myapp.models import Article, Category - class ArticleForm(forms.ModelForm): - class Meta: - model = Article - fields = '__all__' - class CategoryForm(forms.ModelForm): - class Meta: - model = Category - fields = '__all__' - class CompositeForm(ArticleForm, CategoryForm): - pass - installed_apps: - - myapp - files: - - path: myapp/__init__.py - - path: myapp/models.py - content: | - from django.db import models - from django import forms - - class Article(models.Model): - pass - class Category(models.Model): - pass - -- case: formview_methods_on_forms_return_proper_types - main: | - from typing import Any - from django import forms - from django.views.generic.edit import FormView - - class MyForm(forms.ModelForm): - pass - class MyForm2(forms.ModelForm): - pass - class MyView(FormView): - form_class = MyForm - def post(self, request, *args: Any, **kwds: Any): - form_class = self.get_form_class() - reveal_type(form_class) # N: Revealed type is 'Type[main.MyForm]' - reveal_type(self.get_form(None)) # N: Revealed type is 'main.MyForm' - reveal_type(self.get_form()) # N: Revealed type is 'main.MyForm' - reveal_type(self.get_form(form_class)) # N: Revealed type is 'main.MyForm' - reveal_type(self.get_form(MyForm2)) # N: Revealed type is 'main.MyForm2' - -- case: updateview_form_valid_has_form_save - main: | - from django import forms - from django.views.generic.edit import UpdateView - - class MyForm(forms.ModelForm): - pass - class MyView(UpdateView): - form_class = MyForm - def form_valid(self, form: forms.BaseModelForm): - reveal_type(form.save) # N: Revealed type is 'def (commit: builtins.bool =) -> Any' - -- case: successmessagemixin_compatible_with_formmixin - main: | - from django.views.generic.edit import FormMixin - from django.contrib.messages.views import SuccessMessageMixin - - class FormFirstView(FormMixin, SuccessMessageMixin): - pass - - class SuccessMessageFirstView(FormMixin, SuccessMessageMixin): - pass diff --git a/tests/typecheck/test_helpers.yml b/tests/typecheck/test_helpers.yml deleted file mode 100644 index f82ceeaae..000000000 --- a/tests/typecheck/test_helpers.yml +++ /dev/null @@ -1,62 +0,0 @@ -- case: transaction_atomic_contextmanager - main: | - from django.db import transaction - with transaction.atomic(): - pass - with transaction.atomic(using="mydb"): - pass - with transaction.atomic(using="mydb", savepoint=False): - pass - -- case: transaction_atomic_decorator - main: | - from django.db import transaction - - @transaction.atomic() - def decorated_func(param1: str, param2: int) -> bool: - pass - # Ensure that the function's type is preserved - reveal_type(decorated_func) # N: Revealed type is 'def (param1: builtins.str, param2: builtins.int) -> builtins.bool' - - @transaction.atomic(using="mydb") - def decorated_func_using(param1: str, param2: int) -> bool: - pass - # Ensure that the function's type is preserved - reveal_type(decorated_func_using) # N: Revealed type is 'def (param1: builtins.str, param2: builtins.int) -> builtins.bool' - - class ClassWithAtomicMethod: - # Bare decorator - @transaction.atomic - def atomic_method1(self, abc: int) -> str: - pass - @transaction.atomic(savepoint=True) - def atomic_method2(self): - pass - @transaction.atomic(using="db", savepoint=True) - def atomic_method3(self, myparam: str) -> int: - pass - ClassWithAtomicMethod().atomic_method1("abc") # E: Argument 1 to "atomic_method1" of "ClassWithAtomicMethod" has incompatible type "str"; expected "int" - # Ensure that the method's type is preserved - reveal_type(ClassWithAtomicMethod().atomic_method1) # N: Revealed type is 'def (abc: builtins.int) -> builtins.str' - # Ensure that the method's type is preserved - reveal_type(ClassWithAtomicMethod().atomic_method3) # N: Revealed type is 'def (myparam: builtins.str) -> builtins.int' - - -- case: mark_safe_decorator_and_function - main: | - from django.utils.safestring import mark_safe - s = 'hello' - reveal_type(mark_safe(s)) # N: Revealed type is 'django.utils.safestring.SafeText' - reveal_type(mark_safe(s) + mark_safe(s)) # N: Revealed type is 'django.utils.safestring.SafeText' - reveal_type(s + mark_safe(s)) # N: Revealed type is 'builtins.str' - - s += mark_safe(s) - reveal_type(s) # N: Revealed type is 'builtins.str' - ms = mark_safe(s) - ms += mark_safe(s) - reveal_type(ms) # N: Revealed type is 'django.utils.safestring.SafeText' - - @mark_safe - def func(s: str) -> str: - pass - reveal_type(func) # N: Revealed type is 'def (s: builtins.str) -> builtins.str' diff --git a/tests/typecheck/test_import_all.yml b/tests/typecheck/test_import_all.yml deleted file mode 100644 index 3540fa95d..000000000 --- a/tests/typecheck/test_import_all.yml +++ /dev/null @@ -1,442 +0,0 @@ -- case: import_all_modules - main: | - import django.apps - import django.apps.config - import django.apps.registry - import django.conf.global_settings - import django.conf.locale - import django.conf.urls - import django.conf.urls.i18n - import django.conf.urls.static - import django.contrib.admin.actions - import django.contrib.admin.apps - import django.contrib.admin.checks - import django.contrib.admin.decorators - import django.contrib.admin.filters - import django.contrib.admin.forms - import django.contrib.admin.helpers - import django.contrib.admin.models - import django.contrib.admin.options - import django.contrib.admin.sites - import django.contrib.admin.templatetags - import django.contrib.admin.templatetags.admin_list - import django.contrib.admin.templatetags.admin_modify - import django.contrib.admin.templatetags.admin_static - import django.contrib.admin.templatetags.admin_urls - import django.contrib.admin.templatetags.base - import django.contrib.admin.templatetags.log - import django.contrib.admin.tests - import django.contrib.admin.utils - import django.contrib.admin.views - import django.contrib.admin.views.autocomplete - import django.contrib.admin.views.decorators - import django.contrib.admin.views.main - import django.contrib.admin.widgets - import django.contrib.admindocs - import django.contrib.admindocs.middleware - import django.contrib.admindocs.urls - import django.contrib.admindocs.utils - import django.contrib.admindocs.views - import django.contrib.auth.admin - import django.contrib.auth.apps - import django.contrib.auth.backends - import django.contrib.auth.base_user - import django.contrib.auth.checks - import django.contrib.auth.context_processors - import django.contrib.auth.decorators - import django.contrib.auth.forms - import django.contrib.auth.handlers - import django.contrib.auth.handlers.modwsgi - import django.contrib.auth.hashers - import django.contrib.auth.management.commands - import django.contrib.auth.management.commands.changepassword - import django.contrib.auth.management.commands.createsuperuser - import django.contrib.auth.middleware - import django.contrib.auth.mixins - import django.contrib.auth.models - import django.contrib.auth.password_validation - import django.contrib.auth.signals - import django.contrib.auth.tokens - import django.contrib.auth.urls - import django.contrib.auth.validators - import django.contrib.auth.views - import django.contrib.contenttypes.admin - import django.contrib.contenttypes.apps - import django.contrib.contenttypes.checks - import django.contrib.contenttypes.fields - import django.contrib.contenttypes.forms - import django.contrib.contenttypes.management.commands - import django.contrib.contenttypes.management.commands.remove_stale_contenttypes - import django.contrib.contenttypes.models - import django.contrib.contenttypes.views - import django.contrib.flatpages.forms - import django.contrib.flatpages.middleware - import django.contrib.flatpages.models - import django.contrib.flatpages.sitemaps - import django.contrib.flatpages.templatetags - import django.contrib.flatpages.templatetags.flatpages - import django.contrib.flatpages.urls - import django.contrib.flatpages.views - import django.contrib.gis.db.models - import django.contrib.gis.db.models.fields - import django.contrib.humanize.templatetags - import django.contrib.humanize.templatetags.humanize - import django.contrib.messages.api - import django.contrib.messages.constants - import django.contrib.messages.context_processors - import django.contrib.messages.middleware - import django.contrib.messages.storage - import django.contrib.messages.storage.base - import django.contrib.messages.storage.cookie - import django.contrib.messages.storage.fallback - import django.contrib.messages.storage.session - import django.contrib.messages.utils - import django.contrib.messages.views - import django.contrib.postgres.aggregates - import django.contrib.postgres.aggregates.general - import django.contrib.postgres.aggregates.mixins - import django.contrib.postgres.aggregates.statistics - import django.contrib.postgres.constraints - import django.contrib.postgres.fields - import django.contrib.postgres.fields.array - import django.contrib.postgres.fields.citext - import django.contrib.postgres.fields.hstore - import django.contrib.postgres.fields.jsonb - import django.contrib.postgres.fields.mixins - import django.contrib.postgres.fields.ranges - import django.contrib.postgres.functions - import django.contrib.postgres.indexes - import django.contrib.postgres.lookups - import django.contrib.postgres.operations - import django.contrib.postgres.search - import django.contrib.postgres.signals - import django.contrib.postgres.validators - import django.contrib.redirects - import django.contrib.redirects.middleware - import django.contrib.redirects.models - import django.contrib.sessions.backends - import django.contrib.sessions.backends.base - import django.contrib.sessions.backends.cache - import django.contrib.sessions.backends.cached_db - import django.contrib.sessions.backends.db - import django.contrib.sessions.backends.file - import django.contrib.sessions.backends.signed_cookies - import django.contrib.sessions.base_session - import django.contrib.sessions.exceptions - import django.contrib.sessions.management.commands - import django.contrib.sessions.management.commands.clearsessions - import django.contrib.sessions.middleware - import django.contrib.sessions.models - import django.contrib.sessions.serializers - import django.contrib.sitemaps.management.commands - import django.contrib.sitemaps.management.commands.ping_google - import django.contrib.sitemaps.views - import django.contrib.sites - import django.contrib.sites.apps - import django.contrib.sites.management - import django.contrib.sites.managers - import django.contrib.sites.middleware - import django.contrib.sites.models - import django.contrib.sites.requests - import django.contrib.sites.shortcuts - import django.contrib.staticfiles.apps - import django.contrib.staticfiles.checks - import django.contrib.staticfiles.finders - import django.contrib.staticfiles.handlers - import django.contrib.staticfiles.management.commands - import django.contrib.staticfiles.management.commands.collectstatic - import django.contrib.staticfiles.management.commands.findstatic - import django.contrib.staticfiles.management.commands.runserver - import django.contrib.staticfiles.storage - import django.contrib.staticfiles.templatetags - import django.contrib.staticfiles.templatetags.staticfiles - import django.contrib.staticfiles.testing - import django.contrib.staticfiles.urls - import django.contrib.staticfiles.utils - import django.contrib.staticfiles.views - import django.contrib.syndication - import django.contrib.syndication.views - import django.core.cache.backends - import django.core.cache.backends.base - import django.core.cache.backends.db - import django.core.cache.backends.dummy - import django.core.cache.backends.filebased - import django.core.cache.backends.locmem - import django.core.cache.backends.memcached - import django.core.cache.utils - import django.core.checks.caches - import django.core.checks.database - import django.core.checks.messages - import django.core.checks.model_checks - import django.core.checks.registry - import django.core.checks.security - import django.core.checks.security.base - import django.core.checks.security.csrf - import django.core.checks.security.sessions - import django.core.checks.templates - import django.core.checks.translation - import django.core.checks.urls - import django.core.exceptions - import django.core.files - import django.core.files.base - import django.core.files.images - import django.core.files.locks - import django.core.files.move - import django.core.files.storage - import django.core.files.temp - import django.core.files.uploadedfile - import django.core.files.uploadhandler - import django.core.files.utils - import django.core.handlers - import django.core.handlers.base - import django.core.handlers.exception - import django.core.handlers.wsgi - import django.core.mail.backends - import django.core.mail.backends.base - import django.core.mail.message - import django.core.mail.utils - import django.core.management.base - import django.core.management.color - import django.core.management.commands - import django.core.management.commands.dumpdata - import django.core.management.commands.loaddata - import django.core.management.commands.makemessages - import django.core.management.commands.runserver - import django.core.management.commands.testserver - import django.core.management.sql - import django.core.management.templates - import django.core.management.utils - import django.core.paginator - import django.core.serializers - import django.core.serializers.base - import django.core.serializers.json - import django.core.serializers.python - import django.core.servers - import django.core.servers.basehttp - import django.core.signals - import django.core.signing - import django.core.validators - import django.core.wsgi - import django.db.backends.base - import django.db.backends.base.base - import django.db.backends.base.client - import django.db.backends.base.creation - import django.db.backends.base.features - import django.db.backends.base.introspection - import django.db.backends.base.operations - import django.db.backends.base.schema - import django.db.backends.base.validation - import django.db.backends.ddl_references - import django.db.backends.dummy - import django.db.backends.dummy.base - import django.db.backends.mysql - import django.db.backends.mysql.client - import django.db.backends.postgresql - import django.db.backends.postgresql.base - import django.db.backends.postgresql.client - import django.db.backends.postgresql.creation - import django.db.backends.postgresql.operations - import django.db.backends.signals - import django.db.backends.sqlite3 - import django.db.backends.sqlite3.base - import django.db.backends.sqlite3.creation - import django.db.backends.sqlite3.features - import django.db.backends.sqlite3.introspection - import django.db.backends.sqlite3.operations - import django.db.backends.sqlite3.schema - import django.db.backends.utils - import django.db.migrations.autodetector - import django.db.migrations.exceptions - import django.db.migrations.executor - import django.db.migrations.graph - import django.db.migrations.loader - import django.db.migrations.migration - import django.db.migrations.operations - import django.db.migrations.operations.base - import django.db.migrations.operations.fields - import django.db.migrations.operations.models - import django.db.migrations.operations.special - import django.db.migrations.operations.utils - import django.db.migrations.optimizer - import django.db.migrations.questioner - import django.db.migrations.recorder - import django.db.migrations.serializer - import django.db.migrations.state - import django.db.migrations.topological_sort - import django.db.migrations.utils - import django.db.migrations.writer - import django.db.models.aggregates - import django.db.models.base - import django.db.models.constraints - import django.db.models.deletion - import django.db.models.expressions - import django.db.models.enums - import django.db.models.fields - import django.db.models.fields.files - import django.db.models.fields.mixins - import django.db.models.fields.proxy - import django.db.models.fields.related - import django.db.models.fields.related_descriptors - import django.db.models.fields.related_lookups - import django.db.models.fields.reverse_related - import django.db.models.functions - import django.db.models.functions.comparison - import django.db.models.functions.datetime - import django.db.models.functions.math - import django.db.models.functions.mixins - import django.db.models.functions.text - import django.db.models.functions.window - import django.db.models.indexes - import django.db.models.lookups - import django.db.models.manager - import django.db.models.options - import django.db.models.query - import django.db.models.query_utils - import django.db.models.signals - import django.db.models.sql - import django.db.models.sql.compiler - import django.db.models.sql.constants - import django.db.models.sql.datastructures - import django.db.models.sql.query - import django.db.models.sql.subqueries - import django.db.models.sql.where - import django.db.models.utils - import django.db.transaction - import django.db.utils - import django.dispatch - import django.dispatch.dispatcher - import django.forms - import django.forms.boundfield - import django.forms.fields - import django.forms.forms - import django.forms.formsets - import django.forms.models - import django.forms.renderers - import django.forms.utils - import django.forms.widgets - import django.http - import django.http.cookie - import django.http.multipartparser - import django.http.request - import django.http.response - import django.middleware - import django.middleware.cache - import django.middleware.clickjacking - import django.middleware.common - import django.middleware.csrf - import django.middleware.gzip - import django.middleware.http - import django.middleware.locale - import django.middleware.security - import django.shortcuts - import django.template.backends - import django.template.backends.base - import django.template.backends.django - import django.template.backends.dummy - import django.template.backends.jinja2 - import django.template.backends.utils - import django.template.base - import django.template.context - import django.template.context_processors - import django.template.defaultfilters - import django.template.defaulttags - import django.template.engine - import django.template.exceptions - import django.template.library - import django.template.loader - import django.template.loader_tags - import django.template.loaders - import django.template.loaders.app_directories - import django.template.loaders.base - import django.template.loaders.cached - import django.template.loaders.filesystem - import django.template.loaders.locmem - import django.template.response - import django.template.smartif - import django.template.utils - import django.templatetags - import django.templatetags.cache - import django.templatetags.i18n - import django.templatetags.l10n - import django.templatetags.static - import django.templatetags.tz - import django.test - import django.test.client - import django.test.html - import django.test.runner - import django.test.selenium - import django.test.signals - import django.test.testcases - import django.test.utils - import django.urls - import django.urls.base - import django.urls.conf - import django.urls.converters - import django.urls.exceptions - import django.urls.resolvers - import django.urls.utils - import django.utils._os - import django.utils.archive - import django.utils.autoreload - import django.utils.baseconv - import django.utils.cache - import django.utils.crypto - import django.utils.datastructures - import django.utils.dateformat - import django.utils.dateparse - import django.utils.dates - import django.utils.datetime_safe - import django.utils.deconstruct - import django.utils.decorators - import django.utils.deprecation - import django.utils.duration - import django.utils.encoding - import django.utils.feedgenerator - import django.utils.formats - import django.utils.functional - import django.utils.hashable - import django.utils.html - import django.utils.http - import django.utils.inspect - import django.utils.ipv6 - import django.utils.itercompat - import django.utils.jslex - import django.utils.log - import django.utils.lorem_ipsum - import django.utils.module_loading - import django.utils.numberformat - import django.utils.regex_helper - import django.utils.safestring - import django.utils.six - import django.utils.termcolors - import django.utils.text - import django.utils.timesince - import django.utils.timezone - import django.utils.topological_sort - import django.utils.translation - import django.utils.translation.reloader - import django.utils.translation.template - import django.utils.translation.trans_null - import django.utils.translation.trans_real - import django.utils.tree - import django.utils.version - import django.utils.xmlutils - import django.views.csrf - import django.views.debug - import django.views.decorators - import django.views.decorators.cache - import django.views.decorators.clickjacking - import django.views.decorators.csrf - import django.views.decorators.debug - import django.views.decorators.gzip - import django.views.decorators.http - import django.views.decorators.vary - import django.views.defaults - import django.views.generic - import django.views.generic.base - import django.views.generic.dates - import django.views.generic.detail - import django.views.generic.edit - import django.views.generic.list - import django.views.i18n - import django.views.static diff --git a/tests/typecheck/test_request.yml b/tests/typecheck/test_request.yml deleted file mode 100644 index 080a22580..000000000 --- a/tests/typecheck/test_request.yml +++ /dev/null @@ -1,72 +0,0 @@ -- case: request_object_has_user_of_type_auth_user_model - disable_cache: true - main: | - from django.http.request import HttpRequest - reveal_type(HttpRequest().user) # N: Revealed type is 'Union[myapp.models.MyUser, django.contrib.auth.models.AnonymousUser]' - # check that other fields work ok - reveal_type(HttpRequest().method) # N: Revealed type is 'Union[builtins.str, None]' - custom_settings: | - INSTALLED_APPS = ('django.contrib.contenttypes', 'django.contrib.auth', 'myapp') - AUTH_USER_MODEL='myapp.MyUser' - files: - - path: myapp/__init__.py - - path: myapp/models.py - content: | - from django.db import models - class MyUser(models.Model): - pass -- case: request_object_user_can_be_descriminated - disable_cache: true - main: | - from django.http.request import HttpRequest - request = HttpRequest() - reveal_type(request.user) # N: Revealed type is 'Union[django.contrib.auth.models.User, django.contrib.auth.models.AnonymousUser]' - if not request.user.is_anonymous: - reveal_type(request.user) # N: Revealed type is 'django.contrib.auth.models.User' - if request.user.is_authenticated: - reveal_type(request.user) # N: Revealed type is 'django.contrib.auth.models.User' - custom_settings: | - INSTALLED_APPS = ('django.contrib.contenttypes', 'django.contrib.auth') -- case: request_object_user_without_auth_and_contenttypes_apps - disable_cache: true - main: | - from django.http.request import HttpRequest - request = HttpRequest() - reveal_type(request.user) # N: Revealed type is 'Union[django.contrib.auth.base_user.AbstractBaseUser, django.contrib.auth.models.AnonymousUser]' - if request.user.is_authenticated: - reveal_type(request.user) # N: Revealed type is 'django.contrib.auth.base_user.AbstractBaseUser' -- case: request_object_user_without_auth_but_with_contenttypes_apps - disable_cache: true - main: | - from django.http.request import HttpRequest - request = HttpRequest() - reveal_type(request.user) # N: Revealed type is 'Union[django.contrib.auth.base_user.AbstractBaseUser, django.contrib.auth.models.AnonymousUser]' - if request.user.is_authenticated: - reveal_type(request.user) # N: Revealed type is 'django.contrib.auth.base_user.AbstractBaseUser' - custom_settings: | - INSTALLED_APPS = ('django.contrib.contenttypes',) -- case: subclass_request_not_changed_user_type - disable_cache: true - main: | - from django.http.request import HttpRequest - class MyRequest(HttpRequest): - foo: int # Just do something - - request = MyRequest() - reveal_type(request.user) # N: Revealed type is 'Union[django.contrib.auth.models.User, django.contrib.auth.models.AnonymousUser]' - custom_settings: | - INSTALLED_APPS = ('django.contrib.contenttypes', 'django.contrib.auth') - -- case: subclass_request_changed_user_type - disable_cache: true - main: | - from django.http.request import HttpRequest - from django.contrib.auth.models import User - class MyRequest(HttpRequest): - user: User # Override the type of user - - request = MyRequest() - reveal_type(request.user) # N: Revealed type is 'django.contrib.auth.models.User' - custom_settings: | - INSTALLED_APPS = ('django.contrib.contenttypes', 'django.contrib.auth') - diff --git a/tests/typecheck/test_settings.yml b/tests/typecheck/test_settings.yml deleted file mode 100644 index ed5debdaa..000000000 --- a/tests/typecheck/test_settings.yml +++ /dev/null @@ -1,50 +0,0 @@ -- case: settings_loaded_from_different_files - disable_cache: true - main: | - from django.conf import settings - # standard settings - reveal_type(settings.AUTH_USER_MODEL) # N: Revealed type is 'builtins.str' - reveal_type(settings.ROOT_DIR) # N: Revealed type is 'builtins.str' - reveal_type(settings.APPS_DIR) # N: Revealed type is 'pathlib.Path*' - reveal_type(settings.NUMBERS) # N: Revealed type is 'builtins.list[builtins.str*]' - reveal_type(settings.DICT) # N: Revealed type is 'builtins.dict[Any, Any]' - custom_settings: | - from base import * - SECRET_KEY = 112233 - NUMBERS = ['one', 'two'] - DICT = {} # type: ignore - files: - - path: base.py - content: | - from pathlib import Path - ROOT_DIR = '/etc' - APPS_DIR = Path(ROOT_DIR) - -- case: global_settings_are_always_loaded - main: | - from django.conf import settings - reveal_type(settings.AUTH_USER_MODEL) # N: Revealed type is 'builtins.str' - reveal_type(settings.AUTHENTICATION_BACKENDS) # N: Revealed type is 'typing.Sequence[builtins.str]' - installed_apps: [] - -- case: fail_if_there_is_no_setting - main: | - from django.conf import settings - reveal_type(settings.NOT_EXISTING) - out: | - main:2: note: Revealed type is 'Any' - main:2: error: 'Settings' object has no attribute 'NOT_EXISTING' - -- case: override_default_setting_with_different_type_in_the_different_module - custom_settings: | - from settings.basic_settings import * - main: | - from django.conf import settings - reveal_type(settings.MEDIA_ROOT) # N: Revealed type is 'pathlib.Path*' - reveal_type(settings.MEDIA_ROOT / 'part') # N: Revealed type is 'pathlib.Path*' - files: - - path: settings/__init__.py - - path: settings/basic_settings.py - content: | - from pathlib import Path - MEDIA_ROOT = Path() diff --git a/tests/typecheck/test_shortcuts.yml b/tests/typecheck/test_shortcuts.yml deleted file mode 100644 index a06dcf606..000000000 --- a/tests/typecheck/test_shortcuts.yml +++ /dev/null @@ -1,59 +0,0 @@ -- case: get_object_or_404_returns_proper_types - main: | - from django.shortcuts import get_object_or_404, get_list_or_404 - from myapp.models import MyModel - - reveal_type(get_object_or_404(MyModel)) # N: Revealed type is 'myapp.models.MyModel*' - reveal_type(get_object_or_404(MyModel.objects)) # N: Revealed type is 'myapp.models.MyModel*' - reveal_type(get_object_or_404(MyModel.objects.get_queryset())) # N: Revealed type is 'myapp.models.MyModel*' - - reveal_type(get_list_or_404(MyModel)) # N: Revealed type is 'builtins.list[myapp.models.MyModel*]' - reveal_type(get_list_or_404(MyModel.objects)) # N: Revealed type is 'builtins.list[myapp.models.MyModel*]' - reveal_type(get_list_or_404(MyModel.objects.get_queryset())) # N: Revealed type is 'builtins.list[myapp.models.MyModel*]' - installed_apps: - - myapp - files: - - path: myapp/__init__.py - - path: myapp/models.py - content: | - from django.db import models - class MyModel(models.Model): - pass - -- case: get_user_model_returns_proper_class - disable_cache: true - main: | - from django.contrib.auth import get_user_model - UserModel = get_user_model() - reveal_type(UserModel.objects) # N: Revealed type is 'django.db.models.manager.Manager[myapp.models.MyUser]' - custom_settings: | - INSTALLED_APPS = ('django.contrib.contenttypes', 'myapp') - AUTH_USER_MODEL = 'myapp.MyUser' - files: - - path: myapp/__init__.py - - path: myapp/models.py - content: | - from django.db import models - class MyUser(models.Model): - pass - -- case: check_render_function_arguments_annotations - main: | - from typing import Any - from typing_extensions import TypedDict - from django.shortcuts import render - from django.http.request import HttpRequest - - TestContext = TypedDict("TestContext", {"user": Any}) - test_context: TestContext = {"user": "test"} - reveal_type(test_context) # N: Revealed type is 'TypedDict('main.TestContext', {'user': Any})' - reveal_type(render(HttpRequest(), '', test_context)) # N: Revealed type is 'django.http.response.HttpResponse' - -- case: check_redirect_return_annotation - main: | - from django.shortcuts import redirect - reveal_type(redirect(to = '', permanent = True)) # N: Revealed type is 'django.http.response.HttpResponsePermanentRedirect' - reveal_type(redirect(to = '', permanent = False)) # N: Revealed type is 'django.http.response.HttpResponseRedirect' - - var = True - reveal_type(redirect(to = '', permanent = var)) # N: Revealed type is 'Union[django.http.response.HttpResponseRedirect, django.http.response.HttpResponsePermanentRedirect]' diff --git a/tests/typecheck/test_views.yml b/tests/typecheck/test_views.yml deleted file mode 100644 index 4e49280e2..000000000 --- a/tests/typecheck/test_views.yml +++ /dev/null @@ -1,12 +0,0 @@ -- case: login_form_form_valid_typechecks - main: | - from django.contrib.auth.views import LoginView - from django.contrib.auth import login as auth_login - from django.http import HttpResponseRedirect - from django.contrib.auth.forms import AuthenticationForm - - class MyLoginView(LoginView): - def form_valid(self, form: AuthenticationForm) -> HttpResponseRedirect: - """Ensure that form can have type AuthenticationForm.""" - form.get_user() - return HttpResponseRedirect(self.get_success_url()) diff --git a/tests/typecheck/utils/test_decorators.yml b/tests/typecheck/utils/test_decorators.yml deleted file mode 100644 index b347938c9..000000000 --- a/tests/typecheck/utils/test_decorators.yml +++ /dev/null @@ -1,20 +0,0 @@ -- case: method_decorator_class - main: | - from django.views.generic.base import View - from django.utils.decorators import method_decorator - from django.contrib.auth.decorators import login_required - @method_decorator(login_required, name='dispatch') - class TestView(View): ... - reveal_type(TestView()) # N: Revealed type is 'main.TestView' -- case: method_decorator_function - main: | - from django.views.generic.base import View - from django.utils.decorators import method_decorator - from django.contrib.auth.decorators import login_required - from django.http.response import HttpResponse - from django.http.request import HttpRequest - class TestView(View): - @method_decorator(login_required) - def dispatch(self, request: HttpRequest, *args, **kwargs) -> HttpResponse: - return super().dispatch(request, *args, **kwargs) - reveal_type(dispatch) # N: Revealed type is 'def (self: main.TestView, request: django.http.request.HttpRequest, *args: Any, **kwargs: Any) -> django.http.response.HttpResponse' diff --git a/tests/typecheck/utils/test_functional.yml b/tests/typecheck/utils/test_functional.yml deleted file mode 100644 index 0407c18de..000000000 --- a/tests/typecheck/utils/test_functional.yml +++ /dev/null @@ -1,18 +0,0 @@ -- case: cached_property_class_vs_instance_attributes - main: | - from django.utils.functional import cached_property - from typing import List - - class Foo: - @cached_property - def attr(self) -> List[str]: ... - - reveal_type(attr) # N: Revealed type is 'django.utils.functional.cached_property[builtins.list*[builtins.str]]' - reveal_type(attr.name) # N: Revealed type is 'builtins.str' - - reveal_type(Foo.attr) # N: Revealed type is 'django.utils.functional.cached_property[builtins.list*[builtins.str]]' - reveal_type(Foo.attr.func) # N: Revealed type is 'def (*Any, **Any) -> builtins.list*[builtins.str]' - - f = Foo() - reveal_type(f.attr) # N: Revealed type is 'builtins.list*[builtins.str]' - f.attr.name # E: "List[str]" has no attribute "name" From d866392203eeaf95ad22a7366d3a24722463b050 Mon Sep 17 00:00:00 2001 From: Steve Dignam Date: Wed, 25 Nov 2020 20:56:06 -0500 Subject: [PATCH 09/88] fmt --- django-stubs/__init__.pyi | 1 + django-stubs/apps/__init__.pyi | 1 - django-stubs/apps/config.pyi | 6 +- django-stubs/apps/registry.pyi | 16 +- django-stubs/conf/locale/__init__.pyi | 2 +- django-stubs/conf/urls/__init__.pyi | 19 +- django-stubs/conf/urls/i18n.pyi | 6 +- django-stubs/contrib/admin/__init__.pyi | 37 ++- django-stubs/contrib/admin/actions.pyi | 4 +- django-stubs/contrib/admin/checks.pyi | 9 +- django-stubs/contrib/admin/filters.pyi | 18 +- django-stubs/contrib/admin/helpers.pyi | 21 +- django-stubs/contrib/admin/models.pyi | 7 +- django-stubs/contrib/admin/options.pyi | 196 +++++++++++---- django-stubs/contrib/admin/sites.pyi | 32 ++- .../contrib/admin/templatetags/admin_list.pyi | 23 +- .../admin/templatetags/admin_modify.pyi | 4 +- .../contrib/admin/templatetags/base.pyi | 7 +- django-stubs/contrib/admin/tests.pyi | 12 +- django-stubs/contrib/admin/utils.pyi | 32 ++- .../contrib/admin/views/decorators.pyi | 4 +- django-stubs/contrib/admin/views/main.pyi | 27 +- django-stubs/contrib/admin/widgets.pyi | 27 +- django-stubs/contrib/admindocs/apps.pyi | 3 +- django-stubs/contrib/admindocs/middleware.pyi | 6 +- django-stubs/contrib/admindocs/utils.pyi | 4 +- django-stubs/contrib/admindocs/views.pyi | 4 +- django-stubs/contrib/auth/__init__.pyi | 12 +- django-stubs/contrib/auth/admin.pyi | 7 +- django-stubs/contrib/auth/backends.pyi | 25 +- django-stubs/contrib/auth/base_user.pyi | 8 +- django-stubs/contrib/auth/checks.pyi | 11 +- django-stubs/contrib/auth/decorators.pyi | 21 +- django-stubs/contrib/auth/forms.pyi | 7 +- django-stubs/contrib/auth/hashers.pyi | 13 +- django-stubs/contrib/auth/mixins.pyi | 12 +- django-stubs/contrib/auth/models.pyi | 38 ++- .../contrib/auth/password_validation.pyi | 20 +- django-stubs/contrib/auth/tokens.pyi | 8 +- django-stubs/contrib/auth/views.pyi | 8 +- django-stubs/contrib/contenttypes/admin.pyi | 8 +- django-stubs/contrib/contenttypes/checks.pyi | 8 +- django-stubs/contrib/contenttypes/fields.pyi | 36 ++- .../contenttypes/management/__init__.pyi | 13 +- .../commands/remove_stale_contenttypes.pyi | 3 +- django-stubs/contrib/contenttypes/models.pyi | 8 +- django-stubs/contrib/flatpages/admin.pyi | 3 +- django-stubs/contrib/flatpages/apps.pyi | 3 +- django-stubs/contrib/flatpages/middleware.pyi | 4 +- django-stubs/contrib/flatpages/models.pyi | 1 - .../flatpages/templatetags/flatpages.pyi | 7 +- django-stubs/contrib/gis/admin/__init__.pyi | 23 +- django-stubs/contrib/gis/admin/options.pyi | 3 +- django-stubs/contrib/gis/admin/widgets.pyi | 3 +- django-stubs/contrib/gis/apps.pyi | 3 +- .../contrib/gis/db/backends/mysql/base.pyi | 3 +- .../gis/db/backends/mysql/features.pyi | 4 +- .../gis/db/backends/mysql/introspection.pyi | 5 +- .../gis/db/backends/mysql/operations.pyi | 7 +- .../contrib/gis/db/backends/mysql/schema.pyi | 3 +- .../gis/db/backends/oracle/adapter.pyi | 3 +- .../contrib/gis/db/backends/oracle/base.pyi | 3 +- .../gis/db/backends/oracle/features.pyi | 8 +- .../gis/db/backends/oracle/introspection.pyi | 5 +- .../contrib/gis/db/backends/oracle/models.pyi | 7 +- .../gis/db/backends/oracle/operations.pyi | 15 +- .../contrib/gis/db/backends/oracle/schema.pyi | 3 +- .../contrib/gis/db/backends/postgis/base.pyi | 5 +- .../gis/db/backends/postgis/features.pyi | 8 +- .../gis/db/backends/postgis/introspection.pyi | 5 +- .../gis/db/backends/postgis/models.pyi | 7 +- .../gis/db/backends/postgis/operations.pyi | 11 +- .../gis/db/backends/postgis/schema.pyi | 3 +- .../gis/db/backends/spatialite/adapter.pyi | 3 +- .../gis/db/backends/spatialite/base.pyi | 3 +- .../gis/db/backends/spatialite/features.pyi | 8 +- .../db/backends/spatialite/introspection.pyi | 5 +- .../gis/db/backends/spatialite/models.pyi | 7 +- .../gis/db/backends/spatialite/operations.pyi | 7 +- .../gis/db/backends/spatialite/schema.pyi | 11 +- .../contrib/gis/db/backends/utils.pyi | 4 +- .../contrib/gis/db/models/__init__.pyi | 18 +- .../contrib/gis/db/models/aggregates.pyi | 11 +- django-stubs/contrib/gis/db/models/fields.pyi | 14 +- .../contrib/gis/db/models/functions.pyi | 39 ++- .../contrib/gis/db/models/lookups.pyi | 3 +- django-stubs/contrib/gis/db/models/proxy.pyi | 7 +- .../contrib/gis/db/models/sql/conversion.pyi | 3 +- django-stubs/contrib/gis/feeds.pyi | 11 +- django-stubs/contrib/gis/forms/fields.pyi | 11 +- django-stubs/contrib/gis/forms/widgets.pyi | 3 +- django-stubs/contrib/gis/gdal/__init__.pyi | 24 +- django-stubs/contrib/gis/gdal/base.pyi | 3 +- django-stubs/contrib/gis/gdal/datasource.pyi | 11 +- django-stubs/contrib/gis/gdal/driver.pyi | 3 +- django-stubs/contrib/gis/gdal/feature.pyi | 3 +- django-stubs/contrib/gis/gdal/field.pyi | 3 +- django-stubs/contrib/gis/gdal/geometries.pyi | 3 +- django-stubs/contrib/gis/gdal/layer.pyi | 3 +- .../contrib/gis/gdal/prototypes/errcheck.pyi | 8 +- .../gis/gdal/prototypes/generation.pyi | 16 +- django-stubs/contrib/gis/gdal/raster/band.pyi | 3 +- django-stubs/contrib/gis/gdal/raster/base.pyi | 3 +- .../contrib/gis/gdal/raster/source.pyi | 3 +- django-stubs/contrib/gis/gdal/srs.pyi | 7 +- django-stubs/contrib/gis/geoip2/__init__.pyi | 3 +- django-stubs/contrib/gis/geoip2/base.pyi | 6 +- django-stubs/contrib/gis/geos/__init__.pyi | 25 +- django-stubs/contrib/gis/geos/base.pyi | 3 +- django-stubs/contrib/gis/geos/collections.pyi | 4 +- django-stubs/contrib/gis/geos/coordseq.pyi | 3 +- django-stubs/contrib/gis/geos/geometry.pyi | 18 +- django-stubs/contrib/gis/geos/io.pyi | 10 +- django-stubs/contrib/gis/geos/linestring.pyi | 4 +- django-stubs/contrib/gis/geos/point.pyi | 9 +- django-stubs/contrib/gis/geos/polygon.pyi | 3 +- django-stubs/contrib/gis/geos/prepared.pyi | 3 +- .../contrib/gis/geos/prototypes/__init__.pyi | 100 ++++---- .../contrib/gis/geos/prototypes/coordseq.pyi | 7 +- .../contrib/gis/geos/prototypes/geom.pyi | 3 +- .../contrib/gis/geos/prototypes/io.pyi | 11 +- .../contrib/gis/geos/prototypes/misc.pyi | 3 +- .../gis/geos/prototypes/predicates.pyi | 3 +- .../contrib/gis/geos/prototypes/prepared.pyi | 5 +- .../gis/geos/prototypes/threadsafe.pyi | 3 +- .../contrib/gis/geos/prototypes/topology.pyi | 3 +- .../contrib/gis/serializers/geojson.pyi | 3 +- .../contrib/gis/sitemaps/__init__.pyi | 3 +- django-stubs/contrib/gis/sitemaps/kml.pyi | 3 +- django-stubs/contrib/gis/sitemaps/views.pyi | 15 +- django-stubs/contrib/gis/utils/ogrinspect.pyi | 4 +- django-stubs/contrib/humanize/apps.pyi | 3 +- .../humanize/templatetags/humanize.pyi | 4 +- django-stubs/contrib/messages/__init__.pyi | 39 ++- django-stubs/contrib/messages/api.pyi | 31 ++- django-stubs/contrib/messages/apps.pyi | 3 +- .../contrib/messages/context_processors.pyi | 4 +- django-stubs/contrib/messages/middleware.pyi | 4 +- .../contrib/messages/storage/base.pyi | 8 +- .../contrib/messages/storage/session.pyi | 4 +- .../contrib/postgres/aggregates/__init__.pyi | 43 ++-- django-stubs/contrib/postgres/apps.pyi | 7 +- .../contrib/postgres/fields/__init__.pyi | 33 ++- .../contrib/postgres/fields/array.pyi | 7 +- .../contrib/postgres/fields/hstore.pyi | 1 + .../contrib/postgres/fields/jsonb.pyi | 5 +- .../contrib/postgres/fields/ranges.pyi | 1 - django-stubs/contrib/postgres/indexes.pyi | 3 +- django-stubs/contrib/postgres/lookups.pyi | 2 +- django-stubs/contrib/postgres/search.pyi | 30 ++- django-stubs/contrib/postgres/validators.pyi | 12 +- django-stubs/contrib/redirects/admin.pyi | 3 +- django-stubs/contrib/redirects/apps.pyi | 3 +- django-stubs/contrib/redirects/middleware.pyi | 4 +- django-stubs/contrib/sessions/apps.pyi | 3 +- .../contrib/sessions/base_session.pyi | 5 +- django-stubs/contrib/sessions/middleware.pyi | 4 +- django-stubs/contrib/sitemaps/__init__.pyi | 7 +- django-stubs/contrib/sitemaps/apps.pyi | 3 +- django-stubs/contrib/sitemaps/views.pyi | 3 +- django-stubs/contrib/sites/admin.pyi | 3 +- django-stubs/contrib/sites/models.pyi | 3 +- django-stubs/contrib/staticfiles/checks.pyi | 7 +- django-stubs/contrib/staticfiles/finders.pyi | 12 +- .../management/commands/collectstatic.pyi | 12 +- .../management/commands/runserver.pyi | 4 +- django-stubs/contrib/staticfiles/storage.pyi | 16 +- django-stubs/contrib/staticfiles/utils.pyi | 8 +- django-stubs/contrib/staticfiles/views.pyi | 4 +- django-stubs/contrib/syndication/apps.pyi | 3 +- django-stubs/contrib/syndication/views.pyi | 4 +- django-stubs/core/cache/__init__.pyi | 12 +- django-stubs/core/cache/backends/base.pyi | 42 +++- django-stubs/core/cache/utils.pyi | 4 +- django-stubs/core/checks/__init__.pyi | 31 ++- django-stubs/core/checks/async_checks.pyi | 4 +- django-stubs/core/checks/caches.pyi | 3 +- django-stubs/core/checks/messages.pyi | 7 +- django-stubs/core/checks/model_checks.pyi | 11 +- django-stubs/core/checks/registry.pyi | 7 +- django-stubs/core/checks/security/base.pyi | 47 +++- django-stubs/core/checks/security/csrf.pyi | 8 +- .../core/checks/security/sessions.pyi | 11 +- django-stubs/core/checks/templates.pyi | 7 +- django-stubs/core/checks/translation.pyi | 4 +- django-stubs/core/checks/urls.pyi | 21 +- django-stubs/core/exceptions.pyi | 7 +- django-stubs/core/files/base.pyi | 6 +- django-stubs/core/files/images.pyi | 6 +- django-stubs/core/files/move.pyi | 5 +- django-stubs/core/files/storage.pyi | 6 +- django-stubs/core/files/uploadedfile.pyi | 6 +- django-stubs/core/files/uploadhandler.pyi | 5 +- django-stubs/core/handlers/asgi.pyi | 7 +- django-stubs/core/handlers/base.pyi | 8 +- django-stubs/core/handlers/exception.pyi | 6 +- django-stubs/core/handlers/wsgi.pyi | 4 +- django-stubs/core/mail/__init__.pyi | 23 +- django-stubs/core/mail/backends/base.pyi | 7 +- django-stubs/core/mail/message.pyi | 37 ++- django-stubs/core/management/__init__.pyi | 7 +- django-stubs/core/management/base.pyi | 16 +- .../core/management/commands/check.pyi | 6 +- .../management/commands/compilemessages.pyi | 16 +- .../management/commands/createcachetable.pyi | 20 +- .../core/management/commands/dbshell.pyi | 11 +- .../core/management/commands/diffsettings.pyi | 17 +- .../core/management/commands/flush.pyi | 17 +- .../core/management/commands/inspectdb.pyi | 20 +- .../core/management/commands/makemessages.pyi | 8 +- .../management/commands/makemigrations.pyi | 37 +-- .../core/management/commands/migrate.pyi | 28 ++- .../management/commands/sendtestemail.pyi | 4 +- .../core/management/commands/shell.pyi | 6 +- .../management/commands/showmigrations.pyi | 14 +- .../core/management/commands/sqlflush.pyi | 3 +- .../core/management/commands/sqlmigrate.pyi | 12 +- .../management/commands/sqlsequencereset.pyi | 3 +- .../management/commands/squashmigrations.pyi | 14 +- .../core/management/commands/startapp.pyi | 3 +- .../core/management/commands/startproject.pyi | 3 +- .../core/management/commands/test.pyi | 7 +- django-stubs/core/management/sql.pyi | 14 +- django-stubs/core/management/utils.pyi | 12 +- django-stubs/core/serializers/__init__.pyi | 24 +- django-stubs/core/serializers/base.pyi | 33 ++- django-stubs/core/serializers/python.pyi | 9 +- django-stubs/core/serializers/pyyaml.pyi | 3 +- .../core/serializers/xml_serializer.pyi | 41 ++- django-stubs/core/servers/basehttp.pyi | 10 +- django-stubs/core/signing.pyi | 17 +- django-stubs/core/validators.pyi | 35 ++- django-stubs/db/__init__.pyi | 29 +-- django-stubs/db/backends/base/base.pyi | 20 +- django-stubs/db/backends/base/creation.pyi | 23 +- .../db/backends/base/introspection.pyi | 17 +- django-stubs/db/backends/base/operations.pyi | 60 +++-- django-stubs/db/backends/base/schema.pyi | 25 +- django-stubs/db/backends/base/validation.pyi | 1 - django-stubs/db/backends/ddl_references.pyi | 35 ++- django-stubs/db/backends/dummy/features.pyi | 4 +- django-stubs/db/backends/mysql/base.pyi | 3 +- django-stubs/db/backends/mysql/client.pyi | 3 +- django-stubs/db/backends/mysql/compiler.pyi | 3 +- django-stubs/db/backends/mysql/creation.pyi | 4 +- django-stubs/db/backends/mysql/features.pyi | 5 +- .../db/backends/mysql/introspection.pyi | 10 +- django-stubs/db/backends/mysql/operations.pyi | 13 +- django-stubs/db/backends/mysql/schema.pyi | 5 +- django-stubs/db/backends/mysql/validation.pyi | 5 +- django-stubs/db/backends/oracle/base.pyi | 3 +- django-stubs/db/backends/oracle/creation.pyi | 5 +- django-stubs/db/backends/oracle/features.pyi | 5 +- django-stubs/db/backends/oracle/functions.pyi | 11 +- .../db/backends/oracle/introspection.pyi | 5 +- .../db/backends/oracle/operations.pyi | 17 +- django-stubs/db/backends/oracle/schema.pyi | 9 +- .../db/backends/oracle/validation.pyi | 5 +- .../db/backends/postgresql/features.pyi | 5 +- .../db/backends/postgresql/introspection.pyi | 5 +- .../db/backends/postgresql/schema.pyi | 9 +- django-stubs/db/backends/utils.pyi | 18 +- django-stubs/db/migrations/__init__.pyi | 3 +- django-stubs/db/migrations/autodetector.pyi | 18 +- django-stubs/db/migrations/exceptions.pyi | 4 +- django-stubs/db/migrations/executor.pyi | 14 +- django-stubs/db/migrations/graph.pyi | 29 ++- django-stubs/db/migrations/loader.pyi | 34 ++- django-stubs/db/migrations/migration.pyi | 18 +- .../db/migrations/operations/__init__.pyi | 42 ++-- .../db/migrations/operations/base.pyi | 16 +- .../db/migrations/operations/fields.pyi | 13 +- .../db/migrations/operations/models.pyi | 13 +- .../db/migrations/operations/special.pyi | 4 +- .../db/migrations/operations/utils.pyi | 5 +- django-stubs/db/migrations/optimizer.pyi | 8 +- django-stubs/db/migrations/questioner.pyi | 9 +- django-stubs/db/migrations/recorder.pyi | 3 +- django-stubs/db/migrations/serializer.pyi | 2 +- django-stubs/db/migrations/state.pyi | 29 ++- .../db/migrations/topological_sort.pyi | 4 +- django-stubs/db/migrations/writer.pyi | 10 +- django-stubs/db/models/__init__.pyi | 233 ++++++++---------- django-stubs/db/models/aggregates.pyi | 8 +- django-stubs/db/models/base.pyi | 34 ++- django-stubs/db/models/constraints.pyi | 20 +- django-stubs/db/models/deletion.pyi | 9 +- django-stubs/db/models/expressions.pyi | 120 +++++++-- django-stubs/db/models/fields/__init__.pyi | 32 ++- django-stubs/db/models/fields/files.pyi | 20 +- django-stubs/db/models/fields/json.pyi | 28 ++- django-stubs/db/models/fields/mixins.pyi | 4 +- django-stubs/db/models/fields/related.pyi | 52 +++- .../db/models/fields/related_descriptors.pyi | 19 +- .../db/models/fields/related_lookups.pyi | 11 +- .../db/models/fields/reverse_related.pyi | 10 +- django-stubs/db/models/functions/__init__.pyi | 178 +++++++------ django-stubs/db/models/functions/math.pyi | 5 +- django-stubs/db/models/functions/text.pyi | 28 ++- django-stubs/db/models/functions/window.pyi | 10 +- django-stubs/db/models/indexes.pyi | 9 +- django-stubs/db/models/lookups.pyi | 48 +++- django-stubs/db/models/manager.pyi | 16 +- django-stubs/db/models/options.pyi | 33 ++- django-stubs/db/models/query.pyi | 68 +++-- django-stubs/db/models/query_utils.pyi | 38 ++- django-stubs/db/models/sql/__init__.pyi | 14 +- django-stubs/db/models/sql/compiler.pyi | 51 +++- django-stubs/db/models/sql/datastructures.pyi | 20 +- django-stubs/db/models/sql/query.pyi | 107 ++++++-- django-stubs/db/models/sql/subqueries.pyi | 19 +- django-stubs/db/models/sql/where.pyi | 24 +- django-stubs/db/transaction.pyi | 2 +- django-stubs/db/utils.pyi | 4 +- django-stubs/dispatch/__init__.pyi | 3 +- django-stubs/dispatch/dispatcher.pyi | 23 +- django-stubs/forms/__init__.pyi | 163 ++++++------ django-stubs/forms/boundfield.pyi | 20 +- django-stubs/forms/fields.pyi | 21 +- django-stubs/forms/forms.pyi | 4 +- django-stubs/forms/models.pyi | 38 ++- django-stubs/forms/renderers.pyi | 7 +- django-stubs/forms/widgets.pyi | 64 ++++- django-stubs/http/__init__.pyi | 47 ++-- django-stubs/http/multipartparser.pyi | 14 +- django-stubs/http/request.pyi | 27 +- django-stubs/http/response.pyi | 40 ++- django-stubs/middleware/cache.pyi | 10 +- django-stubs/middleware/clickjacking.pyi | 8 +- django-stubs/middleware/common.pyi | 16 +- django-stubs/middleware/csrf.pyi | 10 +- django-stubs/middleware/gzip.pyi | 4 +- django-stubs/middleware/http.pyi | 4 +- django-stubs/middleware/locale.pyi | 4 +- django-stubs/middleware/security.pyi | 8 +- django-stubs/shortcuts.pyi | 46 +++- django-stubs/template/__init__.pyi | 20 +- django-stubs/template/backends/django.pyi | 8 +- django-stubs/template/backends/dummy.pyi | 10 +- django-stubs/template/base.pyi | 60 ++++- django-stubs/template/context.pyi | 24 +- django-stubs/template/context_processors.pyi | 4 +- django-stubs/template/defaultfilters.pyi | 26 +- django-stubs/template/defaulttags.pyi | 25 +- django-stubs/template/engine.pyi | 14 +- django-stubs/template/library.pyi | 15 +- django-stubs/template/loader.pyi | 11 +- django-stubs/template/loader_tags.pyi | 11 +- django-stubs/template/loaders/base.pyi | 6 +- django-stubs/template/loaders/cached.pyi | 4 +- django-stubs/template/response.pyi | 11 +- django-stubs/templatetags/cache.pyi | 3 +- django-stubs/templatetags/i18n.pyi | 15 +- django-stubs/templatetags/l10n.pyi | 3 +- django-stubs/templatetags/static.pyi | 7 +- django-stubs/templatetags/tz.pyi | 11 +- django-stubs/test/__init__.pyi | 35 ++- django-stubs/test/client.pyi | 103 ++++++-- django-stubs/test/html.pyi | 4 +- django-stubs/test/runner.pyi | 38 ++- django-stubs/test/signals.pyi | 1 + django-stubs/test/testcases.pyi | 77 +++++- django-stubs/test/utils.pyi | 37 ++- django-stubs/urls/__init__.pyi | 48 ++-- django-stubs/urls/base.pyi | 2 +- django-stubs/urls/conf.pyi | 36 ++- django-stubs/urls/resolvers.pyi | 30 ++- django-stubs/utils/autoreload.pyi | 25 +- django-stubs/utils/baseconv.pyi | 4 +- django-stubs/utils/cache.pyi | 9 +- django-stubs/utils/crypto.pyi | 4 +- django-stubs/utils/datastructures.pyi | 24 +- django-stubs/utils/dateformat.pyi | 2 +- django-stubs/utils/datetime_safe.pyi | 4 +- django-stubs/utils/decorators.pyi | 6 +- django-stubs/utils/deprecation.pyi | 6 +- django-stubs/utils/encoding.pyi | 54 ++-- django-stubs/utils/feedgenerator.pyi | 4 +- django-stubs/utils/formats.pyi | 22 +- django-stubs/utils/functional.pyi | 18 +- django-stubs/utils/html.pyi | 7 +- django-stubs/utils/http.pyi | 14 +- django-stubs/utils/ipv6.pyi | 4 +- django-stubs/utils/log.pyi | 12 +- django-stubs/utils/safestring.pyi | 2 +- django-stubs/utils/six.pyi | 43 +++- django-stubs/utils/termcolors.pyi | 10 +- django-stubs/utils/text.pyi | 8 +- django-stubs/utils/timesince.pyi | 11 +- django-stubs/utils/timezone.pyi | 30 ++- django-stubs/utils/topological_sort.pyi | 10 +- django-stubs/utils/translation/__init__.pyi | 6 +- django-stubs/utils/translation/reloader.pyi | 4 +- django-stubs/utils/translation/trans_real.pyi | 17 +- django-stubs/utils/tree.pyi | 7 +- django-stubs/utils/version.pyi | 4 +- django-stubs/utils/xmlutils.pyi | 5 +- django-stubs/views/csrf.pyi | 4 +- django-stubs/views/debug.pyi | 24 +- django-stubs/views/decorators/cache.pyi | 4 +- .../views/decorators/clickjacking.pyi | 2 +- django-stubs/views/decorators/csrf.pyi | 4 +- django-stubs/views/decorators/gzip.pyi | 2 +- django-stubs/views/decorators/http.pyi | 4 +- django-stubs/views/defaults.pyi | 8 +- django-stubs/views/generic/__init__.pyi | 25 +- django-stubs/views/generic/base.pyi | 44 +++- django-stubs/views/generic/dates.pyi | 26 +- django-stubs/views/generic/detail.pyi | 7 +- django-stubs/views/generic/edit.pyi | 29 ++- django-stubs/views/generic/list.pyi | 16 +- django-stubs/views/i18n.pyi | 13 +- django-stubs/views/static.pyi | 8 +- 413 files changed, 4429 insertions(+), 2005 deletions(-) diff --git a/django-stubs/__init__.pyi b/django-stubs/__init__.pyi index 83b267d1f..c705a44c5 100644 --- a/django-stubs/__init__.pyi +++ b/django-stubs/__init__.pyi @@ -1,4 +1,5 @@ from typing import Any, NamedTuple + from .utils.version import get_version as get_version VERSION: Any diff --git a/django-stubs/apps/__init__.pyi b/django-stubs/apps/__init__.pyi index 4a783cca3..8270abf93 100644 --- a/django-stubs/apps/__init__.pyi +++ b/django-stubs/apps/__init__.pyi @@ -1,3 +1,2 @@ from .config import AppConfig as AppConfig - from .registry import apps as apps diff --git a/django-stubs/apps/config.pyi b/django-stubs/apps/config.pyi index aa3fb8038..4a3e28571 100644 --- a/django-stubs/apps/config.pyi +++ b/django-stubs/apps/config.pyi @@ -1,4 +1,4 @@ -from typing import Any, Iterator, Type, Optional, Dict +from typing import Any, Dict, Iterator, Optional, Type from django.apps.registry import Apps from django.db.models.base import Model @@ -18,6 +18,8 @@ class AppConfig: @classmethod def create(cls, entry: str) -> AppConfig: ... def get_model(self, model_name: str, require_ready: bool = ...) -> Type[Model]: ... - def get_models(self, include_auto_created: bool = ..., include_swapped: bool = ...) -> Iterator[Type[Model]]: ... + def get_models( + self, include_auto_created: bool = ..., include_swapped: bool = ... + ) -> Iterator[Type[Model]]: ... def import_models(self) -> None: ... def ready(self) -> None: ... diff --git a/django-stubs/apps/registry.pyi b/django-stubs/apps/registry.pyi index 9cf5ed1bc..df2e3591d 100644 --- a/django-stubs/apps/registry.pyi +++ b/django-stubs/apps/registry.pyi @@ -15,15 +15,23 @@ class Apps: _pending_operations: Dict[Tuple[str, str], List] models_ready: bool = ... ready: bool = ... - def __init__(self, installed_apps: Optional[Iterable[Union[AppConfig, str]]] = ...) -> None: ... - def populate(self, installed_apps: Iterable[Union[AppConfig, str]] = ...) -> None: ... + def __init__( + self, installed_apps: Optional[Iterable[Union[AppConfig, str]]] = ... + ) -> None: ... + def populate( + self, installed_apps: Iterable[Union[AppConfig, str]] = ... + ) -> None: ... def check_apps_ready(self) -> None: ... def check_models_ready(self) -> None: ... def get_app_configs(self) -> Iterable[AppConfig]: ... def get_app_config(self, app_label: str) -> AppConfig: ... # it's not possible to support it in plugin properly now - def get_models(self, include_auto_created: bool = ..., include_swapped: bool = ...) -> List[Type[Model]]: ... - def get_model(self, app_label: str, model_name: Optional[str] = ..., require_ready: bool = ...) -> Type[Any]: ... + def get_models( + self, include_auto_created: bool = ..., include_swapped: bool = ... + ) -> List[Type[Model]]: ... + def get_model( + self, app_label: str, model_name: Optional[str] = ..., require_ready: bool = ... + ) -> Type[Any]: ... def register_model(self, app_label: str, model: Type[Model]) -> None: ... def is_installed(self, app_name: str) -> bool: ... def get_containing_app_config(self, object_name: str) -> Optional[AppConfig]: ... diff --git a/django-stubs/conf/locale/__init__.pyi b/django-stubs/conf/locale/__init__.pyi index 4bd5cdf73..b7629af2b 100644 --- a/django-stubs/conf/locale/__init__.pyi +++ b/django-stubs/conf/locale/__init__.pyi @@ -1,3 +1,3 @@ -from typing import Dict, Any +from typing import Any, Dict LANG_INFO: Dict[str, Any] = ... diff --git a/django-stubs/conf/urls/__init__.pyi b/django-stubs/conf/urls/__init__.pyi index 71d290b2c..6228e8a97 100644 --- a/django-stubs/conf/urls/__init__.pyi +++ b/django-stubs/conf/urls/__init__.pyi @@ -1,9 +1,8 @@ # Stubs for django.conf.urls (Python 3.5) -from typing import Any, Callable, Dict, List, Optional, overload, Tuple, Union +from typing import Any, Callable, Dict, List, Optional, Tuple, Union, overload from django.http.response import HttpResponse, HttpResponseBase - -from django.urls import URLResolver, URLPattern +from django.urls import URLPattern, URLResolver handler400: Union[str, Callable[..., HttpResponse]] = ... handler403: Union[str, Callable[..., HttpResponse]] = ... @@ -15,11 +14,19 @@ IncludedURLConf = Tuple[List[URLResolver], Optional[str], Optional[str]] def include(arg: Any, namespace: str = ..., app_name: str = ...) -> IncludedURLConf: ... @overload def url( - regex: str, view: Callable[..., HttpResponseBase], kwargs: Dict[str, Any] = ..., name: str = ... + regex: str, + view: Callable[..., HttpResponseBase], + kwargs: Dict[str, Any] = ..., + name: str = ..., ) -> URLPattern: ... @overload -def url(regex: str, view: IncludedURLConf, kwargs: Dict[str, Any] = ..., name: str = ...) -> URLResolver: ... +def url( + regex: str, view: IncludedURLConf, kwargs: Dict[str, Any] = ..., name: str = ... +) -> URLResolver: ... @overload def url( - regex: str, view: List[Union[URLResolver, str]], kwargs: Dict[str, Any] = ..., name: str = ... + regex: str, + view: List[Union[URLResolver, str]], + kwargs: Dict[str, Any] = ..., + name: str = ..., ) -> URLResolver: ... diff --git a/django-stubs/conf/urls/i18n.pyi b/django-stubs/conf/urls/i18n.pyi index 532cb7df1..c31925828 100644 --- a/django-stubs/conf/urls/i18n.pyi +++ b/django-stubs/conf/urls/i18n.pyi @@ -1,8 +1,10 @@ -from typing import Any, List, Tuple, Callable +from typing import Any, Callable, List, Tuple from django.urls.resolvers import URLPattern -def i18n_patterns(*urls: Any, prefix_default_language: bool = ...) -> List[List[URLPattern]]: ... +def i18n_patterns( + *urls: Any, prefix_default_language: bool = ... +) -> List[List[URLPattern]]: ... def is_language_prefix_patterns_used(urlconf: str) -> Tuple[bool, bool]: ... urlpatterns: List[Callable] diff --git a/django-stubs/contrib/admin/__init__.pyi b/django-stubs/contrib/admin/__init__.pyi index 5737e4242..790f42447 100644 --- a/django-stubs/contrib/admin/__init__.pyi +++ b/django-stubs/contrib/admin/__init__.pyi @@ -1,24 +1,21 @@ +from . import checks as checks from .decorators import register as register -from .filters import ( - AllValuesFieldListFilter as AllValuesFieldListFilter, - BooleanFieldListFilter as BooleanFieldListFilter, - ChoicesFieldListFilter as ChoicesFieldListFilter, - DateFieldListFilter as DateFieldListFilter, - FieldListFilter as FieldListFilter, - ListFilter as ListFilter, - RelatedFieldListFilter as RelatedFieldListFilter, - RelatedOnlyFieldListFilter as RelatedOnlyFieldListFilter, - SimpleListFilter as SimpleListFilter, -) +from .filters import AllValuesFieldListFilter as AllValuesFieldListFilter +from .filters import BooleanFieldListFilter as BooleanFieldListFilter +from .filters import ChoicesFieldListFilter as ChoicesFieldListFilter +from .filters import DateFieldListFilter as DateFieldListFilter +from .filters import FieldListFilter as FieldListFilter +from .filters import ListFilter as ListFilter +from .filters import RelatedFieldListFilter as RelatedFieldListFilter +from .filters import RelatedOnlyFieldListFilter as RelatedOnlyFieldListFilter +from .filters import SimpleListFilter as SimpleListFilter from .helpers import ACTION_CHECKBOX_NAME as ACTION_CHECKBOX_NAME -from .options import ( - HORIZONTAL as HORIZONTAL, - VERTICAL as VERTICAL, - ModelAdmin as ModelAdmin, - StackedInline as StackedInline, - TabularInline as TabularInline, -) -from .sites import AdminSite as AdminSite, site as site -from . import checks as checks +from .options import HORIZONTAL as HORIZONTAL +from .options import VERTICAL as VERTICAL +from .options import ModelAdmin as ModelAdmin +from .options import StackedInline as StackedInline +from .options import TabularInline as TabularInline +from .sites import AdminSite as AdminSite +from .sites import site as site def autodiscover() -> None: ... diff --git a/django-stubs/contrib/admin/actions.pyi b/django-stubs/contrib/admin/actions.pyi index 30a41e837..80bb90492 100644 --- a/django-stubs/contrib/admin/actions.pyi +++ b/django-stubs/contrib/admin/actions.pyi @@ -5,4 +5,6 @@ from django.core.handlers.wsgi import WSGIRequest from django.db.models.query import QuerySet from django.template.response import TemplateResponse -def delete_selected(modeladmin: ModelAdmin, request: WSGIRequest, queryset: QuerySet) -> Optional[TemplateResponse]: ... +def delete_selected( + modeladmin: ModelAdmin, request: WSGIRequest, queryset: QuerySet +) -> Optional[TemplateResponse]: ... diff --git a/django-stubs/contrib/admin/checks.pyi b/django-stubs/contrib/admin/checks.pyi index 8d9ac9ee1..8772e2fa6 100644 --- a/django-stubs/contrib/admin/checks.pyi +++ b/django-stubs/contrib/admin/checks.pyi @@ -1,13 +1,14 @@ -from typing import Any, List, Union, Optional, Sequence +from typing import Any, List, Optional, Sequence, Union +from django.apps.config import AppConfig from django.contrib.admin.options import BaseModelAdmin from django.core.checks.messages import CheckMessage, Error -from django.apps.config import AppConfig - _CheckError = Union[str, Error] -def check_admin_app(app_configs: Optional[Sequence[AppConfig]] = ..., **kwargs: Any) -> List[_CheckError]: ... +def check_admin_app( + app_configs: Optional[Sequence[AppConfig]] = ..., **kwargs: Any +) -> List[_CheckError]: ... def check_dependencies(**kwargs: Any) -> List[_CheckError]: ... class BaseModelAdminChecks: diff --git a/django-stubs/contrib/admin/filters.pyi b/django-stubs/contrib/admin/filters.pyi index 3cba3adbe..64a6ef752 100644 --- a/django-stubs/contrib/admin/filters.pyi +++ b/django-stubs/contrib/admin/filters.pyi @@ -1,19 +1,22 @@ -from typing import Any, Callable, Dict, List, Optional, Tuple, Type, Iterator +from typing import Any, Callable, Dict, Iterator, List, Optional, Tuple, Type from django.contrib.admin.options import ModelAdmin from django.core.handlers.wsgi import WSGIRequest from django.db.models.base import Model +from django.db.models.fields import Field from django.db.models.fields.related import RelatedField from django.db.models.query import QuerySet -from django.db.models.fields import Field - class ListFilter: title: Any = ... template: str = ... used_parameters: Any = ... def __init__( - self, request: WSGIRequest, params: Dict[str, str], model: Type[Model], model_admin: ModelAdmin + self, + request: WSGIRequest, + params: Dict[str, str], + model: Type[Model], + model_admin: ModelAdmin, ) -> None: ... def has_output(self) -> bool: ... def choices(self, changelist: Any) -> Optional[Iterator[Dict[str, Any]]]: ... @@ -40,7 +43,12 @@ class FieldListFilter(ListFilter): field_path: str, ) -> None: ... @classmethod - def register(cls, test: Callable, list_filter_class: Type[FieldListFilter], take_priority: bool = ...) -> None: ... + def register( + cls, + test: Callable, + list_filter_class: Type[FieldListFilter], + take_priority: bool = ..., + ) -> None: ... @classmethod def create( cls, diff --git a/django-stubs/contrib/admin/helpers.pyi b/django-stubs/contrib/admin/helpers.pyi index 32d14338e..baa90597c 100644 --- a/django-stubs/contrib/admin/helpers.pyi +++ b/django-stubs/contrib/admin/helpers.pyi @@ -1,14 +1,13 @@ -from typing import Any, Callable, Dict, Iterator, List, Optional, Tuple, Union, Iterable +from typing import Any, Callable, Dict, Iterable, Iterator, List, Optional, Tuple, Union +from django import forms +from django.db.models.fields import AutoField from django.forms.boundfield import BoundField from django.forms.forms import BaseForm from django.forms.utils import ErrorDict from django.forms.widgets import Media, Widget from django.utils.safestring import SafeText -from django import forms -from django.db.models.fields import AutoField - ACTION_CHECKBOX_NAME: str class ActionForm(forms.Form): @@ -64,7 +63,11 @@ class Fieldline: model_admin: Any = ... readonly_fields: Any = ... def __init__( - self, form: Any, field: Any, readonly_fields: Optional[Iterable[Any]] = ..., model_admin: Optional[Any] = ... + self, + form: Any, + field: Any, + readonly_fields: Optional[Iterable[Any]] = ..., + model_admin: Optional[Any] = ..., ) -> None: ... def __iter__(self) -> Iterator[Union[AdminField, AdminReadonlyField]]: ... def errors(self) -> SafeText: ... @@ -86,7 +89,9 @@ class AdminReadonlyField: is_checkbox: bool = ... is_readonly: bool = ... empty_value_display: Any = ... - def __init__(self, form: Any, field: Any, is_first: Any, model_admin: Optional[Any] = ...) -> None: ... + def __init__( + self, form: Any, field: Any, is_first: Any, model_admin: Optional[Any] = ... + ) -> None: ... def label_tag(self) -> SafeText: ... def contents(self) -> SafeText: ... @@ -116,7 +121,9 @@ class InlineAdminFormSet: has_view_permission: bool = ..., ) -> None: ... def __iter__(self) -> Iterator[InlineAdminForm]: ... - def fields(self) -> Iterator[Dict[str, Union[Dict[str, bool], bool, Widget, str]]]: ... + def fields( + self, + ) -> Iterator[Dict[str, Union[Dict[str, bool], bool, Widget, str]]]: ... def inline_formset_data(self) -> str: ... @property def forms(self): ... diff --git a/django-stubs/contrib/admin/models.pyi b/django-stubs/contrib/admin/models.pyi index 05c033adf..461f5f22b 100644 --- a/django-stubs/contrib/admin/models.pyi +++ b/django-stubs/contrib/admin/models.pyi @@ -2,9 +2,8 @@ from typing import Any, Optional, Union from uuid import UUID from django.contrib.contenttypes.models import ContentType -from django.db.models.base import Model - from django.db import models +from django.db.models.base import Model ADDITION: int CHANGE: int @@ -25,7 +24,9 @@ class LogEntryManager(models.Manager["LogEntry"]): class LogEntry(models.Model): action_time: models.DateTimeField = ... user: models.ForeignKey = ... - content_type: models.ForeignKey = models.ForeignKey(ContentType, on_delete=models.CASCADE) + content_type: models.ForeignKey = models.ForeignKey( + ContentType, on_delete=models.CASCADE + ) object_id: models.TextField = ... object_repr: models.CharField = ... action_flag: models.PositiveSmallIntegerField = ... diff --git a/django-stubs/contrib/admin/options.pyi b/django-stubs/contrib/admin/options.pyi index 4f13cdac2..28534e8dc 100644 --- a/django-stubs/contrib/admin/options.pyi +++ b/django-stubs/contrib/admin/options.pyi @@ -6,20 +6,16 @@ from typing import ( Generic, Iterator, List, + Mapping, Optional, Sequence, Set, Tuple, Type, - Union, - Mapping, TypeVar, + Union, ) -from django.forms.forms import BaseForm -from django.forms.models import BaseInlineFormSet -from typing_extensions import Literal, TypedDict - from django.contrib.admin.filters import ListFilter from django.contrib.admin.models import LogEntry from django.contrib.admin.sites import AdminSite @@ -29,19 +25,29 @@ from django.contrib.contenttypes.models import ContentType from django.core.checks.messages import CheckMessage from django.core.paginator import Paginator from django.db.models.base import Model +from django.db.models.fields import Field from django.db.models.fields.related import ForeignKey, ManyToManyField, RelatedField from django.db.models.options import Options from django.db.models.query import QuerySet from django.forms.fields import TypedChoiceField -from django.forms.models import ModelChoiceField, ModelMultipleChoiceField +from django.forms.forms import BaseForm +from django.forms.models import ( + BaseInlineFormSet, + ModelChoiceField, + ModelMultipleChoiceField, +) from django.forms.widgets import Media from django.http.request import HttpRequest -from django.http.response import HttpResponse, HttpResponseBase, HttpResponseRedirect, JsonResponse +from django.http.response import ( + HttpResponse, + HttpResponseBase, + HttpResponseRedirect, + JsonResponse, +) from django.template.response import TemplateResponse from django.urls.resolvers import URLPattern from django.utils.safestring import SafeText - -from django.db.models.fields import Field +from typing_extensions import Literal, TypedDict IS_POPUP_VAR: str TO_FIELD_VAR: str @@ -113,28 +119,46 @@ class BaseModelAdmin(Generic[_ModelT]): def get_autocomplete_fields(self, request: HttpRequest) -> Tuple: ... def get_view_on_site_url(self, obj: Optional[_ModelT] = ...) -> Optional[str]: ... def get_empty_value_display(self) -> SafeText: ... - def get_exclude(self, request: HttpRequest, obj: Optional[_ModelT] = ...) -> Any: ... - def get_fields(self, request: HttpRequest, obj: Optional[_ModelT] = ...) -> Sequence[Union[Callable, str]]: ... + def get_exclude( + self, request: HttpRequest, obj: Optional[_ModelT] = ... + ) -> Any: ... + def get_fields( + self, request: HttpRequest, obj: Optional[_ModelT] = ... + ) -> Sequence[Union[Callable, str]]: ... def get_fieldsets( self, request: HttpRequest, obj: Optional[_ModelT] = ... ) -> List[Tuple[Optional[str], Dict[str, Any]]]: ... def get_ordering(self, request: HttpRequest) -> Union[List[str], Tuple]: ... - def get_readonly_fields(self, request: HttpRequest, obj: Optional[_ModelT] = ...) -> Union[List[str], Tuple]: ... - def get_prepopulated_fields(self, request: HttpRequest, obj: Optional[_ModelT] = ...) -> Dict[str, Tuple[str]]: ... + def get_readonly_fields( + self, request: HttpRequest, obj: Optional[_ModelT] = ... + ) -> Union[List[str], Tuple]: ... + def get_prepopulated_fields( + self, request: HttpRequest, obj: Optional[_ModelT] = ... + ) -> Dict[str, Tuple[str]]: ... def get_queryset(self, request: HttpRequest) -> QuerySet: ... - 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 to_field_allowed(self, request: HttpRequest, to_field: str) -> bool: ... def has_add_permission(self, request: HttpRequest) -> bool: ... - def has_change_permission(self, request: HttpRequest, obj: Optional[_ModelT] = ...) -> bool: ... - def has_delete_permission(self, request: HttpRequest, obj: Optional[_ModelT] = ...) -> bool: ... - def has_view_permission(self, request: HttpRequest, obj: Optional[_ModelT] = ...) -> bool: ... + def has_change_permission( + self, request: HttpRequest, obj: Optional[_ModelT] = ... + ) -> bool: ... + def has_delete_permission( + self, request: HttpRequest, obj: Optional[_ModelT] = ... + ) -> bool: ... + def has_view_permission( + self, request: HttpRequest, obj: Optional[_ModelT] = ... + ) -> bool: ... def has_module_permission(self, request: HttpRequest) -> bool: ... class ModelAdmin(BaseModelAdmin[_ModelT]): list_display: Sequence[Union[str, Callable[[_ModelT], Any]]] = ... list_display_links: Optional[Sequence[Union[str, Callable]]] = ... - list_filter: Sequence[Union[str, Type[ListFilter], Tuple[str, Type[ListFilter]]]] = ... + list_filter: Sequence[ + Union[str, Type[ListFilter], Tuple[str, Type[ListFilter]]] + ] = ... list_select_related: Union[bool, Sequence[str]] = ... list_per_page: int = ... list_max_show_all: int = ... @@ -154,7 +178,9 @@ class ModelAdmin(BaseModelAdmin[_ModelT]): delete_selected_confirmation_template: str = ... object_history_template: str = ... popup_response_template: str = ... - actions: Sequence[Union[Callable[[ModelAdmin, HttpRequest, QuerySet], None], str]] = ... + actions: Sequence[ + Union[Callable[[ModelAdmin, HttpRequest, QuerySet], None], str] + ] = ... action_form: Any = ... actions_on_top: bool = ... actions_on_bottom: bool = ... @@ -162,21 +188,37 @@ class ModelAdmin(BaseModelAdmin[_ModelT]): model: Type[_ModelT] = ... opts: Options = ... admin_site: AdminSite = ... - def __init__(self, model: Type[_ModelT], admin_site: Optional[AdminSite]) -> None: ... - def get_inline_instances(self, request: HttpRequest, obj: Optional[_ModelT] = ...) -> List[InlineModelAdmin]: ... + def __init__( + self, model: Type[_ModelT], admin_site: Optional[AdminSite] + ) -> None: ... + def get_inline_instances( + self, request: HttpRequest, obj: Optional[_ModelT] = ... + ) -> List[InlineModelAdmin]: ... def get_urls(self) -> List[URLPattern]: ... @property def urls(self) -> List[URLPattern]: ... @property def media(self) -> Media: ... def get_model_perms(self, request: HttpRequest) -> Dict[str, bool]: ... - def get_form(self, request: Any, obj: Optional[_ModelT] = ..., change: bool = ..., **kwargs: Any): ... - def get_changelist(self, request: HttpRequest, **kwargs: Any) -> Type[ChangeList]: ... + def get_form( + self, + request: Any, + obj: Optional[_ModelT] = ..., + change: bool = ..., + **kwargs: Any + ): ... + def get_changelist( + self, request: HttpRequest, **kwargs: Any + ) -> Type[ChangeList]: ... def get_changelist_instance(self, request: HttpRequest) -> ChangeList: ... - def get_object(self, request: HttpRequest, object_id: str, from_field: None = ...) -> Optional[_ModelT]: ... + def get_object( + self, request: HttpRequest, object_id: str, from_field: None = ... + ) -> Optional[_ModelT]: ... def get_changelist_form(self, request: Any, **kwargs: Any): ... def get_changelist_formset(self, request: Any, **kwargs: Any): ... - def get_formsets_with_inlines(self, request: HttpRequest, obj: Optional[_ModelT] = ...) -> Iterator[Any]: ... + def get_formsets_with_inlines( + self, request: HttpRequest, obj: Optional[_ModelT] = ... + ) -> Iterator[Any]: ... def get_paginator( self, request: HttpRequest, @@ -185,9 +227,15 @@ class ModelAdmin(BaseModelAdmin[_ModelT]): orphans: int = ..., allow_empty_first_page: bool = ..., ) -> Paginator: ... - def log_addition(self, request: HttpRequest, object: _ModelT, message: Any) -> LogEntry: ... - def log_change(self, request: HttpRequest, object: _ModelT, message: Any) -> LogEntry: ... - def log_deletion(self, request: HttpRequest, object: _ModelT, object_repr: str) -> LogEntry: ... + def log_addition( + self, request: HttpRequest, object: _ModelT, message: Any + ) -> LogEntry: ... + def log_change( + self, request: HttpRequest, object: _ModelT, message: Any + ) -> LogEntry: ... + def log_deletion( + self, request: HttpRequest, object: _ModelT, object_repr: str + ) -> LogEntry: ... def action_checkbox(self, obj: _ModelT) -> SafeText: ... def get_actions(self, request: HttpRequest) -> OrderedDict: ... def get_action_choices( @@ -195,7 +243,9 @@ class ModelAdmin(BaseModelAdmin[_ModelT]): ) -> List[Tuple[str, str]]: ... def get_action(self, action: Union[Callable, str]) -> Tuple[Callable, str, str]: ... def get_list_display(self, request: HttpRequest) -> Sequence[str]: ... - def get_list_display_links(self, request: HttpRequest, list_display: Sequence[str]) -> Optional[Sequence[str]]: ... + def get_list_display_links( + self, request: HttpRequest, list_display: Sequence[str] + ) -> Optional[Sequence[str]]: ... def get_list_filter(self, request: HttpRequest) -> Sequence[str]: ... def get_list_select_related(self, request: HttpRequest) -> Sequence[str]: ... def get_search_fields(self, request: HttpRequest) -> List[str]: ... @@ -203,10 +253,18 @@ class ModelAdmin(BaseModelAdmin[_ModelT]): self, request: HttpRequest, queryset: QuerySet, search_term: str ) -> Tuple[QuerySet, bool]: ... def get_preserved_filters(self, request: HttpRequest) -> str: ... - def _get_edited_object_pks(self, request: HttpRequest, prefix: str) -> List[str]: ... - def _get_list_editable_queryset(self, request: HttpRequest, prefix: str) -> QuerySet: ... + def _get_edited_object_pks( + self, request: HttpRequest, prefix: str + ) -> List[str]: ... + def _get_list_editable_queryset( + self, request: HttpRequest, prefix: str + ) -> QuerySet: ... def construct_change_message( - self, request: HttpRequest, form: AdminPasswordChangeForm, formsets: None, add: bool = ... + self, + request: HttpRequest, + form: AdminPasswordChangeForm, + formsets: None, + add: bool = ..., ) -> List[Dict[str, Dict[str, List[str]]]]: ... def message_user( self, @@ -217,11 +275,17 @@ class ModelAdmin(BaseModelAdmin[_ModelT]): fail_silently: bool = ..., ) -> None: ... def save_form(self, request: Any, form: Any, change: Any): ... - def save_model(self, request: Any, obj: _ModelT, form: Any, change: Any) -> None: ... + def save_model( + self, request: Any, obj: _ModelT, form: Any, change: Any + ) -> None: ... def delete_model(self, request: HttpRequest, obj: _ModelT) -> None: ... def delete_queryset(self, request: HttpRequest, queryset: QuerySet) -> None: ... - def save_formset(self, request: Any, form: Any, formset: Any, change: Any) -> None: ... - def save_related(self, request: Any, form: Any, formsets: Any, change: Any) -> None: ... + def save_formset( + self, request: Any, form: Any, formset: Any, change: Any + ) -> None: ... + def save_related( + self, request: Any, form: Any, formsets: Any, change: Any + ) -> None: ... def render_change_form( self, request: Any, @@ -235,13 +299,25 @@ class ModelAdmin(BaseModelAdmin[_ModelT]): self, request: HttpRequest, obj: _ModelT, post_url_continue: Optional[str] = ... ) -> HttpResponse: ... def response_change(self, request: HttpRequest, obj: _ModelT) -> HttpResponse: ... - def response_post_save_add(self, request: HttpRequest, obj: _ModelT) -> HttpResponseRedirect: ... - def response_post_save_change(self, request: HttpRequest, obj: _ModelT) -> HttpResponseRedirect: ... - def response_action(self, request: HttpRequest, queryset: QuerySet) -> Optional[HttpResponseBase]: ... - def response_delete(self, request: HttpRequest, obj_display: str, obj_id: int) -> HttpResponse: ... + def response_post_save_add( + self, request: HttpRequest, obj: _ModelT + ) -> HttpResponseRedirect: ... + def response_post_save_change( + self, request: HttpRequest, obj: _ModelT + ) -> HttpResponseRedirect: ... + def response_action( + self, request: HttpRequest, queryset: QuerySet + ) -> Optional[HttpResponseBase]: ... + def response_delete( + self, request: HttpRequest, obj_display: str, obj_id: int + ) -> HttpResponse: ... def render_delete_form(self, request: Any, context: Any): ... def get_inline_formsets( - self, request: HttpRequest, formsets: List[Any], inline_instances: List[Any], obj: Optional[_ModelT] = ... + self, + request: HttpRequest, + formsets: List[Any], + inline_instances: List[Any], + obj: Optional[_ModelT] = ..., ) -> List[Any]: ... def get_changeform_initial_data(self, request: HttpRequest) -> Dict[str, str]: ... def changeform_view( @@ -252,9 +328,15 @@ class ModelAdmin(BaseModelAdmin[_ModelT]): extra_context: Optional[Dict[str, bool]] = ..., ) -> Any: ... def autocomplete_view(self, request: HttpRequest) -> JsonResponse: ... - def add_view(self, request: HttpRequest, form_url: str = ..., extra_context: None = ...) -> HttpResponse: ... + def add_view( + self, request: HttpRequest, form_url: str = ..., extra_context: None = ... + ) -> HttpResponse: ... def change_view( - self, request: HttpRequest, object_id: str, form_url: str = ..., extra_context: Optional[Dict[str, bool]] = ... + self, + request: HttpRequest, + object_id: str, + form_url: str = ..., + extra_context: Optional[Dict[str, bool]] = ..., ) -> HttpResponse: ... def changelist_view( self, request: HttpRequest, extra_context: Optional[Dict[str, str]] = ... @@ -262,8 +344,12 @@ class ModelAdmin(BaseModelAdmin[_ModelT]): def get_deleted_objects( self, objs: QuerySet, request: HttpRequest ) -> Tuple[List[Any], Dict[Any, Any], Set[Any], List[Any]]: ... - def delete_view(self, request: HttpRequest, object_id: str, extra_context: None = ...) -> Any: ... - def history_view(self, request: HttpRequest, object_id: str, extra_context: None = ...) -> HttpResponse: ... + def delete_view( + self, request: HttpRequest, object_id: str, extra_context: None = ... + ) -> Any: ... + def history_view( + self, request: HttpRequest, object_id: str, extra_context: None = ... + ) -> HttpResponse: ... class InlineModelAdmin(BaseModelAdmin[_ModelT]): model: Type[_ModelT] = ... @@ -282,13 +368,23 @@ class InlineModelAdmin(BaseModelAdmin[_ModelT]): parent_model: Any = ... opts: Any = ... has_registered_model: Any = ... - def __init__(self, parent_model: Union[Type[_ModelT], _ModelT], admin_site: AdminSite) -> None: ... + def __init__( + self, parent_model: Union[Type[_ModelT], _ModelT], admin_site: AdminSite + ) -> None: ... @property def media(self) -> Media: ... - def get_extra(self, request: HttpRequest, obj: Optional[_ModelT] = ..., **kwargs: Any) -> int: ... - def get_min_num(self, request: HttpRequest, obj: Optional[_ModelT] = ..., **kwargs: Any) -> Optional[int]: ... - def get_max_num(self, request: HttpRequest, obj: Optional[_ModelT] = ..., **kwargs: Any) -> Optional[int]: ... - def get_formset(self, request: Any, obj: Optional[_ModelT] = ..., **kwargs: Any): ... + def get_extra( + self, request: HttpRequest, obj: Optional[_ModelT] = ..., **kwargs: Any + ) -> int: ... + def get_min_num( + self, request: HttpRequest, obj: Optional[_ModelT] = ..., **kwargs: Any + ) -> Optional[int]: ... + def get_max_num( + self, request: HttpRequest, obj: Optional[_ModelT] = ..., **kwargs: Any + ) -> Optional[int]: ... + def get_formset( + self, request: Any, obj: Optional[_ModelT] = ..., **kwargs: Any + ): ... class StackedInline(InlineModelAdmin[_ModelT]): ... class TabularInline(InlineModelAdmin[_ModelT]): ... diff --git a/django-stubs/contrib/admin/sites.pyi b/django-stubs/contrib/admin/sites.pyi index 2227f87bc..59d88863a 100644 --- a/django-stubs/contrib/admin/sites.pyi +++ b/django-stubs/contrib/admin/sites.pyi @@ -1,5 +1,6 @@ from typing import Any, Callable, Dict, Iterable, List, Optional, Tuple, Type, Union +from django.apps.config import AppConfig from django.contrib.admin.options import ModelAdmin from django.core.handlers.wsgi import WSGIRequest from django.db.models.base import Model @@ -8,8 +9,6 @@ from django.template.response import TemplateResponse from django.urls.resolvers import URLResolver from django.utils.functional import LazyObject -from django.apps.config import AppConfig - all_sites: Any class AlreadyRegistered(Exception): ... @@ -37,7 +36,9 @@ class AdminSite: admin_class: Optional[Type[ModelAdmin]] = ..., **options: Any ) -> None: ... - def unregister(self, model_or_iterable: Union[Type[Model], 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 add_action(self, action: Callable, name: Optional[str] = ...) -> None: ... def disable_action(self, name: str) -> None: ... @@ -60,14 +61,27 @@ class AdminSite: def password_change_done( self, request: WSGIRequest, extra_context: Optional[Dict[str, Any]] = ... ) -> TemplateResponse: ... - def i18n_javascript(self, request: WSGIRequest, extra_context: Optional[Dict[Any, Any]] = ...) -> HttpResponse: ... - def logout(self, request: WSGIRequest, extra_context: Optional[Dict[str, Any]] = ...) -> TemplateResponse: ... - def login(self, request: WSGIRequest, extra_context: Optional[Dict[str, Any]] = ...) -> HttpResponse: ... - def _build_app_dict(self, request: WSGIRequest, label: Optional[str] = ...) -> Dict[str, Any]: ... + def i18n_javascript( + self, request: WSGIRequest, extra_context: Optional[Dict[Any, Any]] = ... + ) -> HttpResponse: ... + def logout( + self, request: WSGIRequest, extra_context: Optional[Dict[str, Any]] = ... + ) -> TemplateResponse: ... + def login( + self, request: WSGIRequest, extra_context: Optional[Dict[str, Any]] = ... + ) -> HttpResponse: ... + def _build_app_dict( + self, request: WSGIRequest, label: Optional[str] = ... + ) -> Dict[str, Any]: ... def get_app_list(self, request: WSGIRequest) -> List[Any]: ... - def index(self, request: WSGIRequest, extra_context: Optional[Dict[str, Any]] = ...) -> TemplateResponse: ... + def index( + self, request: WSGIRequest, extra_context: Optional[Dict[str, Any]] = ... + ) -> TemplateResponse: ... def app_index( - self, request: WSGIRequest, app_label: str, extra_context: Optional[Dict[str, Any]] = ... + self, + request: WSGIRequest, + app_label: str, + extra_context: Optional[Dict[str, Any]] = ..., ) -> TemplateResponse: ... class DefaultAdminSite(LazyObject): ... diff --git a/django-stubs/contrib/admin/templatetags/admin_list.pyi b/django-stubs/contrib/admin/templatetags/admin_list.pyi index 8218f37e6..e4ee9d2e8 100644 --- a/django-stubs/contrib/admin/templatetags/admin_list.pyi +++ b/django-stubs/contrib/admin/templatetags/admin_list.pyi @@ -1,4 +1,4 @@ -from typing import Any, Dict, Iterator, List, Optional, Union, Iterable +from typing import Any, Dict, Iterable, Iterator, List, Optional, Union from django.contrib.admin.filters import FieldListFilter from django.contrib.admin.templatetags.base import InclusionAdminNode @@ -17,8 +17,12 @@ DOT: str def paginator_number(cl: ChangeList, i: int) -> SafeText: ... def pagination(cl: ChangeList) -> Dict[str, Iterable[Any]]: ... def pagination_tag(parser: Parser, token: Token) -> InclusionAdminNode: ... -def result_headers(cl: ChangeList) -> Iterator[Dict[str, Optional[Union[int, str]]]]: ... -def items_for_result(cl: ChangeList, result: Model, form: None) -> Iterator[SafeText]: ... +def result_headers( + cl: ChangeList, +) -> Iterator[Dict[str, Optional[Union[int, str]]]]: ... +def items_for_result( + cl: ChangeList, result: Model, form: None +) -> Iterator[SafeText]: ... class ResultList(list): form: None = ... @@ -29,7 +33,14 @@ def result_hidden_fields(cl: ChangeList) -> Iterator[BoundField]: ... def result_list( cl: ChangeList, ) -> 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, + ], ]: ... def result_list_tag(parser: Parser, token: Token) -> InclusionAdminNode: ... def date_hierarchy(cl: ChangeList) -> Optional[Dict[str, Any]]: ... @@ -39,4 +50,6 @@ def search_form_tag(parser: Parser, token: Token) -> InclusionAdminNode: ... def admin_list_filter(cl: ChangeList, spec: FieldListFilter) -> SafeText: ... def admin_actions(context: RequestContext) -> RequestContext: ... def admin_actions_tag(parser: Parser, token: Token) -> InclusionAdminNode: ... -def change_list_object_tools_tag(parser: Parser, token: Token) -> InclusionAdminNode: ... +def change_list_object_tools_tag( + parser: Parser, token: Token +) -> InclusionAdminNode: ... diff --git a/django-stubs/contrib/admin/templatetags/admin_modify.pyi b/django-stubs/contrib/admin/templatetags/admin_modify.pyi index 67ee4c678..fb2cb3386 100644 --- a/django-stubs/contrib/admin/templatetags/admin_modify.pyi +++ b/django-stubs/contrib/admin/templatetags/admin_modify.pyi @@ -12,5 +12,7 @@ def prepopulated_fields_js(context: RequestContext) -> RequestContext: ... def prepopulated_fields_js_tag(parser: Parser, token: Token) -> InclusionAdminNode: ... def submit_row(context: RequestContext) -> Context: ... def submit_row_tag(parser: Parser, token: Token) -> InclusionAdminNode: ... -def change_form_object_tools_tag(parser: Parser, token: Token) -> InclusionAdminNode: ... +def change_form_object_tools_tag( + parser: Parser, token: Token +) -> InclusionAdminNode: ... def cell_count(inline_admin_form: InlineAdminForm) -> int: ... diff --git a/django-stubs/contrib/admin/templatetags/base.pyi b/django-stubs/contrib/admin/templatetags/base.pyi index 377500754..6b20af0b9 100644 --- a/django-stubs/contrib/admin/templatetags/base.pyi +++ b/django-stubs/contrib/admin/templatetags/base.pyi @@ -12,6 +12,11 @@ class InclusionAdminNode(InclusionNode): takes_context: bool template_name: str = ... def __init__( - self, parser: Parser, token: Token, func: Callable, template_name: str, takes_context: bool = ... + self, + parser: Parser, + token: Token, + func: Callable, + template_name: str, + takes_context: bool = ..., ) -> None: ... def render(self, context: Context) -> SafeText: ... diff --git a/django-stubs/contrib/admin/tests.pyi b/django-stubs/contrib/admin/tests.pyi index 96059d8b7..4ae5ea16d 100644 --- a/django-stubs/contrib/admin/tests.pyi +++ b/django-stubs/contrib/admin/tests.pyi @@ -10,12 +10,18 @@ class AdminSeleniumTestCase(SeleniumTestCase, StaticLiveServerTestCase): def wait_until(self, callback: Callable, timeout: int = ...) -> None: ... def wait_for_popup(self, num_windows: int = ..., timeout: int = ...) -> None: ... def wait_for(self, css_selector: str, timeout: int = ...) -> None: ... - def wait_for_text(self, css_selector: str, text: str, timeout: int = ...) -> None: ... - def wait_for_value(self, css_selector: str, text: str, timeout: int = ...) -> None: ... + def wait_for_text( + self, css_selector: str, text: str, timeout: int = ... + ) -> None: ... + def wait_for_value( + self, css_selector: str, text: str, timeout: int = ... + ) -> None: ... def wait_until_visible(self, css_selector: str, timeout: int = ...) -> None: ... def wait_until_invisible(self, css_selector: str, timeout: int = ...) -> None: ... def wait_page_loaded(self) -> None: ... - def admin_login(self, username: str, password: str, login_url: str = ...) -> None: ... + def admin_login( + self, username: str, password: str, login_url: str = ... + ) -> None: ... def get_css_value(self, selector: str, attribute: str) -> Any: ... def get_select_option(self, selector: str, value: Any) -> Any: ... def assertSelectOptions(self, selector: str, values: Any) -> None: ... diff --git a/django-stubs/contrib/admin/utils.pyi b/django-stubs/contrib/admin/utils.pyi index b127166bf..28d925322 100644 --- a/django-stubs/contrib/admin/utils.pyi +++ b/django-stubs/contrib/admin/utils.pyi @@ -1,6 +1,17 @@ import collections from datetime import datetime -from typing import Any, Callable, Dict, List, Optional, Sequence, Set, Tuple, Type, Union +from typing import ( + Any, + Callable, + Dict, + List, + Optional, + Sequence, + Set, + Tuple, + Type, + Union, +) from uuid import UUID from django.contrib.admin.options import BaseModelAdmin @@ -9,17 +20,18 @@ from django.contrib.auth.forms import AdminPasswordChangeForm from django.core.handlers.wsgi import WSGIRequest from django.db.models.base import Model from django.db.models.deletion import Collector +from django.db.models.fields import Field, reverse_related from django.db.models.fields.reverse_related import ManyToOneRel from django.db.models.options import Options from django.db.models.query import QuerySet from django.forms.forms import BaseForm -from django.db.models.fields import Field, reverse_related - class FieldIsAForeignKeyColumnName(Exception): ... def lookup_needs_distinct(opts: Options, lookup_path: str) -> bool: ... -def prepare_lookup_value(key: str, value: Union[datetime, str]) -> Union[bool, datetime, str]: ... +def prepare_lookup_value( + key: str, value: Union[datetime, str] +) -> Union[bool, datetime, str]: ... def quote(s: Union[int, str, UUID]) -> str: ... def unquote(s: str) -> str: ... def flatten(fields: Any) -> List[Union[Callable, str]]: ... @@ -39,7 +51,9 @@ class NestedObjects(Collector): model_objs: Any = ... def __init__(self, *args: Any, **kwargs: Any) -> None: ... def add_edge(self, source: Optional[Model], target: Model) -> None: ... - def related_objects(self, related: ManyToOneRel, objs: Sequence[Optional[Model]]) -> QuerySet: ... + def related_objects( + self, related: ManyToOneRel, objs: Sequence[Optional[Model]] + ) -> QuerySet: ... def nested(self, format_callback: Callable = ...) -> List[Any]: ... def model_format_dict(obj: Any): ... @@ -56,11 +70,15 @@ def label_for_field( ) -> Union[Tuple[Optional[str], Union[Callable, Type[str]]], str]: ... def help_text_for_field(name: str, model: Type[Model]) -> str: ... def display_for_field(value: Any, field: Field, empty_value_display: str) -> str: ... -def display_for_value(value: Any, empty_value_display: str, boolean: bool = ...) -> str: ... +def display_for_value( + value: Any, empty_value_display: str, boolean: bool = ... +) -> str: ... class NotRelationField(Exception): ... -def get_model_from_relation(field: Union[Field, reverse_related.ForeignObjectRel]) -> Type[Model]: ... +def get_model_from_relation( + field: Union[Field, reverse_related.ForeignObjectRel] +) -> Type[Model]: ... def reverse_field_path(model: Type[Model], path: str) -> Tuple[Type[Model], str]: ... def get_fields_from_path(model: Type[Model], path: str) -> List[Field]: ... def construct_change_message( diff --git a/django-stubs/contrib/admin/views/decorators.pyi b/django-stubs/contrib/admin/views/decorators.pyi index ce7516d2d..f272777b2 100644 --- a/django-stubs/contrib/admin/views/decorators.pyi +++ b/django-stubs/contrib/admin/views/decorators.pyi @@ -7,5 +7,7 @@ def staff_member_required( ) -> _C: ... @overload def staff_member_required( - view_func: None = ..., redirect_field_name: Optional[str] = ..., login_url: str = ... + view_func: None = ..., + redirect_field_name: Optional[str] = ..., + login_url: str = ..., ) -> Callable: ... diff --git a/django-stubs/contrib/admin/views/main.pyi b/django-stubs/contrib/admin/views/main.pyi index ad2deebbd..170d53aac 100644 --- a/django-stubs/contrib/admin/views/main.pyi +++ b/django-stubs/contrib/admin/views/main.pyi @@ -2,17 +2,14 @@ from collections import OrderedDict from typing import Any, Callable, Dict, List, Optional, Tuple, Type, Union from django.contrib.admin.filters import ListFilter, SimpleListFilter -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.contrib.admin.options import IS_POPUP_VAR as IS_POPUP_VAR # noqa: F401 +from django.contrib.admin.options import TO_FIELD_VAR as TO_FIELD_VAR +from django.contrib.admin.options import ModelAdmin from django.core.handlers.wsgi import WSGIRequest from django.db.models.base import Model from django.db.models.expressions import Combinable, CombinedExpression, OrderBy -from django.db.models.query import QuerySet - from django.db.models.options import Options +from django.db.models.query import QuerySet from django.forms.formsets import BaseFormSet ALL_VAR: str @@ -67,9 +64,13 @@ class ChangeList: sortable_by: Union[List[Callable], List[str], Tuple], ) -> None: ... def get_filters_params(self, params: None = ...) -> Dict[str, str]: ... - def get_filters(self, request: WSGIRequest) -> Tuple[List[ListFilter], bool, Dict[str, Union[bool, str]], bool]: ... + def get_filters( + self, request: WSGIRequest + ) -> Tuple[List[ListFilter], bool, Dict[str, Union[bool, str]], bool]: ... def get_query_string( - self, new_params: Optional[Dict[str, None]] = ..., remove: Optional[List[str]] = ... + self, + new_params: Optional[Dict[str, None]] = ..., + remove: Optional[List[str]] = ..., ) -> str: ... result_count: Any = ... show_full_result_count: Any = ... @@ -80,8 +81,12 @@ class ChangeList: multi_page: Any = ... paginator: Any = ... def get_results(self, request: WSGIRequest) -> None: ... - def get_ordering_field(self, field_name: Union[Callable, str]) -> Optional[Union[CombinedExpression, str]]: ... - def get_ordering(self, request: WSGIRequest, queryset: QuerySet) -> List[Union[OrderBy, Combinable, str]]: ... + def get_ordering_field( + self, field_name: Union[Callable, str] + ) -> Optional[Union[CombinedExpression, str]]: ... + def get_ordering( + self, request: WSGIRequest, queryset: QuerySet + ) -> List[Union[OrderBy, Combinable, str]]: ... def get_ordering_field_columns(self) -> OrderedDict: ... def get_queryset(self, request: WSGIRequest) -> QuerySet: ... def apply_select_related(self, qs: QuerySet) -> QuerySet: ... diff --git a/django-stubs/contrib/admin/widgets.pyi b/django-stubs/contrib/admin/widgets.pyi index 7d7fe3976..81ce95ce8 100644 --- a/django-stubs/contrib/admin/widgets.pyi +++ b/django-stubs/contrib/admin/widgets.pyi @@ -1,19 +1,24 @@ from typing import Any, Dict, Optional, Tuple, Union from uuid import UUID +from django import forms from django.contrib.admin.sites import AdminSite from django.db.models.fields.reverse_related import ForeignObjectRel, ManyToOneRel from django.forms.models import ModelChoiceIterator from django.forms.widgets import Media -from django import forms - class FilteredSelectMultiple(forms.SelectMultiple): @property def media(self) -> Media: ... verbose_name: Any = ... is_stacked: Any = ... - def __init__(self, verbose_name: str, is_stacked: bool, attrs: None = ..., choices: Tuple = ...) -> None: ... + def __init__( + self, + verbose_name: str, + is_stacked: bool, + attrs: None = ..., + choices: Tuple = ..., + ) -> None: ... class AdminDateWidget(forms.DateInput): @property @@ -33,10 +38,18 @@ class ForeignKeyRawIdWidget(forms.TextInput): rel: ManyToOneRel = ... admin_site: AdminSite = ... db: None = ... - def __init__(self, rel: ForeignObjectRel, admin_site: AdminSite, attrs: None = ..., using: None = ...) -> None: ... + def __init__( + self, + rel: ForeignObjectRel, + admin_site: AdminSite, + attrs: None = ..., + using: None = ..., + ) -> None: ... def base_url_parameters(self) -> Dict[str, str]: ... def url_parameters(self) -> Dict[str, str]: ... - def label_and_url_for_value(self, value: Union[int, str, UUID]) -> Tuple[str, str]: ... + def label_and_url_for_value( + self, value: Union[int, str, UUID] + ) -> Tuple[str, str]: ... class ManyToManyRawIdWidget(ForeignKeyRawIdWidget): ... @@ -62,7 +75,9 @@ class RelatedFieldWidgetWrapper(forms.Widget): ) -> None: ... @property def media(self) -> Media: ... - def get_related_url(self, info: Tuple[str, str], action: str, *args: Any) -> str: ... + def get_related_url( + self, info: Tuple[str, str], action: str, *args: Any + ) -> str: ... class AdminTextareaWidget(forms.Textarea): ... class AdminTextInputWidget(forms.TextInput): ... diff --git a/django-stubs/contrib/admindocs/apps.pyi b/django-stubs/contrib/admindocs/apps.pyi index 4e2eccd5a..6150ebd38 100644 --- a/django-stubs/contrib/admindocs/apps.pyi +++ b/django-stubs/contrib/admindocs/apps.pyi @@ -1,6 +1,7 @@ -from django.apps import AppConfig as AppConfig from typing import Any +from django.apps import AppConfig as AppConfig + class AdminDocsConfig(AppConfig): name: str = ... verbose_name: Any = ... diff --git a/django-stubs/contrib/admindocs/middleware.pyi b/django-stubs/contrib/admindocs/middleware.pyi index fc697253d..c34ac2713 100644 --- a/django-stubs/contrib/admindocs/middleware.pyi +++ b/django-stubs/contrib/admindocs/middleware.pyi @@ -6,5 +6,9 @@ from django.utils.deprecation import MiddlewareMixin class XViewMiddleware(MiddlewareMixin): def process_view( - self, request: WSGIRequest, view_func: Callable, view_args: Tuple, view_kwargs: Dict[Any, Any] + self, + request: WSGIRequest, + view_func: Callable, + view_args: Tuple, + view_kwargs: Dict[Any, Any], ) -> Optional[HttpResponse]: ... diff --git a/django-stubs/contrib/admindocs/utils.pyi b/django-stubs/contrib/admindocs/utils.pyi index e96e469b2..3b801c541 100644 --- a/django-stubs/contrib/admindocs/utils.pyi +++ b/django-stubs/contrib/admindocs/utils.pyi @@ -5,7 +5,9 @@ docutils_is_available: bool def get_view_name(view_func: Callable) -> str: ... def trim_docstring(docstring: Any): ... def parse_docstring(docstring: Any): ... -def parse_rst(text: Any, default_reference_context: Any, thing_being_parsed: Optional[Any] = ...): ... +def parse_rst( + text: Any, default_reference_context: Any, thing_being_parsed: Optional[Any] = ... +): ... ROLES: Any diff --git a/django-stubs/contrib/admindocs/views.pyi b/django-stubs/contrib/admindocs/views.pyi index 48ef49bc3..bf44a2dfb 100644 --- a/django-stubs/contrib/admindocs/views.pyi +++ b/django-stubs/contrib/admindocs/views.pyi @@ -17,5 +17,7 @@ class TemplateDetailView(BaseAdminDocsView): ... def get_return_data_type(func_name: Any): ... def get_readable_field_data_type(field: Union[Field, str]) -> str: ... -def extract_views_from_urlpatterns(urlpatterns: Any, base: str = ..., namespace: Optional[Any] = ...): ... +def extract_views_from_urlpatterns( + urlpatterns: Any, base: str = ..., namespace: Optional[Any] = ... +): ... def simplify_regex(pattern: str) -> str: ... diff --git a/django-stubs/contrib/auth/__init__.pyi b/django-stubs/contrib/auth/__init__.pyi index 72fb61bcc..41c97ef67 100644 --- a/django-stubs/contrib/auth/__init__.pyi +++ b/django-stubs/contrib/auth/__init__.pyi @@ -20,13 +20,19 @@ REDIRECT_FIELD_NAME: str def load_backend(path: str) -> ModelBackend: ... def get_backends() -> List[ModelBackend]: ... -def authenticate(request: Any = ..., **credentials: Any) -> Optional[AbstractBaseUser]: ... +def authenticate( + request: Any = ..., **credentials: Any +) -> Optional[AbstractBaseUser]: ... def login( - request: HttpRequest, user: Optional[AbstractBaseUser], backend: Optional[Union[Type[ModelBackend], str]] = ... + request: HttpRequest, + user: Optional[AbstractBaseUser], + backend: Optional[Union[Type[ModelBackend], str]] = ..., ) -> None: ... def logout(request: HttpRequest) -> None: ... def get_user_model() -> Type[Model]: ... -def get_user(request: Union[HttpRequest, Client]) -> Union[AbstractBaseUser, AnonymousUser]: ... +def get_user( + request: Union[HttpRequest, Client] +) -> Union[AbstractBaseUser, AnonymousUser]: ... def get_permission_codename(action: str, opts: Options) -> str: ... def update_session_auth_hash(request: HttpRequest, user: AbstractBaseUser) -> None: ... diff --git a/django-stubs/contrib/auth/admin.pyi b/django-stubs/contrib/auth/admin.pyi index 69060d432..244ac0cc0 100644 --- a/django-stubs/contrib/auth/admin.pyi +++ b/django-stubs/contrib/auth/admin.pyi @@ -1,10 +1,9 @@ from typing import Any +from django.contrib import admin from django.core.handlers.wsgi import WSGIRequest from django.http.response import HttpResponse -from django.contrib import admin - csrf_protect_m: Any sensitive_post_parameters_m: Any @@ -15,4 +14,6 @@ class UserAdmin(admin.ModelAdmin): add_fieldsets: Any = ... add_form: Any = ... change_password_form: Any = ... - def user_change_password(self, request: WSGIRequest, id: str, form_url: str = ...) -> HttpResponse: ... + def user_change_password( + self, request: WSGIRequest, id: str, form_url: str = ... + ) -> HttpResponse: ... diff --git a/django-stubs/contrib/auth/backends.pyi b/django-stubs/contrib/auth/backends.pyi index efad88dc0..f5be33d8a 100644 --- a/django-stubs/contrib/auth/backends.pyi +++ b/django-stubs/contrib/auth/backends.pyi @@ -1,8 +1,7 @@ from typing import Any, Optional, Set, Union from django.contrib.auth.base_user import AbstractBaseUser -from django.contrib.auth.models import AnonymousUser, User, Permission - +from django.contrib.auth.models import AnonymousUser, Permission, User from django.db.models.base import Model from django.http.request import HttpRequest @@ -12,13 +11,25 @@ UserModel: Any class BaseBackend: def authenticate( - self, request: HttpRequest, username: Optional[str] = ..., password: Optional[str] = ..., **kwargs: Any + self, + request: HttpRequest, + username: Optional[str] = ..., + password: Optional[str] = ..., + **kwargs: Any ) -> Optional[AbstractBaseUser]: ... def get_user(self, user_id: int) -> Optional[AbstractBaseUser]: ... - def get_user_permissions(self, user_obj: _AnyUser, obj: Optional[Model] = ...) -> Set[str]: ... - def get_group_permissions(self, user_obj: _AnyUser, obj: Optional[Model] = ...) -> Set[str]: ... - def get_all_permissions(self, user_obj: _AnyUser, obj: Optional[Model] = ...) -> Set[str]: ... - def has_perm(self, user_obj: _AnyUser, perm: str, obj: Optional[Model] = ...) -> bool: ... + def get_user_permissions( + self, user_obj: _AnyUser, obj: Optional[Model] = ... + ) -> Set[str]: ... + def get_group_permissions( + self, user_obj: _AnyUser, obj: Optional[Model] = ... + ) -> Set[str]: ... + def get_all_permissions( + self, user_obj: _AnyUser, obj: Optional[Model] = ... + ) -> Set[str]: ... + def has_perm( + self, user_obj: _AnyUser, perm: str, obj: Optional[Model] = ... + ) -> bool: ... class ModelBackend(BaseBackend): def has_module_perms(self, user_obj: _AnyUser, app_label: str) -> bool: ... diff --git a/django-stubs/contrib/auth/base_user.pyi b/django-stubs/contrib/auth/base_user.pyi index 1d99919a1..ac2877404 100644 --- a/django-stubs/contrib/auth/base_user.pyi +++ b/django-stubs/contrib/auth/base_user.pyi @@ -1,10 +1,10 @@ import sys -from typing import Any, Optional, Tuple, List, overload, TypeVar, Union +from typing import Any, List, Optional, Tuple, TypeVar, Union, overload +from django.db import models from django.db.models.base import Model from django.db.models.expressions import Combinable from django.db.models.fields import BooleanField -from django.db import models if sys.version_info < (3, 8): from typing_extensions import Literal @@ -16,7 +16,9 @@ _T = TypeVar("_T", bound=Model) class BaseUserManager(models.Manager[_T]): @classmethod def normalize_email(cls, email: Optional[str]) -> str: ... - def make_random_password(self, length: int = ..., allowed_chars: str = ...) -> str: ... + def make_random_password( + self, length: int = ..., allowed_chars: str = ... + ) -> str: ... def get_by_natural_key(self, username: Optional[str]) -> _T: ... class AbstractBaseUser(models.Model): diff --git a/django-stubs/contrib/auth/checks.pyi b/django-stubs/contrib/auth/checks.pyi index cac71bd0a..a0b28df3b 100644 --- a/django-stubs/contrib/auth/checks.pyi +++ b/django-stubs/contrib/auth/checks.pyi @@ -1,8 +1,11 @@ from typing import Any, List, Optional, Sequence -from django.core.checks.messages import CheckMessage - from django.apps.config import AppConfig +from django.core.checks.messages import CheckMessage -def check_user_model(app_configs: Optional[Sequence[AppConfig]] = ..., **kwargs: Any) -> List[CheckMessage]: ... -def check_models_permissions(app_configs: Optional[Sequence[AppConfig]] = ..., **kwargs: Any) -> List[Any]: ... +def check_user_model( + app_configs: Optional[Sequence[AppConfig]] = ..., **kwargs: Any +) -> List[CheckMessage]: ... +def check_models_permissions( + app_configs: Optional[Sequence[AppConfig]] = ..., **kwargs: Any +) -> List[Any]: ... diff --git a/django-stubs/contrib/auth/decorators.pyi b/django-stubs/contrib/auth/decorators.pyi index 3ecebe72e..e8003e742 100644 --- a/django-stubs/contrib/auth/decorators.pyi +++ b/django-stubs/contrib/auth/decorators.pyi @@ -1,21 +1,28 @@ -from typing import Callable, List, Optional, Set, Union, TypeVar, overload +from typing import Callable, List, Optional, Set, TypeVar, Union, overload from django.contrib.auth import REDIRECT_FIELD_NAME as REDIRECT_FIELD_NAME # noqa: F401 -from django.http.response import HttpResponseBase - from django.contrib.auth.models import AbstractUser +from django.http.response import HttpResponseBase _VIEW = TypeVar("_VIEW", bound=Callable[..., HttpResponseBase]) def user_passes_test( - test_func: Callable[[AbstractUser], bool], login_url: Optional[str] = ..., redirect_field_name: str = ... + test_func: Callable[[AbstractUser], bool], + login_url: Optional[str] = ..., + redirect_field_name: str = ..., ) -> Callable[[_VIEW], _VIEW]: ... # There are two ways of calling @login_required: @with(arguments) and @bare @overload -def login_required(redirect_field_name: str = ..., login_url: Optional[str] = ...) -> Callable[[_VIEW], _VIEW]: ... +def login_required( + redirect_field_name: str = ..., login_url: Optional[str] = ... +) -> Callable[[_VIEW], _VIEW]: ... @overload -def login_required(function: _VIEW, redirect_field_name: str = ..., login_url: Optional[str] = ...) -> _VIEW: ... +def login_required( + function: _VIEW, redirect_field_name: str = ..., login_url: Optional[str] = ... +) -> _VIEW: ... def permission_required( - perm: Union[List[str], Set[str], str], login_url: None = ..., raise_exception: bool = ... + perm: Union[List[str], Set[str], str], + login_url: None = ..., + raise_exception: bool = ..., ) -> Callable[[_VIEW], _VIEW]: ... diff --git a/django-stubs/contrib/auth/forms.pyi b/django-stubs/contrib/auth/forms.pyi index 6271f4555..f507a7313 100644 --- a/django-stubs/contrib/auth/forms.pyi +++ b/django-stubs/contrib/auth/forms.pyi @@ -1,13 +1,12 @@ from typing import Any, Dict, Iterator, Optional +from django import forms from django.contrib.auth.base_user import AbstractBaseUser from django.contrib.auth.models import User from django.contrib.auth.tokens import PasswordResetTokenGenerator from django.core.exceptions import ValidationError from django.core.handlers.wsgi import WSGIRequest -from django import forms - UserModel: Any class ReadOnlyPasswordHashWidget(forms.Widget): @@ -72,7 +71,9 @@ class SetPasswordForm(forms.Form): new_password1: Any = ... new_password2: Any = ... user: User = ... - def __init__(self, user: Optional[AbstractBaseUser], *args: Any, **kwargs: Any) -> None: ... + def __init__( + self, user: Optional[AbstractBaseUser], *args: Any, **kwargs: Any + ) -> None: ... def clean_new_password2(self) -> str: ... def save(self, commit: bool = ...) -> AbstractBaseUser: ... diff --git a/django-stubs/contrib/auth/hashers.pyi b/django-stubs/contrib/auth/hashers.pyi index 4998dfe6e..3af532a6c 100644 --- a/django-stubs/contrib/auth/hashers.pyi +++ b/django-stubs/contrib/auth/hashers.pyi @@ -5,9 +5,14 @@ UNUSABLE_PASSWORD_SUFFIX_LENGTH: int def is_password_usable(encoded: Optional[str]) -> bool: ... def check_password( - password: Optional[str], encoded: str, setter: Optional[Callable] = ..., preferred: str = ... + password: Optional[str], + encoded: str, + setter: Optional[Callable] = ..., + preferred: str = ..., ) -> bool: ... -def make_password(password: Optional[str], salt: Optional[str] = ..., hasher: str = ...) -> str: ... +def make_password( + password: Optional[str], salt: Optional[str] = ..., hasher: str = ... +) -> str: ... def get_hashers() -> List[BasePasswordHasher]: ... def get_hashers_by_algorithm() -> Dict[str, BasePasswordHasher]: ... def reset_hashers(**kwargs: Any) -> None: ... @@ -32,7 +37,9 @@ class BasePasswordHasher: def harden_runtime(self, password: str, encoded: str) -> None: ... class PBKDF2PasswordHasher(BasePasswordHasher): - def encode(self, password: str, salt: str, iterations: Optional[int] = ...) -> str: ... + def encode( + self, password: str, salt: str, iterations: Optional[int] = ... + ) -> str: ... class PBKDF2SHA1PasswordHasher(PBKDF2PasswordHasher): ... class Argon2PasswordHasher(BasePasswordHasher): ... diff --git a/django-stubs/contrib/auth/mixins.pyi b/django-stubs/contrib/auth/mixins.pyi index 50b726369..9c355a9e9 100644 --- a/django-stubs/contrib/auth/mixins.pyi +++ b/django-stubs/contrib/auth/mixins.pyi @@ -14,15 +14,21 @@ class AccessMixin: def handle_no_permission(self) -> HttpResponseRedirect: ... class LoginRequiredMixin(AccessMixin): - def dispatch(self, request: http.HttpRequest, *args: Any, **kwargs: Any) -> HttpResponse: ... + def dispatch( + self, request: http.HttpRequest, *args: Any, **kwargs: Any + ) -> HttpResponse: ... class PermissionRequiredMixin(AccessMixin): permission_required: Any = ... def get_permission_required(self) -> List[str]: ... def has_permission(self) -> bool: ... - 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): def test_func(self) -> Optional[bool]: ... 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: ... diff --git a/django-stubs/contrib/auth/models.pyi b/django-stubs/contrib/auth/models.pyi index 921841ea3..863d07708 100644 --- a/django-stubs/contrib/auth/models.pyi +++ b/django-stubs/contrib/auth/models.pyi @@ -2,14 +2,14 @@ import sys from typing import Any, Collection, Optional, Set, Tuple, Type, TypeVar, Union from django.contrib.auth.backends import ModelBackend -from django.contrib.auth.base_user import AbstractBaseUser as AbstractBaseUser, BaseUserManager as BaseUserManager +from django.contrib.auth.base_user import AbstractBaseUser as AbstractBaseUser +from django.contrib.auth.base_user import BaseUserManager as BaseUserManager from django.contrib.auth.validators import UnicodeUsernameValidator from django.contrib.contenttypes.models import ContentType +from django.db import models from django.db.models.base import Model from django.db.models.manager import EmptyManager -from django.db import models - if sys.version_info < (3, 8): from typing_extensions import Literal else: @@ -17,10 +17,14 @@ else: _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["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): content_type_id: int @@ -45,10 +49,18 @@ _T = TypeVar("_T", bound=Model) class UserManager(BaseUserManager[_T]): def create_user( - self, username: str, email: Optional[str] = ..., password: Optional[str] = ..., **extra_fields: Any + self, + username: str, + email: Optional[str] = ..., + password: Optional[str] = ..., + **extra_fields: Any ) -> _T: ... def create_superuser( - self, username: str, email: Optional[str], password: Optional[str], **extra_fields: Any + self, + username: str, + email: Optional[str], + password: Optional[str], + **extra_fields: Any ) -> _T: ... def with_perm( self, @@ -67,7 +79,9 @@ class PermissionsMixin(models.Model): def get_group_permissions(self, obj: Optional[_AnyUser] = ...) -> Set[str]: ... def get_all_permissions(self, obj: Optional[_AnyUser] = ...) -> Set[str]: ... def has_perm(self, perm: str, obj: Optional[_AnyUser] = ...) -> bool: ... - def has_perms(self, perm_list: Collection[str], obj: Optional[_AnyUser] = ...) -> bool: ... + def has_perms( + self, perm_list: Collection[str], obj: Optional[_AnyUser] = ... + ) -> bool: ... def has_module_perms(self, app_label: str) -> bool: ... class AbstractUser(AbstractBaseUser, PermissionsMixin): # type: ignore @@ -85,7 +99,9 @@ class AbstractUser(AbstractBaseUser, PermissionsMixin): # type: ignore USERNAME_FIELD: str = ... def get_full_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: ... class User(AbstractUser): ... @@ -108,7 +124,9 @@ class AnonymousUser: def get_group_permissions(self, obj: Optional[_AnyUser] = ...) -> Set[Any]: ... def get_all_permissions(self, obj: Optional[_AnyUser] = ...) -> Set[str]: ... def has_perm(self, perm: str, obj: Optional[_AnyUser] = ...) -> bool: ... - def has_perms(self, perm_list: Collection[str], obj: Optional[_AnyUser] = ...) -> bool: ... + def has_perms( + self, perm_list: Collection[str], obj: Optional[_AnyUser] = ... + ) -> bool: ... def has_module_perms(self, module: str) -> bool: ... @property def is_anonymous(self) -> Literal[True]: ... diff --git a/django-stubs/contrib/auth/password_validation.pyi b/django-stubs/contrib/auth/password_validation.pyi index 95c07cda3..4d9df3b53 100644 --- a/django-stubs/contrib/auth/password_validation.pyi +++ b/django-stubs/contrib/auth/password_validation.pyi @@ -9,14 +9,22 @@ class PasswordValidator(Protocol): def password_changed(self, password: str, user: Optional[_UserModel] = ...): ... def get_default_password_validators() -> List[PasswordValidator]: ... -def get_password_validators(validator_config: Sequence[Mapping[str, Any]]) -> List[PasswordValidator]: ... +def get_password_validators( + validator_config: Sequence[Mapping[str, Any]] +) -> List[PasswordValidator]: ... def validate_password( - password: str, user: Optional[_UserModel] = ..., password_validators: Optional[Sequence[PasswordValidator]] = ... + password: str, + user: Optional[_UserModel] = ..., + password_validators: Optional[Sequence[PasswordValidator]] = ..., ) -> None: ... def password_changed( - password: str, user: Optional[_UserModel] = ..., password_validators: Optional[Sequence[PasswordValidator]] = ... + password: str, + user: Optional[_UserModel] = ..., + password_validators: Optional[Sequence[PasswordValidator]] = ..., ) -> None: ... -def password_validators_help_texts(password_validators: Optional[Sequence[PasswordValidator]] = ...) -> List[str]: ... +def password_validators_help_texts( + password_validators: Optional[Sequence[PasswordValidator]] = ..., +) -> List[str]: ... password_validators_help_text_html: Any @@ -30,7 +38,9 @@ class UserAttributeSimilarityValidator: DEFAULT_USER_ATTRIBUTES: Sequence[str] = ... user_attributes: Sequence[str] = ... max_similarity: float = ... - def __init__(self, user_attributes: Sequence[str] = ..., max_similarity: float = ...) -> None: ... + def __init__( + self, user_attributes: Sequence[str] = ..., max_similarity: float = ... + ) -> None: ... def validate(self, password: str, user: Optional[_UserModel] = ...) -> None: ... def get_help_text(self) -> str: ... diff --git a/django-stubs/contrib/auth/tokens.pyi b/django-stubs/contrib/auth/tokens.pyi index d069a6a2a..414a83530 100644 --- a/django-stubs/contrib/auth/tokens.pyi +++ b/django-stubs/contrib/auth/tokens.pyi @@ -7,8 +7,12 @@ class PasswordResetTokenGenerator: key_salt: str = ... secret: Any = ... def make_token(self, user: AbstractBaseUser) -> str: ... - def check_token(self, user: Optional[AbstractBaseUser], token: Optional[str]) -> bool: ... - def _make_token_with_timestamp(self, user: AbstractBaseUser, timestamp: int) -> str: ... + def check_token( + self, user: Optional[AbstractBaseUser], token: Optional[str] + ) -> bool: ... + def _make_token_with_timestamp( + self, user: AbstractBaseUser, timestamp: int + ) -> str: ... def _make_hash_value(self, user: AbstractBaseUser, timestamp: int) -> str: ... def _num_days(self, dt: date) -> float: ... def _today(self) -> date: ... diff --git a/django-stubs/contrib/auth/views.pyi b/django-stubs/contrib/auth/views.pyi index 04df66479..92981a0b3 100644 --- a/django-stubs/contrib/auth/views.pyi +++ b/django-stubs/contrib/auth/views.pyi @@ -26,10 +26,14 @@ class LogoutView(SuccessURLAllowedHostsMixin, TemplateView): next_page: Any = ... redirect_field_name: Any = ... extra_context: Any = ... - def post(self, request: WSGIRequest, *args: Any, **kwargs: Any) -> TemplateResponse: ... + def post( + self, request: WSGIRequest, *args: Any, **kwargs: Any + ) -> TemplateResponse: ... def get_next_page(self) -> Optional[str]: ... -def logout_then_login(request: HttpRequest, login_url: Optional[str] = ...) -> HttpResponseRedirect: ... +def logout_then_login( + request: HttpRequest, login_url: Optional[str] = ... +) -> HttpResponseRedirect: ... def redirect_to_login( next: str, login_url: Optional[str] = ..., redirect_field_name: Optional[str] = ... ) -> HttpResponseRedirect: ... diff --git a/django-stubs/contrib/contenttypes/admin.pyi b/django-stubs/contrib/contenttypes/admin.pyi index b4ca5621d..bcf3aadf5 100644 --- a/django-stubs/contrib/contenttypes/admin.pyi +++ b/django-stubs/contrib/contenttypes/admin.pyi @@ -4,8 +4,12 @@ from django.contrib.admin.options import InlineModelAdmin from django.db.models.base import Model class GenericInlineModelAdminChecks: - def _check_exclude_of_parent_model(self, obj: GenericInlineModelAdmin, parent_model: Type[Model]) -> List[Any]: ... - def _check_relation(self, obj: GenericInlineModelAdmin, parent_model: Type[Model]) -> List[Any]: ... + def _check_exclude_of_parent_model( + self, obj: GenericInlineModelAdmin, parent_model: Type[Model] + ) -> List[Any]: ... + def _check_relation( + self, obj: GenericInlineModelAdmin, parent_model: Type[Model] + ) -> List[Any]: ... class GenericInlineModelAdmin(InlineModelAdmin): template: str = ... diff --git a/django-stubs/contrib/contenttypes/checks.pyi b/django-stubs/contrib/contenttypes/checks.pyi index 71701adf6..25b27b543 100644 --- a/django-stubs/contrib/contenttypes/checks.pyi +++ b/django-stubs/contrib/contenttypes/checks.pyi @@ -2,5 +2,9 @@ from typing import Any, List, Optional, Sequence from django.apps.config import AppConfig -def check_generic_foreign_keys(app_configs: Optional[Sequence[AppConfig]] = ..., **kwargs: Any) -> List[Any]: ... -def check_model_name_lengths(app_configs: Optional[Sequence[AppConfig]] = ..., **kwargs: Any) -> List[Any]: ... +def check_generic_foreign_keys( + app_configs: Optional[Sequence[AppConfig]] = ..., **kwargs: Any +) -> List[Any]: ... +def check_model_name_lengths( + app_configs: Optional[Sequence[AppConfig]] = ..., **kwargs: Any +) -> List[Any]: ... diff --git a/django-stubs/contrib/contenttypes/fields.pyi b/django-stubs/contrib/contenttypes/fields.pyi index 9d243fd64..c2f3d5433 100644 --- a/django-stubs/contrib/contenttypes/fields.pyi +++ b/django-stubs/contrib/contenttypes/fields.pyi @@ -4,6 +4,7 @@ from django.contrib.contenttypes.models import ContentType from django.core.checks.messages import CheckMessage from django.db.models.base import Model 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.fields.related import ForeignObject from django.db.models.fields.related_descriptors import ReverseManyToOneDescriptor @@ -12,8 +13,6 @@ from django.db.models.query import QuerySet from django.db.models.query_utils import FilteredRelation, PathInfo from django.db.models.sql.where import WhereNode -from django.db.models.fields import Field, PositiveIntegerField - class GenericForeignKey(FieldCacheMixin): # django-stubs implementation only fields _pyi_private_set_type: Union[Any, Combinable] @@ -35,21 +34,34 @@ class GenericForeignKey(FieldCacheMixin): for_concrete_model: bool = ... rel: None = ... column: None = ... - def __init__(self, ct_field: str = ..., fk_field: str = ..., for_concrete_model: bool = ...) -> None: ... + def __init__( + self, ct_field: str = ..., fk_field: str = ..., for_concrete_model: bool = ... + ) -> None: ... name: Any = ... model: Any = ... - def contribute_to_class(self, cls: Type[Model], name: str, **kwargs: Any) -> None: ... - def get_filter_kwargs_for_object(self, obj: Model) -> Dict[str, Optional[ContentType]]: ... + def contribute_to_class( + self, cls: Type[Model], name: str, **kwargs: Any + ) -> None: ... + def get_filter_kwargs_for_object( + self, obj: Model + ) -> Dict[str, Optional[ContentType]]: ... def get_forward_related_filter(self, obj: Model) -> Dict[str, int]: ... def check(self, **kwargs: Any) -> List[CheckMessage]: ... def get_cache_name(self) -> str: ... def get_content_type( - self, obj: Optional[Model] = ..., id: Optional[int] = ..., using: Optional[str] = ... + self, + obj: Optional[Model] = ..., + id: Optional[int] = ..., + using: Optional[str] = ..., ) -> ContentType: ... def get_prefetch_queryset( - self, instances: Union[List[Model], QuerySet], queryset: Optional[QuerySet] = ... + self, + instances: Union[List[Model], QuerySet], + queryset: Optional[QuerySet] = ..., ) -> Tuple[List[Model], Callable, Callable, bool, str, bool]: ... - def __get__(self, instance: Optional[Model], cls: Type[Model] = ...) -> Optional[Any]: ... + def __get__( + self, instance: Optional[Model], cls: Type[Model] = ... + ) -> Optional[Any]: ... def __set__(self, instance: Model, value: Optional[Any]) -> None: ... class GenericRel(ForeignObjectRel): @@ -81,8 +93,12 @@ class GenericRelation(ForeignObject): **kwargs: Any ) -> None: ... def resolve_related_fields(self) -> List[Tuple[PositiveIntegerField, Field]]: ... - def get_path_info(self, filtered_relation: Optional[FilteredRelation] = ...) -> List[PathInfo]: ... - def get_reverse_path_info(self, filtered_relation: None = ...) -> List[PathInfo]: ... + def get_path_info( + self, filtered_relation: Optional[FilteredRelation] = ... + ) -> List[PathInfo]: ... + def get_reverse_path_info( + self, filtered_relation: None = ... + ) -> List[PathInfo]: ... def value_to_string(self, obj: Model) -> str: ... def get_content_type(self) -> ContentType: ... def get_extra_restriction( diff --git a/django-stubs/contrib/contenttypes/management/__init__.pyi b/django-stubs/contrib/contenttypes/management/__init__.pyi index 768883b38..4163cce0c 100644 --- a/django-stubs/contrib/contenttypes/management/__init__.pyi +++ b/django-stubs/contrib/contenttypes/management/__init__.pyi @@ -14,11 +14,18 @@ class RenameContentType(migrations.RunPython): old_model: Any = ... new_model: Any = ... def __init__(self, app_label: str, old_model: str, new_model: str) -> None: ... - def rename_forward(self, apps: StateApps, schema_editor: DatabaseSchemaEditor) -> None: ... - def rename_backward(self, apps: StateApps, schema_editor: DatabaseSchemaEditor) -> None: ... + def rename_forward( + self, apps: StateApps, schema_editor: DatabaseSchemaEditor + ) -> None: ... + def rename_backward( + self, apps: StateApps, schema_editor: DatabaseSchemaEditor + ) -> None: ... def inject_rename_contenttypes_operations( - plan: List[Tuple[Migration, bool]] = ..., apps: StateApps = ..., using: str = ..., **kwargs: Any + plan: List[Tuple[Migration, bool]] = ..., + apps: StateApps = ..., + using: str = ..., + **kwargs: Any ) -> None: ... def get_contenttypes_and_models( app_config: AppConfig, using: str, ContentType: Type[ContentType] diff --git a/django-stubs/contrib/contenttypes/management/commands/remove_stale_contenttypes.pyi b/django-stubs/contrib/contenttypes/management/commands/remove_stale_contenttypes.pyi index d432030e2..94452c093 100644 --- a/django-stubs/contrib/contenttypes/management/commands/remove_stale_contenttypes.pyi +++ b/django-stubs/contrib/contenttypes/management/commands/remove_stale_contenttypes.pyi @@ -1,8 +1,7 @@ from typing import Any, Dict, List -from django.db.models.deletion import Collector - from django.core.management import BaseCommand +from django.db.models.deletion import Collector class Command(BaseCommand): ... diff --git a/django-stubs/contrib/contenttypes/models.pyi b/django-stubs/contrib/contenttypes/models.pyi index e9f5e7cbf..3d725b6ee 100644 --- a/django-stubs/contrib/contenttypes/models.pyi +++ b/django-stubs/contrib/contenttypes/models.pyi @@ -6,8 +6,12 @@ from django.db.models.query import QuerySet class ContentTypeManager(models.Manager["ContentType"]): def get_by_natural_key(self, app_label: str, model: str) -> ContentType: ... - def get_for_model(self, model: Union[Type[Model], Model], for_concrete_model: bool = ...) -> ContentType: ... - def get_for_models(self, *models: Any, for_concrete_models: bool = ...) -> Dict[Type[Model], ContentType]: ... + def get_for_model( + self, model: Union[Type[Model], Model], for_concrete_model: bool = ... + ) -> ContentType: ... + def get_for_models( + self, *models: Any, for_concrete_models: bool = ... + ) -> Dict[Type[Model], ContentType]: ... def get_for_id(self, id: int) -> ContentType: ... def clear_cache(self) -> None: ... diff --git a/django-stubs/contrib/flatpages/admin.pyi b/django-stubs/contrib/flatpages/admin.pyi index 45542526e..a11f296dd 100644 --- a/django-stubs/contrib/flatpages/admin.pyi +++ b/django-stubs/contrib/flatpages/admin.pyi @@ -1,6 +1,7 @@ -from django.contrib import admin as admin from typing import Any +from django.contrib import admin as admin + class FlatPageAdmin(admin.ModelAdmin): form: Any = ... fieldsets: Any = ... diff --git a/django-stubs/contrib/flatpages/apps.pyi b/django-stubs/contrib/flatpages/apps.pyi index b195cbdf9..e3cd708bf 100644 --- a/django-stubs/contrib/flatpages/apps.pyi +++ b/django-stubs/contrib/flatpages/apps.pyi @@ -1,6 +1,7 @@ -from django.apps import AppConfig as AppConfig from typing import Any +from django.apps import AppConfig as AppConfig + class FlatPagesConfig(AppConfig): name: str = ... verbose_name: Any = ... diff --git a/django-stubs/contrib/flatpages/middleware.pyi b/django-stubs/contrib/flatpages/middleware.pyi index abb18f24b..82d247d76 100644 --- a/django-stubs/contrib/flatpages/middleware.pyi +++ b/django-stubs/contrib/flatpages/middleware.pyi @@ -3,4 +3,6 @@ from django.http.response import HttpResponse from django.utils.deprecation import MiddlewareMixin class FlatpageFallbackMiddleware(MiddlewareMixin): - def process_response(self, request: WSGIRequest, response: HttpResponse) -> HttpResponse: ... + def process_response( + self, request: WSGIRequest, response: HttpResponse + ) -> HttpResponse: ... diff --git a/django-stubs/contrib/flatpages/models.pyi b/django-stubs/contrib/flatpages/models.pyi index 330f3c770..d44cc9a63 100644 --- a/django-stubs/contrib/flatpages/models.pyi +++ b/django-stubs/contrib/flatpages/models.pyi @@ -1,5 +1,4 @@ from django.contrib.sites.models import Site - from django.db import models class FlatPage(models.Model): diff --git a/django-stubs/contrib/flatpages/templatetags/flatpages.pyi b/django-stubs/contrib/flatpages/templatetags/flatpages.pyi index e9be47e88..46476990b 100644 --- a/django-stubs/contrib/flatpages/templatetags/flatpages.pyi +++ b/django-stubs/contrib/flatpages/templatetags/flatpages.pyi @@ -10,7 +10,12 @@ class FlatpageNode(template.Node): context_name: str = ... starts_with: None = ... user: None = ... - def __init__(self, context_name: str, starts_with: Optional[str] = ..., user: Optional[str] = ...) -> None: ... + def __init__( + self, + context_name: str, + starts_with: Optional[str] = ..., + user: Optional[str] = ..., + ) -> None: ... def render(self, context: Context) -> str: ... def get_flatpages(parser: Parser, token: Token) -> FlatpageNode: ... diff --git a/django-stubs/contrib/gis/admin/__init__.pyi b/django-stubs/contrib/gis/admin/__init__.pyi index 352c8479d..a9b32c9ea 100644 --- a/django-stubs/contrib/gis/admin/__init__.pyi +++ b/django-stubs/contrib/gis/admin/__init__.pyi @@ -1,12 +1,11 @@ -from django.contrib.admin import ( - AdminSite as AdminSite, - HORIZONTAL as HORIZONTAL, - ModelAdmin as ModelAdmin, - StackedInline as StackedInline, - TabularInline as TabularInline, - VERTICAL as VERTICAL, - autodiscover as autodiscover, - register as register, - site as site, -) -from django.contrib.gis.admin.options import GeoModelAdmin as GeoModelAdmin, OSMGeoAdmin as OSMGeoAdmin +from django.contrib.admin import HORIZONTAL as HORIZONTAL +from django.contrib.admin import VERTICAL as VERTICAL +from django.contrib.admin import AdminSite as AdminSite +from django.contrib.admin import ModelAdmin as ModelAdmin +from django.contrib.admin import StackedInline as StackedInline +from django.contrib.admin import TabularInline as TabularInline +from django.contrib.admin import autodiscover as autodiscover +from django.contrib.admin import register as register +from django.contrib.admin import site as site +from django.contrib.gis.admin.options import GeoModelAdmin as GeoModelAdmin +from django.contrib.gis.admin.options import OSMGeoAdmin as OSMGeoAdmin diff --git a/django-stubs/contrib/gis/admin/options.pyi b/django-stubs/contrib/gis/admin/options.pyi index 915e22073..8e06ffe9a 100644 --- a/django-stubs/contrib/gis/admin/options.pyi +++ b/django-stubs/contrib/gis/admin/options.pyi @@ -1,6 +1,7 @@ -from django.contrib.admin import ModelAdmin as ModelAdmin from typing import Any +from django.contrib.admin import ModelAdmin as ModelAdmin + spherical_mercator_srid: int class GeoModelAdmin(ModelAdmin): diff --git a/django-stubs/contrib/gis/admin/widgets.pyi b/django-stubs/contrib/gis/admin/widgets.pyi index 0e39eeadb..a1b3888f3 100644 --- a/django-stubs/contrib/gis/admin/widgets.pyi +++ b/django-stubs/contrib/gis/admin/widgets.pyi @@ -1,6 +1,7 @@ -from django.forms.widgets import Textarea as Textarea from typing import Any +from django.forms.widgets import Textarea as Textarea + geo_context: Any logger: Any diff --git a/django-stubs/contrib/gis/apps.pyi b/django-stubs/contrib/gis/apps.pyi index 12b629140..04ebc989a 100644 --- a/django-stubs/contrib/gis/apps.pyi +++ b/django-stubs/contrib/gis/apps.pyi @@ -1,6 +1,7 @@ -from django.apps import AppConfig as AppConfig from typing import Any +from django.apps import AppConfig as AppConfig + class GISConfig(AppConfig): name: str = ... verbose_name: Any = ... diff --git a/django-stubs/contrib/gis/db/backends/mysql/base.pyi b/django-stubs/contrib/gis/db/backends/mysql/base.pyi index 9b8df9822..0bbd97a18 100644 --- a/django-stubs/contrib/gis/db/backends/mysql/base.pyi +++ b/django-stubs/contrib/gis/db/backends/mysql/base.pyi @@ -1,6 +1,7 @@ -from django.db.backends.mysql.base import DatabaseWrapper as MySQLDatabaseWrapper from typing import Any +from django.db.backends.mysql.base import DatabaseWrapper as MySQLDatabaseWrapper + class DatabaseWrapper(MySQLDatabaseWrapper): SchemaEditorClass: Any = ... features_class: Any = ... diff --git a/django-stubs/contrib/gis/db/backends/mysql/features.pyi b/django-stubs/contrib/gis/db/backends/mysql/features.pyi index 0ff149a01..f1f18b0ff 100644 --- a/django-stubs/contrib/gis/db/backends/mysql/features.pyi +++ b/django-stubs/contrib/gis/db/backends/mysql/features.pyi @@ -1,4 +1,6 @@ -from django.contrib.gis.db.backends.base.features import BaseSpatialFeatures as BaseSpatialFeatures +from django.contrib.gis.db.backends.base.features import ( + BaseSpatialFeatures as BaseSpatialFeatures, +) from django.db.backends.mysql.features import DatabaseFeatures as MySQLDatabaseFeatures class DatabaseFeatures(BaseSpatialFeatures, MySQLDatabaseFeatures): diff --git a/django-stubs/contrib/gis/db/backends/mysql/introspection.pyi b/django-stubs/contrib/gis/db/backends/mysql/introspection.pyi index a50e151cc..df26da5ee 100644 --- a/django-stubs/contrib/gis/db/backends/mysql/introspection.pyi +++ b/django-stubs/contrib/gis/db/backends/mysql/introspection.pyi @@ -1,6 +1,9 @@ -from django.db.backends.mysql.introspection import DatabaseIntrospection as DatabaseIntrospection from typing import Any +from django.db.backends.mysql.introspection import ( + DatabaseIntrospection as DatabaseIntrospection, +) + class MySQLIntrospection(DatabaseIntrospection): data_types_reverse: Any = ... def get_geometry_type(self, table_name: Any, description: Any): ... diff --git a/django-stubs/contrib/gis/db/backends/mysql/operations.pyi b/django-stubs/contrib/gis/db/backends/mysql/operations.pyi index 45e732340..a06f8e8af 100644 --- a/django-stubs/contrib/gis/db/backends/mysql/operations.pyi +++ b/django-stubs/contrib/gis/db/backends/mysql/operations.pyi @@ -1,7 +1,10 @@ -from django.contrib.gis.db.backends.base.operations import BaseSpatialOperations as BaseSpatialOperations -from django.db.backends.mysql.operations import DatabaseOperations as DatabaseOperations from typing import Any +from django.contrib.gis.db.backends.base.operations import ( + BaseSpatialOperations as BaseSpatialOperations, +) +from django.db.backends.mysql.operations import DatabaseOperations as DatabaseOperations + class MySQLOperations(BaseSpatialOperations, DatabaseOperations): mysql: bool = ... name: str = ... diff --git a/django-stubs/contrib/gis/db/backends/mysql/schema.pyi b/django-stubs/contrib/gis/db/backends/mysql/schema.pyi index 49a53487f..6cc782f27 100644 --- a/django-stubs/contrib/gis/db/backends/mysql/schema.pyi +++ b/django-stubs/contrib/gis/db/backends/mysql/schema.pyi @@ -1,6 +1,7 @@ -from django.db.backends.mysql.schema import DatabaseSchemaEditor as DatabaseSchemaEditor from typing import Any +from django.db.backends.mysql.schema import DatabaseSchemaEditor as DatabaseSchemaEditor + logger: Any class MySQLGISSchemaEditor(DatabaseSchemaEditor): diff --git a/django-stubs/contrib/gis/db/backends/oracle/adapter.pyi b/django-stubs/contrib/gis/db/backends/oracle/adapter.pyi index f358f3ccf..86ebca7b6 100644 --- a/django-stubs/contrib/gis/db/backends/oracle/adapter.pyi +++ b/django-stubs/contrib/gis/db/backends/oracle/adapter.pyi @@ -1,6 +1,7 @@ -from django.contrib.gis.db.backends.base.adapter import WKTAdapter from typing import Any +from django.contrib.gis.db.backends.base.adapter import WKTAdapter + class OracleSpatialAdapter(WKTAdapter): input_size: Any = ... wkt: Any = ... diff --git a/django-stubs/contrib/gis/db/backends/oracle/base.pyi b/django-stubs/contrib/gis/db/backends/oracle/base.pyi index d0048b3d5..cc1e35428 100644 --- a/django-stubs/contrib/gis/db/backends/oracle/base.pyi +++ b/django-stubs/contrib/gis/db/backends/oracle/base.pyi @@ -1,6 +1,7 @@ -from django.db.backends.oracle.base import DatabaseWrapper as OracleDatabaseWrapper from typing import Any +from django.db.backends.oracle.base import DatabaseWrapper as OracleDatabaseWrapper + class DatabaseWrapper(OracleDatabaseWrapper): SchemaEditorClass: Any = ... features_class: Any = ... diff --git a/django-stubs/contrib/gis/db/backends/oracle/features.pyi b/django-stubs/contrib/gis/db/backends/oracle/features.pyi index 4e290c11d..9230ce80e 100644 --- a/django-stubs/contrib/gis/db/backends/oracle/features.pyi +++ b/django-stubs/contrib/gis/db/backends/oracle/features.pyi @@ -1,5 +1,9 @@ -from django.contrib.gis.db.backends.base.features import BaseSpatialFeatures as BaseSpatialFeatures -from django.db.backends.oracle.features import DatabaseFeatures as OracleDatabaseFeatures +from django.contrib.gis.db.backends.base.features import ( + BaseSpatialFeatures as BaseSpatialFeatures, +) +from django.db.backends.oracle.features import ( + DatabaseFeatures as OracleDatabaseFeatures, +) class DatabaseFeatures(BaseSpatialFeatures, OracleDatabaseFeatures): supports_add_srs_entry: bool = ... diff --git a/django-stubs/contrib/gis/db/backends/oracle/introspection.pyi b/django-stubs/contrib/gis/db/backends/oracle/introspection.pyi index 389ba05ad..bf1cec30f 100644 --- a/django-stubs/contrib/gis/db/backends/oracle/introspection.pyi +++ b/django-stubs/contrib/gis/db/backends/oracle/introspection.pyi @@ -1,6 +1,9 @@ -from django.db.backends.oracle.introspection import DatabaseIntrospection as DatabaseIntrospection from typing import Any +from django.db.backends.oracle.introspection import ( + DatabaseIntrospection as DatabaseIntrospection, +) + class OracleIntrospection(DatabaseIntrospection): def data_types_reverse(self): ... def get_geometry_type(self, table_name: Any, description: Any): ... diff --git a/django-stubs/contrib/gis/db/backends/oracle/models.pyi b/django-stubs/contrib/gis/db/backends/oracle/models.pyi index 8949b3b26..2190df7c3 100644 --- a/django-stubs/contrib/gis/db/backends/oracle/models.pyi +++ b/django-stubs/contrib/gis/db/backends/oracle/models.pyi @@ -1,7 +1,10 @@ -from django.contrib.gis.db import models as models -from django.contrib.gis.db.backends.base.models import SpatialRefSysMixin as SpatialRefSysMixin from typing import Any +from django.contrib.gis.db import models as models +from django.contrib.gis.db.backends.base.models import ( + SpatialRefSysMixin as SpatialRefSysMixin, +) + class OracleGeometryColumns(models.Model): table_name: Any = ... column_name: Any = ... diff --git a/django-stubs/contrib/gis/db/backends/oracle/operations.pyi b/django-stubs/contrib/gis/db/backends/oracle/operations.pyi index 68962308b..b52e14325 100644 --- a/django-stubs/contrib/gis/db/backends/oracle/operations.pyi +++ b/django-stubs/contrib/gis/db/backends/oracle/operations.pyi @@ -1,8 +1,13 @@ -from django.contrib.gis.db.backends.base.operations import BaseSpatialOperations as BaseSpatialOperations -from django.contrib.gis.db.backends.utils import SpatialOperator as SpatialOperator -from django.db.backends.oracle.operations import DatabaseOperations as DatabaseOperations from typing import Any +from django.contrib.gis.db.backends.base.operations import ( + BaseSpatialOperations as BaseSpatialOperations, +) +from django.contrib.gis.db.backends.utils import SpatialOperator as SpatialOperator +from django.db.backends.oracle.operations import ( + DatabaseOperations as DatabaseOperations, +) + DEFAULT_TOLERANCE: str class SDOOperator(SpatialOperator): @@ -17,7 +22,9 @@ class SDODisjoint(SpatialOperator): class SDORelate(SpatialOperator): sql_template: str = ... def check_relate_argument(self, arg: Any) -> None: ... - def as_sql(self, connection: Any, lookup: Any, template_params: Any, sql_params: Any): ... + def as_sql( + self, connection: Any, lookup: Any, template_params: Any, sql_params: Any + ): ... class OracleOperations(BaseSpatialOperations, DatabaseOperations): name: str = ... diff --git a/django-stubs/contrib/gis/db/backends/oracle/schema.pyi b/django-stubs/contrib/gis/db/backends/oracle/schema.pyi index dceb88aa2..d333685ac 100644 --- a/django-stubs/contrib/gis/db/backends/oracle/schema.pyi +++ b/django-stubs/contrib/gis/db/backends/oracle/schema.pyi @@ -1,6 +1,7 @@ -from django.db.backends.oracle.schema import DatabaseSchemaEditor from typing import Any +from django.db.backends.oracle.schema import DatabaseSchemaEditor + class OracleGISSchemaEditor(DatabaseSchemaEditor): sql_add_geometry_metadata: str = ... sql_add_spatial_index: str = ... diff --git a/django-stubs/contrib/gis/db/backends/postgis/base.pyi b/django-stubs/contrib/gis/db/backends/postgis/base.pyi index 0af86704d..e8cf9ad92 100644 --- a/django-stubs/contrib/gis/db/backends/postgis/base.pyi +++ b/django-stubs/contrib/gis/db/backends/postgis/base.pyi @@ -1,6 +1,9 @@ -from django.db.backends.postgresql.base import DatabaseWrapper as Psycopg2DatabaseWrapper from typing import Any +from django.db.backends.postgresql.base import ( + DatabaseWrapper as Psycopg2DatabaseWrapper, +) + class DatabaseWrapper(Psycopg2DatabaseWrapper): SchemaEditorClass: Any = ... features: Any = ... diff --git a/django-stubs/contrib/gis/db/backends/postgis/features.pyi b/django-stubs/contrib/gis/db/backends/postgis/features.pyi index 0daef2259..d17742dd1 100644 --- a/django-stubs/contrib/gis/db/backends/postgis/features.pyi +++ b/django-stubs/contrib/gis/db/backends/postgis/features.pyi @@ -1,5 +1,9 @@ -from django.contrib.gis.db.backends.base.features import BaseSpatialFeatures as BaseSpatialFeatures -from django.db.backends.postgresql.features import DatabaseFeatures as Psycopg2DatabaseFeatures +from django.contrib.gis.db.backends.base.features import ( + BaseSpatialFeatures as BaseSpatialFeatures, +) +from django.db.backends.postgresql.features import ( + DatabaseFeatures as Psycopg2DatabaseFeatures, +) class DatabaseFeatures(BaseSpatialFeatures, Psycopg2DatabaseFeatures): supports_3d_storage: bool = ... diff --git a/django-stubs/contrib/gis/db/backends/postgis/introspection.pyi b/django-stubs/contrib/gis/db/backends/postgis/introspection.pyi index 17880c8e7..635efae5e 100644 --- a/django-stubs/contrib/gis/db/backends/postgis/introspection.pyi +++ b/django-stubs/contrib/gis/db/backends/postgis/introspection.pyi @@ -1,6 +1,9 @@ -from django.db.backends.postgresql.introspection import DatabaseIntrospection as DatabaseIntrospection from typing import Any +from django.db.backends.postgresql.introspection import ( + DatabaseIntrospection as DatabaseIntrospection, +) + class PostGISIntrospection(DatabaseIntrospection): postgis_oid_lookup: Any = ... ignored_tables: Any = ... diff --git a/django-stubs/contrib/gis/db/backends/postgis/models.pyi b/django-stubs/contrib/gis/db/backends/postgis/models.pyi index 6bcfed08f..1a3c29e4c 100644 --- a/django-stubs/contrib/gis/db/backends/postgis/models.pyi +++ b/django-stubs/contrib/gis/db/backends/postgis/models.pyi @@ -1,7 +1,10 @@ -from django.contrib.gis.db.backends.base.models import SpatialRefSysMixin as SpatialRefSysMixin -from django.db import models as models from typing import Any +from django.contrib.gis.db.backends.base.models import ( + SpatialRefSysMixin as SpatialRefSysMixin, +) +from django.db import models as models + class PostGISGeometryColumns(models.Model): f_table_catalog: Any = ... f_table_schema: Any = ... diff --git a/django-stubs/contrib/gis/db/backends/postgis/operations.pyi b/django-stubs/contrib/gis/db/backends/postgis/operations.pyi index a7ec504c8..429d2aa51 100644 --- a/django-stubs/contrib/gis/db/backends/postgis/operations.pyi +++ b/django-stubs/contrib/gis/db/backends/postgis/operations.pyi @@ -1,16 +1,21 @@ +from typing import Any + from django.contrib.gis.db.backends.base.operations import BaseSpatialOperations from django.contrib.gis.db.backends.utils import SpatialOperator from django.db.backends.postgresql.operations import DatabaseOperations from django.db.models import Func -from typing import Any BILATERAL: str class PostGISOperator(SpatialOperator): geography: Any = ... raster: Any = ... - def __init__(self, geography: bool = ..., raster: bool = ..., **kwargs: Any) -> None: ... - def as_sql(self, connection: Any, lookup: Any, template_params: Any, *args: Any): ... + def __init__( + self, geography: bool = ..., raster: bool = ..., **kwargs: Any + ) -> None: ... + def as_sql( + self, connection: Any, lookup: Any, template_params: Any, *args: Any + ): ... def check_raster(self, lookup: Any, template_params: Any): ... class ST_Polygon(Func): diff --git a/django-stubs/contrib/gis/db/backends/postgis/schema.pyi b/django-stubs/contrib/gis/db/backends/postgis/schema.pyi index 909f09bb6..58cdb9851 100644 --- a/django-stubs/contrib/gis/db/backends/postgis/schema.pyi +++ b/django-stubs/contrib/gis/db/backends/postgis/schema.pyi @@ -1,6 +1,7 @@ -from django.db.backends.postgresql.schema import DatabaseSchemaEditor from typing import Any +from django.db.backends.postgresql.schema import DatabaseSchemaEditor + class PostGISSchemaEditor(DatabaseSchemaEditor): geom_index_type: str = ... geom_index_ops_nd: str = ... diff --git a/django-stubs/contrib/gis/db/backends/spatialite/adapter.pyi b/django-stubs/contrib/gis/db/backends/spatialite/adapter.pyi index ccffaaf6b..840530620 100644 --- a/django-stubs/contrib/gis/db/backends/spatialite/adapter.pyi +++ b/django-stubs/contrib/gis/db/backends/spatialite/adapter.pyi @@ -1,5 +1,6 @@ -from django.contrib.gis.db.backends.base.adapter import WKTAdapter as WKTAdapter from typing import Any +from django.contrib.gis.db.backends.base.adapter import WKTAdapter as WKTAdapter + class SpatiaLiteAdapter(WKTAdapter): def __conform__(self, protocol: Any): ... diff --git a/django-stubs/contrib/gis/db/backends/spatialite/base.pyi b/django-stubs/contrib/gis/db/backends/spatialite/base.pyi index edbcf6781..6f13c4d28 100644 --- a/django-stubs/contrib/gis/db/backends/spatialite/base.pyi +++ b/django-stubs/contrib/gis/db/backends/spatialite/base.pyi @@ -1,6 +1,7 @@ -from django.db.backends.sqlite3.base import DatabaseWrapper as SQLiteDatabaseWrapper from typing import Any +from django.db.backends.sqlite3.base import DatabaseWrapper as SQLiteDatabaseWrapper + class DatabaseWrapper(SQLiteDatabaseWrapper): SchemaEditorClass: Any = ... client_class: Any = ... diff --git a/django-stubs/contrib/gis/db/backends/spatialite/features.pyi b/django-stubs/contrib/gis/db/backends/spatialite/features.pyi index 40d6449e8..7c3b93cf9 100644 --- a/django-stubs/contrib/gis/db/backends/spatialite/features.pyi +++ b/django-stubs/contrib/gis/db/backends/spatialite/features.pyi @@ -1,5 +1,9 @@ -from django.contrib.gis.db.backends.base.features import BaseSpatialFeatures as BaseSpatialFeatures -from django.db.backends.sqlite3.features import DatabaseFeatures as SQLiteDatabaseFeatures +from django.contrib.gis.db.backends.base.features import ( + BaseSpatialFeatures as BaseSpatialFeatures, +) +from django.db.backends.sqlite3.features import ( + DatabaseFeatures as SQLiteDatabaseFeatures, +) class DatabaseFeatures(BaseSpatialFeatures, SQLiteDatabaseFeatures): supports_3d_storage: bool = ... diff --git a/django-stubs/contrib/gis/db/backends/spatialite/introspection.pyi b/django-stubs/contrib/gis/db/backends/spatialite/introspection.pyi index 298a6a1e0..5b94040b5 100644 --- a/django-stubs/contrib/gis/db/backends/spatialite/introspection.pyi +++ b/django-stubs/contrib/gis/db/backends/spatialite/introspection.pyi @@ -1,8 +1,11 @@ +from typing import Any + from django.db.backends.sqlite3.introspection import ( DatabaseIntrospection as DatabaseIntrospection, +) +from django.db.backends.sqlite3.introspection import ( FlexibleFieldLookupDict as FlexibleFieldLookupDict, ) -from typing import Any class GeoFlexibleFieldLookupDict(FlexibleFieldLookupDict): base_data_types_reverse: Any = ... diff --git a/django-stubs/contrib/gis/db/backends/spatialite/models.pyi b/django-stubs/contrib/gis/db/backends/spatialite/models.pyi index df16ae93e..09d35d9a4 100644 --- a/django-stubs/contrib/gis/db/backends/spatialite/models.pyi +++ b/django-stubs/contrib/gis/db/backends/spatialite/models.pyi @@ -1,7 +1,10 @@ -from django.contrib.gis.db.backends.base.models import SpatialRefSysMixin as SpatialRefSysMixin -from django.db import models as models from typing import Any +from django.contrib.gis.db.backends.base.models import ( + SpatialRefSysMixin as SpatialRefSysMixin, +) +from django.db import models as models + class SpatialiteGeometryColumns(models.Model): f_table_name: Any = ... f_geometry_column: Any = ... diff --git a/django-stubs/contrib/gis/db/backends/spatialite/operations.pyi b/django-stubs/contrib/gis/db/backends/spatialite/operations.pyi index 4141b9703..67d02ad37 100644 --- a/django-stubs/contrib/gis/db/backends/spatialite/operations.pyi +++ b/django-stubs/contrib/gis/db/backends/spatialite/operations.pyi @@ -1,10 +1,13 @@ +from typing import Any + from django.contrib.gis.db.backends.base.operations import BaseSpatialOperations from django.contrib.gis.db.backends.utils import SpatialOperator as SpatialOperator from django.db.backends.sqlite3.operations import DatabaseOperations -from typing import Any class SpatialiteNullCheckOperator(SpatialOperator): - def as_sql(self, connection: Any, lookup: Any, template_params: Any, sql_params: Any): ... + def as_sql( + self, connection: Any, lookup: Any, template_params: Any, sql_params: Any + ): ... class SpatiaLiteOperations(BaseSpatialOperations, DatabaseOperations): name: str = ... diff --git a/django-stubs/contrib/gis/db/backends/spatialite/schema.pyi b/django-stubs/contrib/gis/db/backends/spatialite/schema.pyi index a4e81d4ac..983af7a3e 100644 --- a/django-stubs/contrib/gis/db/backends/spatialite/schema.pyi +++ b/django-stubs/contrib/gis/db/backends/spatialite/schema.pyi @@ -1,6 +1,9 @@ -from django.db.backends.sqlite3.schema import DatabaseSchemaEditor as DatabaseSchemaEditor from typing import Any +from django.db.backends.sqlite3.schema import ( + DatabaseSchemaEditor as DatabaseSchemaEditor, +) + class SpatialiteSchemaEditor(DatabaseSchemaEditor): sql_add_geometry_column: str = ... sql_add_spatial_index: str = ... @@ -20,5 +23,9 @@ class SpatialiteSchemaEditor(DatabaseSchemaEditor): def add_field(self, model: Any, field: Any) -> None: ... def remove_field(self, model: Any, field: Any) -> None: ... def alter_db_table( - self, model: Any, old_db_table: Any, new_db_table: Any, disable_constraints: bool = ... + self, + model: Any, + old_db_table: Any, + new_db_table: Any, + disable_constraints: bool = ..., ) -> None: ... diff --git a/django-stubs/contrib/gis/db/backends/utils.pyi b/django-stubs/contrib/gis/db/backends/utils.pyi index aeda8cef6..41a78fd94 100644 --- a/django-stubs/contrib/gis/db/backends/utils.pyi +++ b/django-stubs/contrib/gis/db/backends/utils.pyi @@ -7,4 +7,6 @@ class SpatialOperator: def __init__(self, op: Optional[Any] = ..., func: Optional[Any] = ...) -> None: ... @property def default_template(self): ... - def as_sql(self, connection: Any, lookup: Any, template_params: Any, sql_params: Any): ... + def as_sql( + self, connection: Any, lookup: Any, template_params: Any, sql_params: Any + ): ... diff --git a/django-stubs/contrib/gis/db/models/__init__.pyi b/django-stubs/contrib/gis/db/models/__init__.pyi index 0966cdac6..3c4937695 100644 --- a/django-stubs/contrib/gis/db/models/__init__.pyi +++ b/django-stubs/contrib/gis/db/models/__init__.pyi @@ -1,14 +1,16 @@ # noqa: F401 -from django.db.models import * from django.contrib.gis.db.models.aggregates import * from django.contrib.gis.db.models.fields import ( GeometryCollectionField as GeometryCollectionField, - GeometryField as GeometryField, - LineStringField as LineStringField, +) +from django.contrib.gis.db.models.fields import GeometryField as GeometryField +from django.contrib.gis.db.models.fields import LineStringField as LineStringField +from django.contrib.gis.db.models.fields import ( MultiLineStringField as MultiLineStringField, - MultiPointField as MultiPointField, - MultiPolygonField as MultiPolygonField, - PointField as PointField, - PolygonField as PolygonField, - RasterField as RasterField, ) +from django.contrib.gis.db.models.fields import MultiPointField as MultiPointField +from django.contrib.gis.db.models.fields import MultiPolygonField as MultiPolygonField +from django.contrib.gis.db.models.fields import PointField as PointField +from django.contrib.gis.db.models.fields import PolygonField as PolygonField +from django.contrib.gis.db.models.fields import RasterField as RasterField +from django.db.models import * diff --git a/django-stubs/contrib/gis/db/models/aggregates.pyi b/django-stubs/contrib/gis/db/models/aggregates.pyi index 97524f7d5..f2feb5b8a 100644 --- a/django-stubs/contrib/gis/db/models/aggregates.pyi +++ b/django-stubs/contrib/gis/db/models/aggregates.pyi @@ -1,11 +1,18 @@ -from django.db.models import Aggregate from typing import Any, Optional +from django.db.models import Aggregate + class GeoAggregate(Aggregate): function: Any = ... is_extent: bool = ... def output_field(self): ... - def as_sql(self, compiler: Any, connection: Any, function: Optional[Any] = ..., **extra_context: Any): ... + def as_sql( + self, + compiler: Any, + connection: Any, + function: Optional[Any] = ..., + **extra_context: Any + ): ... def as_oracle(self, compiler: Any, connection: Any, **extra_context: Any): ... def resolve_expression( self, diff --git a/django-stubs/contrib/gis/db/models/fields.pyi b/django-stubs/contrib/gis/db/models/fields.pyi index e7199ae4e..f78577bcb 100644 --- a/django-stubs/contrib/gis/db/models/fields.pyi +++ b/django-stubs/contrib/gis/db/models/fields.pyi @@ -1,5 +1,11 @@ -from typing import Any, Iterable, NamedTuple, Optional, TypeVar, Union, Tuple -from django.db.models.fields import Field, _ErrorMessagesToOverride, _FieldChoices, _ValidatorCallable +from typing import Any, Iterable, NamedTuple, Optional, Tuple, TypeVar, Union + +from django.db.models.fields import ( + Field, + _ErrorMessagesToOverride, + _FieldChoices, + _ValidatorCallable, +) # __set__ value type _ST = TypeVar("_ST") @@ -49,7 +55,9 @@ class BaseSpatialField(Field[_ST, _GT]): def geodetic(self, connection: Any): ... def get_placeholder(self, value: Any, compiler: Any, connection: Any): ... def get_srid(self, obj: Any): ... - def get_db_prep_value(self, value: Any, connection: Any, *args: Any, **kwargs: Any): ... + def get_db_prep_value( + self, value: Any, connection: Any, *args: Any, **kwargs: Any + ): ... def get_raster_prep_value(self, value: Any, is_candidate: Any): ... def get_prep_value(self, value: Any): ... diff --git a/django-stubs/contrib/gis/db/models/functions.pyi b/django-stubs/contrib/gis/db/models/functions.pyi index 8d0b840d0..1e764fca3 100644 --- a/django-stubs/contrib/gis/db/models/functions.pyi +++ b/django-stubs/contrib/gis/db/models/functions.pyi @@ -1,6 +1,8 @@ -from django.db.models import Func, Transform as StandardTransform from typing import Any, Optional +from django.db.models import Func +from django.db.models import Transform as StandardTransform + NUMERIC_TYPES: Any class GeoFuncMixin: @@ -8,7 +10,13 @@ class GeoFuncMixin: geom_param_pos: Any = ... def __init__(self, *expressions: Any, **extra: Any) -> None: ... def geo_field(self): ... - def as_sql(self, compiler: Any, connection: Any, function: Optional[Any] = ..., **extra_context: Any): ... + def as_sql( + self, + compiler: Any, + connection: Any, + function: Optional[Any] = ..., + **extra_context: Any + ): ... def resolve_expression(self, *args: Any, **kwargs: Any): ... class GeoFunc(GeoFuncMixin, Func): ... @@ -36,14 +44,21 @@ class Azimuth(GeoFunc): class AsGeoJSON(GeoFunc): output_field: Any = ... def __init__( - self, expression: Any, bbox: bool = ..., crs: bool = ..., precision: int = ..., **extra: Any + self, + expression: Any, + bbox: bool = ..., + crs: bool = ..., + precision: int = ..., + **extra: Any ) -> None: ... def as_oracle(self, compiler: Any, connection: Any, **extra_context: Any): ... class AsGML(GeoFunc): geom_param_pos: Any = ... output_field: Any = ... - def __init__(self, expression: Any, version: int = ..., precision: int = ..., **extra: Any) -> None: ... + def __init__( + self, expression: Any, version: int = ..., precision: int = ..., **extra: Any + ) -> None: ... def as_oracle(self, compiler: Any, connection: Any, **extra_context: Any): ... class AsKML(GeoFunc): @@ -52,7 +67,9 @@ class AsKML(GeoFunc): class AsSVG(GeoFunc): output_field: Any = ... - def __init__(self, expression: Any, relative: bool = ..., precision: int = ..., **extra: Any) -> None: ... + def __init__( + self, expression: Any, relative: bool = ..., precision: int = ..., **extra: Any + ) -> None: ... class AsWKB(GeoFunc): output_field: Any = ... @@ -80,7 +97,9 @@ class DistanceResultMixin: class Distance(DistanceResultMixin, OracleToleranceMixin, GeoFunc): geom_param_pos: Any = ... spheroid: Any = ... - def __init__(self, expr1: Any, expr2: Any, spheroid: Optional[Any] = ..., **extra: Any) -> None: ... + def __init__( + self, expr1: Any, expr2: Any, spheroid: Optional[Any] = ..., **extra: Any + ) -> None: ... def as_postgresql(self, compiler: Any, connection: Any, **extra_context: Any): ... def as_sqlite(self, compiler: Any, connection: Any, **extra_context: Any): ... @@ -92,7 +111,9 @@ class ForcePolygonCW(GeomOutputGeoFunc): class GeoHash(GeoFunc): output_field: Any = ... - def __init__(self, expression: Any, precision: Optional[Any] = ..., **extra: Any) -> None: ... + def __init__( + self, expression: Any, precision: Optional[Any] = ..., **extra: Any + ) -> None: ... def as_mysql(self, compiler: Any, connection: Any, **extra_context: Any): ... class GeometryDistance(GeoFunc): @@ -148,7 +169,9 @@ class Reverse(GeoFunc): arity: int = ... class Scale(SQLiteDecimalToFloatMixin, GeomOutputGeoFunc): - def __init__(self, expression: Any, x: Any, y: Any, z: float = ..., **extra: Any) -> None: ... + def __init__( + self, expression: Any, x: Any, y: Any, z: float = ..., **extra: Any + ) -> None: ... class SnapToGrid(SQLiteDecimalToFloatMixin, GeomOutputGeoFunc): def __init__(self, expression: Any, *args: Any, **extra: Any) -> None: ... diff --git a/django-stubs/contrib/gis/db/models/lookups.pyi b/django-stubs/contrib/gis/db/models/lookups.pyi index 7961019c0..02794235f 100644 --- a/django-stubs/contrib/gis/db/models/lookups.pyi +++ b/django-stubs/contrib/gis/db/models/lookups.pyi @@ -1,6 +1,7 @@ -from django.db.models import Lookup, Transform from typing import Any +from django.db.models import Lookup, Transform + class RasterBandTransform(Transform): ... class GISLookup(Lookup): diff --git a/django-stubs/contrib/gis/db/models/proxy.pyi b/django-stubs/contrib/gis/db/models/proxy.pyi index 384d3c7d3..56ecd21a9 100644 --- a/django-stubs/contrib/gis/db/models/proxy.pyi +++ b/django-stubs/contrib/gis/db/models/proxy.pyi @@ -1,7 +1,10 @@ -from django.db.models.query_utils import DeferredAttribute from typing import Any, Optional +from django.db.models.query_utils import DeferredAttribute + class SpatialProxy(DeferredAttribute): - def __init__(self, klass: Any, field: Any, load_func: Optional[Any] = ...) -> None: ... + def __init__( + self, klass: Any, field: Any, load_func: Optional[Any] = ... + ) -> None: ... def __get__(self, instance: Any, cls: Optional[Any] = ...): ... def __set__(self, instance: Any, value: Any): ... diff --git a/django-stubs/contrib/gis/db/models/sql/conversion.pyi b/django-stubs/contrib/gis/db/models/sql/conversion.pyi index 4b612a23d..87b4c6cd4 100644 --- a/django-stubs/contrib/gis/db/models/sql/conversion.pyi +++ b/django-stubs/contrib/gis/db/models/sql/conversion.pyi @@ -1,6 +1,7 @@ -from django.db import models as models from typing import Any +from django.db import models as models + class AreaField(models.FloatField): geo_field: Any = ... def __init__(self, geo_field: Any) -> None: ... diff --git a/django-stubs/contrib/gis/feeds.pyi b/django-stubs/contrib/gis/feeds.pyi index 863701fc9..c5dc445fd 100644 --- a/django-stubs/contrib/gis/feeds.pyi +++ b/django-stubs/contrib/gis/feeds.pyi @@ -1,11 +1,16 @@ +from typing import Any + from django.contrib.syndication.views import Feed as BaseFeed from django.utils.feedgenerator import Atom1Feed, Rss201rev2Feed -from typing import Any class GeoFeedMixin: def georss_coords(self, coords: Any): ... - def add_georss_point(self, handler: Any, coords: Any, w3c_geo: bool = ...) -> None: ... - def add_georss_element(self, handler: Any, item: Any, w3c_geo: bool = ...) -> None: ... + def add_georss_point( + self, handler: Any, coords: Any, w3c_geo: bool = ... + ) -> None: ... + def add_georss_element( + self, handler: Any, item: Any, w3c_geo: bool = ... + ) -> None: ... class GeoRSSFeed(Rss201rev2Feed, GeoFeedMixin): def rss_attributes(self): ... diff --git a/django-stubs/contrib/gis/forms/fields.pyi b/django-stubs/contrib/gis/forms/fields.pyi index b8b044994..e6b8fefb1 100644 --- a/django-stubs/contrib/gis/forms/fields.pyi +++ b/django-stubs/contrib/gis/forms/fields.pyi @@ -1,12 +1,19 @@ -from django import forms as forms from typing import Any, Optional +from django import forms as forms + class GeometryField(forms.Field): widget: Any = ... geom_type: str = ... default_error_messages: Any = ... srid: Any = ... - def __init__(self, *, srid: Optional[Any] = ..., geom_type: Optional[Any] = ..., **kwargs: Any) -> None: ... + def __init__( + self, + *, + srid: Optional[Any] = ..., + geom_type: Optional[Any] = ..., + **kwargs: Any + ) -> None: ... def to_python(self, value: Any): ... def clean(self, value: Any): ... def has_changed(self, initial: Any, data: Any): ... diff --git a/django-stubs/contrib/gis/forms/widgets.pyi b/django-stubs/contrib/gis/forms/widgets.pyi index cd4eb4c4b..710a2bd20 100644 --- a/django-stubs/contrib/gis/forms/widgets.pyi +++ b/django-stubs/contrib/gis/forms/widgets.pyi @@ -1,6 +1,7 @@ -from django.forms.widgets import Widget as Widget from typing import Any, Optional +from django.forms.widgets import Widget as Widget + logger: Any class BaseGeometryWidget(Widget): diff --git a/django-stubs/contrib/gis/gdal/__init__.pyi b/django-stubs/contrib/gis/gdal/__init__.pyi index 7658ce2fa..bc30d56bf 100644 --- a/django-stubs/contrib/gis/gdal/__init__.pyi +++ b/django-stubs/contrib/gis/gdal/__init__.pyi @@ -1,15 +1,9 @@ -from django.contrib.gis.gdal.error import ( - GDALException as GDALException, - SRSException as SRSException, - check_err as check_err, -) -from django.contrib.gis.gdal.libgdal import ( - GDAL_VERSION as GDAL_VERSION, - gdal_full_version as gdal_full_version, - gdal_version as gdal_version, -) -from django.contrib.gis.gdal.srs import ( - AxisOrder as AxisOrder, - CoordTransform as CoordTransform, - SpatialReference as SpatialReference, -) +from django.contrib.gis.gdal.error import GDALException as GDALException +from django.contrib.gis.gdal.error import SRSException as SRSException +from django.contrib.gis.gdal.error import check_err as check_err +from django.contrib.gis.gdal.libgdal import GDAL_VERSION as GDAL_VERSION +from django.contrib.gis.gdal.libgdal import gdal_full_version as gdal_full_version +from django.contrib.gis.gdal.libgdal import gdal_version as gdal_version +from django.contrib.gis.gdal.srs import AxisOrder as AxisOrder +from django.contrib.gis.gdal.srs import CoordTransform as CoordTransform +from django.contrib.gis.gdal.srs import SpatialReference as SpatialReference diff --git a/django-stubs/contrib/gis/gdal/base.pyi b/django-stubs/contrib/gis/gdal/base.pyi index 17dcc5582..7cc886641 100644 --- a/django-stubs/contrib/gis/gdal/base.pyi +++ b/django-stubs/contrib/gis/gdal/base.pyi @@ -1,5 +1,6 @@ -from django.contrib.gis.ptr import CPointerBase as CPointerBase from typing import Any +from django.contrib.gis.ptr import CPointerBase as CPointerBase + class GDALBase(CPointerBase): null_ptr_exception_class: Any = ... diff --git a/django-stubs/contrib/gis/gdal/datasource.pyi b/django-stubs/contrib/gis/gdal/datasource.pyi index d48eedeb8..4c39d6350 100644 --- a/django-stubs/contrib/gis/gdal/datasource.pyi +++ b/django-stubs/contrib/gis/gdal/datasource.pyi @@ -1,12 +1,19 @@ -from django.contrib.gis.gdal.base import GDALBase as GDALBase from typing import Any +from django.contrib.gis.gdal.base import GDALBase as GDALBase + class DataSource(GDALBase): destructor: Any = ... encoding: Any = ... ptr: Any = ... driver: Any = ... - def __init__(self, ds_input: Any, ds_driver: bool = ..., write: bool = ..., encoding: str = ...) -> None: ... + def __init__( + self, + ds_input: Any, + ds_driver: bool = ..., + write: bool = ..., + encoding: str = ..., + ) -> None: ... def __getitem__(self, index: Any): ... def __len__(self): ... @property diff --git a/django-stubs/contrib/gis/gdal/driver.pyi b/django-stubs/contrib/gis/gdal/driver.pyi index 6bb3edd90..da635d0f7 100644 --- a/django-stubs/contrib/gis/gdal/driver.pyi +++ b/django-stubs/contrib/gis/gdal/driver.pyi @@ -1,6 +1,7 @@ -from django.contrib.gis.gdal.base import GDALBase as GDALBase from typing import Any +from django.contrib.gis.gdal.base import GDALBase as GDALBase + class Driver(GDALBase): ptr: Any = ... def __init__(self, dr_input: Any) -> None: ... diff --git a/django-stubs/contrib/gis/gdal/feature.pyi b/django-stubs/contrib/gis/gdal/feature.pyi index c8062f2a3..5fa1d2e6c 100644 --- a/django-stubs/contrib/gis/gdal/feature.pyi +++ b/django-stubs/contrib/gis/gdal/feature.pyi @@ -1,6 +1,7 @@ -from django.contrib.gis.gdal.base import GDALBase as GDALBase from typing import Any +from django.contrib.gis.gdal.base import GDALBase as GDALBase + class Feature(GDALBase): destructor: Any = ... ptr: Any = ... diff --git a/django-stubs/contrib/gis/gdal/field.pyi b/django-stubs/contrib/gis/gdal/field.pyi index 8b825400f..2033a8e87 100644 --- a/django-stubs/contrib/gis/gdal/field.pyi +++ b/django-stubs/contrib/gis/gdal/field.pyi @@ -1,6 +1,7 @@ -from django.contrib.gis.gdal.base import GDALBase as GDALBase from typing import Any +from django.contrib.gis.gdal.base import GDALBase as GDALBase + class Field(GDALBase): ptr: Any = ... __class__: Any = ... diff --git a/django-stubs/contrib/gis/gdal/geometries.pyi b/django-stubs/contrib/gis/gdal/geometries.pyi index 9d0d6004e..15e50f8bc 100644 --- a/django-stubs/contrib/gis/gdal/geometries.pyi +++ b/django-stubs/contrib/gis/gdal/geometries.pyi @@ -1,6 +1,7 @@ -from django.contrib.gis.gdal.base import GDALBase as GDALBase from typing import Any, Optional +from django.contrib.gis.gdal.base import GDALBase as GDALBase + class OGRGeometry(GDALBase): destructor: Any = ... ptr: Any = ... diff --git a/django-stubs/contrib/gis/gdal/layer.pyi b/django-stubs/contrib/gis/gdal/layer.pyi index 73f57f8e1..3cbc41c34 100644 --- a/django-stubs/contrib/gis/gdal/layer.pyi +++ b/django-stubs/contrib/gis/gdal/layer.pyi @@ -1,6 +1,7 @@ -from django.contrib.gis.gdal.base import GDALBase as GDALBase from typing import Any +from django.contrib.gis.gdal.base import GDALBase as GDALBase + class Layer(GDALBase): ptr: Any = ... def __init__(self, layer_ptr: Any, ds: Any) -> None: ... diff --git a/django-stubs/contrib/gis/gdal/prototypes/errcheck.pyi b/django-stubs/contrib/gis/gdal/prototypes/errcheck.pyi index 761a2a1d9..cb7c31c1d 100644 --- a/django-stubs/contrib/gis/gdal/prototypes/errcheck.pyi +++ b/django-stubs/contrib/gis/gdal/prototypes/errcheck.pyi @@ -2,8 +2,12 @@ from typing import Any, Optional def arg_byref(args: Any, offset: int = ...): ... def ptr_byref(args: Any, offset: int = ...): ... -def check_const_string(result: Any, func: Any, cargs: Any, offset: Optional[Any] = ..., cpl: bool = ...): ... -def check_string(result: Any, func: Any, cargs: Any, offset: int = ..., str_result: bool = ...): ... +def check_const_string( + result: Any, func: Any, cargs: Any, offset: Optional[Any] = ..., cpl: bool = ... +): ... +def check_string( + result: Any, func: Any, cargs: Any, offset: int = ..., str_result: bool = ... +): ... def check_envelope(result: Any, func: Any, cargs: Any, offset: int = ...): ... def check_geom(result: Any, func: Any, cargs: Any): ... def check_geom_offset(result: Any, func: Any, cargs: Any, offset: int = ...): ... diff --git a/django-stubs/contrib/gis/gdal/prototypes/generation.pyi b/django-stubs/contrib/gis/gdal/prototypes/generation.pyi index 6f4cb3de3..0a3787a8e 100644 --- a/django-stubs/contrib/gis/gdal/prototypes/generation.pyi +++ b/django-stubs/contrib/gis/gdal/prototypes/generation.pyi @@ -4,16 +4,26 @@ from typing import Any, Optional class gdal_char_p(c_char_p): ... def bool_output(func: Any, argtypes: Any, errcheck: Optional[Any] = ...): ... -def double_output(func: Any, argtypes: Any, errcheck: bool = ..., strarg: bool = ..., cpl: bool = ...): ... +def double_output( + func: Any, argtypes: Any, errcheck: bool = ..., strarg: bool = ..., cpl: bool = ... +): ... def geom_output(func: Any, argtypes: Any, offset: Optional[Any] = ...): ... def int_output(func: Any, argtypes: Any, errcheck: Optional[Any] = ...): ... def int64_output(func: Any, argtypes: Any): ... def srs_output(func: Any, argtypes: Any): ... def const_string_output( - func: Any, argtypes: Any, offset: Optional[Any] = ..., decoding: Optional[Any] = ..., cpl: bool = ... + func: Any, + argtypes: Any, + offset: Optional[Any] = ..., + decoding: Optional[Any] = ..., + cpl: bool = ..., ): ... def string_output( - func: Any, argtypes: Any, offset: int = ..., str_result: bool = ..., decoding: Optional[Any] = ... + func: Any, + argtypes: Any, + offset: int = ..., + str_result: bool = ..., + decoding: Optional[Any] = ..., ): ... def void_output(func: Any, argtypes: Any, errcheck: bool = ..., cpl: bool = ...): ... def voidptr_output(func: Any, argtypes: Any, errcheck: bool = ...): ... diff --git a/django-stubs/contrib/gis/gdal/raster/band.pyi b/django-stubs/contrib/gis/gdal/raster/band.pyi index 26b2ecf59..2bc9a7695 100644 --- a/django-stubs/contrib/gis/gdal/raster/band.pyi +++ b/django-stubs/contrib/gis/gdal/raster/band.pyi @@ -1,6 +1,7 @@ -from django.contrib.gis.gdal.raster.base import GDALRasterBase as GDALRasterBase from typing import Any, Optional +from django.contrib.gis.gdal.raster.base import GDALRasterBase as GDALRasterBase + class GDALBand(GDALRasterBase): source: Any = ... def __init__(self, source: Any, index: Any) -> None: ... diff --git a/django-stubs/contrib/gis/gdal/raster/base.pyi b/django-stubs/contrib/gis/gdal/raster/base.pyi index d36a55747..4b3fc5cc5 100644 --- a/django-stubs/contrib/gis/gdal/raster/base.pyi +++ b/django-stubs/contrib/gis/gdal/raster/base.pyi @@ -1,6 +1,7 @@ -from django.contrib.gis.gdal.base import GDALBase as GDALBase from typing import Any +from django.contrib.gis.gdal.base import GDALBase as GDALBase + class GDALRasterBase(GDALBase): @property def metadata(self): ... diff --git a/django-stubs/contrib/gis/gdal/raster/source.pyi b/django-stubs/contrib/gis/gdal/raster/source.pyi index 0da9238ef..3bc2af016 100644 --- a/django-stubs/contrib/gis/gdal/raster/source.pyi +++ b/django-stubs/contrib/gis/gdal/raster/source.pyi @@ -1,6 +1,7 @@ -from django.contrib.gis.gdal.raster.base import GDALRasterBase as GDALRasterBase from typing import Any, Optional +from django.contrib.gis.gdal.raster.base import GDALRasterBase as GDALRasterBase + class TransformPoint(list): indices: Any = ... def __init__(self, raster: Any, prop: Any) -> None: ... diff --git a/django-stubs/contrib/gis/gdal/srs.pyi b/django-stubs/contrib/gis/gdal/srs.pyi index e1112b612..12229d179 100644 --- a/django-stubs/contrib/gis/gdal/srs.pyi +++ b/django-stubs/contrib/gis/gdal/srs.pyi @@ -1,7 +1,8 @@ -from django.contrib.gis.gdal.base import GDALBase as GDALBase from enum import IntEnum from typing import Any, Optional +from django.contrib.gis.gdal.base import GDALBase as GDALBase + class AxisOrder(IntEnum): TRADITIONAL: int = ... AUTHORITY: int = ... @@ -10,7 +11,9 @@ class SpatialReference(GDALBase): destructor: Any = ... axis_order: Any = ... ptr: Any = ... - def __init__(self, srs_input: str = ..., srs_type: str = ..., axis_order: Optional[Any] = ...) -> None: ... + def __init__( + self, srs_input: str = ..., srs_type: str = ..., axis_order: Optional[Any] = ... + ) -> None: ... def __getitem__(self, target: Any): ... def attr_value(self, target: Any, index: int = ...): ... def auth_name(self, target: Any): ... diff --git a/django-stubs/contrib/gis/geoip2/__init__.pyi b/django-stubs/contrib/gis/geoip2/__init__.pyi index b13c7199f..f524617cc 100644 --- a/django-stubs/contrib/gis/geoip2/__init__.pyi +++ b/django-stubs/contrib/gis/geoip2/__init__.pyi @@ -1,3 +1,4 @@ -from .base import GeoIP2 as GeoIP2, GeoIP2Exception as GeoIP2Exception +from .base import GeoIP2 as GeoIP2 +from .base import GeoIP2Exception as GeoIP2Exception HAS_GEOIP2: bool diff --git a/django-stubs/contrib/gis/geoip2/base.pyi b/django-stubs/contrib/gis/geoip2/base.pyi index 8c1672e23..ccf56ae40 100644 --- a/django-stubs/contrib/gis/geoip2/base.pyi +++ b/django-stubs/contrib/gis/geoip2/base.pyi @@ -12,7 +12,11 @@ class GeoIP2: MODE_MEMORY: int = ... cache_options: Any = ... def __init__( - self, path: Optional[Any] = ..., cache: int = ..., country: Optional[Any] = ..., city: Optional[Any] = ... + self, + path: Optional[Any] = ..., + cache: int = ..., + country: Optional[Any] = ..., + city: Optional[Any] = ..., ) -> None: ... def __del__(self) -> None: ... def city(self, query: Any): ... diff --git a/django-stubs/contrib/gis/geos/__init__.pyi b/django-stubs/contrib/gis/geos/__init__.pyi index 5b5a4cd8d..462c21f40 100644 --- a/django-stubs/contrib/gis/geos/__init__.pyi +++ b/django-stubs/contrib/gis/geos/__init__.pyi @@ -1,12 +1,17 @@ -from .collections import ( - GeometryCollection as GeometryCollection, - MultiLineString as MultiLineString, - MultiPoint as MultiPoint, - MultiPolygon as MultiPolygon, -) -from .factory import fromfile as fromfile, fromstr as fromstr -from .geometry import GEOSGeometry as GEOSGeometry, hex_regex as hex_regex, wkt_regex as wkt_regex -from .io import WKBReader as WKBReader, WKBWriter as WKBWriter, WKTReader as WKTReader, WKTWriter as WKTWriter -from .linestring import LineString as LineString, LinearRing as LinearRing +from .collections import GeometryCollection as GeometryCollection +from .collections import MultiLineString as MultiLineString +from .collections import MultiPoint as MultiPoint +from .collections import MultiPolygon as MultiPolygon +from .factory import fromfile as fromfile +from .factory import fromstr as fromstr +from .geometry import GEOSGeometry as GEOSGeometry +from .geometry import hex_regex as hex_regex +from .geometry import wkt_regex as wkt_regex +from .io import WKBReader as WKBReader +from .io import WKBWriter as WKBWriter +from .io import WKTReader as WKTReader +from .io import WKTWriter as WKTWriter +from .linestring import LinearRing as LinearRing +from .linestring import LineString as LineString from .point import Point as Point from .polygon import Polygon as Polygon diff --git a/django-stubs/contrib/gis/geos/base.pyi b/django-stubs/contrib/gis/geos/base.pyi index 00424007f..97b08ada1 100644 --- a/django-stubs/contrib/gis/geos/base.pyi +++ b/django-stubs/contrib/gis/geos/base.pyi @@ -1,5 +1,6 @@ -from django.contrib.gis.ptr import CPointerBase as CPointerBase from typing import Any +from django.contrib.gis.ptr import CPointerBase as CPointerBase + class GEOSBase(CPointerBase): null_ptr_exception_class: Any = ... diff --git a/django-stubs/contrib/gis/geos/collections.pyi b/django-stubs/contrib/gis/geos/collections.pyi index 0f33cde7f..8bcb045a8 100644 --- a/django-stubs/contrib/gis/geos/collections.pyi +++ b/django-stubs/contrib/gis/geos/collections.pyi @@ -1,6 +1,8 @@ -from django.contrib.gis.geos.geometry import GEOSGeometry as GEOSGeometry, LinearGeometryMixin as LinearGeometryMixin from typing import Any +from django.contrib.gis.geos.geometry import GEOSGeometry as GEOSGeometry +from django.contrib.gis.geos.geometry import LinearGeometryMixin as LinearGeometryMixin + class GeometryCollection(GEOSGeometry): def __init__(self, *args: Any, **kwargs: Any) -> None: ... def __iter__(self) -> Any: ... diff --git a/django-stubs/contrib/gis/geos/coordseq.pyi b/django-stubs/contrib/gis/geos/coordseq.pyi index 16dfa12f6..69afc3d52 100644 --- a/django-stubs/contrib/gis/geos/coordseq.pyi +++ b/django-stubs/contrib/gis/geos/coordseq.pyi @@ -1,6 +1,7 @@ -from django.contrib.gis.geos.base import GEOSBase as GEOSBase from typing import Any +from django.contrib.gis.geos.base import GEOSBase as GEOSBase + class GEOSCoordSeq(GEOSBase): ptr_type: Any = ... def __init__(self, ptr: Any, z: bool = ...) -> None: ... diff --git a/django-stubs/contrib/gis/geos/geometry.pyi b/django-stubs/contrib/gis/geos/geometry.pyi index 6f43628f1..d45dcbad3 100644 --- a/django-stubs/contrib/gis/geos/geometry.pyi +++ b/django-stubs/contrib/gis/geos/geometry.pyi @@ -1,11 +1,10 @@ -from django.contrib.gis.geometry import ( # noqa: F401 - hex_regex as hex_regex, - json_regex as json_regex, - wkt_regex as wkt_regex, -) +from typing import Any, Optional + +from django.contrib.gis.geometry import hex_regex as hex_regex # noqa: F401 +from django.contrib.gis.geometry import json_regex as json_regex +from django.contrib.gis.geometry import wkt_regex as wkt_regex from django.contrib.gis.geos.base import GEOSBase as GEOSBase from django.contrib.gis.geos.mutable_list import ListMixin as ListMixin -from typing import Any, Optional class GEOSGeometryBase(GEOSBase): ptr_type: Any = ... @@ -98,7 +97,12 @@ class GEOSGeometryBase(GEOSBase): def boundary(self): ... def buffer(self, width: Any, quadsegs: int = ...): ... def buffer_with_style( - self, width: Any, quadsegs: int = ..., end_cap_style: int = ..., join_style: int = ..., mitre_limit: float = ... + self, + width: Any, + quadsegs: int = ..., + end_cap_style: int = ..., + join_style: int = ..., + mitre_limit: float = ..., ): ... @property def centroid(self): ... diff --git a/django-stubs/contrib/gis/geos/io.pyi b/django-stubs/contrib/gis/geos/io.pyi index 78cdce349..a2e536d01 100644 --- a/django-stubs/contrib/gis/geos/io.pyi +++ b/django-stubs/contrib/gis/geos/io.pyi @@ -1,11 +1,9 @@ -from django.contrib.gis.geos.prototypes.io import ( # noqa: F401 - WKBWriter as WKBWriter, - WKTWriter as WKTWriter, - _WKBReader, - _WKTReader, -) from typing import Any +from django.contrib.gis.geos.prototypes.io import WKBWriter as WKBWriter # noqa: F401 +from django.contrib.gis.geos.prototypes.io import WKTWriter as WKTWriter +from django.contrib.gis.geos.prototypes.io import _WKBReader, _WKTReader + class WKBReader(_WKBReader): def read(self, wkb: Any): ... diff --git a/django-stubs/contrib/gis/geos/linestring.pyi b/django-stubs/contrib/gis/geos/linestring.pyi index 5c85bbd53..b9580b7f7 100644 --- a/django-stubs/contrib/gis/geos/linestring.pyi +++ b/django-stubs/contrib/gis/geos/linestring.pyi @@ -1,6 +1,8 @@ -from django.contrib.gis.geos.geometry import GEOSGeometry as GEOSGeometry, LinearGeometryMixin as LinearGeometryMixin from typing import Any +from django.contrib.gis.geos.geometry import GEOSGeometry as GEOSGeometry +from django.contrib.gis.geos.geometry import LinearGeometryMixin as LinearGeometryMixin + class LineString(LinearGeometryMixin, GEOSGeometry): has_cs: bool = ... def __init__(self, *args: Any, **kwargs: Any) -> None: ... diff --git a/django-stubs/contrib/gis/geos/point.pyi b/django-stubs/contrib/gis/geos/point.pyi index 3d8ce7a39..aab3ae3cf 100644 --- a/django-stubs/contrib/gis/geos/point.pyi +++ b/django-stubs/contrib/gis/geos/point.pyi @@ -1,10 +1,15 @@ -from django.contrib.gis.geos.geometry import GEOSGeometry as GEOSGeometry from typing import Any, Optional +from django.contrib.gis.geos.geometry import GEOSGeometry as GEOSGeometry + class Point(GEOSGeometry): has_cs: bool = ... def __init__( - self, x: Optional[Any] = ..., y: Optional[Any] = ..., z: Optional[Any] = ..., srid: Optional[Any] = ... + self, + x: Optional[Any] = ..., + y: Optional[Any] = ..., + z: Optional[Any] = ..., + srid: Optional[Any] = ..., ) -> None: ... def __iter__(self) -> Any: ... def __len__(self): ... diff --git a/django-stubs/contrib/gis/geos/polygon.pyi b/django-stubs/contrib/gis/geos/polygon.pyi index e4086fba4..d6aac49ce 100644 --- a/django-stubs/contrib/gis/geos/polygon.pyi +++ b/django-stubs/contrib/gis/geos/polygon.pyi @@ -1,6 +1,7 @@ -from django.contrib.gis.geos.geometry import GEOSGeometry as GEOSGeometry from typing import Any +from django.contrib.gis.geos.geometry import GEOSGeometry as GEOSGeometry + class Polygon(GEOSGeometry): def __init__(self, *args: Any, **kwargs: Any) -> None: ... def __iter__(self) -> Any: ... diff --git a/django-stubs/contrib/gis/geos/prepared.pyi b/django-stubs/contrib/gis/geos/prepared.pyi index 304367509..98f79da94 100644 --- a/django-stubs/contrib/gis/geos/prepared.pyi +++ b/django-stubs/contrib/gis/geos/prepared.pyi @@ -1,6 +1,7 @@ -from .base import GEOSBase as GEOSBase from typing import Any +from .base import GEOSBase as GEOSBase + class PreparedGeometry(GEOSBase): ptr_type: Any = ... destructor: Any = ... diff --git a/django-stubs/contrib/gis/geos/prototypes/__init__.pyi b/django-stubs/contrib/gis/geos/prototypes/__init__.pyi index 06b16a938..f39f446a4 100644 --- a/django-stubs/contrib/gis/geos/prototypes/__init__.pyi +++ b/django-stubs/contrib/gis/geos/prototypes/__init__.pyi @@ -1,57 +1,65 @@ -from django.contrib.gis.geos.prototypes.coordseq import ( - create_cs as create_cs, - cs_clone as cs_clone, - cs_getdims as cs_getdims, - cs_getordinate as cs_getordinate, - cs_getsize as cs_getsize, - cs_getx as cs_getx, - cs_gety as cs_gety, - cs_getz as cs_getz, - cs_is_ccw as cs_is_ccw, - cs_setordinate as cs_setordinate, - cs_setx as cs_setx, - cs_sety as cs_sety, - cs_setz as cs_setz, - get_cs as get_cs, -) +from django.contrib.gis.geos.prototypes.coordseq import create_cs as create_cs +from django.contrib.gis.geos.prototypes.coordseq import cs_clone as cs_clone +from django.contrib.gis.geos.prototypes.coordseq import cs_getdims as cs_getdims +from django.contrib.gis.geos.prototypes.coordseq import cs_getordinate as cs_getordinate +from django.contrib.gis.geos.prototypes.coordseq import cs_getsize as cs_getsize +from django.contrib.gis.geos.prototypes.coordseq import cs_getx as cs_getx +from django.contrib.gis.geos.prototypes.coordseq import cs_gety as cs_gety +from django.contrib.gis.geos.prototypes.coordseq import cs_getz as cs_getz +from django.contrib.gis.geos.prototypes.coordseq import cs_is_ccw as cs_is_ccw +from django.contrib.gis.geos.prototypes.coordseq import cs_setordinate as cs_setordinate +from django.contrib.gis.geos.prototypes.coordseq import cs_setx as cs_setx +from django.contrib.gis.geos.prototypes.coordseq import cs_sety as cs_sety +from django.contrib.gis.geos.prototypes.coordseq import cs_setz as cs_setz +from django.contrib.gis.geos.prototypes.coordseq import get_cs as get_cs from django.contrib.gis.geos.prototypes.geom import ( create_collection as create_collection, +) +from django.contrib.gis.geos.prototypes.geom import ( create_empty_polygon as create_empty_polygon, +) +from django.contrib.gis.geos.prototypes.geom import ( create_linearring as create_linearring, +) +from django.contrib.gis.geos.prototypes.geom import ( create_linestring as create_linestring, - create_point as create_point, - create_polygon as create_polygon, - destroy_geom as destroy_geom, - geom_clone as geom_clone, - geos_get_srid as geos_get_srid, - geos_normalize as geos_normalize, - geos_set_srid as geos_set_srid, - geos_type as geos_type, - geos_typeid as geos_typeid, - get_dims as get_dims, - get_extring as get_extring, - get_geomn as get_geomn, - get_intring as get_intring, - get_nrings as get_nrings, - get_num_coords as get_num_coords, - get_num_geoms as get_num_geoms, ) +from django.contrib.gis.geos.prototypes.geom import create_point as create_point +from django.contrib.gis.geos.prototypes.geom import create_polygon as create_polygon +from django.contrib.gis.geos.prototypes.geom import destroy_geom as destroy_geom +from django.contrib.gis.geos.prototypes.geom import geom_clone as geom_clone +from django.contrib.gis.geos.prototypes.geom import geos_get_srid as geos_get_srid +from django.contrib.gis.geos.prototypes.geom import geos_normalize as geos_normalize +from django.contrib.gis.geos.prototypes.geom import geos_set_srid as geos_set_srid +from django.contrib.gis.geos.prototypes.geom import geos_type as geos_type +from django.contrib.gis.geos.prototypes.geom import geos_typeid as geos_typeid +from django.contrib.gis.geos.prototypes.geom import get_dims as get_dims +from django.contrib.gis.geos.prototypes.geom import get_extring as get_extring +from django.contrib.gis.geos.prototypes.geom import get_geomn as get_geomn +from django.contrib.gis.geos.prototypes.geom import get_intring as get_intring +from django.contrib.gis.geos.prototypes.geom import get_nrings as get_nrings +from django.contrib.gis.geos.prototypes.geom import get_num_coords as get_num_coords +from django.contrib.gis.geos.prototypes.geom import get_num_geoms as get_num_geoms +from django.contrib.gis.geos.prototypes.predicates import geos_contains as geos_contains +from django.contrib.gis.geos.prototypes.predicates import geos_covers as geos_covers +from django.contrib.gis.geos.prototypes.predicates import geos_crosses as geos_crosses +from django.contrib.gis.geos.prototypes.predicates import geos_disjoint as geos_disjoint +from django.contrib.gis.geos.prototypes.predicates import geos_equals as geos_equals from django.contrib.gis.geos.prototypes.predicates import ( - geos_contains as geos_contains, - geos_covers as geos_covers, - geos_crosses as geos_crosses, - geos_disjoint as geos_disjoint, - geos_equals as geos_equals, geos_equalsexact as geos_equalsexact, - geos_hasz as geos_hasz, +) +from django.contrib.gis.geos.prototypes.predicates import geos_hasz as geos_hasz +from django.contrib.gis.geos.prototypes.predicates import ( geos_intersects as geos_intersects, - geos_isclosed as geos_isclosed, - geos_isempty as geos_isempty, - geos_isring as geos_isring, - geos_issimple as geos_issimple, - geos_isvalid as geos_isvalid, - geos_overlaps as geos_overlaps, +) +from django.contrib.gis.geos.prototypes.predicates import geos_isclosed as geos_isclosed +from django.contrib.gis.geos.prototypes.predicates import geos_isempty as geos_isempty +from django.contrib.gis.geos.prototypes.predicates import geos_isring as geos_isring +from django.contrib.gis.geos.prototypes.predicates import geos_issimple as geos_issimple +from django.contrib.gis.geos.prototypes.predicates import geos_isvalid as geos_isvalid +from django.contrib.gis.geos.prototypes.predicates import geos_overlaps as geos_overlaps +from django.contrib.gis.geos.prototypes.predicates import ( geos_relatepattern as geos_relatepattern, - geos_touches as geos_touches, - geos_within as geos_within, ) +from django.contrib.gis.geos.prototypes.predicates import geos_touches as geos_touches +from django.contrib.gis.geos.prototypes.predicates import geos_within as geos_within diff --git a/django-stubs/contrib/gis/geos/prototypes/coordseq.pyi b/django-stubs/contrib/gis/geos/prototypes/coordseq.pyi index 36b48aecc..c4a510524 100644 --- a/django-stubs/contrib/gis/geos/prototypes/coordseq.pyi +++ b/django-stubs/contrib/gis/geos/prototypes/coordseq.pyi @@ -1,6 +1,7 @@ -from django.contrib.gis.geos.libgeos import GEOSFuncFactory as GEOSFuncFactory from typing import Any +from django.contrib.gis.geos.libgeos import GEOSFuncFactory as GEOSFuncFactory + def check_cs_op(result: Any, func: Any, cargs: Any): ... def check_cs_get(result: Any, func: Any, cargs: Any): ... @@ -11,7 +12,9 @@ class CsInt(GEOSFuncFactory): class CsOperation(GEOSFuncFactory): restype: Any = ... - def __init__(self, *args: Any, ordinate: bool = ..., get: bool = ..., **kwargs: Any) -> None: ... + def __init__( + self, *args: Any, ordinate: bool = ..., get: bool = ..., **kwargs: Any + ) -> None: ... class CsOutput(GEOSFuncFactory): restype: Any = ... diff --git a/django-stubs/contrib/gis/geos/prototypes/geom.pyi b/django-stubs/contrib/gis/geos/prototypes/geom.pyi index 249c1f657..969af76d6 100644 --- a/django-stubs/contrib/gis/geos/prototypes/geom.pyi +++ b/django-stubs/contrib/gis/geos/prototypes/geom.pyi @@ -1,7 +1,8 @@ from ctypes import c_char_p -from django.contrib.gis.geos.libgeos import GEOSFuncFactory as GEOSFuncFactory from typing import Any +from django.contrib.gis.geos.libgeos import GEOSFuncFactory as GEOSFuncFactory + c_uchar_p: Any class geos_char_p(c_char_p): ... diff --git a/django-stubs/contrib/gis/geos/prototypes/io.pyi b/django-stubs/contrib/gis/geos/prototypes/io.pyi index 1bf000078..9ee704dff 100644 --- a/django-stubs/contrib/gis/geos/prototypes/io.pyi +++ b/django-stubs/contrib/gis/geos/prototypes/io.pyi @@ -1,11 +1,10 @@ import threading from ctypes import Structure -from django.contrib.gis.geos.base import GEOSBase as GEOSBase -from django.contrib.gis.geos.libgeos import ( - GEOSFuncFactory as GEOSFuncFactory, -) from typing import Any, Optional +from django.contrib.gis.geos.base import GEOSBase as GEOSBase +from django.contrib.gis.geos.libgeos import GEOSFuncFactory as GEOSFuncFactory + class WKTReader_st(Structure): ... class WKTWriter_st(Structure): ... class WKBReader_st(Structure): ... @@ -77,7 +76,9 @@ class _WKBReader(IOBase): class WKTWriter(IOBase): ptr_type: Any = ... destructor: Any = ... - def __init__(self, dim: int = ..., trim: bool = ..., precision: Optional[Any] = ...) -> None: ... + def __init__( + self, dim: int = ..., trim: bool = ..., precision: Optional[Any] = ... + ) -> None: ... def write(self, geom: Any): ... @property def outdim(self): ... diff --git a/django-stubs/contrib/gis/geos/prototypes/misc.pyi b/django-stubs/contrib/gis/geos/prototypes/misc.pyi index 50edae3b4..64feec2f5 100644 --- a/django-stubs/contrib/gis/geos/prototypes/misc.pyi +++ b/django-stubs/contrib/gis/geos/prototypes/misc.pyi @@ -1,6 +1,7 @@ -from django.contrib.gis.geos.libgeos import GEOSFuncFactory from typing import Any +from django.contrib.gis.geos.libgeos import GEOSFuncFactory + class DblFromGeom(GEOSFuncFactory): restype: Any = ... errcheck: Any = ... diff --git a/django-stubs/contrib/gis/geos/prototypes/predicates.pyi b/django-stubs/contrib/gis/geos/prototypes/predicates.pyi index c3d743dd1..494f93ba7 100644 --- a/django-stubs/contrib/gis/geos/prototypes/predicates.pyi +++ b/django-stubs/contrib/gis/geos/prototypes/predicates.pyi @@ -1,6 +1,7 @@ -from django.contrib.gis.geos.libgeos import GEOSFuncFactory as GEOSFuncFactory from typing import Any +from django.contrib.gis.geos.libgeos import GEOSFuncFactory as GEOSFuncFactory + class UnaryPredicate(GEOSFuncFactory): argtypes: Any = ... restype: Any = ... diff --git a/django-stubs/contrib/gis/geos/prototypes/prepared.pyi b/django-stubs/contrib/gis/geos/prototypes/prepared.pyi index 5d73f830d..413f8daaf 100644 --- a/django-stubs/contrib/gis/geos/prototypes/prepared.pyi +++ b/django-stubs/contrib/gis/geos/prototypes/prepared.pyi @@ -1,8 +1,7 @@ -from django.contrib.gis.geos.libgeos import ( - GEOSFuncFactory as GEOSFuncFactory, -) from typing import Any +from django.contrib.gis.geos.libgeos import GEOSFuncFactory as GEOSFuncFactory + geos_prepare: Any prepared_destroy: Any diff --git a/django-stubs/contrib/gis/geos/prototypes/threadsafe.pyi b/django-stubs/contrib/gis/geos/prototypes/threadsafe.pyi index 7c740720a..e78ae7af2 100644 --- a/django-stubs/contrib/gis/geos/prototypes/threadsafe.pyi +++ b/django-stubs/contrib/gis/geos/prototypes/threadsafe.pyi @@ -1,7 +1,8 @@ import threading -from django.contrib.gis.geos.base import GEOSBase as GEOSBase from typing import Any +from django.contrib.gis.geos.base import GEOSBase as GEOSBase + class GEOSContextHandle(GEOSBase): ptr_type: Any = ... destructor: Any = ... diff --git a/django-stubs/contrib/gis/geos/prototypes/topology.pyi b/django-stubs/contrib/gis/geos/prototypes/topology.pyi index c745d0138..9b3c005c0 100644 --- a/django-stubs/contrib/gis/geos/prototypes/topology.pyi +++ b/django-stubs/contrib/gis/geos/prototypes/topology.pyi @@ -1,6 +1,7 @@ -from django.contrib.gis.geos.libgeos import GEOSFuncFactory as GEOSFuncFactory from typing import Any +from django.contrib.gis.geos.libgeos import GEOSFuncFactory as GEOSFuncFactory + class Topology(GEOSFuncFactory): argtypes: Any = ... restype: Any = ... diff --git a/django-stubs/contrib/gis/serializers/geojson.pyi b/django-stubs/contrib/gis/serializers/geojson.pyi index 63843eb2f..098243305 100644 --- a/django-stubs/contrib/gis/serializers/geojson.pyi +++ b/django-stubs/contrib/gis/serializers/geojson.pyi @@ -1,6 +1,7 @@ -from django.core.serializers.json import Serializer as JSONSerializer from typing import Any +from django.core.serializers.json import Serializer as JSONSerializer + class Serializer(JSONSerializer): def start_serialization(self) -> None: ... def end_serialization(self) -> None: ... diff --git a/django-stubs/contrib/gis/sitemaps/__init__.pyi b/django-stubs/contrib/gis/sitemaps/__init__.pyi index adf328291..3d41fca13 100644 --- a/django-stubs/contrib/gis/sitemaps/__init__.pyi +++ b/django-stubs/contrib/gis/sitemaps/__init__.pyi @@ -1 +1,2 @@ -from django.contrib.gis.sitemaps.kml import KMLSitemap as KMLSitemap, KMZSitemap as KMZSitemap +from django.contrib.gis.sitemaps.kml import KMLSitemap as KMLSitemap +from django.contrib.gis.sitemaps.kml import KMZSitemap as KMZSitemap diff --git a/django-stubs/contrib/gis/sitemaps/kml.pyi b/django-stubs/contrib/gis/sitemaps/kml.pyi index 518c21ca7..cc61d6113 100644 --- a/django-stubs/contrib/gis/sitemaps/kml.pyi +++ b/django-stubs/contrib/gis/sitemaps/kml.pyi @@ -1,6 +1,7 @@ -from django.contrib.sitemaps import Sitemap as Sitemap from typing import Any, Optional +from django.contrib.sitemaps import Sitemap as Sitemap + class KMLSitemap(Sitemap): geo_format: str = ... locations: Any = ... diff --git a/django-stubs/contrib/gis/sitemaps/views.pyi b/django-stubs/contrib/gis/sitemaps/views.pyi index 98271fe2b..11cdaea37 100644 --- a/django-stubs/contrib/gis/sitemaps/views.pyi +++ b/django-stubs/contrib/gis/sitemaps/views.pyi @@ -1,6 +1,17 @@ from typing import Any, Optional def kml( - request: Any, label: Any, model: Any, field_name: Optional[Any] = ..., compress: bool = ..., using: Any = ... + request: Any, + label: Any, + model: Any, + field_name: Optional[Any] = ..., + compress: bool = ..., + using: Any = ..., +): ... +def kmz( + request: Any, + label: Any, + model: Any, + field_name: Optional[Any] = ..., + using: Any = ..., ): ... -def kmz(request: Any, label: Any, model: Any, field_name: Optional[Any] = ..., using: Any = ...): ... diff --git a/django-stubs/contrib/gis/utils/ogrinspect.pyi b/django-stubs/contrib/gis/utils/ogrinspect.pyi index 984699d7b..632a1e92f 100644 --- a/django-stubs/contrib/gis/utils/ogrinspect.pyi +++ b/django-stubs/contrib/gis/utils/ogrinspect.pyi @@ -1,4 +1,6 @@ from typing import Any -def mapping(data_source: Any, geom_name: str = ..., layer_key: int = ..., multi_geom: bool = ...): ... +def mapping( + data_source: Any, geom_name: str = ..., layer_key: int = ..., multi_geom: bool = ... +): ... def ogrinspect(*args: Any, **kwargs: Any): ... diff --git a/django-stubs/contrib/humanize/apps.pyi b/django-stubs/contrib/humanize/apps.pyi index 9f3cb27d7..ccc481bd9 100644 --- a/django-stubs/contrib/humanize/apps.pyi +++ b/django-stubs/contrib/humanize/apps.pyi @@ -1,6 +1,7 @@ -from django.apps import AppConfig as AppConfig from typing import Any +from django.apps import AppConfig as AppConfig + class HumanizeConfig(AppConfig): name: str = ... verbose_name: Any = ... diff --git a/django-stubs/contrib/humanize/templatetags/humanize.pyi b/django-stubs/contrib/humanize/templatetags/humanize.pyi index f701916f8..eb2026879 100644 --- a/django-stubs/contrib/humanize/templatetags/humanize.pyi +++ b/django-stubs/contrib/humanize/templatetags/humanize.pyi @@ -1,5 +1,7 @@ -from datetime import date, datetime as datetime +from datetime import date +from datetime import datetime as datetime from typing import Any, Callable, Dict, Optional, SupportsInt, Tuple, Type, Union + from django import template register: template.Library diff --git a/django-stubs/contrib/messages/__init__.pyi b/django-stubs/contrib/messages/__init__.pyi index 1ff9c7d09..e45e467ec 100644 --- a/django-stubs/contrib/messages/__init__.pyi +++ b/django-stubs/contrib/messages/__init__.pyi @@ -1,24 +1,19 @@ -from .api import ( - get_level as get_level, - set_level as set_level, - add_message as add_message, - debug as debug, - error as error, - success as success, - get_messages as get_messages, - MessageFailure as MessageFailure, - info as info, - warning as warning, -) - -from .constants import ( - DEBUG as DEBUG, - DEFAULT_LEVELS as DEFAULT_LEVELS, - DEFAULT_TAGS as DEFAULT_TAGS, - ERROR as ERROR, - INFO as INFO, - SUCCESS as SUCCESS, - WARNING as WARNING, -) +from .api import MessageFailure as MessageFailure +from .api import add_message as add_message +from .api import debug as debug +from .api import error as error +from .api import get_level as get_level +from .api import get_messages as get_messages +from .api import info as info +from .api import set_level as set_level +from .api import success as success +from .api import warning as warning +from .constants import DEBUG as DEBUG +from .constants import DEFAULT_LEVELS as DEFAULT_LEVELS +from .constants import DEFAULT_TAGS as DEFAULT_TAGS +from .constants import ERROR as ERROR +from .constants import INFO as INFO +from .constants import SUCCESS as SUCCESS +from .constants import WARNING as WARNING default_app_config: str = ... diff --git a/django-stubs/contrib/messages/api.pyi b/django-stubs/contrib/messages/api.pyi index 7ad6d5973..2a88d10d4 100644 --- a/django-stubs/contrib/messages/api.pyi +++ b/django-stubs/contrib/messages/api.pyi @@ -15,12 +15,33 @@ def add_message( def get_messages(request: HttpRequest) -> Union[List[Any], BaseStorage]: ... def get_level(request: HttpRequest) -> int: ... def set_level(request: HttpRequest, level: int) -> bool: ... -def debug(request: HttpRequest, message: str, extra_tags: str = ..., fail_silently: Union[bool, str] = ...) -> None: ... -def info(request: HttpRequest, message: str, extra_tags: str = ..., fail_silently: Union[bool, str] = ...) -> None: ... +def debug( + request: HttpRequest, + message: str, + extra_tags: str = ..., + fail_silently: Union[bool, str] = ..., +) -> None: ... +def info( + request: HttpRequest, + message: str, + extra_tags: str = ..., + fail_silently: Union[bool, str] = ..., +) -> None: ... def success( - request: HttpRequest, message: str, extra_tags: str = ..., fail_silently: Union[bool, str] = ... + request: HttpRequest, + message: str, + extra_tags: str = ..., + fail_silently: Union[bool, str] = ..., ) -> None: ... def warning( - request: HttpRequest, message: str, extra_tags: str = ..., fail_silently: Union[bool, str] = ... + request: HttpRequest, + message: str, + extra_tags: str = ..., + fail_silently: Union[bool, str] = ..., +) -> None: ... +def error( + request: HttpRequest, + message: str, + extra_tags: str = ..., + fail_silently: Union[bool, str] = ..., ) -> None: ... -def error(request: HttpRequest, message: str, extra_tags: str = ..., fail_silently: Union[bool, str] = ...) -> None: ... diff --git a/django-stubs/contrib/messages/apps.pyi b/django-stubs/contrib/messages/apps.pyi index 7823a7c39..38cafb25c 100644 --- a/django-stubs/contrib/messages/apps.pyi +++ b/django-stubs/contrib/messages/apps.pyi @@ -1,6 +1,7 @@ -from django.apps import AppConfig as AppConfig from typing import Any +from django.apps import AppConfig as AppConfig + class MessagesConfig(AppConfig): name: str = ... verbose_name: Any = ... diff --git a/django-stubs/contrib/messages/context_processors.pyi b/django-stubs/contrib/messages/context_processors.pyi index 86528482b..e98c8dcf9 100644 --- a/django-stubs/contrib/messages/context_processors.pyi +++ b/django-stubs/contrib/messages/context_processors.pyi @@ -3,4 +3,6 @@ from typing import Any, Dict, List, Union from django.contrib.messages.storage.base import BaseStorage from django.http.request import HttpRequest -def messages(request: HttpRequest) -> Dict[str, Union[Dict[str, int], List[Any], BaseStorage]]: ... +def messages( + request: HttpRequest, +) -> Dict[str, Union[Dict[str, int], List[Any], BaseStorage]]: ... diff --git a/django-stubs/contrib/messages/middleware.pyi b/django-stubs/contrib/messages/middleware.pyi index 427f8d0a7..047910b03 100644 --- a/django-stubs/contrib/messages/middleware.pyi +++ b/django-stubs/contrib/messages/middleware.pyi @@ -4,4 +4,6 @@ from django.utils.deprecation import MiddlewareMixin class MessageMiddleware(MiddlewareMixin): def process_request(self, request: HttpRequest) -> None: ... - def process_response(self, request: HttpRequest, response: HttpResponse) -> HttpResponse: ... + def process_response( + self, request: HttpRequest, response: HttpResponse + ) -> HttpResponse: ... diff --git a/django-stubs/contrib/messages/storage/base.pyi b/django-stubs/contrib/messages/storage/base.pyi index d6a7163ef..37ff22e46 100644 --- a/django-stubs/contrib/messages/storage/base.pyi +++ b/django-stubs/contrib/messages/storage/base.pyi @@ -9,7 +9,9 @@ class Message: level: int = ... message: str = ... extra_tags: str = ... - def __init__(self, level: int, message: str, extra_tags: Optional[str] = ...) -> None: ... + def __init__( + self, level: int, message: str, extra_tags: Optional[str] = ... + ) -> None: ... @property def tags(self) -> str: ... @property @@ -24,5 +26,7 @@ class BaseStorage: def __iter__(self): ... def __contains__(self, item: Any): ... def update(self, response: HttpResponseBase) -> Optional[List[Message]]: ... - def add(self, level: int, message: str, extra_tags: Optional[str] = ...) -> None: ... + def add( + self, level: int, message: str, extra_tags: Optional[str] = ... + ) -> None: ... level: Any = ... diff --git a/django-stubs/contrib/messages/storage/session.pyi b/django-stubs/contrib/messages/storage/session.pyi index 8ba628194..38ec18790 100644 --- a/django-stubs/contrib/messages/storage/session.pyi +++ b/django-stubs/contrib/messages/storage/session.pyi @@ -7,4 +7,6 @@ class SessionStorage(BaseStorage): session_key: str = ... def __init__(self, request: HttpRequest, *args: Any, **kwargs: Any) -> None: ... def serialize_messages(self, messages: Sequence[Any]) -> str: ... - def deserialize_messages(self, data: Optional[Union[List[Any], str]]) -> Optional[List[Any]]: ... + def deserialize_messages( + self, data: Optional[Union[List[Any], str]] + ) -> Optional[List[Any]]: ... diff --git a/django-stubs/contrib/postgres/aggregates/__init__.pyi b/django-stubs/contrib/postgres/aggregates/__init__.pyi index 8fad9ee69..fbb15e1d5 100644 --- a/django-stubs/contrib/postgres/aggregates/__init__.pyi +++ b/django-stubs/contrib/postgres/aggregates/__init__.pyi @@ -1,24 +1,19 @@ -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, -) +from .general import ArrayAgg as ArrayAgg +from .general import BitAnd as BitAnd +from .general import BitOr as BitOr +from .general import BoolAnd as BoolAnd +from .general import BoolOr as BoolOr +from .general import JSONBAgg as JSONBAgg +from .general import StringAgg as StringAgg +from .statistics import Corr as Corr +from .statistics import CovarPop as CovarPop +from .statistics import RegrAvgX as RegrAvgX +from .statistics import RegrAvgY as RegrAvgY +from .statistics import RegrCount as RegrCount +from .statistics import RegrIntercept as RegrIntercept +from .statistics import RegrR2 as RegrR2 +from .statistics import RegrSlope as RegrSlope +from .statistics import RegrSXX as RegrSXX +from .statistics import RegrSXY as RegrSXY +from .statistics import RegrSYY as RegrSYY +from .statistics import StatAggregate as StatAggregate diff --git a/django-stubs/contrib/postgres/apps.pyi b/django-stubs/contrib/postgres/apps.pyi index f41db1b81..8ed8115bc 100644 --- a/django-stubs/contrib/postgres/apps.pyi +++ b/django-stubs/contrib/postgres/apps.pyi @@ -1,9 +1,12 @@ -from django.apps import AppConfig as AppConfig from typing import Any +from django.apps import AppConfig as AppConfig + RANGE_TYPES: Any -def uninstall_if_needed(setting: Any, value: Any, enter: Any, **kwargs: Any) -> None: ... +def uninstall_if_needed( + setting: Any, value: Any, enter: Any, **kwargs: Any +) -> None: ... class PostgresConfig(AppConfig): name: str = ... diff --git a/django-stubs/contrib/postgres/fields/__init__.pyi b/django-stubs/contrib/postgres/fields/__init__.pyi index 6ad3e200c..8725127d1 100644 --- a/django-stubs/contrib/postgres/fields/__init__.pyi +++ b/django-stubs/contrib/postgres/fields/__init__.pyi @@ -1,20 +1,17 @@ from .array import ArrayField as ArrayField -from .jsonb import JSONField as JSONField, JsonAdapter as JsonAdapter -from .ranges import ( - RangeField as RangeField, - IntegerRangeField as IntegerRangeField, - BigIntegerRangeField as BigIntegerRangeField, - DecimalRangeField as DecimalRangeField, - FloatRangeField as FloatRangeField, - DateRangeField as DateRangeField, - DateTimeRangeField as DateTimeRangeField, - RangeOperators as RangeOperators, - RangeBoundary as RangeBoundary, -) +from .citext import CICharField as CICharField +from .citext import CIEmailField as CIEmailField +from .citext import CIText as CIText +from .citext import CITextField as CITextField from .hstore import HStoreField as HStoreField -from .citext import ( - CICharField as CICharField, - CIEmailField as CIEmailField, - CIText as CIText, - CITextField as CITextField, -) +from .jsonb import JsonAdapter as JsonAdapter +from .jsonb import JSONField as JSONField +from .ranges import BigIntegerRangeField as BigIntegerRangeField +from .ranges import DateRangeField as DateRangeField +from .ranges import DateTimeRangeField as DateTimeRangeField +from .ranges import DecimalRangeField as DecimalRangeField +from .ranges import FloatRangeField as FloatRangeField +from .ranges import IntegerRangeField as IntegerRangeField +from .ranges import RangeBoundary as RangeBoundary +from .ranges import RangeField as RangeField +from .ranges import RangeOperators as RangeOperators diff --git a/django-stubs/contrib/postgres/fields/array.pyi b/django-stubs/contrib/postgres/fields/array.pyi index a69b0918c..b6ae702a2 100644 --- a/django-stubs/contrib/postgres/fields/array.pyi +++ b/django-stubs/contrib/postgres/fields/array.pyi @@ -1,7 +1,12 @@ from typing import Any, Iterable, List, Optional, Sequence, TypeVar, Union from django.db.models.expressions import Combinable -from django.db.models.fields import Field, _ErrorMessagesToOverride, _FieldChoices, _ValidatorCallable +from django.db.models.fields import ( + Field, + _ErrorMessagesToOverride, + _FieldChoices, + _ValidatorCallable, +) from .mixins import CheckFieldDefaultMixin diff --git a/django-stubs/contrib/postgres/fields/hstore.pyi b/django-stubs/contrib/postgres/fields/hstore.pyi index e94ea6a4c..96208db8b 100644 --- a/django-stubs/contrib/postgres/fields/hstore.pyi +++ b/django-stubs/contrib/postgres/fields/hstore.pyi @@ -1,6 +1,7 @@ from typing import Any from django.db.models import Field, Transform + from .mixins import CheckFieldDefaultMixin class HStoreField(CheckFieldDefaultMixin, Field): diff --git a/django-stubs/contrib/postgres/fields/jsonb.pyi b/django-stubs/contrib/postgres/fields/jsonb.pyi index 48f00984a..18cdfb334 100644 --- a/django-stubs/contrib/postgres/fields/jsonb.pyi +++ b/django-stubs/contrib/postgres/fields/jsonb.pyi @@ -3,11 +3,14 @@ from typing import Any, Optional, Type from django.db.models import Field from django.db.models.lookups import Transform + from .mixins import CheckFieldDefaultMixin class JsonAdapter: encoder: Any = ... - def __init__(self, adapted: Any, dumps: Optional[Any] = ..., encoder: Optional[Any] = ...) -> None: ... + def __init__( + self, adapted: Any, dumps: Optional[Any] = ..., encoder: Optional[Any] = ... + ) -> None: ... def dumps(self, obj: Any): ... class JSONField(CheckFieldDefaultMixin, Field): diff --git a/django-stubs/contrib/postgres/fields/ranges.pyi b/django-stubs/contrib/postgres/fields/ranges.pyi index eb8eeb097..a6beabb11 100644 --- a/django-stubs/contrib/postgres/fields/ranges.pyi +++ b/django-stubs/contrib/postgres/fields/ranges.pyi @@ -1,7 +1,6 @@ from typing import Any from django.db import models - from psycopg2.extras import DateRange, DateTimeTZRange, NumericRange # type: ignore class RangeField(models.Field): diff --git a/django-stubs/contrib/postgres/indexes.pyi b/django-stubs/contrib/postgres/indexes.pyi index c2410e0b6..7d2e3041e 100644 --- a/django-stubs/contrib/postgres/indexes.pyi +++ b/django-stubs/contrib/postgres/indexes.pyi @@ -1,8 +1,7 @@ from typing import Optional, Sequence -from django.db.models.query_utils import Q - from django.db.models import Index +from django.db.models.query_utils import Q class PostgresIndex(Index): ... diff --git a/django-stubs/contrib/postgres/lookups.pyi b/django-stubs/contrib/postgres/lookups.pyi index 79c0a1bc4..bd855fa73 100644 --- a/django-stubs/contrib/postgres/lookups.pyi +++ b/django-stubs/contrib/postgres/lookups.pyi @@ -1,6 +1,6 @@ +from django.db.models import Lookup, Transform from django.db.models.lookups import Exact -from django.db.models import Lookup, Transform from .search import SearchVectorExact class PostgresSimpleLookup(Lookup): diff --git a/django-stubs/contrib/postgres/search.pyi b/django-stubs/contrib/postgres/search.pyi index 69f522af9..663a71cc2 100644 --- a/django-stubs/contrib/postgres/search.pyi +++ b/django-stubs/contrib/postgres/search.pyi @@ -1,9 +1,14 @@ from typing import Any, Dict, Optional, TypeVar, Union -from django.db.models.expressions import Combinable, CombinedExpression, Func, Value, _OutputField -from django.db.models.lookups import Lookup - from django.db.models import Field +from django.db.models.expressions import ( + Combinable, + CombinedExpression, + Func, + Value, + _OutputField, +) +from django.db.models.lookups import Lookup _Expression = Union[str, Combinable, "SearchQueryCombinable"] @@ -20,7 +25,12 @@ class SearchVector(SearchVectorCombinable, Func): class CombinedSearchVector(SearchVectorCombinable, CombinedExpression): def __init__( - self, lhs, connector, rhs, config: Optional[_Expression] = ..., output_field: Optional[_OutputField] = ... + self, + lhs, + connector, + rhs, + config: Optional[_Expression] = ..., + output_field: Optional[_OutputField] = ..., ): ... _T = TypeVar("_T", bound="SearchQueryCombinable") @@ -48,12 +58,20 @@ class SearchQuery(SearchQueryCombinable, Value): # type: ignore class CombinedSearchQuery(SearchQueryCombinable, CombinedExpression): # type: ignore def __init__( - self, lhs, connector, rhs, config: Optional[_Expression] = ..., output_field: Optional[_OutputField] = ... + self, + lhs, + connector, + rhs, + config: Optional[_Expression] = ..., + output_field: Optional[_OutputField] = ..., ) -> None: ... class SearchRank(Func): def __init__( - self, vector: Union[SearchVector, _Expression], query: Union[SearchQuery, _Expression], **extra: Any + self, + vector: Union[SearchVector, _Expression], + query: Union[SearchQuery, _Expression], + **extra: Any ) -> None: ... class TrigramBase(Func): diff --git a/django-stubs/contrib/postgres/validators.pyi b/django-stubs/contrib/postgres/validators.pyi index 00ad4ff7f..89cd365b0 100644 --- a/django-stubs/contrib/postgres/validators.pyi +++ b/django-stubs/contrib/postgres/validators.pyi @@ -1,6 +1,11 @@ from typing import Any, Dict, Iterable, Mapping, Optional -from django.core.validators import MaxLengthValidator, MaxValueValidator, MinLengthValidator, MinValueValidator +from django.core.validators import ( + MaxLengthValidator, + MaxValueValidator, + MinLengthValidator, + MinValueValidator, +) class ArrayMaxLengthValidator(MaxLengthValidator): ... class ArrayMinLengthValidator(MinLengthValidator): ... @@ -9,7 +14,10 @@ class KeysValidator: messages: Dict[str, str] = ... strict: bool = ... def __init__( - self, keys: Iterable[str], strict: bool = ..., messages: Optional[Mapping[str, str]] = ... + self, + keys: Iterable[str], + strict: bool = ..., + messages: Optional[Mapping[str, str]] = ..., ) -> None: ... def __call__(self, value: Any) -> None: ... diff --git a/django-stubs/contrib/redirects/admin.pyi b/django-stubs/contrib/redirects/admin.pyi index bc50ad3c8..dc71b2d75 100644 --- a/django-stubs/contrib/redirects/admin.pyi +++ b/django-stubs/contrib/redirects/admin.pyi @@ -1,6 +1,7 @@ -from django.contrib import admin as admin from typing import Any +from django.contrib import admin as admin + class RedirectAdmin(admin.ModelAdmin): list_display: Any = ... list_filter: Any = ... diff --git a/django-stubs/contrib/redirects/apps.pyi b/django-stubs/contrib/redirects/apps.pyi index db877f3a7..bb3a68dc5 100644 --- a/django-stubs/contrib/redirects/apps.pyi +++ b/django-stubs/contrib/redirects/apps.pyi @@ -1,6 +1,7 @@ -from django.apps import AppConfig as AppConfig from typing import Any +from django.apps import AppConfig as AppConfig + class RedirectsConfig(AppConfig): name: str = ... verbose_name: Any = ... diff --git a/django-stubs/contrib/redirects/middleware.pyi b/django-stubs/contrib/redirects/middleware.pyi index 10b830470..4a5249b0d 100644 --- a/django-stubs/contrib/redirects/middleware.pyi +++ b/django-stubs/contrib/redirects/middleware.pyi @@ -7,4 +7,6 @@ from django.utils.deprecation import MiddlewareMixin class RedirectFallbackMiddleware(MiddlewareMixin): response_gone_class: Any = ... response_redirect_class: Any = ... - def process_response(self, request: HttpRequest, response: HttpResponse) -> HttpResponse: ... + def process_response( + self, request: HttpRequest, response: HttpResponse + ) -> HttpResponse: ... diff --git a/django-stubs/contrib/sessions/apps.pyi b/django-stubs/contrib/sessions/apps.pyi index cd0625a24..c65086ac0 100644 --- a/django-stubs/contrib/sessions/apps.pyi +++ b/django-stubs/contrib/sessions/apps.pyi @@ -1,6 +1,7 @@ -from django.apps import AppConfig as AppConfig from typing import Any +from django.apps import AppConfig as AppConfig + class SessionsConfig(AppConfig): name: str = ... verbose_name: Any = ... diff --git a/django-stubs/contrib/sessions/base_session.pyi b/django-stubs/contrib/sessions/base_session.pyi index 1578fa7e0..f9e7431fb 100644 --- a/django-stubs/contrib/sessions/base_session.pyi +++ b/django-stubs/contrib/sessions/base_session.pyi @@ -2,12 +2,13 @@ from datetime import datetime from typing import Any, Dict, Optional, Type from django.contrib.sessions.backends.base import SessionBase - from django.db import models class BaseSessionManager(models.Manager): def encode(self, session_dict: Dict[str, int]) -> str: ... - def save(self, session_key: str, session_dict: Dict[str, int], expire_date: datetime) -> AbstractBaseSession: ... + def save( + self, session_key: str, session_dict: Dict[str, int], expire_date: datetime + ) -> AbstractBaseSession: ... class AbstractBaseSession(models.Model): expire_date: datetime diff --git a/django-stubs/contrib/sessions/middleware.pyi b/django-stubs/contrib/sessions/middleware.pyi index 0e29b8d22..e4ed6d1de 100644 --- a/django-stubs/contrib/sessions/middleware.pyi +++ b/django-stubs/contrib/sessions/middleware.pyi @@ -8,4 +8,6 @@ from django.utils.deprecation import MiddlewareMixin class SessionMiddleware(MiddlewareMixin): SessionStore: Type[SessionBase] = ... def process_request(self, request: HttpRequest) -> None: ... - def process_response(self, request: HttpRequest, response: HttpResponse) -> HttpResponse: ... + def process_response( + self, request: HttpRequest, response: HttpResponse + ) -> HttpResponse: ... diff --git a/django-stubs/contrib/sitemaps/__init__.pyi b/django-stubs/contrib/sitemaps/__init__.pyi index 3ffc95336..c4126213c 100644 --- a/django-stubs/contrib/sitemaps/__init__.pyi +++ b/django-stubs/contrib/sitemaps/__init__.pyi @@ -1,5 +1,5 @@ from datetime import datetime -from typing import Any, Dict, List, Optional, Union, Protocol +from typing import Any, Dict, List, Optional, Protocol, Union from django.contrib.sites.models import Site from django.contrib.sites.requests import RequestSite @@ -30,7 +30,10 @@ class Sitemap: @property def paginator(self) -> Paginator: ... def get_urls( - self, page: Union[int, str] = ..., site: Optional[Union[Site, RequestSite]] = ..., protocol: Optional[str] = ... + self, + page: Union[int, str] = ..., + site: Optional[Union[Site, RequestSite]] = ..., + protocol: Optional[str] = ..., ) -> List[Dict[str, Any]]: ... class GenericSitemap(Sitemap): diff --git a/django-stubs/contrib/sitemaps/apps.pyi b/django-stubs/contrib/sitemaps/apps.pyi index 06b2b2d92..72ab919eb 100644 --- a/django-stubs/contrib/sitemaps/apps.pyi +++ b/django-stubs/contrib/sitemaps/apps.pyi @@ -1,6 +1,7 @@ -from django.apps import AppConfig as AppConfig from typing import Any +from django.apps import AppConfig as AppConfig + class SiteMapsConfig(AppConfig): name: str = ... verbose_name: Any = ... diff --git a/django-stubs/contrib/sitemaps/views.pyi b/django-stubs/contrib/sitemaps/views.pyi index fb7a639c0..5245f766d 100644 --- a/django-stubs/contrib/sitemaps/views.pyi +++ b/django-stubs/contrib/sitemaps/views.pyi @@ -1,11 +1,10 @@ from collections import OrderedDict from typing import Callable, Dict, Optional, Type, Union +from django.contrib.sitemaps import GenericSitemap, Sitemap from django.http.request import HttpRequest from django.template.response import TemplateResponse -from django.contrib.sitemaps import GenericSitemap, Sitemap - def x_robots_tag(func: Callable) -> Callable: ... def index( request: HttpRequest, diff --git a/django-stubs/contrib/sites/admin.pyi b/django-stubs/contrib/sites/admin.pyi index ab0de9a4c..c80181fab 100644 --- a/django-stubs/contrib/sites/admin.pyi +++ b/django-stubs/contrib/sites/admin.pyi @@ -1,6 +1,7 @@ -from django.contrib import admin as admin from typing import Any +from django.contrib import admin as admin + class SiteAdmin(admin.ModelAdmin): list_display: Any = ... search_fields: Any = ... diff --git a/django-stubs/contrib/sites/models.pyi b/django-stubs/contrib/sites/models.pyi index 385c35d72..099ab2629 100644 --- a/django-stubs/contrib/sites/models.pyi +++ b/django-stubs/contrib/sites/models.pyi @@ -1,8 +1,7 @@ from typing import Any, Optional, Tuple, Type -from django.http.request import HttpRequest - from django.db import models +from django.http.request import HttpRequest SITE_CACHE: Any diff --git a/django-stubs/contrib/staticfiles/checks.pyi b/django-stubs/contrib/staticfiles/checks.pyi index 564e15bee..74e445b80 100644 --- a/django-stubs/contrib/staticfiles/checks.pyi +++ b/django-stubs/contrib/staticfiles/checks.pyi @@ -1,7 +1,8 @@ from typing import Any, List, Optional, Sequence -from django.core.checks.messages import Error - from django.apps.config import AppConfig +from django.core.checks.messages import Error -def check_finders(app_configs: Optional[Sequence[AppConfig]] = ..., **kwargs: Any) -> List[Error]: ... +def check_finders( + app_configs: Optional[Sequence[AppConfig]] = ..., **kwargs: Any +) -> List[Error]: ... diff --git a/django-stubs/contrib/staticfiles/finders.pyi b/django-stubs/contrib/staticfiles/finders.pyi index beabe2a1c..1e4dfc4a3 100644 --- a/django-stubs/contrib/staticfiles/finders.pyi +++ b/django-stubs/contrib/staticfiles/finders.pyi @@ -15,7 +15,9 @@ class FileSystemFinder(BaseFinder): locations: List[Any] = ... storages: Mapping[str, Any] = ... def __init__(self, app_names: None = ..., *args: Any, **kwargs: Any) -> None: ... - def find_location(self, root: str, path: str, prefix: str = ...) -> Optional[str]: ... + def find_location( + self, root: str, path: str, prefix: str = ... + ) -> Optional[str]: ... class AppDirectoriesFinder(BaseFinder): storage_class: Any = ... @@ -27,14 +29,18 @@ class AppDirectoriesFinder(BaseFinder): class BaseStorageFinder(BaseFinder): storage: Storage = ... - def __init__(self, storage: Optional[Storage] = ..., *args: Any, **kwargs: Any) -> None: ... + def __init__( + self, storage: Optional[Storage] = ..., *args: Any, **kwargs: Any + ) -> None: ... class DefaultStorageFinder(BaseStorageFinder): ... def find(path: str, all: bool = ...) -> Optional[Union[List[str], str]]: ... def get_finders() -> Iterator[BaseFinder]: ... @overload -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 def get_finder( import_path: Literal["django.contrib.staticfiles.finders.AppDirectoriesFinder"], diff --git a/django-stubs/contrib/staticfiles/management/commands/collectstatic.pyi b/django-stubs/contrib/staticfiles/management/commands/collectstatic.pyi index cfad24bf4..46b7f29bd 100644 --- a/django-stubs/contrib/staticfiles/management/commands/collectstatic.pyi +++ b/django-stubs/contrib/staticfiles/management/commands/collectstatic.pyi @@ -23,6 +23,12 @@ class Command(BaseCommand): def log(self, msg: str, level: int = ...) -> None: ... def is_local_storage(self) -> bool: ... def clear_dir(self, path: str) -> None: ... - def delete_file(self, path: str, prefixed_path: str, source_storage: Storage) -> bool: ... - def link_file(self, path: str, prefixed_path: str, source_storage: Storage) -> None: ... - def copy_file(self, path: str, prefixed_path: str, source_storage: Storage) -> None: ... + def delete_file( + self, path: str, prefixed_path: str, source_storage: Storage + ) -> bool: ... + def link_file( + self, path: str, prefixed_path: str, source_storage: Storage + ) -> None: ... + def copy_file( + self, path: str, prefixed_path: str, source_storage: Storage + ) -> None: ... diff --git a/django-stubs/contrib/staticfiles/management/commands/runserver.pyi b/django-stubs/contrib/staticfiles/management/commands/runserver.pyi index 20cfd79d2..65c80d7d5 100644 --- a/django-stubs/contrib/staticfiles/management/commands/runserver.pyi +++ b/django-stubs/contrib/staticfiles/management/commands/runserver.pyi @@ -1,3 +1,5 @@ -from django.core.management.commands.runserver import Command as RunserverCommand # type: ignore +from django.core.management.commands.runserver import ( + Command as RunserverCommand, # type: ignore +) class Command(RunserverCommand): ... diff --git a/django-stubs/contrib/staticfiles/storage.pyi b/django-stubs/contrib/staticfiles/storage.pyi index da67f2a40..c53e16394 100644 --- a/django-stubs/contrib/staticfiles/storage.pyi +++ b/django-stubs/contrib/staticfiles/storage.pyi @@ -8,7 +8,13 @@ from django.utils.functional import LazyObject class StaticFilesStorage(FileSystemStorage): base_location: Any = ... location: Any = ... - def __init__(self, location: Optional[str] = ..., base_url: None = ..., *args: Any, **kwargs: Any) -> None: ... + def __init__( + self, + location: Optional[str] = ..., + base_url: None = ..., + *args: Any, + **kwargs: Any + ) -> None: ... def path(self, name: str) -> str: ... class HashedFilesMixin: @@ -18,8 +24,12 @@ class HashedFilesMixin: hashed_files: Any = ... def __init__(self, *args: Any, **kwargs: Any) -> None: ... def file_hash(self, name: str, content: File = ...) -> str: ... - def hashed_name(self, name: str, content: Optional[File] = ..., filename: Optional[str] = ...) -> str: ... - def url_converter(self, name: str, hashed_files: OrderedDict, template: str = ...) -> Callable: ... + def hashed_name( + self, name: str, content: Optional[File] = ..., filename: Optional[str] = ... + ) -> str: ... + def url_converter( + self, name: str, hashed_files: OrderedDict, template: str = ... + ) -> Callable: ... def post_process( self, paths: OrderedDict, dry_run: bool = ..., **options: Any ) -> Iterator[Tuple[str, str, bool]]: ... diff --git a/django-stubs/contrib/staticfiles/utils.pyi b/django-stubs/contrib/staticfiles/utils.pyi index 8d98d5f12..497481fec 100644 --- a/django-stubs/contrib/staticfiles/utils.pyi +++ b/django-stubs/contrib/staticfiles/utils.pyi @@ -3,6 +3,10 @@ from typing import Iterator, List, Optional, Tuple, Union from django.core.files.storage import FileSystemStorage -def matches_patterns(path: str, patterns: Union[List[str], Tuple[str], OrderedDict] = ...) -> bool: ... -def get_files(storage: FileSystemStorage, ignore_patterns: List[str] = ..., location: str = ...) -> Iterator[str]: ... +def matches_patterns( + path: str, patterns: Union[List[str], Tuple[str], OrderedDict] = ... +) -> bool: ... +def get_files( + storage: FileSystemStorage, ignore_patterns: List[str] = ..., location: str = ... +) -> Iterator[str]: ... def check_settings(base_url: Optional[str] = ...) -> None: ... diff --git a/django-stubs/contrib/staticfiles/views.pyi b/django-stubs/contrib/staticfiles/views.pyi index 8d1ef04da..dafa16558 100644 --- a/django-stubs/contrib/staticfiles/views.pyi +++ b/django-stubs/contrib/staticfiles/views.pyi @@ -3,4 +3,6 @@ from typing import Any from django.core.handlers.wsgi import WSGIRequest from django.http.response import FileResponse -def serve(request: WSGIRequest, path: str, insecure: bool = ..., **kwargs: Any) -> FileResponse: ... +def serve( + request: WSGIRequest, path: str, insecure: bool = ..., **kwargs: Any +) -> FileResponse: ... diff --git a/django-stubs/contrib/syndication/apps.pyi b/django-stubs/contrib/syndication/apps.pyi index 5a1984599..029571178 100644 --- a/django-stubs/contrib/syndication/apps.pyi +++ b/django-stubs/contrib/syndication/apps.pyi @@ -1,6 +1,7 @@ -from django.apps import AppConfig as AppConfig from typing import Any +from django.apps import AppConfig as AppConfig + class SyndicationConfig(AppConfig): name: str = ... verbose_name: Any = ... diff --git a/django-stubs/contrib/syndication/views.pyi b/django-stubs/contrib/syndication/views.pyi index bf2b1b31a..839143683 100644 --- a/django-stubs/contrib/syndication/views.pyi +++ b/django-stubs/contrib/syndication/views.pyi @@ -15,7 +15,9 @@ class Feed: feed_type: Any = ... title_template: Any = ... description_template: Any = ... - def __call__(self, request: WSGIRequest, *args: Any, **kwargs: Any) -> HttpResponse: ... + def __call__( + self, request: WSGIRequest, *args: Any, **kwargs: Any + ) -> HttpResponse: ... def item_title(self, item: Model) -> SafeText: ... def item_description(self, item: Model) -> str: ... def item_link(self, item: Model) -> str: ... diff --git a/django-stubs/core/cache/__init__.pyi b/django-stubs/core/cache/__init__.pyi index 7652696c7..320eef957 100644 --- a/django-stubs/core/cache/__init__.pyi +++ b/django-stubs/core/cache/__init__.pyi @@ -1,11 +1,9 @@ from collections import OrderedDict from typing import Any, Callable, Dict, Union -from .backends.base import ( - BaseCache as BaseCache, - CacheKeyWarning as CacheKeyWarning, - InvalidCacheBackendError as InvalidCacheBackendError, -) +from .backends.base import BaseCache as BaseCache +from .backends.base import CacheKeyWarning as CacheKeyWarning +from .backends.base import InvalidCacheBackendError as InvalidCacheBackendError DEFAULT_CACHE_ALIAS: str @@ -15,7 +13,9 @@ class CacheHandler: def all(self): ... class DefaultCacheProxy: - def __getattr__(self, name: str) -> Union[Callable, Dict[str, float], OrderedDict, int]: ... + def __getattr__( + self, name: str + ) -> Union[Callable, Dict[str, float], OrderedDict, int]: ... def __setattr__(self, name: str, value: Callable) -> None: ... def __delattr__(self, name: Any): ... def __contains__(self, key: str) -> bool: ... diff --git a/django-stubs/core/cache/backends/base.pyi b/django-stubs/core/cache/backends/base.pyi index 75f4f51b5..7b9c69399 100644 --- a/django-stubs/core/cache/backends/base.pyi +++ b/django-stubs/core/cache/backends/base.pyi @@ -19,23 +19,45 @@ class BaseCache: def __init__(self, params: Dict[str, Any]) -> None: ... def get_backend_timeout(self, timeout: Any = ...) -> Optional[float]: ... def make_key(self, key: Any, version: Optional[Any] = ...) -> str: ... - def add(self, key: Any, value: Any, timeout: Any = ..., version: Optional[Any] = ...) -> bool: ... - def get(self, key: Any, default: Optional[Any] = ..., version: Optional[Any] = ...) -> Any: ... - def set(self, key: Any, value: Any, timeout: Any = ..., version: Optional[Any] = ...) -> None: ... - def touch(self, key: Any, timeout: Any = ..., version: Optional[Any] = ...) -> bool: ... + def add( + self, key: Any, value: Any, timeout: Any = ..., version: Optional[Any] = ... + ) -> bool: ... + def get( + self, key: Any, default: Optional[Any] = ..., version: Optional[Any] = ... + ) -> Any: ... + def set( + self, key: Any, value: Any, timeout: Any = ..., version: Optional[Any] = ... + ) -> None: ... + def touch( + self, key: Any, timeout: Any = ..., version: Optional[Any] = ... + ) -> bool: ... def delete(self, key: Any, version: Optional[Any] = ...) -> None: ... - def get_many(self, keys: List[str], version: Optional[int] = ...) -> Dict[str, Union[int, str]]: ... + def get_many( + self, keys: List[str], version: Optional[int] = ... + ) -> Dict[str, Union[int, str]]: ... def get_or_set( - self, key: Any, default: Optional[Any], timeout: Any = ..., version: Optional[int] = ... + self, + key: Any, + default: Optional[Any], + timeout: Any = ..., + version: Optional[int] = ..., ) -> Optional[Any]: ... def has_key(self, key: Any, version: Optional[Any] = ...) -> bool: ... def incr(self, key: str, delta: int = ..., version: Optional[int] = ...) -> int: ... def decr(self, key: str, delta: int = ..., version: Optional[int] = ...) -> int: ... def __contains__(self, key: str) -> bool: ... - def set_many(self, data: Dict[str, Any], timeout: Any = ..., version: Optional[Any] = ...) -> List[Any]: ... - def delete_many(self, keys: Iterable[Any], version: Optional[Any] = ...) -> None: ... + def set_many( + self, data: Dict[str, Any], timeout: Any = ..., version: Optional[Any] = ... + ) -> List[Any]: ... + def delete_many( + self, keys: Iterable[Any], version: Optional[Any] = ... + ) -> None: ... def clear(self) -> None: ... def validate_key(self, key: str) -> None: ... - def incr_version(self, key: str, delta: int = ..., version: Optional[int] = ...) -> int: ... - def decr_version(self, key: str, delta: int = ..., version: Optional[int] = ...) -> int: ... + def incr_version( + self, key: str, delta: int = ..., version: Optional[int] = ... + ) -> int: ... + def decr_version( + self, key: str, delta: int = ..., version: Optional[int] = ... + ) -> int: ... def close(self, **kwargs: Any) -> None: ... diff --git a/django-stubs/core/cache/utils.pyi b/django-stubs/core/cache/utils.pyi index 76df11959..9e706ab47 100644 --- a/django-stubs/core/cache/utils.pyi +++ b/django-stubs/core/cache/utils.pyi @@ -2,4 +2,6 @@ from typing import Any, Iterable, Optional TEMPLATE_FRAGMENT_KEY_TEMPLATE: str -def make_template_fragment_key(fragment_name: str, vary_on: Optional[Iterable[Any]] = ...) -> str: ... +def make_template_fragment_key( + fragment_name: str, vary_on: Optional[Iterable[Any]] = ... +) -> str: ... diff --git a/django-stubs/core/checks/__init__.pyi b/django-stubs/core/checks/__init__.pyi index a41eed9bd..69626e9dd 100644 --- a/django-stubs/core/checks/__init__.pyi +++ b/django-stubs/core/checks/__init__.pyi @@ -1,17 +1,16 @@ -from .messages import ( - CheckMessage as CheckMessage, - Debug as Debug, - Info as Info, - Warning as Warning, - Error as Error, - Critical as Critical, - DEBUG as DEBUG, - INFO as INFO, - WARNING as WARNING, - ERROR as ERROR, - CRITICAL as CRITICAL, -) - -from .registry import register as register, run_checks as run_checks, tag_exists as tag_exists, Tags as Tags - from . import model_checks as model_checks +from .messages import CRITICAL as CRITICAL +from .messages import DEBUG as DEBUG +from .messages import ERROR as ERROR +from .messages import INFO as INFO +from .messages import WARNING as WARNING +from .messages import CheckMessage as CheckMessage +from .messages import Critical as Critical +from .messages import Debug as Debug +from .messages import Error as Error +from .messages import Info as Info +from .messages import Warning as Warning +from .registry import Tags as Tags +from .registry import register as register +from .registry import run_checks as run_checks +from .registry import tag_exists as tag_exists diff --git a/django-stubs/core/checks/async_checks.pyi b/django-stubs/core/checks/async_checks.pyi index 09005ffa2..0ec26e3c5 100644 --- a/django-stubs/core/checks/async_checks.pyi +++ b/django-stubs/core/checks/async_checks.pyi @@ -4,4 +4,6 @@ from django.apps.config import AppConfig E001: Any -def check_async_unsafe(app_configs: Optional[Sequence[AppConfig]] = ..., **kwargs: Any): ... +def check_async_unsafe( + app_configs: Optional[Sequence[AppConfig]] = ..., **kwargs: Any +): ... diff --git a/django-stubs/core/checks/caches.pyi b/django-stubs/core/checks/caches.pyi index 3e07a1ef7..b912a8e28 100644 --- a/django-stubs/core/checks/caches.pyi +++ b/django-stubs/core/checks/caches.pyi @@ -1,8 +1,7 @@ from typing import Any, List, Optional, Sequence -from django.core.checks.messages import Error - from django.apps.config import AppConfig +from django.core.checks.messages import Error E001: Any diff --git a/django-stubs/core/checks/messages.pyi b/django-stubs/core/checks/messages.pyi index f7aec386e..f5a3b5ce5 100644 --- a/django-stubs/core/checks/messages.pyi +++ b/django-stubs/core/checks/messages.pyi @@ -13,7 +13,12 @@ class CheckMessage: obj: Any = ... id: Optional[str] = ... def __init__( - self, level: int, msg: str, hint: Optional[str] = ..., obj: Any = ..., id: Optional[str] = ... + self, + level: int, + msg: str, + hint: Optional[str] = ..., + obj: Any = ..., + id: Optional[str] = ..., ) -> None: ... def is_serious(self, level: int = ...) -> bool: ... def is_silenced(self) -> bool: ... diff --git a/django-stubs/core/checks/model_checks.pyi b/django-stubs/core/checks/model_checks.pyi index d73337de2..7d0e03290 100644 --- a/django-stubs/core/checks/model_checks.pyi +++ b/django-stubs/core/checks/model_checks.pyi @@ -1,8 +1,11 @@ from typing import Any, List, Optional, Sequence -from django.core.checks.messages import Warning - from django.apps.config import AppConfig +from django.core.checks.messages import Warning -def check_all_models(app_configs: Optional[Sequence[AppConfig]] = ..., **kwargs: Any) -> List[Warning]: ... -def check_lazy_references(app_configs: Optional[Sequence[AppConfig]] = ..., **kwargs: Any) -> List[Any]: ... +def check_all_models( + app_configs: Optional[Sequence[AppConfig]] = ..., **kwargs: Any +) -> List[Warning]: ... +def check_lazy_references( + app_configs: Optional[Sequence[AppConfig]] = ..., **kwargs: Any +) -> List[Any]: ... diff --git a/django-stubs/core/checks/registry.pyi b/django-stubs/core/checks/registry.pyi index aa42e545c..f1a960370 100644 --- a/django-stubs/core/checks/registry.pyi +++ b/django-stubs/core/checks/registry.pyi @@ -21,7 +21,12 @@ class CheckRegistry: registered_checks: Set[Callable] = ... deployment_checks: Set[Callable] = ... def __init__(self) -> None: ... - def register(self, check: Optional[Union[_CheckCallable, str]] = ..., *tags: str, **kwargs: Any) -> Callable: ... + def register( + self, + check: Optional[Union[_CheckCallable, str]] = ..., + *tags: str, + **kwargs: Any + ) -> Callable: ... def run_checks( self, app_configs: Optional[List[AppConfig]] = ..., diff --git a/django-stubs/core/checks/security/base.pyi b/django-stubs/core/checks/security/base.pyi index 8b9c37e21..7eea2e707 100644 --- a/django-stubs/core/checks/security/base.pyi +++ b/django-stubs/core/checks/security/base.pyi @@ -1,8 +1,7 @@ from typing import Any, List, Optional, Sequence -from django.core.checks.messages import Warning - from django.apps.config import AppConfig +from django.core.checks.messages import Warning SECRET_KEY_MIN_LENGTH: int SECRET_KEY_MIN_UNIQUE_CHARACTERS: int @@ -19,17 +18,39 @@ W019: Any W020: Any W021: Any -def check_security_middleware(app_configs: Optional[Sequence[AppConfig]] = ..., **kwargs: Any) -> List[Warning]: ... +def check_security_middleware( + app_configs: Optional[Sequence[AppConfig]] = ..., **kwargs: Any +) -> List[Warning]: ... def check_xframe_options_middleware( app_configs: Optional[Sequence[AppConfig]] = ..., **kwargs: Any ) -> List[Warning]: ... -def check_sts(app_configs: Optional[Sequence[AppConfig]] = ..., **kwargs: Any) -> List[Warning]: ... -def check_sts_include_subdomains(app_configs: Optional[Sequence[AppConfig]] = ..., **kwargs: Any) -> List[Warning]: ... -def check_sts_preload(app_configs: Optional[Sequence[AppConfig]] = ..., **kwargs: Any) -> List[Warning]: ... -def check_content_type_nosniff(app_configs: Optional[Sequence[AppConfig]] = ..., **kwargs: Any) -> List[Warning]: ... -def check_xss_filter(app_configs: Optional[Sequence[AppConfig]] = ..., **kwargs: Any) -> List[Warning]: ... -def check_ssl_redirect(app_configs: Optional[Sequence[AppConfig]] = ..., **kwargs: Any) -> List[Warning]: ... -def check_secret_key(app_configs: Optional[Sequence[AppConfig]] = ..., **kwargs: Any) -> List[Warning]: ... -def check_debug(app_configs: Optional[Sequence[AppConfig]] = ..., **kwargs: Any) -> List[Warning]: ... -def check_xframe_deny(app_configs: Optional[Sequence[AppConfig]] = ..., **kwargs: Any) -> List[Warning]: ... -def check_allowed_hosts(app_configs: Optional[Sequence[AppConfig]] = ..., **kwargs: Any) -> List[Warning]: ... +def check_sts( + app_configs: Optional[Sequence[AppConfig]] = ..., **kwargs: Any +) -> List[Warning]: ... +def check_sts_include_subdomains( + app_configs: Optional[Sequence[AppConfig]] = ..., **kwargs: Any +) -> List[Warning]: ... +def check_sts_preload( + app_configs: Optional[Sequence[AppConfig]] = ..., **kwargs: Any +) -> List[Warning]: ... +def check_content_type_nosniff( + app_configs: Optional[Sequence[AppConfig]] = ..., **kwargs: Any +) -> List[Warning]: ... +def check_xss_filter( + app_configs: Optional[Sequence[AppConfig]] = ..., **kwargs: Any +) -> List[Warning]: ... +def check_ssl_redirect( + app_configs: Optional[Sequence[AppConfig]] = ..., **kwargs: Any +) -> List[Warning]: ... +def check_secret_key( + app_configs: Optional[Sequence[AppConfig]] = ..., **kwargs: Any +) -> List[Warning]: ... +def check_debug( + app_configs: Optional[Sequence[AppConfig]] = ..., **kwargs: Any +) -> List[Warning]: ... +def check_xframe_deny( + app_configs: Optional[Sequence[AppConfig]] = ..., **kwargs: Any +) -> List[Warning]: ... +def check_allowed_hosts( + app_configs: Optional[Sequence[AppConfig]] = ..., **kwargs: Any +) -> List[Warning]: ... diff --git a/django-stubs/core/checks/security/csrf.pyi b/django-stubs/core/checks/security/csrf.pyi index 804ef3fdf..68473942f 100644 --- a/django-stubs/core/checks/security/csrf.pyi +++ b/django-stubs/core/checks/security/csrf.pyi @@ -6,5 +6,9 @@ from django.core.checks.messages import Warning W003: Any W016: Any -def check_csrf_middleware(app_configs: Optional[Sequence[AppConfig]] = ..., **kwargs: Any) -> List[Warning]: ... -def check_csrf_cookie_secure(app_configs: Optional[Sequence[AppConfig]] = ..., **kwargs: Any) -> List[Warning]: ... +def check_csrf_middleware( + app_configs: Optional[Sequence[AppConfig]] = ..., **kwargs: Any +) -> List[Warning]: ... +def check_csrf_cookie_secure( + app_configs: Optional[Sequence[AppConfig]] = ..., **kwargs: Any +) -> List[Warning]: ... diff --git a/django-stubs/core/checks/security/sessions.pyi b/django-stubs/core/checks/security/sessions.pyi index e3a7c18cf..a9565d397 100644 --- a/django-stubs/core/checks/security/sessions.pyi +++ b/django-stubs/core/checks/security/sessions.pyi @@ -1,8 +1,7 @@ from typing import Any, List, Optional, Sequence -from django.core.checks.messages import Warning - from django.apps.config import AppConfig +from django.core.checks.messages import Warning def add_session_cookie_message(message: Any): ... @@ -16,5 +15,9 @@ W013: Any W014: Any W015: Any -def check_session_cookie_secure(app_configs: Optional[Sequence[AppConfig]] = ..., **kwargs: Any) -> List[Warning]: ... -def check_session_cookie_httponly(app_configs: Optional[Sequence[AppConfig]] = ..., **kwargs: Any) -> List[Warning]: ... +def check_session_cookie_secure( + app_configs: Optional[Sequence[AppConfig]] = ..., **kwargs: Any +) -> List[Warning]: ... +def check_session_cookie_httponly( + app_configs: Optional[Sequence[AppConfig]] = ..., **kwargs: Any +) -> List[Warning]: ... diff --git a/django-stubs/core/checks/templates.pyi b/django-stubs/core/checks/templates.pyi index 698a575c0..dce417884 100644 --- a/django-stubs/core/checks/templates.pyi +++ b/django-stubs/core/checks/templates.pyi @@ -1,13 +1,14 @@ from typing import Any, List, Optional, Sequence -from django.core.checks.messages import Error - from django.apps.config import AppConfig +from django.core.checks.messages import Error E001: Any E002: Any -def check_setting_app_dirs_loaders(app_configs: Optional[Sequence[AppConfig]] = ..., **kwargs: Any) -> List[Error]: ... +def check_setting_app_dirs_loaders( + app_configs: Optional[Sequence[AppConfig]] = ..., **kwargs: Any +) -> List[Error]: ... def check_string_if_invalid_is_string( app_configs: Optional[Sequence[AppConfig]] = ..., **kwargs: Any ) -> List[Error]: ... diff --git a/django-stubs/core/checks/translation.pyi b/django-stubs/core/checks/translation.pyi index c7bda1905..6c19c80d7 100644 --- a/django-stubs/core/checks/translation.pyi +++ b/django-stubs/core/checks/translation.pyi @@ -6,4 +6,6 @@ from . import Error E001: Error = ... -def check_setting_language_code(app_configs: Optional[Sequence[AppConfig]] = ..., **kwargs: Any) -> List[Error]: ... +def check_setting_language_code( + app_configs: Optional[Sequence[AppConfig]] = ..., **kwargs: Any +) -> List[Error]: ... diff --git a/django-stubs/core/checks/urls.pyi b/django-stubs/core/checks/urls.pyi index 76a27b75d..c6386e99a 100644 --- a/django-stubs/core/checks/urls.pyi +++ b/django-stubs/core/checks/urls.pyi @@ -1,13 +1,20 @@ -from typing import Any, Callable, List, Tuple, Union, Optional, Sequence +from typing import Any, Callable, List, Optional, Sequence, Tuple, Union +from django.apps.config import AppConfig from django.core.checks.messages import CheckMessage, Error, Warning from django.urls.resolvers import URLPattern, URLResolver -from django.apps.config import AppConfig - -def check_url_config(app_configs: Optional[Sequence[AppConfig]] = ..., **kwargs: Any) -> List[CheckMessage]: ... -def check_resolver(resolver: Union[Tuple[str, Callable], URLPattern, URLResolver]) -> List[CheckMessage]: ... -def check_url_namespaces_unique(app_configs: Optional[Sequence[AppConfig]] = ..., **kwargs: Any) -> List[Warning]: ... +def check_url_config( + app_configs: Optional[Sequence[AppConfig]] = ..., **kwargs: Any +) -> List[CheckMessage]: ... +def check_resolver( + resolver: Union[Tuple[str, Callable], URLPattern, URLResolver] +) -> List[CheckMessage]: ... +def check_url_namespaces_unique( + app_configs: Optional[Sequence[AppConfig]] = ..., **kwargs: Any +) -> List[Warning]: ... def get_warning_for_invalid_pattern(pattern: Any) -> List[Error]: ... -def check_url_settings(app_configs: Optional[Sequence[AppConfig]] = ..., **kwargs: Any) -> List[Error]: ... +def check_url_settings( + app_configs: Optional[Sequence[AppConfig]] = ..., **kwargs: Any +) -> List[Error]: ... def E006(name: str) -> Error: ... diff --git a/django-stubs/core/exceptions.pyi b/django-stubs/core/exceptions.pyi index 44a904b31..20429bf3f 100644 --- a/django-stubs/core/exceptions.pyi +++ b/django-stubs/core/exceptions.pyi @@ -30,7 +30,12 @@ class ValidationError(Exception): message: Any = ... code: Any = ... params: Any = ... - def __init__(self, message: Any, code: Optional[str] = ..., params: Optional[Mapping[str, Any]] = ...) -> None: ... + def __init__( + self, + message: Any, + code: Optional[str] = ..., + params: Optional[Mapping[str, Any]] = ..., + ) -> None: ... @property def message_dict(self) -> Dict[str, List[str]]: ... @property diff --git a/django-stubs/core/files/base.pyi b/django-stubs/core/files/base.pyi index 96226857e..3bc3892ea 100644 --- a/django-stubs/core/files/base.pyi +++ b/django-stubs/core/files/base.pyi @@ -1,6 +1,6 @@ import types from io import StringIO -from typing import Any, IO, Iterator, Optional, Type, TypeVar, Union +from typing import IO, Any, Iterator, Optional, Type, TypeVar, Union from django.core.files.utils import FileProxyMixin @@ -33,7 +33,9 @@ class File(FileProxyMixin, IO[Any]): class ContentFile(File): file: StringIO size: Any = ... - def __init__(self, content: Union[bytes, str], name: Optional[str] = ...) -> None: ... + def __init__( + self, content: Union[bytes, str], name: Optional[str] = ... + ) -> None: ... def write(self, data: str) -> int: ... def endswith_cr(line: bytes) -> bool: ... diff --git a/django-stubs/core/files/images.pyi b/django-stubs/core/files/images.pyi index 31956983b..0ca05ffae 100644 --- a/django-stubs/core/files/images.pyi +++ b/django-stubs/core/files/images.pyi @@ -1,4 +1,4 @@ -from typing import Any, IO, Union +from typing import IO, Any, Union from django.core.files import File @@ -10,4 +10,6 @@ class ImageFile(File): @property def height(self) -> int: ... -def get_image_dimensions(file_or_path: Union[str, IO[bytes]], close: bool = ...) -> Any: ... +def get_image_dimensions( + file_or_path: Union[str, IO[bytes]], close: bool = ... +) -> Any: ... diff --git a/django-stubs/core/files/move.pyi b/django-stubs/core/files/move.pyi index bdbfd17fb..96835991a 100644 --- a/django-stubs/core/files/move.pyi +++ b/django-stubs/core/files/move.pyi @@ -1,3 +1,6 @@ def file_move_safe( - old_file_name: str, new_file_name: str, chunk_size: int = ..., allow_overwrite: bool = ... + old_file_name: str, + new_file_name: str, + chunk_size: int = ..., + allow_overwrite: bool = ..., ) -> None: ... diff --git a/django-stubs/core/files/storage.pyi b/django-stubs/core/files/storage.pyi index 32dac5bc5..a6dfaac73 100644 --- a/django-stubs/core/files/storage.pyi +++ b/django-stubs/core/files/storage.pyi @@ -1,12 +1,14 @@ from datetime import datetime -from typing import Any, IO, List, Optional, Tuple, Type +from typing import IO, Any, List, Optional, Tuple, Type from django.core.files.base import File from django.utils.functional import LazyObject class Storage: def open(self, name: str, mode: str = ...) -> File: ... - def save(self, name: Optional[str], content: IO[Any], max_length: Optional[int] = ...) -> str: ... + def save( + self, name: Optional[str], content: IO[Any], max_length: Optional[int] = ... + ) -> str: ... def get_valid_name(self, name: str) -> str: ... def get_available_name(self, name: str, max_length: Optional[int] = ...) -> str: ... def generate_filename(self, filename: str) -> str: ... diff --git a/django-stubs/core/files/uploadedfile.pyi b/django-stubs/core/files/uploadedfile.pyi index 7ef734322..1370da247 100644 --- a/django-stubs/core/files/uploadedfile.pyi +++ b/django-stubs/core/files/uploadedfile.pyi @@ -1,4 +1,4 @@ -from typing import Any, Dict, IO, Optional, Union +from typing import IO, Any, Dict, Optional, Union from django.core.files.base import File @@ -41,6 +41,8 @@ class InMemoryUploadedFile(UploadedFile): ) -> None: ... class SimpleUploadedFile(InMemoryUploadedFile): - def __init__(self, name: str, content: Optional[Union[bytes, str]], content_type: str = ...) -> None: ... + def __init__( + self, name: str, content: Optional[Union[bytes, str]], content_type: str = ... + ) -> None: ... @classmethod def from_dict(cls: Any, file_dict: Dict[str, Union[str, bytes]]) -> None: ... diff --git a/django-stubs/core/files/uploadhandler.pyi b/django-stubs/core/files/uploadhandler.pyi index 1dfe8630e..d5c230e95 100644 --- a/django-stubs/core/files/uploadhandler.pyi +++ b/django-stubs/core/files/uploadhandler.pyi @@ -1,7 +1,8 @@ # Stubs for django.core.files.uploadhandler (Python 3.5) -from typing import Any, Dict, IO, Optional, Tuple -from django.core.files.uploadedfile import UploadedFile, TemporaryUploadedFile +from typing import IO, Any, Dict, Optional, Tuple + +from django.core.files.uploadedfile import TemporaryUploadedFile, UploadedFile from django.http.request import HttpRequest, QueryDict from django.utils.datastructures import MultiValueDict diff --git a/django-stubs/core/handlers/asgi.pyi b/django-stubs/core/handlers/asgi.pyi index 255b021f0..38677d2ba 100644 --- a/django-stubs/core/handlers/asgi.pyi +++ b/django-stubs/core/handlers/asgi.pyi @@ -1,9 +1,8 @@ -from django.core.handlers import base as base -from django.http import ( - HttpRequest as HttpRequest, -) from typing import Any +from django.core.handlers import base as base +from django.http import HttpRequest as HttpRequest + logger: Any class ASGIRequest(HttpRequest): diff --git a/django-stubs/core/handlers/base.pyi b/django-stubs/core/handlers/base.pyi index 93461d15b..ed3c2163a 100644 --- a/django-stubs/core/handlers/base.pyi +++ b/django-stubs/core/handlers/base.pyi @@ -8,6 +8,10 @@ logger: Any class BaseHandler: def load_middleware(self) -> None: ... def make_view_atomic(self, view: Callable) -> Callable: ... - def get_exception_response(self, request: Any, resolver: Any, status_code: Any, exception: Any): ... + def get_exception_response( + self, request: Any, resolver: Any, status_code: Any, exception: Any + ): ... def get_response(self, request: HttpRequest) -> HttpResponseBase: ... - def process_exception_by_middleware(self, exception: Exception, request: HttpRequest) -> HttpResponse: ... + def process_exception_by_middleware( + self, exception: Exception, request: HttpRequest + ) -> HttpResponse: ... diff --git a/django-stubs/core/handlers/exception.pyi b/django-stubs/core/handlers/exception.pyi index ef4de5f7c..a82390ab2 100644 --- a/django-stubs/core/handlers/exception.pyi +++ b/django-stubs/core/handlers/exception.pyi @@ -7,6 +7,10 @@ from django.urls.resolvers import URLResolver def convert_exception_to_response(get_response: Callable) -> Callable: ... def response_for_exception(request: HttpRequest, exc: Exception) -> HttpResponse: ... def get_exception_response( - request: HttpRequest, resolver: URLResolver, status_code: int, exception: Exception, sender: None = ... + request: HttpRequest, + resolver: URLResolver, + status_code: int, + exception: Exception, + sender: None = ..., ) -> HttpResponse: ... def handle_uncaught_exception(request: Any, resolver: Any, exc_info: Any): ... diff --git a/django-stubs/core/handlers/wsgi.pyi b/django-stubs/core/handlers/wsgi.pyi index 4ea28d983..f7d1a8c7a 100644 --- a/django-stubs/core/handlers/wsgi.pyi +++ b/django-stubs/core/handlers/wsgi.pyi @@ -27,7 +27,9 @@ class WSGIRequest(HttpRequest): class WSGIHandler(base.BaseHandler): request_class: Any = ... def __init__(self, *args: Any, **kwargs: Any) -> None: ... - def __call__(self, environ: _WSGIEnviron, start_response: Callable) -> HttpResponse: ... + def __call__( + self, environ: _WSGIEnviron, start_response: Callable + ) -> HttpResponse: ... def get_path_info(environ: _WSGIEnviron) -> str: ... def get_script_name(environ: _WSGIEnviron) -> str: ... diff --git a/django-stubs/core/mail/__init__.pyi b/django-stubs/core/mail/__init__.pyi index 02e762ed7..fa6321e29 100644 --- a/django-stubs/core/mail/__init__.pyi +++ b/django-stubs/core/mail/__init__.pyi @@ -1,17 +1,18 @@ from typing import Any, List, Optional, Tuple -from .message import ( - BadHeaderError as BadHeaderError, - DEFAULT_ATTACHMENT_MIME_TYPE as DEFAULT_ATTACHMENT_MIME_TYPE, - EmailMessage as EmailMessage, - EmailMultiAlternatives as EmailMultiAlternatives, - SafeMIMEMultipart as SafeMIMEMultipart, - SafeMIMEText as SafeMIMEText, - forbid_multi_line_headers as forbid_multi_line_headers, -) -from .utils import CachedDnsName as CachedDnsName, DNS_NAME as DNS_NAME +from .message import DEFAULT_ATTACHMENT_MIME_TYPE as DEFAULT_ATTACHMENT_MIME_TYPE +from .message import BadHeaderError as BadHeaderError +from .message import EmailMessage as EmailMessage +from .message import EmailMultiAlternatives as EmailMultiAlternatives +from .message import SafeMIMEMultipart as SafeMIMEMultipart +from .message import SafeMIMEText as SafeMIMEText +from .message import forbid_multi_line_headers as forbid_multi_line_headers +from .utils import DNS_NAME as DNS_NAME +from .utils import CachedDnsName as CachedDnsName -def get_connection(backend: Optional[str] = ..., fail_silently: bool = ..., **kwds: Any) -> Any: ... +def get_connection( + backend: Optional[str] = ..., fail_silently: bool = ..., **kwds: Any +) -> Any: ... def send_mail( subject: str, message: str, diff --git a/django-stubs/core/mail/backends/base.pyi b/django-stubs/core/mail/backends/base.pyi index 2e3fd0f20..81d430383 100644 --- a/django-stubs/core/mail/backends/base.pyi +++ b/django-stubs/core/mail/backends/base.pyi @@ -1,5 +1,5 @@ import types -from typing import Any, TypeVar, Type, Iterable, Optional +from typing import Any, Iterable, Optional, Type, TypeVar from django.core.mail.message import EmailMessage @@ -11,6 +11,9 @@ class BaseEmailBackend: def close(self) -> None: ... def __enter__(self: _T) -> _T: ... def __exit__( - self, exc_type: Type[BaseException], exc_value: BaseException, traceback: types.TracebackType + self, + exc_type: Type[BaseException], + exc_value: BaseException, + traceback: types.TracebackType, ) -> None: ... def send_messages(self, email_messages: Iterable[EmailMessage]) -> int: ... diff --git a/django-stubs/core/mail/message.pyi b/django-stubs/core/mail/message.pyi index ef98c9c8c..ccc2a1d0f 100644 --- a/django-stubs/core/mail/message.pyi +++ b/django-stubs/core/mail/message.pyi @@ -15,7 +15,9 @@ class BadHeaderError(ValueError): ... ADDRESS_HEADERS: Any -def forbid_multi_line_headers(name: str, val: str, encoding: str) -> Tuple[str, str]: ... +def forbid_multi_line_headers( + name: str, val: str, encoding: str +) -> Tuple[str, str]: ... def split_addr(addr: str, encoding: str) -> Tuple[str, str]: ... def sanitize_address(addr: Union[Tuple[str, str], str], encoding: str) -> str: ... @@ -33,7 +35,9 @@ class SafeMIMEText(MIMEMixin, MIMEText): policy: Policy preamble: None encoding: str = ... - def __init__(self, _text: str, _subtype: str = ..., _charset: str = ...) -> None: ... + def __init__( + self, _text: str, _subtype: str = ..., _charset: str = ... + ) -> None: ... class SafeMIMEMultipart(MIMEMixin, MIMEMultipart): defects: List[Any] @@ -42,12 +46,19 @@ class SafeMIMEMultipart(MIMEMixin, MIMEMultipart): preamble: None encoding: str = ... def __init__( - self, _subtype: str = ..., boundary: None = ..., _subparts: None = ..., encoding: str = ..., **_params: Any + self, + _subtype: str = ..., + boundary: None = ..., + _subparts: None = ..., + encoding: str = ..., + **_params: Any ) -> None: ... _AttachmentContent = Union[bytes, EmailMessage, Message, SafeMIMEText, str] _AttachmentTuple = Union[ - Tuple[str, _AttachmentContent], Tuple[Optional[str], _AttachmentContent, str], Tuple[str, _AttachmentContent, None] + Tuple[str, _AttachmentContent], + Tuple[Optional[str], _AttachmentContent, str], + Tuple[str, _AttachmentContent, None], ] class EmailMessage: @@ -85,9 +96,19 @@ class EmailMessage: @overload def attach(self, filename: MIMEText = ...) -> None: ... @overload - def attach(self, filename: None = ..., content: _AttachmentContent = ..., mimetype: str = ...) -> None: ... + def attach( + self, + filename: None = ..., + content: _AttachmentContent = ..., + mimetype: str = ..., + ) -> None: ... @overload - def attach(self, filename: str = ..., content: _AttachmentContent = ..., mimetype: Optional[str] = ...) -> None: ... + def attach( + self, + filename: str = ..., + content: _AttachmentContent = ..., + mimetype: Optional[str] = ..., + ) -> None: ... def attach_file(self, path: str, mimetype: Optional[str] = ...) -> None: ... class EmailMultiAlternatives(EmailMessage): @@ -107,4 +128,6 @@ class EmailMultiAlternatives(EmailMessage): cc: Optional[Sequence[str]] = ..., reply_to: Optional[Sequence[str]] = ..., ) -> None: ... - def attach_alternative(self, content: _AttachmentContent, mimetype: str) -> None: ... + def attach_alternative( + self, content: _AttachmentContent, mimetype: str + ) -> None: ... diff --git a/django-stubs/core/management/__init__.pyi b/django-stubs/core/management/__init__.pyi index 2b5bef273..e80ef2288 100644 --- a/django-stubs/core/management/__init__.pyi +++ b/django-stubs/core/management/__init__.pyi @@ -1,11 +1,14 @@ from typing import Any, Dict, List, Tuple, Union -from .base import BaseCommand as BaseCommand, CommandError as CommandError +from .base import BaseCommand as BaseCommand +from .base import CommandError as CommandError def find_commands(management_dir: str) -> List[str]: ... def load_command_class(app_name: str, name: str) -> BaseCommand: ... def get_commands() -> Dict[str, str]: ... -def call_command(command_name: Union[Tuple[str], BaseCommand, str], *args: Any, **options: Any) -> str: ... +def call_command( + command_name: Union[Tuple[str], BaseCommand, str], *args: Any, **options: Any +) -> str: ... class ManagementUtility: argv: List[str] = ... diff --git a/django-stubs/core/management/base.pyi b/django-stubs/core/management/base.pyi index ec5896f09..675144be8 100644 --- a/django-stubs/core/management/base.pyi +++ b/django-stubs/core/management/base.pyi @@ -1,6 +1,6 @@ from argparse import ArgumentParser, HelpFormatter, Namespace from io import StringIO, TextIOBase, TextIOWrapper -from typing import Any, Callable, List, Optional, Union, Tuple +from typing import Any, Callable, List, Optional, Tuple, Union from django.apps.config import AppConfig from django.core.management.color import Style @@ -26,12 +26,18 @@ class OutputWrapper(TextIOBase): def style_func(self, style_func: Callable[[str], str]): ... ending: str = ... def __init__( - self, out: Union[StringIO, TextIOWrapper], style_func: Optional[Callable[[str], str]] = ..., ending: str = ... + self, + out: Union[StringIO, TextIOWrapper], + style_func: Optional[Callable[[str], str]] = ..., + ending: str = ..., ) -> None: ... def __getattr__(self, name: str) -> Callable: ... def isatty(self) -> bool: ... def write( # type: ignore[override] - self, msg: str, style_func: Optional[Callable[[str], str]] = ..., ending: Optional[str] = ... + self, + msg: str, + style_func: Optional[Callable[[str], str]] = ..., + ending: Optional[str] = ..., ) -> None: ... class BaseCommand: @@ -52,7 +58,9 @@ class BaseCommand: force_color: bool = ..., ) -> None: ... def get_version(self) -> str: ... - def create_parser(self, prog_name: str, subcommand: str, **kwargs: Any) -> CommandParser: ... + def create_parser( + self, prog_name: str, subcommand: str, **kwargs: Any + ) -> CommandParser: ... def add_arguments(self, parser: CommandParser) -> None: ... def print_help(self, prog_name: str, subcommand: str) -> None: ... def run_from_argv(self, argv: List[str]) -> None: ... diff --git a/django-stubs/core/management/commands/check.pyi b/django-stubs/core/management/commands/check.pyi index ff363ff30..e50296dbf 100644 --- a/django-stubs/core/management/commands/check.pyi +++ b/django-stubs/core/management/commands/check.pyi @@ -1,8 +1,10 @@ +from typing import Any, List + from django.apps import apps as apps from django.core import checks as checks from django.core.checks.registry import registry as registry -from django.core.management.base import BaseCommand as BaseCommand, CommandError as CommandError -from typing import Any, List +from django.core.management.base import BaseCommand as BaseCommand +from django.core.management.base import CommandError as CommandError class Command(BaseCommand): def handle(self, *app_labels: List[str], **options: Any) -> None: ... diff --git a/django-stubs/core/management/commands/compilemessages.pyi b/django-stubs/core/management/commands/compilemessages.pyi index 64fd802fc..11463bf44 100644 --- a/django-stubs/core/management/commands/compilemessages.pyi +++ b/django-stubs/core/management/commands/compilemessages.pyi @@ -1,12 +1,12 @@ import os -from django.core.management.base import ( - BaseCommand as BaseCommand, - CommandError as CommandError, - CommandParser as CommandParser, -) -from django.core.management.utils import find_command as find_command, popen_wrapper as popen_wrapper from typing import List, Tuple, Union +from django.core.management.base import BaseCommand as BaseCommand +from django.core.management.base import CommandError as CommandError +from django.core.management.base import CommandParser as CommandParser +from django.core.management.utils import find_command as find_command +from django.core.management.utils import popen_wrapper as popen_wrapper + _PathType = Union[str, bytes, os.PathLike] def has_bom(fn: _PathType) -> bool: ... @@ -17,4 +17,6 @@ class Command(BaseCommand): program_options: List[str] = ... verbosity: int = ... has_errors: bool = ... - def compile_messages(self, locations: List[Tuple[_PathType, _PathType]]) -> None: ... + def compile_messages( + self, locations: List[Tuple[_PathType, _PathType]] + ) -> None: ... diff --git a/django-stubs/core/management/commands/createcachetable.pyi b/django-stubs/core/management/commands/createcachetable.pyi index e5ca53d9c..4c64f1099 100644 --- a/django-stubs/core/management/commands/createcachetable.pyi +++ b/django-stubs/core/management/commands/createcachetable.pyi @@ -1,16 +1,16 @@ +from typing import Any, List + from django.conf import settings as settings from django.core.cache import caches as caches from django.core.cache.backends.db import BaseDatabaseCache as BaseDatabaseCache -from django.core.management.base import BaseCommand as BaseCommand, CommandError as CommandError -from django.db import ( - DEFAULT_DB_ALIAS as DEFAULT_DB_ALIAS, - DatabaseError as DatabaseError, - connections as connections, - models as models, - router as router, - transaction as transaction, -) -from typing import Any, List +from django.core.management.base import BaseCommand as BaseCommand +from django.core.management.base import CommandError as CommandError +from django.db import DEFAULT_DB_ALIAS as DEFAULT_DB_ALIAS +from django.db import DatabaseError as DatabaseError +from django.db import connections as connections +from django.db import models as models +from django.db import router as router +from django.db import transaction as transaction class Command(BaseCommand): verbosity: int = ... diff --git a/django-stubs/core/management/commands/dbshell.pyi b/django-stubs/core/management/commands/dbshell.pyi index 7a1277e39..7c1fbcc1d 100644 --- a/django-stubs/core/management/commands/dbshell.pyi +++ b/django-stubs/core/management/commands/dbshell.pyi @@ -1,8 +1,7 @@ -from django.core.management.base import ( - BaseCommand as BaseCommand, - CommandError as CommandError, - CommandParser as CommandParser, -) -from django.db import DEFAULT_DB_ALIAS as DEFAULT_DB_ALIAS, connections as connections +from django.core.management.base import BaseCommand as BaseCommand +from django.core.management.base import CommandError as CommandError +from django.core.management.base import CommandParser as CommandParser +from django.db import DEFAULT_DB_ALIAS as DEFAULT_DB_ALIAS +from django.db import connections as connections class Command(BaseCommand): ... diff --git a/django-stubs/core/management/commands/diffsettings.pyi b/django-stubs/core/management/commands/diffsettings.pyi index b5b2229b7..82c39e094 100644 --- a/django-stubs/core/management/commands/diffsettings.pyi +++ b/django-stubs/core/management/commands/diffsettings.pyi @@ -1,12 +1,21 @@ -from django.core.management.base import BaseCommand as BaseCommand from typing import Any, Callable, Dict, List -def module_to_dict(module: Any, omittable: Callable[[str], bool] = ...) -> Dict[str, str]: ... +from django.core.management.base import BaseCommand as BaseCommand + +def module_to_dict( + module: Any, omittable: Callable[[str], bool] = ... +) -> Dict[str, str]: ... class Command(BaseCommand): def output_hash( - self, user_settings: Dict[str, str], default_settings: Dict[str, str], **options: Any + self, + user_settings: Dict[str, str], + default_settings: Dict[str, str], + **options: Any ) -> List[str]: ... def output_unified( - self, user_settings: Dict[str, str], default_settings: Dict[str, str], **options: Any + self, + user_settings: Dict[str, str], + default_settings: Dict[str, str], + **options: Any ) -> List[str]: ... diff --git a/django-stubs/core/management/commands/flush.pyi b/django-stubs/core/management/commands/flush.pyi index 41f123d4e..4b151cad7 100644 --- a/django-stubs/core/management/commands/flush.pyi +++ b/django-stubs/core/management/commands/flush.pyi @@ -1,10 +1,17 @@ -from django.apps import apps as apps -from django.core.management.base import BaseCommand as BaseCommand, CommandError as CommandError -from django.core.management.color import Style, no_style as no_style -from django.core.management.sql import emit_post_migrate_signal as emit_post_migrate_signal, sql_flush as sql_flush -from django.db import DEFAULT_DB_ALIAS as DEFAULT_DB_ALIAS, connections as connections from typing import Tuple +from django.apps import apps as apps +from django.core.management.base import BaseCommand as BaseCommand +from django.core.management.base import CommandError as CommandError +from django.core.management.color import Style +from django.core.management.color import no_style as no_style +from django.core.management.sql import ( + emit_post_migrate_signal as emit_post_migrate_signal, +) +from django.core.management.sql import sql_flush as sql_flush +from django.db import DEFAULT_DB_ALIAS as DEFAULT_DB_ALIAS +from django.db import connections as connections + class Command(BaseCommand): stealth_options: Tuple[str] = ... style: Style = ... diff --git a/django-stubs/core/management/commands/inspectdb.pyi b/django-stubs/core/management/commands/inspectdb.pyi index de0e24d5e..4f28d3b09 100644 --- a/django-stubs/core/management/commands/inspectdb.pyi +++ b/django-stubs/core/management/commands/inspectdb.pyi @@ -1,8 +1,11 @@ -from django.core.management.base import BaseCommand as BaseCommand, CommandError as CommandError -from django.db import DEFAULT_DB_ALIAS as DEFAULT_DB_ALIAS, connections as connections -from django.db.models.constants import LOOKUP_SEP as LOOKUP_SEP from typing import Any, Dict, Iterable, List, Tuple +from django.core.management.base import BaseCommand as BaseCommand +from django.core.management.base import CommandError as CommandError +from django.db import DEFAULT_DB_ALIAS as DEFAULT_DB_ALIAS +from django.db import connections as connections +from django.db.models.constants import LOOKUP_SEP as LOOKUP_SEP + class Command(BaseCommand): stealth_options: Tuple[str] = ... db_module: str = ... @@ -10,7 +13,14 @@ class Command(BaseCommand): def normalize_col_name( self, col_name: str, used_column_names: List[str], is_relation: bool ) -> Tuple[str, Dict[str, str], List[str]]: ... - def get_field_type(self, connection: Any, table_name: Any, row: Any) -> Tuple[str, Dict[str, str], List[str]]: ... + def get_field_type( + self, connection: Any, table_name: Any, row: Any + ) -> Tuple[str, Dict[str, str], List[str]]: ... def get_meta( - self, table_name: str, constraints: Any, column_to_field_name: Any, is_view: Any, is_partition: Any + self, + table_name: str, + constraints: Any, + column_to_field_name: Any, + is_view: Any, + is_partition: Any, ) -> List[str]: ... diff --git a/django-stubs/core/management/commands/makemessages.pyi b/django-stubs/core/management/commands/makemessages.pyi index 8f8e5fdd5..cbcad756e 100644 --- a/django-stubs/core/management/commands/makemessages.pyi +++ b/django-stubs/core/management/commands/makemessages.pyi @@ -12,14 +12,18 @@ class TranslatableFile: dirpath: str file_name: str locale_dir: str - def __init__(self, dirpath: str, file_name: str, locale_dir: Optional[str]) -> None: ... + def __init__( + self, dirpath: str, file_name: str, locale_dir: Optional[str] + ) -> None: ... class BuildFile: """ Represent the state of a translatable file during the build process. """ - def __init__(self, command: BaseCommand, domain: str, translatable: TranslatableFile) -> None: ... + def __init__( + self, command: BaseCommand, domain: str, translatable: TranslatableFile + ) -> None: ... @property def is_templatized(self) -> bool: ... @property diff --git a/django-stubs/core/management/commands/makemigrations.pyi b/django-stubs/core/management/commands/makemigrations.pyi index d8390c506..bcd0ca723 100644 --- a/django-stubs/core/management/commands/makemigrations.pyi +++ b/django-stubs/core/management/commands/makemigrations.pyi @@ -1,28 +1,31 @@ +from typing import Any, Dict + from django.apps import apps as apps from django.conf import settings as settings -from django.core.management.base import ( - BaseCommand as BaseCommand, - CommandError as CommandError, - no_translations as no_translations, -) -from django.db import ( - DEFAULT_DB_ALIAS as DEFAULT_DB_ALIAS, - OperationalError as OperationalError, - connections as connections, - router as router, -) +from django.core.management.base import BaseCommand as BaseCommand +from django.core.management.base import CommandError as CommandError +from django.core.management.base import no_translations as no_translations +from django.db import DEFAULT_DB_ALIAS as DEFAULT_DB_ALIAS +from django.db import OperationalError as OperationalError +from django.db import connections as connections +from django.db import router as router from django.db.migrations import Migration as Migration -from django.db.migrations.autodetector import MigrationAutodetector as MigrationAutodetector +from django.db.migrations.autodetector import ( + MigrationAutodetector as MigrationAutodetector, +) from django.db.migrations.loader import MigrationLoader as MigrationLoader from django.db.migrations.questioner import ( InteractiveMigrationQuestioner as InteractiveMigrationQuestioner, - MigrationQuestioner as MigrationQuestioner, +) +from django.db.migrations.questioner import MigrationQuestioner as MigrationQuestioner +from django.db.migrations.questioner import ( NonInteractiveMigrationQuestioner as NonInteractiveMigrationQuestioner, ) from django.db.migrations.state import ProjectState as ProjectState -from django.db.migrations.utils import get_migration_name_timestamp as get_migration_name_timestamp +from django.db.migrations.utils import ( + get_migration_name_timestamp as get_migration_name_timestamp, +) from django.db.migrations.writer import MigrationWriter as MigrationWriter -from typing import Any, Dict class Command(BaseCommand): verbosity: int = ... @@ -33,4 +36,6 @@ class Command(BaseCommand): migration_name: str = ... include_header: bool = ... def write_migration_files(self, changes: Dict[str, Any]) -> None: ... - def handle_merge(self, loader: MigrationLoader, conflicts: Dict[str, Any]) -> None: ... + def handle_merge( + self, loader: MigrationLoader, conflicts: Dict[str, Any] + ) -> None: ... diff --git a/django-stubs/core/management/commands/migrate.pyi b/django-stubs/core/management/commands/migrate.pyi index 17c432e3d..73e5ea58a 100644 --- a/django-stubs/core/management/commands/migrate.pyi +++ b/django-stubs/core/management/commands/migrate.pyi @@ -1,28 +1,36 @@ +from typing import Any, List, Optional + from django.apps import apps as apps -from django.core.management.base import ( - BaseCommand as BaseCommand, - CommandError as CommandError, - no_translations as no_translations, -) +from django.core.management.base import BaseCommand as BaseCommand +from django.core.management.base import CommandError as CommandError +from django.core.management.base import no_translations as no_translations from django.core.management.sql import ( emit_post_migrate_signal as emit_post_migrate_signal, +) +from django.core.management.sql import ( emit_pre_migrate_signal as emit_pre_migrate_signal, ) -from django.db import DEFAULT_DB_ALIAS as DEFAULT_DB_ALIAS, connections as connections, router as router -from django.db.migrations.autodetector import MigrationAutodetector as MigrationAutodetector +from django.db import DEFAULT_DB_ALIAS as DEFAULT_DB_ALIAS +from django.db import connections as connections +from django.db import router as router +from django.db.migrations.autodetector import ( + MigrationAutodetector as MigrationAutodetector, +) from django.db.migrations.executor import MigrationExecutor as MigrationExecutor from django.db.migrations.loader import AmbiguityError as AmbiguityError from django.db.migrations.operations.base import Operation -from django.db.migrations.state import ModelState as ModelState, ProjectState as ProjectState +from django.db.migrations.state import ModelState as ModelState +from django.db.migrations.state import ProjectState as ProjectState from django.utils.module_loading import module_has_submodule as module_has_submodule from django.utils.text import Truncator as Truncator -from typing import Any, List, Optional class Command(BaseCommand): verbosity: int = ... interactive: bool = ... start: float = ... - def migration_progress_callback(self, action: str, migration: Optional[Any] = ..., fake: bool = ...) -> None: ... + def migration_progress_callback( + self, action: str, migration: Optional[Any] = ..., fake: bool = ... + ) -> None: ... def sync_apps(self, connection: Any, app_labels: List[str]) -> None: ... @staticmethod def describe_operation(operation: Operation, backwards: bool) -> str: ... diff --git a/django-stubs/core/management/commands/sendtestemail.pyi b/django-stubs/core/management/commands/sendtestemail.pyi index 8e7058afa..6cda8b1fb 100644 --- a/django-stubs/core/management/commands/sendtestemail.pyi +++ b/django-stubs/core/management/commands/sendtestemail.pyi @@ -1,4 +1,6 @@ -from django.core.mail import mail_admins as mail_admins, mail_managers as mail_managers, send_mail as send_mail +from django.core.mail import mail_admins as mail_admins +from django.core.mail import mail_managers as mail_managers +from django.core.mail import send_mail as send_mail from django.core.management.base import BaseCommand as BaseCommand from django.utils import timezone as timezone diff --git a/django-stubs/core/management/commands/shell.pyi b/django-stubs/core/management/commands/shell.pyi index 4fbb76bed..73cced3ad 100644 --- a/django-stubs/core/management/commands/shell.pyi +++ b/django-stubs/core/management/commands/shell.pyi @@ -1,7 +1,9 @@ -from django.core.management import BaseCommand as BaseCommand, CommandError as CommandError -from django.utils.datastructures import OrderedSet as OrderedSet from typing import Any, List +from django.core.management import BaseCommand as BaseCommand +from django.core.management import CommandError as CommandError +from django.utils.datastructures import OrderedSet as OrderedSet + class Command(BaseCommand): shells: List[str] = ... def ipython(self, options: Any) -> None: ... diff --git a/django-stubs/core/management/commands/showmigrations.pyi b/django-stubs/core/management/commands/showmigrations.pyi index 52272e6a3..572f1800f 100644 --- a/django-stubs/core/management/commands/showmigrations.pyi +++ b/django-stubs/core/management/commands/showmigrations.pyi @@ -1,10 +1,16 @@ +from typing import Any, List, Optional + from django.apps import apps as apps from django.core.management.base import BaseCommand as BaseCommand -from django.db import DEFAULT_DB_ALIAS as DEFAULT_DB_ALIAS, connections as connections +from django.db import DEFAULT_DB_ALIAS as DEFAULT_DB_ALIAS +from django.db import connections as connections from django.db.migrations.loader import MigrationLoader as MigrationLoader -from typing import Any, List, Optional class Command(BaseCommand): verbosity: int = ... - def show_list(self, connection: Any, app_names: Optional[List[str]] = ...) -> None: ... - def show_plan(self, connection: Any, app_names: Optional[List[str]] = ...) -> None: ... + def show_list( + self, connection: Any, app_names: Optional[List[str]] = ... + ) -> None: ... + def show_plan( + self, connection: Any, app_names: Optional[List[str]] = ... + ) -> None: ... diff --git a/django-stubs/core/management/commands/sqlflush.pyi b/django-stubs/core/management/commands/sqlflush.pyi index 3d2b99c5d..74bbc7c2a 100644 --- a/django-stubs/core/management/commands/sqlflush.pyi +++ b/django-stubs/core/management/commands/sqlflush.pyi @@ -1,6 +1,7 @@ from django.core.management.base import BaseCommand as BaseCommand from django.core.management.sql import sql_flush as sql_flush -from django.db import DEFAULT_DB_ALIAS as DEFAULT_DB_ALIAS, connections as connections +from django.db import DEFAULT_DB_ALIAS as DEFAULT_DB_ALIAS +from django.db import connections as connections class Command(BaseCommand): output_transaction: bool = ... diff --git a/django-stubs/core/management/commands/sqlmigrate.pyi b/django-stubs/core/management/commands/sqlmigrate.pyi index 8223ce336..febeff5a2 100644 --- a/django-stubs/core/management/commands/sqlmigrate.pyi +++ b/django-stubs/core/management/commands/sqlmigrate.pyi @@ -1,9 +1,13 @@ -from django.apps import apps as apps -from django.core.management.base import BaseCommand as BaseCommand, CommandError as CommandError -from django.db import DEFAULT_DB_ALIAS as DEFAULT_DB_ALIAS, connections as connections -from django.db.migrations.loader import AmbiguityError as AmbiguityError, MigrationLoader as MigrationLoader from typing import Any +from django.apps import apps as apps +from django.core.management.base import BaseCommand as BaseCommand +from django.core.management.base import CommandError as CommandError +from django.db import DEFAULT_DB_ALIAS as DEFAULT_DB_ALIAS +from django.db import connections as connections +from django.db.migrations.loader import AmbiguityError as AmbiguityError +from django.db.migrations.loader import MigrationLoader as MigrationLoader + class Command(BaseCommand): output_transaction: bool = ... def execute(self, *args: Any, **options: Any): ... diff --git a/django-stubs/core/management/commands/sqlsequencereset.pyi b/django-stubs/core/management/commands/sqlsequencereset.pyi index 9ffc546b2..018ecf4fc 100644 --- a/django-stubs/core/management/commands/sqlsequencereset.pyi +++ b/django-stubs/core/management/commands/sqlsequencereset.pyi @@ -1,4 +1,5 @@ from django.core.management.base import AppCommand as AppCommand -from django.db import DEFAULT_DB_ALIAS as DEFAULT_DB_ALIAS, connections as connections +from django.db import DEFAULT_DB_ALIAS as DEFAULT_DB_ALIAS +from django.db import connections as connections class Command(AppCommand): ... diff --git a/django-stubs/core/management/commands/squashmigrations.pyi b/django-stubs/core/management/commands/squashmigrations.pyi index 27a81d61e..b15c328d9 100644 --- a/django-stubs/core/management/commands/squashmigrations.pyi +++ b/django-stubs/core/management/commands/squashmigrations.pyi @@ -1,9 +1,13 @@ from django.apps import apps as apps from django.conf import settings as settings -from django.core.management.base import BaseCommand as BaseCommand, CommandError as CommandError -from django.db import DEFAULT_DB_ALIAS as DEFAULT_DB_ALIAS, connections as connections, migrations as migrations +from django.core.management.base import BaseCommand as BaseCommand +from django.core.management.base import CommandError as CommandError +from django.db import DEFAULT_DB_ALIAS as DEFAULT_DB_ALIAS +from django.db import connections as connections +from django.db import migrations as migrations +from django.db.migrations.loader import AmbiguityError as AmbiguityError +from django.db.migrations.loader import MigrationLoader as MigrationLoader from django.db.migrations.migration import Migration -from django.db.migrations.loader import AmbiguityError as AmbiguityError, MigrationLoader as MigrationLoader from django.db.migrations.migration import SwappableTuple as SwappableTuple from django.db.migrations.optimizer import MigrationOptimizer as MigrationOptimizer from django.db.migrations.writer import MigrationWriter as MigrationWriter @@ -12,4 +16,6 @@ from django.utils.version import get_docs_version as get_docs_version class Command(BaseCommand): verbosity: int = ... interactive: bool = ... - def find_migration(self, loader: MigrationLoader, app_label: str, name: str) -> Migration: ... + def find_migration( + self, loader: MigrationLoader, app_label: str, name: str + ) -> Migration: ... diff --git a/django-stubs/core/management/commands/startapp.pyi b/django-stubs/core/management/commands/startapp.pyi index 2c0b011cd..0bd549a50 100644 --- a/django-stubs/core/management/commands/startapp.pyi +++ b/django-stubs/core/management/commands/startapp.pyi @@ -1,5 +1,6 @@ -from django.core.management.templates import TemplateCommand as TemplateCommand from typing import Any +from django.core.management.templates import TemplateCommand as TemplateCommand + class Command(TemplateCommand): missing_args_message: str = ... diff --git a/django-stubs/core/management/commands/startproject.pyi b/django-stubs/core/management/commands/startproject.pyi index 9adf94625..9111c5e84 100644 --- a/django-stubs/core/management/commands/startproject.pyi +++ b/django-stubs/core/management/commands/startproject.pyi @@ -1,5 +1,6 @@ -from ..utils import get_random_secret_key as get_random_secret_key from django.core.management.templates import TemplateCommand as TemplateCommand +from ..utils import get_random_secret_key as get_random_secret_key + class Command(TemplateCommand): missing_args_message: str = ... diff --git a/django-stubs/core/management/commands/test.pyi b/django-stubs/core/management/commands/test.pyi index da74c45af..e325ca3db 100644 --- a/django-stubs/core/management/commands/test.pyi +++ b/django-stubs/core/management/commands/test.pyi @@ -1,8 +1,11 @@ +from typing import Any + from django.conf import settings as settings from django.core.management.base import BaseCommand as BaseCommand -from django.core.management.utils import get_command_line_option as get_command_line_option +from django.core.management.utils import ( + get_command_line_option as get_command_line_option, +) from django.test.utils import get_runner as get_runner -from typing import Any class Command(BaseCommand): test_runner: Any = ... diff --git a/django-stubs/core/management/sql.pyi b/django-stubs/core/management/sql.pyi index 8798e12b0..95b0a1a24 100644 --- a/django-stubs/core/management/sql.pyi +++ b/django-stubs/core/management/sql.pyi @@ -3,7 +3,15 @@ from typing import Any, List from django.core.management.color import Style def sql_flush( - style: Style, connection: Any, only_django: bool = ..., reset_sequences: bool = ..., allow_cascade: bool = ... + style: Style, + connection: Any, + only_django: bool = ..., + reset_sequences: bool = ..., + allow_cascade: bool = ..., ) -> List[str]: ... -def emit_pre_migrate_signal(verbosity: int, interactive: bool, db: str, **kwargs: Any) -> None: ... -def emit_post_migrate_signal(verbosity: int, interactive: bool, db: str, **kwargs: Any) -> None: ... +def emit_pre_migrate_signal( + verbosity: int, interactive: bool, db: str, **kwargs: Any +) -> None: ... +def emit_post_migrate_signal( + verbosity: int, interactive: bool, db: str, **kwargs: Any +) -> None: ... diff --git a/django-stubs/core/management/utils.pyi b/django-stubs/core/management/utils.pyi index cf84aa69d..4da7d0861 100644 --- a/django-stubs/core/management/utils.pyi +++ b/django-stubs/core/management/utils.pyi @@ -3,9 +3,15 @@ from typing import Any, List, Optional, Set, Tuple, Type from django.apps.config import AppConfig from django.db.models.base import Model -def popen_wrapper(args: List[str], stdout_encoding: str = ...) -> Tuple[str, str, int]: ... +def popen_wrapper( + args: List[str], stdout_encoding: str = ... +) -> Tuple[str, str, int]: ... def handle_extensions(extensions: List[str]) -> Set[str]: ... -def find_command(cmd: str, path: Optional[str] = ..., pathext: Optional[str] = ...) -> Optional[str]: ... +def find_command( + cmd: str, path: Optional[str] = ..., pathext: Optional[str] = ... +) -> Optional[str]: ... def get_random_secret_key(): ... -def parse_apps_and_model_labels(labels: List[str]) -> Tuple[Set[Type[Model]], Set[AppConfig]]: ... +def parse_apps_and_model_labels( + labels: List[str], +) -> Tuple[Set[Type[Model]], Set[AppConfig]]: ... def get_command_line_option(argv: Any, option: Any): ... diff --git a/django-stubs/core/serializers/__init__.pyi b/django-stubs/core/serializers/__init__.pyi index 35305be2a..813c9431b 100644 --- a/django-stubs/core/serializers/__init__.pyi +++ b/django-stubs/core/serializers/__init__.pyi @@ -2,15 +2,13 @@ from typing import Any, Callable, Dict, Iterable, Iterator, List, Optional, Type from django.db.models.base import Model -from .base import ( - DeserializationError as DeserializationError, - DeserializedObject, - Deserializer as Deserializer, - M2MDeserializationError as M2MDeserializationError, - SerializationError as SerializationError, - Serializer as Serializer, - SerializerDoesNotExist as SerializerDoesNotExist, -) +from .base import DeserializationError as DeserializationError +from .base import DeserializedObject +from .base import Deserializer as Deserializer +from .base import M2MDeserializationError as M2MDeserializationError +from .base import SerializationError as SerializationError +from .base import Serializer as Serializer +from .base import SerializerDoesNotExist as SerializerDoesNotExist BUILTIN_SERIALIZERS: Any @@ -20,12 +18,16 @@ class BadSerializer: def __init__(self, exception: BaseException) -> None: ... def __call__(self, *args: Any, **kwargs: Any) -> Any: ... -def register_serializer(format: str, serializer_module: str, serializers: Optional[Dict[str, Any]] = ...) -> None: ... +def register_serializer( + format: str, serializer_module: str, serializers: Optional[Dict[str, Any]] = ... +) -> None: ... def unregister_serializer(format: str) -> None: ... def get_serializer(format: str) -> Union[Type[Serializer], BadSerializer]: ... def get_serializer_formats() -> List[str]: ... def get_public_serializer_formats() -> List[str]: ... def get_deserializer(format: str) -> Union[Callable, Type[Deserializer]]: ... def serialize(format: str, queryset: Iterable[Model], **options: Any) -> Any: ... -def deserialize(format: str, stream_or_string: Any, **options: Any) -> Iterator[DeserializedObject]: ... +def deserialize( + format: str, stream_or_string: Any, **options: Any +) -> Iterator[DeserializedObject]: ... def sort_dependencies(app_list: Iterable[Any]) -> List[Type[Model]]: ... diff --git a/django-stubs/core/serializers/base.pyi b/django-stubs/core/serializers/base.pyi index a910132f6..b9ad37a0d 100644 --- a/django-stubs/core/serializers/base.pyi +++ b/django-stubs/core/serializers/base.pyi @@ -1,13 +1,12 @@ from datetime import date from io import BufferedReader, StringIO, TextIOWrapper -from typing import Any, Dict, Iterable, List, Mapping, Optional, Type, Union, Collection +from typing import Any, Collection, Dict, Iterable, List, Mapping, Optional, Type, Union from uuid import UUID from django.core.management.base import OutputWrapper from django.db.models.base import Model -from django.db.models.fields.related import ForeignKey, ManyToManyField - from django.db.models.fields import Field +from django.db.models.fields.related import ForeignKey, ManyToManyField class SerializerDoesNotExist(KeyError): ... class SerializationError(Exception): ... @@ -15,7 +14,11 @@ class SerializationError(Exception): ... class DeserializationError(Exception): @classmethod def WithData( - cls, original_exc: Exception, model: str, fk: Union[int, str], field_value: Optional[Union[List[str], str]] + cls, + original_exc: Exception, + model: str, + fk: Union[int, str], + field_value: Optional[Union[List[str], str]], ) -> DeserializationError: ... class M2MDeserializationError(Exception): @@ -28,7 +31,9 @@ class ProgressBar: output: None = ... total_count: int = ... prev_done: int = ... - def __init__(self, output: Optional[Union[StringIO, OutputWrapper]], total_count: int) -> None: ... + def __init__( + self, output: Optional[Union[StringIO, OutputWrapper]], total_count: int + ) -> None: ... def update(self, count: int) -> None: ... class Serializer: @@ -65,7 +70,11 @@ class Serializer: class Deserializer: options: Dict[str, Any] = ... stream: Any = ... - def __init__(self, stream_or_string: Union[BufferedReader, TextIOWrapper, str], **options: Any) -> None: ... + def __init__( + self, + stream_or_string: Union[BufferedReader, TextIOWrapper, str], + **options: Any + ) -> None: ... def __iter__(self) -> Deserializer: ... def __next__(self) -> None: ... @@ -79,9 +88,15 @@ class DeserializedObject: m2m_data: Optional[Dict[str, List[int]]] = ..., deferred_fields: Optional[Mapping[Field, Any]] = ..., ) -> None: ... - def save(self, save_m2m: bool = ..., using: Optional[str] = ..., **kwargs: Any) -> None: ... + def save( + self, save_m2m: bool = ..., using: Optional[str] = ..., **kwargs: Any + ) -> None: ... def save_deferred_fields(self, using: Optional[str] = ...) -> None: ... -def build_instance(Model: Type[Model], data: Dict[str, Optional[Union[date, int, str, UUID]]], db: str) -> Model: ... -def deserialize_m2m_values(field: ManyToManyField, field_value: Any, using: str) -> List[Any]: ... +def build_instance( + Model: Type[Model], data: Dict[str, Optional[Union[date, int, str, UUID]]], db: str +) -> Model: ... +def deserialize_m2m_values( + field: ManyToManyField, field_value: Any, using: str +) -> List[Any]: ... def deserialize_fk_value(field: ForeignKey, field_value: Any, using: str) -> Any: ... diff --git a/django-stubs/core/serializers/python.pyi b/django-stubs/core/serializers/python.pyi index a348e49ab..e8777e14f 100644 --- a/django-stubs/core/serializers/python.pyi +++ b/django-stubs/core/serializers/python.pyi @@ -1,15 +1,18 @@ from collections import OrderedDict from typing import Any, Dict, Iterator, List, Optional +from django.core.serializers import base from django.core.serializers.base import DeserializedObject from django.db.models.base import Model -from django.core.serializers import base - class Serializer(base.Serializer): objects: List[Any] = ... def get_dump_object(self, obj: Model) -> OrderedDict: ... def Deserializer( - object_list: List[Dict[str, Any]], *, using: Optional[str] = ..., ignorenonexistent: bool = ..., **options: Any + object_list: List[Dict[str, Any]], + *, + using: Optional[str] = ..., + ignorenonexistent: bool = ..., + **options: Any ) -> Iterator[DeserializedObject]: ... diff --git a/django-stubs/core/serializers/pyyaml.pyi b/django-stubs/core/serializers/pyyaml.pyi index 8e084b766..0c88f3fe1 100644 --- a/django-stubs/core/serializers/pyyaml.pyi +++ b/django-stubs/core/serializers/pyyaml.pyi @@ -1,5 +1,6 @@ -from django.core.serializers.python import Serializer as PythonSerializer from typing import Any + +from django.core.serializers.python import Serializer as PythonSerializer from yaml import CSafeDumper as SafeDumper class DjangoSafeDumper(SafeDumper): diff --git a/django-stubs/core/serializers/xml_serializer.pyi b/django-stubs/core/serializers/xml_serializer.pyi index e81e07aed..5e3642e20 100644 --- a/django-stubs/core/serializers/xml_serializer.pyi +++ b/django-stubs/core/serializers/xml_serializer.pyi @@ -1,7 +1,8 @@ -from django.core.serializers import base as base from typing import Any from xml.sax.expatreader import ExpatParser as _ExpatParser # type: ignore +from django.core.serializers import base as base + class Serializer(base.Serializer): def indent(self, level: Any) -> None: ... xml: Any = ... @@ -19,7 +20,12 @@ class Deserializer(base.Deserializer): db: Any = ... ignore: Any = ... def __init__( - self, stream_or_string: Any, *, using: Any = ..., ignorenonexistent: bool = ..., **options: Any + self, + stream_or_string: Any, + *, + using: Any = ..., + ignorenonexistent: bool = ..., + **options: Any ) -> None: ... def __next__(self): ... @@ -27,12 +33,25 @@ def getInnerText(node: Any): ... class DefusedExpatParser(_ExpatParser): def __init__(self, *args: Any, **kwargs: Any) -> None: ... - def start_doctype_decl(self, name: Any, sysid: Any, pubid: Any, has_internal_subset: Any) -> None: ... + def start_doctype_decl( + self, name: Any, sysid: Any, pubid: Any, has_internal_subset: Any + ) -> None: ... def entity_decl( - self, name: Any, is_parameter_entity: Any, value: Any, base: Any, sysid: Any, pubid: Any, notation_name: Any + self, + name: Any, + is_parameter_entity: Any, + value: Any, + base: Any, + sysid: Any, + pubid: Any, + notation_name: Any, + ) -> None: ... + def unparsed_entity_decl( + self, name: Any, base: Any, sysid: Any, pubid: Any, notation_name: Any + ) -> None: ... + def external_entity_ref_handler( + self, context: Any, base: Any, sysid: Any, pubid: Any ) -> None: ... - def unparsed_entity_decl(self, name: Any, base: Any, sysid: Any, pubid: Any, notation_name: Any) -> None: ... - def external_entity_ref_handler(self, context: Any, base: Any, sysid: Any, pubid: Any) -> None: ... def reset(self) -> None: ... class DefusedXmlException(ValueError): ... @@ -50,7 +69,15 @@ class EntitiesForbidden(DefusedXmlException): sysid: Any = ... pubid: Any = ... notation_name: Any = ... - def __init__(self, name: Any, value: Any, base: Any, sysid: Any, pubid: Any, notation_name: Any) -> None: ... + def __init__( + self, + name: Any, + value: Any, + base: Any, + sysid: Any, + pubid: Any, + notation_name: Any, + ) -> None: ... class ExternalReferenceForbidden(DefusedXmlException): context: Any = ... diff --git a/django-stubs/core/servers/basehttp.pyi b/django-stubs/core/servers/basehttp.pyi index e16d5b85b..d4a6109f1 100644 --- a/django-stubs/core/servers/basehttp.pyi +++ b/django-stubs/core/servers/basehttp.pyi @@ -3,14 +3,20 @@ from io import BytesIO from typing import Any, Dict from wsgiref import simple_server -from django.core.handlers.wsgi import WSGIRequest, WSGIHandler +from django.core.handlers.wsgi import WSGIHandler, WSGIRequest from django.core.wsgi import get_wsgi_application as get_wsgi_application # noqa: F401 class WSGIServer(simple_server.WSGIServer): request_queue_size: int = ... address_family: Any = ... allow_reuse_address: Any = ... - def __init__(self, *args: Any, ipv6: bool = ..., allow_reuse_address: bool = ..., **kwargs: Any) -> None: ... + def __init__( + self, + *args: Any, + ipv6: bool = ..., + allow_reuse_address: bool = ..., + **kwargs: Any + ) -> None: ... def handle_error(self, request: Any, client_address: Any) -> None: ... class ThreadedWSGIServer(socketserver.ThreadingMixIn, WSGIServer): ... diff --git a/django-stubs/core/signing.pyi b/django-stubs/core/signing.pyi index 16d64c045..a84c2607b 100644 --- a/django-stubs/core/signing.pyi +++ b/django-stubs/core/signing.pyi @@ -18,7 +18,11 @@ class JSONSerializer: def loads(self, data: bytes) -> Dict[str, Union[int, str]]: ... def dumps( - obj: Any, key: None = ..., salt: str = ..., serializer: Type[Serializer] = ..., compress: bool = ... + obj: Any, + key: None = ..., + salt: str = ..., + serializer: Type[Serializer] = ..., + compress: bool = ..., ) -> str: ... def loads( s: str, @@ -32,11 +36,18 @@ class Signer: key: str = ... sep: str = ... salt: str = ... - def __init__(self, key: Optional[Union[bytes, str]] = ..., sep: str = ..., salt: Optional[str] = ...) -> None: ... + def __init__( + self, + key: Optional[Union[bytes, str]] = ..., + sep: str = ..., + salt: Optional[str] = ..., + ) -> None: ... def signature(self, value: Union[bytes, str]) -> str: ... def sign(self, value: str) -> str: ... def unsign(self, signed_value: str) -> str: ... class TimestampSigner(Signer): def timestamp(self) -> str: ... - def unsign(self, value: str, max_age: Optional[Union[int, timedelta]] = ...) -> str: ... + def unsign( + self, value: str, max_age: Optional[Union[int, timedelta]] = ... + ) -> str: ... diff --git a/django-stubs/core/validators.pyi b/django-stubs/core/validators.pyi index 1868ac187..d178ca918 100644 --- a/django-stubs/core/validators.pyi +++ b/django-stubs/core/validators.pyi @@ -1,6 +1,16 @@ from decimal import Decimal from re import RegexFlag -from typing import Any, Callable, Collection, Dict, List, Optional, Pattern, Tuple, Union +from typing import ( + Any, + Callable, + Collection, + Dict, + List, + Optional, + Pattern, + Tuple, + Union, +) from django.core.files.base import File @@ -36,7 +46,9 @@ class URLValidator(RegexValidator): tld_re: str = ... host_re: str = ... schemes: List[str] = ... - def __init__(self, schemes: Optional[Collection[str]] = ..., **kwargs: Any) -> None: ... + def __init__( + self, schemes: Optional[Collection[str]] = ..., **kwargs: Any + ) -> None: ... integer_validator: RegexValidator = ... @@ -73,7 +85,10 @@ ip_address_validator_map: Dict[str, _IPValidator] def ip_address_validators(protocol: str, unpack_ipv4: bool) -> _IPValidator: ... def int_list_validator( - sep: str = ..., message: Optional[_ErrorMessage] = ..., code: str = ..., allow_negative: bool = ... + sep: str = ..., + message: Optional[_ErrorMessage] = ..., + code: str = ..., + allow_negative: bool = ..., ) -> RegexValidator: ... validate_comma_separated_integer_list: Any @@ -82,7 +97,9 @@ class BaseValidator: message: str = ... code: str = ... limit_value: Any = ... - def __init__(self, limit_value: Any, message: Optional[_ErrorMessage] = ...) -> None: ... + def __init__( + self, limit_value: Any, message: Optional[_ErrorMessage] = ... + ) -> None: ... def __call__(self, value: Any) -> None: ... def compare(self, a: Any, b: Any) -> bool: ... def clean(self, x: Any) -> Any: ... @@ -96,7 +113,11 @@ class DecimalValidator: messages: Dict[str, str] = ... max_digits: int = ... decimal_places: int = ... - def __init__(self, max_digits: Optional[Union[int, str]], decimal_places: Optional[Union[int, str]]) -> None: ... + def __init__( + self, + max_digits: Optional[Union[int, str]], + decimal_places: Optional[Union[int, str]], + ) -> None: ... def __call__(self, value: Decimal) -> None: ... class FileExtensionValidator: @@ -117,5 +138,7 @@ def validate_image_file_extension(value: File) -> None: ... class ProhibitNullCharactersValidator: message: str = ... code: str = ... - def __init__(self, message: Optional[_ErrorMessage] = ..., code: Optional[str] = ...) -> None: ... + def __init__( + self, message: Optional[_ErrorMessage] = ..., code: Optional[str] = ... + ) -> None: ... def __call__(self, value: Any) -> None: ... diff --git a/django-stubs/db/__init__.pyi b/django-stubs/db/__init__.pyi index 5211356a5..a974ffdb1 100644 --- a/django-stubs/db/__init__.pyi +++ b/django-stubs/db/__init__.pyi @@ -1,22 +1,19 @@ from typing import Any -from .utils import ( - DEFAULT_DB_ALIAS as DEFAULT_DB_ALIAS, - DJANGO_VERSION_PICKLE_KEY as DJANGO_VERSION_PICKLE_KEY, - ProgrammingError as ProgrammingError, - IntegrityError as IntegrityError, - OperationalError as OperationalError, - DatabaseError as DatabaseError, - DataError as DataError, - NotSupportedError as NotSupportedError, - InternalError as InternalError, - InterfaceError as InterfaceError, - ConnectionHandler as ConnectionHandler, - Error as Error, - ConnectionDoesNotExist as ConnectionDoesNotExist, -) - from . import migrations +from .utils import DEFAULT_DB_ALIAS as DEFAULT_DB_ALIAS +from .utils import DJANGO_VERSION_PICKLE_KEY as DJANGO_VERSION_PICKLE_KEY +from .utils import ConnectionDoesNotExist as ConnectionDoesNotExist +from .utils import ConnectionHandler as ConnectionHandler +from .utils import DatabaseError as DatabaseError +from .utils import DataError as DataError +from .utils import Error as Error +from .utils import IntegrityError as IntegrityError +from .utils import InterfaceError as InterfaceError +from .utils import InternalError as InternalError +from .utils import NotSupportedError as NotSupportedError +from .utils import OperationalError as OperationalError +from .utils import ProgrammingError as ProgrammingError connections: Any router: Any diff --git a/django-stubs/db/backends/base/base.pyi b/django-stubs/db/backends/base/base.pyi index eafdad550..1e40329cb 100644 --- a/django-stubs/db/backends/base/base.pyi +++ b/django-stubs/db/backends/base/base.pyi @@ -2,14 +2,11 @@ from typing import Any, Callable, Dict, Iterator, List, Optional from django.db.backends.base.client import BaseDatabaseClient from django.db.backends.base.creation import BaseDatabaseCreation -from django.db.backends.base.validation import BaseDatabaseValidation -from django.db.backends.utils import CursorDebugWrapper, CursorWrapper - -from django.db.backends.base.schema import BaseDatabaseSchemaEditor - from django.db.backends.base.features import BaseDatabaseFeatures - from django.db.backends.base.introspection import BaseDatabaseIntrospection +from django.db.backends.base.schema import BaseDatabaseSchemaEditor +from django.db.backends.base.validation import BaseDatabaseValidation +from django.db.backends.utils import CursorDebugWrapper, CursorWrapper NO_DB_ALIAS: str @@ -52,7 +49,10 @@ class BaseDatabaseWrapper: introspection: BaseDatabaseIntrospection = ... validation: BaseDatabaseValidation = ... def __init__( - self, settings_dict: Dict[str, Dict[str, str]], alias: str = ..., allow_thread_sharing: bool = ... + self, + settings_dict: Dict[str, Dict[str, str]], + alias: str = ..., + allow_thread_sharing: bool = ..., ) -> None: ... def ensure_timezone(self) -> bool: ... def timezone(self): ... @@ -77,7 +77,11 @@ class BaseDatabaseWrapper: def savepoint_commit(self, sid: str) -> None: ... def clean_savepoints(self) -> None: ... def get_autocommit(self) -> bool: ... - def set_autocommit(self, autocommit: bool, force_begin_transaction_with_broken_autocommit: bool = ...) -> None: ... + def set_autocommit( + self, + autocommit: bool, + force_begin_transaction_with_broken_autocommit: bool = ..., + ) -> None: ... def get_rollback(self) -> bool: ... def set_rollback(self, rollback: bool) -> None: ... def validate_no_atomic_block(self) -> None: ... diff --git a/django-stubs/db/backends/base/creation.pyi b/django-stubs/db/backends/base/creation.pyi index 8904232ff..dbb8bea5c 100644 --- a/django-stubs/db/backends/base/creation.pyi +++ b/django-stubs/db/backends/base/creation.pyi @@ -8,17 +8,32 @@ class BaseDatabaseCreation: connection: Any = ... def __init__(self, connection: BaseDatabaseWrapper) -> None: ... def create_test_db( - self, verbosity: int = ..., autoclobber: bool = ..., serialize: bool = ..., keepdb: bool = ... + self, + verbosity: int = ..., + autoclobber: bool = ..., + serialize: bool = ..., + keepdb: bool = ..., ) -> str: ... def set_as_test_mirror( - self, primary_settings_dict: Dict[str, Optional[Union[Dict[str, None], int, str]]] + self, + primary_settings_dict: Dict[str, Optional[Union[Dict[str, None], int, str]]], ) -> None: ... def serialize_db_to_string(self) -> str: ... def deserialize_db_from_string(self, data: str) -> None: ... - def clone_test_db(self, suffix: Any, verbosity: int = ..., autoclobber: bool = ..., keepdb: bool = ...) -> None: ... + def clone_test_db( + self, + suffix: Any, + verbosity: int = ..., + autoclobber: bool = ..., + keepdb: bool = ..., + ) -> None: ... def get_test_db_clone_settings(self, suffix: Any): ... def destroy_test_db( - self, old_database_name: str = ..., verbosity: int = ..., keepdb: bool = ..., suffix: None = ... + self, + old_database_name: str = ..., + verbosity: int = ..., + keepdb: bool = ..., + suffix: None = ..., ) -> None: ... def sql_table_creation_suffix(self): ... def test_db_signature(self) -> Tuple[str, str, str, str]: ... diff --git a/django-stubs/db/backends/base/introspection.pyi b/django-stubs/db/backends/base/introspection.pyi index 33d128fee..6853f4c4e 100644 --- a/django-stubs/db/backends/base/introspection.pyi +++ b/django-stubs/db/backends/base/introspection.pyi @@ -7,7 +7,10 @@ from django.db.models.base import Model TableInfo = namedtuple("TableInfo", ["name", "type"]) -FieldInfo = namedtuple("FieldInfo", "name type_code display_size internal_size precision scale null_ok default") +FieldInfo = namedtuple( + "FieldInfo", + "name type_code display_size internal_size precision scale null_ok default", +) class BaseDatabaseIntrospection: data_types_reverse: Any = ... @@ -16,12 +19,18 @@ class BaseDatabaseIntrospection: def get_field_type(self, data_type: str, description: FieldInfo) -> str: ... def table_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]: ... def get_table_list(self, cursor: Any) -> None: ... - def django_table_names(self, only_existing: bool = ..., include_views: bool = ...) -> List[str]: ... + def django_table_names( + self, only_existing: bool = ..., include_views: bool = ... + ) -> List[str]: ... def installed_models(self, tables: List[str]) -> Set[Type[Model]]: ... def sequence_list(self) -> List[Dict[str, str]]: ... - def get_sequences(self, cursor: Any, table_name: Any, table_fields: Any = ...) -> None: ... + def get_sequences( + self, cursor: Any, table_name: Any, table_fields: Any = ... + ) -> None: ... def get_key_columns(self, cursor: Any, table_name: Any) -> None: ... def get_primary_key_column(self, cursor: Any, table_name: Any): ... def get_constraints(self, cursor: Any, table_name: Any) -> None: ... diff --git a/django-stubs/db/backends/base/operations.pyi b/django-stubs/db/backends/base/operations.pyi index fa9905c43..8d52d0b2f 100644 --- a/django-stubs/db/backends/base/operations.pyi +++ b/django-stubs/db/backends/base/operations.pyi @@ -1,16 +1,15 @@ -from datetime import date, datetime, timedelta, time +from datetime import date, datetime, time, timedelta from decimal import Decimal from typing import Any, List, Optional, Sequence, Tuple, Type, Union from django.core.management.color import Style +from django.db import DefaultConnectionProxy from django.db.backends.base.base import BaseDatabaseWrapper from django.db.backends.utils import CursorWrapper from django.db.models.base import Model from django.db.models.expressions import Case, Expression -from django.db.models.sql.compiler import SQLCompiler - -from django.db import DefaultConnectionProxy from django.db.models.fields import Field +from django.db.models.sql.compiler import SQLCompiler _Connection = Union[DefaultConnectionProxy, BaseDatabaseWrapper] @@ -37,19 +36,29 @@ class BaseDatabaseOperations: def date_trunc_sql(self, lookup_type: None, field_name: None) -> Any: ... def datetime_cast_date_sql(self, field_name: None, tzname: None) -> Any: ... def datetime_cast_time_sql(self, field_name: None, tzname: None) -> Any: ... - def datetime_extract_sql(self, lookup_type: None, field_name: None, tzname: None) -> Any: ... - def datetime_trunc_sql(self, lookup_type: None, field_name: None, tzname: None) -> Any: ... + def datetime_extract_sql( + self, lookup_type: None, field_name: None, tzname: None + ) -> Any: ... + def datetime_trunc_sql( + self, lookup_type: None, field_name: None, tzname: None + ) -> Any: ... def time_trunc_sql(self, lookup_type: None, field_name: None) -> Any: ... def time_extract_sql(self, lookup_type: None, field_name: None) -> Any: ... def deferrable_sql(self) -> str: ... - def distinct_sql(self, fields: List[str], params: Optional[List[Any]]) -> Tuple[List[str], List[Any]]: ... + def distinct_sql( + self, fields: List[str], params: Optional[List[Any]] + ) -> Tuple[List[str], List[Any]]: ... def fetch_returned_insert_id(self, cursor: Any): ... def field_cast_sql(self, db_type: Optional[str], internal_type: str) -> str: ... def force_no_ordering(self) -> List[Any]: ... - def for_update_sql(self, nowait: bool = ..., skip_locked: bool = ..., of: Any = ...): ... + def for_update_sql( + self, nowait: bool = ..., skip_locked: bool = ..., of: Any = ... + ): ... def limit_offset_sql(self, low_mark: int, high_mark: Optional[int]) -> str: ... def last_executed_query(self, cursor: Any, sql: Any, params: Any): ... - def last_insert_id(self, cursor: CursorWrapper, table_name: str, pk_name: str) -> int: ... + def last_insert_id( + self, cursor: CursorWrapper, table_name: str, pk_name: str + ) -> int: ... def lookup_cast(self, lookup_type: str, internal_type: str = ...) -> str: ... def max_in_list_size(self) -> None: ... def max_name_length(self) -> None: ... @@ -66,10 +75,16 @@ class BaseDatabaseOperations: def savepoint_commit_sql(self, sid: str) -> str: ... def savepoint_rollback_sql(self, sid: str) -> str: ... def set_time_zone_sql(self) -> str: ... - def sql_flush(self, style: None, tables: None, sequences: None, allow_cascade: bool = ...) -> Any: ... + def sql_flush( + self, style: None, tables: None, sequences: None, allow_cascade: bool = ... + ) -> Any: ... def execute_sql_flush(self, using: str, sql_list: List[str]) -> None: ... - def sequence_reset_by_name_sql(self, style: None, sequences: List[Any]) -> List[Any]: ... - def sequence_reset_sql(self, style: Style, model_list: Sequence[Type[Model]]) -> List[Any]: ... + def sequence_reset_by_name_sql( + self, style: None, sequences: List[Any] + ) -> List[Any]: ... + def sequence_reset_sql( + self, style: Style, model_list: Sequence[Type[Model]] + ) -> List[Any]: ... def start_transaction_sql(self) -> str: ... def end_transaction_sql(self, success: bool = ...) -> str: ... def tablespace_sql(self, tablespace: Optional[str], inline: bool = ...) -> str: ... @@ -79,9 +94,14 @@ class BaseDatabaseOperations: def adapt_unknown_value(self, value: Any) -> Any: ... def adapt_datefield_value(self, value: Optional[date]) -> Optional[str]: ... def adapt_datetimefield_value(self, value: Optional[datetime]) -> Optional[str]: ... - def adapt_timefield_value(self, value: Optional[Union[datetime, time]]) -> Optional[str]: ... + def adapt_timefield_value( + self, value: Optional[Union[datetime, time]] + ) -> Optional[str]: ... 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]: ... def adapt_ipaddressfield_value(self, value: Optional[str]) -> Optional[str]: ... def year_lookup_bounds_for_date_field(self, value: int) -> List[str]: ... @@ -99,6 +119,12 @@ class BaseDatabaseOperations: def subtract_temporals(self, internal_type: Any, lhs: Any, rhs: Any): ... def window_frame_start(self, start: Any): ... def window_frame_end(self, end: Any): ... - def window_frame_rows_start_end(self, start: Optional[int] = ..., end: Optional[int] = ...) -> 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 window_frame_rows_start_end( + self, start: Optional[int] = ..., end: Optional[int] = ... + ) -> 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: ... diff --git a/django-stubs/db/backends/base/schema.pyi b/django-stubs/db/backends/base/schema.pyi index 4da424849..8fca57328 100644 --- a/django-stubs/db/backends/base/schema.pyi +++ b/django-stubs/db/backends/base/schema.pyi @@ -2,9 +2,8 @@ from typing import Any, ContextManager, List, Optional, Sequence, Tuple, Type, U from django.db.backends.ddl_references import Statement from django.db.models.base import Model -from django.db.models.indexes import Index - from django.db.models.fields import Field +from django.db.models.indexes import Index logger: Any @@ -39,12 +38,18 @@ class BaseDatabaseSchemaEditor(ContextManager[Any]): collect_sql: bool = ... collected_sql: Any = ... atomic_migration: Any = ... - def __init__(self, connection: Any, collect_sql: bool = ..., atomic: bool = ...) -> None: ... + def __init__( + self, connection: Any, collect_sql: bool = ..., atomic: bool = ... + ) -> None: ... deferred_sql: Any = ... atomic: Any = ... def __enter__(self) -> BaseDatabaseSchemaEditor: ... def __exit__(self, exc_type: Any, exc_value: Any, traceback: Any) -> None: ... - def execute(self, sql: Union[Statement, str], params: Optional[Union[List[int], Tuple]] = ...) -> None: ... + def execute( + self, + sql: Union[Statement, str], + params: Optional[Union[List[int], Tuple]] = ..., + ) -> None: ... def quote_name(self, name: str) -> str: ... def column_sql( self, model: Type[Model], field: Field, include_default: bool = ... @@ -69,9 +74,15 @@ class BaseDatabaseSchemaEditor(ContextManager[Any]): old_index_together: Sequence[Sequence[str]], new_index_together: Sequence[Sequence[str]], ) -> None: ... - def alter_db_table(self, model: Type[Model], old_db_table: str, new_db_table: str) -> None: ... - def alter_db_tablespace(self, model: Any, old_db_tablespace: Any, new_db_tablespace: Any) -> None: ... + def alter_db_table( + self, model: Type[Model], old_db_table: str, new_db_table: str + ) -> None: ... + def alter_db_tablespace( + self, model: Any, old_db_tablespace: Any, new_db_tablespace: Any + ) -> None: ... def add_field(self, model: Any, field: Any): ... def remove_field(self, model: Any, field: Any): ... - def alter_field(self, model: Type[Model], old_field: Field, new_field: Field, strict: bool = ...) -> None: ... + def alter_field( + self, model: Type[Model], old_field: Field, new_field: Field, strict: bool = ... + ) -> None: ... def remove_procedure(self, procedure_name: Any, param_types: Any = ...) -> None: ... diff --git a/django-stubs/db/backends/base/validation.pyi b/django-stubs/db/backends/base/validation.pyi index 382f4c1ad..d88b40cf5 100644 --- a/django-stubs/db/backends/base/validation.pyi +++ b/django-stubs/db/backends/base/validation.pyi @@ -1,7 +1,6 @@ from typing import Any, List from django.db.backends.base.base import BaseDatabaseWrapper - from django.db.models.fields import Field class BaseDatabaseValidation: diff --git a/django-stubs/db/backends/ddl_references.pyi b/django-stubs/db/backends/ddl_references.pyi index 2d3f6af13..c0996e055 100644 --- a/django-stubs/db/backends/ddl_references.pyi +++ b/django-stubs/db/backends/ddl_references.pyi @@ -1,10 +1,12 @@ -from typing import Any, Callable, List, Tuple, Union, Dict +from typing import Any, Callable, Dict, List, Tuple, Union class Reference: def references_table(self, table: Any): ... def references_column(self, table: Any, column: Any): ... def rename_table_references(self, old_table: Any, new_table: Any) -> None: ... - def rename_column_references(self, table: Any, old_column: Any, new_column: Any) -> None: ... + def rename_column_references( + self, table: Any, old_column: Any, new_column: Any + ) -> None: ... class Table(Reference): table: str = ... @@ -18,7 +20,9 @@ class TableColumns(Table): columns: List[str] = ... def __init__(self, table: str, columns: List[str]) -> None: ... def references_column(self, table: str, column: str) -> bool: ... - def rename_column_references(self, table: str, old_column: str, new_column: str) -> None: ... + def rename_column_references( + self, table: str, old_column: str, new_column: str + ) -> None: ... class Columns(TableColumns): columns: List[str] @@ -26,7 +30,11 @@ class Columns(TableColumns): quote_name: Callable = ... col_suffixes: Tuple = ... def __init__( - self, table: str, columns: List[str], quote_name: Callable, col_suffixes: Union[List[str], Tuple] = ... + self, + table: str, + columns: List[str], + quote_name: Callable, + col_suffixes: Union[List[str], Tuple] = ..., ) -> None: ... class IndexName(TableColumns): @@ -34,12 +42,19 @@ class IndexName(TableColumns): table: str suffix: str = ... create_index_name: Callable = ... - def __init__(self, table: str, columns: List[str], suffix: str, create_index_name: Callable) -> None: ... + def __init__( + self, table: str, columns: List[str], suffix: str, create_index_name: Callable + ) -> None: ... class IndexColumns(Columns): opclasses: Any = ... def __init__( - self, table: Any, columns: Any, quote_name: Any, col_suffixes: Any = ..., opclasses: Any = ... + self, + table: Any, + columns: Any, + quote_name: Any, + col_suffixes: Any = ..., + opclasses: Any = ..., ) -> None: ... class ForeignKeyName(TableColumns): @@ -60,7 +75,9 @@ class ForeignKeyName(TableColumns): def references_table(self, table: str) -> bool: ... def references_column(self, table: str, column: str) -> bool: ... def rename_table_references(self, old_table: str, new_table: str) -> None: ... - def rename_column_references(self, table: str, old_column: str, new_column: str) -> None: ... + def rename_column_references( + self, table: str, old_column: str, new_column: str + ) -> None: ... class Statement(Reference): template: str = ... @@ -69,4 +86,6 @@ class Statement(Reference): def references_table(self, table: str) -> bool: ... def references_column(self, table: str, column: str) -> bool: ... def rename_table_references(self, old_table: str, new_table: str) -> None: ... - def rename_column_references(self, table: str, old_column: str, new_column: str) -> None: ... + def rename_column_references( + self, table: str, old_column: str, new_column: str + ) -> None: ... diff --git a/django-stubs/db/backends/dummy/features.pyi b/django-stubs/db/backends/dummy/features.pyi index 7e05ffdd0..90b3bfac3 100644 --- a/django-stubs/db/backends/dummy/features.pyi +++ b/django-stubs/db/backends/dummy/features.pyi @@ -1,4 +1,6 @@ -from django.db.backends.base.features import BaseDatabaseFeatures as BaseDatabaseFeatures +from django.db.backends.base.features import ( + BaseDatabaseFeatures as BaseDatabaseFeatures, +) class DummyDatabaseFeatures(BaseDatabaseFeatures): supports_transactions: bool = ... diff --git a/django-stubs/db/backends/mysql/base.pyi b/django-stubs/db/backends/mysql/base.pyi index 75f2d4ce8..d86041d20 100644 --- a/django-stubs/db/backends/mysql/base.pyi +++ b/django-stubs/db/backends/mysql/base.pyi @@ -1,6 +1,7 @@ -from django.db.backends.base.base import BaseDatabaseWrapper as BaseDatabaseWrapper from typing import Any, Optional +from django.db.backends.base.base import BaseDatabaseWrapper as BaseDatabaseWrapper + version: Any django_conversions: Any server_version_re: Any diff --git a/django-stubs/db/backends/mysql/client.pyi b/django-stubs/db/backends/mysql/client.pyi index 212f15dec..eb08d2ec8 100644 --- a/django-stubs/db/backends/mysql/client.pyi +++ b/django-stubs/db/backends/mysql/client.pyi @@ -6,6 +6,7 @@ class DatabaseClient(BaseDatabaseClient): executable_name: str = ... @classmethod def settings_to_cmd_args( - cls, settings_dict: Dict[str, Optional[Union[Dict[str, Dict[str, str]], int, str]]] + cls, + settings_dict: Dict[str, Optional[Union[Dict[str, Dict[str, str]], int, str]]], ) -> List[str]: ... def runshell(self) -> None: ... diff --git a/django-stubs/db/backends/mysql/compiler.pyi b/django-stubs/db/backends/mysql/compiler.pyi index 47998329e..aa6e1e4c1 100644 --- a/django-stubs/db/backends/mysql/compiler.pyi +++ b/django-stubs/db/backends/mysql/compiler.pyi @@ -1,6 +1,7 @@ -from django.db.models.sql import compiler as compiler from typing import Any +from django.db.models.sql import compiler as compiler + class SQLCompiler(compiler.SQLCompiler): def as_subquery_condition(self, alias: Any, columns: Any, compiler: Any): ... diff --git a/django-stubs/db/backends/mysql/creation.pyi b/django-stubs/db/backends/mysql/creation.pyi index 759713b2e..cce664ed3 100644 --- a/django-stubs/db/backends/mysql/creation.pyi +++ b/django-stubs/db/backends/mysql/creation.pyi @@ -1,4 +1,6 @@ -from django.db.backends.base.creation import BaseDatabaseCreation as BaseDatabaseCreation +from django.db.backends.base.creation import ( + BaseDatabaseCreation as BaseDatabaseCreation, +) class DatabaseCreation(BaseDatabaseCreation): def sql_table_creation_suffix(self): ... diff --git a/django-stubs/db/backends/mysql/features.pyi b/django-stubs/db/backends/mysql/features.pyi index 0e16a5765..0c85e519c 100644 --- a/django-stubs/db/backends/mysql/features.pyi +++ b/django-stubs/db/backends/mysql/features.pyi @@ -1,6 +1,9 @@ -from django.db.backends.base.features import BaseDatabaseFeatures as BaseDatabaseFeatures from typing import Any +from django.db.backends.base.features import ( + BaseDatabaseFeatures as BaseDatabaseFeatures, +) + class DatabaseFeatures(BaseDatabaseFeatures): empty_fetchmany_value: Any = ... allows_group_by_pk: bool = ... diff --git a/django-stubs/db/backends/mysql/introspection.pyi b/django-stubs/db/backends/mysql/introspection.pyi index df3503f3e..f3852f92c 100644 --- a/django-stubs/db/backends/mysql/introspection.pyi +++ b/django-stubs/db/backends/mysql/introspection.pyi @@ -1,9 +1,15 @@ from collections import namedtuple -from django.db.backends.base.introspection import BaseDatabaseIntrospection as BaseDatabaseIntrospection from typing import Any +from django.db.backends.base.introspection import ( + BaseDatabaseIntrospection as BaseDatabaseIntrospection, +) + FieldInfo: Any -InfoLine = namedtuple("InfoLine", "col_name data_type max_len num_prec num_scale extra column_default is_unsigned") +InfoLine = namedtuple( + "InfoLine", + "col_name data_type max_len num_prec num_scale extra column_default is_unsigned", +) class DatabaseIntrospection(BaseDatabaseIntrospection): data_types_reverse: Any = ... diff --git a/django-stubs/db/backends/mysql/operations.pyi b/django-stubs/db/backends/mysql/operations.pyi index a7712a839..66624afe9 100644 --- a/django-stubs/db/backends/mysql/operations.pyi +++ b/django-stubs/db/backends/mysql/operations.pyi @@ -1,6 +1,9 @@ -from django.db.backends.base.operations import BaseDatabaseOperations as BaseDatabaseOperations from typing import Any, Optional +from django.db.backends.base.operations import ( + BaseDatabaseOperations as BaseDatabaseOperations, +) + class DatabaseOperations(BaseDatabaseOperations): compiler_module: str = ... integer_field_ranges: Any = ... @@ -31,8 +34,12 @@ class DatabaseOperations(BaseDatabaseOperations): def bulk_insert_sql(self, fields: Any, placeholder_rows: Any): ... def combine_expression(self, connector: Any, sub_expressions: Any): ... def get_db_converters(self, expression: Any): ... - def convert_booleanfield_value(self, value: Any, expression: Any, connection: Any): ... - def convert_datetimefield_value(self, value: Any, expression: Any, connection: Any): ... + def convert_booleanfield_value( + self, value: Any, expression: Any, connection: Any + ): ... + def convert_datetimefield_value( + self, value: Any, expression: Any, connection: Any + ): ... def convert_uuidfield_value(self, value: Any, expression: Any, connection: Any): ... def binary_placeholder_sql(self, value: Any): ... def subtract_temporals(self, internal_type: Any, lhs: Any, rhs: Any): ... diff --git a/django-stubs/db/backends/mysql/schema.pyi b/django-stubs/db/backends/mysql/schema.pyi index 1c89996cf..778f5a99b 100644 --- a/django-stubs/db/backends/mysql/schema.pyi +++ b/django-stubs/db/backends/mysql/schema.pyi @@ -1,6 +1,9 @@ -from django.db.backends.base.schema import BaseDatabaseSchemaEditor as BaseDatabaseSchemaEditor from typing import Any +from django.db.backends.base.schema import ( + BaseDatabaseSchemaEditor as BaseDatabaseSchemaEditor, +) + class DatabaseSchemaEditor(BaseDatabaseSchemaEditor): sql_rename_table: str = ... sql_alter_column_null: str = ... diff --git a/django-stubs/db/backends/mysql/validation.pyi b/django-stubs/db/backends/mysql/validation.pyi index e09243c4c..6a7149ffb 100644 --- a/django-stubs/db/backends/mysql/validation.pyi +++ b/django-stubs/db/backends/mysql/validation.pyi @@ -1,6 +1,9 @@ -from django.db.backends.base.validation import BaseDatabaseValidation as BaseDatabaseValidation from typing import Any +from django.db.backends.base.validation import ( + BaseDatabaseValidation as BaseDatabaseValidation, +) + class DatabaseValidation(BaseDatabaseValidation): def check(self, **kwargs: Any): ... def check_field_type(self, field: Any, field_type: Any): ... diff --git a/django-stubs/db/backends/oracle/base.pyi b/django-stubs/db/backends/oracle/base.pyi index 5d48e0290..491fd340e 100644 --- a/django-stubs/db/backends/oracle/base.pyi +++ b/django-stubs/db/backends/oracle/base.pyi @@ -1,6 +1,7 @@ -from django.db.backends.base.base import BaseDatabaseWrapper as BaseDatabaseWrapper from typing import Any, Optional +from django.db.backends.base.base import BaseDatabaseWrapper as BaseDatabaseWrapper + def wrap_oracle_errors() -> None: ... class _UninitializedOperatorsDescriptor: diff --git a/django-stubs/db/backends/oracle/creation.pyi b/django-stubs/db/backends/oracle/creation.pyi index 82cd3c5ce..3ccc8006d 100644 --- a/django-stubs/db/backends/oracle/creation.pyi +++ b/django-stubs/db/backends/oracle/creation.pyi @@ -1,6 +1,9 @@ -from django.db.backends.base.creation import BaseDatabaseCreation as BaseDatabaseCreation from typing import Any +from django.db.backends.base.creation import ( + BaseDatabaseCreation as BaseDatabaseCreation, +) + TEST_DATABASE_PREFIX: str class DatabaseCreation(BaseDatabaseCreation): diff --git a/django-stubs/db/backends/oracle/features.pyi b/django-stubs/db/backends/oracle/features.pyi index 7954caf77..da984a7e5 100644 --- a/django-stubs/db/backends/oracle/features.pyi +++ b/django-stubs/db/backends/oracle/features.pyi @@ -1,6 +1,9 @@ -from django.db.backends.base.features import BaseDatabaseFeatures as BaseDatabaseFeatures from typing import Any +from django.db.backends.base.features import ( + BaseDatabaseFeatures as BaseDatabaseFeatures, +) + class DatabaseFeatures(BaseDatabaseFeatures): interprets_empty_strings_as_nulls: bool = ... has_select_for_update: bool = ... diff --git a/django-stubs/db/backends/oracle/functions.pyi b/django-stubs/db/backends/oracle/functions.pyi index 3c9035fdd..962145bca 100644 --- a/django-stubs/db/backends/oracle/functions.pyi +++ b/django-stubs/db/backends/oracle/functions.pyi @@ -1,12 +1,17 @@ -from django.db.models import Func as Func from typing import Any, Optional +from django.db.models import Func as Func + class IntervalToSeconds(Func): function: str = ... template: str = ... - def __init__(self, expression: Any, *, output_field: Optional[Any] = ..., **extra: Any) -> None: ... + def __init__( + self, expression: Any, *, output_field: Optional[Any] = ..., **extra: Any + ) -> None: ... class SecondsToInterval(Func): function: str = ... template: str = ... - def __init__(self, expression: Any, *, output_field: Optional[Any] = ..., **extra: Any) -> None: ... + def __init__( + self, expression: Any, *, output_field: Optional[Any] = ..., **extra: Any + ) -> None: ... diff --git a/django-stubs/db/backends/oracle/introspection.pyi b/django-stubs/db/backends/oracle/introspection.pyi index 959988393..afa8daec5 100644 --- a/django-stubs/db/backends/oracle/introspection.pyi +++ b/django-stubs/db/backends/oracle/introspection.pyi @@ -1,6 +1,9 @@ -from django.db.backends.base.introspection import BaseDatabaseIntrospection as BaseDatabaseIntrospection from typing import Any +from django.db.backends.base.introspection import ( + BaseDatabaseIntrospection as BaseDatabaseIntrospection, +) + FieldInfo: Any class DatabaseIntrospection(BaseDatabaseIntrospection): diff --git a/django-stubs/db/backends/oracle/operations.pyi b/django-stubs/db/backends/oracle/operations.pyi index 345e3ec8d..91d200bf1 100644 --- a/django-stubs/db/backends/oracle/operations.pyi +++ b/django-stubs/db/backends/oracle/operations.pyi @@ -1,6 +1,9 @@ -from django.db.backends.base.operations import BaseDatabaseOperations as BaseDatabaseOperations from typing import Any, Optional +from django.db.backends.base.operations import ( + BaseDatabaseOperations as BaseDatabaseOperations, +) + class DatabaseOperations(BaseDatabaseOperations): integer_field_ranges: Any = ... set_operators: Any = ... @@ -16,9 +19,15 @@ class DatabaseOperations(BaseDatabaseOperations): def time_trunc_sql(self, lookup_type: Any, field_name: Any): ... def get_db_converters(self, expression: Any): ... def convert_textfield_value(self, value: Any, expression: Any, connection: Any): ... - def convert_binaryfield_value(self, value: Any, expression: Any, connection: Any): ... - def convert_booleanfield_value(self, value: Any, expression: Any, connection: Any): ... - def convert_datetimefield_value(self, value: Any, expression: Any, connection: Any): ... + def convert_binaryfield_value( + self, value: Any, expression: Any, connection: Any + ): ... + def convert_booleanfield_value( + self, value: Any, expression: Any, connection: Any + ): ... + def convert_datetimefield_value( + self, value: Any, expression: Any, connection: Any + ): ... def convert_datefield_value(self, value: Any, expression: Any, connection: Any): ... def convert_timefield_value(self, value: Any, expression: Any, connection: Any): ... def convert_uuidfield_value(self, value: Any, expression: Any, connection: Any): ... diff --git a/django-stubs/db/backends/oracle/schema.pyi b/django-stubs/db/backends/oracle/schema.pyi index d2df8efa9..0753f8471 100644 --- a/django-stubs/db/backends/oracle/schema.pyi +++ b/django-stubs/db/backends/oracle/schema.pyi @@ -1,6 +1,9 @@ -from django.db.backends.base.schema import BaseDatabaseSchemaEditor as BaseDatabaseSchemaEditor from typing import Any +from django.db.backends.base.schema import ( + BaseDatabaseSchemaEditor as BaseDatabaseSchemaEditor, +) + class DatabaseSchemaEditor(BaseDatabaseSchemaEditor): sql_create_column: str = ... sql_alter_column_type: str = ... @@ -15,6 +18,8 @@ class DatabaseSchemaEditor(BaseDatabaseSchemaEditor): def quote_value(self, value: Any): ... def remove_field(self, model: Any, field: Any) -> None: ... def delete_model(self, model: Any) -> None: ... - def alter_field(self, model: Any, old_field: Any, new_field: Any, strict: bool = ...) -> None: ... + def alter_field( + self, model: Any, old_field: Any, new_field: Any, strict: bool = ... + ) -> None: ... def normalize_name(self, name: Any): ... def prepare_default(self, value: Any): ... diff --git a/django-stubs/db/backends/oracle/validation.pyi b/django-stubs/db/backends/oracle/validation.pyi index 13abec77b..62e2019d6 100644 --- a/django-stubs/db/backends/oracle/validation.pyi +++ b/django-stubs/db/backends/oracle/validation.pyi @@ -1,5 +1,8 @@ -from django.db.backends.base.validation import BaseDatabaseValidation as BaseDatabaseValidation from typing import Any +from django.db.backends.base.validation import ( + BaseDatabaseValidation as BaseDatabaseValidation, +) + class DatabaseValidation(BaseDatabaseValidation): def check_field_type(self, field: Any, field_type: Any): ... diff --git a/django-stubs/db/backends/postgresql/features.pyi b/django-stubs/db/backends/postgresql/features.pyi index bb3452947..2ad76ec2c 100644 --- a/django-stubs/db/backends/postgresql/features.pyi +++ b/django-stubs/db/backends/postgresql/features.pyi @@ -1,6 +1,9 @@ -from django.db.backends.base.features import BaseDatabaseFeatures as BaseDatabaseFeatures from typing import Any +from django.db.backends.base.features import ( + BaseDatabaseFeatures as BaseDatabaseFeatures, +) + class DatabaseFeatures(BaseDatabaseFeatures): allows_group_by_selected_pks: bool = ... can_return_columns_from_insert: bool = ... diff --git a/django-stubs/db/backends/postgresql/introspection.pyi b/django-stubs/db/backends/postgresql/introspection.pyi index 463688911..4977f7ccf 100644 --- a/django-stubs/db/backends/postgresql/introspection.pyi +++ b/django-stubs/db/backends/postgresql/introspection.pyi @@ -1,6 +1,9 @@ -from django.db.backends.base.introspection import BaseDatabaseIntrospection as BaseDatabaseIntrospection from typing import Any +from django.db.backends.base.introspection import ( + BaseDatabaseIntrospection as BaseDatabaseIntrospection, +) + class DatabaseIntrospection(BaseDatabaseIntrospection): data_types_reverse: Any = ... ignored_tables: Any = ... diff --git a/django-stubs/db/backends/postgresql/schema.pyi b/django-stubs/db/backends/postgresql/schema.pyi index 3c8e1c214..dc4add2ed 100644 --- a/django-stubs/db/backends/postgresql/schema.pyi +++ b/django-stubs/db/backends/postgresql/schema.pyi @@ -1,6 +1,9 @@ -from django.db.backends.base.schema import BaseDatabaseSchemaEditor as BaseDatabaseSchemaEditor from typing import Any +from django.db.backends.base.schema import ( + BaseDatabaseSchemaEditor as BaseDatabaseSchemaEditor, +) + class DatabaseSchemaEditor(BaseDatabaseSchemaEditor): sql_create_sequence: str = ... sql_delete_sequence: str = ... @@ -15,4 +18,6 @@ class DatabaseSchemaEditor(BaseDatabaseSchemaEditor): sql_delete_procedure: str = ... def quote_value(self, value: Any): ... def add_index(self, model: Any, index: Any, concurrently: bool = ...) -> None: ... - def remove_index(self, model: Any, index: Any, concurrently: bool = ...) -> None: ... + def remove_index( + self, model: Any, index: Any, concurrently: bool = ... + ) -> None: ... diff --git a/django-stubs/db/backends/utils.pyi b/django-stubs/db/backends/utils.pyi index a867b5170..115c6cf53 100644 --- a/django-stubs/db/backends/utils.pyi +++ b/django-stubs/db/backends/utils.pyi @@ -23,12 +23,20 @@ class CursorWrapper: exc_value: Optional[BaseException], tb: Optional[types.TracebackType], ) -> None: ... - def callproc(self, procname: str, params: List[Any] = ..., kparams: Dict[str, int] = ...) -> Any: ... + def callproc( + self, procname: str, params: List[Any] = ..., kparams: Dict[str, int] = ... + ) -> Any: ... def execute( - self, sql: str, params: Optional[Union[Sequence[_SQLType], Mapping[str, _SQLType]]] = ... + self, + sql: str, + params: Optional[Union[Sequence[_SQLType], Mapping[str, _SQLType]]] = ..., ) -> Optional[Any]: ... def executemany( - self, sql: str, param_list: Sequence[Optional[Union[Sequence[_SQLType], Mapping[str, _SQLType]]]] + self, + sql: str, + param_list: Sequence[ + Optional[Union[Sequence[_SQLType], Mapping[str, _SQLType]]] + ], ) -> Optional[Any]: ... class CursorDebugWrapper(CursorWrapper): @@ -40,7 +48,9 @@ def typecast_time(s: Optional[str]) -> Optional[time]: ... def typecast_timestamp(s: Optional[str]) -> Optional[date]: ... def rev_typecast_decimal(d: Decimal) -> str: ... def split_identifier(identifier: str) -> Tuple[str, str]: ... -def truncate_name(identifier: str, length: Optional[int] = ..., hash_len: int = ...) -> str: ... +def truncate_name( + identifier: str, length: Optional[int] = ..., hash_len: int = ... +) -> str: ... def format_number( value: Optional[Decimal], max_digits: Optional[int], decimal_places: Optional[int] ) -> Optional[str]: ... diff --git a/django-stubs/db/migrations/__init__.pyi b/django-stubs/db/migrations/__init__.pyi index bf1bdcdde..4a8e9a23e 100644 --- a/django-stubs/db/migrations/__init__.pyi +++ b/django-stubs/db/migrations/__init__.pyi @@ -2,5 +2,6 @@ # # NOTE: This dynamically typed stub was automatically generated by stubgen. -from .migration import Migration as Migration, swappable_dependency as swappable_dependency +from .migration import Migration as Migration +from .migration import swappable_dependency as swappable_dependency from .operations import * diff --git a/django-stubs/db/migrations/autodetector.pyi b/django-stubs/db/migrations/autodetector.pyi index 0f86225d0..149eec08d 100644 --- a/django-stubs/db/migrations/autodetector.pyi +++ b/django-stubs/db/migrations/autodetector.pyi @@ -13,7 +13,10 @@ class MigrationAutodetector: questioner: MigrationQuestioner = ... existing_apps: Set[Any] = ... def __init__( - self, from_state: ProjectState, to_state: ProjectState, questioner: Optional[MigrationQuestioner] = ... + self, + from_state: ProjectState, + to_state: ProjectState, + questioner: Optional[MigrationQuestioner] = ..., ) -> None: ... def changes( self, @@ -27,13 +30,17 @@ class MigrationAutodetector: self, fields: List[Tuple[str, Field]] ) -> List[Tuple[str, List[Any], Dict[str, Union[Callable, int, str]]]]: ... def check_dependency( - self, operation: Operation, dependency: Tuple[str, str, Optional[str], Union[bool, str]] + self, + operation: Operation, + dependency: Tuple[str, str, Optional[str], Union[bool, str]], ) -> bool: ... def add_operation( self, app_label: str, operation: Operation, - dependencies: Optional[List[Tuple[str, str, Optional[str], Union[bool, str]]]] = ..., + dependencies: Optional[ + List[Tuple[str, str, Optional[str], Union[bool, str]]] + ] = ..., beginning: bool = ..., ) -> None: ... def swappable_first_key(self, item: Tuple[str, str]) -> Tuple[str, str]: ... @@ -59,7 +66,10 @@ class MigrationAutodetector: def generate_altered_order_with_respect_to(self) -> None: ... def generate_altered_managers(self) -> None: ... def arrange_for_graph( - self, changes: Dict[str, List[Migration]], graph: MigrationGraph, migration_name: Optional[str] = ... + self, + changes: Dict[str, List[Migration]], + graph: MigrationGraph, + migration_name: Optional[str] = ..., ) -> Dict[str, List[Migration]]: ... @classmethod def suggest_name(cls, ops: List[Operation]) -> str: ... diff --git a/django-stubs/db/migrations/exceptions.pyi b/django-stubs/db/migrations/exceptions.pyi index 88941ead4..898fad59a 100644 --- a/django-stubs/db/migrations/exceptions.pyi +++ b/django-stubs/db/migrations/exceptions.pyi @@ -14,7 +14,9 @@ class NodeNotFoundError(LookupError): message: str = ... origin: None = ... node: Tuple[str, str] = ... - def __init__(self, message: str, node: Tuple[str, str], origin: Optional[Migration] = ...) -> None: ... + def __init__( + self, message: str, node: Tuple[str, str], origin: Optional[Migration] = ... + ) -> None: ... class MigrationSchemaMissing(DatabaseError): ... class InvalidMigrationPlan(ValueError): ... diff --git a/django-stubs/db/migrations/executor.pyi b/django-stubs/db/migrations/executor.pyi index dc759d97b..63591c58e 100644 --- a/django-stubs/db/migrations/executor.pyi +++ b/django-stubs/db/migrations/executor.pyi @@ -19,7 +19,9 @@ class MigrationExecutor: progress_callback: Optional[Callable] = ..., ) -> None: ... def migration_plan( - self, targets: Union[List[Tuple[str, Optional[str]]], Set[Tuple[str, str]]], clean_start: bool = ... + self, + targets: Union[List[Tuple[str, Optional[str]]], Set[Tuple[str, str]]], + clean_start: bool = ..., ) -> List[Tuple[Migration, bool]]: ... def migrate( self, @@ -31,9 +33,15 @@ class MigrationExecutor: ) -> ProjectState: ... def collect_sql(self, plan: List[Tuple[Migration, bool]]) -> List[str]: ... def apply_migration( - self, state: ProjectState, migration: Migration, fake: bool = ..., fake_initial: bool = ... + self, + state: ProjectState, + migration: Migration, + fake: bool = ..., + fake_initial: bool = ..., + ) -> ProjectState: ... + def unapply_migration( + self, state: ProjectState, migration: Migration, fake: bool = ... ) -> ProjectState: ... - def unapply_migration(self, state: ProjectState, migration: Migration, fake: bool = ...) -> ProjectState: ... def check_replacements(self) -> None: ... def detect_soft_applied( self, project_state: Optional[ProjectState], migration: Migration diff --git a/django-stubs/db/migrations/graph.pyi b/django-stubs/db/migrations/graph.pyi index acee1f7d9..3af42618c 100644 --- a/django-stubs/db/migrations/graph.pyi +++ b/django-stubs/db/migrations/graph.pyi @@ -20,7 +20,9 @@ class Node: class DummyNode(Node): origin: Any = ... error_message: Any = ... - def __init__(self, key: Tuple[str, str], origin: Union[Migration, str], error_message: str) -> None: ... + def __init__( + self, key: Tuple[str, str], origin: Union[Migration, str], error_message: str + ) -> None: ... def promote(self) -> None: ... def raise_error(self) -> None: ... @@ -29,8 +31,12 @@ class MigrationGraph: nodes: Dict[Any, Any] = ... cached: bool = ... def __init__(self) -> None: ... - def add_node(self, key: Tuple[str, str], migration: Optional[Migration]) -> None: ... - def add_dummy_node(self, key: Tuple[str, str], origin: Union[Migration, str], error_message: str) -> None: ... + def add_node( + self, key: Tuple[str, str], migration: Optional[Migration] + ) -> None: ... + def add_dummy_node( + self, key: Tuple[str, str], origin: Union[Migration, str], error_message: str + ) -> None: ... def add_dependency( self, migration: Optional[Union[Migration, str]], @@ -38,17 +44,26 @@ class MigrationGraph: parent: Tuple[str, str], skip_validation: bool = ..., ) -> None: ... - def remove_replaced_nodes(self, replacement: Tuple[str, str], replaced: List[Tuple[str, str]]) -> None: ... - def remove_replacement_node(self, replacement: Tuple[str, str], replaced: List[Tuple[str, str]]) -> None: ... + def remove_replaced_nodes( + self, replacement: Tuple[str, str], replaced: List[Tuple[str, str]] + ) -> None: ... + def remove_replacement_node( + self, replacement: Tuple[str, str], replaced: List[Tuple[str, str]] + ) -> None: ... def validate_consistency(self) -> None: ... def clear_cache(self) -> None: ... def forwards_plan(self, target: Tuple[str, str]) -> List[Tuple[str, str]]: ... - def backwards_plan(self, target: Union[Tuple[str, str], Node]) -> List[Tuple[str, str]]: ... + def backwards_plan( + self, target: Union[Tuple[str, str], Node] + ) -> List[Tuple[str, str]]: ... def iterative_dfs(self, start: Any, forwards: bool = ...): ... def root_nodes(self, app: Optional[str] = ...) -> List[Tuple[str, str]]: ... def leaf_nodes(self, app: Optional[str] = ...) -> List[Tuple[str, str]]: ... def ensure_not_cyclic(self) -> None: ... def make_state( - self, nodes: Optional[Tuple[str, str]] = ..., at_end: bool = ..., real_apps: List[str] = ... + self, + nodes: Optional[Tuple[str, str]] = ..., + at_end: bool = ..., + real_apps: List[str] = ..., ) -> ProjectState: ... def __contains__(self, node: Union[Tuple[str, str], SwappableTuple]) -> bool: ... diff --git a/django-stubs/db/migrations/loader.pyi b/django-stubs/db/migrations/loader.pyi index 071371993..79c57b9e1 100644 --- a/django-stubs/db/migrations/loader.pyi +++ b/django-stubs/db/migrations/loader.pyi @@ -3,12 +3,10 @@ from typing import Any, Dict, Optional, Sequence, Set, Tuple, Union from django.db.migrations.migration import Migration from django.db.migrations.state import ProjectState -from .exceptions import ( - AmbiguityError as AmbiguityError, - BadMigrationError as BadMigrationError, - InconsistentMigrationHistory as InconsistentMigrationHistory, - NodeNotFoundError as NodeNotFoundError, -) +from .exceptions import AmbiguityError as AmbiguityError +from .exceptions import BadMigrationError as BadMigrationError +from .exceptions import InconsistentMigrationHistory as InconsistentMigrationHistory +from .exceptions import NodeNotFoundError as NodeNotFoundError MIGRATIONS_MODULE_NAME: str @@ -17,22 +15,34 @@ class MigrationLoader: disk_migrations: Dict[Tuple[str, str], Migration] = ... applied_migrations: Set[Tuple[str, str]] = ... ignore_no_migrations: bool = ... - def __init__(self, connection: Any, load: bool = ..., ignore_no_migrations: bool = ...) -> None: ... + def __init__( + self, connection: Any, load: bool = ..., ignore_no_migrations: bool = ... + ) -> None: ... @classmethod def migrations_module(cls, app_label: str) -> Tuple[Optional[str], bool]: ... unmigrated_apps: Set[str] = ... migrated_apps: Set[str] = ... def load_disk(self) -> None: ... def get_migration(self, app_label: str, name_prefix: str) -> Migration: ... - def get_migration_by_prefix(self, app_label: str, name_prefix: str) -> Migration: ... - def check_key(self, key: Tuple[str, str], current_app: str) -> Optional[Tuple[str, str]]: ... - def add_internal_dependencies(self, key: Tuple[str, str], migration: Migration) -> None: ... - def add_external_dependencies(self, key: Tuple[str, str], migration: Migration) -> None: ... + def get_migration_by_prefix( + self, app_label: str, name_prefix: str + ) -> Migration: ... + def check_key( + self, key: Tuple[str, str], current_app: str + ) -> Optional[Tuple[str, str]]: ... + def add_internal_dependencies( + self, key: Tuple[str, str], migration: Migration + ) -> None: ... + def add_external_dependencies( + self, key: Tuple[str, str], migration: Migration + ) -> None: ... graph: Any = ... replacements: Any = ... def build_graph(self) -> None: ... def check_consistent_history(self, connection: Any) -> None: ... def detect_conflicts(self) -> Dict[str, Set[str]]: ... def project_state( - self, nodes: Optional[Union[Tuple[str, str], Sequence[Tuple[str, str]]]] = ..., at_end: bool = ... + self, + nodes: Optional[Union[Tuple[str, str], Sequence[Tuple[str, str]]]] = ..., + at_end: bool = ..., ) -> ProjectState: ... diff --git a/django-stubs/db/migrations/migration.pyi b/django-stubs/db/migrations/migration.pyi index 093bc35c3..1468ea557 100644 --- a/django-stubs/db/migrations/migration.pyi +++ b/django-stubs/db/migrations/migration.pyi @@ -1,8 +1,8 @@ -from typing import Tuple, List, Optional +from typing import List, Optional, Tuple from django.db.backends.base.schema import BaseDatabaseSchemaEditor -from django.db.migrations.state import ProjectState from django.db.migrations.operations.base import Operation +from django.db.migrations.state import ProjectState class Migration: operations: List[Operation] = ... @@ -14,12 +14,20 @@ class Migration: name: str = ... app_label: str = ... def __init__(self, name: str, app_label: str) -> None: ... - def mutate_state(self, project_state: ProjectState, preserve: bool = ...) -> ProjectState: ... + def mutate_state( + self, project_state: ProjectState, preserve: bool = ... + ) -> ProjectState: ... def apply( - self, project_state: ProjectState, schema_editor: BaseDatabaseSchemaEditor, collect_sql: bool = ... + self, + project_state: ProjectState, + schema_editor: BaseDatabaseSchemaEditor, + collect_sql: bool = ..., ) -> ProjectState: ... def unapply( - self, project_state: ProjectState, schema_editor: BaseDatabaseSchemaEditor, collect_sql: bool = ... + self, + project_state: ProjectState, + schema_editor: BaseDatabaseSchemaEditor, + collect_sql: bool = ..., ) -> ProjectState: ... class SwappableTuple(Tuple[str, str]): diff --git a/django-stubs/db/migrations/operations/__init__.pyi b/django-stubs/db/migrations/operations/__init__.pyi index 6a520feb1..fb91d90ea 100644 --- a/django-stubs/db/migrations/operations/__init__.pyi +++ b/django-stubs/db/migrations/operations/__init__.pyi @@ -1,22 +1,20 @@ -from .fields import ( - AddField as AddField, - AlterField as AlterField, - RemoveField as RemoveField, - RenameField as RenameField, -) -from .models import ( - AddIndex as AddIndex, - AlterIndexTogether as AlterIndexTogether, - AlterModelManagers as AlterModelManagers, - AlterModelOptions as AlterModelOptions, - AlterModelTable as AlterModelTable, - AlterOrderWithRespectTo as AlterOrderWithRespectTo, - AlterUniqueTogether as AlterUniqueTogether, - CreateModel as CreateModel, - DeleteModel as DeleteModel, - RemoveIndex as RemoveIndex, - RenameModel as RenameModel, - AddConstraint as AddConstraint, - RemoveConstraint as RemoveConstraint, -) -from .special import RunPython as RunPython, RunSQL as RunSQL, SeparateDatabaseAndState as SeparateDatabaseAndState +from .fields import AddField as AddField +from .fields import AlterField as AlterField +from .fields import RemoveField as RemoveField +from .fields import RenameField as RenameField +from .models import AddConstraint as AddConstraint +from .models import AddIndex as AddIndex +from .models import AlterIndexTogether as AlterIndexTogether +from .models import AlterModelManagers as AlterModelManagers +from .models import AlterModelOptions as AlterModelOptions +from .models import AlterModelTable as AlterModelTable +from .models import AlterOrderWithRespectTo as AlterOrderWithRespectTo +from .models import AlterUniqueTogether as AlterUniqueTogether +from .models import CreateModel as CreateModel +from .models import DeleteModel as DeleteModel +from .models import RemoveConstraint as RemoveConstraint +from .models import RemoveIndex as RemoveIndex +from .models import RenameModel as RenameModel +from .special import RunPython as RunPython +from .special import RunSQL as RunSQL +from .special import SeparateDatabaseAndState as SeparateDatabaseAndState diff --git a/django-stubs/db/migrations/operations/base.pyi b/django-stubs/db/migrations/operations/base.pyi index cf9928d87..0cdb388cf 100644 --- a/django-stubs/db/migrations/operations/base.pyi +++ b/django-stubs/db/migrations/operations/base.pyi @@ -8,10 +8,18 @@ class Operation: serialization_expand_args: Any = ... def deconstruct(self): ... def state_forwards(self, app_label: Any, state: Any) -> None: ... - def database_forwards(self, app_label: Any, schema_editor: Any, from_state: Any, to_state: Any) -> None: ... - def database_backwards(self, app_label: Any, schema_editor: Any, from_state: Any, to_state: Any) -> None: ... + def database_forwards( + self, app_label: Any, schema_editor: Any, from_state: Any, to_state: Any + ) -> None: ... + def database_backwards( + self, app_label: Any, schema_editor: Any, from_state: Any, to_state: Any + ) -> None: ... def describe(self) -> str: ... def references_model(self, name: str, app_label: str = ...) -> bool: ... - def references_field(self, model_name: str, name: str, app_label: str = ...) -> bool: ... + def references_field( + self, model_name: str, name: str, app_label: str = ... + ) -> bool: ... def allow_migrate_model(self, connection_alias: Any, model: Any) -> bool: ... - def reduce(self, operation: Operation, in_between: List[Operation], app_label: str = ...) -> bool: ... + def reduce( + self, operation: Operation, in_between: List[Operation], app_label: str = ... + ) -> bool: ... diff --git a/django-stubs/db/migrations/operations/fields.pyi b/django-stubs/db/migrations/operations/fields.pyi index 1909aa38f..0563a8d22 100644 --- a/django-stubs/db/migrations/operations/fields.pyi +++ b/django-stubs/db/migrations/operations/fields.pyi @@ -1,13 +1,16 @@ from typing import Any, Optional from django.db.models.fields import Field + from .base import Operation class FieldOperation(Operation): model_name: str = ... model_name_lower: str name: str = ... - def __init__(self, model_name: str, name: str, field: Optional[Field] = ...) -> None: ... + def __init__( + self, model_name: str, name: str, field: Optional[Field] = ... + ) -> None: ... def name_lower(self) -> str: ... def is_same_model_operation(self, operation: FieldOperation) -> bool: ... def is_same_field_operation(self, operation: AddField) -> bool: ... @@ -15,14 +18,18 @@ class FieldOperation(Operation): class AddField(FieldOperation): field: Field = ... preserve_default: bool = ... - def __init__(self, model_name: str, name: str, field: Field, preserve_default: bool = ...) -> None: ... + def __init__( + self, model_name: str, name: str, field: Field, preserve_default: bool = ... + ) -> None: ... class RemoveField(FieldOperation): ... class AlterField(FieldOperation): field: Any = ... preserve_default: Any = ... - def __init__(self, model_name: str, name: str, field: Field, preserve_default: bool = ...) -> None: ... + def __init__( + self, model_name: str, name: str, field: Field, preserve_default: bool = ... + ) -> None: ... class RenameField(FieldOperation): old_name: Any = ... diff --git a/django-stubs/db/migrations/operations/models.pyi b/django-stubs/db/migrations/operations/models.pyi index b6cccf732..3564da55f 100644 --- a/django-stubs/db/migrations/operations/models.pyi +++ b/django-stubs/db/migrations/operations/models.pyi @@ -1,11 +1,10 @@ from typing import Any, Collection, Dict, List, Optional, Sequence, Tuple, Union from django.db.migrations.operations.base import Operation -from django.db.models.indexes import Index -from django.db.models.manager import Manager - from django.db.models.constraints import BaseConstraint from django.db.models.fields import Field +from django.db.models.indexes import Index +from django.db.models.manager import Manager class ModelOperation(Operation): name: str = ... @@ -46,12 +45,16 @@ class FieldRelatedOptionOperation(ModelOptionOperation): ... class AlterUniqueTogether(FieldRelatedOptionOperation): option_name: str = ... unique_together: Collection[Sequence[str]] = ... - def __init__(self, name: str, unique_together: Optional[Collection[Sequence[str]]]) -> None: ... + def __init__( + self, name: str, unique_together: Optional[Collection[Sequence[str]]] + ) -> None: ... class AlterIndexTogether(FieldRelatedOptionOperation): option_name: str = ... index_together: Collection[Sequence[str]] = ... - def __init__(self, name: str, index_together: Optional[Collection[Sequence[str]]]) -> None: ... + def __init__( + self, name: str, index_together: Optional[Collection[Sequence[str]]] + ) -> None: ... class AlterOrderWithRespectTo(FieldRelatedOptionOperation): order_with_respect_to: str = ... diff --git a/django-stubs/db/migrations/operations/special.pyi b/django-stubs/db/migrations/operations/special.pyi index 323a32c53..25dd00f73 100644 --- a/django-stubs/db/migrations/operations/special.pyi +++ b/django-stubs/db/migrations/operations/special.pyi @@ -9,7 +9,9 @@ class SeparateDatabaseAndState(Operation): database_operations: Sequence[Operation] = ... state_operations: Sequence[Operation] = ... def __init__( - self, database_operations: Sequence[Operation] = ..., state_operations: Sequence[Operation] = ... + self, + database_operations: Sequence[Operation] = ..., + state_operations: Sequence[Operation] = ..., ) -> None: ... class RunSQL(Operation): diff --git a/django-stubs/db/migrations/operations/utils.pyi b/django-stubs/db/migrations/operations/utils.pyi index 58c49d892..108b82827 100644 --- a/django-stubs/db/migrations/operations/utils.pyi +++ b/django-stubs/db/migrations/operations/utils.pyi @@ -1,5 +1,6 @@ from django.db.migrations.state import ProjectState - from django.db.models.fields import Field -def is_referenced_by_foreign_key(state: ProjectState, model_name_lower: str, field: Field, field_name: str) -> bool: ... +def is_referenced_by_foreign_key( + state: ProjectState, model_name_lower: str, field: Field, field_name: str +) -> bool: ... diff --git a/django-stubs/db/migrations/optimizer.pyi b/django-stubs/db/migrations/optimizer.pyi index 0a43cfc59..952650ae0 100644 --- a/django-stubs/db/migrations/optimizer.pyi +++ b/django-stubs/db/migrations/optimizer.pyi @@ -3,5 +3,9 @@ from typing import List, Optional from django.db.migrations.operations.base import Operation class MigrationOptimizer: - def optimize(self, operations: List[Operation], app_label: Optional[str] = ...) -> List[Operation]: ... - def optimize_inner(self, operations: List[Operation], app_label: Optional[str] = ...) -> List[Operation]: ... + def optimize( + self, operations: List[Operation], app_label: Optional[str] = ... + ) -> List[Operation]: ... + def optimize_inner( + self, operations: List[Operation], app_label: Optional[str] = ... + ) -> List[Operation]: ... diff --git a/django-stubs/db/migrations/questioner.pyi b/django-stubs/db/migrations/questioner.pyi index 2a2ff1c5d..906ffb3b3 100644 --- a/django-stubs/db/migrations/questioner.pyi +++ b/django-stubs/db/migrations/questioner.pyi @@ -1,7 +1,6 @@ from typing import Any, Dict, Optional, Set from django.db.migrations.state import ModelState - from django.db.models.fields import Field class MigrationQuestioner: @@ -17,8 +16,12 @@ class MigrationQuestioner: def ask_initial(self, app_label: str) -> bool: ... def ask_not_null_addition(self, field_name: str, model_name: str) -> None: ... def ask_not_null_alteration(self, field_name: Any, model_name: Any): ... - def ask_rename(self, model_name: str, old_name: str, new_name: str, field_instance: Field) -> bool: ... - def ask_rename_model(self, old_model_state: ModelState, new_model_state: ModelState) -> bool: ... + def ask_rename( + self, model_name: str, old_name: str, new_name: str, field_instance: Field + ) -> bool: ... + def ask_rename_model( + self, old_model_state: ModelState, new_model_state: ModelState + ) -> bool: ... def ask_merge(self, app_label: str) -> bool: ... def ask_auto_now_add_addition(self, field_name: str, model_name: str) -> None: ... diff --git a/django-stubs/db/migrations/recorder.pyi b/django-stubs/db/migrations/recorder.pyi index e2918e450..e26cb6924 100644 --- a/django-stubs/db/migrations/recorder.pyi +++ b/django-stubs/db/migrations/recorder.pyi @@ -1,10 +1,9 @@ from typing import Any, Optional, Set, Tuple +from django.db import models from django.db.backends.base.base import BaseDatabaseWrapper from django.db.models.query import QuerySet -from django.db import models - class MigrationRecorder: class Migration(models.Model): app: Any = ... diff --git a/django-stubs/db/migrations/serializer.pyi b/django-stubs/db/migrations/serializer.pyi index 8a84bd3d9..3dc3ceded 100644 --- a/django-stubs/db/migrations/serializer.pyi +++ b/django-stubs/db/migrations/serializer.pyi @@ -1,4 +1,4 @@ -from typing import Any, Callable, Dict, List, Set, Tuple, Union, Type +from typing import Any, Callable, Dict, List, Set, Tuple, Type, Union class BaseSerializer: value: Any = ... diff --git a/django-stubs/db/migrations/state.pyi b/django-stubs/db/migrations/state.pyi index bc1e8f293..2d626c7ce 100644 --- a/django-stubs/db/migrations/state.pyi +++ b/django-stubs/db/migrations/state.pyi @@ -1,11 +1,21 @@ -from typing import Any, Dict, Iterator, List, Optional, Sequence, Tuple, Type, Union, Set +from typing import ( + Any, + Dict, + Iterator, + List, + Optional, + Sequence, + Set, + Tuple, + Type, + Union, +) from django.apps import AppConfig from django.apps.registry import Apps from django.db.models.base import Model -from django.db.models.manager import Manager - from django.db.models.fields import Field +from django.db.models.manager import Manager class AppConfigStub(AppConfig): ... @@ -42,7 +52,9 @@ class ProjectState: models: Dict[Any, Any] real_apps: List[str] def __init__( - self, models: Optional[Dict[Tuple[str, str], ModelState]] = ..., real_apps: Optional[List[str]] = ... + self, + models: Optional[Dict[Tuple[str, str], ModelState]] = ..., + real_apps: Optional[List[str]] = ..., ) -> None: ... def add_model(self, model_state: ModelState) -> None: ... @property @@ -53,14 +65,19 @@ class ProjectState: def concrete_apps(self) -> StateApps: ... @classmethod def from_apps(cls, apps: Apps) -> ProjectState: ... - def reload_model(self, app_label: str, model_name: str, delay: bool = ...) -> None: ... + def reload_model( + self, app_label: str, model_name: str, delay: bool = ... + ) -> None: ... def reload_models(self, models: List[Any], delay: bool = ...) -> None: ... def remove_model(self, app_label: str, model_name: str) -> None: ... class StateApps(Apps): real_models: List[ModelState] def __init__( - self, real_apps: List[str], models: Dict[Tuple[str, str], ModelState], ignore_swappable: bool = ... + self, + real_apps: List[str], + models: Dict[Tuple[str, str], ModelState], + ignore_swappable: bool = ..., ) -> None: ... def bulk_update(self) -> Iterator[None]: ... def clone(self) -> StateApps: ... diff --git a/django-stubs/db/migrations/topological_sort.pyi b/django-stubs/db/migrations/topological_sort.pyi index 87e9bc310..2825611a5 100644 --- a/django-stubs/db/migrations/topological_sort.pyi +++ b/django-stubs/db/migrations/topological_sort.pyi @@ -2,7 +2,9 @@ from typing import Dict, Iterator, List, Set from django.db.migrations.operations.base import Operation -def topological_sort_as_sets(dependency_graph: Dict[Operation, Set[Operation]]) -> Iterator[Set[Operation]]: ... +def topological_sort_as_sets( + dependency_graph: Dict[Operation, Set[Operation]] +) -> Iterator[Set[Operation]]: ... def stable_topological_sort( l: List[Operation], dependency_graph: Dict[Operation, Set[Operation]] ) -> List[Operation]: ... diff --git a/django-stubs/db/migrations/writer.pyi b/django-stubs/db/migrations/writer.pyi index 751d8a919..69a32e4d5 100644 --- a/django-stubs/db/migrations/writer.pyi +++ b/django-stubs/db/migrations/writer.pyi @@ -1,4 +1,4 @@ -from typing import Any, List, Set, Tuple, Union, Type +from typing import Any, List, Set, Tuple, Type, Union from django.db.migrations.migration import Migration from django.db.migrations.operations.base import Operation @@ -22,7 +22,9 @@ class OperationWriter: class MigrationWriter: migration: Migration = ... needs_manual_porting: bool = ... - def __init__(self, migration: Union[type, Migration], include_header: bool = ...) -> None: ... + def __init__( + self, migration: Union[type, Migration], include_header: bool = ... + ) -> None: ... def as_string(self) -> str: ... @property def basedir(self) -> str: ... @@ -33,7 +35,9 @@ class MigrationWriter: @classmethod def serialize(cls, value: Any) -> Tuple[str, Set[str]]: ... @classmethod - def register_serializer(cls, type_: type, serializer: Type[BaseSerializer]) -> None: ... + def register_serializer( + cls, type_: type, serializer: Type[BaseSerializer] + ) -> None: ... @classmethod def unregister_serializer(cls, type_: type) -> None: ... diff --git a/django-stubs/db/models/__init__.pyi b/django-stubs/db/models/__init__.pyi index e1e0f2baa..7c7985e1d 100644 --- a/django-stubs/db/models/__init__.pyi +++ b/django-stubs/db/models/__init__.pyi @@ -1,138 +1,103 @@ -from .base import Model as Model - from django.db.models import functions as functions -from .aggregates import ( - Aggregate as Aggregate, - Avg as Avg, - Count as Count, - Max as Max, - Min as Min, - StdDev as StdDev, - Sum as Sum, - Variance as Variance, -) - -from .fields import ( - FieldDoesNotExist as FieldDoesNotExist, - AutoField as AutoField, - IntegerField as IntegerField, - PositiveIntegerField as PositiveIntegerField, - PositiveSmallIntegerField as PositiveSmallIntegerField, - SmallIntegerField as SmallIntegerField, - BigIntegerField as BigIntegerField, - FloatField as FloatField, - CharField as CharField, - EmailField as EmailField, - URLField as URLField, - Field as Field, - SlugField as SlugField, - TextField as TextField, - BooleanField as BooleanField, - NullBooleanField as NullBooleanField, - DateField as DateField, - TimeField as TimeField, - DateTimeField as DateTimeField, - IPAddressField as IPAddressField, - GenericIPAddressField as GenericIPAddressField, - UUIDField as UUIDField, - DecimalField as DecimalField, - FilePathField as FilePathField, - BinaryField as BinaryField, - DurationField as DurationField, - BigAutoField as BigAutoField, - CommaSeparatedIntegerField as CommaSeparatedIntegerField, - NOT_PROVIDED as NOT_PROVIDED, -) - -from .fields.related import ( - ForeignKey as ForeignKey, - OneToOneField as OneToOneField, - ManyToManyField as ManyToManyField, - ForeignObject as ForeignObject, - ManyToManyRel as ManyToManyRel, - ManyToOneRel as ManyToOneRel, - OneToOneRel as OneToOneRel, - ForeignObjectRel as ForeignObjectRel, -) -from .fields.files import ( - ImageField as ImageField, - FileField as FileField, - FieldFile as FieldFile, - FileDescriptor as FileDescriptor, -) -from .fields.proxy import OrderWrt as OrderWrt - -from .deletion import ( - CASCADE as CASCADE, - SET_DEFAULT as SET_DEFAULT, - SET_NULL as SET_NULL, - DO_NOTHING as DO_NOTHING, - PROTECT as PROTECT, - SET as SET, - RESTRICT as RESTRICT, - ProtectedError as ProtectedError, - RestrictedError as RestrictedError, -) - -from .query import ( - Prefetch as Prefetch, - QuerySet as QuerySet, - RawQuerySet as RawQuerySet, - prefetch_related_objects as prefetch_related_objects, -) - -from .query_utils import Q as Q, FilteredRelation as FilteredRelation - -from .lookups import Lookup as Lookup, Transform as Transform - -from .expressions import ( - F as F, - Expression as Expression, - Subquery as Subquery, - Exists as Exists, - OrderBy as OrderBy, - OuterRef as OuterRef, - Case as Case, - When as When, - RawSQL as RawSQL, - Value as Value, - Func as Func, - ExpressionWrapper as ExpressionWrapper, - Combinable as Combinable, - Col as Col, - CombinedExpression as CombinedExpression, - ExpressionList as ExpressionList, - Random as Random, - Ref as Ref, - Window as Window, - WindowFrame as WindowFrame, - RowRange as RowRange, - ValueRange as ValueRange, -) - -from .manager import BaseManager as BaseManager, Manager as Manager - from . import lookups as lookups - -from .aggregates import ( - Avg as Avg, - Min as Min, - Max as Max, - Variance as Variance, - StdDev as StdDev, - Sum as Sum, - Aggregate as Aggregate, -) - -from .indexes import Index as Index - from . import signals as signals - -from .constraints import ( - BaseConstraint as BaseConstraint, - CheckConstraint as CheckConstraint, - UniqueConstraint as UniqueConstraint, -) - -from .enums import Choices as Choices, IntegerChoices as IntegerChoices, TextChoices as TextChoices +from .aggregates import Aggregate as Aggregate +from .aggregates import Avg as Avg +from .aggregates import Count as Count +from .aggregates import Max as Max +from .aggregates import Min as Min +from .aggregates import StdDev as StdDev +from .aggregates import Sum as Sum +from .aggregates import Variance as Variance +from .base import Model as Model +from .constraints import BaseConstraint as BaseConstraint +from .constraints import CheckConstraint as CheckConstraint +from .constraints import UniqueConstraint as UniqueConstraint +from .deletion import CASCADE as CASCADE +from .deletion import DO_NOTHING as DO_NOTHING +from .deletion import PROTECT as PROTECT +from .deletion import RESTRICT as RESTRICT +from .deletion import SET as SET +from .deletion import SET_DEFAULT as SET_DEFAULT +from .deletion import SET_NULL as SET_NULL +from .deletion import ProtectedError as ProtectedError +from .deletion import RestrictedError as RestrictedError +from .enums import Choices as Choices +from .enums import IntegerChoices as IntegerChoices +from .enums import TextChoices as TextChoices +from .expressions import Case as Case +from .expressions import Col as Col +from .expressions import Combinable as Combinable +from .expressions import CombinedExpression as CombinedExpression +from .expressions import Exists as Exists +from .expressions import Expression as Expression +from .expressions import ExpressionList as ExpressionList +from .expressions import ExpressionWrapper as ExpressionWrapper +from .expressions import F as F +from .expressions import Func as Func +from .expressions import OrderBy as OrderBy +from .expressions import OuterRef as OuterRef +from .expressions import Random as Random +from .expressions import RawSQL as RawSQL +from .expressions import Ref as Ref +from .expressions import RowRange as RowRange +from .expressions import Subquery as Subquery +from .expressions import Value as Value +from .expressions import ValueRange as ValueRange +from .expressions import When as When +from .expressions import Window as Window +from .expressions import WindowFrame as WindowFrame +from .fields import NOT_PROVIDED as NOT_PROVIDED +from .fields import AutoField as AutoField +from .fields import BigAutoField as BigAutoField +from .fields import BigIntegerField as BigIntegerField +from .fields import BinaryField as BinaryField +from .fields import BooleanField as BooleanField +from .fields import CharField as CharField +from .fields import CommaSeparatedIntegerField as CommaSeparatedIntegerField +from .fields import DateField as DateField +from .fields import DateTimeField as DateTimeField +from .fields import DecimalField as DecimalField +from .fields import DurationField as DurationField +from .fields import EmailField as EmailField +from .fields import Field as Field +from .fields import FieldDoesNotExist as FieldDoesNotExist +from .fields import FilePathField as FilePathField +from .fields import FloatField as FloatField +from .fields import GenericIPAddressField as GenericIPAddressField +from .fields import IntegerField as IntegerField +from .fields import IPAddressField as IPAddressField +from .fields import NullBooleanField as NullBooleanField +from .fields import PositiveIntegerField as PositiveIntegerField +from .fields import PositiveSmallIntegerField as PositiveSmallIntegerField +from .fields import SlugField as SlugField +from .fields import SmallIntegerField as SmallIntegerField +from .fields import TextField as TextField +from .fields import TimeField as TimeField +from .fields import URLField as URLField +from .fields import UUIDField as UUIDField +from .fields.files import FieldFile as FieldFile +from .fields.files import FileDescriptor as FileDescriptor +from .fields.files import FileField as FileField +from .fields.files import ImageField as ImageField +from .fields.proxy import OrderWrt as OrderWrt +from .fields.related import ForeignKey as ForeignKey +from .fields.related import ForeignObject as ForeignObject +from .fields.related import ForeignObjectRel as ForeignObjectRel +from .fields.related import ManyToManyField as ManyToManyField +from .fields.related import ManyToManyRel as ManyToManyRel +from .fields.related import ManyToOneRel as ManyToOneRel +from .fields.related import OneToOneField as OneToOneField +from .fields.related import OneToOneRel as OneToOneRel +from .indexes import Index as Index +from .lookups import Lookup as Lookup +from .lookups import Transform as Transform +from .manager import BaseManager as BaseManager +from .manager import Manager as Manager +from .query import Prefetch as Prefetch +from .query import QuerySet as QuerySet +from .query import RawQuerySet as RawQuerySet +from .query import prefetch_related_objects as prefetch_related_objects +from .query_utils import FilteredRelation as FilteredRelation +from .query_utils import Q as Q diff --git a/django-stubs/db/models/aggregates.pyi b/django-stubs/db/models/aggregates.pyi index 1522d34b7..1b0c67391 100644 --- a/django-stubs/db/models/aggregates.pyi +++ b/django-stubs/db/models/aggregates.pyi @@ -6,7 +6,13 @@ class Aggregate(Func): filter_template: str = ... filter: Any = ... allow_distinct: bool = ... - def __init__(self, *expressions: Any, distinct: bool = ..., filter: Optional[Any] = ..., **extra: Any) -> None: ... + def __init__( + self, + *expressions: Any, + distinct: bool = ..., + filter: Optional[Any] = ..., + **extra: Any + ) -> None: ... class Avg(Aggregate): ... class Count(Aggregate): ... diff --git a/django-stubs/db/models/base.pyi b/django-stubs/db/models/base.pyi index a8ffa0705..b4aede726 100644 --- a/django-stubs/db/models/base.pyi +++ b/django-stubs/db/models/base.pyi @@ -1,11 +1,23 @@ -from typing import Any, Callable, Collection, Dict, Iterable, List, Optional, Set, Tuple, Type, TypeVar, Union +from typing import ( + Any, + Callable, + Collection, + Dict, + Iterable, + List, + Optional, + Set, + Tuple, + Type, + TypeVar, + Union, +) from django.core.checks.messages import CheckMessage from django.core.exceptions import ( - ValidationError, - ObjectDoesNotExist, MultipleObjectsReturned as BaseMultipleObjectsReturned, ) +from django.core.exceptions import ObjectDoesNotExist, ValidationError from django.db.models.manager import BaseManager from django.db.models.options import Options @@ -35,9 +47,15 @@ class Model(metaclass=ModelBase): @classmethod def add_to_class(cls, name: str, value: Any): ... @classmethod - def from_db(cls, db: Optional[str], field_names: Collection[str], values: Collection[Any]) -> _Self: ... - def delete(self, using: Any = ..., keep_parents: bool = ...) -> Tuple[int, Dict[str, int]]: ... - def full_clean(self, exclude: Optional[Collection[str]] = ..., validate_unique: bool = ...) -> None: ... + def from_db( + cls, db: Optional[str], field_names: Collection[str], values: Collection[Any] + ) -> _Self: ... + def delete( + self, using: Any = ..., keep_parents: bool = ... + ) -> Tuple[int, Dict[str, int]]: ... + def full_clean( + self, exclude: Optional[Collection[str]] = ..., validate_unique: bool = ... + ) -> None: ... def clean(self) -> None: ... def clean_fields(self, exclude: Optional[Collection[str]] = ...) -> None: ... def validate_unique(self, exclude: Optional[Collection[str]] = ...) -> None: ... @@ -59,7 +77,9 @@ class Model(metaclass=ModelBase): using: Optional[str] = ..., update_fields: Optional[Iterable[str]] = ..., ): ... - def refresh_from_db(self: _Self, using: Optional[str] = ..., fields: Optional[List[str]] = ...) -> None: ... + def refresh_from_db( + self: _Self, using: Optional[str] = ..., fields: Optional[List[str]] = ... + ) -> None: ... def get_deferred_fields(self) -> Set[str]: ... @classmethod def check(cls, **kwargs: Any) -> List[CheckMessage]: ... diff --git a/django-stubs/db/models/constraints.pyi b/django-stubs/db/models/constraints.pyi index dc163ab30..07fee6016 100644 --- a/django-stubs/db/models/constraints.pyi +++ b/django-stubs/db/models/constraints.pyi @@ -10,10 +10,20 @@ class BaseConstraint: name: str def __init__(self, name: str) -> None: ... def constraint_sql( - self, model: Optional[Type[Model]], schema_editor: Optional[BaseDatabaseSchemaEditor] + self, + model: Optional[Type[Model]], + schema_editor: Optional[BaseDatabaseSchemaEditor], + ) -> str: ... + def create_sql( + self, + model: Optional[Type[Model]], + schema_editor: Optional[BaseDatabaseSchemaEditor], + ) -> str: ... + def remove_sql( + self, + model: Optional[Type[Model]], + schema_editor: Optional[BaseDatabaseSchemaEditor], ) -> str: ... - def create_sql(self, model: Optional[Type[Model]], schema_editor: Optional[BaseDatabaseSchemaEditor]) -> str: ... - def remove_sql(self, model: Optional[Type[Model]], schema_editor: Optional[BaseDatabaseSchemaEditor]) -> str: ... def deconstruct(self) -> Any: ... def clone(self: _T) -> _T: ... @@ -24,4 +34,6 @@ class CheckConstraint(BaseConstraint): class UniqueConstraint(BaseConstraint): fields: Tuple[str] condition: Optional[Q] - def __init__(self, *, fields: Sequence[str], name: str, condition: Optional[Q] = ...): ... + def __init__( + self, *, fields: Sequence[str], name: str, condition: Optional[Q] = ... + ): ... diff --git a/django-stubs/db/models/deletion.pyi b/django-stubs/db/models/deletion.pyi index 061e5b7a8..93904a81e 100644 --- a/django-stubs/db/models/deletion.pyi +++ b/django-stubs/db/models/deletion.pyi @@ -1,8 +1,7 @@ -from typing import Any, Callable, Iterable, Optional, Union, Collection, Type - -from django.db.models.base import Model +from typing import Any, Callable, Collection, Iterable, Optional, Type, Union from django.db import IntegrityError +from django.db.models.base import Model from django.db.models.fields import Field from django.db.models.options import Options @@ -27,4 +26,6 @@ class Collector: source_attr: Optional[str] = ..., **kwargs: Any ) -> None: ... - def can_fast_delete(self, objs: Union[Model, Iterable[Model]], from_field: Optional[Field] = ...) -> bool: ... + def can_fast_delete( + self, objs: Union[Model, Iterable[Model]], from_field: Optional[Field] = ... + ) -> bool: ... diff --git a/django-stubs/db/models/expressions.pyi b/django-stubs/db/models/expressions.pyi index e4372ac02..e1aea2726 100644 --- a/django-stubs/db/models/expressions.pyi +++ b/django-stubs/db/models/expressions.pyi @@ -1,18 +1,33 @@ from datetime import datetime, timedelta from decimal import Decimal -from typing import Any, Callable, Dict, Iterator, List, Optional, Sequence, Set, Tuple, Type, TypeVar, Union, Iterable - -from django.db.models.lookups import Lookup -from django.db.models.sql.compiler import SQLCompiler +from typing import ( + Any, + Callable, + Dict, + Iterable, + Iterator, + List, + Optional, + Sequence, + Set, + Tuple, + Type, + TypeVar, + Union, +) from django.db.models import Q, QuerySet from django.db.models.fields import Field +from django.db.models.lookups import Lookup from django.db.models.query import _BaseQuerySet +from django.db.models.sql.compiler import SQLCompiler _OutputField = Union[Field, str] class SQLiteNumericMixin: - def as_sqlite(self, compiler: SQLCompiler, connection: Any, **extra_context: Any) -> Tuple[str, List[float]]: ... + def as_sqlite( + self, compiler: SQLCompiler, connection: Any, **extra_context: Any + ) -> Tuple[str, List[float]]: ... _Self = TypeVar("_Self") @@ -30,9 +45,15 @@ class Combinable: BITLEFTSHIFT: str = ... BITRIGHTSHIFT: str = ... def __neg__(self: _Self) -> _Self: ... - def __add__(self: _Self, other: Optional[Union[timedelta, Combinable, _Numeric, str]]) -> _Self: ... - def __sub__(self: _Self, other: Union[timedelta, Combinable, _Numeric]) -> _Self: ... - def __mul__(self: _Self, other: Union[timedelta, Combinable, _Numeric]) -> _Self: ... + def __add__( + self: _Self, other: Optional[Union[timedelta, Combinable, _Numeric, str]] + ) -> _Self: ... + def __sub__( + self: _Self, other: Union[timedelta, Combinable, _Numeric] + ) -> _Self: ... + def __mul__( + self: _Self, other: Union[timedelta, Combinable, _Numeric] + ) -> _Self: ... def __truediv__(self: _Self, other: Union[Combinable, _Numeric]) -> _Self: ... def __itruediv__(self: _Self, other: Union[Combinable, _Numeric]) -> _Self: ... def __mod__(self: _Self, other: Union[int, Combinable]) -> _Self: ... @@ -43,7 +64,9 @@ class Combinable: def bitrightshift(self: _Self, other: int) -> _Self: ... def __or__(self: _Self, other: Combinable) -> _Self: ... def bitor(self: _Self, other: int) -> _Self: ... - def __radd__(self, other: Optional[Union[datetime, _Numeric, Combinable]]) -> Combinable: ... + def __radd__( + self, other: Optional[Union[datetime, _Numeric, Combinable]] + ) -> Combinable: ... def __rsub__(self, other: Union[_Numeric, Combinable]) -> Combinable: ... def __rmul__(self, other: Union[_Numeric, Combinable]) -> Combinable: ... def __rtruediv__(self, other: Union[_Numeric, Combinable]) -> Combinable: ... @@ -92,7 +115,9 @@ class BaseExpression: def flatten(self) -> Iterator[Expression]: ... def deconstruct(self) -> Any: ... def as_sqlite(self, compiler: SQLCompiler, connection: Any) -> Any: ... - def as_sql(self, compiler: SQLCompiler, connection: Any, **extra_context: Any) -> Any: ... + def as_sql( + self, compiler: SQLCompiler, connection: Any, **extra_context: Any + ) -> Any: ... def as_mysql(self, compiler: Any, connection: Any) -> Any: ... def as_postgresql(self, compiler: Any, connection: Any) -> Any: ... def as_oracle(self, compiler: Any, connection: Any): ... @@ -104,7 +129,11 @@ class CombinedExpression(SQLiteNumericMixin, Expression): lhs: Any = ... rhs: Any = ... def __init__( - self, lhs: Combinable, connector: str, rhs: Combinable, output_field: Optional[_OutputField] = ... + self, + lhs: Combinable, + connector: str, + rhs: Combinable, + output_field: Optional[_OutputField] = ..., ) -> None: ... class F(Combinable): @@ -129,7 +158,12 @@ class Subquery(Expression): template: str = ... queryset: QuerySet = ... extra: Dict[Any, Any] = ... - def __init__(self, queryset: _BaseQuerySet, output_field: Optional[_OutputField] = ..., **extra: Any) -> None: ... + def __init__( + self, + queryset: _BaseQuerySet, + output_field: Optional[_OutputField] = ..., + **extra: Any + ) -> None: ... class Exists(Subquery): negated: bool = ... @@ -143,17 +177,28 @@ class OrderBy(BaseExpression): descending: bool = ... expression: Expression = ... def __init__( - self, expression: Combinable, descending: bool = ..., nulls_first: bool = ..., nulls_last: bool = ... + self, + expression: Combinable, + descending: bool = ..., + nulls_first: bool = ..., + nulls_last: bool = ..., ) -> None: ... class Value(Expression): value: Any = ... - def __init__(self, value: Any, output_field: Optional[_OutputField] = ...) -> None: ... + def __init__( + self, value: Any, output_field: Optional[_OutputField] = ... + ) -> None: ... class RawSQL(Expression): params: List[Any] sql: str - def __init__(self, sql: str, params: Sequence[Any], output_field: Optional[_OutputField] = ...) -> None: ... + def __init__( + self, + sql: str, + params: Sequence[Any], + output_field: Optional[_OutputField] = ..., + ) -> None: ... class Func(SQLiteNumericMixin, Expression): function: str = ... @@ -163,13 +208,20 @@ class Func(SQLiteNumericMixin, Expression): arity: int = ... source_expressions: List[Combinable] = ... extra: Dict[Any, Any] = ... - def __init__(self, *expressions: Any, output_field: Optional[_OutputField] = ..., **extra: Any) -> None: ... + def __init__( + self, + *expressions: Any, + output_field: Optional[_OutputField] = ..., + **extra: Any + ) -> None: ... class When(Expression): template: str = ... condition: Any = ... result: Any = ... - def __init__(self, condition: Any = ..., then: Any = ..., **lookups: Any) -> None: ... + def __init__( + self, condition: Any = ..., then: Any = ..., **lookups: Any + ) -> None: ... class Case(Expression): template: str = ... @@ -178,14 +230,22 @@ class Case(Expression): default: Any = ... extra: Any = ... def __init__( - self, *cases: Any, default: Optional[Any] = ..., output_field: Optional[_OutputField] = ..., **extra: Any + self, + *cases: Any, + default: Optional[Any] = ..., + output_field: Optional[_OutputField] = ..., + **extra: Any ) -> None: ... class ExpressionWrapper(Expression): - def __init__(self, expression: Union[Q, Combinable], output_field: _OutputField): ... + def __init__( + self, expression: Union[Q, Combinable], output_field: _OutputField + ): ... class Col(Expression): - def __init__(self, alias: str, target: str, output_field: Optional[_OutputField] = ...): ... + def __init__( + self, alias: str, target: str, output_field: Optional[_OutputField] = ... + ): ... class SimpleCol(Expression): contains_column_references: bool = ... @@ -195,7 +255,9 @@ class Ref(Expression): def __init__(self, refs: str, source: Expression): ... class ExpressionList(Func): - def __init__(self, *expressions: Union[BaseExpression, Combinable], **extra: Any) -> None: ... + def __init__( + self, *expressions: Union[BaseExpression, Combinable], **extra: Any + ) -> None: ... class Random(Expression): ... @@ -206,8 +268,12 @@ class Window(Expression): def __init__( self, expression: BaseExpression, - partition_by: Optional[Union[str, Iterable[Union[BaseExpression, F]], F, BaseExpression]] = ..., - order_by: Optional[Union[Sequence[Union[BaseExpression, F]], Union[BaseExpression, F]]] = ..., + partition_by: Optional[ + Union[str, Iterable[Union[BaseExpression, F]], F, BaseExpression] + ] = ..., + order_by: Optional[ + Union[Sequence[Union[BaseExpression, F]], Union[BaseExpression, F]] + ] = ..., frame: Optional[WindowFrame] = ..., output_field: Optional[_OutputField] = ..., ) -> None: ... @@ -215,8 +281,12 @@ class Window(Expression): class WindowFrame(Expression): template: str = ... frame_type: str = ... - def __init__(self, start: Optional[int] = ..., end: Optional[int] = ...) -> None: ... - def window_frame_start_end(self, connection: Any, start: Optional[int], end: Optional[int]) -> Tuple[int, int]: ... + def __init__( + self, start: Optional[int] = ..., end: Optional[int] = ... + ) -> None: ... + def window_frame_start_end( + self, connection: Any, start: Optional[int], end: Optional[int] + ) -> Tuple[int, int]: ... class RowRange(WindowFrame): ... class ValueRange(WindowFrame): ... diff --git a/django-stubs/db/models/fields/__init__.pyi b/django-stubs/db/models/fields/__init__.pyi index c928a3bae..d34c681b8 100644 --- a/django-stubs/db/models/fields/__init__.pyi +++ b/django-stubs/db/models/fields/__init__.pyi @@ -7,23 +7,23 @@ from typing import ( Dict, Generic, Iterable, + List, Optional, + Sequence, Tuple, Type, TypeVar, Union, - Sequence, - List, overload, ) from django.core.checks import CheckMessage - -from django.db.models import Model from django.core.exceptions import FieldDoesNotExist as FieldDoesNotExist -from django.db.models.expressions import Combinable, Col +from django.db.models import Model +from django.db.models.expressions import Col, Combinable from django.db.models.query_utils import RegisterLookupMixin -from django.forms import Field as FormField, Widget +from django.forms import Field as FormField +from django.forms import Widget from typing_extensions import Literal class NOT_PROVIDED: ... @@ -118,7 +118,9 @@ class Field(RegisterLookupMixin, Generic[_ST, _GT]): # TODO: plugin support def formfield(self, **kwargs) -> Any: ... def save_form_data(self, instance: Model, data: Any) -> None: ... - def contribute_to_class(self, cls: Type[Model], name: str, private_only: bool = ...) -> None: ... + def contribute_to_class( + self, cls: Type[Model], name: str, private_only: bool = ... + ) -> None: ... def to_python(self, value: Any) -> Any: ... def clean(self, value: Any, model_instance: Optional[Model]) -> Any: ... def get_choices( @@ -152,7 +154,9 @@ class SmallIntegerField(IntegerField): ... class BigIntegerField(IntegerField): ... class FloatField(Field[Union[float, int, str, Combinable], float]): ... -class DecimalField(Field[Union[str, float, decimal.Decimal, Combinable], decimal.Decimal]): +class DecimalField( + Field[Union[str, float, decimal.Decimal, Combinable], decimal.Decimal] +): # attributes max_digits: int = ... decimal_places: int = ... @@ -325,7 +329,9 @@ class BooleanField(Field[Union[bool, Combinable], bool]): ... class NullBooleanField(Field[Optional[Union[bool, Combinable]], Optional[bool]]): ... class IPAddressField(Field[Union[str, Combinable], str]): ... -class GenericIPAddressField(Field[Union[str, int, Callable[..., Any], Combinable], str]): +class GenericIPAddressField( + Field[Union[str, int, Callable[..., Any], Combinable], str] +): default_error_messages: Any = ... unpack_ipv4: Any = ... @@ -380,7 +386,9 @@ class DateField(DateTimeCheckMixin, Field[Union[str, date, Combinable], date]): error_messages: Optional[_ErrorMessagesToOverride] = ..., ): ... -class TimeField(DateTimeCheckMixin, Field[Union[str, time, datetime, Combinable], time]): +class TimeField( + DateTimeCheckMixin, Field[Union[str, time, datetime, Combinable], time] +): def __init__( self, verbose_name: Optional[Union[str, bytes]] = ..., @@ -406,7 +414,9 @@ class TimeField(DateTimeCheckMixin, Field[Union[str, time, datetime, Combinable] _DT = TypeVar("_DT", bound=Optional[datetime]) -class DateTimeField(Generic[_DT], DateTimeCheckMixin, Field[Union[str, datetime], datetime]): +class DateTimeField( + Generic[_DT], DateTimeCheckMixin, Field[Union[str, datetime], datetime] +): @overload def __init__( self: DateTimeField[datetime], diff --git a/django-stubs/db/models/fields/files.pyi b/django-stubs/db/models/fields/files.pyi index 1fba352b3..03d10e75a 100644 --- a/django-stubs/db/models/fields/files.pyi +++ b/django-stubs/db/models/fields/files.pyi @@ -5,14 +5,20 @@ from django.core.files.base import File from django.core.files.images import ImageFile from django.core.files.storage import FileSystemStorage, Storage from django.db.models.base import Model - -from django.db.models.fields import Field, _FieldChoices, _ValidatorCallable, _ErrorMessagesToOverride +from django.db.models.fields import ( + Field, + _ErrorMessagesToOverride, + _FieldChoices, + _ValidatorCallable, +) class FieldFile(File): instance: Model = ... field: FileField = ... storage: FileSystemStorage = ... - def __init__(self, instance: Model, field: FileField, name: Optional[str]) -> None: ... + def __init__( + self, instance: Model, field: FileField, name: Optional[str] + ) -> None: ... file: Any = ... @property def path(self) -> str: ... @@ -29,7 +35,9 @@ class FileDescriptor: field: FileField = ... def __init__(self, field: FileField) -> None: ... def __set__(self, instance: Model, value: Optional[Any]) -> None: ... - def __get__(self, instance: Optional[Model], cls: Type[Model] = ...) -> Union[FieldFile, FileDescriptor]: ... + def __get__( + self, instance: Optional[Model], cls: Type[Model] = ... + ) -> Union[FieldFile, FileDescriptor]: ... _T = TypeVar("_T", bound="Field") @@ -98,4 +106,6 @@ class ImageField(FileField): # non-Model instances @overload def __get__(self: _T, instance, owner) -> _T: ... - def update_dimension_fields(self, instance: Model, force: bool = ..., *args: Any, **kwargs: Any) -> None: ... + def update_dimension_fields( + self, instance: Model, force: bool = ..., *args: Any, **kwargs: Any + ) -> None: ... diff --git a/django-stubs/db/models/fields/json.pyi b/django-stubs/db/models/fields/json.pyi index a1dd4b312..ad5cd125c 100644 --- a/django-stubs/db/models/fields/json.pyi +++ b/django-stubs/db/models/fields/json.pyi @@ -1,8 +1,10 @@ -from . import Field -from .mixins import CheckFieldDefaultMixin +from typing import Any, Optional + from django.db.models import lookups from django.db.models.lookups import PostgresOperatorLookup, Transform -from typing import Any, Optional + +from . import Field +from .mixins import CheckFieldDefaultMixin class JSONField(CheckFieldDefaultMixin, Field): empty_strings_allowed: bool = ... @@ -99,14 +101,24 @@ class KeyTransformExact(JSONExact): def process_rhs(self, compiler: Any, connection: Any): ... def as_oracle(self, compiler: Any, connection: Any): ... -class KeyTransformIExact(CaseInsensitiveMixin, KeyTransformTextLookupMixin, lookups.IExact): ... -class KeyTransformIContains(CaseInsensitiveMixin, KeyTransformTextLookupMixin, lookups.IContains): ... +class KeyTransformIExact( + CaseInsensitiveMixin, KeyTransformTextLookupMixin, lookups.IExact +): ... +class KeyTransformIContains( + CaseInsensitiveMixin, KeyTransformTextLookupMixin, lookups.IContains +): ... class KeyTransformStartsWith(KeyTransformTextLookupMixin, lookups.StartsWith): ... -class KeyTransformIStartsWith(CaseInsensitiveMixin, KeyTransformTextLookupMixin, lookups.IStartsWith): ... +class KeyTransformIStartsWith( + CaseInsensitiveMixin, KeyTransformTextLookupMixin, lookups.IStartsWith +): ... class KeyTransformEndsWith(KeyTransformTextLookupMixin, lookups.EndsWith): ... -class KeyTransformIEndsWith(CaseInsensitiveMixin, KeyTransformTextLookupMixin, lookups.IEndsWith): ... +class KeyTransformIEndsWith( + CaseInsensitiveMixin, KeyTransformTextLookupMixin, lookups.IEndsWith +): ... class KeyTransformRegex(KeyTransformTextLookupMixin, lookups.Regex): ... -class KeyTransformIRegex(CaseInsensitiveMixin, KeyTransformTextLookupMixin, lookups.IRegex): ... +class KeyTransformIRegex( + CaseInsensitiveMixin, KeyTransformTextLookupMixin, lookups.IRegex +): ... class KeyTransformNumericLookupMixin: def process_rhs(self, compiler: Any, connection: Any): ... diff --git a/django-stubs/db/models/fields/mixins.pyi b/django-stubs/db/models/fields/mixins.pyi index 6e51a2912..fddb6595d 100644 --- a/django-stubs/db/models/fields/mixins.pyi +++ b/django-stubs/db/models/fields/mixins.pyi @@ -6,7 +6,9 @@ NOT_PROVIDED: Any class FieldCacheMixin: def get_cache_name(self) -> str: ... - def get_cached_value(self, instance: Model, default: Any = ...) -> Optional[Model]: ... + def get_cached_value( + self, instance: Model, default: Any = ... + ) -> Optional[Model]: ... def is_cached(self, instance: Model) -> bool: ... def set_cached_value(self, instance: Model, value: Optional[Model]) -> None: ... def delete_cached_value(self, instance: Model) -> None: ... diff --git a/django-stubs/db/models/fields/related.pyi b/django-stubs/db/models/fields/related.pyi index 9c448e229..ec9a93333 100644 --- a/django-stubs/db/models/fields/related.pyi +++ b/django-stubs/db/models/fields/related.pyi @@ -1,26 +1,48 @@ -from typing import Any, Callable, Dict, Iterable, List, Optional, Sequence, Tuple, Type, TypeVar, Union, overload +from typing import ( + Any, + Callable, + Dict, + Generic, + Iterable, + List, + Optional, + Sequence, + Tuple, + Type, + TypeVar, + Union, + overload, +) from uuid import UUID from django.db import models from django.db.models.base import Model -from django.db.models.fields import Field -from django.db.models.query_utils import Q, PathInfo -from django.db.models.manager import RelatedManager from django.db.models.expressions import Combinable +from django.db.models.fields import Field from django.db.models.fields.mixins import FieldCacheMixin +from django.db.models.fields.related_descriptors import ( + ForwardManyToOneDescriptor as ForwardManyToOneDescriptor, +) from django.db.models.fields.related_descriptors import ( # noqa: F401 ForwardOneToOneDescriptor as ForwardOneToOneDescriptor, - ForwardManyToOneDescriptor as ForwardManyToOneDescriptor, +) +from django.db.models.fields.related_descriptors import ( ManyToManyDescriptor as ManyToManyDescriptor, - ReverseOneToOneDescriptor as ReverseOneToOneDescriptor, +) +from django.db.models.fields.related_descriptors import ( ReverseManyToOneDescriptor as ReverseManyToOneDescriptor, ) +from django.db.models.fields.related_descriptors import ( + ReverseOneToOneDescriptor as ReverseOneToOneDescriptor, +) from django.db.models.fields.reverse_related import ( # noqa: F401 ForeignObjectRel as ForeignObjectRel, - OneToOneRel as OneToOneRel, - ManyToOneRel as ManyToOneRel, - ManyToManyRel as ManyToManyRel, ) +from django.db.models.fields.reverse_related import ManyToManyRel as ManyToManyRel +from django.db.models.fields.reverse_related import ManyToOneRel as ManyToOneRel +from django.db.models.fields.reverse_related import OneToOneRel as OneToOneRel +from django.db.models.manager import RelatedManager +from django.db.models.query_utils import PathInfo, Q from typing_extensions import Literal _T = TypeVar("_T", bound=models.Model) @@ -270,8 +292,12 @@ class ManyToManyField(RelatedField[_ST, _GT]): @overload def __get__(self: _F, instance, owner) -> _F: ... def get_path_info(self, filtered_relation: None = ...) -> List[PathInfo]: ... - def get_reverse_path_info(self, filtered_relation: None = ...) -> List[PathInfo]: ... - def contribute_to_related_class(self, cls: Type[Model], related: RelatedField) -> None: ... + def get_reverse_path_info( + self, filtered_relation: None = ... + ) -> List[PathInfo]: ... + def contribute_to_related_class( + self, cls: Type[Model], related: RelatedField + ) -> None: ... def m2m_db_table(self) -> str: ... def m2m_column_name(self) -> str: ... def m2m_reverse_name(self) -> str: ... @@ -279,4 +305,6 @@ class ManyToManyField(RelatedField[_ST, _GT]): def m2m_target_field_name(self) -> str: ... def m2m_reverse_target_field_name(self) -> str: ... -def create_many_to_many_intermediary_model(field: Type[Field], klass: Type[Model]) -> Type[Model]: ... +def create_many_to_many_intermediary_model( + field: Type[Field], klass: Type[Model] +) -> Type[Model]: ... diff --git a/django-stubs/db/models/fields/related_descriptors.pyi b/django-stubs/db/models/fields/related_descriptors.pyi index ef53788a3..201262d19 100644 --- a/django-stubs/db/models/fields/related_descriptors.pyi +++ b/django-stubs/db/models/fields/related_descriptors.pyi @@ -1,14 +1,13 @@ -from typing import Any, Callable, List, Optional, Tuple, Type, Union, Generic, TypeVar +from typing import Any, Callable, Generic, List, Optional, Tuple, Type, TypeVar, Union from django.core.exceptions import ObjectDoesNotExist from django.db.models.base import Model +from django.db.models.fields import Field from django.db.models.fields.mixins import FieldCacheMixin -from django.db.models.fields.related import RelatedField, OneToOneField +from django.db.models.fields.related import OneToOneField, RelatedField from django.db.models.fields.reverse_related import ManyToManyRel, OneToOneRel from django.db.models.query import QuerySet -from django.db.models.fields import Field - _T = TypeVar("_T") class ForwardManyToOneDescriptor: @@ -41,7 +40,9 @@ class ReverseOneToOneDescriptor: def get_prefetch_queryset( self, instances: List[Model], queryset: Optional[QuerySet] = ... ) -> Tuple[QuerySet, Callable, Callable, bool, str, bool]: ... - def __get__(self, instance: Optional[Model], cls: Type[Model] = ...) -> Union[Model, ReverseOneToOneDescriptor]: ... + def __get__( + self, instance: Optional[Model], cls: Type[Model] = ... + ) -> Union[Model, ReverseOneToOneDescriptor]: ... def __set__(self, instance: Model, value: Optional[Model]) -> None: ... def __reduce__(self) -> Tuple[Callable, Tuple[Type[Model], str]]: ... @@ -50,7 +51,9 @@ class ReverseManyToOneDescriptor: field: FieldCacheMixin = ... def __init__(self, rel: FieldCacheMixin) -> None: ... def related_manager_cls(self): ... - def __get__(self, instance: Optional[Model], cls: Type[Model] = ...) -> ReverseManyToOneDescriptor: ... + def __get__( + self, instance: Optional[Model], cls: Type[Model] = ... + ) -> ReverseManyToOneDescriptor: ... def __set__(self, instance: Model, value: List[Model]) -> Any: ... def create_reverse_many_to_one_manager(superclass: Any, rel: Any): ... @@ -67,4 +70,6 @@ class ManyToManyDescriptor(ReverseManyToOneDescriptor): class _ForwardManyToManyManager(Generic[_T]): def all(self) -> QuerySet: ... -def create_forward_many_to_many_manager(superclass: Any, rel: Any, reverse: Any) -> _ForwardManyToManyManager: ... +def create_forward_many_to_many_manager( + superclass: Any, rel: Any, reverse: Any +) -> _ForwardManyToManyManager: ... diff --git a/django-stubs/db/models/fields/related_lookups.pyi b/django-stubs/db/models/fields/related_lookups.pyi index c667edcb8..f1096238e 100644 --- a/django-stubs/db/models/fields/related_lookups.pyi +++ b/django-stubs/db/models/fields/related_lookups.pyi @@ -1,7 +1,8 @@ from collections import OrderedDict -from typing import Any, List, Tuple, Type, Iterable +from typing import Any, Iterable, List, Tuple, Type from django.db.models.expressions import Expression +from django.db.models.fields import Field from django.db.models.lookups import ( BuiltinLookup, Exact, @@ -13,8 +14,6 @@ from django.db.models.lookups import ( LessThanOrEqual, ) -from django.db.models.fields import Field - class MultiColSource: alias: str field: Field @@ -23,7 +22,11 @@ class MultiColSource: contains_aggregate: bool = ... output_field: Field = ... def __init__( - self, alias: str, targets: Tuple[Field, Field], sources: Tuple[Field, Field], field: Field + self, + alias: str, + targets: Tuple[Field, Field], + sources: Tuple[Field, Field], + field: Field, ) -> None: ... def relabeled_clone(self, relabels: OrderedDict) -> MultiColSource: ... def get_lookup(self, lookup: str) -> Type[BuiltinLookup]: ... diff --git a/django-stubs/db/models/fields/reverse_related.pyi b/django-stubs/db/models/fields/reverse_related.pyi index c2a43dd91..adee3afce 100644 --- a/django-stubs/db/models/fields/reverse_related.pyi +++ b/django-stubs/db/models/fields/reverse_related.pyi @@ -1,12 +1,12 @@ from typing import Any, Callable, Dict, List, Optional, Tuple, Type, Union from django.db.models.base import Model +from django.db.models.fields import AutoField, Field from django.db.models.fields.related import ForeignKey, OneToOneField, RelatedField from django.db.models.lookups import BuiltinLookup, StartsWith from django.db.models.query_utils import FilteredRelation, PathInfo from django.db.models.sql.where import WhereNode -from django.db.models.fields import AutoField, Field from .mixins import FieldCacheMixin class ForeignObjectRel(FieldCacheMixin): @@ -61,8 +61,12 @@ class ForeignObjectRel(FieldCacheMixin): self, where_class: Type[WhereNode], alias: str, related_alias: str ) -> Optional[Union[StartsWith, WhereNode]]: ... def set_field_name(self) -> None: ... - def get_accessor_name(self, model: Optional[Type[Model]] = ...) -> Optional[str]: ... - def get_path_info(self, filtered_relation: Optional[FilteredRelation] = ...) -> List[PathInfo]: ... + def get_accessor_name( + self, model: Optional[Type[Model]] = ... + ) -> Optional[str]: ... + def get_path_info( + self, filtered_relation: Optional[FilteredRelation] = ... + ) -> List[PathInfo]: ... class ManyToOneRel(ForeignObjectRel): def __init__( diff --git a/django-stubs/db/models/functions/__init__.pyi b/django-stubs/db/models/functions/__init__.pyi index e95196af9..186fb979c 100644 --- a/django-stubs/db/models/functions/__init__.pyi +++ b/django-stubs/db/models/functions/__init__.pyi @@ -1,93 +1,85 @@ -from .text import ( - Lower as Lower, - Upper as Upper, - Length as Length, - Chr as Chr, - Concat as Concat, - ConcatPair as ConcatPair, - Left as Left, - Right as Right, - LPad as LPad, - RPad as RPad, - LTrim as LTrim, - RTrim as RTrim, - Trim as Trim, - Ord as Ord, - Repeat as Repeat, - SHA1 as SHA1, - SHA224 as SHA224, - SHA256 as SHA256, - SHA384 as SHA384, - SHA512 as SHA512, - StrIndex as StrIndex, - Substr as Substr, - Replace as Replace, - Reverse as Reverse, -) - -from .window import ( - CumeDist as CumeDist, - DenseRank as DenseRank, - FirstValue as FirstValue, - Lag as Lag, - LastValue as LastValue, - Lead as Lead, - NthValue as NthValue, - Ntile as Ntile, - PercentRank as PercentRank, - Rank as Rank, - RowNumber as RowNumber, -) - -from .datetime import ( - Extract as Extract, - ExtractDay as ExtractDay, - ExtractHour as ExtractHour, - ExtractMinute as ExtractMinute, - ExtractSecond as ExtractSecond, - ExtractMonth as ExtractMonth, - ExtractQuarter as ExtractQuarter, - ExtractWeek as ExtractWeek, - ExtractWeekDay as ExtractWeekDay, - ExtractYear as ExtractYear, - ExtractIsoYear as ExtractIsoYear, - Trunc as Trunc, - TruncDate as TruncDate, - TruncDay as TruncDay, - TruncHour as TruncHour, - TruncMinute as TruncMinute, - TruncQuarter as TruncQuarter, - TruncMonth as TruncMonth, - TruncSecond as TruncSecond, - TruncTime as TruncTime, - TruncWeek as TruncWeek, - TruncYear as TruncYear, - Now as Now, -) - -from .comparison import Coalesce as Coalesce, Greatest as Greatest, Least as Least, Cast as Cast, NullIf as NullIf - -from .math import ( - Abs as Abs, - ACos as ACos, - ASin as ASin, - ATan as ATan, - ATan2 as ATan2, - Ceil as Ceil, - Cos as Cos, - Cot as Cot, - Degrees as Degrees, - Floor as Floor, - Exp as Exp, - Ln as Ln, - Log as Log, - Mod as Mod, - Pi as Pi, - Power as Power, - Radians as Radians, - Round as Round, - Sign as Sign, - Sin as Sin, - Sqrt as Sqrt, - Tan as Tan, -) +from .comparison import Cast as Cast +from .comparison import Coalesce as Coalesce +from .comparison import Greatest as Greatest +from .comparison import Least as Least +from .comparison import NullIf as NullIf +from .datetime import Extract as Extract +from .datetime import ExtractDay as ExtractDay +from .datetime import ExtractHour as ExtractHour +from .datetime import ExtractIsoYear as ExtractIsoYear +from .datetime import ExtractMinute as ExtractMinute +from .datetime import ExtractMonth as ExtractMonth +from .datetime import ExtractQuarter as ExtractQuarter +from .datetime import ExtractSecond as ExtractSecond +from .datetime import ExtractWeek as ExtractWeek +from .datetime import ExtractWeekDay as ExtractWeekDay +from .datetime import ExtractYear as ExtractYear +from .datetime import Now as Now +from .datetime import Trunc as Trunc +from .datetime import TruncDate as TruncDate +from .datetime import TruncDay as TruncDay +from .datetime import TruncHour as TruncHour +from .datetime import TruncMinute as TruncMinute +from .datetime import TruncMonth as TruncMonth +from .datetime import TruncQuarter as TruncQuarter +from .datetime import TruncSecond as TruncSecond +from .datetime import TruncTime as TruncTime +from .datetime import TruncWeek as TruncWeek +from .datetime import TruncYear as TruncYear +from .math import Abs as Abs +from .math import ACos as ACos +from .math import ASin as ASin +from .math import ATan as ATan +from .math import ATan2 as ATan2 +from .math import Ceil as Ceil +from .math import Cos as Cos +from .math import Cot as Cot +from .math import Degrees as Degrees +from .math import Exp as Exp +from .math import Floor as Floor +from .math import Ln as Ln +from .math import Log as Log +from .math import Mod as Mod +from .math import Pi as Pi +from .math import Power as Power +from .math import Radians as Radians +from .math import Round as Round +from .math import Sign as Sign +from .math import Sin as Sin +from .math import Sqrt as Sqrt +from .math import Tan as Tan +from .text import SHA1 as SHA1 +from .text import SHA224 as SHA224 +from .text import SHA256 as SHA256 +from .text import SHA384 as SHA384 +from .text import SHA512 as SHA512 +from .text import Chr as Chr +from .text import Concat as Concat +from .text import ConcatPair as ConcatPair +from .text import Left as Left +from .text import Length as Length +from .text import Lower as Lower +from .text import LPad as LPad +from .text import LTrim as LTrim +from .text import Ord as Ord +from .text import Repeat as Repeat +from .text import Replace as Replace +from .text import Reverse as Reverse +from .text import Right as Right +from .text import RPad as RPad +from .text import RTrim as RTrim +from .text import StrIndex as StrIndex +from .text import Substr as Substr +from .text import Trim as Trim +from .text import Upper as Upper +from .window import CumeDist as CumeDist +from .window import DenseRank as DenseRank +from .window import FirstValue as FirstValue +from .window import Lag as Lag +from .window import LastValue as LastValue +from .window import Lead as Lead +from .window import NthValue as NthValue +from .window import Ntile as Ntile +from .window import PercentRank as PercentRank +from .window import Rank as Rank +from .window import RowNumber as RowNumber diff --git a/django-stubs/db/models/functions/math.pyi b/django-stubs/db/models/functions/math.pyi index 36adeb0d4..a99c858fb 100644 --- a/django-stubs/db/models/functions/math.pyi +++ b/django-stubs/db/models/functions/math.pyi @@ -1,5 +1,8 @@ from django.db.models.expressions import Func -from django.db.models.functions.mixins import FixDecimalInputMixin, NumericOutputFieldMixin +from django.db.models.functions.mixins import ( + FixDecimalInputMixin, + NumericOutputFieldMixin, +) from django.db.models.lookups import Transform class Abs(Transform): ... diff --git a/django-stubs/db/models/functions/text.pyi b/django-stubs/db/models/functions/text.pyi index fc120a48e..b6905af07 100644 --- a/django-stubs/db/models/functions/text.pyi +++ b/django-stubs/db/models/functions/text.pyi @@ -1,11 +1,10 @@ from typing import Any, List, Optional, Tuple, Union from django.db.backends.sqlite3.base import DatabaseWrapper +from django.db.models import Func, Transform from django.db.models.expressions import Combinable, Expression, Value from django.db.models.sql.compiler import SQLCompiler -from django.db.models import Func, Transform - class BytesToCharFieldConversionMixin: ... class Chr(Transform): ... @@ -15,7 +14,9 @@ class ConcatPair(Func): class Concat(Func): ... class Left(Func): - def __init__(self, expression: str, length: Union[Value, int], **extra: Any) -> None: ... + def __init__( + self, expression: str, length: Union[Value, int], **extra: Any + ) -> None: ... def get_substr(self) -> Substr: ... def use_substr( self, compiler: SQLCompiler, connection: DatabaseWrapper, **extra_context: Any @@ -26,17 +27,32 @@ class Lower(Transform): ... class LPad(BytesToCharFieldConversionMixin, Func): def __init__( - self, expression: str, length: Optional[Union[Length, int]], fill_text: Value = ..., **extra: Any + self, + expression: str, + length: Optional[Union[Length, int]], + fill_text: Value = ..., + **extra: Any ) -> None: ... class LTrim(Transform): ... class Ord(Transform): ... class Repeat(BytesToCharFieldConversionMixin, Func): - def __init__(self, expression: Union[Value, str], number: Optional[Union[Length, int]], **extra: Any) -> None: ... + def __init__( + self, + expression: Union[Value, str], + number: Optional[Union[Length, int]], + **extra: Any + ) -> None: ... class Replace(Func): - def __init__(self, expression: Combinable, text: Value, replacement: Value = ..., **extra: Any) -> None: ... + def __init__( + self, + expression: Combinable, + text: Value, + replacement: Value = ..., + **extra: Any + ) -> None: ... class Right(Left): ... class RPad(LPad): ... diff --git a/django-stubs/db/models/functions/window.pyi b/django-stubs/db/models/functions/window.pyi index 789a4fd74..1b1e44405 100644 --- a/django-stubs/db/models/functions/window.pyi +++ b/django-stubs/db/models/functions/window.pyi @@ -8,7 +8,11 @@ class FirstValue(Func): ... class LagLeadFunction(Func): def __init__( - self, expression: Optional[str], offset: int = ..., default: Optional[int] = ..., **extra: Any + self, + expression: Optional[str], + offset: int = ..., + default: Optional[int] = ..., + **extra: Any ) -> None: ... class Lag(LagLeadFunction): ... @@ -16,7 +20,9 @@ class LastValue(Func): ... class Lead(LagLeadFunction): ... class NthValue(Func): - def __init__(self, expression: Optional[str], nth: int = ..., **extra: Any) -> None: ... + def __init__( + self, expression: Optional[str], nth: int = ..., **extra: Any + ) -> None: ... class Ntile(Func): def __init__(self, num_buckets: int = ..., **extra: Any) -> None: ... diff --git a/django-stubs/db/models/indexes.pyi b/django-stubs/db/models/indexes.pyi index cb33b493f..9f0ab5336 100644 --- a/django-stubs/db/models/indexes.pyi +++ b/django-stubs/db/models/indexes.pyi @@ -26,9 +26,14 @@ class Index: ) -> None: ... def check_name(self) -> List[str]: ... def create_sql( - self, model: Type[Model], schema_editor: BaseDatabaseSchemaEditor, using: str = ... + self, + model: Type[Model], + schema_editor: BaseDatabaseSchemaEditor, + using: str = ..., ) -> Statement: ... - def remove_sql(self, model: Type[Model], schema_editor: BaseDatabaseSchemaEditor) -> str: ... + def remove_sql( + self, model: Type[Model], schema_editor: BaseDatabaseSchemaEditor + ) -> str: ... def deconstruct(self) -> Any: ... def clone(self) -> Index: ... def set_name_with_model(self, model: Type[Model]) -> None: ... diff --git a/django-stubs/db/models/lookups.pyi b/django-stubs/db/models/lookups.pyi index d418db574..f9fec9b74 100644 --- a/django-stubs/db/models/lookups.pyi +++ b/django-stubs/db/models/lookups.pyi @@ -1,15 +1,25 @@ from datetime import datetime -from typing import Any, Iterable, List, Optional, Tuple, Type, Union, Mapping, TypeVar, Generic +from typing import ( + Any, + Generic, + Iterable, + List, + Mapping, + Optional, + Tuple, + Type, + TypeVar, + Union, +) from django.db.backends.sqlite3.base import DatabaseWrapper from django.db.models.expressions import Expression, Func +from django.db.models.fields import TextField, related_lookups from django.db.models.query_utils import RegisterLookupMixin from django.db.models.sql.compiler import SQLCompiler from django.utils.datastructures import OrderedSet from django.utils.safestring import SafeText -from django.db.models.fields import TextField, related_lookups - _T = TypeVar("_T") class Lookup(Generic[_T]): @@ -19,19 +29,33 @@ class Lookup(Generic[_T]): lhs: Any = ... rhs: Any = ... bilateral_transforms: List[Type[Transform]] = ... - def __init__(self, lhs: Union[Expression, TextField, related_lookups.MultiColSource], rhs: Any) -> None: ... + def __init__( + self, + lhs: Union[Expression, TextField, related_lookups.MultiColSource], + rhs: Any, + ) -> None: ... def apply_bilateral_transforms(self, value: Expression) -> Transform: ... def batch_process_rhs( - self, compiler: SQLCompiler, connection: DatabaseWrapper, rhs: Optional[OrderedSet] = ... + self, + compiler: SQLCompiler, + connection: DatabaseWrapper, + rhs: Optional[OrderedSet] = ..., ) -> Tuple[List[str], List[str]]: ... def get_source_expressions(self) -> List[Expression]: ... def set_source_expressions(self, new_exprs: List[Expression]) -> None: ... def get_prep_lookup(self) -> Any: ... - def get_db_prep_lookup(self, value: Union[int, str], connection: DatabaseWrapper) -> Tuple[str, List[SafeText]]: ... + def get_db_prep_lookup( + self, value: Union[int, str], connection: DatabaseWrapper + ) -> Tuple[str, List[SafeText]]: ... def process_lhs( - self, compiler: SQLCompiler, connection: DatabaseWrapper, lhs: Optional[Expression] = ... + self, + compiler: SQLCompiler, + connection: DatabaseWrapper, + lhs: Optional[Expression] = ..., + ) -> Tuple[str, List[Union[int, str]]]: ... + def process_rhs( + self, compiler: SQLCompiler, connection: DatabaseWrapper ) -> Tuple[str, List[Union[int, str]]]: ... - def process_rhs(self, compiler: SQLCompiler, connection: DatabaseWrapper) -> Tuple[str, List[Union[int, str]]]: ... def rhs_is_direct_value(self) -> bool: ... def relabeled_clone(self: _T, relabels: Mapping[str, str]) -> _T: ... def get_group_by_cols(self) -> List[Expression]: ... @@ -74,7 +98,9 @@ class IntegerFieldFloatRounding: rhs: Any = ... def get_prep_lookup(self) -> Any: ... -class IntegerGreaterThanOrEqual(IntegerFieldFloatRounding, GreaterThanOrEqual[Union[int, float]]): ... +class IntegerGreaterThanOrEqual( + IntegerFieldFloatRounding, GreaterThanOrEqual[Union[int, float]] +): ... class IntegerLessThan(IntegerFieldFloatRounding, LessThan[Union[int, float]]): ... class In(FieldGetDbPrepValueIterableMixin, BuiltinLookup): @@ -95,7 +121,9 @@ class Regex(BuiltinLookup[str]): ... class IRegex(Regex): ... class YearLookup(Lookup): - def year_lookup_bounds(self, connection: DatabaseWrapper, year: int) -> List[str]: ... + def year_lookup_bounds( + self, connection: DatabaseWrapper, year: int + ) -> List[str]: ... class YearComparisonLookup(YearLookup): def get_rhs_op(self, connection: DatabaseWrapper, rhs: str) -> str: ... diff --git a/django-stubs/db/models/manager.pyi b/django-stubs/db/models/manager.pyi index 50bef8dab..991caad80 100644 --- a/django-stubs/db/models/manager.pyi +++ b/django-stubs/db/models/manager.pyi @@ -1,4 +1,4 @@ -from typing import Any, Dict, List, Optional, Tuple, Type, TypeVar, Iterable, Union +from typing import Any, Dict, Iterable, List, Optional, Tuple, Type, TypeVar, Union from django.db.models.base import Model from django.db.models.query import QuerySet @@ -18,11 +18,15 @@ class BaseManager(QuerySet[_T]): def deconstruct(self) -> Tuple[bool, str, None, Tuple, Dict[str, int]]: ... def check(self, **kwargs: Any) -> List[Any]: ... @classmethod - def from_queryset(cls, queryset_class: Type[QuerySet], class_name: Optional[str] = ...) -> Any: ... + def from_queryset( + cls, queryset_class: Type[QuerySet], class_name: Optional[str] = ... + ) -> Any: ... @classmethod def _get_queryset_methods(cls, queryset_class: type) -> Dict[str, Any]: ... def contribute_to_class(self, model: Type[Model], name: str) -> None: ... - def db_manager(self: _M, using: Optional[str] = ..., hints: Optional[Dict[str, Model]] = ...) -> _M: ... + def db_manager( + self: _M, using: Optional[str] = ..., hints: Optional[Dict[str, Model]] = ... + ) -> _M: ... def get_queryset(self) -> QuerySet[_T]: ... class Manager(BaseManager[_T]): ... @@ -32,7 +36,11 @@ class RelatedManager(Manager[_T]): def add(self, *objs: Union[_T, int], bulk: bool = ...) -> None: ... def remove(self, *objs: Union[_T, int], bulk: bool = ...) -> None: ... def set( - self, objs: Union[QuerySet[_T], Iterable[Union[_T, int]]], *, bulk: bool = ..., clear: bool = ... + self, + objs: Union[QuerySet[_T], Iterable[Union[_T, int]]], + *, + bulk: bool = ..., + clear: bool = ... ) -> None: ... def clear(self) -> None: ... diff --git a/django-stubs/db/models/options.pyi b/django-stubs/db/models/options.pyi index d7fee8136..45e81fba7 100644 --- a/django-stubs/db/models/options.pyi +++ b/django-stubs/db/models/options.pyi @@ -1,5 +1,18 @@ import collections -from typing import Any, Callable, Dict, Generic, Iterator, List, Optional, Sequence, Tuple, Type, TypeVar, Union +from typing import ( + Any, + Callable, + Dict, + Generic, + Iterator, + List, + Optional, + Sequence, + Tuple, + Type, + TypeVar, + Union, +) from django.apps.config import AppConfig from django.apps.registry import Apps @@ -9,6 +22,7 @@ from django.contrib.postgres.fields.citext import CIText from django.db.backends.sqlite3.base import DatabaseWrapper from django.db.models.base import Model from django.db.models.constraints import BaseConstraint +from django.db.models.fields import AutoField, Field from django.db.models.fields.mixins import FieldCacheMixin from django.db.models.fields.related import ManyToManyField, OneToOneField from django.db.models.fields.reverse_related import ForeignObjectRel @@ -16,8 +30,6 @@ from django.db.models.manager import Manager from django.db.models.query_utils import PathInfo from django.utils.datastructures import ImmutableList -from django.db.models.fields import AutoField, Field - PROXY_PARENTS: Any EMPTY_RELATION_TREE: Any IMMUTABLE_WARNING: str @@ -27,7 +39,12 @@ def normalize_together( option_together: Union[Sequence[Tuple[str, str]], Tuple[str, str]] ) -> Tuple[Tuple[str, str], ...]: ... def make_immutable_fields_list( - name: str, data: Union[Iterator[Any], List[Union[ArrayField, CIText]], List[Union[Field, FieldCacheMixin]]] + name: str, + data: Union[ + Iterator[Any], + List[Union[ArrayField, CIText]], + List[Union[Field, FieldCacheMixin]], + ], ) -> ImmutableList: ... _M = TypeVar("_M", bound=Model) @@ -83,7 +100,9 @@ class Options(Generic[_M]): default_related_name: Optional[str] = ... model: Type[Model] = ... original_attrs: Dict[str, Any] = ... - def __init__(self, meta: Optional[type], app_label: Optional[str] = ...) -> None: ... + def __init__( + self, meta: Optional[type], app_label: Optional[str] = ... + ) -> None: ... @property def label(self) -> str: ... @property @@ -94,7 +113,9 @@ class Options(Generic[_M]): def installed(self): ... def contribute_to_class(self, cls: Type[Model], name: str) -> None: ... def add_manager(self, manager: Manager) -> None: ... - def add_field(self, field: Union[GenericForeignKey, Field], private: bool = ...) -> None: ... + def add_field( + self, field: Union[GenericForeignKey, Field], private: bool = ... + ) -> None: ... def setup_pk(self, field: Field) -> None: ... def setup_proxy(self, target: Type[Model]) -> None: ... def can_migrate(self, connection: Union[DatabaseWrapper, str]) -> bool: ... diff --git a/django-stubs/db/models/query.pyi b/django-stubs/db/models/query.pyi index 901884d00..21f490e36 100644 --- a/django-stubs/db/models/query.pyi +++ b/django-stubs/db/models/query.pyi @@ -9,6 +9,7 @@ from typing import ( List, MutableMapping, Optional, + Reversible, Sequence, Sized, Tuple, @@ -16,16 +17,15 @@ from typing import ( TypeVar, Union, overload, - Reversible, ) -from django.db.models.base import Model -from django.db.models.expressions import Combinable as Combinable, F as F # noqa: F401 -from django.db.models.sql.query import Query, RawQuery - from django.db import models from django.db.models import Manager +from django.db.models.base import Model +from django.db.models.expressions import Combinable as Combinable # noqa: F401 +from django.db.models.expressions import F as F from django.db.models.query_utils import Q as Q # noqa: F401 +from django.db.models.sql.query import Query, RawQuery _T = TypeVar("_T", bound=models.Model, covariant=True) _QS = TypeVar("_QS", bound="_BaseQuerySet") @@ -54,10 +54,17 @@ class _BaseQuerySet(Generic[_T], Sized): def get(self, *args: Any, **kwargs: Any) -> _T: ... def create(self, *args: Any, **kwargs: Any) -> _T: ... def bulk_create( - self, objs: Iterable[_T], batch_size: Optional[int] = ..., ignore_conflicts: bool = ... + self, + objs: Iterable[_T], + batch_size: Optional[int] = ..., + ignore_conflicts: bool = ..., ) -> List[_T]: ... - def bulk_update(self, objs: Iterable[_T], fields: Sequence[str], batch_size: Optional[int] = ...) -> None: ... - def get_or_create(self, defaults: Optional[MutableMapping[str, Any]] = ..., **kwargs: Any) -> Tuple[_T, bool]: ... + def bulk_update( + self, objs: Iterable[_T], fields: Sequence[str], batch_size: Optional[int] = ... + ) -> None: ... + def get_or_create( + self, defaults: Optional[MutableMapping[str, Any]] = ..., **kwargs: Any + ) -> Tuple[_T, bool]: ... def update_or_create( self, defaults: Optional[MutableMapping[str, Any]] = ..., **kwargs: Any ) -> Tuple[_T, bool]: ... @@ -65,7 +72,9 @@ class _BaseQuerySet(Generic[_T], Sized): def latest(self, *fields: Any, field_name: Optional[Any] = ...) -> _T: ... def first(self) -> Optional[_T]: ... def last(self) -> Optional[_T]: ... - def in_bulk(self, id_list: Iterable[Any] = ..., *, field_name: str = ...) -> Dict[Any, _T]: ... + def in_bulk( + self, id_list: Iterable[Any] = ..., *, field_name: str = ... + ) -> Dict[Any, _T]: ... def delete(self) -> Tuple[int, Dict[str, int]]: ... def update(self, **kwargs: Any) -> int: ... def exists(self) -> bool: ... @@ -78,14 +87,22 @@ class _BaseQuerySet(Generic[_T], Sized): using: Optional[str] = ..., ) -> RawQuerySet: ... # The type of values may be overridden to be more specific in the mypy plugin, depending on the fields param - def values(self, *fields: Union[str, Combinable], **expressions: Any) -> ValuesQuerySet[_T, Dict[str, Any]]: ... + def values( + self, *fields: Union[str, Combinable], **expressions: Any + ) -> ValuesQuerySet[_T, Dict[str, Any]]: ... # The type of values_list may be overridden to be more specific in the mypy plugin, depending on the fields param def values_list( self, *fields: Union[str, Combinable], flat: bool = ..., named: bool = ... ) -> ValuesQuerySet[_T, Any]: ... - def dates(self, field_name: str, kind: str, order: str = ...) -> ValuesQuerySet[_T, datetime.date]: ... + def dates( + self, field_name: str, kind: str, order: str = ... + ) -> ValuesQuerySet[_T, datetime.date]: ... def datetimes( - self, field_name: str, kind: str, order: str = ..., tzinfo: Optional[datetime.tzinfo] = ... + self, + field_name: str, + kind: str, + order: str = ..., + tzinfo: Optional[datetime.tzinfo] = ..., ) -> ValuesQuerySet[_T, datetime.datetime]: ... def none(self: _QS) -> _QS: ... def all(self: _QS) -> _QS: ... @@ -96,7 +113,9 @@ class _BaseQuerySet(Generic[_T], Sized): def union(self: _QS, *other_qs: Any, all: bool = ...) -> _QS: ... def intersection(self: _QS, *other_qs: Any) -> _QS: ... def difference(self: _QS, *other_qs: Any) -> _QS: ... - def select_for_update(self: _QS, nowait: bool = ..., skip_locked: bool = ..., of: Sequence[str] = ...) -> _QS: ... + def select_for_update( + self: _QS, nowait: bool = ..., skip_locked: bool = ..., of: Sequence[str] = ... + ) -> _QS: ... def select_related(self: _QS, *fields: Any) -> _QS: ... def prefetch_related(self: _QS, *lookups: Any) -> _QS: ... # TODO: return type @@ -135,7 +154,9 @@ class QuerySet(_BaseQuerySet[_T], Collection[_T], Reversible[_T], Sized): _Row = TypeVar("_Row", covariant=True) class BaseIterable(Sequence[_Row]): - def __init__(self, queryset: _BaseQuerySet, chunked_fetch: bool = ..., chunk_size: int = ...): ... + def __init__( + self, queryset: _BaseQuerySet, chunked_fetch: bool = ..., chunk_size: int = ... + ): ... def __iter__(self) -> Iterator[_Row]: ... def __contains__(self, x: object) -> bool: ... def __len__(self) -> int: ... @@ -195,19 +216,30 @@ class RawQuerySet(Iterable[_T], Sized): @property def model_fields(self) -> Dict[str, str]: ... def prefetch_related(self, *lookups: Any) -> RawQuerySet[_T]: ... - def resolve_model_init_order(self) -> Tuple[List[str], List[int], List[Tuple[str, int]]]: ... + def resolve_model_init_order( + self, + ) -> Tuple[List[str], List[int], List[Tuple[str, int]]]: ... def using(self, alias: Optional[str]) -> RawQuerySet[_T]: ... class Prefetch(object): - def __init__(self, lookup: str, queryset: Optional[QuerySet] = ..., to_attr: Optional[str] = ...) -> None: ... + def __init__( + self, + lookup: str, + queryset: Optional[QuerySet] = ..., + to_attr: Optional[str] = ..., + ) -> None: ... def __getstate__(self) -> Dict[str, Any]: ... def add_prefix(self, prefix: str) -> None: ... def get_current_prefetch_to(self, level: int) -> str: ... def get_current_to_attr(self, level: int) -> Tuple[str, str]: ... def get_current_queryset(self, level) -> Optional[QuerySet]: ... -def prefetch_related_objects(model_instances: Iterable[_T], *related_lookups: Union[str, Prefetch]) -> None: ... -def get_prefetcher(instance: Model, through_attr: str, to_attr: str) -> Tuple[Any, Any, bool, bool]: ... +def prefetch_related_objects( + model_instances: Iterable[_T], *related_lookups: Union[str, Prefetch] +) -> None: ... +def get_prefetcher( + instance: Model, through_attr: str, to_attr: str +) -> Tuple[Any, Any, bool, bool]: ... class InstanceCheckMeta(type): ... class EmptyQuerySet(metaclass=InstanceCheckMeta): ... diff --git a/django-stubs/db/models/query_utils.pyi b/django-stubs/db/models/query_utils.pyi index 7ee77bcdb..6eaa2521a 100644 --- a/django-stubs/db/models/query_utils.pyi +++ b/django-stubs/db/models/query_utils.pyi @@ -1,20 +1,36 @@ from collections import namedtuple -from typing import Any, Collection, Dict, Iterator, List, Mapping, Optional, Sequence, Set, Tuple, Type +from typing import ( + Any, + Collection, + Dict, + Iterator, + List, + Mapping, + Optional, + Sequence, + Set, + Tuple, + Type, +) from django.db.models.base import Model +from django.db.models.fields import Field from django.db.models.fields.mixins import FieldCacheMixin from django.db.models.sql.compiler import SQLCompiler from django.db.models.sql.query import Query from django.db.models.sql.where import WhereNode - -from django.db.models.fields import Field from django.utils import tree -PathInfo = namedtuple("PathInfo", "from_opts to_opts target_fields join_field m2m direct filtered_relation") +PathInfo = namedtuple( + "PathInfo", + "from_opts to_opts target_fields join_field m2m direct filtered_relation", +) class InvalidQuery(Exception): ... -def subclasses(cls: Type[RegisterLookupMixin]) -> Iterator[Type[RegisterLookupMixin]]: ... +def subclasses( + cls: Type[RegisterLookupMixin], +) -> Iterator[Type[RegisterLookupMixin]]: ... class QueryWrapper: contains_aggregate: bool = ... @@ -54,7 +70,9 @@ class RegisterLookupMixin: @staticmethod def merge_dicts(dicts: List[Dict[str, Any]]) -> Dict[str, Any]: ... @classmethod - def register_lookup(cls, lookup: Any, lookup_name: Optional[str] = ...) -> Type[Any]: ... + def register_lookup( + cls, lookup: Any, lookup_name: Optional[str] = ... + ) -> Type[Any]: ... @classmethod def _unregister_lookup(cls, lookup: Any, lookup_name: Optional[str] = ...): ... @@ -65,8 +83,12 @@ def select_related_descend( load_fields: Optional[Collection[str]], reverse: bool = ..., ) -> bool: ... -def refs_expression(lookup_parts: Sequence[str], annotations: Mapping[str, bool]) -> Tuple[bool, Sequence[str]]: ... -def check_rel_lookup_compatibility(model: Type[Model], target_opts: Any, field: FieldCacheMixin) -> bool: ... +def refs_expression( + lookup_parts: Sequence[str], annotations: Mapping[str, bool] +) -> Tuple[bool, Sequence[str]]: ... +def check_rel_lookup_compatibility( + model: Type[Model], target_opts: Any, field: FieldCacheMixin +) -> bool: ... class FilteredRelation: relation_name: str = ... diff --git a/django-stubs/db/models/sql/__init__.pyi b/django-stubs/db/models/sql/__init__.pyi index f5faddaf2..ee2ea4874 100644 --- a/django-stubs/db/models/sql/__init__.pyi +++ b/django-stubs/db/models/sql/__init__.pyi @@ -1,8 +1,6 @@ -from .query import Query as Query, RawQuery as RawQuery - -from .subqueries import ( - InsertQuery as InsertQuery, - AggregateQuery as AggregateQuery, - DeleteQuery as DeleteQuery, - UpdateQuery as UpdateQuery, -) +from .query import Query as Query +from .query import RawQuery as RawQuery +from .subqueries import AggregateQuery as AggregateQuery +from .subqueries import DeleteQuery as DeleteQuery +from .subqueries import InsertQuery as InsertQuery +from .subqueries import UpdateQuery as UpdateQuery diff --git a/django-stubs/db/models/sql/compiler.pyi b/django-stubs/db/models/sql/compiler.pyi index c0c257ddc..ed3e091fa 100644 --- a/django-stubs/db/models/sql/compiler.pyi +++ b/django-stubs/db/models/sql/compiler.pyi @@ -1,12 +1,22 @@ from datetime import date, datetime from decimal import Decimal from itertools import chain -from typing import Any, Callable, Dict, Iterator, List, Optional, Set, Tuple, Type, Union +from typing import ( + Any, + Callable, + Dict, + Iterator, + List, + Optional, + Set, + Tuple, + Type, + Union, +) from uuid import UUID from django.db.models.base import Model from django.db.models.expressions import BaseExpression, Expression - from django.db.models.sql.query import Query, RawQuery FORCE: Any @@ -20,7 +30,9 @@ class SQLCompiler: annotation_col_map: Any = ... klass_info: Any = ... ordering_parts: Any = ... - def __init__(self, query: Union[Query, RawQuery], connection: Any, using: Optional[str]) -> None: ... + def __init__( + self, query: Union[Query, RawQuery], connection: Any, using: Optional[str] + ) -> None: ... col_count: Any = ... def setup_query(self) -> None: ... has_extra_select: Any = ... @@ -56,10 +68,15 @@ class SQLCompiler: def compile( self, node: Any, select_format: Any = ... ) -> Tuple[str, Union[List[Optional[int]], Tuple[int, int]]]: ... - def get_combinator_sql(self, combinator: str, all: bool) -> Tuple[List[str], Union[List[int], List[str]]]: ... + def get_combinator_sql( + self, combinator: str, all: bool + ) -> Tuple[List[str], Union[List[int], List[str]]]: ... def as_sql(self, with_limits: bool = ..., with_col_aliases: bool = ...) -> Any: ... def get_default_columns( - self, start_alias: Optional[str] = ..., opts: Optional[Any] = ..., from_parent: Optional[Type[Model]] = ... + self, + start_alias: Optional[str] = ..., + opts: Optional[Any] = ..., + from_parent: Optional[Type[Model]] = ..., ) -> List[Expression]: ... def get_distinct(self) -> Tuple[List[Any], List[Any]]: ... def find_ordering_name( @@ -68,7 +85,9 @@ class SQLCompiler: opts: Any, alias: Optional[str] = ..., default_order: str = ..., - already_seen: Optional[Set[Tuple[Optional[Tuple[Tuple[str, str]]], Tuple[Tuple[str, str]]]]] = ..., + already_seen: Optional[ + Set[Tuple[Optional[Tuple[Tuple[str, str]]], Tuple[Tuple[str, str]]]] + ] = ..., ) -> List[Tuple[Expression, bool]]: ... def get_from_clause(self) -> Tuple[List[str], List[Union[int, str]]]: ... def get_related_selections( @@ -77,12 +96,16 @@ class SQLCompiler: opts: Optional[Any] = ..., root_alias: Optional[str] = ..., cur_depth: int = ..., - requested: Optional[Union[Dict[str, Dict[str, Dict[str, Dict[Any, Any]]]], bool]] = ..., + requested: Optional[ + Union[Dict[str, Dict[str, Dict[str, Dict[Any, Any]]]], bool] + ] = ..., restricted: Optional[bool] = ..., ) -> List[Dict[str, Any]]: ... def get_select_for_update_of_arguments(self): ... def deferred_to_columns(self) -> Dict[Type[Model], Set[str]]: ... - def get_converters(self, expressions: List[Expression]) -> Dict[int, Tuple[List[Callable], Expression]]: ... + def get_converters( + self, expressions: List[Expression] + ) -> Dict[int, Tuple[List[Callable], Expression]]: ... def apply_converters( self, rows: chain, converters: Dict[int, Tuple[List[Callable], Expression]] ) -> Iterator[ @@ -94,7 +117,9 @@ class SQLCompiler: ]: ... def results_iter( self, - results: Optional[Union[Iterator[Any], List[List[Tuple[Union[int, str]]]]]] = ..., + results: Optional[ + Union[Iterator[Any], List[List[Tuple[Union[int, str]]]]] + ] = ..., tuple_expected: bool = ..., chunked_fetch: bool = ..., chunk_size: int = ..., @@ -103,7 +128,9 @@ class SQLCompiler: def execute_sql( self, result_type: str = ..., chunked_fetch: bool = ..., chunk_size: int = ... ) -> Optional[Any]: ... - def as_subquery_condition(self, alias: str, columns: List[str], compiler: SQLCompiler) -> Tuple[str, Tuple]: ... + def as_subquery_condition( + self, alias: str, columns: List[str], compiler: SQLCompiler + ) -> Tuple[str, Tuple]: ... def explain_query(self) -> Iterator[str]: ... class SQLInsertCompiler(SQLCompiler): @@ -126,4 +153,6 @@ class SQLAggregateCompiler(SQLCompiler): col_count: Any = ... def as_sql(self): ... -def cursor_iter(cursor: Any, sentinel: Any, col_count: Optional[int], itersize: int) -> Iterator[Any]: ... +def cursor_iter( + cursor: Any, sentinel: Any, col_count: Optional[int], itersize: int +) -> Iterator[Any]: ... diff --git a/django-stubs/db/models/sql/datastructures.pyi b/django-stubs/db/models/sql/datastructures.pyi index 8ef7656ec..a53403e3e 100644 --- a/django-stubs/db/models/sql/datastructures.pyi +++ b/django-stubs/db/models/sql/datastructures.pyi @@ -8,7 +8,9 @@ from django.db.models.sql.compiler import SQLCompiler class MultiJoin(Exception): level: int = ... names_with_path: List[Tuple[str, List[PathInfo]]] = ... - def __init__(self, names_pos: int, path_with_names: List[Tuple[str, List[PathInfo]]]) -> None: ... + def __init__( + self, names_pos: int, path_with_names: List[Tuple[str, List[PathInfo]]] + ) -> None: ... class Empty: ... @@ -31,9 +33,15 @@ class Join: nullable: bool, filtered_relation: Optional[FilteredRelation] = ..., ) -> None: ... - def as_sql(self, compiler: SQLCompiler, connection: Any) -> Tuple[str, List[Union[int, str]]]: ... - def relabeled_clone(self, change_map: Union[Dict[str, str], OrderedDict]) -> Join: ... - def equals(self, other: Union[BaseTable, Join], with_filtered_relation: bool) -> bool: ... + def as_sql( + self, compiler: SQLCompiler, connection: Any + ) -> Tuple[str, List[Union[int, str]]]: ... + def relabeled_clone( + self, change_map: Union[Dict[str, str], OrderedDict] + ) -> Join: ... + def equals( + self, other: Union[BaseTable, Join], with_filtered_relation: bool + ) -> bool: ... def demote(self) -> Join: ... def promote(self) -> Join: ... @@ -44,6 +52,8 @@ class BaseTable: table_name: str = ... table_alias: Optional[str] = ... def __init__(self, table_name: str, alias: Optional[str]) -> None: ... - def as_sql(self, compiler: SQLCompiler, connection: Any) -> Tuple[str, List[Any]]: ... + def as_sql( + self, compiler: SQLCompiler, connection: Any + ) -> Tuple[str, List[Any]]: ... def relabeled_clone(self, change_map: OrderedDict) -> BaseTable: ... def equals(self, other: Join, with_filtered_relation: bool) -> bool: ... diff --git a/django-stubs/db/models/sql/query.pyi b/django-stubs/db/models/sql/query.pyi index 2ed5c6516..dfa5c19eb 100644 --- a/django-stubs/db/models/sql/query.pyi +++ b/django-stubs/db/models/sql/query.pyi @@ -1,17 +1,32 @@ import collections from collections import OrderedDict, namedtuple -from typing import Any, Callable, Dict, Iterator, List, Optional, Sequence, Set, Tuple, Type, Union, Iterable +from typing import ( + Any, + Callable, + Dict, + Iterable, + Iterator, + List, + Optional, + Sequence, + Set, + Tuple, + Type, + Union, +) +from django.db.models import Expression, Field, FilteredRelation, Model, Q, QuerySet +from django.db.models.expressions import Combinable from django.db.models.lookups import Lookup, Transform from django.db.models.query_utils import PathInfo, RegisterLookupMixin from django.db.models.sql.compiler import SQLCompiler from django.db.models.sql.datastructures import BaseTable from django.db.models.sql.where import WhereNode -from django.db.models import Expression, Field, FilteredRelation, Model, Q, QuerySet -from django.db.models.expressions import Combinable - -JoinInfo = namedtuple("JoinInfo", ["final_field", "targets", "opts", "joins", "path", "transform_function"]) +JoinInfo = namedtuple( + "JoinInfo", + ["final_field", "targets", "opts", "joins", "path", "transform_function"], +) class RawQuery: high_mark: Optional[int] @@ -71,7 +86,9 @@ class Query: explain_options: Dict[str, int] = ... high_mark: Optional[int] = ... low_mark: int = ... - def __init__(self, model: Optional[Type[Model]], where: Type[WhereNode] = ...) -> None: ... + def __init__( + self, model: Optional[Type[Model]], where: Type[WhereNode] = ... + ) -> None: ... @property def extra(self) -> OrderedDict: ... @property @@ -80,14 +97,20 @@ class Query: def has_select_fields(self) -> bool: ... def sql_with_params(self) -> Tuple[str, Tuple]: ... def __deepcopy__(self, memo: Dict[str, Any]) -> Query: ... - def get_compiler(self, using: Optional[str] = ..., connection: Any = ...) -> SQLCompiler: ... + def get_compiler( + self, using: Optional[str] = ..., connection: Any = ... + ) -> SQLCompiler: ... def clone(self) -> Query: ... def chain(self, klass: Optional[Type[Query]] = ...) -> Query: ... - def relabeled_clone(self, change_map: Union[Dict[Any, Any], OrderedDict]) -> Query: ... + def relabeled_clone( + self, change_map: Union[Dict[Any, Any], OrderedDict] + ) -> Query: ... def get_count(self, using: str) -> int: ... def has_filters(self) -> WhereNode: ... def has_results(self, using: str) -> bool: ... - def explain(self, using: str, format: Optional[str] = ..., **options: Any) -> str: ... + def explain( + self, using: str, format: Optional[str] = ..., **options: Any + ) -> str: ... def combine(self, rhs: Query, connector: str) -> None: ... def deferred_to_data(self, target: Dict[Any, Any], callback: Callable) -> None: ... def ref_alias(self, alias: str) -> None: ... @@ -95,14 +118,20 @@ class Query: def promote_joins(self, aliases: Set[str]) -> None: ... def demote_joins(self, aliases: Set[str]) -> None: ... def reset_refcounts(self, to_counts: Dict[str, int]) -> None: ... - def change_aliases(self, change_map: Union[Dict[Any, Any], OrderedDict]) -> None: ... + def change_aliases( + self, change_map: Union[Dict[Any, Any], OrderedDict] + ) -> None: ... def bump_prefix(self, outer_query: Query) -> None: ... def get_initial_alias(self) -> str: ... def count_active_tables(self) -> int: ... def resolve_expression(self, query: Query, *args: Any, **kwargs: Any) -> Query: ... def as_sql(self, compiler: SQLCompiler, connection: Any) -> Any: ... - def resolve_lookup_value(self, value: Any, can_reuse: Optional[Set[str]], allow_joins: bool) -> Any: ... - def solve_lookup_type(self, lookup: str) -> Tuple[Sequence[str], Sequence[str], bool]: ... + def resolve_lookup_value( + self, value: Any, can_reuse: Optional[Set[str]], allow_joins: bool + ) -> Any: ... + def solve_lookup_type( + self, lookup: str + ) -> Tuple[Sequence[str], Sequence[str], bool]: ... def build_filter( self, filter_expr: Union[Dict[str, str], Tuple[str, Tuple[int, int]]], @@ -113,13 +142,21 @@ class Query: split_subq: bool = ..., reuse_with_filtered_relation: bool = ..., ) -> Tuple[WhereNode, List[Any]]: ... - def add_filter(self, filter_clause: Tuple[str, Union[List[int], List[str]]]) -> None: ... + def add_filter( + self, filter_clause: Tuple[str, Union[List[int], List[str]]] + ) -> None: ... def add_q(self, q_object: Q) -> None: ... def build_where(self, q_object: Q) -> Any: ... def build_filtered_relation_q( - self, q_object: Q, reuse: Set[str], branch_negated: bool = ..., current_negated: bool = ... + self, + q_object: Q, + reuse: Set[str], + branch_negated: bool = ..., + current_negated: bool = ..., ) -> WhereNode: ... - def add_filtered_relation(self, filtered_relation: FilteredRelation, alias: str) -> None: ... + def add_filtered_relation( + self, filtered_relation: FilteredRelation, alias: str + ) -> None: ... def setup_joins( self, names: List[str], @@ -133,7 +170,11 @@ class Query: self, targets: Tuple[Field], joins: List[str], path: List[PathInfo] ) -> Tuple[Tuple[Field], str, List[str]]: ... def resolve_ref( - self, name: str, allow_joins: bool = ..., reuse: Optional[Set[str]] = ..., summarize: bool = ... + self, + name: str, + allow_joins: bool = ..., + reuse: Optional[Set[str]] = ..., + summarize: bool = ..., ) -> Expression: ... def split_exclude( self, @@ -143,7 +184,9 @@ class Query: ) -> Tuple[WhereNode, Tuple]: ... def set_empty(self) -> None: ... def is_empty(self) -> bool: ... - def set_limits(self, low: Optional[int] = ..., high: Optional[int] = ...) -> None: ... + def set_limits( + self, low: Optional[int] = ..., high: Optional[int] = ... + ) -> None: ... def clear_limits(self) -> None: ... def has_limit_one(self) -> bool: ... def can_filter(self) -> bool: ... @@ -151,7 +194,9 @@ class Query: def clear_select_fields(self) -> None: ... def set_select(self, cols: List[Expression]) -> None: ... def add_distinct_fields(self, *field_names: Any) -> None: ... - def add_fields(self, field_names: Union[Iterator[Any], List[str]], allow_m2m: bool = ...) -> None: ... + def add_fields( + self, field_names: Union[Iterator[Any], List[str]], allow_m2m: bool = ... + ) -> None: ... def add_ordering(self, *ordering: Any) -> None: ... def clear_ordering(self, force_empty: bool) -> None: ... def set_group_by(self) -> None: ... @@ -170,18 +215,30 @@ class Query: def add_immediate_loading(self, field_names: Iterable[str]) -> None: ... def get_loaded_field_names(self) -> Dict[Type[Model], Set[str]]: ... def get_loaded_field_names_cb( - self, target: Dict[Type[Model], Set[str]], model: Type[Model], fields: Set[Field] + self, + target: Dict[Type[Model], Set[str]], + model: Type[Model], + fields: Set[Field], + ) -> None: ... + def set_annotation_mask( + self, names: Optional[Union[List[str], Set[str], Tuple]] ) -> None: ... - def set_annotation_mask(self, names: Optional[Union[List[str], Set[str], Tuple]]) -> None: ... def append_annotation_mask(self, names: List[str]) -> None: ... def set_extra_mask(self, names: Union[List[str], Tuple]) -> None: ... def set_values(self, fields: Union[List[str], Tuple]) -> None: ... - def trim_start(self, names_with_path: List[Tuple[str, List[PathInfo]]]) -> Tuple[str, bool]: ... + def trim_start( + self, names_with_path: List[Tuple[str, List[PathInfo]]] + ) -> Tuple[str, bool]: ... def is_nullable(self, field: Field) -> bool: ... def build_lookup( - self, lookups: Sequence[str], lhs: Union[RegisterLookupMixin, Query], rhs: Optional[Query] + self, + lookups: Sequence[str], + lhs: Union[RegisterLookupMixin, Query], + rhs: Optional[Query], ) -> Lookup: ... - def try_transform(self, lhs: Union[RegisterLookupMixin, Query], name: str) -> Transform: ... + def try_transform( + self, lhs: Union[RegisterLookupMixin, Query], name: str + ) -> Transform: ... class JoinPromoter: connector: str = ... @@ -190,5 +247,7 @@ class JoinPromoter: num_children: int = ... votes: collections.Counter = ... def __init__(self, connector: str, num_children: int, negated: bool) -> None: ... - def add_votes(self, votes: Union[Iterator[Any], List[Any], Set[str], Tuple]) -> None: ... + def add_votes( + self, votes: Union[Iterator[Any], List[Any], Set[str], Tuple] + ) -> None: ... def update_join_types(self, query: Query) -> Set[str]: ... diff --git a/django-stubs/db/models/sql/subqueries.pyi b/django-stubs/db/models/sql/subqueries.pyi index ba3d7e82a..2edbdce26 100644 --- a/django-stubs/db/models/sql/subqueries.pyi +++ b/django-stubs/db/models/sql/subqueries.pyi @@ -2,12 +2,11 @@ from typing import Any, Dict, Iterable, List, Optional, Tuple, Type, Union from django.db.models.base import Model from django.db.models.expressions import Case +from django.db.models.fields import Field from django.db.models.query import QuerySet from django.db.models.sql.query import Query from django.db.models.sql.where import WhereNode -from django.db.models.fields import Field - class DeleteQuery(Query): select: Tuple where_class: Type[WhereNode] @@ -21,10 +20,16 @@ class UpdateQuery(Query): where_class: Type[WhereNode] def __init__(self, *args: Any, **kwargs: Any) -> None: ... where: WhereNode = ... - def update_batch(self, pk_list: List[int], values: Dict[str, Optional[int]], using: str) -> None: ... + def update_batch( + self, pk_list: List[int], values: Dict[str, Optional[int]], using: str + ) -> None: ... def add_update_values(self, values: Dict[str, Any]) -> None: ... - def add_update_fields(self, values_seq: List[Tuple[Field, Optional[Type[Model]], Case]]) -> None: ... - def add_related_update(self, model: Type[Model], field: Field, value: Union[int, str]) -> None: ... + def add_update_fields( + self, values_seq: List[Tuple[Field, Optional[Type[Model]], Case]] + ) -> None: ... + def add_related_update( + self, model: Type[Model], field: Field, value: Union[int, str] + ) -> None: ... def get_related_updates(self) -> List[UpdateQuery]: ... class InsertQuery(Query): @@ -35,7 +40,9 @@ class InsertQuery(Query): objs: List[Model] = ... raw: bool = ... def __init__(self, *args: Any, **kwargs: Any) -> None: ... - def insert_values(self, fields: Iterable[Field], objs: List[Model], raw: bool = ...) -> None: ... + def insert_values( + self, fields: Iterable[Field], objs: List[Model], raw: bool = ... + ) -> None: ... class AggregateQuery(Query): select: Tuple diff --git a/django-stubs/db/models/sql/where.pyi b/django-stubs/db/models/sql/where.pyi index dfab304d5..d76845306 100644 --- a/django-stubs/db/models/sql/where.pyi +++ b/django-stubs/db/models/sql/where.pyi @@ -17,12 +17,18 @@ class WhereNode(tree.Node): default: Any = ... resolved: bool = ... conditional: bool = ... - def split_having(self, negated: bool = ...) -> Tuple[Optional[WhereNode], Optional[WhereNode]]: ... + def split_having( + self, negated: bool = ... + ) -> Tuple[Optional[WhereNode], Optional[WhereNode]]: ... def as_sql(self, compiler: SQLCompiler, connection: Any) -> Any: ... def get_group_by_cols(self) -> List[Expression]: ... - def relabel_aliases(self, change_map: Union[Dict[Optional[str], str], OrderedDict]) -> None: ... + def relabel_aliases( + self, change_map: Union[Dict[Optional[str], str], OrderedDict] + ) -> None: ... def clone(self) -> WhereNode: ... - def relabeled_clone(self, change_map: Union[Dict[Optional[str], str], OrderedDict]) -> WhereNode: ... + def relabeled_clone( + self, change_map: Union[Dict[Optional[str], str], OrderedDict] + ) -> WhereNode: ... def resolve_expression(self, *args: Any, **kwargs: Any) -> WhereNode: ... class NothingNode: @@ -33,8 +39,12 @@ class ExtraWhere: contains_aggregate: bool = ... sqls: List[str] = ... params: Optional[Union[List[int], List[str]]] = ... - def __init__(self, sqls: List[str], params: Optional[Union[List[int], List[str]]]) -> None: ... - def as_sql(self, compiler: SQLCompiler = ..., connection: Any = ...) -> Tuple[str, Union[List[int], List[str]]]: ... + def __init__( + self, sqls: List[str], params: Optional[Union[List[int], List[str]]] + ) -> None: ... + def as_sql( + self, compiler: SQLCompiler = ..., connection: Any = ... + ) -> Tuple[str, Union[List[int], List[str]]]: ... class SubqueryConstraint: contains_aggregate: bool = ... @@ -42,5 +52,7 @@ class SubqueryConstraint: columns: List[str] = ... targets: List[str] = ... query_object: Query = ... - def __init__(self, alias: str, columns: List[str], targets: List[str], query_object: Query) -> None: ... + def __init__( + self, alias: str, columns: List[str], targets: List[str], query_object: Query + ) -> None: ... def as_sql(self, compiler: SQLCompiler, connection: Any) -> Tuple[str, Tuple]: ... diff --git a/django-stubs/db/transaction.pyi b/django-stubs/db/transaction.pyi index 959479b5b..28d4f65b6 100644 --- a/django-stubs/db/transaction.pyi +++ b/django-stubs/db/transaction.pyi @@ -1,5 +1,5 @@ from contextlib import contextmanager -from typing import Any, Callable, Optional, overload, TypeVar, Iterator +from typing import Any, Callable, Iterator, Optional, TypeVar, overload from django.db import ProgrammingError diff --git a/django-stubs/db/utils.pyi b/django-stubs/db/utils.pyi index 998bbf8ee..b41b8c920 100644 --- a/django-stubs/db/utils.pyi +++ b/django-stubs/db/utils.pyi @@ -19,7 +19,9 @@ class ConnectionDoesNotExist(Exception): ... class ConnectionHandler: databases: Dict[str, Dict[str, Optional[Any]]] - def __init__(self, databases: Dict[str, Dict[str, Optional[Any]]] = ...) -> None: ... + def __init__( + self, databases: Dict[str, Dict[str, Optional[Any]]] = ... + ) -> None: ... def ensure_defaults(self, alias: str) -> None: ... def prepare_test_settings(self, alias: str) -> None: ... def __getitem__(self, alias: str) -> Any: ... diff --git a/django-stubs/dispatch/__init__.pyi b/django-stubs/dispatch/__init__.pyi index 97080cd7b..b22842975 100644 --- a/django-stubs/dispatch/__init__.pyi +++ b/django-stubs/dispatch/__init__.pyi @@ -1 +1,2 @@ -from django.dispatch.dispatcher import Signal as Signal, receiver as receiver +from django.dispatch.dispatcher import Signal as Signal +from django.dispatch.dispatcher import receiver as receiver diff --git a/django-stubs/dispatch/dispatcher.pyi b/django-stubs/dispatch/dispatcher.pyi index 8ae53ce5e..5acacc93c 100644 --- a/django-stubs/dispatch/dispatcher.pyi +++ b/django-stubs/dispatch/dispatcher.pyi @@ -9,15 +9,28 @@ class Signal: lock: Any = ... use_caching: Any = ... sender_receivers_cache: Any = ... - def __init__(self, providing_args: List[str] = ..., use_caching: bool = ...) -> None: ... + def __init__( + self, providing_args: List[str] = ..., use_caching: bool = ... + ) -> None: ... def connect( - self, receiver: Callable, sender: Optional[object] = ..., weak: bool = ..., dispatch_uid: Optional[str] = ... + self, + receiver: Callable, + sender: Optional[object] = ..., + weak: bool = ..., + dispatch_uid: Optional[str] = ..., ) -> None: ... def disconnect( - self, receiver: Optional[Callable] = ..., sender: Optional[object] = ..., dispatch_uid: Optional[str] = ... + self, + receiver: Optional[Callable] = ..., + sender: Optional[object] = ..., + dispatch_uid: Optional[str] = ..., ) -> bool: ... def has_listeners(self, sender: Any = ...) -> bool: ... - def send(self, sender: Any, **named: Any) -> List[Tuple[Callable, Optional[str]]]: ... - def send_robust(self, sender: Any, **named: Any) -> List[Tuple[Callable, Union[ValueError, str]]]: ... + def send( + self, sender: Any, **named: Any + ) -> List[Tuple[Callable, Optional[str]]]: ... + def send_robust( + self, sender: Any, **named: Any + ) -> List[Tuple[Callable, Union[ValueError, str]]]: ... def receiver(signal: Union[List[Signal], Signal], **kwargs: Any) -> Callable: ... diff --git a/django-stubs/forms/__init__.pyi b/django-stubs/forms/__init__.pyi index 2e623bb58..463615f6c 100644 --- a/django-stubs/forms/__init__.pyi +++ b/django-stubs/forms/__init__.pyi @@ -1,87 +1,80 @@ from django.core.exceptions import ValidationError as ValidationError -from .forms import Form as Form, BaseForm as BaseForm - -from .formsets import BaseFormSet as BaseFormSet, all_valid as all_valid, formset_factory as formset_factory - -from .models import ( - ModelForm as ModelForm, - ModelChoiceField as ModelChoiceField, - ModelMultipleChoiceField as ModelMultipleChoiceField, - model_to_dict as model_to_dict, - BaseModelForm as BaseModelForm, - BaseInlineFormSet as BaseInlineFormSet, - BaseModelFormSet as BaseModelFormSet, - fields_for_model as fields_for_model, - inlineformset_factory as inlineformset_factory, - modelform_factory as modelform_factory, - InlineForeignKeyField as InlineForeignKeyField, - ModelChoiceIterator as ModelChoiceIterator, - ModelFormMetaclass as ModelFormMetaclass, - ModelFormOptions as ModelFormOptions, - modelformset_factory as modelformset_factory, -) - -from .widgets import ( - Widget as Widget, - ChoiceWidget as ChoiceWidget, - NumberInput as NumberInput, - Select as Select, - CheckboxInput as CheckboxInput, - CheckboxSelectMultiple as CheckboxSelectMultiple, - Media as Media, - MultiWidget as MultiWidget, - TextInput as TextInput, - Textarea as Textarea, - Input as Input, - ClearableFileInput as ClearableFileInput, - DateInput as DateInput, - DateTimeBaseInput as DateTimeBaseInput, - DateTimeInput as DateTimeInput, - EmailInput as EmailInput, - FileInput as FileInput, - HiddenInput as HiddenInput, - MultipleHiddenInput as MultipleHiddenInput, - NullBooleanSelect as NullBooleanSelect, - PasswordInput as PasswordInput, - RadioSelect as RadioSelect, - SelectMultiple as SelectMultiple, - TimeInput as TimeInput, - URLInput as URLInput, - SelectDateWidget as SelectDateWidget, - SplitHiddenDateTimeWidget as SplitHiddenDateTimeWidget, - SplitDateTimeWidget as SplitDateTimeWidget, -) - -from .fields import ( - Field as Field, - CharField as CharField, - ChoiceField as ChoiceField, - DurationField as DurationField, - FileField as FileField, - ImageField as ImageField, - DateTimeField as DateTimeField, - DateField as DateField, - BooleanField as BooleanField, - EmailField as EmailField, - FloatField as FloatField, - MultiValueField as MultiValueField, - MultipleChoiceField as MultipleChoiceField, - NullBooleanField as NullBooleanField, - SplitDateTimeField as SplitDateTimeField, - TimeField as TimeField, - IntegerField as IntegerField, - FilePathField as FilePathField, - DecimalField as DecimalField, - UUIDField as UUIDField, - URLField as URLField, - ComboField as ComboField, - GenericIPAddressField as GenericIPAddressField, - RegexField as RegexField, - SlugField as SlugField, - TypedChoiceField as TypedChoiceField, - TypedMultipleChoiceField as TypedMultipleChoiceField, - JSONField as JSONField, -) - -from .boundfield import BoundField as BoundField, BoundWidget as BoundWidget +from .boundfield import BoundField as BoundField +from .boundfield import BoundWidget as BoundWidget +from .fields import BooleanField as BooleanField +from .fields import CharField as CharField +from .fields import ChoiceField as ChoiceField +from .fields import ComboField as ComboField +from .fields import DateField as DateField +from .fields import DateTimeField as DateTimeField +from .fields import DecimalField as DecimalField +from .fields import DurationField as DurationField +from .fields import EmailField as EmailField +from .fields import Field as Field +from .fields import FileField as FileField +from .fields import FilePathField as FilePathField +from .fields import FloatField as FloatField +from .fields import GenericIPAddressField as GenericIPAddressField +from .fields import ImageField as ImageField +from .fields import IntegerField as IntegerField +from .fields import JSONField as JSONField +from .fields import MultipleChoiceField as MultipleChoiceField +from .fields import MultiValueField as MultiValueField +from .fields import NullBooleanField as NullBooleanField +from .fields import RegexField as RegexField +from .fields import SlugField as SlugField +from .fields import SplitDateTimeField as SplitDateTimeField +from .fields import TimeField as TimeField +from .fields import TypedChoiceField as TypedChoiceField +from .fields import TypedMultipleChoiceField as TypedMultipleChoiceField +from .fields import URLField as URLField +from .fields import UUIDField as UUIDField +from .forms import BaseForm as BaseForm +from .forms import Form as Form +from .formsets import BaseFormSet as BaseFormSet +from .formsets import all_valid as all_valid +from .formsets import formset_factory as formset_factory +from .models import BaseInlineFormSet as BaseInlineFormSet +from .models import BaseModelForm as BaseModelForm +from .models import BaseModelFormSet as BaseModelFormSet +from .models import InlineForeignKeyField as InlineForeignKeyField +from .models import ModelChoiceField as ModelChoiceField +from .models import ModelChoiceIterator as ModelChoiceIterator +from .models import ModelForm as ModelForm +from .models import ModelFormMetaclass as ModelFormMetaclass +from .models import ModelFormOptions as ModelFormOptions +from .models import ModelMultipleChoiceField as ModelMultipleChoiceField +from .models import fields_for_model as fields_for_model +from .models import inlineformset_factory as inlineformset_factory +from .models import model_to_dict as model_to_dict +from .models import modelform_factory as modelform_factory +from .models import modelformset_factory as modelformset_factory +from .widgets import CheckboxInput as CheckboxInput +from .widgets import CheckboxSelectMultiple as CheckboxSelectMultiple +from .widgets import ChoiceWidget as ChoiceWidget +from .widgets import ClearableFileInput as ClearableFileInput +from .widgets import DateInput as DateInput +from .widgets import DateTimeBaseInput as DateTimeBaseInput +from .widgets import DateTimeInput as DateTimeInput +from .widgets import EmailInput as EmailInput +from .widgets import FileInput as FileInput +from .widgets import HiddenInput as HiddenInput +from .widgets import Input as Input +from .widgets import Media as Media +from .widgets import MultipleHiddenInput as MultipleHiddenInput +from .widgets import MultiWidget as MultiWidget +from .widgets import NullBooleanSelect as NullBooleanSelect +from .widgets import NumberInput as NumberInput +from .widgets import PasswordInput as PasswordInput +from .widgets import RadioSelect as RadioSelect +from .widgets import Select as Select +from .widgets import SelectDateWidget as SelectDateWidget +from .widgets import SelectMultiple as SelectMultiple +from .widgets import SplitDateTimeWidget as SplitDateTimeWidget +from .widgets import SplitHiddenDateTimeWidget as SplitHiddenDateTimeWidget +from .widgets import Textarea as Textarea +from .widgets import TextInput as TextInput +from .widgets import TimeInput as TimeInput +from .widgets import URLInput as URLInput +from .widgets import Widget as Widget diff --git a/django-stubs/forms/boundfield.pyi b/django-stubs/forms/boundfield.pyi index ae293b509..b50a1454e 100644 --- a/django-stubs/forms/boundfield.pyi +++ b/django-stubs/forms/boundfield.pyi @@ -22,10 +22,17 @@ class BoundField: def __bool__(self) -> bool: ... def __iter__(self): ... def __len__(self) -> int: ... - def __getitem__(self, idx: Union[int, slice, str]) -> Union[List[BoundWidget], BoundWidget]: ... + def __getitem__( + self, idx: Union[int, slice, str] + ) -> Union[List[BoundWidget], BoundWidget]: ... @property def errors(self) -> ErrorList: ... - def as_widget(self, widget: Optional[Widget] = ..., attrs: None = ..., only_initial: bool = ...) -> SafeText: ... + def as_widget( + self, + widget: Optional[Widget] = ..., + attrs: None = ..., + only_initial: bool = ..., + ) -> SafeText: ... def as_text(self, attrs: None = ..., **kwargs: Any) -> SafeText: ... def as_textarea(self, attrs: None = ..., **kwargs: Any) -> SafeText: ... def as_hidden(self, attrs: None = ..., **kwargs: Any) -> SafeText: ... @@ -33,7 +40,10 @@ class BoundField: def data(self) -> Any: ... def value(self) -> Any: ... def label_tag( - self, contents: Optional[str] = ..., attrs: Optional[Dict[str, str]] = ..., label_suffix: Optional[str] = ... + self, + contents: Optional[str] = ..., + attrs: Optional[Dict[str, str]] = ..., + label_suffix: Optional[str] = ..., ) -> SafeText: ... def css_classes(self, extra_classes: None = ...) -> str: ... @property @@ -50,7 +60,9 @@ class BoundWidget: parent_widget: Widget = ... data: Dict[str, Any] = ... renderer: DjangoTemplates = ... - def __init__(self, parent_widget: Widget, data: Dict[str, Any], renderer: DjangoTemplates) -> None: ... + def __init__( + self, parent_widget: Widget, data: Dict[str, Any], renderer: DjangoTemplates + ) -> None: ... def tag(self, wrap_label: bool = ...) -> SafeText: ... @property def template_name(self) -> str: ... diff --git a/django-stubs/forms/fields.pyi b/django-stubs/forms/fields.pyi index 704c6939e..60b24e911 100644 --- a/django-stubs/forms/fields.pyi +++ b/django-stubs/forms/fields.pyi @@ -1,5 +1,16 @@ from datetime import datetime, timedelta -from typing import Any, Callable, Iterable, List, Optional, Pattern, Sequence, Tuple, Type, Union +from typing import ( + Any, + Callable, + Iterable, + List, + Optional, + Pattern, + Sequence, + Tuple, + Type, + Union, +) from django.core.validators import BaseValidator from django.forms.boundfield import BoundField @@ -148,7 +159,9 @@ class TimeField(BaseTemporalField): ... class DateTimeField(BaseTemporalField): ... class DurationField(Field): - def prepare_value(self, value: Optional[Union[timedelta, str]]) -> Optional[str]: ... + def prepare_value( + self, value: Optional[Union[timedelta, str]] + ) -> Optional[str]: ... class RegexField(CharField): regex: str = ... @@ -400,7 +413,9 @@ class JSONField(CharField): widget: Any = ... encoder: Any = ... decoder: Any = ... - def __init__(self, encoder: Optional[Any] = ..., decoder: Optional[Any] = ..., **kwargs: Any) -> None: ... + def __init__( + self, encoder: Optional[Any] = ..., decoder: Optional[Any] = ..., **kwargs: Any + ) -> None: ... def to_python(self, value: Any): ... def bound_data(self, data: Any, initial: Any): ... def prepare_value(self, value: Any): ... diff --git a/django-stubs/forms/forms.pyi b/django-stubs/forms/forms.pyi index dcb140c6c..4eaa8e143 100644 --- a/django-stubs/forms/forms.pyi +++ b/django-stubs/forms/forms.pyi @@ -56,7 +56,9 @@ class BaseForm: def as_ul(self) -> SafeText: ... def as_p(self) -> SafeText: ... def non_field_errors(self) -> ErrorList: ... - def add_error(self, field: Optional[str], error: Union[ValidationError, str]) -> None: ... + def add_error( + self, field: Optional[str], error: Union[ValidationError, str] + ) -> None: ... def has_error(self, field: Any, code: Optional[Any] = ...): ... def full_clean(self) -> None: ... def clean(self) -> Dict[str, Any]: ... diff --git a/django-stubs/forms/models.pyi b/django-stubs/forms/models.pyi index 549db200b..e5520c72f 100644 --- a/django-stubs/forms/models.pyi +++ b/django-stubs/forms/models.pyi @@ -2,6 +2,8 @@ from datetime import datetime from typing import ( Any, Callable, + ClassVar, + Container, Dict, Iterator, List, @@ -11,15 +13,15 @@ from typing import ( Sequence, Tuple, Type, - Union, - ClassVar, - Container, TypeVar, + Union, ) from unittest.mock import MagicMock from uuid import UUID from django.core.files.base import File +from django.db import models +from django.db.models import ForeignKey from django.db.models.base import Model from django.db.models.manager import Manager from django.db.models.query import QuerySet, _BaseQuerySet @@ -31,9 +33,6 @@ from django.forms.utils import ErrorList from django.forms.widgets import Input, Widget from typing_extensions import Literal -from django.db import models -from django.db.models import ForeignKey - ALL_FIELDS: str _Fields = Union[List[Union[Callable, str]], Sequence[str], Literal["__all__"]] @@ -43,7 +42,10 @@ _ErrorMessages = Dict[str, Dict[str, str]] _M = TypeVar("_M", bound=Model) def construct_instance( - form: BaseForm, instance: _M, fields: Optional[Container[str]] = ..., exclude: Optional[Container[str]] = ... + form: BaseForm, + instance: _M, + fields: Optional[Container[str]] = ..., + exclude: Optional[Container[str]] = ..., ) -> _M: ... def model_to_dict( instance: Model, fields: Optional[_Fields] = ..., exclude: Optional[_Fields] = ... @@ -228,7 +230,12 @@ class InlineForeignKeyField(Field): pk_field: bool = ... to_field: Optional[str] = ... def __init__( - self, parent_instance: Model, *args: Any, pk_field: bool = ..., to_field: Optional[Any] = ..., **kwargs: Any + self, + parent_instance: Model, + *args: Any, + pk_field: bool = ..., + to_field: Optional[Any] = ..., + **kwargs: Any ) -> None: ... class ModelChoiceIterator: @@ -267,11 +274,17 @@ class ModelChoiceField(ChoiceField): limit_choices_to: Optional[Union[Dict[str, Any], Callable[[], Any]]] = ..., **kwargs: Any ) -> None: ... - def get_limit_choices_to(self) -> Optional[Union[Dict[str, datetime], Q, MagicMock]]: ... + def get_limit_choices_to( + self, + ) -> Optional[Union[Dict[str, datetime], Q, MagicMock]]: ... def label_from_instance(self, obj: Model) -> str: ... choices: Any = ... def validate(self, value: Optional[Model]) -> None: ... - def has_changed(self, initial: Optional[Union[Model, int, str, UUID]], data: Optional[Union[int, str]]) -> bool: ... + def has_changed( + self, + initial: Optional[Union[Model, int, str, UUID]], + data: Optional[Union[int, str]], + ) -> bool: ... class ModelMultipleChoiceField(ModelChoiceField): disabled: bool @@ -285,5 +298,8 @@ class ModelMultipleChoiceField(ModelChoiceField): def __init__(self, queryset: _BaseQuerySet, **kwargs: Any) -> None: ... def _get_foreign_key( - parent_model: Type[Model], model: Type[Model], fk_name: Optional[str] = ..., can_fail: bool = ... + parent_model: Type[Model], + model: Type[Model], + fk_name: Optional[str] = ..., + can_fail: bool = ..., ) -> ForeignKey: ... diff --git a/django-stubs/forms/renderers.pyi b/django-stubs/forms/renderers.pyi index ffdf34f6d..6718c8adf 100644 --- a/django-stubs/forms/renderers.pyi +++ b/django-stubs/forms/renderers.pyi @@ -1,8 +1,7 @@ from typing import Any, Dict -from django.template.backends.base import BaseEngine - from django.template import Template +from django.template.backends.base import BaseEngine ROOT: Any @@ -10,7 +9,9 @@ def get_default_renderer() -> DjangoTemplates: ... class BaseRenderer: def get_template(self, template_name: str) -> Any: ... - def render(self, template_name: str, context: Dict[str, Any], request: None = ...) -> str: ... + def render( + self, template_name: str, context: Dict[str, Any], request: None = ... + ) -> str: ... class EngineMixin: def get_template(self, template_name: str) -> Any: ... diff --git a/django-stubs/forms/widgets.pyi b/django-stubs/forms/widgets.pyi index 6e10c9526..e5f5415a6 100644 --- a/django-stubs/forms/widgets.pyi +++ b/django-stubs/forms/widgets.pyi @@ -1,6 +1,20 @@ from decimal import Decimal from itertools import chain -from typing import Any, Callable, Dict, Iterable, Iterator, List, Mapping, Optional, Sequence, Set, Tuple, Type, Union +from typing import ( + Any, + Callable, + Dict, + Iterable, + Iterator, + List, + Mapping, + Optional, + Sequence, + Set, + Tuple, + Type, + Union, +) from django.core.files.base import File from django.forms.renderers import BaseRenderer @@ -38,17 +52,29 @@ class Widget: def __init__(self, attrs: Optional[_OptAttrs] = ...) -> None: ... @property def is_hidden(self) -> bool: ... - def subwidgets(self, name: str, value: Optional[List[str]], attrs: _OptAttrs = ...) -> Iterator[Dict[str, Any]]: ... + def subwidgets( + self, name: str, value: Optional[List[str]], attrs: _OptAttrs = ... + ) -> Iterator[Dict[str, Any]]: ... def format_value(self, value: Any) -> Optional[str]: ... - def get_context(self, name: str, value: Any, attrs: Optional[_OptAttrs]) -> Dict[str, Any]: ... + def get_context( + self, name: str, value: Any, attrs: Optional[_OptAttrs] + ) -> Dict[str, Any]: ... def render( - self, name: str, value: Any, attrs: Optional[_OptAttrs] = ..., renderer: Optional[BaseRenderer] = ... + self, + name: str, + value: Any, + attrs: Optional[_OptAttrs] = ..., + renderer: Optional[BaseRenderer] = ..., ) -> SafeText: ... def build_attrs( self, base_attrs: _OptAttrs, extra_attrs: Optional[_OptAttrs] = ... ) -> Dict[str, Union[Decimal, float, str]]: ... - def value_from_datadict(self, data: Dict[str, Any], files: Mapping[str, Iterable[Any]], name: str) -> Any: ... - def value_omitted_from_data(self, data: Dict[str, Any], files: Mapping[str, Iterable[Any]], name: str) -> bool: ... + def value_from_datadict( + self, data: Dict[str, Any], files: Mapping[str, Iterable[Any]], name: str + ) -> Any: ... + def value_omitted_from_data( + self, data: Dict[str, Any], files: Mapping[str, Iterable[Any]], name: str + ) -> bool: ... def id_for_label(self, id_: str) -> str: ... def use_required_attribute(self, initial: Any) -> bool: ... @@ -87,7 +113,9 @@ class Textarea(Widget): class DateTimeBaseInput(TextInput): format_key: str = ... format: Optional[str] = ... - def __init__(self, attrs: Optional[_OptAttrs] = ..., format: Optional[str] = ...): ... + def __init__( + self, attrs: Optional[_OptAttrs] = ..., format: Optional[str] = ... + ): ... class DateInput(DateTimeBaseInput): ... class DateTimeInput(DateTimeBaseInput): ... @@ -95,7 +123,9 @@ class TimeInput(DateTimeBaseInput): ... class CheckboxInput(Input): check_test: Callable = ... - def __init__(self, attrs: Optional[_OptAttrs] = ..., check_test: Optional[Callable] = ...) -> None: ... + def __init__( + self, attrs: Optional[_OptAttrs] = ..., check_test: Optional[Callable] = ... + ) -> None: ... class ChoiceWidget(Widget): allow_multiple_selected: bool = ... @@ -106,9 +136,15 @@ class ChoiceWidget(Widget): checked_attribute: Any = ... option_inherits_attrs: bool = ... choices: List[List[Union[int, str]]] = ... - def __init__(self, attrs: Optional[_OptAttrs] = ..., choices: Sequence[Tuple[Any, Any]] = ...) -> None: ... - def options(self, name: str, value: List[str], attrs: Optional[_OptAttrs] = ...) -> None: ... - def optgroups(self, name: str, value: List[str], attrs: Optional[_OptAttrs] = ...) -> Any: ... + def __init__( + self, attrs: Optional[_OptAttrs] = ..., choices: Sequence[Tuple[Any, Any]] = ... + ) -> None: ... + def options( + self, name: str, value: List[str], attrs: Optional[_OptAttrs] = ... + ) -> None: ... + def optgroups( + self, name: str, value: List[str], attrs: Optional[_OptAttrs] = ... + ) -> Any: ... def create_option( self, name: str, @@ -135,7 +171,11 @@ class CheckboxSelectMultiple(ChoiceWidget): ... class MultiWidget(Widget): template_name: str = ... widgets: List[Widget] = ... - def __init__(self, widgets: Sequence[Union[Widget, Type[Widget]]], attrs: Optional[_OptAttrs] = ...) -> None: ... + def __init__( + self, + widgets: Sequence[Union[Widget, Type[Widget]]], + attrs: Optional[_OptAttrs] = ..., + ) -> None: ... def decompress(self, value: Any) -> Optional[Any]: ... media: Any = ... diff --git a/django-stubs/http/__init__.pyi b/django-stubs/http/__init__.pyi index a8e4c86de..a45c8867e 100644 --- a/django-stubs/http/__init__.pyi +++ b/django-stubs/http/__init__.pyi @@ -1,26 +1,21 @@ -from .request import ( - HttpRequest as HttpRequest, - QueryDict as QueryDict, - RawPostDataException as RawPostDataException, - UnreadablePostError as UnreadablePostError, -) - -from .response import ( - BadHeaderError as BadHeaderError, - FileResponse as FileResponse, - Http404 as Http404, - HttpResponse as HttpResponse, - HttpResponseBadRequest as HttpResponseBadRequest, - HttpResponseForbidden as HttpResponseForbidden, - HttpResponseGone as HttpResponseGone, - HttpResponseNotAllowed as HttpResponseNotAllowed, - HttpResponseNotFound as HttpResponseNotFound, - HttpResponseNotModified as HttpResponseNotModified, - HttpResponsePermanentRedirect as HttpResponsePermanentRedirect, - HttpResponseRedirect as HttpResponseRedirect, - HttpResponseServerError as HttpResponseServerError, - JsonResponse as JsonResponse, - StreamingHttpResponse as StreamingHttpResponse, -) - -from .cookie import SimpleCookie as SimpleCookie, parse_cookie as parse_cookie +from .cookie import SimpleCookie as SimpleCookie +from .cookie import parse_cookie as parse_cookie +from .request import HttpRequest as HttpRequest +from .request import QueryDict as QueryDict +from .request import RawPostDataException as RawPostDataException +from .request import UnreadablePostError as UnreadablePostError +from .response import BadHeaderError as BadHeaderError +from .response import FileResponse as FileResponse +from .response import Http404 as Http404 +from .response import HttpResponse as HttpResponse +from .response import HttpResponseBadRequest as HttpResponseBadRequest +from .response import HttpResponseForbidden as HttpResponseForbidden +from .response import HttpResponseGone as HttpResponseGone +from .response import HttpResponseNotAllowed as HttpResponseNotAllowed +from .response import HttpResponseNotFound as HttpResponseNotFound +from .response import HttpResponseNotModified as HttpResponseNotModified +from .response import HttpResponsePermanentRedirect as HttpResponsePermanentRedirect +from .response import HttpResponseRedirect as HttpResponseRedirect +from .response import HttpResponseServerError as HttpResponseServerError +from .response import JsonResponse as JsonResponse +from .response import StreamingHttpResponse as StreamingHttpResponse diff --git a/django-stubs/http/multipartparser.pyi b/django-stubs/http/multipartparser.pyi index c8843a690..fbabab0d0 100644 --- a/django-stubs/http/multipartparser.pyi +++ b/django-stubs/http/multipartparser.pyi @@ -16,13 +16,17 @@ class MultiPartParser: encoding: Optional[str] = ..., ) -> None: ... def parse(self) -> Tuple[QueryDict, MultiValueDict]: ... - def handle_file_complete(self, old_field_name: str, counters: List[int]) -> None: ... + def handle_file_complete( + self, old_field_name: str, counters: List[int] + ) -> None: ... def IE_sanitize(self, filename: str) -> str: ... class LazyStream: length: None = ... position: int = ... - def __init__(self, producer: Union[BoundaryIter, ChunkIter], length: None = ...) -> None: ... + def __init__( + self, producer: Union[BoundaryIter, ChunkIter], length: None = ... + ) -> None: ... def tell(self): ... def read(self, size: Optional[int] = ...) -> bytes: ... def __next__(self) -> bytes: ... @@ -49,6 +53,10 @@ class BoundaryIter: class Parser: def __init__(self, stream: LazyStream, boundary: bytes) -> None: ... - def __iter__(self) -> Iterator[Tuple[str, Dict[str, Tuple[str, Dict[str, Union[bytes, str]]]], LazyStream]]: ... + def __iter__( + self, + ) -> Iterator[ + Tuple[str, Dict[str, Tuple[str, Dict[str, Union[bytes, str]]]], LazyStream] + ]: ... def parse_header(line: bytes) -> Tuple[str, Dict[str, Any]]: ... diff --git a/django-stubs/http/request.pyi b/django-stubs/http/request.pyi index 821e6900c..127a6c4e9 100644 --- a/django-stubs/http/request.pyi +++ b/django-stubs/http/request.pyi @@ -20,10 +20,13 @@ from django.contrib.auth.base_user import AbstractBaseUser from django.contrib.auth.models import AnonymousUser from django.contrib.sessions.backends.base import SessionBase from django.contrib.sites.models import Site -from django.utils.datastructures import CaseInsensitiveMapping, ImmutableList, MultiValueDict - from django.core.files import uploadedfile, uploadhandler from django.urls import ResolverMatch +from django.utils.datastructures import ( + CaseInsensitiveMapping, + ImmutableList, + MultiValueDict, +) RAISE_ERROR: object = ... host_validation_re: Pattern = ... @@ -31,7 +34,10 @@ host_validation_re: Pattern = ... class UnreadablePostError(IOError): ... class RawPostDataException(Exception): ... -UploadHandlerList = Union[List[uploadhandler.FileUploadHandler], ImmutableList[uploadhandler.FileUploadHandler]] +UploadHandlerList = Union[ + List[uploadhandler.FileUploadHandler], + ImmutableList[uploadhandler.FileUploadHandler], +] class HttpHeaders(CaseInsensitiveMapping): HTTP_PREFIX: str = ... @@ -63,7 +69,11 @@ class HttpRequest(BytesIO): def get_full_path(self, force_append_slash: bool = ...) -> str: ... def get_full_path_info(self, force_append_slash: bool = ...) -> str: ... def get_signed_cookie( - self, key: str, default: Any = ..., salt: str = ..., max_age: Optional[int] = ... + self, + key: str, + default: Any = ..., + salt: str = ..., + max_age: Optional[int] = ..., ) -> Optional[str]: ... def get_raw_uri(self) -> str: ... def build_absolute_uri(self, location: Optional[str] = ...) -> str: ... @@ -86,10 +96,15 @@ class QueryDict(MultiValueDict[str, str]): encoding: str = ... _mutable: bool = ... def __init__( - self, query_string: Optional[Union[str, bytes]] = ..., mutable: bool = ..., encoding: Optional[str] = ... + self, + query_string: Optional[Union[str, bytes]] = ..., + mutable: bool = ..., + encoding: Optional[str] = ..., ) -> None: ... def setlist(self, key: str, list_: List[str]) -> None: ... - def setlistdefault(self, key: str, default_list: Optional[List[str]] = ...) -> List[str]: ... + def setlistdefault( + self, key: str, default_list: Optional[List[str]] = ... + ) -> List[str]: ... def appendlist(self, key: str, value: str) -> None: ... def urlencode(self, safe: Optional[str] = ...) -> str: ... @classmethod diff --git a/django-stubs/http/response.pyi b/django-stubs/http/response.pyi index 3bcad2d6c..cc97a0aae 100644 --- a/django-stubs/http/response.pyi +++ b/django-stubs/http/response.pyi @@ -1,13 +1,23 @@ import datetime from io import BytesIO from json import JSONEncoder -from typing import Any, Dict, Iterable, Iterator, List, Optional, Tuple, Type, Union, overload +from typing import ( + Any, + Dict, + Iterable, + Iterator, + List, + Optional, + Tuple, + Type, + Union, + overload, +) from django.core.handlers.wsgi import WSGIRequest from django.http.cookie import SimpleCookie -from django.test.client import Client - from django.template import Context, Template +from django.test.client import Client from django.urls import ResolverMatch class BadHeaderError(ValueError): ... @@ -26,7 +36,9 @@ class HttpResponseBase(Iterable[Any]): charset: Optional[str] = ..., ) -> None: ... def serialize_headers(self) -> bytes: ... - def __setitem__(self, header: Union[str, bytes], value: Union[str, bytes, int]) -> None: ... + def __setitem__( + self, header: Union[str, bytes], value: Union[str, bytes, int] + ) -> None: ... def __delitem__(self, header: Union[str, bytes]) -> None: ... def __getitem__(self, header: Union[str, bytes]) -> str: ... def has_header(self, header: str) -> bool: ... @@ -48,8 +60,12 @@ class HttpResponseBase(Iterable[Any]): samesite: str = ..., ) -> None: ... def setdefault(self, key: str, value: str) -> None: ... - def set_signed_cookie(self, key: str, value: str, salt: str = ..., **kwargs: Any) -> None: ... - def delete_cookie(self, key: str, path: str = ..., domain: Optional[str] = ...) -> None: ... + def set_signed_cookie( + self, key: str, value: str, salt: str = ..., **kwargs: Any + ) -> None: ... + def delete_cookie( + self, key: str, path: str = ..., domain: Optional[str] = ... + ) -> None: ... def make_bytes(self, value: object) -> bytes: ... def close(self) -> None: ... def write(self, content: Union[str, bytes]) -> None: ... @@ -88,7 +104,9 @@ class HttpResponse(HttpResponseBase): class StreamingHttpResponse(HttpResponseBase): content: Any streaming_content: Iterator[Any] - def __init__(self, streaming_content: Iterable[Any] = ..., *args: Any, **kwargs: Any) -> None: ... + def __init__( + self, streaming_content: Iterable[Any] = ..., *args: Any, **kwargs: Any + ) -> None: ... def getvalue(self) -> bytes: ... class FileResponse(StreamingHttpResponse): @@ -102,7 +120,9 @@ class FileResponse(StreamingHttpResponse): block_size: int = ... as_attachment: bool = ... filename: str = ... - def __init__(self, *args: Any, as_attachment: bool = ..., filename: str = ..., **kwargs: Any) -> None: ... + def __init__( + self, *args: Any, as_attachment: bool = ..., filename: str = ..., **kwargs: Any + ) -> None: ... def set_headers(self, filelike: BytesIO) -> None: ... def json(self) -> Dict[str, Any]: ... @@ -121,7 +141,9 @@ class HttpResponseNotFound(HttpResponse): ... class HttpResponseForbidden(HttpResponse): ... class HttpResponseNotAllowed(HttpResponse): - def __init__(self, permitted_methods: Iterable[str], *args: Any, **kwargs: Any) -> None: ... + def __init__( + self, permitted_methods: Iterable[str], *args: Any, **kwargs: Any + ) -> None: ... class HttpResponseGone(HttpResponse): ... class HttpResponseServerError(HttpResponse): ... diff --git a/django-stubs/middleware/cache.pyi b/django-stubs/middleware/cache.pyi index 04c7eb20e..dcbecc8ad 100644 --- a/django-stubs/middleware/cache.pyi +++ b/django-stubs/middleware/cache.pyi @@ -1,11 +1,10 @@ -from typing import Any, Optional, Union, Callable +from typing import Any, Callable, Optional, Union +from django.core.cache import BaseCache from django.http.request import HttpRequest from django.http.response import HttpResponse, HttpResponseBase from django.utils.deprecation import MiddlewareMixin -from django.core.cache import BaseCache - class UpdateCacheMiddleware(MiddlewareMixin): cache_timeout: float = ... key_prefix: str = ... @@ -27,5 +26,8 @@ class CacheMiddleware(UpdateCacheMiddleware, FetchFromCacheMiddleware): cache_timeout: float = ... cache: BaseCache = ... def __init__( - self, get_response: Optional[Callable] = ..., cache_timeout: Optional[float] = ..., **kwargs: Any + self, + get_response: Optional[Callable] = ..., + cache_timeout: Optional[float] = ..., + **kwargs: Any ) -> None: ... diff --git a/django-stubs/middleware/clickjacking.pyi b/django-stubs/middleware/clickjacking.pyi index 08f4e181f..37a58b444 100644 --- a/django-stubs/middleware/clickjacking.pyi +++ b/django-stubs/middleware/clickjacking.pyi @@ -3,5 +3,9 @@ from django.http.response import HttpResponse from django.utils.deprecation import MiddlewareMixin class XFrameOptionsMiddleware(MiddlewareMixin): - def process_response(self, request: HttpRequest, response: HttpResponse) -> HttpResponse: ... - def get_xframe_options_value(self, request: HttpRequest, response: HttpResponse) -> str: ... + def process_response( + self, request: HttpRequest, response: HttpResponse + ) -> HttpResponse: ... + def get_xframe_options_value( + self, request: HttpRequest, response: HttpResponse + ) -> str: ... diff --git a/django-stubs/middleware/common.pyi b/django-stubs/middleware/common.pyi index a5aa8f915..078326939 100644 --- a/django-stubs/middleware/common.pyi +++ b/django-stubs/middleware/common.pyi @@ -6,12 +6,20 @@ from django.utils.deprecation import MiddlewareMixin class CommonMiddleware(MiddlewareMixin): response_redirect_class: Any = ... - def process_request(self, request: HttpRequest) -> Optional[HttpResponsePermanentRedirect]: ... + def process_request( + self, request: HttpRequest + ) -> Optional[HttpResponsePermanentRedirect]: ... def should_redirect_with_slash(self, request: HttpRequest) -> bool: ... def get_full_path_with_slash(self, request: HttpRequest) -> str: ... - def process_response(self, request: HttpRequest, response: HttpResponseBase) -> HttpResponseBase: ... + def process_response( + self, request: HttpRequest, response: HttpResponseBase + ) -> HttpResponseBase: ... class BrokenLinkEmailsMiddleware(MiddlewareMixin): - def process_response(self, request: HttpRequest, response: HttpResponseBase) -> HttpResponseBase: ... + def process_response( + self, request: HttpRequest, response: HttpResponseBase + ) -> HttpResponseBase: ... def is_internal_request(self, domain: str, referer: str) -> bool: ... - def is_ignorable_request(self, request: HttpRequest, uri: str, domain: str, referer: str) -> bool: ... + def is_ignorable_request( + self, request: HttpRequest, uri: str, domain: str, referer: str + ) -> bool: ... diff --git a/django-stubs/middleware/csrf.pyi b/django-stubs/middleware/csrf.pyi index 98193211c..54ee411c8 100644 --- a/django-stubs/middleware/csrf.pyi +++ b/django-stubs/middleware/csrf.pyi @@ -22,9 +22,15 @@ def rotate_token(request: HttpRequest) -> None: ... class CsrfViewMiddleware(MiddlewareMixin): def process_request(self, request: HttpRequest) -> None: ... def process_view( - self, request: HttpRequest, callback: Optional[Callable], callback_args: Tuple, callback_kwargs: Dict[str, Any] + self, + request: HttpRequest, + callback: Optional[Callable], + callback_args: Tuple, + callback_kwargs: Dict[str, Any], ) -> Optional[HttpResponseForbidden]: ... - def process_response(self, request: HttpRequest, response: HttpResponseBase) -> HttpResponseBase: ... + def process_response( + self, request: HttpRequest, response: HttpResponseBase + ) -> HttpResponseBase: ... def _compare_salted_tokens(request_csrf_token: str, csrf_token: str) -> bool: ... def _get_new_csrf_string() -> str: ... diff --git a/django-stubs/middleware/gzip.pyi b/django-stubs/middleware/gzip.pyi index e25dca8be..07e41279d 100644 --- a/django-stubs/middleware/gzip.pyi +++ b/django-stubs/middleware/gzip.pyi @@ -7,4 +7,6 @@ from django.utils.deprecation import MiddlewareMixin re_accepts_gzip: Any class GZipMiddleware(MiddlewareMixin): - def process_response(self, request: HttpRequest, response: HttpResponseBase) -> HttpResponseBase: ... + def process_response( + self, request: HttpRequest, response: HttpResponseBase + ) -> HttpResponseBase: ... diff --git a/django-stubs/middleware/http.pyi b/django-stubs/middleware/http.pyi index c0981b7d0..74e3c9f90 100644 --- a/django-stubs/middleware/http.pyi +++ b/django-stubs/middleware/http.pyi @@ -3,5 +3,7 @@ from django.http.response import HttpResponseBase from django.utils.deprecation import MiddlewareMixin class ConditionalGetMiddleware(MiddlewareMixin): - def process_response(self, request: HttpRequest, response: HttpResponseBase) -> HttpResponseBase: ... + def process_response( + self, request: HttpRequest, response: HttpResponseBase + ) -> HttpResponseBase: ... def needs_etag(self, response: HttpResponseBase) -> bool: ... diff --git a/django-stubs/middleware/locale.pyi b/django-stubs/middleware/locale.pyi index ed2476793..56067b80e 100644 --- a/django-stubs/middleware/locale.pyi +++ b/django-stubs/middleware/locale.pyi @@ -7,4 +7,6 @@ from django.utils.deprecation import MiddlewareMixin class LocaleMiddleware(MiddlewareMixin): response_redirect_class: Any = ... def process_request(self, request: HttpRequest) -> None: ... - def process_response(self, request: HttpRequest, response: HttpResponseBase) -> HttpResponseBase: ... + def process_response( + self, request: HttpRequest, response: HttpResponseBase + ) -> HttpResponseBase: ... diff --git a/django-stubs/middleware/security.pyi b/django-stubs/middleware/security.pyi index 1a449335b..57de364ad 100644 --- a/django-stubs/middleware/security.pyi +++ b/django-stubs/middleware/security.pyi @@ -13,5 +13,9 @@ class SecurityMiddleware(MiddlewareMixin): redirect: bool = ... redirect_host: Optional[str] = ... redirect_exempt: List[Any] = ... - def process_request(self, request: HttpRequest) -> Optional[HttpResponsePermanentRedirect]: ... - def process_response(self, request: HttpRequest, response: HttpResponse) -> HttpResponse: ... + def process_request( + self, request: HttpRequest + ) -> Optional[HttpResponsePermanentRedirect]: ... + def process_response( + self, request: HttpRequest, response: HttpResponse + ) -> HttpResponse: ... diff --git a/django-stubs/shortcuts.pyi b/django-stubs/shortcuts.pyi index 736ee26b7..007326457 100644 --- a/django-stubs/shortcuts.pyi +++ b/django-stubs/shortcuts.pyi @@ -1,15 +1,26 @@ import sys -from typing import Any, Callable, List, Mapping, Optional, overload, Protocol, Sequence, Type, TypeVar, Union +from typing import ( + Any, + Callable, + List, + Mapping, + Optional, + Protocol, + Sequence, + Type, + TypeVar, + Union, + overload, +) +from django.db.models import Manager, QuerySet from django.db.models.base import Model +from django.http import HttpRequest +from django.http.response import HttpResponse as HttpResponse from django.http.response import ( - HttpResponse as HttpResponse, - HttpResponseRedirect as HttpResponseRedirect, HttpResponsePermanentRedirect as HttpResponsePermanentRedirect, ) - -from django.db.models import Manager, QuerySet -from django.http import HttpRequest +from django.http.response import HttpResponseRedirect as HttpResponseRedirect if sys.version_info < (3, 8): from typing_extensions import Literal @@ -36,19 +47,32 @@ class SupportsGetAbsoluteUrl(Protocol): ... @overload def redirect( - to: Union[Callable, str, SupportsGetAbsoluteUrl], *args: Any, permanent: Literal[True], **kwargs: Any + to: Union[Callable, str, SupportsGetAbsoluteUrl], + *args: Any, + permanent: Literal[True], + **kwargs: Any ) -> HttpResponsePermanentRedirect: ... @overload def redirect( - to: Union[Callable, str, SupportsGetAbsoluteUrl], *args: Any, permanent: Literal[False], **kwargs: Any + to: Union[Callable, str, SupportsGetAbsoluteUrl], + *args: Any, + permanent: Literal[False], + **kwargs: Any ) -> HttpResponseRedirect: ... @overload def redirect( - to: Union[Callable, str, SupportsGetAbsoluteUrl], *args: Any, permanent: bool = ..., **kwargs: Any + to: Union[Callable, str, SupportsGetAbsoluteUrl], + *args: Any, + permanent: bool = ..., + **kwargs: Any ) -> Union[HttpResponseRedirect, HttpResponsePermanentRedirect]: ... _T = TypeVar("_T", bound=Model) -def get_object_or_404(klass: Union[Type[_T], Manager[_T], QuerySet[_T]], *args: Any, **kwargs: Any) -> _T: ... -def get_list_or_404(klass: Union[Type[_T], Manager[_T], QuerySet[_T]], *args: Any, **kwargs: Any) -> List[_T]: ... +def get_object_or_404( + klass: Union[Type[_T], Manager[_T], QuerySet[_T]], *args: Any, **kwargs: Any +) -> _T: ... +def get_list_or_404( + klass: Union[Type[_T], Manager[_T], QuerySet[_T]], *args: Any, **kwargs: Any +) -> List[_T]: ... def resolve_url(to: Union[Callable, Model, str], *args: Any, **kwargs: Any) -> str: ... diff --git a/django-stubs/template/__init__.pyi b/django-stubs/template/__init__.pyi index 02a0ada9b..124c69967 100644 --- a/django-stubs/template/__init__.pyi +++ b/django-stubs/template/__init__.pyi @@ -3,14 +3,18 @@ from .utils import EngineHandler as EngineHandler engines: EngineHandler -from .base import VariableDoesNotExist as VariableDoesNotExist -from .context import ContextPopException as ContextPopException -from .exceptions import TemplateDoesNotExist as TemplateDoesNotExist, TemplateSyntaxError as TemplateSyntaxError +from . import defaultfilters as defaultfilters # Template parts -from .base import Node as Node, NodeList as NodeList, Origin as Origin, Template as Template, Variable as Variable -from .context import Context as Context, RequestContext as RequestContext - +from .base import Node as Node +from .base import NodeList as NodeList +from .base import Origin as Origin +from .base import Template as Template +from .base import Variable as Variable +from .base import VariableDoesNotExist as VariableDoesNotExist +from .context import Context as Context +from .context import ContextPopException as ContextPopException +from .context import RequestContext as RequestContext +from .exceptions import TemplateDoesNotExist as TemplateDoesNotExist +from .exceptions import TemplateSyntaxError as TemplateSyntaxError from .library import Library as Library - -from . import defaultfilters as defaultfilters diff --git a/django-stubs/template/backends/django.pyi b/django-stubs/template/backends/django.pyi index fa2c7e191..930302788 100644 --- a/django-stubs/template/backends/django.pyi +++ b/django-stubs/template/backends/django.pyi @@ -8,9 +8,13 @@ from .base import BaseEngine class DjangoTemplates(BaseEngine): engine: Engine = ... def __init__(self, params: Dict[str, Any]) -> None: ... - def get_templatetag_libraries(self, custom_libraries: Dict[str, str]) -> Dict[str, str]: ... + def get_templatetag_libraries( + self, custom_libraries: Dict[str, str] + ) -> Dict[str, str]: ... -def copy_exception(exc: TemplateDoesNotExist, backend: Optional[DjangoTemplates] = ...) -> TemplateDoesNotExist: ... +def copy_exception( + exc: TemplateDoesNotExist, backend: Optional[DjangoTemplates] = ... +) -> TemplateDoesNotExist: ... def reraise(exc: TemplateDoesNotExist, backend: DjangoTemplates) -> Any: ... def get_installed_libraries() -> Dict[str, str]: ... def get_package_libraries(pkg: Any) -> Iterator[str]: ... diff --git a/django-stubs/template/backends/dummy.pyi b/django-stubs/template/backends/dummy.pyi index 6a8a759da..5c1bd3858 100644 --- a/django-stubs/template/backends/dummy.pyi +++ b/django-stubs/template/backends/dummy.pyi @@ -7,8 +7,14 @@ from .base import BaseEngine class TemplateStrings(BaseEngine): template_dirs: Tuple[str] - def __init__(self, params: Dict[str, Union[Dict[Any, Any], List[Any], bool, str]]) -> None: ... + def __init__( + self, params: Dict[str, Union[Dict[Any, Any], List[Any], bool, str]] + ) -> None: ... class Template(string.Template): template: str - def render(self, context: Optional[Dict[str, str]] = ..., request: Optional[HttpRequest] = ...) -> str: ... + def render( + self, + context: Optional[Dict[str, str]] = ..., + request: Optional[HttpRequest] = ..., + ) -> str: ... diff --git a/django-stubs/template/base.pyi b/django-stubs/template/base.pyi index 5e3a2e4ba..98196afe9 100644 --- a/django-stubs/template/base.pyi +++ b/django-stubs/template/base.pyi @@ -1,5 +1,17 @@ from enum import Enum -from typing import Any, Callable, Dict, Iterator, List, Mapping, Optional, Sequence, Tuple, Type, Union +from typing import ( + Any, + Callable, + Dict, + Iterator, + List, + Mapping, + Optional, + Sequence, + Tuple, + Type, + Union, +) from django.http.request import HttpRequest from django.template.context import Context as Context @@ -33,14 +45,19 @@ class TokenType(Enum): class VariableDoesNotExist(Exception): msg: str = ... params: Tuple[Union[Dict[str, str], str]] = ... - def __init__(self, msg: str, params: Tuple[Union[Dict[str, str], str]] = ...) -> None: ... + def __init__( + self, msg: str, params: Tuple[Union[Dict[str, str], str]] = ... + ) -> None: ... class Origin: name: str = ... template_name: Optional[Union[bytes, str]] = ... loader: Optional[Loader] = ... def __init__( - self, name: str, template_name: Optional[Union[bytes, str]] = ..., loader: Optional[Loader] = ... + self, + name: str, + template_name: Optional[Union[bytes, str]] = ..., + loader: Optional[Loader] = ..., ) -> None: ... @property def loader_name(self) -> Optional[str]: ... @@ -60,10 +77,14 @@ class Template: ) -> None: ... def __iter__(self) -> None: ... def render( - self, context: Optional[Union[Context, Dict[str, Any]]] = ..., request: Optional[HttpRequest] = ... + self, + context: Optional[Union[Context, Dict[str, Any]]] = ..., + request: Optional[HttpRequest] = ..., ) -> Any: ... def compile_nodelist(self) -> NodeList: ... - def get_exception_info(self, exception: Exception, token: Token) -> Dict[str, Any]: ... + def get_exception_info( + self, exception: Exception, token: Token + ) -> Dict[str, Any]: ... def linebreak_iter(template_source: str) -> Iterator[int]: ... @@ -87,7 +108,11 @@ class Lexer: def __init__(self, template_string: str) -> None: ... def tokenize(self) -> List[Token]: ... def create_token( - self, token_string: str, position: Optional[Tuple[int, int]], lineno: int, in_tag: bool + self, + token_string: str, + position: Optional[Tuple[int, int]], + lineno: int, + in_tag: bool, ) -> Token: ... class DebugLexer(Lexer): @@ -113,7 +138,12 @@ class Parser: def skip_past(self, endtag: str) -> None: ... def extend_nodelist(self, nodelist: NodeList, node: Node, token: Token) -> None: ... def error(self, token: Token, e: Union[Exception, str]) -> Exception: ... - def invalid_block_tag(self, token: Token, command: str, parse_until: Union[List[Any], Tuple[str]] = ...) -> Any: ... + def invalid_block_tag( + self, + token: Token, + command: str, + parse_until: Union[List[Any], Tuple[str]] = ..., + ) -> Any: ... def unclosed_block_tag(self, parse_until: Tuple[str]) -> Any: ... def next_token(self) -> Token: ... def prepend_token(self, token: Token) -> None: ... @@ -131,9 +161,13 @@ class FilterExpression: filters: List[Any] = ... var: Any = ... def __init__(self, token: str, parser: Parser) -> None: ... - def resolve(self, context: Mapping[str, Any], ignore_failures: bool = ...) -> Any: ... + def resolve( + self, context: Mapping[str, Any], ignore_failures: bool = ... + ) -> Any: ... @staticmethod - def args_check(name: str, func: Callable, provided: List[Tuple[bool, Any]]) -> bool: ... + def args_check( + name: str, func: Callable, provided: List[Tuple[bool, Any]] + ) -> bool: ... class Variable: var: Union[Dict[Any, Any], str] = ... @@ -142,7 +176,9 @@ class Variable: translate: bool = ... message_context: Optional[str] = ... def __init__(self, var: Union[Dict[Any, Any], str]) -> None: ... - def resolve(self, context: Union[Mapping[str, Mapping[str, Any]], Context, int, str]) -> Any: ... + def resolve( + self, context: Union[Mapping[str, Mapping[str, Any]], Context, int, str] + ) -> Any: ... class Node: must_be_first: bool = ... @@ -171,4 +207,6 @@ class VariableNode(Node): kwarg_re: Any -def token_kwargs(bits: Sequence[str], parser: Parser, support_legacy: bool = ...) -> Dict[str, FilterExpression]: ... +def token_kwargs( + bits: Sequence[str], parser: Parser, support_legacy: bool = ... +) -> Dict[str, FilterExpression]: ... diff --git a/django-stubs/template/context.pyi b/django-stubs/template/context.pyi index 1e95d6b2c..a43767e67 100644 --- a/django-stubs/template/context.pyi +++ b/django-stubs/template/context.pyi @@ -1,4 +1,4 @@ -from typing import Any, Callable, Dict, Iterator, List, Optional, Type, Union, Iterable +from typing import Any, Callable, Dict, Iterable, Iterator, List, Optional, Type, Union from django.http.request import HttpRequest from django.template.base import Node, Origin, Template @@ -28,10 +28,14 @@ class BaseContext(Iterable[Any]): def __contains__(self, key: str) -> bool: ... def get(self, key: str, otherwise: Optional[Any] = ...) -> Optional[Any]: ... def setdefault( - self, key: Union[IfChangedNode, str], default: Optional[Union[List[Origin], int]] = ... + self, + key: Union[IfChangedNode, str], + default: Optional[Union[List[Origin], int]] = ..., ) -> Optional[Union[List[Origin], int]]: ... def new(self, values: Optional[_ContextValues] = ...) -> Context: ... - def flatten(self) -> Dict[str, Optional[Union[Dict[str, Union[Type[Any], str]], int, str]]]: ... + def flatten( + self, + ) -> Dict[str, Optional[Union[Dict[str, Union[Type[Any], str]], int, str]]]: ... class Context(BaseContext): dicts: Any @@ -42,7 +46,11 @@ class Context(BaseContext): render_context: RenderContext = ... template: Optional[Template] = ... def __init__( - self, dict_: Any = ..., autoescape: bool = ..., use_l10n: Optional[bool] = ..., use_tz: None = ... + self, + dict_: Any = ..., + autoescape: bool = ..., + use_l10n: Optional[bool] = ..., + use_tz: None = ..., ) -> None: ... def bind_template(self, template: Template) -> Iterator[None]: ... def update(self, other_dict: Union[Dict[str, Any], Context]) -> ContextDict: ... @@ -50,7 +58,9 @@ class Context(BaseContext): class RenderContext(BaseContext): dicts: List[Dict[Union[IncludeNode, str], str]] template: Optional[Template] = ... - def push_state(self, template: Template, isolated_context: bool = ...) -> Iterator[None]: ... + def push_state( + self, template: Template, isolated_context: bool = ... + ) -> Iterator[None]: ... class RequestContext(Context): autoescape: bool @@ -73,4 +83,6 @@ class RequestContext(Context): def bind_template(self, template: Template) -> Iterator[None]: ... def new(self, values: Optional[_ContextValues] = ...) -> RequestContext: ... -def make_context(context: Any, request: Optional[HttpRequest] = ..., **kwargs: Any) -> Context: ... +def make_context( + context: Any, request: Optional[HttpRequest] = ..., **kwargs: Any +) -> Context: ... diff --git a/django-stubs/template/context_processors.pyi b/django-stubs/template/context_processors.pyi index c831a979e..5aa817e7c 100644 --- a/django-stubs/template/context_processors.pyi +++ b/django-stubs/template/context_processors.pyi @@ -6,7 +6,9 @@ from django.utils.functional import SimpleLazyObject def csrf(request: HttpRequest) -> Dict[str, SimpleLazyObject]: ... def debug(request: HttpRequest) -> Dict[str, Union[Callable, bool]]: ... -def i18n(request: WSGIRequest) -> Dict[str, Union[List[Tuple[str, str]], bool, str]]: ... +def i18n( + request: WSGIRequest, +) -> Dict[str, Union[List[Tuple[str, str]], bool, str]]: ... def tz(request: HttpRequest) -> Dict[str, str]: ... def static(request: HttpRequest) -> Dict[str, str]: ... def media(request: Any): ... diff --git a/django-stubs/template/defaultfilters.pyi b/django-stubs/template/defaultfilters.pyi index a66e1deab..a4fca1351 100644 --- a/django-stubs/template/defaultfilters.pyi +++ b/django-stubs/template/defaultfilters.pyi @@ -1,8 +1,10 @@ -from datetime import date as _date, datetime, time as _time +from datetime import date as _date +from datetime import datetime +from datetime import time as _time from typing import Any, Callable, Dict, List, Optional, Union -from django.utils.safestring import SafeText from django.utils.html import escape as escape # noqa: F401 +from django.utils.safestring import SafeText register: Any @@ -26,7 +28,9 @@ def truncatewords_html(value: str, arg: Union[int, str]) -> str: ... def upper(value: str) -> str: ... def urlencode(value: str, safe: Optional[SafeText] = ...) -> str: ... def urlize(value: str, autoescape: bool = ...) -> SafeText: ... -def urlizetrunc(value: str, limit: Union[SafeText, int], autoescape: bool = ...) -> SafeText: ... +def urlizetrunc( + value: str, limit: Union[SafeText, int], autoescape: bool = ... +) -> SafeText: ... def wordcount(value: str) -> int: ... def wordwrap(value: str, arg: Union[SafeText, int]) -> str: ... def ljust(value: str, arg: Union[SafeText, int]) -> str: ... @@ -52,14 +56,22 @@ def slice_filter(value: Any, arg: Union[str, int]) -> Any: ... def unordered_list(value: Any, autoescape: bool = ...) -> Any: ... def add(value: Any, arg: Any) -> Any: ... def get_digit(value: Any, arg: int) -> Any: ... -def date(value: Optional[Union[_date, datetime, str]], arg: Optional[str] = ...) -> str: ... -def time(value: Optional[Union[datetime, _time, str]], arg: Optional[str] = ...) -> str: ... +def date( + value: Optional[Union[_date, datetime, str]], arg: Optional[str] = ... +) -> str: ... +def time( + value: Optional[Union[datetime, _time, str]], arg: Optional[str] = ... +) -> str: ... def timesince_filter(value: Optional[_date], arg: Optional[_date] = ...) -> str: ... def timeuntil_filter(value: Optional[_date], arg: Optional[_date] = ...) -> str: ... -def default(value: Optional[Union[int, str]], arg: Union[int, str]) -> Union[int, str]: ... +def default( + value: Optional[Union[int, str]], arg: Union[int, str] +) -> Union[int, str]: ... def default_if_none(value: Optional[str], arg: Union[int, str]) -> Union[int, str]: ... def divisibleby(value: int, arg: int) -> bool: ... -def yesno(value: Optional[int], arg: Optional[str] = ...) -> Optional[Union[bool, str]]: ... +def yesno( + value: Optional[int], arg: Optional[str] = ... +) -> Optional[Union[bool, str]]: ... def filesizeformat(bytes_: Union[complex, int, str]) -> str: ... def pluralize(value: Any, arg: str = ...) -> str: ... def phone2numeric_filter(value: str) -> str: ... diff --git a/django-stubs/template/defaulttags.pyi b/django-stubs/template/defaulttags.pyi index 6faac5dda..00c7ea1fa 100644 --- a/django-stubs/template/defaulttags.pyi +++ b/django-stubs/template/defaulttags.pyi @@ -25,7 +25,10 @@ class CycleNode(Node): variable_name: Optional[str] = ... silent: bool = ... def __init__( - self, cyclevars: List[FilterExpression], variable_name: Optional[str] = ..., silent: bool = ... + self, + cyclevars: List[FilterExpression], + variable_name: Optional[str] = ..., + silent: bool = ..., ) -> None: ... def reset(self, context: Context) -> None: ... @@ -39,7 +42,9 @@ class FilterNode(Node): class FirstOfNode(Node): vars: List[FilterExpression] = ... asvar: Optional[str] = ... - def __init__(self, variables: List[FilterExpression], asvar: Optional[str] = ...) -> None: ... + def __init__( + self, variables: List[FilterExpression], asvar: Optional[str] = ... + ) -> None: ... class ForNode(Node): loopvars: Union[List[str], str] @@ -61,7 +66,9 @@ class IfChangedNode(Node): nodelist_false: NodeList nodelist_true: NodeList child_nodelists: Any = ... - def __init__(self, nodelist_true: NodeList, nodelist_false: NodeList, *varlist: Any) -> None: ... + def __init__( + self, nodelist_true: NodeList, nodelist_false: NodeList, *varlist: Any + ) -> None: ... class IfEqualNode(Node): nodelist_false: Union[List[Any], NodeList] @@ -81,7 +88,9 @@ class IfEqualNode(Node): class IfNode(Node): conditions_nodelists: List[Tuple[Optional[TemplateLiteral], NodeList]] = ... - def __init__(self, conditions_nodelists: List[Tuple[Optional[TemplateLiteral], NodeList]]) -> None: ... + def __init__( + self, conditions_nodelists: List[Tuple[Optional[TemplateLiteral], NodeList]] + ) -> None: ... def __iter__(self) -> None: ... @property def nodelist(self) -> NodeList: ... @@ -98,8 +107,12 @@ class RegroupNode(Node): expression: FilterExpression target: FilterExpression var_name: str = ... - def __init__(self, target: FilterExpression, expression: FilterExpression, var_name: str) -> None: ... - def resolve_expression(self, obj: Dict[str, date], context: Context) -> Union[int, str]: ... + def __init__( + self, target: FilterExpression, expression: FilterExpression, var_name: str + ) -> None: ... + def resolve_expression( + self, obj: Dict[str, date], context: Context + ) -> Union[int, str]: ... class LoadNode(Node): ... diff --git a/django-stubs/template/engine.pyi b/django-stubs/template/engine.pyi index edd8c9a27..eba1f3c2e 100644 --- a/django-stubs/template/engine.pyi +++ b/django-stubs/template/engine.pyi @@ -1,4 +1,4 @@ -from typing import Any, Callable, Dict, List, Optional, Tuple, Union, Sequence +from typing import Any, Callable, Dict, List, Optional, Sequence, Tuple, Union from django.template.base import Origin from django.template.library import Library @@ -41,13 +41,19 @@ class Engine: @staticmethod def get_default() -> Engine: ... def get_template_builtins(self, builtins: List[str]) -> List[Library]: ... - def get_template_libraries(self, libraries: Dict[str, str]) -> Dict[str, Library]: ... - def get_template_loaders(self, template_loaders: Sequence[_Loader]) -> List[Loader]: ... + def get_template_libraries( + self, libraries: Dict[str, str] + ) -> Dict[str, Library]: ... + def get_template_loaders( + self, template_loaders: Sequence[_Loader] + ) -> List[Loader]: ... def find_template_loader(self, loader: _Loader) -> Loader: ... def find_template( self, name: str, dirs: None = ..., skip: Optional[List[Origin]] = ... ) -> Tuple[Template, Origin]: ... def from_string(self, template_code: str) -> Template: ... def get_template(self, template_name: str) -> Template: ... - def render_to_string(self, template_name: str, context: Optional[Dict[str, Any]] = ...) -> SafeText: ... + def render_to_string( + self, template_name: str, context: Optional[Dict[str, Any]] = ... + ) -> SafeText: ... def select_template(self, template_name_list: List[str]) -> Template: ... diff --git a/django-stubs/template/library.pyi b/django-stubs/template/library.pyi index dca59e27d..424a76c2d 100644 --- a/django-stubs/template/library.pyi +++ b/django-stubs/template/library.pyi @@ -1,6 +1,6 @@ from typing import Any, Callable, Dict, List, Optional, Tuple, Union -from django.template.base import FilterExpression, Parser, Origin, Token +from django.template.base import FilterExpression, Origin, Parser, Token from django.template.context import Context from django.utils.safestring import SafeText @@ -13,7 +13,9 @@ class Library: tags: Dict[str, Callable] = ... def __init__(self) -> None: ... def tag( - self, name: Optional[Union[Callable, str]] = ..., compile_function: Optional[Union[Callable, str]] = ... + self, + name: Optional[Union[Callable, str]] = ..., + compile_function: Optional[Union[Callable, str]] = ..., ) -> Callable: ... def tag_function(self, func: Callable) -> Callable: ... def filter( @@ -24,7 +26,10 @@ class Library: ) -> Callable: ... def filter_function(self, func: Callable, **flags: Any) -> Callable: ... def simple_tag( - self, func: Optional[Union[Callable, str]] = ..., takes_context: Optional[bool] = ..., name: Optional[str] = ... + self, + func: Optional[Union[Callable, str]] = ..., + takes_context: Optional[bool] = ..., + name: Optional[str] = ..., ) -> Callable: ... def inclusion_tag( self, @@ -46,7 +51,9 @@ class TagHelperNode(Node): args: List[FilterExpression], kwargs: Dict[str, FilterExpression], ) -> None: ... - def get_resolved_arguments(self, context: Context) -> Tuple[List[int], Dict[str, Union[SafeText, int]]]: ... + def get_resolved_arguments( + self, context: Context + ) -> Tuple[List[int], Dict[str, Union[SafeText, int]]]: ... class SimpleNode(TagHelperNode): args: List[FilterExpression] diff --git a/django-stubs/template/loader.pyi b/django-stubs/template/loader.pyi index 0cd3214ae..6bbb7569f 100644 --- a/django-stubs/template/loader.pyi +++ b/django-stubs/template/loader.pyi @@ -1,11 +1,16 @@ from typing import Any, Dict, List, Optional, Union -from . import engines as engines # noqa: F401 from django.http.request import HttpRequest -from django.template.exceptions import TemplateDoesNotExist as TemplateDoesNotExist # noqa: F401 +from django.template.exceptions import ( # noqa: F401 + TemplateDoesNotExist as TemplateDoesNotExist, +) + +from . import engines as engines # noqa: F401 def get_template(template_name: str, using: Optional[str] = ...) -> Any: ... -def select_template(template_name_list: Union[List[str], str], using: Optional[str] = ...) -> Any: ... +def select_template( + template_name_list: Union[List[str], str], using: Optional[str] = ... +) -> Any: ... def render_to_string( template_name: Union[List[str], str], context: Optional[Dict[str, Any]] = ..., diff --git a/django-stubs/template/loader_tags.pyi b/django-stubs/template/loader_tags.pyi index 3a3593638..256079273 100644 --- a/django-stubs/template/loader_tags.pyi +++ b/django-stubs/template/loader_tags.pyi @@ -1,7 +1,7 @@ import collections from typing import Any, Dict, List, Optional, Union -from django.template.base import FilterExpression, NodeList, Parser, Token, Origin +from django.template.base import FilterExpression, NodeList, Origin, Parser, Token from django.template.context import Context from django.utils.safestring import SafeText @@ -39,7 +39,10 @@ class ExtendsNode(Node): template_dirs: Optional[List[Any]] = ... blocks: Dict[str, BlockNode] = ... def __init__( - self, nodelist: NodeList, parent_name: Union[FilterExpression, Node], template_dirs: Optional[List[Any]] = ... + self, + nodelist: NodeList, + parent_name: Union[FilterExpression, Node], + template_dirs: Optional[List[Any]] = ..., ) -> None: ... def find_template(self, template_name: str, context: Context) -> Template: ... def get_parent(self, context: Context) -> Template: ... @@ -63,6 +66,8 @@ class IncludeNode(Node): def render(self, context: Context) -> SafeText: ... def do_block(parser: Parser, token: Token) -> BlockNode: ... -def construct_relative_path(current_template_name: Optional[str], relative_name: str) -> str: ... +def construct_relative_path( + current_template_name: Optional[str], relative_name: str +) -> str: ... def do_extends(parser: Parser, token: Token) -> ExtendsNode: ... def do_include(parser: Parser, token: Token) -> IncludeNode: ... diff --git a/django-stubs/template/loaders/base.pyi b/django-stubs/template/loaders/base.pyi index 034769afe..0bbbec46b 100644 --- a/django-stubs/template/loaders/base.pyi +++ b/django-stubs/template/loaders/base.pyi @@ -1,4 +1,4 @@ -from typing import Any, List, Iterable, Optional, Dict +from typing import Any, Dict, Iterable, List, Optional from django.template.base import Origin, Template from django.template.engine import Engine @@ -7,6 +7,8 @@ class Loader: engine: Engine = ... get_template_cache: Dict[str, Any] = ... def __init__(self, engine: Engine) -> None: ... - def get_template(self, template_name: str, skip: Optional[List[Origin]] = ...) -> Template: ... + def get_template( + self, template_name: str, skip: Optional[List[Origin]] = ... + ) -> Template: ... def get_template_sources(self, template_name: str) -> Iterable[Origin]: ... def reset(self) -> None: ... diff --git a/django-stubs/template/loaders/cached.pyi b/django-stubs/template/loaders/cached.pyi index 956e9dc0f..60c659b95 100644 --- a/django-stubs/template/loaders/cached.pyi +++ b/django-stubs/template/loaders/cached.pyi @@ -10,5 +10,7 @@ class Loader(BaseLoader): loaders: List[BaseLoader] = ... def __init__(self, engine: Engine, loaders: Sequence[Any]) -> None: ... def get_contents(self, origin: Origin) -> str: ... - def cache_key(self, template_name: str, skip: Optional[List[Origin]] = ...) -> str: ... + def cache_key( + self, template_name: str, skip: Optional[List[Origin]] = ... + ) -> str: ... def generate_hash(self, values: List[str]) -> str: ... diff --git a/django-stubs/template/response.pyi b/django-stubs/template/response.pyi index 02005a0b5..a74acf7f2 100644 --- a/django-stubs/template/response.pyi +++ b/django-stubs/template/response.pyi @@ -3,13 +3,12 @@ from http.cookies import SimpleCookie from typing import Any, Callable, Dict, List, Optional, Sequence, Tuple, Union from django.core.handlers.wsgi import WSGIRequest +from django.http import HttpResponse from django.http.request import HttpRequest from django.template.base import Template from django.template.context import RequestContext from django.test.client import Client -from django.http import HttpResponse - class ContentNotRenderedError(Exception): ... class SimpleTemplateResponse(HttpResponse): @@ -30,8 +29,12 @@ class SimpleTemplateResponse(HttpResponse): charset: Optional[str] = ..., using: Optional[str] = ..., ) -> None: ... - def resolve_template(self, template: Union[Sequence[str], Template, str]) -> Template: ... - def resolve_context(self, context: Optional[Dict[str, Any]]) -> Optional[Dict[str, Any]]: ... + def resolve_template( + self, template: Union[Sequence[str], Template, str] + ) -> Template: ... + def resolve_context( + self, context: Optional[Dict[str, Any]] + ) -> Optional[Dict[str, Any]]: ... @property def rendered_content(self) -> str: ... def add_post_render_callback(self, callback: Callable) -> None: ... diff --git a/django-stubs/templatetags/cache.pyi b/django-stubs/templatetags/cache.pyi index 2f8d1f6d0..70eaee63d 100644 --- a/django-stubs/templatetags/cache.pyi +++ b/django-stubs/templatetags/cache.pyi @@ -1,8 +1,7 @@ from typing import Any, List, Optional -from django.template.base import FilterExpression, NodeList, Parser, Token - from django.template import Node +from django.template.base import FilterExpression, NodeList, Parser, Token register: Any diff --git a/django-stubs/templatetags/i18n.pyi b/django-stubs/templatetags/i18n.pyi index a32fd8fbe..69e415e18 100644 --- a/django-stubs/templatetags/i18n.pyi +++ b/django-stubs/templatetags/i18n.pyi @@ -1,8 +1,7 @@ from typing import Any, Dict, List, Optional, Tuple -from django.template.base import FilterExpression, NodeList, Parser, Token - from django.template import Node +from django.template.base import FilterExpression, NodeList, Parser, Token register: Any @@ -69,15 +68,21 @@ class LanguageNode(Node): language: FilterExpression = ... def __init__(self, nodelist: NodeList, language: FilterExpression) -> None: ... -def do_get_available_languages(parser: Parser, token: Token) -> GetAvailableLanguagesNode: ... +def do_get_available_languages( + parser: Parser, token: Token +) -> GetAvailableLanguagesNode: ... def do_get_language_info(parser: Parser, token: Token) -> GetLanguageInfoNode: ... -def do_get_language_info_list(parser: Parser, token: Token) -> GetLanguageInfoListNode: ... +def do_get_language_info_list( + parser: Parser, token: Token +) -> GetLanguageInfoListNode: ... def language_name(lang_code: str) -> str: ... def language_name_translated(lang_code: str) -> str: ... def language_name_local(lang_code: str) -> str: ... def language_bidi(lang_code: str) -> bool: ... def do_get_current_language(parser: Parser, token: Token) -> GetCurrentLanguageNode: ... -def do_get_current_language_bidi(parser: Parser, token: Token) -> GetCurrentLanguageBidiNode: ... +def do_get_current_language_bidi( + parser: Parser, token: Token +) -> GetCurrentLanguageBidiNode: ... def do_translate(parser: Parser, token: Token) -> TranslateNode: ... def do_block_translate(parser: Parser, token: Token) -> BlockTranslateNode: ... def language(parser: Parser, token: Token) -> LanguageNode: ... diff --git a/django-stubs/templatetags/l10n.pyi b/django-stubs/templatetags/l10n.pyi index 03c45bb69..2dc3d5258 100644 --- a/django-stubs/templatetags/l10n.pyi +++ b/django-stubs/templatetags/l10n.pyi @@ -1,8 +1,7 @@ from typing import Any, List -from django.template.base import Parser, Token - from django.template import Node +from django.template.base import Parser, Token register: Any diff --git a/django-stubs/templatetags/static.pyi b/django-stubs/templatetags/static.pyi index db254c7a0..3469e18ec 100644 --- a/django-stubs/templatetags/static.pyi +++ b/django-stubs/templatetags/static.pyi @@ -1,10 +1,9 @@ from typing import Any, Optional +from django import template from django.template.base import FilterExpression, Parser, Token from django.template.context import Context -from django import template - register: Any class PrefixNode(template.Node): @@ -22,7 +21,9 @@ def get_media_prefix(parser: Parser, token: Token) -> PrefixNode: ... class StaticNode(template.Node): path: FilterExpression = ... varname: Optional[str] = ... - def __init__(self, varname: Optional[str] = ..., path: FilterExpression = ...) -> None: ... + def __init__( + self, varname: Optional[str] = ..., path: FilterExpression = ... + ) -> None: ... def url(self, context: Context) -> str: ... @classmethod def handle_simple(cls, path: str) -> str: ... diff --git a/django-stubs/templatetags/tz.pyi b/django-stubs/templatetags/tz.pyi index 7719adb1b..ab503fdf2 100644 --- a/django-stubs/templatetags/tz.pyi +++ b/django-stubs/templatetags/tz.pyi @@ -1,18 +1,19 @@ from datetime import datetime from typing import Any, Optional, Union +from django.template import Node from django.template.base import FilterExpression, NodeList, Parser, Token from django.utils.timezone import FixedOffset -from django.template import Node - register: Any class datetimeobject(datetime): ... def localtime(value: Optional[Union[datetime, str]]) -> Any: ... def utc(value: Optional[Union[datetime, str]]) -> Any: ... -def do_timezone(value: Optional[Union[datetime, str]], arg: Optional[Union[FixedOffset, str]]) -> Any: ... +def do_timezone( + value: Optional[Union[datetime, str]], arg: Optional[Union[FixedOffset, str]] +) -> Any: ... class LocalTimeNode(Node): nodelist: NodeList = ... @@ -30,4 +31,6 @@ class GetCurrentTimezoneNode(Node): def localtime_tag(parser: Parser, token: Token) -> LocalTimeNode: ... def timezone_tag(parser: Parser, token: Token) -> TimezoneNode: ... -def get_current_timezone_tag(parser: Parser, token: Token) -> GetCurrentTimezoneNode: ... +def get_current_timezone_tag( + parser: Parser, token: Token +) -> GetCurrentTimezoneNode: ... diff --git a/django-stubs/test/__init__.pyi b/django-stubs/test/__init__.pyi index e2f43713c..ad4229296 100644 --- a/django-stubs/test/__init__.pyi +++ b/django-stubs/test/__init__.pyi @@ -1,20 +1,15 @@ -from .testcases import ( - TestCase as TestCase, - TransactionTestCase as TransactionTestCase, - SimpleTestCase as SimpleTestCase, - LiveServerTestCase as LiveServerTestCase, - skipIfDBFeature as skipIfDBFeature, - skipUnlessDBFeature as skipUnlessDBFeature, - skipUnlessAnyDBFeature as skipUnlessAnyDBFeature, -) - -from .utils import ( - override_settings as override_settings, - modify_settings as modify_settings, - override_script_prefix as override_script_prefix, - override_system_checks as override_system_checks, - ignore_warnings as ignore_warnings, - tag as tag, -) - -from .client import Client as Client, RequestFactory as RequestFactory +from .client import Client as Client +from .client import RequestFactory as RequestFactory +from .testcases import LiveServerTestCase as LiveServerTestCase +from .testcases import SimpleTestCase as SimpleTestCase +from .testcases import TestCase as TestCase +from .testcases import TransactionTestCase as TransactionTestCase +from .testcases import skipIfDBFeature as skipIfDBFeature +from .testcases import skipUnlessAnyDBFeature as skipUnlessAnyDBFeature +from .testcases import skipUnlessDBFeature as skipUnlessDBFeature +from .utils import ignore_warnings as ignore_warnings +from .utils import modify_settings as modify_settings +from .utils import override_script_prefix as override_script_prefix +from .utils import override_settings as override_settings +from .utils import override_system_checks as override_system_checks +from .utils import tag as tag diff --git a/django-stubs/test/client.pyi b/django-stubs/test/client.pyi index 7e0f7523c..b9e464ba2 100644 --- a/django-stubs/test/client.pyi +++ b/django-stubs/test/client.pyi @@ -1,17 +1,16 @@ from io import BytesIO +from json import JSONEncoder from types import TracebackType from typing import Any, Dict, List, Optional, Pattern, Tuple, Type, Union from django.contrib.auth.base_user import AbstractBaseUser from django.contrib.sessions.backends.base import SessionBase from django.core.handlers.base import BaseHandler +from django.core.handlers.wsgi import WSGIRequest from django.http.cookie import SimpleCookie from django.http.request import HttpRequest from django.http.response import HttpResponse, HttpResponseBase -from django.core.handlers.wsgi import WSGIRequest -from json import JSONEncoder - BOUNDARY: str = ... MULTIPART_CONTENT: str = ... CONTENT_TYPE_RE: Pattern = ... @@ -31,7 +30,9 @@ class FakePayload: class ClientHandler(BaseHandler): enforce_csrf_checks: bool = ... - def __init__(self, enforce_csrf_checks: bool = ..., *args: Any, **kwargs: Any) -> None: ... + def __init__( + self, enforce_csrf_checks: bool = ..., *args: Any, **kwargs: Any + ) -> None: ... def __call__(self, environ: Dict[str, Any]) -> HttpResponseBase: ... def encode_multipart(boundary: str, data: Dict[str, Any]) -> bytes: ... @@ -42,13 +43,24 @@ class RequestFactory: defaults: Dict[str, str] cookies: SimpleCookie errors: BytesIO - def __init__(self, *, json_encoder: Type[JSONEncoder] = ..., **defaults: Any) -> None: ... + def __init__( + self, *, json_encoder: Type[JSONEncoder] = ..., **defaults: Any + ) -> None: ... def request(self, **request: Any) -> WSGIRequest: ... - def get(self, path: str, data: Any = ..., secure: bool = ..., **extra: Any) -> WSGIRequest: ... + def get( + self, path: str, data: Any = ..., secure: bool = ..., **extra: Any + ) -> WSGIRequest: ... def post( - self, path: str, data: Any = ..., content_type: str = ..., secure: bool = ..., **extra: Any + self, + path: str, + data: Any = ..., + content_type: str = ..., + secure: bool = ..., + **extra: Any + ) -> WSGIRequest: ... + def head( + self, path: str, data: Any = ..., secure: bool = ..., **extra: Any ) -> WSGIRequest: ... - def head(self, path: str, data: Any = ..., secure: bool = ..., **extra: Any) -> WSGIRequest: ... def trace(self, path: str, secure: bool = ..., **extra: Any) -> WSGIRequest: ... def options( self, @@ -60,13 +72,28 @@ class RequestFactory: **extra: Any ) -> WSGIRequest: ... def put( - self, path: str, data: Any = ..., content_type: str = ..., secure: bool = ..., **extra: Any + self, + path: str, + data: Any = ..., + content_type: str = ..., + secure: bool = ..., + **extra: Any ) -> WSGIRequest: ... def patch( - self, path: str, data: Any = ..., content_type: str = ..., secure: bool = ..., **extra: Any + self, + path: str, + data: Any = ..., + content_type: str = ..., + secure: bool = ..., + **extra: Any ) -> WSGIRequest: ... def delete( - self, path: str, data: Any = ..., content_type: str = ..., secure: bool = ..., **extra: Any + self, + path: str, + data: Any = ..., + content_type: str = ..., + secure: bool = ..., + **extra: Any ) -> WSGIRequest: ... def generic( self, @@ -93,13 +120,29 @@ class Client(RequestFactory): # Silence type warnings, since this class overrides arguments and return types in an unsafe manner. def request(self, **request: Any) -> HttpResponse: ... # type: ignore def get( # type: ignore - self, path: str, data: Any = ..., follow: bool = ..., secure: bool = ..., **extra: Any + self, + path: str, + data: Any = ..., + follow: bool = ..., + secure: bool = ..., + **extra: Any ) -> HttpResponse: ... # type: ignore def post( # type: ignore - self, path: str, data: Any = ..., content_type: str = ..., follow: bool = ..., secure: bool = ..., **extra: Any + self, + path: str, + data: Any = ..., + content_type: str = ..., + follow: bool = ..., + secure: bool = ..., + **extra: Any ) -> HttpResponse: ... # type: ignore def head( # type: ignore - self, path: str, data: Any = ..., follow: bool = ..., secure: bool = ..., **extra: Any + self, + path: str, + data: Any = ..., + follow: bool = ..., + secure: bool = ..., + **extra: Any ) -> HttpResponse: ... # type: ignore def trace( # type: ignore self, path: str, follow: bool = ..., secure: bool = ..., **extra: Any @@ -114,19 +157,41 @@ class Client(RequestFactory): **extra: Any ) -> HttpResponse: ... # type: ignore def put( # type: ignore - self, path: str, data: Any = ..., content_type: str = ..., follow: bool = ..., secure: bool = ..., **extra: Any + self, + path: str, + data: Any = ..., + content_type: str = ..., + follow: bool = ..., + secure: bool = ..., + **extra: Any ) -> HttpResponse: ... # type: ignore def patch( # type: ignore - self, path: str, data: Any = ..., content_type: str = ..., follow: bool = ..., secure: bool = ..., **extra: Any + self, + path: str, + data: Any = ..., + content_type: str = ..., + follow: bool = ..., + secure: bool = ..., + **extra: Any ) -> HttpResponse: ... # type: ignore def delete( # type: ignore - self, path: str, data: Any = ..., content_type: str = ..., follow: bool = ..., secure: bool = ..., **extra: Any + self, + path: str, + data: Any = ..., + content_type: str = ..., + follow: bool = ..., + secure: bool = ..., + **extra: Any ) -> HttpResponse: ... # type: ignore def store_exc_info(self, **kwargs: Any) -> None: ... @property def session(self) -> SessionBase: ... def login(self, **credentials: Any) -> bool: ... - def force_login(self, user: AbstractBaseUser, backend: Optional[str] = ...) -> None: ... + def force_login( + self, user: AbstractBaseUser, backend: Optional[str] = ... + ) -> None: ... def logout(self) -> None: ... -def conditional_content_removal(request: HttpRequest, response: HttpResponseBase) -> HttpResponse: ... +def conditional_content_removal( + request: HttpRequest, response: HttpResponseBase +) -> HttpResponse: ... diff --git a/django-stubs/test/html.pyi b/django-stubs/test/html.pyi index 67d69f856..35f5f8ea2 100644 --- a/django-stubs/test/html.pyi +++ b/django-stubs/test/html.pyi @@ -13,7 +13,9 @@ class Element: name: Optional[str] = ... attributes: List[_ElementAttribute] = ... children: List[Any] = ... - def __init__(self, name: Optional[str], attributes: Sequence[_ElementAttribute]) -> None: ... + def __init__( + self, name: Optional[str], attributes: Sequence[_ElementAttribute] + ) -> None: ... def append(self, element: Union[Element, str]) -> None: ... def finalize(self) -> None: ... def __contains__(self, element: Union[Element, str]) -> bool: ... diff --git a/django-stubs/test/runner.pyi b/django-stubs/test/runner.pyi index d68b4de27..3f4855518 100644 --- a/django-stubs/test/runner.pyi +++ b/django-stubs/test/runner.pyi @@ -57,7 +57,9 @@ class RemoteTestResult: class RemoteTestRunner: resultclass: Any = ... failfast: Any = ... - def __init__(self, failfast: bool = ..., resultclass: Optional[Any] = ...) -> None: ... + def __init__( + self, failfast: bool = ..., resultclass: Optional[Any] = ... + ) -> None: ... def run(self, test: Any): ... def default_test_processes() -> int: ... @@ -110,24 +112,42 @@ class DiscoverRunner: def add_arguments(cls, parser: ArgumentParser) -> None: ... def setup_test_environment(self, **kwargs: Any) -> None: ... def build_suite( - self, test_labels: Sequence[str] = ..., extra_tests: Optional[List[Any]] = ..., **kwargs: Any + self, + test_labels: Sequence[str] = ..., + extra_tests: Optional[List[Any]] = ..., + **kwargs: Any ) -> TestSuite: ... - def setup_databases(self, **kwargs: Any) -> List[Tuple[BaseDatabaseWrapper, str, bool]]: ... + def setup_databases( + self, **kwargs: Any + ) -> List[Tuple[BaseDatabaseWrapper, str, bool]]: ... def get_resultclass(self) -> Optional[Type[DebugSQLTextTestResult]]: ... def get_test_runner_kwargs(self) -> Dict[str, Optional[int]]: ... def run_checks(self) -> None: ... def run_suite(self, suite: TestSuite, **kwargs: Any) -> TextTestResult: ... - def teardown_databases(self, old_config: List[Tuple[BaseDatabaseWrapper, str, bool]], **kwargs: Any) -> None: ... + def teardown_databases( + self, old_config: List[Tuple[BaseDatabaseWrapper, str, bool]], **kwargs: Any + ) -> None: ... def teardown_test_environment(self, **kwargs: Any) -> None: ... - def suite_result(self, suite: TestSuite, result: TextTestResult, **kwargs: Any) -> int: ... - def run_tests(self, test_labels: List[str], extra_tests: List[Any] = ..., **kwargs: Any) -> int: ... + def suite_result( + self, suite: TestSuite, result: TextTestResult, **kwargs: Any + ) -> int: ... + def run_tests( + self, test_labels: List[str], extra_tests: List[Any] = ..., **kwargs: Any + ) -> int: ... def is_discoverable(label: str) -> bool: ... def reorder_suite( - suite: TestSuite, classes: Tuple[Type[TestCase], Type[SimpleTestCase]], reverse: bool = ... + suite: TestSuite, + classes: Tuple[Type[TestCase], Type[SimpleTestCase]], + reverse: bool = ..., ) -> TestSuite: ... def partition_suite_by_type( - suite: TestSuite, classes: Tuple[Type[TestCase], Type[SimpleTestCase]], bins: List[OrderedSet], reverse: bool = ... + suite: TestSuite, + classes: Tuple[Type[TestCase], Type[SimpleTestCase]], + bins: List[OrderedSet], + reverse: bool = ..., ) -> None: ... def partition_suite_by_case(suite: Any): ... -def filter_tests_by_tags(suite: TestSuite, tags: Set[str], exclude_tags: Set[str]) -> TestSuite: ... +def filter_tests_by_tags( + suite: TestSuite, tags: Set[str], exclude_tags: Set[str] +) -> TestSuite: ... diff --git a/django-stubs/test/signals.pyi b/django-stubs/test/signals.pyi index 72c02df5e..cad768176 100644 --- a/django-stubs/test/signals.pyi +++ b/django-stubs/test/signals.pyi @@ -1,4 +1,5 @@ from typing import Any + from django.core.signals import setting_changed as setting_changed # noqa: F401 template_rendered: Any diff --git a/django-stubs/test/testcases.pyi b/django-stubs/test/testcases.pyi index 67a565cfd..9c46b93af 100644 --- a/django-stubs/test/testcases.pyi +++ b/django-stubs/test/testcases.pyi @@ -1,11 +1,25 @@ import threading import unittest from datetime import date -from typing import Any, Callable, Dict, Iterator, List, Optional, Set, Tuple, Type, Union, ClassVar, overload +from typing import ( + Any, + Callable, + ClassVar, + Dict, + Iterator, + List, + Optional, + Set, + Tuple, + Type, + Union, + overload, +) from django.core.exceptions import ImproperlyConfigured from django.core.handlers.wsgi import WSGIHandler from django.core.servers.basehttp import ThreadedWSGIServer, WSGIRequestHandler +from django.db import connections as connections # noqa: F401 from django.db.backends.sqlite3.base import DatabaseWrapper from django.db.models.base import Model from django.db.models.query import QuerySet, RawQuerySet @@ -15,7 +29,6 @@ from django.template.base import Template from django.test.client import Client from django.test.utils import CaptureQueriesContext, ContextList from django.utils.safestring import SafeText -from django.db import connections as connections # noqa: F401 class _AssertNumQueriesContext(CaptureQueriesContext): test_case: SimpleTestCase = ... @@ -29,7 +42,9 @@ class _AssertTemplateUsedContext: rendered_template_names: List[str] = ... context: ContextList = ... def __init__(self, test_case: Any, template_name: Any) -> None: ... - def on_template_render(self, sender: Any, signal: Any, template: Any, context: Any, **kwargs: Any) -> None: ... + def on_template_render( + self, sender: Any, signal: Any, template: Any, context: Any, **kwargs: Any + ) -> None: ... def test(self): ... def message(self): ... def __enter__(self): ... @@ -103,13 +118,24 @@ class SimpleTestCase(unittest.TestCase): count: Optional[int] = ..., ) -> Optional[_AssertTemplateUsedContext]: ... def assertTemplateNotUsed( - self, response: Union[HttpResponse, str] = ..., template_name: Optional[str] = ..., msg_prefix: str = ... + self, + response: Union[HttpResponse, str] = ..., + template_name: Optional[str] = ..., + msg_prefix: str = ..., ) -> Optional[_AssertTemplateNotUsedContext]: ... def assertRaisesMessage( - self, expected_exception: Type[Exception], expected_message: str, *args: Any, **kwargs: Any + self, + expected_exception: Type[Exception], + expected_message: str, + *args: Any, + **kwargs: Any ) -> Any: ... def assertWarnsMessage( - self, expected_warning: Type[Exception], expected_message: str, *args: Any, **kwargs: Any + self, + expected_warning: Type[Exception], + expected_message: str, + *args: Any, + **kwargs: Any ) -> Any: ... def assertFieldOutput( self, @@ -120,10 +146,18 @@ class SimpleTestCase(unittest.TestCase): field_kwargs: None = ..., empty_value: str = ..., ) -> Any: ... - def assertHTMLEqual(self, html1: str, html2: str, msg: Optional[str] = ...) -> None: ... - def assertHTMLNotEqual(self, html1: str, html2: str, msg: Optional[str] = ...) -> None: ... + def assertHTMLEqual( + self, html1: str, html2: str, msg: Optional[str] = ... + ) -> None: ... + def assertHTMLNotEqual( + self, html1: str, html2: str, msg: Optional[str] = ... + ) -> None: ... def assertInHTML( - self, needle: str, haystack: SafeText, count: Optional[int] = ..., msg_prefix: str = ... + self, + needle: str, + haystack: SafeText, + count: Optional[int] = ..., + msg_prefix: str = ..., ) -> None: ... def assertJSONEqual( self, @@ -137,8 +171,12 @@ class SimpleTestCase(unittest.TestCase): expected_data: Union[Dict[str, Any], List[Any], str, int, float, bool, None], msg: Optional[str] = ..., ) -> None: ... - def assertXMLEqual(self, xml1: str, xml2: str, msg: Optional[str] = ...) -> None: ... - def assertXMLNotEqual(self, xml1: str, xml2: str, msg: Optional[str] = ...) -> None: ... + def assertXMLEqual( + self, xml1: str, xml2: str, msg: Optional[str] = ... + ) -> None: ... + def assertXMLNotEqual( + self, xml1: str, xml2: str, msg: Optional[str] = ... + ) -> None: ... class TransactionTestCase(SimpleTestCase): reset_sequences: bool = ... @@ -149,14 +187,27 @@ class TransactionTestCase(SimpleTestCase): def assertQuerysetEqual( self, qs: Union[Iterator[Any], List[Model], QuerySet, RawQuerySet], - values: Union[List[None], List[Tuple[str, str]], List[date], List[int], List[str], Set[str], QuerySet], + values: Union[ + List[None], + List[Tuple[str, str]], + List[date], + List[int], + List[str], + Set[str], + QuerySet, + ], transform: Union[Callable, Type[str]] = ..., ordered: bool = ..., msg: Optional[str] = ..., ) -> None: ... @overload def assertNumQueries( - self, num: int, func: Callable[..., Any], *args: Any, using: str = ..., **kwargs: Any + self, + num: int, + func: Callable[..., Any], + *args: Any, + using: str = ..., + **kwargs: Any ) -> None: ... @overload def assertNumQueries( diff --git a/django-stubs/test/utils.pyi b/django-stubs/test/utils.pyi index 03d4da1b5..4f6e62841 100644 --- a/django-stubs/test/utils.pyi +++ b/django-stubs/test/utils.pyi @@ -5,6 +5,7 @@ from io import StringIO from typing import ( Any, Callable, + ContextManager, Dict, Iterable, Iterator, @@ -14,20 +15,18 @@ from typing import ( Set, Tuple, Type, - Union, - ContextManager, TypeVar, + Union, ) from django.apps.registry import Apps +from django.conf import LazySettings, Settings from django.core.checks.registry import CheckRegistry from django.db.models.lookups import Lookup, Transform from django.db.models.query_utils import RegisterLookupMixin from django.test.runner import DiscoverRunner from django.test.testcases import SimpleTestCase -from django.conf import LazySettings, Settings - _TestClass = Type[SimpleTestCase] _DecoratedTest = Union[Callable, _TestClass] _C = TypeVar("_C", bound=Callable) # Any callable @@ -47,12 +46,16 @@ class _TestState: ... def setup_test_environment(debug: Optional[bool] = ...) -> None: ... def teardown_test_environment() -> None: ... -def get_runner(settings: LazySettings, test_runner_class: Optional[str] = ...) -> Type[DiscoverRunner]: ... +def get_runner( + settings: LazySettings, test_runner_class: Optional[str] = ... +) -> Type[DiscoverRunner]: ... class TestContextDecorator: attr_name: Optional[str] = ... kwarg_name: Optional[str] = ... - def __init__(self, attr_name: Optional[str] = ..., kwarg_name: Optional[str] = ...) -> None: ... + def __init__( + self, attr_name: Optional[str] = ..., kwarg_name: Optional[str] = ... + ) -> None: ... def enable(self) -> Any: ... def disable(self) -> None: ... def __enter__(self) -> Optional[Apps]: ... @@ -79,7 +82,11 @@ class override_system_checks(TestContextDecorator): registry: CheckRegistry = ... new_checks: List[Callable] = ... deployment_checks: Optional[List[Callable]] = ... - def __init__(self, new_checks: List[Callable], deployment_checks: Optional[List[Callable]] = ...) -> None: ... + def __init__( + self, + new_checks: List[Callable], + deployment_checks: Optional[List[Callable]] = ..., + ) -> None: ... old_checks: Set[Callable] = ... old_deployment_checks: Set[Callable] = ... @@ -142,14 +149,22 @@ _Signature = str _TestDatabase = Tuple[str, List[str]] def dependency_ordered( - test_databases: Iterable[Tuple[_Signature, _TestDatabase]], dependencies: Mapping[str, List[str]] + test_databases: Iterable[Tuple[_Signature, _TestDatabase]], + dependencies: Mapping[str, List[str]], ) -> List[Tuple[_Signature, _TestDatabase]]: ... -def get_unique_databases_and_mirrors() -> Tuple[Dict[_Signature, _TestDatabase], Dict[str, Any]]: ... +def get_unique_databases_and_mirrors() -> Tuple[ + Dict[_Signature, _TestDatabase], Dict[str, Any] +]: ... def teardown_databases( - old_config: Iterable[Tuple[Any, str, bool]], verbosity: int, parallel: int = ..., keepdb: bool = ... + old_config: Iterable[Tuple[Any, str, bool]], + verbosity: int, + parallel: int = ..., + keepdb: bool = ..., ) -> None: ... def require_jinja2(test_func: _C) -> _C: ... @contextmanager def register_lookup( - field: Type[RegisterLookupMixin], *lookups: Type[Union[Lookup, Transform]], lookup_name: Optional[str] = ... + field: Type[RegisterLookupMixin], + *lookups: Type[Union[Lookup, Transform]], + lookup_name: Optional[str] = ... ) -> Iterator[None]: ... diff --git a/django-stubs/urls/__init__.pyi b/django-stubs/urls/__init__.pyi index 3742aa4fb..0144ac266 100644 --- a/django-stubs/urls/__init__.pyi +++ b/django-stubs/urls/__init__.pyi @@ -1,36 +1,36 @@ # noinspection PyUnresolvedReferences -from .base import ( - clear_script_prefix as clear_script_prefix, - clear_url_caches as clear_url_caches, - get_script_prefix as get_script_prefix, - get_urlconf as get_urlconf, - is_valid_path as is_valid_path, - resolve as resolve, - reverse as reverse, - reverse_lazy as reverse_lazy, - set_script_prefix as set_script_prefix, - set_urlconf as set_urlconf, - translate_url as translate_url, -) +from .base import clear_script_prefix as clear_script_prefix +from .base import clear_url_caches as clear_url_caches +from .base import get_script_prefix as get_script_prefix +from .base import get_urlconf as get_urlconf +from .base import is_valid_path as is_valid_path +from .base import resolve as resolve +from .base import reverse as reverse +from .base import reverse_lazy as reverse_lazy +from .base import set_script_prefix as set_script_prefix +from .base import set_urlconf as set_urlconf +from .base import translate_url as translate_url # noinspection PyUnresolvedReferences -from .conf import include as include, path as path, re_path as re_path +from .conf import include as include +from .conf import path as path +from .conf import re_path as re_path # noinspection PyUnresolvedReferences from .converters import register_converter as register_converter # noinspection PyUnresolvedReferences -from .exceptions import NoReverseMatch as NoReverseMatch, Resolver404 as Resolver404 +from .exceptions import NoReverseMatch as NoReverseMatch +from .exceptions import Resolver404 as Resolver404 # noinspection PyUnresolvedReferences -from .resolvers import ( - LocalePrefixPattern as LocalePrefixPattern, - ResolverMatch as ResolverMatch, - URLPattern as URLPattern, - URLResolver as URLResolver, - get_ns_resolver as get_ns_resolver, - get_resolver as get_resolver, -) +from .resolvers import LocalePrefixPattern as LocalePrefixPattern +from .resolvers import ResolverMatch as ResolverMatch +from .resolvers import URLPattern as URLPattern +from .resolvers import URLResolver as URLResolver +from .resolvers import get_ns_resolver as get_ns_resolver +from .resolvers import get_resolver as get_resolver # noinspection PyUnresolvedReferences -from .utils import get_callable as get_callable, get_mod_func as get_mod_func +from .utils import get_callable as get_callable +from .utils import get_mod_func as get_mod_func diff --git a/django-stubs/urls/base.pyi b/django-stubs/urls/base.pyi index d0e233d69..b8b4daeb2 100644 --- a/django-stubs/urls/base.pyi +++ b/django-stubs/urls/base.pyi @@ -1,4 +1,4 @@ -from typing import Any, Callable, Dict, Optional, Type, Union, Sequence +from typing import Any, Callable, Dict, Optional, Sequence, Type, Union from django.urls.resolvers import ResolverMatch diff --git a/django-stubs/urls/conf.pyi b/django-stubs/urls/conf.pyi index dddf1395e..a5348738c 100644 --- a/django-stubs/urls/conf.pyi +++ b/django-stubs/urls/conf.pyi @@ -1,31 +1,49 @@ -from typing import Any, List, Optional, Tuple, overload, Callable, Dict, Union +from typing import Any, Callable, Dict, List, Optional, Tuple, Union, overload -from .resolvers import URLResolver, URLPattern from ..conf.urls import IncludedURLConf from ..http.response import HttpResponseBase +from .resolvers import URLPattern, URLResolver -def include(arg: Any, namespace: Optional[str] = ...) -> Tuple[List[URLResolver], Optional[str], Optional[str]]: ... +def include( + arg: Any, namespace: Optional[str] = ... +) -> Tuple[List[URLResolver], Optional[str], Optional[str]]: ... # path() @overload def path( - route: str, view: Callable[..., HttpResponseBase], kwargs: Dict[str, Any] = ..., name: str = ... + route: str, + view: Callable[..., HttpResponseBase], + kwargs: Dict[str, Any] = ..., + name: str = ..., ) -> URLPattern: ... @overload -def path(route: str, view: IncludedURLConf, kwargs: Dict[str, Any] = ..., name: str = ...) -> URLResolver: ... +def path( + route: str, view: IncludedURLConf, kwargs: Dict[str, Any] = ..., name: str = ... +) -> URLResolver: ... @overload def path( - route: str, view: List[Union[URLResolver, str]], kwargs: Dict[str, Any] = ..., name: str = ... + route: str, + view: List[Union[URLResolver, str]], + kwargs: Dict[str, Any] = ..., + name: str = ..., ) -> URLResolver: ... # re_path() @overload def re_path( - route: str, view: Callable[..., HttpResponseBase], kwargs: Dict[str, Any] = ..., name: str = ... + route: str, + view: Callable[..., HttpResponseBase], + kwargs: Dict[str, Any] = ..., + name: str = ..., ) -> URLPattern: ... @overload -def re_path(route: str, view: IncludedURLConf, kwargs: Dict[str, Any] = ..., name: str = ...) -> URLResolver: ... +def re_path( + route: str, view: IncludedURLConf, kwargs: Dict[str, Any] = ..., name: str = ... +) -> URLResolver: ... @overload def re_path( - route: str, view: List[Union[URLResolver, str]], kwargs: Dict[str, Any] = ..., name: str = ... + route: str, + view: List[Union[URLResolver, str]], + kwargs: Dict[str, Any] = ..., + name: str = ..., ) -> URLResolver: ... diff --git a/django-stubs/urls/resolvers.pyi b/django-stubs/urls/resolvers.pyi index 5be27f201..6f327ab54 100644 --- a/django-stubs/urls/resolvers.pyi +++ b/django-stubs/urls/resolvers.pyi @@ -29,12 +29,16 @@ class ResolverMatch: def __iter__(self) -> Any: ... def get_resolver(urlconf: Optional[str] = ...) -> URLResolver: ... -def get_ns_resolver(ns_pattern: str, resolver: URLResolver, converters: Tuple) -> URLResolver: ... +def get_ns_resolver( + ns_pattern: str, resolver: URLResolver, converters: Tuple +) -> URLResolver: ... class LocaleRegexDescriptor: attr: str = ... def __init__(self, attr: Any) -> None: ... - def __get__(self, instance: Optional[RegexPattern], cls: Type[RegexPattern] = ...) -> LocaleRegexDescriptor: ... + def __get__( + self, instance: Optional[RegexPattern], cls: Type[RegexPattern] = ... + ) -> LocaleRegexDescriptor: ... class CheckURLMixin: def describe(self) -> str: ... @@ -43,7 +47,9 @@ class RegexPattern(CheckURLMixin): regex: Any = ... name: Optional[str] = ... converters: Dict[Any, Any] = ... - def __init__(self, regex: str, name: Optional[str] = ..., is_endpoint: bool = ...) -> None: ... + def __init__( + self, regex: str, name: Optional[str] = ..., is_endpoint: bool = ... + ) -> None: ... def match(self, path: str) -> Optional[Tuple[str, Tuple, Dict[str, str]]]: ... def check(self) -> List[Warning]: ... @@ -51,8 +57,12 @@ class RoutePattern(CheckURLMixin): regex: Any = ... name: Optional[str] = ... converters: Dict[str, UUIDConverter] = ... - def __init__(self, route: str, name: Optional[str] = ..., is_endpoint: bool = ...) -> None: ... - def match(self, path: str) -> Optional[Tuple[str, Tuple, Dict[str, Union[int, str]]]]: ... + def __init__( + self, route: str, name: Optional[str] = ..., is_endpoint: bool = ... + ) -> None: ... + def match( + self, path: str + ) -> Optional[Tuple[str, Tuple, Dict[str, Union[int, str]]]]: ... def check(self) -> List[Warning]: ... class LocalePrefixPattern: @@ -74,7 +84,11 @@ class URLPattern: default_args: Optional[Dict[str, str]] = ... name: Optional[str] = ... def __init__( - self, pattern: Any, callback: Callable, default_args: Optional[Dict[str, str]] = ..., name: Optional[str] = ... + self, + pattern: Any, + callback: Callable, + default_args: Optional[Dict[str, str]] = ..., + name: Optional[str] = ..., ) -> None: ... def check(self) -> List[Warning]: ... def resolve(self, path: str) -> Optional[ResolverMatch]: ... @@ -105,7 +119,9 @@ class URLResolver: @property def app_dict(self) -> Dict[str, List[str]]: ... def resolve(self, path: str) -> ResolverMatch: ... - def resolve_error_handler(self, view_type: int) -> Tuple[Callable, Dict[str, Any]]: ... + def resolve_error_handler( + self, view_type: int + ) -> Tuple[Callable, Dict[str, Any]]: ... def reverse(self, lookup_view: str, *args: Any, **kwargs: Any) -> str: ... def _is_callback(self, name: str) -> bool: ... def _populate(self) -> None: ... diff --git a/django-stubs/utils/autoreload.pyi b/django-stubs/utils/autoreload.pyi index edb684167..33c4e4992 100644 --- a/django-stubs/utils/autoreload.pyi +++ b/django-stubs/utils/autoreload.pyi @@ -1,7 +1,18 @@ import threading import types from pathlib import Path -from typing import Any, Callable, List, Optional, Set, Dict, Union, Iterator, Tuple, Iterable +from typing import ( + Any, + Callable, + Dict, + Iterable, + Iterator, + List, + Optional, + Set, + Tuple, + Union, +) from django.apps.registry import Apps @@ -22,7 +33,9 @@ def ensure_echo_on() -> None: ... def reloader_thread() -> None: ... def restart_with_reloader() -> int: ... def python_reloader(main_func: Any, args: Any, kwargs: Any) -> None: ... -def main(main_func: Any, args: Optional[Any] = ..., kwargs: Optional[Any] = ...) -> None: ... +def main( + main_func: Any, args: Optional[Any] = ..., kwargs: Optional[Any] = ... +) -> None: ... def iter_all_python_module_files() -> Set[Path]: ... def iter_modules_and_files( modules: Iterable[types.ModuleType], extra_files: Iterable[Union[str, Path]] @@ -37,7 +50,9 @@ class BaseReloader: def watch_dir(self, path: Union[str, Path], glob: str) -> None: ... def watch_file(self, path: Union[str, Path]) -> None: ... def watched_files(self, include_globs: bool = ...) -> Iterator[Path]: ... - def wait_for_apps_ready(self, app_reg: Apps, django_main_thread: threading.Thread) -> bool: ... + def wait_for_apps_ready( + self, app_reg: Apps, django_main_thread: threading.Thread + ) -> bool: ... def run(self, django_main_thread: threading.Thread) -> None: ... def run_loop(self) -> None: ... def tick(self) -> Iterator[None]: ... @@ -63,5 +78,7 @@ class WatchmanReloader(BaseReloader): def check_server_status(self, inner_ex: Optional[BaseException] = ...) -> bool: ... def get_reloader() -> BaseReloader: ... -def start_django(reloader: BaseReloader, main_func: Callable, *args: Any, **kwargs: Any) -> None: ... +def start_django( + reloader: BaseReloader, main_func: Callable, *args: Any, **kwargs: Any +) -> None: ... def run_with_reloader(main_func: Callable, *args: Any, **kwargs: Any) -> None: ... diff --git a/django-stubs/utils/baseconv.pyi b/django-stubs/utils/baseconv.pyi index 20f65556c..5d5993b11 100644 --- a/django-stubs/utils/baseconv.pyi +++ b/django-stubs/utils/baseconv.pyi @@ -14,7 +14,9 @@ class BaseConverter: def __init__(self, digits: str, sign: str = ...) -> None: ... def encode(self, i: int) -> str: ... def decode(self, s: str) -> int: ... - def convert(self, number: Union[int, str], from_digits: str, to_digits: str, sign: str) -> Tuple[int, str]: ... + def convert( + self, number: Union[int, str], from_digits: str, to_digits: str, sign: str + ) -> Tuple[int, str]: ... base2: Any base16: Any diff --git a/django-stubs/utils/cache.pyi b/django-stubs/utils/cache.pyi index f47d929db..2722e5f43 100644 --- a/django-stubs/utils/cache.pyi +++ b/django-stubs/utils/cache.pyi @@ -15,12 +15,17 @@ def get_conditional_response( last_modified: Optional[int] = ..., response: Optional[HttpResponse] = ..., ) -> Optional[HttpResponse]: ... -def patch_response_headers(response: HttpResponseBase, cache_timeout: float = ...) -> None: ... +def patch_response_headers( + response: HttpResponseBase, cache_timeout: float = ... +) -> None: ... def add_never_cache_headers(response: HttpResponseBase) -> None: ... def patch_vary_headers(response: HttpResponseBase, newheaders: Tuple[str]) -> None: ... def has_vary_header(response: HttpResponse, header_query: str) -> bool: ... def get_cache_key( - request: WSGIRequest, key_prefix: Optional[str] = ..., method: str = ..., cache: Optional[BaseCache] = ... + request: WSGIRequest, + key_prefix: Optional[str] = ..., + method: str = ..., + cache: Optional[BaseCache] = ..., ) -> Optional[str]: ... def learn_cache_key( request: WSGIRequest, diff --git a/django-stubs/utils/crypto.pyi b/django-stubs/utils/crypto.pyi index 9b41ab78b..fb7c1653a 100644 --- a/django-stubs/utils/crypto.pyi +++ b/django-stubs/utils/crypto.pyi @@ -3,7 +3,9 @@ from typing import Callable, Optional, Union using_sysrandom: bool -def salted_hmac(key_salt: str, value: Union[bytes, str], secret: Optional[Union[bytes, str]] = ...) -> HMAC: ... +def salted_hmac( + key_salt: str, value: Union[bytes, str], secret: Optional[Union[bytes, str]] = ... +) -> HMAC: ... def get_random_string(length: int = ..., allowed_chars: str = ...) -> str: ... def constant_time_compare(val1: Union[bytes, str], val2: Union[bytes, str]) -> bool: ... def pbkdf2( diff --git a/django-stubs/utils/datastructures.pyi b/django-stubs/utils/datastructures.pyi index 7b5f7b2d1..d283ad014 100644 --- a/django-stubs/utils/datastructures.pyi +++ b/django-stubs/utils/datastructures.pyi @@ -3,16 +3,16 @@ from typing import ( Callable, Dict, Iterable, + Iterator, List, Mapping, MutableMapping, MutableSet, + Optional, Tuple, TypeVar, Union, overload, - Iterator, - Optional, ) from typing_extensions import Literal @@ -35,12 +35,18 @@ _D = TypeVar("_D", bound="MultiValueDict") class MultiValueDict(MutableMapping[_K, _V]): @overload - def __init__(self, key_to_list_mapping: Mapping[_K, Optional[List[_V]]] = ...) -> None: ... + def __init__( + self, key_to_list_mapping: Mapping[_K, Optional[List[_V]]] = ... + ) -> None: ... @overload - def __init__(self, key_to_list_mapping: Iterable[Tuple[_K, List[_V]]] = ...) -> None: ... + def __init__( + self, key_to_list_mapping: Iterable[Tuple[_K, List[_V]]] = ... + ) -> None: ... def getlist(self, key: _K, default: Any = ...) -> List[_V]: ... def setlist(self, key: _K, list_: List[_V]) -> None: ... - def setlistdefault(self, key: _K, default_list: Optional[List[_V]] = ...) -> List[_V]: ... + def setlistdefault( + self, key: _K, default_list: Optional[List[_V]] = ... + ) -> List[_V]: ... def appendlist(self, key: _K, value: _V) -> None: ... def lists(self) -> Iterable[Tuple[_K, List[_V]]]: ... def dict(self) -> Dict[_K, Union[_V, List[_V]]]: ... @@ -61,9 +67,13 @@ class DictWrapper(Dict[str, _V]): func: Callable[[_V], _V] = ... prefix: str = ... @overload - def __init__(self, data: Mapping[str, _V], func: Callable[[_V], _V], prefix: str) -> None: ... + def __init__( + self, data: Mapping[str, _V], func: Callable[[_V], _V], prefix: str + ) -> None: ... @overload - def __init__(self, data: Iterable[Tuple[str, _V]], func: Callable[[_V], _V], prefix: str) -> None: ... + def __init__( + self, data: Iterable[Tuple[str, _V]], func: Callable[[_V], _V], prefix: str + ) -> None: ... _T = TypeVar("_T", bound="CaseInsensitiveMapping") diff --git a/django-stubs/utils/dateformat.pyi b/django-stubs/utils/dateformat.pyi index e9246e4d8..9c95bc143 100644 --- a/django-stubs/utils/dateformat.pyi +++ b/django-stubs/utils/dateformat.pyi @@ -1,4 +1,4 @@ -from datetime import datetime, date +from datetime import date, datetime from typing import Any, Optional, Union from django.utils.timezone import FixedOffset diff --git a/django-stubs/utils/datetime_safe.pyi b/django-stubs/utils/datetime_safe.pyi index 8dbfc7101..49180d01d 100644 --- a/django-stubs/utils/datetime_safe.pyi +++ b/django-stubs/utils/datetime_safe.pyi @@ -1,4 +1,6 @@ -from datetime import date as real_date, datetime as real_datetime, time as real_time +from datetime import date as real_date +from datetime import datetime as real_datetime +from datetime import time as real_time from typing import Union class date(real_date): ... diff --git a/django-stubs/utils/decorators.pyi b/django-stubs/utils/decorators.pyi index 3badf23eb..ae56897e4 100644 --- a/django-stubs/utils/decorators.pyi +++ b/django-stubs/utils/decorators.pyi @@ -1,4 +1,4 @@ -from typing import Any, Callable, Iterable, Optional, Type, Union, TypeVar +from typing import Any, Callable, Iterable, Optional, Type, TypeVar, Union from django.utils.deprecation import MiddlewareMixin from django.views.generic.base import View @@ -7,7 +7,9 @@ _T = TypeVar("_T", bound=Union[View, Callable]) # Any callable class classonlymethod(classmethod): ... -def method_decorator(decorator: Union[Callable, Iterable[Callable]], name: str = ...) -> Callable[[_T], _T]: ... +def method_decorator( + decorator: Union[Callable, Iterable[Callable]], name: str = ... +) -> Callable[[_T], _T]: ... def decorator_from_middleware_with_args(middleware_class: type) -> Callable: ... def decorator_from_middleware(middleware_class: type) -> Callable: ... def available_attrs(fn: Callable): ... diff --git a/django-stubs/utils/deprecation.pyi b/django-stubs/utils/deprecation.pyi index 096513aaa..726645976 100644 --- a/django-stubs/utils/deprecation.pyi +++ b/django-stubs/utils/deprecation.pyi @@ -14,7 +14,11 @@ class warn_about_renamed_method: new_method_name: str = ... deprecation_warning: Type[DeprecationWarning] = ... def __init__( - self, class_name: str, old_method_name: str, new_method_name: str, deprecation_warning: Type[DeprecationWarning] + self, + class_name: str, + old_method_name: str, + new_method_name: str, + deprecation_warning: Type[DeprecationWarning], ) -> None: ... def __call__(self, f: Callable) -> Callable: ... diff --git a/django-stubs/utils/encoding.pyi b/django-stubs/utils/encoding.pyi index 11fd059b2..dbff3fd3b 100644 --- a/django-stubs/utils/encoding.pyi +++ b/django-stubs/utils/encoding.pyi @@ -1,6 +1,6 @@ import datetime from decimal import Decimal -from typing import Any, TypeVar, overload, Union +from typing import Any, TypeVar, Union, overload from django.utils.functional import Promise from typing_extensions import Literal @@ -11,32 +11,58 @@ class DjangoUnicodeDecodeError(UnicodeDecodeError): _P = TypeVar("_P", bound=Promise) _S = TypeVar("_S", bound=str) -_PT = TypeVar("_PT", None, int, float, Decimal, datetime.datetime, datetime.date, datetime.time) +_PT = TypeVar( + "_PT", None, int, float, Decimal, datetime.datetime, datetime.date, datetime.time +) @overload -def smart_text(s: _P, encoding: str = ..., strings_only: bool = ..., errors: str = ...) -> _P: ... +def smart_text( + s: _P, encoding: str = ..., strings_only: bool = ..., errors: str = ... +) -> _P: ... @overload -def smart_text(s: _PT, encoding: str = ..., strings_only: Literal[True] = ..., errors: str = ...) -> _PT: ... +def smart_text( + s: _PT, encoding: str = ..., strings_only: Literal[True] = ..., errors: str = ... +) -> _PT: ... @overload -def smart_text(s: _S, encoding: str = ..., strings_only: bool = ..., errors: str = ...) -> _S: ... +def smart_text( + s: _S, encoding: str = ..., strings_only: bool = ..., errors: str = ... +) -> _S: ... @overload -def smart_text(s: Any, encoding: str = ..., strings_only: bool = ..., errors: str = ...) -> str: ... +def smart_text( + s: Any, encoding: str = ..., strings_only: bool = ..., errors: str = ... +) -> str: ... def is_protected_type(obj: Any) -> bool: ... @overload -def force_text(s: _PT, encoding: str = ..., strings_only: Literal[True] = ..., errors: str = ...) -> _PT: ... +def force_text( + s: _PT, encoding: str = ..., strings_only: Literal[True] = ..., errors: str = ... +) -> _PT: ... @overload -def force_text(s: _S, encoding: str = ..., strings_only: bool = ..., errors: str = ...) -> _S: ... +def force_text( + s: _S, encoding: str = ..., strings_only: bool = ..., errors: str = ... +) -> _S: ... @overload -def force_text(s: Any, encoding: str = ..., strings_only: bool = ..., errors: str = ...) -> str: ... +def force_text( + s: Any, encoding: str = ..., strings_only: bool = ..., errors: str = ... +) -> str: ... @overload -def smart_bytes(s: _P, encoding: str = ..., strings_only: bool = ..., errors: str = ...) -> _P: ... +def smart_bytes( + s: _P, encoding: str = ..., strings_only: bool = ..., errors: str = ... +) -> _P: ... @overload -def smart_bytes(s: _PT, encoding: str = ..., strings_only: Literal[True] = ..., errors: str = ...) -> _PT: ... +def smart_bytes( + s: _PT, encoding: str = ..., strings_only: Literal[True] = ..., errors: str = ... +) -> _PT: ... @overload -def smart_bytes(s: Any, encoding: str = ..., strings_only: bool = ..., errors: str = ...) -> bytes: ... +def smart_bytes( + s: Any, encoding: str = ..., strings_only: bool = ..., errors: str = ... +) -> bytes: ... @overload -def force_bytes(s: _PT, encoding: str = ..., strings_only: Literal[True] = ..., errors: str = ...) -> _PT: ... +def force_bytes( + s: _PT, encoding: str = ..., strings_only: Literal[True] = ..., errors: str = ... +) -> _PT: ... @overload -def force_bytes(s: Any, encoding: str = ..., strings_only: bool = ..., errors: str = ...) -> bytes: ... +def force_bytes( + s: Any, encoding: str = ..., strings_only: bool = ..., errors: str = ... +) -> bytes: ... smart_str = smart_text force_str = force_text diff --git a/django-stubs/utils/feedgenerator.pyi b/django-stubs/utils/feedgenerator.pyi index ce0cb43dc..ea6358b57 100644 --- a/django-stubs/utils/feedgenerator.pyi +++ b/django-stubs/utils/feedgenerator.pyi @@ -49,7 +49,9 @@ class SyndicationFeed: def root_attributes(self) -> Dict[Any, Any]: ... def add_root_elements(self, handler: ContentHandler) -> None: ... def item_attributes(self, item: Dict[str, Any]) -> Dict[Any, Any]: ... - def add_item_elements(self, handler: ContentHandler, item: Dict[str, Any]) -> None: ... + def add_item_elements( + self, handler: ContentHandler, item: Dict[str, Any] + ) -> None: ... def write(self, outfile: Any, encoding: Any) -> None: ... def writeString(self, encoding: str) -> str: ... def latest_post_date(self) -> datetime: ... diff --git a/django-stubs/utils/formats.pyi b/django-stubs/utils/formats.pyi index 7bf76d0aa..0460fcb1c 100644 --- a/django-stubs/utils/formats.pyi +++ b/django-stubs/utils/formats.pyi @@ -1,4 +1,4 @@ -from datetime import datetime, date, time +from datetime import date, datetime, time from decimal import Decimal from typing import Any, Iterator, List, Optional, Union @@ -6,17 +6,25 @@ ISO_INPUT_FORMATS: Any FORMAT_SETTINGS: Any def reset_format_cache() -> None: ... -def iter_format_modules(lang: str, format_module_path: Optional[Union[List[str], str]] = ...) -> Iterator[Any]: ... +def iter_format_modules( + lang: str, format_module_path: Optional[Union[List[str], str]] = ... +) -> Iterator[Any]: ... def get_format_modules(lang: Optional[str] = ..., reverse: bool = ...) -> List[Any]: ... -def get_format(format_type: str, lang: Optional[str] = ..., use_l10n: Optional[bool] = ...) -> str: ... +def get_format( + format_type: str, lang: Optional[str] = ..., use_l10n: Optional[bool] = ... +) -> str: ... get_format_lazy: Any def date_format( - value: Union[date, datetime, str], format: Optional[str] = ..., use_l10n: Optional[bool] = ... + value: Union[date, datetime, str], + format: Optional[str] = ..., + use_l10n: Optional[bool] = ..., ) -> str: ... def time_format( - value: Union[time, datetime, str], format: Optional[str] = ..., use_l10n: Optional[bool] = ... + value: Union[time, datetime, str], + format: Optional[str] = ..., + use_l10n: Optional[bool] = ..., ) -> str: ... def number_format( value: Union[Decimal, float, str], @@ -28,4 +36,6 @@ def localize(value: Any, use_l10n: Optional[bool] = ...) -> Any: ... def localize_input( value: Optional[Union[datetime, Decimal, float, str]], default: Optional[str] = ... ) -> Optional[str]: ... -def sanitize_separators(value: Union[Decimal, int, str]) -> Union[Decimal, int, str]: ... +def sanitize_separators( + value: Union[Decimal, int, str] +) -> Union[Decimal, int, str]: ... diff --git a/django-stubs/utils/functional.pyi b/django-stubs/utils/functional.pyi index 7fa7abace..8e51dcf10 100644 --- a/django-stubs/utils/functional.pyi +++ b/django-stubs/utils/functional.pyi @@ -1,5 +1,17 @@ -from typing import Any, Callable, Dict, List, Optional, Tuple, Type, Union, TypeVar, Generic, overload from functools import wraps as wraps # noqa: F401 +from typing import ( + Any, + Callable, + Dict, + Generic, + List, + Optional, + Tuple, + Type, + TypeVar, + Union, + overload, +) from django.db.models.base import Model @@ -13,7 +25,9 @@ class cached_property(Generic[_T]): name: str = ... def __init__(self, func: Callable[..., _T], name: Optional[str] = ...): ... @overload - def __get__(self, instance: None, cls: Type[Any] = ...) -> "cached_property[_T]": ... + def __get__( + self, instance: None, cls: Type[Any] = ... + ) -> "cached_property[_T]": ... @overload def __get__(self, instance: object, cls: Type[Any] = ...) -> _T: ... diff --git a/django-stubs/utils/html.pyi b/django-stubs/utils/html.pyi index 314dcaa5f..2f697d746 100644 --- a/django-stubs/utils/html.pyi +++ b/django-stubs/utils/html.pyi @@ -32,6 +32,11 @@ class MLStripper(HTMLParser): def strip_tags(value: str) -> str: ... def strip_spaces_between_tags(value: str) -> str: ... def smart_urlquote(url: str) -> str: ... -def urlize(text: str, trim_url_limit: Optional[int] = ..., nofollow: bool = ..., autoescape: bool = ...) -> str: ... +def urlize( + text: str, + trim_url_limit: Optional[int] = ..., + nofollow: bool = ..., + autoescape: bool = ..., +) -> str: ... def avoid_wrapping(value: str) -> str: ... def html_safe(klass: Any): ... diff --git a/django-stubs/utils/http.pyi b/django-stubs/utils/http.pyi index 5ba5da61d..43f0ceb62 100644 --- a/django-stubs/utils/http.pyi +++ b/django-stubs/utils/http.pyi @@ -26,12 +26,20 @@ def parse_etags(etag_str: str) -> List[str]: ... def quote_etag(etag_str: str) -> str: ... def is_same_domain(host: str, pattern: str) -> bool: ... def url_has_allowed_host_and_scheme( - url: Optional[str], allowed_hosts: Optional[Union[str, Iterable[str]]], require_https: bool = ... + url: Optional[str], + allowed_hosts: Optional[Union[str, Iterable[str]]], + require_https: bool = ..., ) -> bool: ... def is_safe_url( - url: Optional[str], allowed_hosts: Optional[Union[str, Iterable[str]]], require_https: bool = ... + url: Optional[str], + allowed_hosts: Optional[Union[str, Iterable[str]]], + require_https: bool = ..., ) -> bool: ... def limited_parse_qsl( - qs: str, keep_blank_values: bool = ..., encoding: str = ..., errors: str = ..., fields_limit: Optional[int] = ... + qs: str, + keep_blank_values: bool = ..., + encoding: str = ..., + errors: str = ..., + fields_limit: Optional[int] = ..., ) -> List[Tuple[str, str]]: ... def escape_leading_slashes(url: str) -> str: ... diff --git a/django-stubs/utils/ipv6.pyi b/django-stubs/utils/ipv6.pyi index e3669c573..c96b4c95b 100644 --- a/django-stubs/utils/ipv6.pyi +++ b/django-stubs/utils/ipv6.pyi @@ -1,4 +1,6 @@ from typing import Any -def clean_ipv6_address(ip_str: Any, unpack_ipv4: bool = ..., error_message: Any = ...): ... +def clean_ipv6_address( + ip_str: Any, unpack_ipv4: bool = ..., error_message: Any = ... +): ... def is_valid_ipv6_address(ip_str: str) -> bool: ... diff --git a/django-stubs/utils/log.pyi b/django-stubs/utils/log.pyi index a9cd12746..0c0a4b480 100644 --- a/django-stubs/utils/log.pyi +++ b/django-stubs/utils/log.pyi @@ -7,13 +7,19 @@ from django.core.management.color import Style request_logger: Any DEFAULT_LOGGING: Any -def configure_logging(logging_config: str, logging_settings: Dict[str, Any]) -> None: ... +def configure_logging( + logging_config: str, logging_settings: Dict[str, Any] +) -> None: ... class AdminEmailHandler(logging.Handler): include_html: bool = ... email_backend: Optional[str] = ... - def __init__(self, include_html: bool = ..., email_backend: Optional[str] = ...) -> None: ... - def send_mail(self, subject: str, message: str, *args: Any, **kwargs: Any) -> None: ... + def __init__( + self, include_html: bool = ..., email_backend: Optional[str] = ... + ) -> None: ... + def send_mail( + self, subject: str, message: str, *args: Any, **kwargs: Any + ) -> None: ... def connection(self) -> Any: ... def format_subject(self, subject: str) -> str: ... diff --git a/django-stubs/utils/safestring.pyi b/django-stubs/utils/safestring.pyi index ac52284a3..04fa2f62c 100644 --- a/django-stubs/utils/safestring.pyi +++ b/django-stubs/utils/safestring.pyi @@ -1,4 +1,4 @@ -from typing import TypeVar, overload, Callable, Any +from typing import Any, Callable, TypeVar, overload _SD = TypeVar("_SD", bound="SafeData") diff --git a/django-stubs/utils/six.pyi b/django-stubs/utils/six.pyi index 2dad9d97e..a6079cc5b 100644 --- a/django-stubs/utils/six.pyi +++ b/django-stubs/utils/six.pyi @@ -50,13 +50,17 @@ MAXSIZE = ... # type: int def callable(obj: object) -> bool: ... def get_unbound_function(unbound: types.FunctionType) -> types.FunctionType: ... def create_bound_method(func: types.FunctionType, obj: object) -> types.MethodType: ... -def create_unbound_method(func: types.FunctionType, cls: type) -> types.FunctionType: ... +def create_unbound_method( + func: types.FunctionType, cls: type +) -> types.FunctionType: ... Iterator = object def get_method_function(meth: types.MethodType) -> types.FunctionType: ... def get_method_self(meth: types.MethodType) -> Optional[object]: ... -def get_function_closure(fun: types.FunctionType) -> Optional[Tuple[types._Cell, ...]]: ... +def get_function_closure( + fun: types.FunctionType, +) -> Optional[Tuple[types._Cell, ...]]: ... def get_function_code(fun: types.FunctionType) -> types.CodeType: ... def get_function_defaults(fun: types.FunctionType) -> Optional[Tuple[Any, ...]]: ... def get_function_globals(fun: types.FunctionType) -> Dict[str, Any]: ... @@ -79,28 +83,47 @@ def byte2int(bs: binary_type) -> int: ... def indexbytes(buf: binary_type, i: int) -> int: ... def iterbytes(buf: binary_type) -> typing.Iterator[int]: ... def assertCountEqual( - self: unittest.TestCase, first: Iterable[_T], second: Iterable[_T], msg: Optional[str] = ... + self: unittest.TestCase, + first: Iterable[_T], + second: Iterable[_T], + msg: Optional[str] = ..., ) -> None: ... @overload def assertRaisesRegex(self: unittest.TestCase, msg: Optional[str] = ...) -> Any: ... @overload -def assertRaisesRegex(self: unittest.TestCase, callable_obj: Callable[..., Any], *args: Any, **kwargs: Any) -> Any: ... +def assertRaisesRegex( + self: unittest.TestCase, callable_obj: Callable[..., Any], *args: Any, **kwargs: Any +) -> Any: ... def assertRegex( - self: unittest.TestCase, text: AnyStr, expected_regex: Union[AnyStr, Pattern[AnyStr]], msg: Optional[str] = ... + self: unittest.TestCase, + text: AnyStr, + expected_regex: Union[AnyStr, Pattern[AnyStr]], + msg: Optional[str] = ..., ) -> None: ... exec_ = exec def reraise( - tp: Optional[Type[BaseException]], value: Optional[BaseException], tb: Optional[types.TracebackType] = ... + tp: Optional[Type[BaseException]], + value: Optional[BaseException], + tb: Optional[types.TracebackType] = ..., +) -> NoReturn: ... +def raise_from( + value: Union[BaseException, Type[BaseException]], + from_value: Optional[BaseException], ) -> NoReturn: ... -def raise_from(value: Union[BaseException, Type[BaseException]], from_value: Optional[BaseException]) -> NoReturn: ... print_ = print def with_metaclass(meta: type, *bases: type) -> type: ... def add_metaclass(metaclass: type) -> Callable[[_T], _T]: ... -def ensure_binary(s: Union[bytes, Text], encoding: str = ..., errors: str = ...) -> bytes: ... -def ensure_str(s: Union[bytes, Text], encoding: str = ..., errors: str = ...) -> str: ... -def ensure_text(s: Union[bytes, Text], encoding: str = ..., errors: str = ...) -> Text: ... +def ensure_binary( + s: Union[bytes, Text], encoding: str = ..., errors: str = ... +) -> bytes: ... +def ensure_str( + s: Union[bytes, Text], encoding: str = ..., errors: str = ... +) -> str: ... +def ensure_text( + s: Union[bytes, Text], encoding: str = ..., errors: str = ... +) -> Text: ... def python_2_unicode_compatible(klass: _T) -> _T: ... diff --git a/django-stubs/utils/termcolors.pyi b/django-stubs/utils/termcolors.pyi index 2065a51bb..ff9013fea 100644 --- a/django-stubs/utils/termcolors.pyi +++ b/django-stubs/utils/termcolors.pyi @@ -1,4 +1,4 @@ -from typing import Any, Callable, Dict, Optional, Tuple, Union, Sequence +from typing import Any, Callable, Dict, Optional, Sequence, Tuple, Union color_names: Any foreground: Any @@ -6,7 +6,9 @@ background: Any RESET: str opt_dict: Any -def colorize(text: Optional[str] = ..., opts: Sequence[str] = ..., **kwargs: Any) -> str: ... +def colorize( + text: Optional[str] = ..., opts: Sequence[str] = ..., **kwargs: Any +) -> str: ... def make_style(opts: Tuple = ..., **kwargs: Any) -> Callable: ... NOCOLOR_PALETTE: str @@ -15,4 +17,6 @@ LIGHT_PALETTE: str PALETTES: Any DEFAULT_PALETTE: str = ... -def parse_color_setting(config_string: str) -> Optional[Dict[str, Dict[str, Union[Tuple[str], str]]]]: ... +def parse_color_setting( + config_string: str, +) -> Optional[Dict[str, Dict[str, Union[Tuple[str], str]]]]: ... diff --git a/django-stubs/utils/text.pyi b/django-stubs/utils/text.pyi index 927e51445..550220618 100644 --- a/django-stubs/utils/text.pyi +++ b/django-stubs/utils/text.pyi @@ -17,8 +17,12 @@ def wrap(text: str, width: int) -> str: ... class Truncator(SimpleLazyObject): def __init__(self, text: Union[Model, str]) -> None: ... def add_truncation_text(self, text: str, truncate: Optional[str] = ...) -> str: ... - def chars(self, num: int, truncate: Optional[str] = ..., html: bool = ...) -> str: ... - def words(self, num: int, truncate: Optional[str] = ..., html: bool = ...) -> str: ... + def chars( + self, num: int, truncate: Optional[str] = ..., html: bool = ... + ) -> str: ... + def words( + self, num: int, truncate: Optional[str] = ..., html: bool = ... + ) -> str: ... def get_valid_filename(s: str) -> str: ... def get_text_list(list_: List[str], last_word: str = ...) -> str: ... diff --git a/django-stubs/utils/timesince.pyi b/django-stubs/utils/timesince.pyi index 04e5b6a35..d88de07ca 100644 --- a/django-stubs/utils/timesince.pyi +++ b/django-stubs/utils/timesince.pyi @@ -1,10 +1,15 @@ from datetime import date -from typing import Any, Optional, Dict +from typing import Any, Dict, Optional TIME_STRINGS: Dict[str, str] TIMESINCE_CHUNKS: Any def timesince( - d: date, now: Optional[date] = ..., reversed: bool = ..., time_strings: Optional[Dict[str, str]] = ... + d: date, + now: Optional[date] = ..., + reversed: bool = ..., + time_strings: Optional[Dict[str, str]] = ..., +) -> str: ... +def timeuntil( + d: date, now: Optional[date] = ..., time_strings: Optional[Dict[str, str]] = ... ) -> str: ... -def timeuntil(d: date, now: Optional[date] = ..., time_strings: Optional[Dict[str, str]] = ...) -> str: ... diff --git a/django-stubs/utils/timezone.pyi b/django-stubs/utils/timezone.pyi index c61d4a5ce..52faede29 100644 --- a/django-stubs/utils/timezone.pyi +++ b/django-stubs/utils/timezone.pyi @@ -1,7 +1,12 @@ import types from contextlib import ContextDecorator -from datetime import date, datetime as datetime, time, timedelta as timedelta, tzinfo as tzinfo, timezone -from typing import Optional, Union, Type +from datetime import date +from datetime import datetime as datetime +from datetime import time +from datetime import timedelta as timedelta +from datetime import timezone +from datetime import tzinfo as tzinfo +from typing import Optional, Type, Union from pytz import BaseTzInfo @@ -13,7 +18,9 @@ class UTC(tzinfo): def dst(self, dt: Optional[datetime]) -> Optional[timedelta]: ... class FixedOffset(tzinfo): - def __init__(self, offset: Optional[int] = ..., name: Optional[str] = ...) -> None: ... + def __init__( + self, offset: Optional[int] = ..., name: Optional[str] = ... + ) -> None: ... def utcoffset(self, dt: Optional[datetime]) -> Optional[timedelta]: ... def tzname(self, dt: Optional[datetime]) -> str: ... def dst(self, dt: Optional[Union[datetime, timedelta]]) -> Optional[timedelta]: ... @@ -50,13 +57,22 @@ class override(ContextDecorator): def __init__(self, timezone: Optional[Union[str, tzinfo]]) -> None: ... def __enter__(self) -> None: ... def __exit__( - self, exc_type: Type[BaseException], exc_value: BaseException, traceback: types.TracebackType + self, + exc_type: Type[BaseException], + exc_value: BaseException, + traceback: types.TracebackType, ) -> None: ... -def localtime(value: Optional[_AnyTime] = ..., timezone: Optional[tzinfo] = ...) -> datetime: ... -def localdate(value: Optional[_AnyTime] = ..., timezone: Optional[tzinfo] = ...) -> date: ... +def localtime( + value: Optional[_AnyTime] = ..., timezone: Optional[tzinfo] = ... +) -> datetime: ... +def localdate( + value: Optional[_AnyTime] = ..., timezone: Optional[tzinfo] = ... +) -> date: ... def now() -> datetime: ... def is_aware(value: _AnyTime) -> bool: ... def is_naive(value: _AnyTime) -> bool: ... -def make_aware(value: _AnyTime, timezone: Optional[tzinfo] = ..., is_dst: Optional[bool] = ...) -> datetime: ... +def make_aware( + value: _AnyTime, timezone: Optional[tzinfo] = ..., is_dst: Optional[bool] = ... +) -> datetime: ... def make_naive(value: _AnyTime, timezone: Optional[tzinfo] = ...) -> datetime: ... diff --git a/django-stubs/utils/topological_sort.pyi b/django-stubs/utils/topological_sort.pyi index 0a537a550..d0ace23b2 100644 --- a/django-stubs/utils/topological_sort.pyi +++ b/django-stubs/utils/topological_sort.pyi @@ -1,6 +1,10 @@ -from typing import Any, Dict, Iterator, Set, Container, List +from typing import Any, Container, Dict, Iterator, List, Set class CyclicDependencyError(ValueError): ... -def topological_sort_as_sets(dependency_graph: Dict[Any, Any]) -> Iterator[Set[Any]]: ... -def stable_topological_sort(l: Container[Any], dependency_graph: Dict[Any, Any]) -> List[Any]: ... +def topological_sort_as_sets( + dependency_graph: Dict[Any, Any] +) -> Iterator[Set[Any]]: ... +def stable_topological_sort( + l: Container[Any], dependency_graph: Dict[Any, Any] +) -> List[Any]: ... diff --git a/django-stubs/utils/translation/__init__.pyi b/django-stubs/utils/translation/__init__.pyi index 08a1edebf..042aac31b 100644 --- a/django-stubs/utils/translation/__init__.pyi +++ b/django-stubs/utils/translation/__init__.pyi @@ -1,6 +1,6 @@ import functools from contextlib import ContextDecorator -from typing import Any, Optional, Callable, Union +from typing import Any, Callable, Optional, Union from django.core.handlers.wsgi import WSGIRequest @@ -47,7 +47,9 @@ def ngettext_lazy(singular: str, plural: str, number: Union[int, str, None]) -> ungettext_lazy = ngettext_lazy -def npgettext_lazy(context: str, singular: str, plural: str, number: Union[int, str, None]) -> str: ... +def npgettext_lazy( + context: str, singular: str, plural: str, number: Union[int, str, None] +) -> str: ... def activate(language: str) -> None: ... def deactivate() -> None: ... diff --git a/django-stubs/utils/translation/reloader.pyi b/django-stubs/utils/translation/reloader.pyi index f10515283..c1108aea6 100644 --- a/django-stubs/utils/translation/reloader.pyi +++ b/django-stubs/utils/translation/reloader.pyi @@ -4,4 +4,6 @@ from typing import Any, Optional from django.utils.autoreload import BaseReloader def watch_for_translation_changes(sender: BaseReloader, **kwargs: Any) -> None: ... -def translation_file_changed(sender: Optional[BaseReloader], file_path: Path, **kwargs: Any) -> bool: ... +def translation_file_changed( + sender: Optional[BaseReloader], file_path: Path, **kwargs: Any +) -> bool: ... diff --git a/django-stubs/utils/translation/trans_real.pyi b/django-stubs/utils/translation/trans_real.pyi index f07e1b2d1..a332461e4 100644 --- a/django-stubs/utils/translation/trans_real.pyi +++ b/django-stubs/utils/translation/trans_real.pyi @@ -1,7 +1,7 @@ import gettext as gettext_module from collections import OrderedDict from gettext import NullTranslations -from typing import Any, List, Optional, Tuple, Callable +from typing import Any, Callable, List, Optional, Tuple from django.core.handlers.wsgi import WSGIRequest @@ -15,7 +15,12 @@ def reset_cache(**kwargs: Any) -> None: ... class DjangoTranslation(gettext_module.GNUTranslations): domain: str = ... plural: Callable = ... - def __init__(self, language: str, domain: Optional[str] = ..., localedirs: Optional[List[str]] = ...) -> None: ... + def __init__( + self, + language: str, + domain: Optional[str] = ..., + localedirs: Optional[List[str]] = ..., + ) -> None: ... def merge(self, other: NullTranslations) -> None: ... def language(self): ... def to_language(self) -> str: ... @@ -30,13 +35,17 @@ def catalog(): ... def gettext(message: str) -> str: ... def pgettext(context: str, message: str) -> str: ... def gettext_noop(message: str) -> str: ... -def do_ntranslate(singular: str, plural: str, number: float, translation_function: str) -> str: ... +def do_ntranslate( + singular: str, plural: str, number: float, translation_function: str +) -> str: ... def ngettext(singular: str, plural: str, number: float) -> str: ... def npgettext(context: str, singular: str, plural: str, number: int) -> str: ... def all_locale_paths() -> List[str]: ... def check_for_language(lang_code: Optional[str]) -> bool: ... def get_languages() -> OrderedDict: ... -def get_supported_language_variant(lang_code: Optional[str], strict: bool = ...) -> str: ... +def get_supported_language_variant( + lang_code: Optional[str], strict: bool = ... +) -> str: ... def get_language_from_path(path: str, strict: bool = ...) -> Optional[str]: ... def get_language_from_request(request: WSGIRequest, check_path: bool = ...) -> str: ... def parse_accept_lang_header(lang_string: str) -> Tuple: ... diff --git a/django-stubs/utils/tree.pyi b/django-stubs/utils/tree.pyi index 75a7c7b24..1b98e155f 100644 --- a/django-stubs/utils/tree.pyi +++ b/django-stubs/utils/tree.pyi @@ -1,4 +1,4 @@ -from typing import Any, Dict, Iterable, Optional, Tuple, Union, Sequence, List +from typing import Any, Dict, Iterable, List, Optional, Sequence, Tuple, Union from django.db.models.sql.where import NothingNode @@ -10,7 +10,10 @@ class Node: connector: str = ... negated: bool = ... def __init__( - self, children: Optional[_NodeChildren] = ..., connector: Optional[str] = ..., negated: bool = ... + self, + children: Optional[_NodeChildren] = ..., + connector: Optional[str] = ..., + negated: bool = ..., ) -> None: ... def __deepcopy__(self, memodict: Dict[Any, Any]) -> Node: ... def __len__(self) -> int: ... diff --git a/django-stubs/utils/version.pyi b/django-stubs/utils/version.pyi index e90b96077..db6f842ea 100644 --- a/django-stubs/utils/version.pyi +++ b/django-stubs/utils/version.pyi @@ -7,7 +7,9 @@ PY39: Any def get_version(version: Optional[Tuple[int, int, int, str, int]] = ...) -> str: ... def get_main_version(version: Tuple[int, int, int, str, int] = ...) -> str: ... -def get_complete_version(version: Optional[Tuple[int, int, int, str, int]] = ...) -> Tuple[int, int, int, str, int]: ... +def get_complete_version( + version: Optional[Tuple[int, int, int, str, int]] = ... +) -> Tuple[int, int, int, str, int]: ... def get_docs_version(version: None = ...) -> str: ... def get_git_changeset(): ... def get_version_tuple(version: str) -> Tuple[int, int, int]: ... diff --git a/django-stubs/utils/xmlutils.pyi b/django-stubs/utils/xmlutils.pyi index 45d8c4c3a..a9190a339 100644 --- a/django-stubs/utils/xmlutils.pyi +++ b/django-stubs/utils/xmlutils.pyi @@ -5,7 +5,10 @@ class UnserializableContentError(ValueError): ... class SimplerXMLGenerator(XMLGenerator): def addQuickElement( - self, name: str, contents: Optional[str] = ..., attrs: Optional[Dict[str, str]] = ... + self, + name: str, + contents: Optional[str] = ..., + attrs: Optional[Dict[str, str]] = ..., ) -> None: ... def characters(self, content: str) -> None: ... def startElement(self, name: str, attrs: Dict[str, str]) -> None: ... diff --git a/django-stubs/views/csrf.pyi b/django-stubs/views/csrf.pyi index 7b76e7df5..228aae26f 100644 --- a/django-stubs/views/csrf.pyi +++ b/django-stubs/views/csrf.pyi @@ -4,4 +4,6 @@ from django.http.response import HttpResponseForbidden CSRF_FAILURE_TEMPLATE: str CSRF_FAILURE_TEMPLATE_NAME: str -def csrf_failure(request: HttpRequest, reason: str = ..., template_name: str = ...) -> HttpResponseForbidden: ... +def csrf_failure( + request: HttpRequest, reason: str = ..., template_name: str = ... +) -> HttpResponseForbidden: ... diff --git a/django-stubs/views/debug.pyi b/django-stubs/views/debug.pyi index a7e1aad8a..01c3a4cd7 100644 --- a/django-stubs/views/debug.pyi +++ b/django-stubs/views/debug.pyi @@ -16,9 +16,13 @@ class CallableSettingWrapper: def cleanse_setting(key: Union[int, str], value: Any) -> Any: ... def get_safe_settings() -> Dict[str, Any]: ... -def technical_500_response(request: Any, exc_type: Any, exc_value: Any, tb: Any, status_code: int = ...): ... +def technical_500_response( + request: Any, exc_type: Any, exc_value: Any, tb: Any, status_code: int = ... +): ... def get_default_exception_reporter_filter() -> ExceptionReporterFilter: ... -def get_exception_reporter_filter(request: Optional[HttpRequest]) -> ExceptionReporterFilter: ... +def get_exception_reporter_filter( + request: Optional[HttpRequest], +) -> ExceptionReporterFilter: ... class ExceptionReporterFilter: def get_post_parameters(self, request: Any): ... @@ -26,9 +30,15 @@ class ExceptionReporterFilter: class SafeExceptionReporterFilter(ExceptionReporterFilter): def is_active(self, request: Optional[HttpRequest]) -> bool: ... - def get_cleansed_multivaluedict(self, request: HttpRequest, multivaluedict: QueryDict) -> QueryDict: ... - def get_post_parameters(self, request: Optional[HttpRequest]) -> MutableMapping[str, Any]: ... - def cleanse_special_types(self, request: Optional[HttpRequest], value: Any) -> Any: ... + def get_cleansed_multivaluedict( + self, request: HttpRequest, multivaluedict: QueryDict + ) -> QueryDict: ... + def get_post_parameters( + self, request: Optional[HttpRequest] + ) -> MutableMapping[str, Any]: ... + def cleanse_special_types( + self, request: Optional[HttpRequest], value: Any + ) -> Any: ... def get_traceback_frame_variables(self, request: Any, tb_frame: Any): ... class ExceptionReporter: @@ -62,5 +72,7 @@ class ExceptionReporter: module_name: Optional[str] = ..., ): ... -def technical_404_response(request: HttpRequest, exception: Http404) -> HttpResponse: ... +def technical_404_response( + request: HttpRequest, exception: Http404 +) -> HttpResponse: ... def default_urlconf(request: Optional[HttpResponse]) -> HttpResponse: ... diff --git a/django-stubs/views/decorators/cache.pyi b/django-stubs/views/decorators/cache.pyi index 992df85e0..15ee83d1e 100644 --- a/django-stubs/views/decorators/cache.pyi +++ b/django-stubs/views/decorators/cache.pyi @@ -2,6 +2,8 @@ from typing import Any, Callable, Optional, TypeVar _F = TypeVar("_F", bound=Callable[..., Any]) -def cache_page(timeout: float, *, cache: Optional[Any] = ..., key_prefix: Optional[Any] = ...) -> Callable: ... +def cache_page( + timeout: float, *, cache: Optional[Any] = ..., key_prefix: Optional[Any] = ... +) -> Callable: ... def cache_control(**kwargs: Any) -> Callable: ... def never_cache(view_func: _F) -> _F: ... diff --git a/django-stubs/views/decorators/clickjacking.pyi b/django-stubs/views/decorators/clickjacking.pyi index f93f1ff07..1d0e483dd 100644 --- a/django-stubs/views/decorators/clickjacking.pyi +++ b/django-stubs/views/decorators/clickjacking.pyi @@ -1,4 +1,4 @@ -from typing import Callable, TypeVar, Any +from typing import Any, Callable, TypeVar _F = TypeVar("_F", bound=Callable[..., Any]) diff --git a/django-stubs/views/decorators/csrf.pyi b/django-stubs/views/decorators/csrf.pyi index a9f9a047b..016f6669d 100644 --- a/django-stubs/views/decorators/csrf.pyi +++ b/django-stubs/views/decorators/csrf.pyi @@ -10,7 +10,9 @@ requires_csrf_token: Any class _EnsureCsrfCookie(CsrfViewMiddleware): get_response: None - def process_view(self, request: Any, callback: Any, callback_args: Any, callback_kwargs: Any): ... + def process_view( + self, request: Any, callback: Any, callback_args: Any, callback_kwargs: Any + ): ... ensure_csrf_cookie: Any diff --git a/django-stubs/views/decorators/gzip.pyi b/django-stubs/views/decorators/gzip.pyi index 7b3766c9f..7792af7b3 100644 --- a/django-stubs/views/decorators/gzip.pyi +++ b/django-stubs/views/decorators/gzip.pyi @@ -1,4 +1,4 @@ -from typing import Callable, TypeVar, Any +from typing import Any, Callable, TypeVar _C = TypeVar("_C", bound=Callable[..., Any]) diff --git a/django-stubs/views/decorators/http.pyi b/django-stubs/views/decorators/http.pyi index 6a672ec53..649e0f29a 100644 --- a/django-stubs/views/decorators/http.pyi +++ b/django-stubs/views/decorators/http.pyi @@ -7,6 +7,8 @@ def require_http_methods(request_method_list: List[str]) -> Callable[[_F], _F]: def require_GET(_F) -> _F: ... def require_POST(_F) -> _F: ... def require_safe(_F) -> _F: ... -def condition(etag_func: Optional[Callable] = ..., last_modified_func: Optional[Callable] = ...) -> Callable: ... +def condition( + etag_func: Optional[Callable] = ..., last_modified_func: Optional[Callable] = ... +) -> Callable: ... def etag(etag_func: Callable[..., Any]) -> Callable[[_F], _F]: ... def last_modified(last_modified_func: Callable[..., Any]) -> Callable[[_F], _F]: ... diff --git a/django-stubs/views/defaults.pyi b/django-stubs/views/defaults.pyi index 3241eb8fd..955a4060d 100644 --- a/django-stubs/views/defaults.pyi +++ b/django-stubs/views/defaults.pyi @@ -16,8 +16,12 @@ ERROR_500_TEMPLATE_NAME: str def page_not_found( request: HttpRequest, exception: Optional[Exception], template_name: str = ... ) -> HttpResponseNotFound: ... -def server_error(request: HttpRequest, template_name: str = ...) -> HttpResponseServerError: ... -def bad_request(request: HttpRequest, exception: Exception, template_name: str = ...) -> HttpResponseBadRequest: ... +def server_error( + request: HttpRequest, template_name: str = ... +) -> HttpResponseServerError: ... +def bad_request( + request: HttpRequest, exception: Exception, template_name: str = ... +) -> HttpResponseBadRequest: ... def permission_denied( request: HttpRequest, exception: Exception, template_name: str = ... ) -> HttpResponseForbidden: ... diff --git a/django-stubs/views/generic/__init__.pyi b/django-stubs/views/generic/__init__.pyi index da416059d..f8cae74a8 100644 --- a/django-stubs/views/generic/__init__.pyi +++ b/django-stubs/views/generic/__init__.pyi @@ -1,15 +1,18 @@ -from .base import RedirectView as RedirectView, TemplateView as TemplateView, View as View -from .dates import ( - ArchiveIndexView as ArchiveIndexView, - DateDetailView as DateDetailView, - DayArchiveView as DayArchiveView, - MonthArchiveView as MonthArchiveView, - TodayArchiveView as TodayArchiveView, - WeekArchiveView as WeekArchiveView, - YearArchiveView as YearArchiveView, -) +from .base import RedirectView as RedirectView +from .base import TemplateView as TemplateView +from .base import View as View +from .dates import ArchiveIndexView as ArchiveIndexView +from .dates import DateDetailView as DateDetailView +from .dates import DayArchiveView as DayArchiveView +from .dates import MonthArchiveView as MonthArchiveView +from .dates import TodayArchiveView as TodayArchiveView +from .dates import WeekArchiveView as WeekArchiveView +from .dates import YearArchiveView as YearArchiveView from .detail import DetailView as DetailView -from .edit import CreateView as CreateView, DeleteView as DeleteView, FormView as FormView, UpdateView as UpdateView +from .edit import CreateView as CreateView +from .edit import DeleteView as DeleteView +from .edit import FormView as FormView +from .edit import UpdateView as UpdateView from .list import ListView as ListView class GenericViewError(Exception): ... diff --git a/django-stubs/views/generic/base.pyi b/django-stubs/views/generic/base.pyi index d9eb72e65..66b0706c9 100644 --- a/django-stubs/views/generic/base.pyi +++ b/django-stubs/views/generic/base.pyi @@ -14,9 +14,15 @@ class View: @classmethod def as_view(cls: Any, **initkwargs: Any) -> Callable[..., http.HttpResponse]: ... def setup(self, request: http.HttpRequest, *args: Any, **kwargs: Any) -> None: ... - def dispatch(self, request: http.HttpRequest, *args: Any, **kwargs: Any) -> http.HttpResponse: ... - def http_method_not_allowed(self, request: http.HttpRequest, *args: Any, **kwargs: Any) -> http.HttpResponse: ... - def options(self, request: http.HttpRequest, *args: Any, **kwargs: Any) -> http.HttpResponse: ... + def dispatch( + self, request: http.HttpRequest, *args: Any, **kwargs: Any + ) -> http.HttpResponse: ... + def http_method_not_allowed( + self, request: http.HttpRequest, *args: Any, **kwargs: Any + ) -> http.HttpResponse: ... + def options( + self, request: http.HttpRequest, *args: Any, **kwargs: Any + ) -> http.HttpResponse: ... class TemplateResponseMixin: template_name: str = ... @@ -24,11 +30,15 @@ class TemplateResponseMixin: response_class: Type[http.HttpResponse] = ... content_type: Optional[str] = ... request: http.HttpRequest = ... - def render_to_response(self, context: Dict[str, Any], **response_kwargs: Any) -> http.HttpResponse: ... + def render_to_response( + self, context: Dict[str, Any], **response_kwargs: Any + ) -> http.HttpResponse: ... def get_template_names(self) -> List[str]: ... class TemplateView(TemplateResponseMixin, ContextMixin, View): - def get(self, request: http.HttpRequest, *args: Any, **kwargs: Any) -> http.HttpResponse: ... + def get( + self, request: http.HttpRequest, *args: Any, **kwargs: Any + ) -> http.HttpResponse: ... class RedirectView(View): permanent: bool = ... @@ -36,9 +46,21 @@ class RedirectView(View): pattern_name: Optional[str] = ... query_string: bool = ... def get_redirect_url(self, *args: Any, **kwargs: Any) -> Optional[str]: ... - def get(self, request: http.HttpRequest, *args: Any, **kwargs: Any) -> http.HttpResponse: ... - def head(self, request: http.HttpRequest, *args: Any, **kwargs: Any) -> http.HttpResponse: ... - def post(self, request: http.HttpRequest, *args: Any, **kwargs: Any) -> http.HttpResponse: ... - def delete(self, request: http.HttpRequest, *args: Any, **kwargs: Any) -> http.HttpResponse: ... - def put(self, request: http.HttpRequest, *args: Any, **kwargs: Any) -> http.HttpResponse: ... - def patch(self, request: http.HttpRequest, *args: Any, **kwargs: Any) -> http.HttpResponse: ... + def get( + self, request: http.HttpRequest, *args: Any, **kwargs: Any + ) -> http.HttpResponse: ... + def head( + self, request: http.HttpRequest, *args: Any, **kwargs: Any + ) -> http.HttpResponse: ... + def post( + self, request: http.HttpRequest, *args: Any, **kwargs: Any + ) -> http.HttpResponse: ... + def delete( + self, request: http.HttpRequest, *args: Any, **kwargs: Any + ) -> http.HttpResponse: ... + def put( + self, request: http.HttpRequest, *args: Any, **kwargs: Any + ) -> http.HttpResponse: ... + def patch( + self, request: http.HttpRequest, *args: Any, **kwargs: Any + ) -> http.HttpResponse: ... diff --git a/django-stubs/views/generic/dates.pyi b/django-stubs/views/generic/dates.pyi index 195498170..fcdf309ca 100644 --- a/django-stubs/views/generic/dates.pyi +++ b/django-stubs/views/generic/dates.pyi @@ -1,12 +1,17 @@ import datetime from typing import Any, Dict, Optional, Sequence, Tuple -from django.views.generic.base import View -from django.views.generic.detail import BaseDetailView, SingleObjectTemplateResponseMixin -from django.views.generic.list import MultipleObjectMixin, MultipleObjectTemplateResponseMixin - from django.db import models from django.http import HttpRequest, HttpResponse +from django.views.generic.base import View +from django.views.generic.detail import ( + BaseDetailView, + SingleObjectTemplateResponseMixin, +) +from django.views.generic.list import ( + MultipleObjectMixin, + MultipleObjectTemplateResponseMixin, +) class YearMixin: year_format: str = ... @@ -51,13 +56,18 @@ DatedItems = Tuple[Optional[Sequence[datetime.date]], Sequence[object], Dict[str class BaseDateListView(MultipleObjectMixin, DateMixin, View): date_list_period: str = ... - def render_to_response(self, context: Dict[str, Any], **response_kwargs: Any) -> HttpResponse: ... + def render_to_response( + self, context: Dict[str, Any], **response_kwargs: Any + ) -> HttpResponse: ... def get(self, request: HttpRequest, *args: Any, **kwargs: Any) -> HttpResponse: ... def get_dated_items(self) -> DatedItems: ... def get_dated_queryset(self, **lookup: Any) -> models.query.QuerySet: ... def get_date_list_period(self) -> str: ... def get_date_list( - self, queryset: models.query.QuerySet, date_type: Optional[str] = ..., ordering: str = ... + self, + queryset: models.query.QuerySet, + date_type: Optional[str] = ..., + ordering: str = ..., ) -> models.query.QuerySet: ... class BaseArchiveIndexView(BaseDateListView): ... @@ -76,7 +86,9 @@ class BaseDayArchiveView(YearMixin, MonthMixin, DayMixin, BaseDateListView): ... class DayArchiveView(MultipleObjectTemplateResponseMixin, BaseDayArchiveView): ... class BaseTodayArchiveView(BaseDayArchiveView): ... class TodayArchiveView(MultipleObjectTemplateResponseMixin, BaseTodayArchiveView): ... -class BaseDateDetailView(YearMixin, MonthMixin, DayMixin, DateMixin, BaseDetailView): ... +class BaseDateDetailView( + YearMixin, MonthMixin, DayMixin, DateMixin, BaseDetailView +): ... class DateDetailView(SingleObjectTemplateResponseMixin, BaseDateDetailView): ... def timezone_today() -> datetime.date: ... diff --git a/django-stubs/views/generic/detail.pyi b/django-stubs/views/generic/detail.pyi index 70229eace..c04542255 100644 --- a/django-stubs/views/generic/detail.pyi +++ b/django-stubs/views/generic/detail.pyi @@ -1,9 +1,8 @@ from typing import Any, Optional, Type -from django.views.generic.base import ContextMixin, TemplateResponseMixin, View - from django.db import models from django.http import HttpRequest, HttpResponse +from django.views.generic.base import ContextMixin, TemplateResponseMixin, View class SingleObjectMixin(ContextMixin): model: Type[models.Model] = ... @@ -13,7 +12,9 @@ class SingleObjectMixin(ContextMixin): slug_url_kwarg: str = ... pk_url_kwarg: str = ... query_pk_and_slug: bool = ... - def get_object(self, queryset: Optional[models.query.QuerySet] = ...) -> models.Model: ... + def get_object( + self, queryset: Optional[models.query.QuerySet] = ... + ) -> models.Model: ... def get_queryset(self) -> models.query.QuerySet: ... def get_slug_field(self) -> str: ... def get_context_object_name(self, obj: Any) -> Optional[str]: ... diff --git a/django-stubs/views/generic/edit.pyi b/django-stubs/views/generic/edit.pyi index 79e414928..2924d2beb 100644 --- a/django-stubs/views/generic/edit.pyi +++ b/django-stubs/views/generic/edit.pyi @@ -1,13 +1,26 @@ -from typing import Any, Callable, Dict, Generic, Optional, Sequence, Type, TypeVar, Union +from typing import ( + Any, + Callable, + Dict, + Generic, + Optional, + Sequence, + Type, + TypeVar, + Union, +) from django.forms.forms import BaseForm from django.forms.models import BaseModelForm +from django.http import HttpRequest, HttpResponse from django.views.generic.base import ContextMixin, TemplateResponseMixin, View -from django.views.generic.detail import BaseDetailView, SingleObjectMixin, SingleObjectTemplateResponseMixin +from django.views.generic.detail import ( + BaseDetailView, + SingleObjectMixin, + SingleObjectTemplateResponseMixin, +) from typing_extensions import Literal -from django.http import HttpRequest, HttpResponse - _FormT = TypeVar("_FormT", bound=BaseForm) class AbstractFormMixin(ContextMixin): @@ -29,7 +42,9 @@ class FormMixin(Generic[_FormT], AbstractFormMixin): class ModelFormMixin(AbstractFormMixin, SingleObjectMixin): fields: Optional[Union[Sequence[str], Literal["__all__"]]] = ... def get_form_class(self) -> Type[BaseModelForm]: ... - def get_form(self, form_class: Optional[Type[BaseModelForm]] = ...) -> BaseModelForm: ... + def get_form( + self, form_class: Optional[Type[BaseModelForm]] = ... + ) -> BaseModelForm: ... def form_valid(self, form: BaseModelForm) -> HttpResponse: ... def form_invalid(self, form: BaseModelForm) -> HttpResponse: ... @@ -48,7 +63,9 @@ class UpdateView(SingleObjectTemplateResponseMixin, BaseUpdateView): ... class DeletionMixin: success_url: Optional[str] = ... def post(self, request: HttpRequest, *args: str, **kwargs: Any) -> HttpResponse: ... - def delete(self, request: HttpRequest, *args: str, **kwargs: Any) -> HttpResponse: ... + def delete( + self, request: HttpRequest, *args: str, **kwargs: Any + ) -> HttpResponse: ... def get_success_url(self) -> str: ... class BaseDeleteView(DeletionMixin, BaseDetailView): ... diff --git a/django-stubs/views/generic/list.pyi b/django-stubs/views/generic/list.pyi index c93379787..d6cfbf558 100644 --- a/django-stubs/views/generic/list.pyi +++ b/django-stubs/views/generic/list.pyi @@ -1,11 +1,10 @@ from typing import Any, Optional, Sequence, Tuple, Type from django.core.paginator import Paginator -from django.db.models.query import QuerySet, _BaseQuerySet -from django.views.generic.base import ContextMixin, TemplateResponseMixin, View - from django.db.models import Model +from django.db.models.query import QuerySet, _BaseQuerySet from django.http import HttpRequest, HttpResponse +from django.views.generic.base import ContextMixin, TemplateResponseMixin, View class MultipleObjectMixin(ContextMixin): allow_empty: bool = ... @@ -19,10 +18,17 @@ class MultipleObjectMixin(ContextMixin): ordering: Sequence[str] = ... def get_queryset(self) -> QuerySet: ... def get_ordering(self) -> Sequence[str]: ... - def paginate_queryset(self, queryset: _BaseQuerySet, page_size: int) -> Tuple[Paginator, int, QuerySet, bool]: ... + def paginate_queryset( + self, queryset: _BaseQuerySet, page_size: int + ) -> Tuple[Paginator, int, QuerySet, bool]: ... def get_paginate_by(self, queryset: _BaseQuerySet) -> Optional[int]: ... def get_paginator( - self, queryset: QuerySet, per_page: int, orphans: int = ..., allow_empty_first_page: bool = ..., **kwargs: Any + self, + queryset: QuerySet, + per_page: int, + orphans: int = ..., + allow_empty_first_page: bool = ..., + **kwargs: Any ) -> Paginator: ... def get_paginate_orphans(self) -> int: ... def get_allow_empty(self) -> bool: ... diff --git a/django-stubs/views/i18n.pyi b/django-stubs/views/i18n.pyi index eec1bd95a..c2706f64c 100644 --- a/django-stubs/views/i18n.pyi +++ b/django-stubs/views/i18n.pyi @@ -3,7 +3,6 @@ from typing import Any, Callable, Dict, List, Optional, Union from django.http.request import HttpRequest from django.http.response import HttpResponse from django.utils.translation.trans_real import DjangoTranslation - from django.views.generic import View LANGUAGE_QUERY_PARAMETER: str @@ -13,8 +12,12 @@ def get_formats() -> Dict[str, Union[List[str], int, str]]: ... js_catalog_template: str -def render_javascript_catalog(catalog: Optional[Any] = ..., plural: Optional[Any] = ...): ... -def null_javascript_catalog(request: Any, domain: Optional[Any] = ..., packages: Optional[Any] = ...): ... +def render_javascript_catalog( + catalog: Optional[Any] = ..., plural: Optional[Any] = ... +): ... +def null_javascript_catalog( + request: Any, domain: Optional[Any] = ..., packages: Optional[Any] = ... +): ... class JavaScriptCatalog(View): head: Callable @@ -26,6 +29,8 @@ class JavaScriptCatalog(View): def get_plural(self) -> None: ... def get_catalog(self) -> Dict[str, Union[List[str], str]]: ... def get_context_data(self, **kwargs: Any) -> Dict[str, Any]: ... - def render_to_response(self, context: Dict[str, Any], **response_kwargs: Any) -> HttpResponse: ... + def render_to_response( + self, context: Dict[str, Any], **response_kwargs: Any + ) -> HttpResponse: ... class JSONCatalog(JavaScriptCatalog): ... diff --git a/django-stubs/views/static.pyi b/django-stubs/views/static.pyi index 9c9e04a74..4d914b006 100644 --- a/django-stubs/views/static.pyi +++ b/django-stubs/views/static.pyi @@ -3,10 +3,14 @@ from typing import Any, Optional from django.http.request import HttpRequest from django.http.response import FileResponse -def serve(request: HttpRequest, path: str, document_root: str = ..., show_indexes: bool = ...) -> FileResponse: ... +def serve( + request: HttpRequest, path: str, document_root: str = ..., show_indexes: bool = ... +) -> FileResponse: ... DEFAULT_DIRECTORY_INDEX_TEMPLATE: str template_translatable: Any def directory_index(path: Any, fullpath: Any): ... -def was_modified_since(header: Optional[str] = ..., mtime: float = ..., size: int = ...) -> bool: ... +def was_modified_since( + header: Optional[str] = ..., mtime: float = ..., size: int = ... +) -> bool: ... From 3c2ea438b9123270fc436c2a180ab5f80fe1b815 Mon Sep 17 00:00:00 2001 From: Steve Dignam Date: Wed, 25 Nov 2020 21:06:49 -0500 Subject: [PATCH 10/88] remove release script --- release.sh | 17 ----------------- 1 file changed, 17 deletions(-) delete mode 100755 release.sh diff --git a/release.sh b/release.sh deleted file mode 100755 index c0b2a075c..000000000 --- a/release.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/usr/bin/env bash -set -ex - -if [[ -z $(git status -s) ]] -then - if [[ "$VIRTUAL_ENV" != "" ]] - then - pip install --upgrade setuptools wheel twine - python setup.py sdist bdist_wheel - twine upload dist/* - rm -rf dist/ build/ - else - echo "this script must be executed inside an active virtual env, aborting" - fi -else - echo "git working tree is not clean, aborting" -fi \ No newline at end of file From 54eba34ea7aef8bf1d4a300c69f4c983525176f9 Mon Sep 17 00:00:00 2001 From: Steve Dignam Date: Wed, 25 Nov 2020 21:09:19 -0500 Subject: [PATCH 11/88] update(docs): readme with pypi badge --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 4d49d530d..354b5fd00 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# django-types +# django-types [![PyPI](https://img.shields.io/pypi/v/django-types.svg)](https://pypi.org/project/django-types/) Type stubs for [Django](https://www.djangoproject.com). From 7aa1b773c24ed4502b0adc5fcfc8b5f55ce174ca Mon Sep 17 00:00:00 2001 From: Steve Dignam Date: Thu, 26 Nov 2020 12:22:25 -0500 Subject: [PATCH 12/88] update(docs): readme with proper monkey patch --- README.md | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 354b5fd00..c9bd9d8c9 100644 --- a/README.md +++ b/README.md @@ -22,15 +22,12 @@ If you're on a Django version < 3.1, you'll need to monkey patch Django's argument. You can either use [`django-stubs-ext`](https://pypi.org/project/django-stubs-ext/`) or do this yourself manually: ```python -import types +# in settings.py from django.db.models.manager import BaseManager from django.db.models.query import QuerySet -def no_op(self, x): - return self - -QuerySet.__class_getitem__ = types.MethodType(no_op, QuerySet) -BaseManager.__class_getitem__ = types.MethodType(no_op, BaseManager) +for cls in (QuerySet, BaseManager): + cls.__class_getitem__ = classmethod(lambda cls, *args, **kwargs: cls) # type: ignore [attr-defined] ``` ## usage From a2521601f78885b2e4d53cca21e55e77875b702e Mon Sep 17 00:00:00 2001 From: Steve Dignam Date: Sun, 6 Dec 2020 16:24:11 -0500 Subject: [PATCH 13/88] add: pg field types, basic tests, nullability Bunch of misc changes: - Support for PG fields - Basic Django project to type check model fields - Nullability for most fields via the `null` argument. --- django-stubs/contrib/auth/base_user.pyi | 2 +- .../contrib/postgres/fields/array.pyi | 60 +- .../contrib/postgres/fields/citext.pyi | 187 +++- .../contrib/postgres/fields/hstore.pyi | 76 +- .../contrib/sessions/backends/base.pyi | 2 +- django-stubs/db/models/fields/__init__.pyi | 975 ++++++++++++++++-- django-stubs/db/models/fields/related.pyi | 60 +- mypy.ini | 3 +- poetry.lock | 43 +- pyproject.toml | 1 + test/__init__.py | 0 test/bear/__init__.py | 0 test/bear/bear/__init__.py | 0 test/bear/bear/asgi.py | 16 + test/bear/bear/settings.py | 121 +++ test/bear/bear/urls.py | 21 + test/bear/bear/wsgi.py | 16 + test/bear/manage.py | 22 + test/trout/__init__.py | 0 test/trout/apps.py | 5 + test/trout/migrations/__init__.py | 0 test/trout/models.py | 496 +++++++++ test/trout/views.py | 3 + 23 files changed, 2008 insertions(+), 101 deletions(-) create mode 100644 test/__init__.py create mode 100644 test/bear/__init__.py create mode 100644 test/bear/bear/__init__.py create mode 100644 test/bear/bear/asgi.py create mode 100644 test/bear/bear/settings.py create mode 100644 test/bear/bear/urls.py create mode 100644 test/bear/bear/wsgi.py create mode 100755 test/bear/manage.py create mode 100644 test/trout/__init__.py create mode 100644 test/trout/apps.py create mode 100644 test/trout/migrations/__init__.py create mode 100644 test/trout/models.py create mode 100644 test/trout/views.py diff --git a/django-stubs/contrib/auth/base_user.pyi b/django-stubs/contrib/auth/base_user.pyi index ac2877404..92c59a0dd 100644 --- a/django-stubs/contrib/auth/base_user.pyi +++ b/django-stubs/contrib/auth/base_user.pyi @@ -33,7 +33,7 @@ class AbstractBaseUser(models.Model): def is_anonymous(self) -> Literal[False]: ... @property def is_authenticated(self) -> Literal[True]: ... - def set_password(self, raw_password: str) -> None: ... + def set_password(self, raw_password: Optional[str]) -> None: ... def check_password(self, raw_password: str) -> bool: ... def set_unusable_password(self) -> None: ... def has_usable_password(self) -> bool: ... diff --git a/django-stubs/contrib/postgres/fields/array.pyi b/django-stubs/contrib/postgres/fields/array.pyi index b6ae702a2..7099e8c4f 100644 --- a/django-stubs/contrib/postgres/fields/array.pyi +++ b/django-stubs/contrib/postgres/fields/array.pyi @@ -1,4 +1,14 @@ -from typing import Any, Iterable, List, Optional, Sequence, TypeVar, Union +from typing import ( + Any, + Generic, + Iterable, + List, + Optional, + Sequence, + TypeVar, + Union, + overload, +) from django.db.models.expressions import Combinable from django.db.models.fields import ( @@ -7,17 +17,17 @@ from django.db.models.fields import ( _FieldChoices, _ValidatorCallable, ) +from typing_extensions import Literal from .mixins import CheckFieldDefaultMixin -# __set__ value type -_ST = TypeVar("_ST") -# __get__ return type -_GT = TypeVar("_GT") +_T = TypeVar("_T") -class ArrayField(CheckFieldDefaultMixin, Field[_ST, _GT]): - _pyi_private_set_type: Union[Sequence[Any], Combinable] - _pyi_private_get_type: List[Any] +class ArrayField( + Generic[_T], + CheckFieldDefaultMixin, + Field[Union[Sequence[Any], Combinable], List[Any]], +): empty_strings_allowed: bool = ... default_error_messages: Any = ... @@ -25,8 +35,36 @@ class ArrayField(CheckFieldDefaultMixin, Field[_ST, _GT]): size: Any = ... default_validators: Any = ... from_db_value: Any = ... + @overload + def __init__( + self: ArrayField[List[Any]], + base_field: Field, + size: Optional[int] = ..., + verbose_name: Optional[Union[str, bytes]] = ..., + name: Optional[str] = ..., + primary_key: bool = ..., + max_length: Optional[int] = ..., + unique: bool = ..., + blank: bool = ..., + null: Literal[False] = ..., + db_index: bool = ..., + default: Any = ..., + editable: bool = ..., + auto_created: bool = ..., + serialize: bool = ..., + unique_for_date: Optional[str] = ..., + unique_for_month: Optional[str] = ..., + unique_for_year: Optional[str] = ..., + choices: Optional[_FieldChoices] = ..., + help_text: str = ..., + db_column: Optional[str] = ..., + db_tablespace: Optional[str] = ..., + validators: Iterable[_ValidatorCallable] = ..., + error_messages: Optional[_ErrorMessagesToOverride] = ..., + ) -> None: ... + @overload def __init__( - self, + self: ArrayField[Optional[List[Any]]], base_field: Field, size: Optional[int] = ..., verbose_name: Optional[Union[str, bytes]] = ..., @@ -35,7 +73,7 @@ class ArrayField(CheckFieldDefaultMixin, Field[_ST, _GT]): max_length: Optional[int] = ..., unique: bool = ..., blank: bool = ..., - null: bool = ..., + null: Literal[True] = ..., db_index: bool = ..., default: Any = ..., editable: bool = ..., @@ -51,6 +89,8 @@ class ArrayField(CheckFieldDefaultMixin, Field[_ST, _GT]): validators: Iterable[_ValidatorCallable] = ..., error_messages: Optional[_ErrorMessagesToOverride] = ..., ) -> None: ... + def __get__(self: ArrayField[_T], instance: Any, owner: Any) -> _T: ... + def __set__(self: ArrayField[_T], instance: Any, value: _T) -> None: ... @property def description(self): ... def get_transform(self, name: Any): ... diff --git a/django-stubs/contrib/postgres/fields/citext.pyi b/django-stubs/contrib/postgres/fields/citext.pyi index e0fbfcb5b..7296d3c8b 100644 --- a/django-stubs/contrib/postgres/fields/citext.pyi +++ b/django-stubs/contrib/postgres/fields/citext.pyi @@ -1,6 +1,187 @@ +from typing import ( + Any, + Callable, + Dict, + Iterable, + Optional, + Tuple, + TypeVar, + Union, + overload, +) + from django.db.models.fields import CharField, EmailField, TextField +from typing_extensions import Literal + +_Choice = Tuple[Any, Any] +_ChoiceNamedGroup = Tuple[str, Iterable[_Choice]] +_FieldChoices = Iterable[Union[_Choice, _ChoiceNamedGroup]] + +_ValidatorCallable = Callable[..., None] +_ErrorMessagesToOverride = Dict[str, Any] + +_C = TypeVar("_C") class CIText: ... -class CICharField(CIText, CharField): ... -class CIEmailField(CIText, EmailField): ... -class CITextField(CIText, TextField): ... + +class CICharField(CIText, CharField[_C]): + @overload + def __init__( + self: CICharField[str], + verbose_name: Optional[Union[str, bytes]] = ..., + name: Optional[str] = ..., + primary_key: bool = ..., + max_length: Optional[int] = ..., + unique: bool = ..., + blank: bool = ..., + null: Literal[False] = ..., + db_index: bool = ..., + default: Any = ..., + editable: bool = ..., + auto_created: bool = ..., + serialize: bool = ..., + unique_for_date: Optional[str] = ..., + unique_for_month: Optional[str] = ..., + unique_for_year: Optional[str] = ..., + choices: Optional[_FieldChoices] = ..., + help_text: str = ..., + db_column: Optional[str] = ..., + db_tablespace: Optional[str] = ..., + validators: Iterable[_ValidatorCallable] = ..., + error_messages: Optional[_ErrorMessagesToOverride] = ..., + ) -> None: ... + @overload + def __init__( + self: CICharField[Optional[str]], + verbose_name: Optional[Union[str, bytes]] = ..., + name: Optional[str] = ..., + primary_key: bool = ..., + max_length: Optional[int] = ..., + unique: bool = ..., + blank: bool = ..., + null: Literal[True] = ..., + db_index: bool = ..., + default: Any = ..., + editable: bool = ..., + auto_created: bool = ..., + serialize: bool = ..., + unique_for_date: Optional[str] = ..., + unique_for_month: Optional[str] = ..., + unique_for_year: Optional[str] = ..., + choices: Optional[_FieldChoices] = ..., + help_text: str = ..., + db_column: Optional[str] = ..., + db_tablespace: Optional[str] = ..., + validators: Iterable[_ValidatorCallable] = ..., + error_messages: Optional[_ErrorMessagesToOverride] = ..., + ) -> None: ... + def __get__(self: CICharField[_C], instance: Any, owner: Any) -> _C: ... + def __set__(self, instance: Any, value: _C) -> None: ... + +class CIEmailField(CIText, EmailField[_C]): + @overload + def __init__( + self: CIEmailField[str], + verbose_name: Optional[Union[str, bytes]] = ..., + name: Optional[str] = ..., + primary_key: bool = ..., + max_length: Optional[int] = ..., + unique: bool = ..., + blank: bool = ..., + null: Literal[False] = ..., + db_index: bool = ..., + default: Any = ..., + editable: bool = ..., + auto_created: bool = ..., + serialize: bool = ..., + unique_for_date: Optional[str] = ..., + unique_for_month: Optional[str] = ..., + unique_for_year: Optional[str] = ..., + choices: Optional[_FieldChoices] = ..., + help_text: str = ..., + db_column: Optional[str] = ..., + db_tablespace: Optional[str] = ..., + validators: Iterable[_ValidatorCallable] = ..., + error_messages: Optional[_ErrorMessagesToOverride] = ..., + ) -> None: ... + @overload + def __init__( + self: CIEmailField[Optional[str]], + verbose_name: Optional[Union[str, bytes]] = ..., + name: Optional[str] = ..., + primary_key: bool = ..., + max_length: Optional[int] = ..., + unique: bool = ..., + blank: bool = ..., + null: Literal[True] = ..., + db_index: bool = ..., + default: Any = ..., + editable: bool = ..., + auto_created: bool = ..., + serialize: bool = ..., + unique_for_date: Optional[str] = ..., + unique_for_month: Optional[str] = ..., + unique_for_year: Optional[str] = ..., + choices: Optional[_FieldChoices] = ..., + help_text: str = ..., + db_column: Optional[str] = ..., + db_tablespace: Optional[str] = ..., + validators: Iterable[_ValidatorCallable] = ..., + error_messages: Optional[_ErrorMessagesToOverride] = ..., + ) -> None: ... + def __get__(self: CIEmailField[_C], instance: Any, owner: Any) -> _C: ... + def __set__(self, instance: Any, value: _C) -> None: ... + +class CITextField(CIText, TextField[_C]): + @overload + def __init__( + self: CITextField[str], + verbose_name: Optional[Union[str, bytes]] = ..., + name: Optional[str] = ..., + primary_key: bool = ..., + max_length: Optional[int] = ..., + unique: bool = ..., + blank: bool = ..., + null: Literal[False] = ..., + db_index: bool = ..., + default: Any = ..., + editable: bool = ..., + auto_created: bool = ..., + serialize: bool = ..., + unique_for_date: Optional[str] = ..., + unique_for_month: Optional[str] = ..., + unique_for_year: Optional[str] = ..., + choices: Optional[_FieldChoices] = ..., + help_text: str = ..., + db_column: Optional[str] = ..., + db_tablespace: Optional[str] = ..., + validators: Iterable[_ValidatorCallable] = ..., + error_messages: Optional[_ErrorMessagesToOverride] = ..., + ) -> None: ... + @overload + def __init__( + self: CITextField[Optional[str]], + verbose_name: Optional[Union[str, bytes]] = ..., + name: Optional[str] = ..., + primary_key: bool = ..., + max_length: Optional[int] = ..., + unique: bool = ..., + blank: bool = ..., + null: Literal[True] = ..., + db_index: bool = ..., + default: Any = ..., + editable: bool = ..., + auto_created: bool = ..., + serialize: bool = ..., + unique_for_date: Optional[str] = ..., + unique_for_month: Optional[str] = ..., + unique_for_year: Optional[str] = ..., + choices: Optional[_FieldChoices] = ..., + help_text: str = ..., + db_column: Optional[str] = ..., + db_tablespace: Optional[str] = ..., + validators: Iterable[_ValidatorCallable] = ..., + error_messages: Optional[_ErrorMessagesToOverride] = ..., + ) -> None: ... + def __get__(self: CITextField[_C], instance: Any, owner: Any) -> _C: ... + def __set__(self, instance: Any, value: _C) -> None: ... diff --git a/django-stubs/contrib/postgres/fields/hstore.pyi b/django-stubs/contrib/postgres/fields/hstore.pyi index 96208db8b..6fa88eb22 100644 --- a/django-stubs/contrib/postgres/fields/hstore.pyi +++ b/django-stubs/contrib/postgres/fields/hstore.pyi @@ -1,11 +1,83 @@ -from typing import Any +from typing import ( + Any, + Callable, + Dict, + Generic, + Iterable, + Optional, + Tuple, + TypeVar, + Union, + overload, +) from django.db.models import Field, Transform +from typing_extensions import Literal from .mixins import CheckFieldDefaultMixin -class HStoreField(CheckFieldDefaultMixin, Field): +_Choice = Tuple[Any, Any] +_ChoiceNamedGroup = Tuple[str, Iterable[_Choice]] +_FieldChoices = Iterable[Union[_Choice, _ChoiceNamedGroup]] +_ValidatorCallable = Callable[..., None] +_ErrorMessagesToOverride = Dict[str, Any] + +_T = TypeVar("_T") + +class HStoreField(Generic[_T], CheckFieldDefaultMixin, Field[Any, Any]): + @overload + def __init__( + self: HStoreField[Dict[str, Optional[str]]], + verbose_name: Optional[Union[str, bytes]] = ..., + name: Optional[str] = ..., + primary_key: bool = ..., + max_length: Optional[int] = ..., + unique: bool = ..., + blank: bool = ..., + null: Literal[False] = ..., + 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] = ..., + ): ... + @overload + def __init__( + self: HStoreField[Optional[Dict[str, Optional[str]]]], + verbose_name: Optional[Union[str, bytes]] = ..., + name: Optional[str] = ..., + primary_key: bool = ..., + max_length: Optional[int] = ..., + unique: bool = ..., + blank: bool = ..., + null: Literal[True] = ..., + 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 get_transform(self, name) -> Any: ... + def __get__(self: HStoreField[_T], instance: Any, owner: Any) -> _T: ... + def __set__(self: HStoreField[_T], instance: Any, value: _T) -> None: ... class KeyTransform(Transform): def __init__(self, key_name: str, *args: Any, **kwargs: Any): ... diff --git a/django-stubs/contrib/sessions/backends/base.pyi b/django-stubs/contrib/sessions/backends/base.pyi index 5fcb05e81..ff0e2ae93 100644 --- a/django-stubs/contrib/sessions/backends/base.pyi +++ b/django-stubs/contrib/sessions/backends/base.pyi @@ -12,7 +12,7 @@ class SessionBase(Dict[str, Any]): accessed: bool = ... modified: bool = ... serializer: Any = ... - def __init__(self, session_key: Optional[str] = ...) -> None: ... + def __init__(self, session_key: Optional[str] = ..., **kwargs: Any) -> None: ... def set_test_cookie(self) -> None: ... def test_cookie_worked(self) -> bool: ... def delete_test_cookie(self) -> None: ... diff --git a/django-stubs/db/models/fields/__init__.pyi b/django-stubs/db/models/fields/__init__.pyi index d34c681b8..9cdb5ff19 100644 --- a/django-stubs/db/models/fields/__init__.pyi +++ b/django-stubs/db/models/fields/__init__.pyi @@ -16,6 +16,7 @@ from typing import ( Union, overload, ) +from uuid import UUID from django.core.checks import CheckMessage from django.core.exceptions import FieldDoesNotExist as FieldDoesNotExist @@ -143,54 +144,683 @@ class Field(RegisterLookupMixin, Generic[_ST, _GT]): def value_from_object(self, obj: Model) -> _GT: ... def get_attname(self) -> str: ... -class IntegerField(Field[Union[float, int, str, Combinable], int]): ... +class IntegerField(Generic[_C], Field[Union[float, int, str, Combinable], int]): + @overload + def __init__( + self: IntegerField[int], + verbose_name: Optional[Union[str, bytes]] = ..., + name: Optional[str] = ..., + primary_key: bool = ..., + max_length: Optional[int] = ..., + unique: bool = ..., + blank: bool = ..., + null: Literal[False] = ..., + db_index: bool = ..., + default: Any = ..., + editable: bool = ..., + auto_created: bool = ..., + serialize: bool = ..., + unique_for_date: Optional[str] = ..., + unique_for_month: Optional[str] = ..., + unique_for_year: Optional[str] = ..., + choices: Optional[_FieldChoices] = ..., + help_text: str = ..., + db_column: Optional[str] = ..., + db_tablespace: Optional[str] = ..., + validators: Iterable[_ValidatorCallable] = ..., + error_messages: Optional[_ErrorMessagesToOverride] = ..., + ) -> None: ... + @overload + def __init__( + self: IntegerField[Optional[int]], + verbose_name: Optional[Union[str, bytes]] = ..., + name: Optional[str] = ..., + primary_key: bool = ..., + max_length: Optional[int] = ..., + unique: bool = ..., + blank: bool = ..., + null: Literal[True] = ..., + db_index: bool = ..., + default: Any = ..., + editable: bool = ..., + auto_created: bool = ..., + serialize: bool = ..., + unique_for_date: Optional[str] = ..., + unique_for_month: Optional[str] = ..., + unique_for_year: Optional[str] = ..., + choices: Optional[_FieldChoices] = ..., + help_text: str = ..., + db_column: Optional[str] = ..., + db_tablespace: Optional[str] = ..., + validators: Iterable[_ValidatorCallable] = ..., + error_messages: Optional[_ErrorMessagesToOverride] = ..., + ) -> None: ... + def __get__(self, instance: Any, owner: Any) -> _C: ... + def __set__( + self, instance: Any, value: Union[str, float, int, Combinable, _C] + ) -> None: ... class PositiveIntegerRelDbTypeMixin: def rel_db_type(self, connection: Any): ... -class PositiveIntegerField(PositiveIntegerRelDbTypeMixin, IntegerField): ... -class PositiveSmallIntegerField(PositiveIntegerRelDbTypeMixin, IntegerField): ... -class SmallIntegerField(IntegerField): ... -class BigIntegerField(IntegerField): ... -class FloatField(Field[Union[float, int, str, Combinable], float]): ... +class PositiveIntegerField(PositiveIntegerRelDbTypeMixin, IntegerField[_C]): + @overload + def __init__( + self: PositiveIntegerField[int], + verbose_name: Optional[Union[str, bytes]] = ..., + name: Optional[str] = ..., + primary_key: bool = ..., + max_length: Optional[int] = ..., + unique: bool = ..., + blank: bool = ..., + null: Literal[False] = ..., + db_index: bool = ..., + default: Any = ..., + editable: bool = ..., + auto_created: bool = ..., + serialize: bool = ..., + unique_for_date: Optional[str] = ..., + unique_for_month: Optional[str] = ..., + unique_for_year: Optional[str] = ..., + choices: Optional[_FieldChoices] = ..., + help_text: str = ..., + db_column: Optional[str] = ..., + db_tablespace: Optional[str] = ..., + validators: Iterable[_ValidatorCallable] = ..., + error_messages: Optional[_ErrorMessagesToOverride] = ..., + ) -> None: ... + @overload + def __init__( + self: PositiveIntegerField[Optional[int]], + verbose_name: Optional[Union[str, bytes]] = ..., + name: Optional[str] = ..., + primary_key: bool = ..., + max_length: Optional[int] = ..., + unique: bool = ..., + blank: bool = ..., + null: Literal[True] = ..., + db_index: bool = ..., + default: Any = ..., + editable: bool = ..., + auto_created: bool = ..., + serialize: bool = ..., + unique_for_date: Optional[str] = ..., + unique_for_month: Optional[str] = ..., + unique_for_year: Optional[str] = ..., + choices: Optional[_FieldChoices] = ..., + help_text: str = ..., + db_column: Optional[str] = ..., + db_tablespace: Optional[str] = ..., + validators: Iterable[_ValidatorCallable] = ..., + error_messages: Optional[_ErrorMessagesToOverride] = ..., + ) -> None: ... + def __get__(self, instance: Any, owner: Any) -> _C: ... + def __set__( + self, instance: Any, value: Union[str, float, int, Combinable, _C] + ) -> None: ... -class DecimalField( - Field[Union[str, float, decimal.Decimal, Combinable], decimal.Decimal] -): - # attributes - max_digits: int = ... - decimal_places: int = ... +class PositiveSmallIntegerField(PositiveIntegerRelDbTypeMixin, IntegerField[_C]): + @overload def __init__( - self, + self: PositiveSmallIntegerField[int], verbose_name: Optional[Union[str, bytes]] = ..., name: Optional[str] = ..., - max_digits: Optional[int] = ..., - decimal_places: Optional[int] = ..., primary_key: bool = ..., + max_length: Optional[int] = ..., unique: bool = ..., blank: bool = ..., - null: bool = ..., + null: Literal[False] = ..., db_index: bool = ..., default: Any = ..., editable: bool = ..., auto_created: bool = ..., serialize: bool = ..., + unique_for_date: Optional[str] = ..., + unique_for_month: Optional[str] = ..., + unique_for_year: Optional[str] = ..., choices: Optional[_FieldChoices] = ..., help_text: str = ..., db_column: Optional[str] = ..., db_tablespace: Optional[str] = ..., validators: Iterable[_ValidatorCallable] = ..., error_messages: Optional[_ErrorMessagesToOverride] = ..., - ): ... + ) -> None: ... + @overload + def __init__( + self: PositiveSmallIntegerField[Optional[int]], + verbose_name: Optional[Union[str, bytes]] = ..., + name: Optional[str] = ..., + primary_key: bool = ..., + max_length: Optional[int] = ..., + unique: bool = ..., + blank: bool = ..., + null: Literal[True] = ..., + db_index: bool = ..., + default: Any = ..., + editable: bool = ..., + auto_created: bool = ..., + serialize: bool = ..., + unique_for_date: Optional[str] = ..., + unique_for_month: Optional[str] = ..., + unique_for_year: Optional[str] = ..., + choices: Optional[_FieldChoices] = ..., + help_text: str = ..., + db_column: Optional[str] = ..., + db_tablespace: Optional[str] = ..., + validators: Iterable[_ValidatorCallable] = ..., + error_messages: Optional[_ErrorMessagesToOverride] = ..., + ) -> None: ... + def __get__(self, instance: Any, owner: Any) -> _C: ... + def __set__( + self, instance: Any, value: Union[str, float, int, Combinable, _C] + ) -> None: ... -class AutoField(Field[Union[Combinable, int, str], int]): ... +class SmallIntegerField(IntegerField[_C]): + @overload + def __init__( + self: SmallIntegerField[int], + verbose_name: Optional[Union[str, bytes]] = ..., + name: Optional[str] = ..., + primary_key: bool = ..., + max_length: Optional[int] = ..., + unique: bool = ..., + blank: bool = ..., + null: Literal[False] = ..., + db_index: bool = ..., + default: Any = ..., + editable: bool = ..., + auto_created: bool = ..., + serialize: bool = ..., + unique_for_date: Optional[str] = ..., + unique_for_month: Optional[str] = ..., + unique_for_year: Optional[str] = ..., + choices: Optional[_FieldChoices] = ..., + help_text: str = ..., + db_column: Optional[str] = ..., + db_tablespace: Optional[str] = ..., + validators: Iterable[_ValidatorCallable] = ..., + error_messages: Optional[_ErrorMessagesToOverride] = ..., + ) -> None: ... + @overload + def __init__( + self: SmallIntegerField[Optional[int]], + verbose_name: Optional[Union[str, bytes]] = ..., + name: Optional[str] = ..., + primary_key: bool = ..., + max_length: Optional[int] = ..., + unique: bool = ..., + blank: bool = ..., + null: Literal[True] = ..., + db_index: bool = ..., + default: Any = ..., + editable: bool = ..., + auto_created: bool = ..., + serialize: bool = ..., + unique_for_date: Optional[str] = ..., + unique_for_month: Optional[str] = ..., + unique_for_year: Optional[str] = ..., + choices: Optional[_FieldChoices] = ..., + help_text: str = ..., + db_column: Optional[str] = ..., + db_tablespace: Optional[str] = ..., + validators: Iterable[_ValidatorCallable] = ..., + error_messages: Optional[_ErrorMessagesToOverride] = ..., + ) -> None: ... + def __get__(self, instance: Any, owner: Any) -> _C: ... + def __set__( + self, instance: Any, value: Union[str, float, int, Combinable, _C] + ) -> None: ... -_C = TypeVar("_C", bound=Optional[str]) +class BigIntegerField(IntegerField[_C]): + @overload + def __init__( + self: BigIntegerField[int], + verbose_name: Optional[Union[str, bytes]] = ..., + name: Optional[str] = ..., + primary_key: bool = ..., + max_length: Optional[int] = ..., + unique: bool = ..., + blank: bool = ..., + null: Literal[False] = ..., + db_index: bool = ..., + default: Any = ..., + editable: bool = ..., + auto_created: bool = ..., + serialize: bool = ..., + unique_for_date: Optional[str] = ..., + unique_for_month: Optional[str] = ..., + unique_for_year: Optional[str] = ..., + choices: Optional[_FieldChoices] = ..., + help_text: str = ..., + db_column: Optional[str] = ..., + db_tablespace: Optional[str] = ..., + validators: Iterable[_ValidatorCallable] = ..., + error_messages: Optional[_ErrorMessagesToOverride] = ..., + ) -> None: ... + @overload + def __init__( + self: BigIntegerField[Optional[int]], + verbose_name: Optional[Union[str, bytes]] = ..., + name: Optional[str] = ..., + primary_key: bool = ..., + max_length: Optional[int] = ..., + unique: bool = ..., + blank: bool = ..., + null: Literal[True] = ..., + db_index: bool = ..., + default: Any = ..., + editable: bool = ..., + auto_created: bool = ..., + serialize: bool = ..., + unique_for_date: Optional[str] = ..., + unique_for_month: Optional[str] = ..., + unique_for_year: Optional[str] = ..., + choices: Optional[_FieldChoices] = ..., + help_text: str = ..., + db_column: Optional[str] = ..., + db_tablespace: Optional[str] = ..., + validators: Iterable[_ValidatorCallable] = ..., + error_messages: Optional[_ErrorMessagesToOverride] = ..., + ) -> None: ... + def __get__(self, instance: Any, owner: Any) -> _C: ... + def __set__( + self, instance: Any, value: Union[str, float, int, Combinable, _C] + ) -> None: ... -class CharField(Generic[_C], Field[str, str]): +class FloatField(Generic[_C], Field[Union[float, int, str, Combinable], float]): @overload def __init__( - self: CharField[str], + self: FloatField[float], + verbose_name: Optional[Union[str, bytes]] = ..., + name: Optional[str] = ..., + primary_key: bool = ..., + max_length: Optional[int] = ..., + unique: bool = ..., + blank: bool = ..., + null: Literal[False] = ..., + db_index: bool = ..., + default: Any = ..., + editable: bool = ..., + auto_created: bool = ..., + serialize: bool = ..., + unique_for_date: Optional[str] = ..., + unique_for_month: Optional[str] = ..., + unique_for_year: Optional[str] = ..., + choices: Optional[_FieldChoices] = ..., + help_text: str = ..., + db_column: Optional[str] = ..., + db_tablespace: Optional[str] = ..., + validators: Iterable[_ValidatorCallable] = ..., + error_messages: Optional[_ErrorMessagesToOverride] = ..., + ) -> None: ... + @overload + def __init__( + self: FloatField[Optional[float]], + verbose_name: Optional[Union[str, bytes]] = ..., + name: Optional[str] = ..., + primary_key: bool = ..., + max_length: Optional[int] = ..., + unique: bool = ..., + blank: bool = ..., + null: Literal[True] = ..., + db_index: bool = ..., + default: Any = ..., + editable: bool = ..., + auto_created: bool = ..., + serialize: bool = ..., + unique_for_date: Optional[str] = ..., + unique_for_month: Optional[str] = ..., + unique_for_year: Optional[str] = ..., + choices: Optional[_FieldChoices] = ..., + help_text: str = ..., + db_column: Optional[str] = ..., + db_tablespace: Optional[str] = ..., + validators: Iterable[_ValidatorCallable] = ..., + error_messages: Optional[_ErrorMessagesToOverride] = ..., + ) -> None: ... + def __get__(self, instance: Any, owner: Any) -> _C: ... + def __set__( + self, instance: Any, value: Union[str, float, int, Combinable, _C] + ) -> None: ... + +class DecimalField( + Generic[_C], Field[Union[str, float, decimal.Decimal, Combinable], decimal.Decimal] +): + # attributes + max_digits: int = ... + decimal_places: int = ... + @overload + def __init__( + self: DecimalField[decimal.Decimal], + verbose_name: Optional[Union[str, bytes]] = ..., + name: Optional[str] = ..., + max_digits: Optional[int] = ..., + decimal_places: Optional[int] = ..., + primary_key: bool = ..., + unique: bool = ..., + blank: bool = ..., + null: Literal[False] = ..., + db_index: bool = ..., + default: Any = ..., + editable: bool = ..., + auto_created: bool = ..., + serialize: bool = ..., + choices: Optional[_FieldChoices] = ..., + help_text: str = ..., + db_column: Optional[str] = ..., + db_tablespace: Optional[str] = ..., + validators: Iterable[_ValidatorCallable] = ..., + error_messages: Optional[_ErrorMessagesToOverride] = ..., + ): ... + @overload + def __init__( + self: DecimalField[Optional[decimal.Decimal]], + verbose_name: Optional[Union[str, bytes]] = ..., + name: Optional[str] = ..., + max_digits: Optional[int] = ..., + decimal_places: Optional[int] = ..., + primary_key: bool = ..., + unique: bool = ..., + blank: bool = ..., + null: Literal[True] = ..., + db_index: bool = ..., + default: Any = ..., + editable: bool = ..., + auto_created: bool = ..., + serialize: bool = ..., + choices: Optional[_FieldChoices] = ..., + help_text: str = ..., + db_column: Optional[str] = ..., + db_tablespace: Optional[str] = ..., + validators: Iterable[_ValidatorCallable] = ..., + error_messages: Optional[_ErrorMessagesToOverride] = ..., + ): ... + def __get__(self, instance: Any, owner: Any) -> _C: ... + def __set__( + self, instance: Any, value: Union[str, float, Combinable, _C] + ) -> None: ... + +class AutoField(Field[Union[Combinable, int, str, None], int]): ... + +_C = TypeVar("_C") + +class CharField(Generic[_C], Field[str, str]): + @overload + def __init__( + self: CharField[str], + verbose_name: Optional[Union[str, bytes]] = ..., + name: Optional[str] = ..., + primary_key: bool = ..., + max_length: Optional[int] = ..., + unique: bool = ..., + blank: bool = ..., + null: Literal[False] = ..., + db_index: bool = ..., + default: Any = ..., + editable: bool = ..., + auto_created: bool = ..., + serialize: bool = ..., + unique_for_date: Optional[str] = ..., + unique_for_month: Optional[str] = ..., + unique_for_year: Optional[str] = ..., + choices: Optional[_FieldChoices] = ..., + help_text: str = ..., + db_column: Optional[str] = ..., + db_tablespace: Optional[str] = ..., + validators: Iterable[_ValidatorCallable] = ..., + error_messages: Optional[_ErrorMessagesToOverride] = ..., + ) -> None: ... + @overload + def __init__( + self: CharField[Optional[str]], + verbose_name: Optional[Union[str, bytes]] = ..., + name: Optional[str] = ..., + primary_key: bool = ..., + max_length: Optional[int] = ..., + unique: bool = ..., + blank: bool = ..., + null: Literal[True] = ..., + db_index: bool = ..., + default: Any = ..., + editable: bool = ..., + auto_created: bool = ..., + serialize: bool = ..., + unique_for_date: Optional[str] = ..., + unique_for_month: Optional[str] = ..., + unique_for_year: Optional[str] = ..., + choices: Optional[_FieldChoices] = ..., + help_text: str = ..., + db_column: Optional[str] = ..., + db_tablespace: Optional[str] = ..., + validators: Iterable[_ValidatorCallable] = ..., + error_messages: Optional[_ErrorMessagesToOverride] = ..., + ) -> None: ... + def __get__(self, instance: Any, owner: Any) -> _C: ... + def __set__(self, instance: Any, value: _C) -> None: ... + +class SlugField(CharField[_C]): + @overload + def __init__( + self: SlugField[str], + verbose_name: Optional[Union[str, bytes]] = ..., + name: Optional[str] = ..., + primary_key: bool = ..., + max_length: Optional[int] = ..., + allow_unicode: bool = ..., + unique: bool = ..., + blank: bool = ..., + null: Literal[False] = ..., + 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] = ..., + ): ... + @overload + def __init__( + self: SlugField[Optional[str]], + verbose_name: Optional[Union[str, bytes]] = ..., + name: Optional[str] = ..., + primary_key: bool = ..., + max_length: Optional[int] = ..., + allow_unicode: bool = ..., + unique: bool = ..., + blank: bool = ..., + null: Literal[True] = ..., + 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 __get__(self: SlugField[_C], instance: Any, owner: Any) -> _C: ... + def __set__(self, instance: Any, value: _C) -> None: ... + +class EmailField(CharField[_C]): + @overload + def __init__( + self: EmailField[str], + verbose_name: Optional[Union[str, bytes]] = ..., + name: Optional[str] = ..., + primary_key: bool = ..., + max_length: Optional[int] = ..., + unique: bool = ..., + blank: bool = ..., + null: Literal[False] = ..., + db_index: bool = ..., + default: Any = ..., + editable: bool = ..., + auto_created: bool = ..., + serialize: bool = ..., + unique_for_date: Optional[str] = ..., + unique_for_month: Optional[str] = ..., + unique_for_year: Optional[str] = ..., + choices: Optional[_FieldChoices] = ..., + help_text: str = ..., + db_column: Optional[str] = ..., + db_tablespace: Optional[str] = ..., + validators: Iterable[_ValidatorCallable] = ..., + error_messages: Optional[_ErrorMessagesToOverride] = ..., + ) -> None: ... + @overload + def __init__( + self: EmailField[Optional[str]], + verbose_name: Optional[Union[str, bytes]] = ..., + name: Optional[str] = ..., + primary_key: bool = ..., + max_length: Optional[int] = ..., + unique: bool = ..., + blank: bool = ..., + null: Literal[True] = ..., + db_index: bool = ..., + default: Any = ..., + editable: bool = ..., + auto_created: bool = ..., + serialize: bool = ..., + unique_for_date: Optional[str] = ..., + unique_for_month: Optional[str] = ..., + unique_for_year: Optional[str] = ..., + choices: Optional[_FieldChoices] = ..., + help_text: str = ..., + db_column: Optional[str] = ..., + db_tablespace: Optional[str] = ..., + validators: Iterable[_ValidatorCallable] = ..., + error_messages: Optional[_ErrorMessagesToOverride] = ..., + ) -> None: ... + def __get__(self, instance: Any, owner: Any) -> _C: ... + def __set__(self, instance: Any, value: _C) -> None: ... + +class URLField(CharField[_C]): + @overload + def __init__( + self: URLField[str], + verbose_name: Optional[Union[str, bytes]] = ..., + name: Optional[str] = ..., + primary_key: bool = ..., + max_length: Optional[int] = ..., + unique: bool = ..., + blank: bool = ..., + null: Literal[False] = ..., + db_index: bool = ..., + default: Any = ..., + editable: bool = ..., + auto_created: bool = ..., + serialize: bool = ..., + unique_for_date: Optional[str] = ..., + unique_for_month: Optional[str] = ..., + unique_for_year: Optional[str] = ..., + choices: Optional[_FieldChoices] = ..., + help_text: str = ..., + db_column: Optional[str] = ..., + db_tablespace: Optional[str] = ..., + validators: Iterable[_ValidatorCallable] = ..., + error_messages: Optional[_ErrorMessagesToOverride] = ..., + ) -> None: ... + @overload + def __init__( + self: URLField[Optional[str]], + verbose_name: Optional[Union[str, bytes]] = ..., + name: Optional[str] = ..., + primary_key: bool = ..., + max_length: Optional[int] = ..., + unique: bool = ..., + blank: bool = ..., + null: Literal[True] = ..., + db_index: bool = ..., + default: Any = ..., + editable: bool = ..., + auto_created: bool = ..., + serialize: bool = ..., + unique_for_date: Optional[str] = ..., + unique_for_month: Optional[str] = ..., + unique_for_year: Optional[str] = ..., + choices: Optional[_FieldChoices] = ..., + help_text: str = ..., + db_column: Optional[str] = ..., + db_tablespace: Optional[str] = ..., + validators: Iterable[_ValidatorCallable] = ..., + error_messages: Optional[_ErrorMessagesToOverride] = ..., + ) -> None: ... + def __get__(self, instance: Any, owner: Any) -> _C: ... + def __set__(self, instance: Any, value: _C) -> None: ... + +class TextField(Generic[_C], Field[str, str]): + @overload + def __init__( + self: TextField[str], + *, + verbose_name: Optional[Union[str, bytes]] = ..., + name: Optional[str] = ..., + primary_key: bool = ..., + max_length: Optional[int] = ..., + unique: bool = ..., + blank: bool = ..., + db_index: bool = ..., + default: Any = ..., + editable: bool = ..., + auto_created: bool = ..., + serialize: bool = ..., + unique_for_date: Optional[str] = ..., + unique_for_month: Optional[str] = ..., + unique_for_year: Optional[str] = ..., + choices: Optional[_FieldChoices] = ..., + help_text: str = ..., + db_column: Optional[str] = ..., + db_tablespace: Optional[str] = ..., + validators: Iterable[_ValidatorCallable] = ..., + error_messages: Optional[_ErrorMessagesToOverride] = ..., + ) -> None: ... + @overload + def __init__( + self: TextField[Optional[str]], + *, + verbose_name: Optional[Union[str, bytes]] = ..., + name: Optional[str] = ..., + primary_key: bool = ..., + max_length: Optional[int] = ..., + unique: bool = ..., + blank: bool = ..., + null: Literal[True] = ..., + db_index: bool = ..., + default: Any = ..., + editable: bool = ..., + auto_created: bool = ..., + serialize: bool = ..., + unique_for_date: Optional[str] = ..., + unique_for_month: Optional[str] = ..., + unique_for_year: Optional[str] = ..., + choices: Optional[_FieldChoices] = ..., + help_text: str = ..., + db_column: Optional[str] = ..., + db_tablespace: Optional[str] = ..., + validators: Iterable[_ValidatorCallable] = ..., + error_messages: Optional[_ErrorMessagesToOverride] = ..., + ) -> None: ... + def __get__(self: TextField[_C], instance: Any, owner: Any) -> _C: ... + def __set__(self, instance: Any, value: _C) -> None: ... + +class BooleanField(Generic[_C], Field[Union[bool, Combinable], bool]): + @overload + def __init__( + self: BooleanField[bool], verbose_name: Optional[Union[str, bytes]] = ..., name: Optional[str] = ..., primary_key: bool = ..., @@ -212,10 +842,10 @@ class CharField(Generic[_C], Field[str, str]): db_tablespace: Optional[str] = ..., validators: Iterable[_ValidatorCallable] = ..., error_messages: Optional[_ErrorMessagesToOverride] = ..., - ) -> None: ... + ): ... @overload def __init__( - self: CharField[Optional[str]], + self: BooleanField[Optional[bool]], verbose_name: Optional[Union[str, bytes]] = ..., name: Optional[str] = ..., primary_key: bool = ..., @@ -237,21 +867,21 @@ class CharField(Generic[_C], Field[str, str]): db_tablespace: Optional[str] = ..., validators: Iterable[_ValidatorCallable] = ..., error_messages: Optional[_ErrorMessagesToOverride] = ..., - ) -> None: ... - def __get__(self: CharField[_C], instance: Any, owner: Any) -> _C: ... + ): ... + def __get__(self, instance: Any, owner: Any) -> _C: ... def __set__(self, instance: Any, value: _C) -> None: ... -class SlugField(CharField): +class IPAddressField(Generic[_C], Field[Union[str, Combinable], str]): + @overload def __init__( - self, + self: IPAddressField[str], verbose_name: Optional[Union[str, bytes]] = ..., name: Optional[str] = ..., primary_key: bool = ..., max_length: Optional[int] = ..., - allow_unicode: bool = ..., unique: bool = ..., blank: bool = ..., - null: bool = ..., + null: Literal[False] = ..., db_index: bool = ..., default: Any = ..., editable: bool = ..., @@ -267,14 +897,9 @@ class SlugField(CharField): validators: Iterable[_ValidatorCallable] = ..., error_messages: Optional[_ErrorMessagesToOverride] = ..., ): ... - -class EmailField(CharField): ... -class URLField(CharField): ... - -class TextField(Generic[_C], Field[str, str]): @overload def __init__( - self: TextField[Optional[str]], + self: IPAddressField[Optional[str]], verbose_name: Optional[Union[str, bytes]] = ..., name: Optional[str] = ..., primary_key: bool = ..., @@ -296,14 +921,25 @@ class TextField(Generic[_C], Field[str, str]): db_tablespace: Optional[str] = ..., validators: Iterable[_ValidatorCallable] = ..., error_messages: Optional[_ErrorMessagesToOverride] = ..., - ) -> None: ... + ): ... + def __get__(self, instance: Any, owner: Any) -> _C: ... + def __set__(self, instance: Any, value: _C) -> None: ... + +class GenericIPAddressField( + Generic[_C], Field[Union[str, int, Callable[..., Any], Combinable], str] +): + + default_error_messages: Any = ... + unpack_ipv4: Any = ... + protocol: Any = ... @overload def __init__( - self: TextField[str], - verbose_name: Optional[Union[str, bytes]] = ..., - name: Optional[str] = ..., + self: GenericIPAddressField[str], + verbose_name: Optional[Any] = ..., + name: Optional[Any] = ..., + protocol: str = ..., + unpack_ipv4: bool = ..., primary_key: bool = ..., - max_length: Optional[int] = ..., unique: bool = ..., blank: bool = ..., null: Literal[False] = ..., @@ -312,9 +948,6 @@ class TextField(Generic[_C], Field[str, str]): 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] = ..., @@ -322,22 +955,9 @@ class TextField(Generic[_C], Field[str, str]): validators: Iterable[_ValidatorCallable] = ..., error_messages: Optional[_ErrorMessagesToOverride] = ..., ) -> None: ... - def __get__(self: TextField[_C], instance: Any, owner: Any) -> _C: ... - def __set__(self, instance: Any, value: _C) -> None: ... - -class BooleanField(Field[Union[bool, Combinable], bool]): ... -class NullBooleanField(Field[Optional[Union[bool, Combinable]], Optional[bool]]): ... -class IPAddressField(Field[Union[str, Combinable], str]): ... - -class GenericIPAddressField( - Field[Union[str, int, Callable[..., Any], Combinable], str] -): - - default_error_messages: Any = ... - unpack_ipv4: Any = ... - protocol: Any = ... + @overload def __init__( - self, + self: GenericIPAddressField[Optional[str]], verbose_name: Optional[Any] = ..., name: Optional[Any] = ..., protocol: str = ..., @@ -345,7 +965,7 @@ class GenericIPAddressField( primary_key: bool = ..., unique: bool = ..., blank: bool = ..., - null: bool = ..., + null: Literal[True] = ..., db_index: bool = ..., default: Any = ..., editable: bool = ..., @@ -358,6 +978,8 @@ class GenericIPAddressField( validators: Iterable[_ValidatorCallable] = ..., error_messages: Optional[_ErrorMessagesToOverride] = ..., ) -> None: ... + def __get__(self, instance: Any, owner: Any) -> _C: ... + def __set__(self, instance: Any, value: _C) -> None: ... class DateTimeCheckMixin: ... @@ -387,10 +1009,13 @@ class DateField(DateTimeCheckMixin, Field[Union[str, date, Combinable], date]): ): ... class TimeField( - DateTimeCheckMixin, Field[Union[str, time, datetime, Combinable], time] + Generic[_C], + DateTimeCheckMixin, + Field[Union[str, time, datetime, Combinable], time], ): + @overload def __init__( - self, + self: TimeField[time], verbose_name: Optional[Union[str, bytes]] = ..., name: Optional[str] = ..., auto_now: bool = ..., @@ -398,7 +1023,30 @@ class TimeField( primary_key: bool = ..., unique: bool = ..., blank: bool = ..., - null: bool = ..., + null: Literal[False] = ..., + db_index: bool = ..., + default: Any = ..., + editable: bool = ..., + auto_created: bool = ..., + serialize: bool = ..., + choices: Optional[_FieldChoices] = ..., + help_text: str = ..., + db_column: Optional[str] = ..., + db_tablespace: Optional[str] = ..., + validators: Iterable[_ValidatorCallable] = ..., + error_messages: Optional[_ErrorMessagesToOverride] = ..., + ): ... + @overload + def __init__( + self: TimeField[Optional[time]], + verbose_name: Optional[Union[str, bytes]] = ..., + name: Optional[str] = ..., + auto_now: bool = ..., + auto_now_add: bool = ..., + primary_key: bool = ..., + unique: bool = ..., + blank: bool = ..., + null: Literal[True] = ..., db_index: bool = ..., default: Any = ..., editable: bool = ..., @@ -411,6 +1059,8 @@ class TimeField( validators: Iterable[_ValidatorCallable] = ..., error_messages: Optional[_ErrorMessagesToOverride] = ..., ): ... + def __get__(self, instance: Any, owner: Any) -> _C: ... + def __set__(self, instance: Any, value: _C) -> None: ... _DT = TypeVar("_DT", bound=Optional[datetime]) @@ -468,16 +1118,69 @@ class DateTimeField( def __get__(self, instance: Any, owner: Any) -> _DT: ... def __set__(self, instance: Any, value: _DT) -> None: ... -class UUIDField(Field[Union[str, uuid.UUID], uuid.UUID]): ... +class UUIDField(Generic[_C], Field[Union[str, uuid.UUID], uuid.UUID]): + @overload + def __init__( + self: UUIDField[uuid.UUID], + verbose_name: Optional[Union[str, bytes]] = ..., + name: Optional[str] = ..., + primary_key: bool = ..., + max_length: Optional[int] = ..., + unique: bool = ..., + blank: bool = ..., + null: Literal[False] = ..., + db_index: bool = ..., + default: Any = ..., + editable: bool = ..., + auto_created: bool = ..., + serialize: bool = ..., + unique_for_date: Optional[str] = ..., + unique_for_month: Optional[str] = ..., + unique_for_year: Optional[str] = ..., + choices: Optional[_FieldChoices] = ..., + help_text: str = ..., + db_column: Optional[str] = ..., + db_tablespace: Optional[str] = ..., + validators: Iterable[_ValidatorCallable] = ..., + error_messages: Optional[_ErrorMessagesToOverride] = ..., + ) -> None: ... + @overload + def __init__( + self: UUIDField[Optional[uuid.UUID]], + verbose_name: Optional[Union[str, bytes]] = ..., + name: Optional[str] = ..., + primary_key: bool = ..., + max_length: Optional[int] = ..., + unique: bool = ..., + blank: bool = ..., + null: Literal[True] = ..., + db_index: bool = ..., + default: Any = ..., + editable: bool = ..., + auto_created: bool = ..., + serialize: bool = ..., + unique_for_date: Optional[str] = ..., + unique_for_month: Optional[str] = ..., + unique_for_year: Optional[str] = ..., + choices: Optional[_FieldChoices] = ..., + help_text: str = ..., + db_column: Optional[str] = ..., + db_tablespace: Optional[str] = ..., + validators: Iterable[_ValidatorCallable] = ..., + error_messages: Optional[_ErrorMessagesToOverride] = ..., + ) -> None: ... + def __get__(self, instance: Any, owner: Any) -> _C: ... + def __set__(self, instance: Any, value: Union[str, _C]) -> None: ... -class FilePathField(Field[str, str]): +class FilePathField(Generic[_C], Field[str, str]): path: Any = ... match: Optional[str] = ... recursive: bool = ... allow_files: bool = ... allow_folders: bool = ... + @overload def __init__( - self, + self: FilePathField[str], path: Union[str, Callable[..., str]] = ..., match: Optional[str] = ..., recursive: bool = ..., @@ -489,12 +1192,147 @@ class FilePathField(Field[str, str]): max_length: int = ..., unique: bool = ..., blank: bool = ..., - null: bool = ..., + null: Literal[False] = ..., + db_index: bool = ..., + default: Any = ..., + editable: bool = ..., + auto_created: bool = ..., + serialize: bool = ..., + choices: Optional[_FieldChoices] = ..., + help_text: str = ..., + db_column: Optional[str] = ..., + db_tablespace: Optional[str] = ..., + validators: Iterable[_ValidatorCallable] = ..., + error_messages: Optional[_ErrorMessagesToOverride] = ..., + ): ... + @overload + def __init__( + self: FilePathField[Optional[str]], + path: Union[str, Callable[..., str]] = ..., + match: Optional[str] = ..., + recursive: bool = ..., + allow_files: bool = ..., + allow_folders: bool = ..., + verbose_name: Optional[str] = ..., + name: Optional[str] = ..., + primary_key: bool = ..., + max_length: int = ..., + unique: bool = ..., + blank: bool = ..., + null: Literal[True] = ..., + db_index: bool = ..., + default: Any = ..., + editable: bool = ..., + auto_created: bool = ..., + serialize: bool = ..., + choices: Optional[_FieldChoices] = ..., + help_text: str = ..., + db_column: Optional[str] = ..., + db_tablespace: Optional[str] = ..., + validators: Iterable[_ValidatorCallable] = ..., + error_messages: Optional[_ErrorMessagesToOverride] = ..., + ): ... + def __get__(self, instance: Any, owner: Any) -> _C: ... + def __set__(self, instance: Any, value: _C) -> None: ... + +class BinaryField(Generic[_C], Field[Union[bytes, bytearray, memoryview], bytes]): + @overload + def __init__( + self: BinaryField[bytes], + verbose_name: Optional[Union[str, bytes]] = ..., + name: Optional[str] = ..., + primary_key: bool = ..., + max_length: Optional[int] = ..., + unique: bool = ..., + blank: bool = ..., + null: Literal[False] = ..., + 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] = ..., + ): ... + @overload + def __init__( + self: BinaryField[Optional[bytes]], + verbose_name: Optional[Union[str, bytes]] = ..., + name: Optional[str] = ..., + primary_key: bool = ..., + max_length: Optional[int] = ..., + unique: bool = ..., + blank: bool = ..., + null: Literal[True] = ..., + 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 __get__(self, instance: Any, owner: Any) -> _C: ... + def __set__(self, instance: Any, value: _C) -> None: ... + +class DurationField(Generic[_C], Field[timedelta, timedelta]): + @overload + def __init__( + self: DurationField[timedelta], + verbose_name: Optional[Union[str, bytes]] = ..., + name: Optional[str] = ..., + primary_key: bool = ..., + max_length: Optional[int] = ..., + unique: bool = ..., + blank: bool = ..., + null: Literal[False] = ..., + 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] = ..., + ): ... + @overload + def __init__( + self: DurationField[Optional[timedelta]], + verbose_name: Optional[Union[str, bytes]] = ..., + name: Optional[str] = ..., + primary_key: bool = ..., + max_length: Optional[int] = ..., + unique: bool = ..., + blank: bool = ..., + null: Literal[True] = ..., 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] = ..., @@ -502,8 +1340,7 @@ class FilePathField(Field[str, str]): validators: Iterable[_ValidatorCallable] = ..., error_messages: Optional[_ErrorMessagesToOverride] = ..., ): ... + def __get__(self, instance: Any, owner: Any) -> _C: ... + def __set__(self, instance: Any, value: _C) -> None: ... -class BinaryField(Field[Union[bytes, bytearray, memoryview], bytes]): ... -class DurationField(Field[timedelta, timedelta]): ... class BigAutoField(AutoField): ... -class CommaSeparatedIntegerField(CharField): ... diff --git a/django-stubs/db/models/fields/related.pyi b/django-stubs/db/models/fields/related.pyi index ec9a93333..180da1c1c 100644 --- a/django-stubs/db/models/fields/related.pyi +++ b/django-stubs/db/models/fields/related.pyi @@ -186,21 +186,20 @@ class ForeignKey(Generic[_M], ForeignObject[_M, _M]): def __get__(self, instance: None, owner) -> ForwardManyToOneDescriptor: ... # Model instance access @overload + def __get__(self: ForeignKey[_M], instance: Any, owner: Any) -> _M: ... + @overload def __get__( self: ForeignKey[Optional[_M]], instance: Any, owner: Any ) -> Optional[_M]: ... - @overload - def __get__(self: ForeignKey[_M], instance: Any, owner: Any) -> _M: ... # non-Model instances @overload def __get__(self: _F, instance, owner) -> _F: ... -class OneToOneField(RelatedField[_ST, _GT]): - _pyi_private_set_type: Union[Any, Combinable] - _pyi_private_get_type: Any +class OneToOneField(Generic[_M], RelatedField[_M, _M]): + @overload def __init__( - self, - to: Union[Type[Model], str], + self: OneToOneField[_M], + to: Union[Type[_M], str], on_delete: Any, to_field: Optional[str] = ..., related_name: Optional[str] = ..., @@ -214,7 +213,40 @@ class OneToOneField(RelatedField[_ST, _GT]): max_length: Optional[int] = ..., unique: bool = ..., blank: bool = ..., - null: bool = ..., + null: Literal[False] = ..., + 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] = ..., + ): ... + @overload + def __init__( + self: OneToOneField[Optional[_M]], + to: Union[Type[_M], str], + on_delete: Any, + to_field: Optional[str] = ..., + related_name: Optional[str] = ..., + related_query_name: Optional[str] = ..., + limit_choices_to: Optional[Union[Dict[str, Any], Callable[[], Any], Q]] = ..., + parent_link: bool = ..., + db_constraint: bool = ..., + verbose_name: Optional[Union[str, bytes]] = ..., + name: Optional[str] = ..., + primary_key: bool = ..., + max_length: Optional[int] = ..., + unique: bool = ..., + blank: bool = ..., + null: Literal[True] = ..., db_index: bool = ..., default: Any = ..., editable: bool = ..., @@ -235,14 +267,16 @@ class OneToOneField(RelatedField[_ST, _GT]): def __get__(self, instance: None, owner) -> ForwardOneToOneDescriptor: ... # Model instance access @overload - def __get__(self, instance: Model, owner) -> _GT: ... + def __get__(self: OneToOneField[_M], instance: Any, owner: Any) -> _M: ... + @overload + def __get__( + self: OneToOneField[Optional[_M]], instance: Any, owner: Any + ) -> Optional[_M]: ... # non-Model instances @overload def __get__(self: _F, instance, owner) -> _F: ... -class ManyToManyField(RelatedField[_ST, _GT]): - _pyi_private_set_type: Sequence[Any] - _pyi_private_get_type: RelatedManager[Any] +class ManyToManyField(RelatedField[Sequence[Any], RelatedManager[Any]]): rel_class: Any = ... description: Any = ... @@ -287,7 +321,7 @@ class ManyToManyField(RelatedField[_ST, _GT]): def __get__(self, instance: None, owner) -> ManyToManyDescriptor: ... # Model instance access @overload - def __get__(self, instance: Model, owner) -> _GT: ... + def __get__(self, instance: Model, owner) -> RelatedManager[Any]: ... # non-Model instances @overload def __get__(self: _F, instance, owner) -> _F: ... diff --git a/mypy.ini b/mypy.ini index 02d33c30c..f71a6e037 100644 --- a/mypy.ini +++ b/mypy.ini @@ -1,6 +1,7 @@ [mypy] show_column_numbers=True pretty=False +show_error_codes = True disallow_any_unimported=True disallow_any_expr=False @@ -22,7 +23,7 @@ warn_redundant_casts=True warn_unused_ignores=True warn_no_return=True warn_return_any=False -warn_unreachable=False +warn_unreachable=True strict_equality=True diff --git a/poetry.lock b/poetry.lock index 72a8580fb..7da44da38 100644 --- a/poetry.lock +++ b/poetry.lock @@ -6,6 +6,14 @@ optional = false python-versions = "*" version = "1.4.4" +[[package]] +category = "dev" +description = "ASGI specs, helper code, and adapters" +name = "asgiref" +optional = false +python-versions = ">=3.5" +version = "3.3.1" + [[package]] category = "dev" description = "Atomic file writes." @@ -58,6 +66,19 @@ optional = false python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*" version = "0.4.4" +[[package]] +category = "dev" +description = "A high-level Python Web framework that encourages rapid development and clean, pragmatic design." +name = "django" +optional = false +python-versions = ">=3.6" +version = "3.1.3" + +[package.dependencies] +asgiref = ">=3.2.10,<4" +pytz = "*" +sqlparse = ">=0.2.2" + [[package]] category = "dev" description = "Read metadata from Python packages" @@ -178,6 +199,14 @@ toml = "*" python = "<3.8" version = ">=0.12" +[[package]] +category = "dev" +description = "World timezone definitions, modern and historical" +name = "pytz" +optional = false +python-versions = "*" +version = "2020.4" + [[package]] category = "dev" description = "Alternative regular expression module, to replace re." @@ -194,6 +223,14 @@ optional = false python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*" version = "1.15.0" +[[package]] +category = "dev" +description = "A non-validating SQL parser." +name = "sqlparse" +optional = false +python-versions = ">=3.5" +version = "0.4.1" + [[package]] category = "dev" description = "Python Library for Tom's Obvious, Minimal Language" @@ -236,16 +273,18 @@ python-versions = ">=3.6" version = "3.4.0" [metadata] -content-hash = "96d8f4fd61efd5e2f3e619f9856998444f41f52b1a22dc41085aadc7cef08b96" +content-hash = "e216165fb6aebd39a38bf388b375a421609d2b42c96843ceb37ccdc261fddb88" python-versions = "^3.7" [metadata.hashes] appdirs = ["7d5d0167b2b1ba821647616af46a749d1c653740dd0d2415100fe26e27afdf41", "a841dacd6b99318a741b166adb07e19ee71a274450e68237b4650ca1055ab128"] +asgiref = ["5ee950735509d04eb673bd7f7120f8fa1c9e2df495394992c73234d526907e17", "7162a3cb30ab0609f1a4c95938fd73e8604f63bdba516a7f7d64b83ff09478f0"] atomicwrites = ["6d1784dea7c0c8d4a5172b6c620f40b6e4cbfdf96d783691f2e1302a7b88e197", "ae70396ad1a434f9c7046fd2dd196fc04b12f9e91ffb859164193be8b6168a7a"] attrs = ["31b2eced602aa8423c2aea9c76a724617ed67cf9513173fd3a4f03e3a929c7e6", "832aa3cde19744e49938b91fea06d69ecb9e649c93ba974535d08ad92164f700"] black = ["1c02557aa099101b9d21496f8a914e9ed2222ef70336404eeeac8edba836fbea"] click = ["d2b5255c7c6349bc1bd1e59e08cd12acbbd63ce649f2588755783aa94dfb6b1a", "dacca89f4bfadd5de3d7489b7c8a566eee0d3676333fbb50030263894c38c0dc"] colorama = ["5941b2b48a20143d2267e95b1c2a7603ce057ee39fd88e7329b0c292aa16869b", "9f47eda37229f68eee03b24b9748937c7dc3868f906e8ba69fbcbdd3bc5dc3e2"] +django = ["14a4b7cd77297fba516fc0d92444cc2e2e388aa9de32d7a68d4a83d58f5a4927", "14b87775ffedab2ef6299b73343d1b4b41e5d4e2aa58c6581f114dbec01e3f8f"] importlib-metadata = ["590690d61efdd716ff82c39ca9a9d4209252adfe288a4b5721181050acbd4175", "d9b8a46a0885337627a6430db287176970fff18ad421becec1d64cfc763c2099"] iniconfig = ["011e24c64b7f47f6ebd835bb12a743f2fbe9a26d4cecaa7f53bc4f35ee9da8b3", "bc3af051d7d14b2ee5ef9969666def0cd1a000e121eaea580d4a313df4b37f32"] isort = ["dcab1d98b469a12a1a624ead220584391648790275560e1a43e54c5dceae65e7", "dcaeec1b5f0eca77faea2a35ab790b4f3680ff75590bfcb7145986905aab2f58"] @@ -257,8 +296,10 @@ pluggy = ["15b2acde666561e1298d71b523007ed7364de07029219b604cf808bfa1c765b0", "9 py = ["366389d1db726cd2fcfc79732e75410e5fe4d31db13692115529d34069a043c2", "9ca6883ce56b4e8da7e79ac18787889fa5206c79dcc67fb065376cd2fe03f342"] pyparsing = ["c203ec8783bf771a155b207279b9bccb8dea02d8f0c9e5f8ead507bc3246ecc1", "ef9d7589ef3c200abe66653d3f1ab1033c3c419ae9b9bdb1240a85b024efc88b"] pytest = ["4288fed0d9153d9646bfcdf0c0428197dba1ecb27a33bb6e031d002fa88653fe", "c0a7e94a8cdbc5422a51ccdad8e6f1024795939cc89159a0ae7f0b316ad3823e"] +pytz = ["3e6b7dd2d1e0a59084bcee14a17af60c5c562cdc16d828e8eba2e683d3a7e268", "5c55e189b682d420be27c6995ba6edce0c0a77dd67bfbe2ae6607134d5851ffd"] regex = ["02951b7dacb123d8ea6da44fe45ddd084aa6777d4b2454fa0da61d569c6fa538", "0d08e71e70c0237883d0bef12cad5145b84c3705e9c6a588b2a9c7080e5af2a4", "1862a9d9194fae76a7aaf0150d5f2a8ec1da89e8b55890b1786b8f88a0f619dc", "1ab79fcb02b930de09c76d024d279686ec5d532eb814fd0ed1e0051eb8bd2daa", "1fa7ee9c2a0e30405e21031d07d7ba8617bc590d391adfc2b7f1e8b99f46f444", "262c6825b309e6485ec2493ffc7e62a13cf13fb2a8b6d212f72bd53ad34118f1", "2a11a3e90bd9901d70a5b31d7dd85114755a581a5da3fc996abfefa48aee78af", "2c99e97d388cd0a8d30f7c514d67887d8021541b875baf09791a3baad48bb4f8", "3128e30d83f2e70b0bed9b2a34e92707d0877e460b402faca908c6667092ada9", "38c8fd190db64f513fe4e1baa59fed086ae71fa45083b6936b52d34df8f86a88", "3bddc701bdd1efa0d5264d2649588cbfda549b2899dc8d50417e47a82e1387ba", "4902e6aa086cbb224241adbc2f06235927d5cdacffb2425c73e6570e8d862364", "49cae022fa13f09be91b2c880e58e14b6da5d10639ed45ca69b85faf039f7a4e", "56e01daca75eae420bce184edd8bb341c8eebb19dd3bce7266332258f9fb9dd7", "5862975b45d451b6db51c2e654990c1820523a5b07100fc6903e9c86575202a0", "6a8ce43923c518c24a2579fda49f093f1397dad5d18346211e46f134fc624e31", "6c54ce4b5d61a7129bad5c5dc279e222afd00e721bf92f9ef09e4fae28755683", "6e4b08c6f8daca7d8f07c8d24e4331ae7953333dbd09c648ed6ebd24db5a10ee", "717881211f46de3ab130b58ec0908267961fadc06e44f974466d1887f865bd5b", "749078d1eb89484db5f34b4012092ad14b327944ee7f1c4f74d6279a6e4d1884", "7913bd25f4ab274ba37bc97ad0e21c31004224ccb02765ad984eef43e04acc6c", "7a25fcbeae08f96a754b45bdc050e1fb94b95cab046bf56b016c25e9ab127b3e", "83d6b356e116ca119db8e7c6fc2983289d87b27b3fac238cfe5dca529d884562", "8b882a78c320478b12ff024e81dc7d43c1462aa4a3341c754ee65d857a521f85", "8f6a2229e8ad946e36815f2a03386bb8353d4bde368fdf8ca5f0cb97264d3b5c", "9801c4c1d9ae6a70aeb2128e5b4b68c45d4f0af0d1535500884d644fa9b768c6", "a15f64ae3a027b64496a71ab1f722355e570c3fac5ba2801cafce846bf5af01d", "a3d748383762e56337c39ab35c6ed4deb88df5326f97a38946ddd19028ecce6b", "a63f1a07932c9686d2d416fb295ec2c01ab246e89b4d58e5fa468089cab44b70", "b2b1a5ddae3677d89b686e5c625fc5547c6e492bd755b520de5332773a8af06b", "b2f4007bff007c96a173e24dcda236e5e83bde4358a557f9ccf5e014439eae4b", "baf378ba6151f6e272824b86a774326f692bc2ef4cc5ce8d5bc76e38c813a55f", "bafb01b4688833e099d79e7efd23f99172f501a15c44f21ea2118681473fdba0", "bba349276b126947b014e50ab3316c027cac1495992f10e5682dc677b3dfa0c5", "c084582d4215593f2f1d28b65d2a2f3aceff8342aa85afd7be23a9cad74a0de5", "d1ebb090a426db66dd80df8ca85adc4abfcbad8a7c2e9a5ec7513ede522e0a8f", "d2d8ce12b7c12c87e41123997ebaf1a5767a5be3ec545f64675388970f415e2e", "e32f5f3d1b1c663af7f9c4c1e72e6ffe9a78c03a31e149259f531e0fed826512", "e3faaf10a0d1e8e23a9b51d1900b72e1635c2d5b0e1bea1c18022486a8e2e52d", "f7d29a6fc4760300f86ae329e3b6ca28ea9c20823df123a2ea8693e967b29917", "f8f295db00ef5f8bae530fc39af0b40486ca6068733fb860b42115052206466f"] six = ["30639c035cdb23534cd4aa2dd52c3bf48f06e5f4a941509c8bafd8ce11080259", "8b74bedcbbbaca38ff6d7491d76f2b06b3592611af620f8426e82dddb04a5ced"] +sqlparse = ["017cde379adbd6a1f15a61873f43e8274179378e95ef3fede90b5aa64d304ed0", "0f91fd2e829c44362cbcfab3e9ae12e22badaa8a29ad5ff599f9ec109f0454e8"] toml = ["806143ae5bfb6a3c6e736a764057db0e6a0e05e338b5630894a5f779cabb4f9b", "b3bda1d108d5dd99f4a20d24d9c348e91c4db7ab1b749200bded2f839ccbe68f"] typed-ast = ["0666aa36131496aed8f7be0410ff974562ab7eeac11ef351def9ea6fa28f6355", "0c2c07682d61a629b68433afb159376e24e5b2fd4641d35424e462169c0a7919", "249862707802d40f7f29f6e1aad8d84b5aa9e44552d2cc17384b209f091276aa", "24995c843eb0ad11a4527b026b4dde3da70e1f2d8806c99b7b4a7cf491612652", "269151951236b0f9a6f04015a9004084a5ab0d5f19b57de779f908621e7d8b75", "4083861b0aa07990b619bd7ddc365eb7fa4b817e99cf5f8d9cf21a42780f6e01", "498b0f36cc7054c1fead3d7fc59d2150f4d5c6c56ba7fb150c013fbc683a8d2d", "4e3e5da80ccbebfff202a67bf900d081906c358ccc3d5e3c8aea42fdfdfd51c1", "6daac9731f172c2a22ade6ed0c00197ee7cc1221aa84cfdf9c31defeb059a907", "715ff2f2df46121071622063fc7543d9b1fd19ebfc4f5c8895af64a77a8c852c", "73d785a950fc82dd2a25897d525d003f6378d1cb23ab305578394694202a58c3", "8c8aaad94455178e3187ab22c8b01a3837f8ee50e09cf31f1ba129eb293ec30b", "8ce678dbaf790dbdb3eba24056d5364fb45944f33553dd5869b7580cdbb83614", "aaee9905aee35ba5905cfb3c62f3e83b3bec7b39413f0a7f19be4e547ea01ebb", "bcd3b13b56ea479b3650b82cabd6b5343a625b0ced5429e4ccad28a8973f301b", "c9e348e02e4d2b4a8b2eedb48210430658df6951fa484e59de33ff773fbd4b41", "d205b1b46085271b4e15f670058ce182bd1199e56b317bf2ec004b6a44f911f6", "d43943ef777f9a1c42bf4e552ba23ac77a6351de620aa9acf64ad54933ad4d34", "d5d33e9e7af3b34a40dc05f498939f0ebf187f07c385fd58d591c533ad8562fe", "fc0fea399acb12edbf8a628ba8d2312f583bdbdb3335635db062fa98cf71fca4", "fe460b922ec15dd205595c9b5b99e2f056fd98ae8f9f56b888e7a17dc2b757e7"] typing-extensions = ["7cb407020f00f7bfc3cb3e7881628838e69d8f3fcab2f64742a5e76b2f841918", "99d4073b617d30288f569d3f13d2bd7548c3a7e4c8de87db09a9d29bb3a4a60c", "dafc7639cde7f1b6e1acc0f457842a83e722ccca8eef5270af2d74792619a89f"] diff --git a/pyproject.toml b/pyproject.toml index 82fa9384c..09600de4f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -21,6 +21,7 @@ pytest = "^6.1" wheel = "^0.35.1" mypy = "^0.790.0" isort = "^5.6" +django = "^3.1" [tool.black] line-length = 88 diff --git a/test/__init__.py b/test/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/test/bear/__init__.py b/test/bear/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/test/bear/bear/__init__.py b/test/bear/bear/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/test/bear/bear/asgi.py b/test/bear/bear/asgi.py new file mode 100644 index 000000000..e05a5eaa5 --- /dev/null +++ b/test/bear/bear/asgi.py @@ -0,0 +1,16 @@ +""" +ASGI config for bear project. + +It exposes the ASGI callable as a module-level variable named ``application``. + +For more information on this file, see +https://docs.djangoproject.com/en/3.1/howto/deployment/asgi/ +""" + +import os + +from django.core.asgi import get_asgi_application + +os.environ.setdefault("DJANGO_SETTINGS_MODULE", "bear.settings") + +application = get_asgi_application() diff --git a/test/bear/bear/settings.py b/test/bear/bear/settings.py new file mode 100644 index 000000000..90a5f93bf --- /dev/null +++ b/test/bear/bear/settings.py @@ -0,0 +1,121 @@ +""" +Django settings for bear project. + +Generated by 'django-admin startproject' using Django 3.1.3. + +For more information on this file, see +https://docs.djangoproject.com/en/3.1/topics/settings/ + +For the full list of settings and their values, see +https://docs.djangoproject.com/en/3.1/ref/settings/ +""" + +from pathlib import Path +from typing import List + +# Build paths inside the project like this: BASE_DIR / 'subdir'. +BASE_DIR = Path(__file__).resolve().parent.parent + + +# Quick-start development settings - unsuitable for production +# See https://docs.djangoproject.com/en/3.1/howto/deployment/checklist/ + +# SECURITY WARNING: keep the secret key used in production secret! +SECRET_KEY = "k$483ye5*2-4o8dnwim9#kgq0)c(3kc*o1v8yw%l=n43ik1d)j" + +# SECURITY WARNING: don't run with debug turned on in production! +DEBUG = True + +ALLOWED_HOSTS: List[str] = [] + + +# Application definition + +INSTALLED_APPS = [ + "django.contrib.admin", + "django.contrib.auth", + "django.contrib.contenttypes", + "django.contrib.sessions", + "django.contrib.messages", + "django.contrib.staticfiles", +] + +MIDDLEWARE = [ + "django.middleware.security.SecurityMiddleware", + "django.contrib.sessions.middleware.SessionMiddleware", + "django.middleware.common.CommonMiddleware", + "django.middleware.csrf.CsrfViewMiddleware", + "django.contrib.auth.middleware.AuthenticationMiddleware", + "django.contrib.messages.middleware.MessageMiddleware", + "django.middleware.clickjacking.XFrameOptionsMiddleware", +] + +ROOT_URLCONF = "bear.urls" + +TEMPLATES = [ + { + "BACKEND": "django.template.backends.django.DjangoTemplates", + "DIRS": [], + "APP_DIRS": True, + "OPTIONS": { + "context_processors": [ + "django.template.context_processors.debug", + "django.template.context_processors.request", + "django.contrib.auth.context_processors.auth", + "django.contrib.messages.context_processors.messages", + ], + }, + }, +] + +WSGI_APPLICATION = "bear.wsgi.application" + + +# Database +# https://docs.djangoproject.com/en/3.1/ref/settings/#databases + +DATABASES = { + "default": { + "ENGINE": "django.db.backends.sqlite3", + "NAME": BASE_DIR / "db.sqlite3", + } +} + + +# Password validation +# https://docs.djangoproject.com/en/3.1/ref/settings/#auth-password-validators + +AUTH_PASSWORD_VALIDATORS = [ + { + "NAME": "django.contrib.auth.password_validation.UserAttributeSimilarityValidator", + }, + { + "NAME": "django.contrib.auth.password_validation.MinimumLengthValidator", + }, + { + "NAME": "django.contrib.auth.password_validation.CommonPasswordValidator", + }, + { + "NAME": "django.contrib.auth.password_validation.NumericPasswordValidator", + }, +] + + +# Internationalization +# https://docs.djangoproject.com/en/3.1/topics/i18n/ + +LANGUAGE_CODE = "en-us" + +TIME_ZONE = "UTC" + +USE_I18N = True + +USE_L10N = True + +USE_TZ = True + + +# Static files (CSS, JavaScript, Images) +# https://docs.djangoproject.com/en/3.1/howto/static-files/ + +STATIC_URL = "/static/" diff --git a/test/bear/bear/urls.py b/test/bear/bear/urls.py new file mode 100644 index 000000000..0595780fd --- /dev/null +++ b/test/bear/bear/urls.py @@ -0,0 +1,21 @@ +"""bear URL Configuration + +The `urlpatterns` list routes URLs to views. For more information please see: + https://docs.djangoproject.com/en/3.1/topics/http/urls/ +Examples: +Function views + 1. Add an import: from my_app import views + 2. Add a URL to urlpatterns: path('', views.home, name='home') +Class-based views + 1. Add an import: from other_app.views import Home + 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home') +Including another URLconf + 1. Import the include() function: from django.urls import include, path + 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) +""" +from django.contrib import admin +from django.urls import path + +urlpatterns = [ + path("admin/", admin.site.urls), +] diff --git a/test/bear/bear/wsgi.py b/test/bear/bear/wsgi.py new file mode 100644 index 000000000..eb8fb3ab1 --- /dev/null +++ b/test/bear/bear/wsgi.py @@ -0,0 +1,16 @@ +""" +WSGI config for bear project. + +It exposes the WSGI callable as a module-level variable named ``application``. + +For more information on this file, see +https://docs.djangoproject.com/en/3.1/howto/deployment/wsgi/ +""" + +import os + +from django.core.wsgi import get_wsgi_application + +os.environ.setdefault("DJANGO_SETTINGS_MODULE", "bear.settings") + +application = get_wsgi_application() diff --git a/test/bear/manage.py b/test/bear/manage.py new file mode 100755 index 000000000..025d9cea9 --- /dev/null +++ b/test/bear/manage.py @@ -0,0 +1,22 @@ +#!/usr/bin/env python +"""Django's command-line utility for administrative tasks.""" +import os +import sys + + +def main() -> None: + """Run administrative tasks.""" + os.environ.setdefault("DJANGO_SETTINGS_MODULE", "bear.settings") + try: + from django.core.management import execute_from_command_line + except ImportError as exc: + raise ImportError( + "Couldn't import Django. Are you sure it's installed and " + "available on your PYTHONPATH environment variable? Did you " + "forget to activate a virtual environment?" + ) from exc + execute_from_command_line(sys.argv) + + +if __name__ == "__main__": + main() diff --git a/test/trout/__init__.py b/test/trout/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/test/trout/apps.py b/test/trout/apps.py new file mode 100644 index 000000000..f40467da2 --- /dev/null +++ b/test/trout/apps.py @@ -0,0 +1,5 @@ +from django.apps import AppConfig + + +class TroutConfig(AppConfig): + name = "trout" diff --git a/test/trout/migrations/__init__.py b/test/trout/migrations/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/test/trout/models.py b/test/trout/models.py new file mode 100644 index 000000000..a5761468b --- /dev/null +++ b/test/trout/models.py @@ -0,0 +1,496 @@ +from datetime import time, timedelta +from decimal import Decimal +from typing import Dict, List, Optional, Union +from uuid import UUID + +from django.contrib.postgres.fields import ( + ArrayField, + CICharField, + CIEmailField, + CITextField, + HStoreField, + JSONField, +) +from django.db import models +from django.db.models.manager import RelatedManager + + +class User(models.Model): + + pass + + +class Post(models.Model): + + pass + + +class PostToComment(models.Model): + pass + + +class Comment(models.Model): + id = models.AutoField(primary_key=True) + + post_fk = models.ForeignKey( + Post, on_delete=models.CASCADE, help_text="Comment for a post." + ) + post_fk_nullable = models.ForeignKey( + Post, null=True, on_delete=models.CASCADE, help_text="Comment for a post." + ) + + post_one_to_one = models.OneToOneField(Post, on_delete=models.CASCADE) + post_one_to_one_nullable = models.OneToOneField( + Post, null=True, on_delete=models.CASCADE + ) + + post_many_to_many = models.ManyToManyField(Post, through=PostToComment) + post_many_to_many_nullable = models.ManyToManyField( + Post, through=PostToComment, null=True + ) + + created_at = models.DateTimeField() + created_at_nullable = models.DateTimeField(null=True) + + created_at_date = models.DateField() + created_at_date_nullable = models.DateField(null=True) + + char = models.CharField() + char_nullable = models.CharField(null=True) + + text = models.TextField() + text_nullable = models.TextField(null=True) + + integer = models.IntegerField() + integer_nullable = models.IntegerField(null=True) + + float = models.FloatField() + float_nullable = models.FloatField(null=True) + + uuid = models.UUIDField() + uuid_nullable = models.UUIDField(null=True) + + url = models.URLField() + url_nullable = models.URLField(null=True) + + email = models.EmailField() + email_nullable = models.EmailField(null=True) + + decimal = models.DecimalField() + decimal_nullable = models.DecimalField(null=True) + + bool = models.BooleanField() + bool_nullable = models.BooleanField(null=True) + + ip_address = models.IPAddressField() + ip_address_nullable = models.IPAddressField(null=True) + + generic_ip_address = models.GenericIPAddressField() + generic_ip_address_nullable = models.GenericIPAddressField(null=True) + + time = models.TimeField() + time_nullable = models.TimeField(null=True) + + file_path = models.FilePathField() + file_path_nullable = models.FilePathField(null=True) + + binary = models.BinaryField() + binary_nullable = models.BinaryField(null=True) + + duration = models.DurationField() + duration_nullable = models.DurationField(null=True) + + slug = models.SlugField() + slug_nullable = models.SlugField(null=True) + + pos_int = models.PositiveIntegerField() + pos_int_nullable = models.PositiveIntegerField(null=True) + + pos_small_int = models.PositiveSmallIntegerField() + pos_small_int_nullable = models.PositiveSmallIntegerField(null=True) + + small_int = models.SmallIntegerField() + small_int_nullable = models.SmallIntegerField(null=True) + + big_int = models.BigIntegerField() + big_int_nullable = models.BigIntegerField(null=True) + + ci_text = CITextField() + ci_text_nullable = CITextField(null=True) + + ci_char = CICharField() + ci_char_nullable = CICharField(null=True) + + ci_email = CIEmailField() + ci_email_nullable = CIEmailField(null=True) + + hstore = HStoreField() + hstore_nullable = HStoreField(null=True) + + array = ArrayField( + ArrayField( + models.CharField(max_length=10, blank=True), + size=8, + ), + size=8, + ) + array_nullable = ArrayField( + ArrayField( + models.CharField(max_length=10, blank=True), + size=8, + ), + size=8, + null=True, + ) + + created_by = models.ForeignKey["User"]( + "User", on_delete=models.CASCADE, help_text="owner of the comment" + ) + + user_type = models.ForeignKey(User, on_delete=models.CASCADE) + user_str = models.ForeignKey("User", on_delete=models.CASCADE) # type: ignore [var-annotated] + nullable_user_type = models.ForeignKey(User, on_delete=models.CASCADE, null=True) + nullable_user_str = models.ForeignKey("User", on_delete=models.CASCADE, null=True) + not_nullable_user_str = models.ForeignKey( # type: ignore [var-annotated] + "User", on_delete=models.CASCADE, null=False + ) + null_str_specified = models.ForeignKey["User"]( + "User", on_delete=models.CASCADE, null=True + ) + + metadata = JSONField() + + +def process_non_nullable( + x: Union[ + Post, + User, + time, + float, + bytes, + UUID, + int, + str, + Decimal, + timedelta, + List[object], + Dict[str, Optional[str]], + ] +) -> None: + ... + + +def main() -> None: + + post = Post() + + print(post.id) # type: ignore [attr-defined] + + comment = Comment() + comment.save() + + # Django way to duplicate an instance + comment.id = None + comment.save() + + print(comment.id) + + process_non_nullable(comment.post_fk) + if isinstance(comment.post_fk_nullable, type(None)): + print(comment.post_fk_nullable) + if comment.post_fk_nullable is not None: + print(comment.post_fk_nullable) + if not isinstance(comment.post_fk, Post): + print() # type: ignore [unreachable] + if not comment.post_fk and not isinstance(comment.post_fk, Post): + print() # type: ignore [unreachable] + + process_non_nullable(comment.post_one_to_one) + if isinstance(comment.post_one_to_one_nullable, type(None)): + print(comment.post_one_to_one_nullable) + if comment.post_one_to_one_nullable is not None: + print(comment.post_one_to_one_nullable) + if not isinstance(comment.post_one_to_one, Post): + print() # type: ignore [unreachable] + if not comment.post_one_to_one and not isinstance(comment.post_one_to_one, Post): + print() # type: ignore [unreachable] + + # many to many is complicated so we don't check nullability like we do with other fields + if comment.post_many_to_many_nullable is not None: + print(comment.post_many_to_many_nullable) + if not isinstance(comment.post_many_to_many, RelatedManager): + print() # type: ignore [unreachable] + if not comment.post_many_to_many and not isinstance( + comment.post_many_to_many, RelatedManager + ): + print() # type: ignore [unreachable] + + process_non_nullable(comment.text) + if isinstance(comment.text_nullable, type(None)): + print(comment.text_nullable) + if comment.text_nullable is not None: + print(comment.text_nullable) + if not isinstance(comment.text, str): + print() # type: ignore [unreachable] + if not comment.text and not isinstance(comment.text, str): + print() # type: ignore [unreachable] + + process_non_nullable(comment.integer) + if isinstance(comment.integer_nullable, type(None)): + print(comment.integer_nullable) + if comment.integer_nullable is not None: + print(comment.integer_nullable) + if not isinstance(comment.integer, int): + print() # type: ignore [unreachable] + if not comment.integer and not isinstance(comment.integer, int): + print() # type: ignore [unreachable] + + process_non_nullable(comment.float) + if isinstance(comment.float_nullable, type(None)): + print(comment.float_nullable) + if comment.float_nullable is not None: + print(comment.float_nullable) + if not isinstance(comment.float, float): + print() # type: ignore [unreachable] + if not comment.float and not isinstance(comment.float, float): + print() # type: ignore [unreachable] + + process_non_nullable(comment.uuid) + if isinstance(comment.uuid_nullable, type(None)): + print(comment.uuid_nullable) + if comment.uuid_nullable is not None: + print(comment.uuid_nullable) + if not isinstance(comment.uuid, UUID): + print() # type: ignore [unreachable] + if not comment.uuid and not isinstance(comment.uuid, UUID): + print() # type: ignore [unreachable] + + process_non_nullable(comment.url) + if isinstance(comment.url_nullable, type(None)): + print(comment.url_nullable) + if comment.url_nullable is not None: + print(comment.url_nullable) + if not isinstance(comment.url, str): + print() # type: ignore [unreachable] + if not comment.url and not isinstance(comment.url, str): + print() # type: ignore [unreachable] + + process_non_nullable(comment.email) + if isinstance(comment.email_nullable, type(None)): + print(comment.email_nullable) + if comment.email_nullable is not None: + print(comment.email_nullable) + if not isinstance(comment.email, str): + print() # type: ignore [unreachable] + if not comment.email and not isinstance(comment.email, str): + print() # type: ignore [unreachable] + + process_non_nullable(comment.decimal) + if isinstance(comment.decimal_nullable, type(None)): + print(comment.decimal_nullable) + if comment.decimal_nullable is not None: + print(comment.decimal_nullable) + if not isinstance(comment.decimal, Decimal): + print() # type: ignore [unreachable] + if not comment.decimal and not isinstance(comment.decimal, Decimal): + print() # type: ignore [unreachable] + + process_non_nullable(comment.bool) + if isinstance(comment.bool_nullable, type(None)): + print(comment.bool_nullable) + if comment.bool_nullable is not None: + print(comment.bool_nullable) + if not isinstance(comment.bool, int): + print() # type: ignore [unreachable] + if not comment.bool and not isinstance(comment.bool, int): + print() # type: ignore [unreachable] + + process_non_nullable(comment.ip_address) + if isinstance(comment.ip_address_nullable, type(None)): + print(comment.ip_address_nullable) + if comment.ip_address_nullable is not None: + print(comment.ip_address_nullable) + if not isinstance(comment.ip_address, str): + print() # type: ignore [unreachable] + if not comment.ip_address and not isinstance(comment.ip_address, str): + print() # type: ignore [unreachable] + + process_non_nullable(comment.generic_ip_address) + if isinstance(comment.generic_ip_address_nullable, type(None)): + print(comment.generic_ip_address_nullable) + if comment.generic_ip_address_nullable is not None: + print(comment.generic_ip_address_nullable) + if not isinstance(comment.generic_ip_address, str): + print() # type: ignore [unreachable] + if not comment.generic_ip_address and not isinstance( + comment.generic_ip_address, str + ): + print() # type: ignore [unreachable] + + process_non_nullable(comment.time) + if isinstance(comment.time_nullable, type(None)): + print(comment.time_nullable) + if comment.time_nullable is not None: + print(comment.time_nullable) + if not isinstance(comment.time, time): + print() # type: ignore [unreachable] + if not comment.time and not isinstance(comment.time, time): + print() # type: ignore [unreachable] + + process_non_nullable(comment.file_path) + if isinstance(comment.file_path_nullable, type(None)): + print(comment.file_path_nullable) + if comment.file_path_nullable is not None: + print(comment.file_path_nullable) + if not isinstance(comment.file_path, str): + print() # type: ignore [unreachable] + if not comment.file_path and not isinstance(comment.file_path, str): + print() # type: ignore [unreachable] + + process_non_nullable(comment.binary) + if isinstance(comment.binary_nullable, type(None)): + print(comment.binary_nullable) + if comment.binary_nullable is not None: + print(comment.binary_nullable) + if not isinstance(comment.binary, bytes): + print() # type: ignore [unreachable] + if not comment.binary and not isinstance(comment.binary, bytes): + print() # type: ignore [unreachable] + + process_non_nullable(comment.duration) + if isinstance(comment.duration_nullable, type(None)): + print(comment.duration_nullable) + if comment.duration_nullable is not None: + print(comment.duration_nullable) + if not isinstance(comment.duration, timedelta): + print() # type: ignore [unreachable] + if not comment.duration and not isinstance(comment.duration, timedelta): + print() # type: ignore [unreachable] + + process_non_nullable(comment.slug) + if isinstance(comment.slug_nullable, type(None)): + print(comment.slug_nullable) + if comment.slug_nullable is not None: + print(comment.slug_nullable) + if not isinstance(comment.slug, str): + print() # type: ignore [unreachable] + if not comment.slug and not isinstance(comment.slug, str): + print() # type: ignore [unreachable] + + process_non_nullable(comment.pos_int) + if isinstance(comment.pos_int_nullable, type(None)): + print(comment.pos_int_nullable) + if comment.pos_int_nullable is not None: + print(comment.pos_int_nullable) + if not isinstance(comment.pos_int, int): + print() # type: ignore [unreachable] + if not comment.pos_int and not isinstance(comment.pos_int, int): + print() # type: ignore [unreachable] + + process_non_nullable(comment.pos_small_int) + if isinstance(comment.pos_small_int_nullable, type(None)): + print(comment.pos_small_int_nullable) + if comment.pos_small_int_nullable is not None: + print(comment.pos_small_int_nullable) + if not isinstance(comment.pos_small_int, int): + print() # type: ignore [unreachable] + if not comment.pos_small_int and not isinstance(comment.pos_small_int, int): + print() # type: ignore [unreachable] + + process_non_nullable(comment.small_int) + if isinstance(comment.small_int_nullable, type(None)): + print(comment.small_int_nullable) + if comment.small_int_nullable is not None: + print(comment.small_int_nullable) + if not isinstance(comment.small_int, int): + print() # type: ignore [unreachable] + if not comment.small_int and not isinstance(comment.small_int, int): + print() # type: ignore [unreachable] + + process_non_nullable(comment.big_int) + if isinstance(comment.big_int_nullable, type(None)): + print(comment.big_int_nullable) + if comment.big_int_nullable is not None: + print(comment.big_int_nullable) + if not isinstance(comment.big_int, int): + print() # type: ignore [unreachable] + if not comment.big_int and not isinstance(comment.big_int, int): + print() # type: ignore [unreachable] + + process_non_nullable(comment.ci_text) + if isinstance(comment.ci_text_nullable, type(None)): + print(comment.ci_text_nullable) + if comment.ci_text_nullable is not None: + print(comment.ci_text_nullable) + if not isinstance(comment.ci_text, str): + print() # type: ignore [unreachable] + if not comment.ci_text and not isinstance(comment.ci_text, str): + print() # type: ignore [unreachable] + + process_non_nullable(comment.ci_char) + if isinstance(comment.ci_char_nullable, type(None)): + print(comment.ci_char_nullable) + if comment.ci_char_nullable is not None: + print(comment.ci_char_nullable) + if not isinstance(comment.ci_char, str): + print() # type: ignore [unreachable] + if not comment.ci_char and not isinstance(comment.ci_char, str): + print() # type: ignore [unreachable] + + process_non_nullable(comment.ci_email) + if isinstance(comment.ci_email_nullable, type(None)): + print(comment.ci_email_nullable) + if comment.ci_email_nullable is not None: + print(comment.ci_email_nullable) + if not isinstance(comment.ci_email, str): + print() # type: ignore [unreachable] + if not comment.ci_email and not isinstance(comment.ci_email, str): + print() # type: ignore [unreachable] + + process_non_nullable(comment.hstore) + if isinstance(comment.hstore_nullable, type(None)): + print(comment.hstore_nullable) + if comment.hstore_nullable is not None: + print(comment.hstore_nullable) + # refinement doesn't work + # see: https://github.com/python/mypy/issues/9783 + # if not isinstance(comment.hstore, dict): + # print() # type: ignore [unreachable] + # if not comment.hstore and not isinstance(comment.hstore, dict): + # print() # type: ignore [unreachable] + + process_non_nullable(comment.array) + if isinstance(comment.array_nullable, type(None)): + print(comment.array_nullable) + if comment.array_nullable is not None: + print(comment.array_nullable) + if not isinstance(comment.array, list): + print() # type: ignore [unreachable] + if not comment.array and not isinstance(comment.array, list): + print() # type: ignore [unreachable] + + process_non_nullable(comment.user_type) + if isinstance(comment.nullable_user_type, type(None)): + print(comment.nullable_user_type) + if comment.nullable_user_type is not None: + process_non_nullable(comment.nullable_user_type) + if not isinstance(comment.user_type, User): + print() # type: ignore [unreachable] + + process_non_nullable(comment.user_str) + if isinstance(comment.nullable_user_str, type(None)): + print(comment.nullable_user_str) + if comment.nullable_user_str is not None: + print(comment.nullable_user_str) # type: ignore [unreachable] + + if isinstance(comment.not_nullable_user_str, type(None)): + print(comment.not_nullable_user_str) + if comment.not_nullable_user_str is not None: + print(comment.not_nullable_user_str) + + # if it's T, instead of the expected Optional[T], then will fail to type + # check + if isinstance(comment.null_str_specified, type(None)): + print(comment.null_str_specified) + if comment.null_str_specified is not None: + print(comment.null_str_specified) diff --git a/test/trout/views.py b/test/trout/views.py new file mode 100644 index 000000000..91ea44a21 --- /dev/null +++ b/test/trout/views.py @@ -0,0 +1,3 @@ +from django.shortcuts import render + +# Create your views here. From c9155e0e98ed52ad0ecdd134e1463e93f5ce2dd8 Mon Sep 17 00:00:00 2001 From: Steve Dignam Date: Sun, 6 Dec 2020 16:25:18 -0500 Subject: [PATCH 14/88] release: 0.2.0 --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 09600de4f..fa42f3a0f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "django-types" -version = "0.1.0" +version = "0.2.0" description = "Type subs for Django" repository = "https://github.com/sbdchd/django-types" readme = "README.md" From 1f0544876a1bbb5accfec7eac929ce77445cab1d Mon Sep 17 00:00:00 2001 From: Steve Dignam Date: Fri, 11 Dec 2020 18:09:16 -0500 Subject: [PATCH 15/88] fix: missing null param in overload --- django-stubs/db/models/fields/__init__.pyi | 1 + test/trout/models.py | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/django-stubs/db/models/fields/__init__.pyi b/django-stubs/db/models/fields/__init__.pyi index 9cdb5ff19..1da8102b6 100644 --- a/django-stubs/db/models/fields/__init__.pyi +++ b/django-stubs/db/models/fields/__init__.pyi @@ -773,6 +773,7 @@ class TextField(Generic[_C], Field[str, str]): max_length: Optional[int] = ..., unique: bool = ..., blank: bool = ..., + null: Literal[False] = ..., db_index: bool = ..., default: Any = ..., editable: bool = ..., diff --git a/test/trout/models.py b/test/trout/models.py index a5761468b..3194bbd44 100644 --- a/test/trout/models.py +++ b/test/trout/models.py @@ -60,6 +60,13 @@ class Comment(models.Model): text = models.TextField() text_nullable = models.TextField(null=True) + test_with_explicit_null_false = models.TextField( + db_index=True, + unique=True, + null=False, + blank=False, + help_text="", + ) integer = models.IntegerField() integer_nullable = models.IntegerField(null=True) From edf7e06508bd41a3e152f33541f2aebe5960c573 Mon Sep 17 00:00:00 2001 From: Steve Dignam Date: Fri, 11 Dec 2020 18:12:36 -0500 Subject: [PATCH 16/88] add flake8, move tests --- poetry.lock | 47 +++++++++++++++++++- pyproject.toml | 1 + {test => tests}/__init__.py | 0 {test => tests}/bear/__init__.py | 0 {test => tests}/bear/bear/__init__.py | 0 {test => tests}/bear/bear/asgi.py | 0 {test => tests}/bear/bear/settings.py | 0 {test => tests}/bear/bear/urls.py | 0 {test => tests}/bear/bear/wsgi.py | 0 {test => tests}/bear/manage.py | 0 {test => tests}/trout/__init__.py | 0 {test => tests}/trout/apps.py | 0 {test => tests}/trout/migrations/__init__.py | 0 {test => tests}/trout/models.py | 0 {test => tests}/trout/views.py | 0 15 files changed, 47 insertions(+), 1 deletion(-) rename {test => tests}/__init__.py (100%) rename {test => tests}/bear/__init__.py (100%) rename {test => tests}/bear/bear/__init__.py (100%) rename {test => tests}/bear/bear/asgi.py (100%) rename {test => tests}/bear/bear/settings.py (100%) rename {test => tests}/bear/bear/urls.py (100%) rename {test => tests}/bear/bear/wsgi.py (100%) rename {test => tests}/bear/manage.py (100%) rename {test => tests}/trout/__init__.py (100%) rename {test => tests}/trout/apps.py (100%) rename {test => tests}/trout/migrations/__init__.py (100%) rename {test => tests}/trout/models.py (100%) rename {test => tests}/trout/views.py (100%) diff --git a/poetry.lock b/poetry.lock index 7da44da38..1e362e476 100644 --- a/poetry.lock +++ b/poetry.lock @@ -79,6 +79,23 @@ asgiref = ">=3.2.10,<4" pytz = "*" sqlparse = ">=0.2.2" +[[package]] +category = "dev" +description = "the modular source code checker: pep8 pyflakes and co" +name = "flake8" +optional = false +python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,>=2.7" +version = "3.8.4" + +[package.dependencies] +mccabe = ">=0.6.0,<0.7.0" +pycodestyle = ">=2.6.0a1,<2.7.0" +pyflakes = ">=2.2.0,<2.3.0" + +[package.dependencies.importlib-metadata] +python = "<3.8" +version = "*" + [[package]] category = "dev" description = "Read metadata from Python packages" @@ -107,6 +124,14 @@ optional = false python-versions = ">=3.6,<4.0" version = "5.6.4" +[[package]] +category = "dev" +description = "McCabe checker, plugin for flake8" +name = "mccabe" +optional = false +python-versions = "*" +version = "0.6.1" + [[package]] category = "dev" description = "Optional static typing for Python" @@ -169,6 +194,22 @@ optional = false python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" version = "1.9.0" +[[package]] +category = "dev" +description = "Python style guide checker" +name = "pycodestyle" +optional = false +python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" +version = "2.6.0" + +[[package]] +category = "dev" +description = "passive checker of Python programs" +name = "pyflakes" +optional = false +python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" +version = "2.2.0" + [[package]] category = "dev" description = "Python parsing module" @@ -273,7 +314,7 @@ python-versions = ">=3.6" version = "3.4.0" [metadata] -content-hash = "e216165fb6aebd39a38bf388b375a421609d2b42c96843ceb37ccdc261fddb88" +content-hash = "7aff51acdb55e93b2fdaedb6010af2ceced541985adc145ec99faee5e66c67f9" python-versions = "^3.7" [metadata.hashes] @@ -285,15 +326,19 @@ black = ["1c02557aa099101b9d21496f8a914e9ed2222ef70336404eeeac8edba836fbea"] click = ["d2b5255c7c6349bc1bd1e59e08cd12acbbd63ce649f2588755783aa94dfb6b1a", "dacca89f4bfadd5de3d7489b7c8a566eee0d3676333fbb50030263894c38c0dc"] colorama = ["5941b2b48a20143d2267e95b1c2a7603ce057ee39fd88e7329b0c292aa16869b", "9f47eda37229f68eee03b24b9748937c7dc3868f906e8ba69fbcbdd3bc5dc3e2"] django = ["14a4b7cd77297fba516fc0d92444cc2e2e388aa9de32d7a68d4a83d58f5a4927", "14b87775ffedab2ef6299b73343d1b4b41e5d4e2aa58c6581f114dbec01e3f8f"] +flake8 = ["749dbbd6bfd0cf1318af27bf97a14e28e5ff548ef8e5b1566ccfb25a11e7c839", "aadae8761ec651813c24be05c6f7b4680857ef6afaae4651a4eccaef97ce6c3b"] importlib-metadata = ["590690d61efdd716ff82c39ca9a9d4209252adfe288a4b5721181050acbd4175", "d9b8a46a0885337627a6430db287176970fff18ad421becec1d64cfc763c2099"] iniconfig = ["011e24c64b7f47f6ebd835bb12a743f2fbe9a26d4cecaa7f53bc4f35ee9da8b3", "bc3af051d7d14b2ee5ef9969666def0cd1a000e121eaea580d4a313df4b37f32"] isort = ["dcab1d98b469a12a1a624ead220584391648790275560e1a43e54c5dceae65e7", "dcaeec1b5f0eca77faea2a35ab790b4f3680ff75590bfcb7145986905aab2f58"] +mccabe = ["ab8a6258860da4b6677da4bd2fe5dc2c659cff31b3ee4f7f5d64e79735b80d42", "dd8d182285a0fe56bace7f45b5e7d1a6ebcbf524e8f3bd87eb0f125271b8831f"] mypy = ["0a0d102247c16ce93c97066443d11e2d36e6cc2a32d8ccc1f705268970479324", "0d34d6b122597d48a36d6c59e35341f410d4abfa771d96d04ae2c468dd201abc", "2170492030f6faa537647d29945786d297e4862765f0b4ac5930ff62e300d802", "2842d4fbd1b12ab422346376aad03ff5d0805b706102e475e962370f874a5122", "2b21ba45ad9ef2e2eb88ce4aeadd0112d0f5026418324176fd494a6824b74975", "72060bf64f290fb629bd4a67c707a66fd88ca26e413a91384b18db3876e57ed7", "af4e9ff1834e565f1baa74ccf7ae2564ae38c8df2a85b057af1dbbc958eb6666", "bd03b3cf666bff8d710d633d1c56ab7facbdc204d567715cb3b9f85c6e94f669", "c614194e01c85bb2e551c421397e49afb2872c88b5830e3554f0519f9fb1c178", "cf4e7bf7f1214826cf7333627cb2547c0db7e3078723227820d0a2490f117a01", "da56dedcd7cd502ccd3c5dddc656cb36113dd793ad466e894574125945653cea", "e86bdace26c5fe9cf8cb735e7cedfe7850ad92b327ac5d797c656717d2ca66de", "e97e9c13d67fbe524be17e4d8025d51a7dca38f90de2e462243ab8ed8a9178d1", "eea260feb1830a627fb526d22fbb426b750d9f5a47b624e8d5e7e004359b219c"] mypy-extensions = ["090fedd75945a69ae91ce1303b5824f428daf5a028d2f6ab8a299250a846f15d", "2d82818f5bb3e369420cb3c4060a7970edba416647068eb4c5343488a6c604a8"] packaging = ["4357f74f47b9c12db93624a82154e9b120fa8293699949152b22065d556079f8", "998416ba6962ae7fbd6596850b80e17859a5753ba17c32284f67bfff33784181"] pathspec = ["86379d6b86d75816baba717e64b1a3a3469deb93bb76d613c9ce79edc5cb68fd", "aa0cb481c4041bf52ffa7b0d8fa6cd3e88a2ca4879c533c9153882ee2556790d"] pluggy = ["15b2acde666561e1298d71b523007ed7364de07029219b604cf808bfa1c765b0", "966c145cd83c96502c3c3868f50408687b38434af77734af1e9ca461a4081d2d"] py = ["366389d1db726cd2fcfc79732e75410e5fe4d31db13692115529d34069a043c2", "9ca6883ce56b4e8da7e79ac18787889fa5206c79dcc67fb065376cd2fe03f342"] +pycodestyle = ["2295e7b2f6b5bd100585ebcb1f616591b652db8a741695b3d8f5d28bdc934367", "c58a7d2815e0e8d7972bf1803331fb0152f867bd89adf8a01dfd55085434192e"] +pyflakes = ["0d94e0e05a19e57a99444b6ddcf9a6eb2e5c68d3ca1e98e90707af8152c90a92", "35b2d75ee967ea93b55750aa9edbbf72813e06a66ba54438df2cfac9e3c27fc8"] pyparsing = ["c203ec8783bf771a155b207279b9bccb8dea02d8f0c9e5f8ead507bc3246ecc1", "ef9d7589ef3c200abe66653d3f1ab1033c3c419ae9b9bdb1240a85b024efc88b"] pytest = ["4288fed0d9153d9646bfcdf0c0428197dba1ecb27a33bb6e031d002fa88653fe", "c0a7e94a8cdbc5422a51ccdad8e6f1024795939cc89159a0ae7f0b316ad3823e"] pytz = ["3e6b7dd2d1e0a59084bcee14a17af60c5c562cdc16d828e8eba2e683d3a7e268", "5c55e189b682d420be27c6995ba6edce0c0a77dd67bfbe2ae6607134d5851ffd"] diff --git a/pyproject.toml b/pyproject.toml index fa42f3a0f..8c5d534ef 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -22,6 +22,7 @@ wheel = "^0.35.1" mypy = "^0.790.0" isort = "^5.6" django = "^3.1" +flake8 = "^3.8" [tool.black] line-length = 88 diff --git a/test/__init__.py b/tests/__init__.py similarity index 100% rename from test/__init__.py rename to tests/__init__.py diff --git a/test/bear/__init__.py b/tests/bear/__init__.py similarity index 100% rename from test/bear/__init__.py rename to tests/bear/__init__.py diff --git a/test/bear/bear/__init__.py b/tests/bear/bear/__init__.py similarity index 100% rename from test/bear/bear/__init__.py rename to tests/bear/bear/__init__.py diff --git a/test/bear/bear/asgi.py b/tests/bear/bear/asgi.py similarity index 100% rename from test/bear/bear/asgi.py rename to tests/bear/bear/asgi.py diff --git a/test/bear/bear/settings.py b/tests/bear/bear/settings.py similarity index 100% rename from test/bear/bear/settings.py rename to tests/bear/bear/settings.py diff --git a/test/bear/bear/urls.py b/tests/bear/bear/urls.py similarity index 100% rename from test/bear/bear/urls.py rename to tests/bear/bear/urls.py diff --git a/test/bear/bear/wsgi.py b/tests/bear/bear/wsgi.py similarity index 100% rename from test/bear/bear/wsgi.py rename to tests/bear/bear/wsgi.py diff --git a/test/bear/manage.py b/tests/bear/manage.py similarity index 100% rename from test/bear/manage.py rename to tests/bear/manage.py diff --git a/test/trout/__init__.py b/tests/trout/__init__.py similarity index 100% rename from test/trout/__init__.py rename to tests/trout/__init__.py diff --git a/test/trout/apps.py b/tests/trout/apps.py similarity index 100% rename from test/trout/apps.py rename to tests/trout/apps.py diff --git a/test/trout/migrations/__init__.py b/tests/trout/migrations/__init__.py similarity index 100% rename from test/trout/migrations/__init__.py rename to tests/trout/migrations/__init__.py diff --git a/test/trout/models.py b/tests/trout/models.py similarity index 100% rename from test/trout/models.py rename to tests/trout/models.py diff --git a/test/trout/views.py b/tests/trout/views.py similarity index 100% rename from test/trout/views.py rename to tests/trout/views.py From 51b694879a2f23184f11056cea05ce5ef9093386 Mon Sep 17 00:00:00 2001 From: Steve Dignam Date: Fri, 11 Dec 2020 18:48:02 -0500 Subject: [PATCH 17/88] release: 0.2.1 --- pyproject.toml | 2 +- s/lint | 2 +- tests/trout/views.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 8c5d534ef..0d2e1aab2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "django-types" -version = "0.2.0" +version = "0.2.1" description = "Type subs for Django" repository = "https://github.com/sbdchd/django-types" readme = "README.md" diff --git a/s/lint b/s/lint index 30d3c44f6..5ddacd870 100755 --- a/s/lint +++ b/s/lint @@ -2,7 +2,7 @@ set -ex -if [[ ! -f ./.venv/lib/python3.7/site-packages/django-types.egg-link ]]; then +if [[ ! -f ./.venv/lib/python3.7/site-packages/django-stubs.egg-link ]]; then ./.venv/bin/pip install -e . fi diff --git a/tests/trout/views.py b/tests/trout/views.py index 91ea44a21..fd0e04495 100644 --- a/tests/trout/views.py +++ b/tests/trout/views.py @@ -1,3 +1,3 @@ -from django.shortcuts import render +# from django.shortcuts import render # Create your views here. From ef75c0a8c45748cc40470079d2b640315e32f306 Mon Sep 17 00:00:00 2001 From: Steve Dignam Date: Sat, 12 Dec 2020 20:25:10 -0500 Subject: [PATCH 18/88] update(docs): readme with info about defining FK id fields --- README.md | 21 +++++++++++++++++++++ pyproject.toml | 2 +- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index c9bd9d8c9..aa11bab94 100644 --- a/README.md +++ b/README.md @@ -50,6 +50,27 @@ reveal_type(User.objects.all().first()) # note: Revealed type is 'Optional[User]' ``` +### ForeignKey ids as properties in ORM models + +When defining a Django ORM model with a foreign key, like so: + +```python +class User(models.Model): + team = models.ForeignKey("Team", null=True, on_delete=models.SET_NULL) +``` + +two properties are created, `team` as expected, and `team_id`. In order for +mypy to know about the id property we need to define it manually as follows: + +```python +from typing import TYPE_CHECKING + +class User(models.Model): + team = models.ForeignKey("Team", null=True, on_delete=models.SET_NULL) + if TYPE_CHECKING: + team_id: int +``` + ### `HttpRequest`'s `user` property The `HttpRequest`'s `user` property has a type of `Union[AbstractBaseUser, AnonymousUser]`, diff --git a/pyproject.toml b/pyproject.toml index 0d2e1aab2..6c6875f12 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,7 @@ [tool.poetry] name = "django-types" version = "0.2.1" -description = "Type subs for Django" +description = "Type stubs for Django" repository = "https://github.com/sbdchd/django-types" readme = "README.md" authors = ["Steve Dignam "] From e1cb3d4ba8ecd8c0f0e717924682e507926a27e1 Mon Sep 17 00:00:00 2001 From: Steve Dignam Date: Mon, 18 Jan 2021 17:59:50 -0500 Subject: [PATCH 19/88] add: basic pyscopg2 type stubs Add basic psycopg2 type stubs and type more of django's raw sql related methods, e.g.: ``` with connection.cursor() as cur: cur.execute("select 1") ``` Add some other dev dependencies to make figuring out the types easier. --- django-stubs/db/__init__.pyi | 7 +- django-stubs/db/backends/utils.pyi | 101 +++++++++- django-stubs/db/utils.pyi | 4 +- mypy.ini | 2 +- poetry.lock | 165 ++++++++++++++- psycopg2-stubs/__init__.pyi | 71 +++++++ psycopg2-stubs/errors.pyi | 1 + psycopg2-stubs/extensions.pyi | 309 +++++++++++++++++++++++++++++ psycopg2-stubs/tz.pyi | 13 ++ pyproject.toml | 3 + tests/trout/models.py | 188 +++++++++++++++++- tox.ini | 47 +++++ 12 files changed, 894 insertions(+), 17 deletions(-) create mode 100644 psycopg2-stubs/__init__.pyi create mode 100644 psycopg2-stubs/errors.pyi create mode 100644 psycopg2-stubs/extensions.pyi create mode 100644 psycopg2-stubs/tz.pyi create mode 100644 tox.ini diff --git a/django-stubs/db/__init__.pyi b/django-stubs/db/__init__.pyi index a974ffdb1..681a5ff2f 100644 --- a/django-stubs/db/__init__.pyi +++ b/django-stubs/db/__init__.pyi @@ -1,5 +1,7 @@ from typing import Any +from django.db.backends.utils import CursorWrapper + from . import migrations from .utils import DEFAULT_DB_ALIAS as DEFAULT_DB_ALIAS from .utils import DJANGO_VERSION_PICKLE_KEY as DJANGO_VERSION_PICKLE_KEY @@ -15,11 +17,12 @@ from .utils import NotSupportedError as NotSupportedError from .utils import OperationalError as OperationalError from .utils import ProgrammingError as ProgrammingError -connections: Any +connections: ConnectionHandler router: Any -connection: Any +connection: DefaultConnectionProxy class DefaultConnectionProxy: + def cursor(self) -> CursorWrapper: ... def __getattr__(self, item: str) -> Any: ... def __setattr__(self, name: str, value: Any) -> None: ... def __delattr__(self, name: str) -> None: ... diff --git a/django-stubs/db/backends/utils.pyi b/django-stubs/db/backends/utils.pyi index 115c6cf53..5a2aadffa 100644 --- a/django-stubs/db/backends/utils.pyi +++ b/django-stubs/db/backends/utils.pyi @@ -1,21 +1,41 @@ import types from datetime import date, datetime, time from decimal import Decimal -from typing import Any, Dict, List, Mapping, Optional, Sequence, Tuple, Type, Union +from typing import ( + IO, + Any, + Dict, + Iterable, + Iterator, + List, + Mapping, + Optional, + Sequence, + Tuple, + Type, + Union, +) from uuid import UUID +import psycopg2 +from django.db.backends.postgresql.base import DatabaseWrapper +from psycopg2.extensions import Column +from typing_extensions import Literal + logger: Any # Python types that can be adapted to SQL. _SQLType = Union[None, bool, int, float, Decimal, str, bytes, datetime, UUID] class CursorWrapper: - cursor: Any = ... - db: Any = ... - def __init__(self, cursor: Any, db: Any) -> None: ... + cursor: psycopg2.extensions.cursor = ... + db: DatabaseWrapper = ... + def __init__( + self, cursor: psycopg2.extensions.cursor, db: DatabaseWrapper + ) -> None: ... WRAP_ERROR_ATTRS: Any = ... - def __getattr__(self, attr: str) -> Any: ... - def __iter__(self) -> None: ... + def __iter__(self) -> Iterator[Tuple[Any, ...]]: ... + def __next__(self) -> Tuple[Any, ...]: ... def __enter__(self) -> CursorWrapper: ... def __exit__( self, @@ -24,20 +44,81 @@ class CursorWrapper: tb: Optional[types.TracebackType], ) -> None: ... def callproc( - self, procname: str, params: List[Any] = ..., kparams: Dict[str, int] = ... - ) -> Any: ... + self, + procname: str, + params: Optional[List[_SQLType]] = ..., + kparams: Optional[Mapping[str, int]] = ..., + ) -> None: ... def execute( self, sql: str, params: Optional[Union[Sequence[_SQLType], Mapping[str, _SQLType]]] = ..., - ) -> Optional[Any]: ... + ) -> None: ... def executemany( self, sql: str, param_list: Sequence[ Optional[Union[Sequence[_SQLType], Mapping[str, _SQLType]]] ], - ) -> Optional[Any]: ... + ) -> None: ... + # copied over from psycopg2 since Django uses __getattr__ to proxy calls + @property + def description(self) -> Optional[Tuple[Column, ...]]: ... + def close(self) -> None: ... + @property + def closed(self) -> bool: ... + @property + def connection(self) -> psycopg2.extensions.connection: ... + @property + def name(self) -> Optional[str]: ... + scrollable: Optional[bool] + withhold: bool + def mogrify( + self, + operation: str, + parameters: Optional[Union[Sequence[_SQLType], Mapping[str, _SQLType]]] = ..., + ) -> bytes: ... + def setinputsizes(self, sizes: int) -> None: ... + def fetchone(self) -> Optional[Tuple[Any, ...]]: ... + def fetchmany(self, size: int = ...) -> List[Tuple[Any, ...]]: ... + def fetchall(self) -> List[Tuple[Any, ...]]: ... + def scroll( + self, value: int, mode: Union[Literal["relative"], Literal["absolute"]] = ... + ) -> None: ... + arraysize: int + itersize: int + @property + def rowcount(self) -> int: ... + @property + def rownumber(self) -> int: ... + @property + def lastrowid(self) -> Optional[int]: ... + @property + def query(self) -> Optional[str]: ... + @property + def statusmessage(self) -> Optional[str]: ... + def cast(self, oid: int, s: str) -> Any: ... + tzinfo_factory: Any + def nextset(self) -> None: ... + def setoutputsize(self, size: int, column: int = ...) -> None: ... + def copy_from( + self, + file: IO[str], + table: str, + sep: str = ..., + null: str = ..., + size: int = ..., + columns: Optional[Iterable[str]] = ..., + ) -> None: ... + def copy_to( + self, + file: IO[str], + table: str, + sep: str = ..., + null: str = ..., + columns: Optional[str] = ..., + ) -> None: ... + def copy_expert(self, sql: str, file: IO[str], size: int = ...) -> None: ... class CursorDebugWrapper(CursorWrapper): cursor: Any diff --git a/django-stubs/db/utils.pyi b/django-stubs/db/utils.pyi index b41b8c920..251199ddd 100644 --- a/django-stubs/db/utils.pyi +++ b/django-stubs/db/utils.pyi @@ -1,5 +1,7 @@ from typing import Any, Dict, Iterable, List, Optional +from django.db import DefaultConnectionProxy + DEFAULT_DB_ALIAS: str DJANGO_VERSION_PICKLE_KEY: str @@ -24,7 +26,7 @@ class ConnectionHandler: ) -> None: ... def ensure_defaults(self, alias: str) -> None: ... def prepare_test_settings(self, alias: str) -> None: ... - def __getitem__(self, alias: str) -> Any: ... + def __getitem__(self, alias: str) -> DefaultConnectionProxy: ... def __setitem__(self, key: Any, value: Any) -> None: ... def __delitem__(self, key: Any) -> None: ... def __iter__(self): ... diff --git a/mypy.ini b/mypy.ini index f71a6e037..0749c850f 100644 --- a/mypy.ini +++ b/mypy.ini @@ -6,7 +6,7 @@ show_error_codes = True disallow_any_unimported=True disallow_any_expr=False disallow_any_decorated=True -disallow_any_explicit=True +disallow_any_explicit=False disallow_any_generics=True disallow_subclassing_any=True diff --git a/poetry.lock b/poetry.lock index 1e362e476..81a66b9e6 100644 --- a/poetry.lock +++ b/poetry.lock @@ -6,6 +6,15 @@ optional = false python-versions = "*" version = "1.4.4" +[[package]] +category = "dev" +description = "Disable App Nap on macOS >= 10.9" +marker = "sys_platform == \"darwin\"" +name = "appnope" +optional = false +python-versions = "*" +version = "0.1.2" + [[package]] category = "dev" description = "ASGI specs, helper code, and adapters" @@ -31,6 +40,14 @@ optional = false python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" version = "20.3.0" +[[package]] +category = "dev" +description = "Specifications for callback functions passed in to an API" +name = "backcall" +optional = false +python-versions = "*" +version = "0.2.0" + [[package]] category = "dev" description = "The uncompromising code formatter." @@ -66,6 +83,14 @@ optional = false python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*" version = "0.4.4" +[[package]] +category = "dev" +description = "Decorators for Humans" +name = "decorator" +optional = false +python-versions = ">=2.6, !=3.0.*, !=3.1.*" +version = "4.4.2" + [[package]] category = "dev" description = "A high-level Python Web framework that encourages rapid development and clean, pragmatic design." @@ -116,6 +141,35 @@ optional = false python-versions = "*" version = "1.1.1" +[[package]] +category = "dev" +description = "IPython: Productive Interactive Computing" +name = "ipython" +optional = false +python-versions = ">=3.7" +version = "7.19.0" + +[package.dependencies] +appnope = "*" +backcall = "*" +colorama = "*" +decorator = "*" +jedi = ">=0.10" +pexpect = ">4.3" +pickleshare = "*" +prompt-toolkit = ">=2.0.0,<3.0.0 || >3.0.0,<3.0.1 || >3.0.1,<3.1.0" +pygments = "*" +setuptools = ">=18.5" +traitlets = ">=4.2" + +[[package]] +category = "dev" +description = "Vestigial utilities from IPython" +name = "ipython-genutils" +optional = false +python-versions = "*" +version = "0.2.0" + [[package]] category = "dev" description = "A Python utility / library to sort Python imports." @@ -124,6 +178,17 @@ optional = false python-versions = ">=3.6,<4.0" version = "5.6.4" +[[package]] +category = "dev" +description = "An autocompletion tool for Python that can be used for text editors." +name = "jedi" +optional = false +python-versions = ">=3.6" +version = "0.18.0" + +[package.dependencies] +parso = ">=0.8.0,<0.9.0" + [[package]] category = "dev" description = "McCabe checker, plugin for flake8" @@ -165,6 +230,14 @@ version = "20.4" pyparsing = ">=2.0.2" six = "*" +[[package]] +category = "dev" +description = "A Python Parser" +name = "parso" +optional = false +python-versions = ">=3.6" +version = "0.8.1" + [[package]] category = "dev" description = "Utility library for gitignore style pattern matching of file paths." @@ -173,6 +246,26 @@ optional = false python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*" version = "0.8.1" +[[package]] +category = "dev" +description = "Pexpect allows easy control of interactive console applications." +marker = "sys_platform != \"win32\"" +name = "pexpect" +optional = false +python-versions = "*" +version = "4.8.0" + +[package.dependencies] +ptyprocess = ">=0.5" + +[[package]] +category = "dev" +description = "Tiny 'shelve'-like database with concurrency support" +name = "pickleshare" +optional = false +python-versions = "*" +version = "0.7.5" + [[package]] category = "dev" description = "plugin and hook calling mechanisms for python" @@ -186,6 +279,34 @@ version = "0.13.1" python = "<3.8" version = ">=0.12" +[[package]] +category = "dev" +description = "Library for building powerful interactive command lines in Python" +name = "prompt-toolkit" +optional = false +python-versions = ">=3.6.1" +version = "3.0.10" + +[package.dependencies] +wcwidth = "*" + +[[package]] +category = "dev" +description = "psycopg2 - Python-PostgreSQL Database Adapter" +name = "psycopg2" +optional = false +python-versions = ">=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*" +version = "2.8.6" + +[[package]] +category = "dev" +description = "Run a subprocess in a pseudo terminal" +marker = "sys_platform != \"win32\"" +name = "ptyprocess" +optional = false +python-versions = "*" +version = "0.7.0" + [[package]] category = "dev" description = "library with cross-python path, ini-parsing, io, code, log facilities" @@ -210,6 +331,14 @@ optional = false python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" version = "2.2.0" +[[package]] +category = "dev" +description = "Pygments is a syntax highlighting package written in Python." +name = "pygments" +optional = false +python-versions = ">=3.5" +version = "2.7.4" + [[package]] category = "dev" description = "Python parsing module" @@ -280,6 +409,17 @@ optional = false python-versions = ">=2.6, !=3.0.*, !=3.1.*, !=3.2.*" version = "0.10.2" +[[package]] +category = "dev" +description = "Traitlets Python configuration system" +name = "traitlets" +optional = false +python-versions = ">=3.7" +version = "5.0.5" + +[package.dependencies] +ipython-genutils = "*" + [[package]] category = "dev" description = "a fork of Python 2 and 3 ast modules with type comment support" @@ -296,6 +436,14 @@ optional = false python-versions = "*" version = "3.7.4.3" +[[package]] +category = "dev" +description = "Measures the displayed width of unicode strings in a terminal" +name = "wcwidth" +optional = false +python-versions = "*" +version = "0.2.5" + [[package]] category = "dev" description = "A built-package format for Python" @@ -314,31 +462,44 @@ python-versions = ">=3.6" version = "3.4.0" [metadata] -content-hash = "7aff51acdb55e93b2fdaedb6010af2ceced541985adc145ec99faee5e66c67f9" +content-hash = "224d1d4c83164b64970e2452293d49093f85bac1db146e7d1a96904adc3716ca" python-versions = "^3.7" [metadata.hashes] appdirs = ["7d5d0167b2b1ba821647616af46a749d1c653740dd0d2415100fe26e27afdf41", "a841dacd6b99318a741b166adb07e19ee71a274450e68237b4650ca1055ab128"] +appnope = ["93aa393e9d6c54c5cd570ccadd8edad61ea0c4b9ea7a01409020c9aa019eb442", "dd83cd4b5b460958838f6eb3000c660b1f9caf2a5b1de4264e941512f603258a"] asgiref = ["5ee950735509d04eb673bd7f7120f8fa1c9e2df495394992c73234d526907e17", "7162a3cb30ab0609f1a4c95938fd73e8604f63bdba516a7f7d64b83ff09478f0"] atomicwrites = ["6d1784dea7c0c8d4a5172b6c620f40b6e4cbfdf96d783691f2e1302a7b88e197", "ae70396ad1a434f9c7046fd2dd196fc04b12f9e91ffb859164193be8b6168a7a"] attrs = ["31b2eced602aa8423c2aea9c76a724617ed67cf9513173fd3a4f03e3a929c7e6", "832aa3cde19744e49938b91fea06d69ecb9e649c93ba974535d08ad92164f700"] +backcall = ["5cbdbf27be5e7cfadb448baf0aa95508f91f2bbc6c6437cd9cd06e2a4c215e1e", "fbbce6a29f263178a1f7915c1940bde0ec2b2a967566fe1c65c1dfb7422bd255"] black = ["1c02557aa099101b9d21496f8a914e9ed2222ef70336404eeeac8edba836fbea"] click = ["d2b5255c7c6349bc1bd1e59e08cd12acbbd63ce649f2588755783aa94dfb6b1a", "dacca89f4bfadd5de3d7489b7c8a566eee0d3676333fbb50030263894c38c0dc"] colorama = ["5941b2b48a20143d2267e95b1c2a7603ce057ee39fd88e7329b0c292aa16869b", "9f47eda37229f68eee03b24b9748937c7dc3868f906e8ba69fbcbdd3bc5dc3e2"] +decorator = ["41fa54c2a0cc4ba648be4fd43cff00aedf5b9465c9bf18d64325bc225f08f760", "e3a62f0520172440ca0dcc823749319382e377f37f140a0b99ef45fecb84bfe7"] django = ["14a4b7cd77297fba516fc0d92444cc2e2e388aa9de32d7a68d4a83d58f5a4927", "14b87775ffedab2ef6299b73343d1b4b41e5d4e2aa58c6581f114dbec01e3f8f"] flake8 = ["749dbbd6bfd0cf1318af27bf97a14e28e5ff548ef8e5b1566ccfb25a11e7c839", "aadae8761ec651813c24be05c6f7b4680857ef6afaae4651a4eccaef97ce6c3b"] importlib-metadata = ["590690d61efdd716ff82c39ca9a9d4209252adfe288a4b5721181050acbd4175", "d9b8a46a0885337627a6430db287176970fff18ad421becec1d64cfc763c2099"] iniconfig = ["011e24c64b7f47f6ebd835bb12a743f2fbe9a26d4cecaa7f53bc4f35ee9da8b3", "bc3af051d7d14b2ee5ef9969666def0cd1a000e121eaea580d4a313df4b37f32"] +ipython = ["c987e8178ced651532b3b1ff9965925bfd445c279239697052561a9ab806d28f", "cbb2ef3d5961d44e6a963b9817d4ea4e1fa2eb589c371a470fed14d8d40cbd6a"] +ipython-genutils = ["72dd37233799e619666c9f639a9da83c34013a73e8bbc79a7a6348d93c61fab8", "eb2e116e75ecef9d4d228fdc66af54269afa26ab4463042e33785b887c628ba8"] isort = ["dcab1d98b469a12a1a624ead220584391648790275560e1a43e54c5dceae65e7", "dcaeec1b5f0eca77faea2a35ab790b4f3680ff75590bfcb7145986905aab2f58"] +jedi = ["18456d83f65f400ab0c2d3319e48520420ef43b23a086fdc05dff34132f0fb93", "92550a404bad8afed881a137ec9a461fed49eca661414be45059329614ed0707"] mccabe = ["ab8a6258860da4b6677da4bd2fe5dc2c659cff31b3ee4f7f5d64e79735b80d42", "dd8d182285a0fe56bace7f45b5e7d1a6ebcbf524e8f3bd87eb0f125271b8831f"] mypy = ["0a0d102247c16ce93c97066443d11e2d36e6cc2a32d8ccc1f705268970479324", "0d34d6b122597d48a36d6c59e35341f410d4abfa771d96d04ae2c468dd201abc", "2170492030f6faa537647d29945786d297e4862765f0b4ac5930ff62e300d802", "2842d4fbd1b12ab422346376aad03ff5d0805b706102e475e962370f874a5122", "2b21ba45ad9ef2e2eb88ce4aeadd0112d0f5026418324176fd494a6824b74975", "72060bf64f290fb629bd4a67c707a66fd88ca26e413a91384b18db3876e57ed7", "af4e9ff1834e565f1baa74ccf7ae2564ae38c8df2a85b057af1dbbc958eb6666", "bd03b3cf666bff8d710d633d1c56ab7facbdc204d567715cb3b9f85c6e94f669", "c614194e01c85bb2e551c421397e49afb2872c88b5830e3554f0519f9fb1c178", "cf4e7bf7f1214826cf7333627cb2547c0db7e3078723227820d0a2490f117a01", "da56dedcd7cd502ccd3c5dddc656cb36113dd793ad466e894574125945653cea", "e86bdace26c5fe9cf8cb735e7cedfe7850ad92b327ac5d797c656717d2ca66de", "e97e9c13d67fbe524be17e4d8025d51a7dca38f90de2e462243ab8ed8a9178d1", "eea260feb1830a627fb526d22fbb426b750d9f5a47b624e8d5e7e004359b219c"] mypy-extensions = ["090fedd75945a69ae91ce1303b5824f428daf5a028d2f6ab8a299250a846f15d", "2d82818f5bb3e369420cb3c4060a7970edba416647068eb4c5343488a6c604a8"] packaging = ["4357f74f47b9c12db93624a82154e9b120fa8293699949152b22065d556079f8", "998416ba6962ae7fbd6596850b80e17859a5753ba17c32284f67bfff33784181"] +parso = ["15b00182f472319383252c18d5913b69269590616c947747bc50bf4ac768f410", "8519430ad07087d4c997fda3a7918f7cfa27cb58972a8c89c2a0295a1c940e9e"] pathspec = ["86379d6b86d75816baba717e64b1a3a3469deb93bb76d613c9ce79edc5cb68fd", "aa0cb481c4041bf52ffa7b0d8fa6cd3e88a2ca4879c533c9153882ee2556790d"] +pexpect = ["0b48a55dcb3c05f3329815901ea4fc1537514d6ba867a152b581d69ae3710937", "fc65a43959d153d0114afe13997d439c22823a27cefceb5ff35c2178c6784c0c"] +pickleshare = ["87683d47965c1da65cdacaf31c8441d12b8044cdec9aca500cd78fc2c683afca", "9649af414d74d4df115d5d718f82acb59c9d418196b7b4290ed47a12ce62df56"] pluggy = ["15b2acde666561e1298d71b523007ed7364de07029219b604cf808bfa1c765b0", "966c145cd83c96502c3c3868f50408687b38434af77734af1e9ca461a4081d2d"] +prompt-toolkit = ["ac329c69bd8564cb491940511957312c7b8959bb5b3cf3582b406068a51d5bb7", "b8b3d0bde65da350290c46a8f54f336b3cbf5464a4ac11239668d986852e79d5"] +psycopg2 = ["00195b5f6832dbf2876b8bf77f12bdce648224c89c880719c745b90515233301", "068115e13c70dc5982dfc00c5d70437fe37c014c808acce119b5448361c03725", "26e7fd115a6db75267b325de0fba089b911a4a12ebd3d0b5e7acb7028bc46821", "56007a226b8e95aa980ada7abdea6b40b75ce62a433bd27cec7a8178d57f4051", "56fee7f818d032f802b8eed81ef0c1232b8b42390df189cab9cfa87573fe52c5", "6a3d9efb6f36f1fe6aa8dbb5af55e067db802502c55a9defa47c5a1dad41df84", "a49833abfdede8985ba3f3ec641f771cca215479f41523e99dace96d5b8cce2a", "ad2fe8a37be669082e61fb001c185ffb58867fdbb3e7a6b0b0d2ffe232353a3e", "b8cae8b2f022efa1f011cc753adb9cbadfa5a184431d09b273fb49b4167561ad", "d160744652e81c80627a909a0e808f3c6653a40af435744de037e3172cf277f5", "f22ea9b67aea4f4a1718300908a2fb62b3e4276cf00bd829a97ab5894af42ea3", "f974c96fca34ae9e4f49839ba6b78addf0346777b46c4da27a7bf54f48d3057d", "fb23f6c71107c37fd667cb4ea363ddeb936b348bbd6449278eb92c189699f543"] +ptyprocess = ["4b41f3967fce3af57cc7e94b888626c18bf37a083e3651ca8feeb66d492fef35", "5c5d0a3b48ceee0b48485e0c26037c0acd7d29765ca3fbb5cb3831d347423220"] py = ["366389d1db726cd2fcfc79732e75410e5fe4d31db13692115529d34069a043c2", "9ca6883ce56b4e8da7e79ac18787889fa5206c79dcc67fb065376cd2fe03f342"] pycodestyle = ["2295e7b2f6b5bd100585ebcb1f616591b652db8a741695b3d8f5d28bdc934367", "c58a7d2815e0e8d7972bf1803331fb0152f867bd89adf8a01dfd55085434192e"] pyflakes = ["0d94e0e05a19e57a99444b6ddcf9a6eb2e5c68d3ca1e98e90707af8152c90a92", "35b2d75ee967ea93b55750aa9edbbf72813e06a66ba54438df2cfac9e3c27fc8"] +pygments = ["bc9591213a8f0e0ca1a5e68a479b4887fdc3e75d0774e5c71c31920c427de435", "df49d09b498e83c1a73128295860250b0b7edd4c723a32e9bc0d295c7c2ec337"] pyparsing = ["c203ec8783bf771a155b207279b9bccb8dea02d8f0c9e5f8ead507bc3246ecc1", "ef9d7589ef3c200abe66653d3f1ab1033c3c419ae9b9bdb1240a85b024efc88b"] pytest = ["4288fed0d9153d9646bfcdf0c0428197dba1ecb27a33bb6e031d002fa88653fe", "c0a7e94a8cdbc5422a51ccdad8e6f1024795939cc89159a0ae7f0b316ad3823e"] pytz = ["3e6b7dd2d1e0a59084bcee14a17af60c5c562cdc16d828e8eba2e683d3a7e268", "5c55e189b682d420be27c6995ba6edce0c0a77dd67bfbe2ae6607134d5851ffd"] @@ -346,7 +507,9 @@ regex = ["02951b7dacb123d8ea6da44fe45ddd084aa6777d4b2454fa0da61d569c6fa538", "0d six = ["30639c035cdb23534cd4aa2dd52c3bf48f06e5f4a941509c8bafd8ce11080259", "8b74bedcbbbaca38ff6d7491d76f2b06b3592611af620f8426e82dddb04a5ced"] sqlparse = ["017cde379adbd6a1f15a61873f43e8274179378e95ef3fede90b5aa64d304ed0", "0f91fd2e829c44362cbcfab3e9ae12e22badaa8a29ad5ff599f9ec109f0454e8"] toml = ["806143ae5bfb6a3c6e736a764057db0e6a0e05e338b5630894a5f779cabb4f9b", "b3bda1d108d5dd99f4a20d24d9c348e91c4db7ab1b749200bded2f839ccbe68f"] +traitlets = ["178f4ce988f69189f7e523337a3e11d91c786ded9360174a3d9ca83e79bc5396", "69ff3f9d5351f31a7ad80443c2674b7099df13cc41fc5fa6e2f6d3b0330b0426"] typed-ast = ["0666aa36131496aed8f7be0410ff974562ab7eeac11ef351def9ea6fa28f6355", "0c2c07682d61a629b68433afb159376e24e5b2fd4641d35424e462169c0a7919", "249862707802d40f7f29f6e1aad8d84b5aa9e44552d2cc17384b209f091276aa", "24995c843eb0ad11a4527b026b4dde3da70e1f2d8806c99b7b4a7cf491612652", "269151951236b0f9a6f04015a9004084a5ab0d5f19b57de779f908621e7d8b75", "4083861b0aa07990b619bd7ddc365eb7fa4b817e99cf5f8d9cf21a42780f6e01", "498b0f36cc7054c1fead3d7fc59d2150f4d5c6c56ba7fb150c013fbc683a8d2d", "4e3e5da80ccbebfff202a67bf900d081906c358ccc3d5e3c8aea42fdfdfd51c1", "6daac9731f172c2a22ade6ed0c00197ee7cc1221aa84cfdf9c31defeb059a907", "715ff2f2df46121071622063fc7543d9b1fd19ebfc4f5c8895af64a77a8c852c", "73d785a950fc82dd2a25897d525d003f6378d1cb23ab305578394694202a58c3", "8c8aaad94455178e3187ab22c8b01a3837f8ee50e09cf31f1ba129eb293ec30b", "8ce678dbaf790dbdb3eba24056d5364fb45944f33553dd5869b7580cdbb83614", "aaee9905aee35ba5905cfb3c62f3e83b3bec7b39413f0a7f19be4e547ea01ebb", "bcd3b13b56ea479b3650b82cabd6b5343a625b0ced5429e4ccad28a8973f301b", "c9e348e02e4d2b4a8b2eedb48210430658df6951fa484e59de33ff773fbd4b41", "d205b1b46085271b4e15f670058ce182bd1199e56b317bf2ec004b6a44f911f6", "d43943ef777f9a1c42bf4e552ba23ac77a6351de620aa9acf64ad54933ad4d34", "d5d33e9e7af3b34a40dc05f498939f0ebf187f07c385fd58d591c533ad8562fe", "fc0fea399acb12edbf8a628ba8d2312f583bdbdb3335635db062fa98cf71fca4", "fe460b922ec15dd205595c9b5b99e2f056fd98ae8f9f56b888e7a17dc2b757e7"] typing-extensions = ["7cb407020f00f7bfc3cb3e7881628838e69d8f3fcab2f64742a5e76b2f841918", "99d4073b617d30288f569d3f13d2bd7548c3a7e4c8de87db09a9d29bb3a4a60c", "dafc7639cde7f1b6e1acc0f457842a83e722ccca8eef5270af2d74792619a89f"] +wcwidth = ["beb4802a9cebb9144e99086eff703a642a13d6a0052920003a230f3294bbe784", "c4d647b99872929fdb7bdcaa4fbe7f01413ed3d98077df798530e5b04f116c83"] wheel = ["497add53525d16c173c2c1c733b8f655510e909ea78cc0e29d374243544b77a2", "99a22d87add3f634ff917310a3d87e499f19e663413a52eb9232c447aa646c9f"] zipp = ["102c24ef8f171fd729d46599845e95c7ab894a4cf45f5de11a44cc7444fb1108", "ed5eee1974372595f9e416cc7bbeeb12335201d8081ca8a0743c954d4446e5cb"] diff --git a/psycopg2-stubs/__init__.pyi b/psycopg2-stubs/__init__.pyi new file mode 100644 index 000000000..1456a5c18 --- /dev/null +++ b/psycopg2-stubs/__init__.pyi @@ -0,0 +1,71 @@ +from typing import Any, Optional + +from psycopg2 import errors as errors +from psycopg2 import extensions as extensions +from psycopg2 import tz as tz + +paramstyle: str +threadsafety: int + +def connect( + dsn: Optional[str] = ..., + connection_factory: Optional[Any] = ..., + cursor_factor: Optional[Any] = ..., + async_: bool = ..., + dbname: str = ..., + user: str = ..., + password: str = ..., + host: str = ..., + port: str = ..., + **kwargs: str +) -> extensions.connection: ... + +class Warning(Exception): ... + +class Error(Exception): + @property + def pgerror(self) -> Optional[str]: ... + @property + def pgcode(self) -> Optional[str]: ... + @property + def cursor(self) -> Optional[extensions.cursor]: ... + @property + def diag(self) -> extensions.Diagnostics: ... + +class InterfaceError(Error): ... +class DatabaseError(Error): ... +class DataError(DatabaseError): ... +class OperationalError(DatabaseError): ... +class IntegrityError(DatabaseError): ... +class InternalError(DatabaseError): ... +class ProgrammingError(DatabaseError): ... +class NotSupportedError(DatabaseError): ... + +class Date: + def __init__(self, year: int, month: int, day: int) -> None: ... + +class Time: + def __init__(self, hour: int, minute: int, second: int) -> None: ... + +class Timestamp: + def __init__( + self, year: int, month: int, day: int, hour: int, minute: int, second: int + ) -> None: ... + +class DateFromTicks: + def __init__(self, ticks: int) -> None: ... + +class TimeFromTicks: + def __init__(self, ticks: int) -> None: ... + +class TimestampFromTicks: + def __init__(self, ticks: int) -> None: ... + +class Binary: + def __init__(self, string: bytes) -> None: ... + +class STRING: ... +class BINARY: ... +class NUMBER: ... +class DATETIME: ... +class ROWID: ... diff --git a/psycopg2-stubs/errors.pyi b/psycopg2-stubs/errors.pyi new file mode 100644 index 000000000..ad015ebe5 --- /dev/null +++ b/psycopg2-stubs/errors.pyi @@ -0,0 +1 @@ +def lookup(code: str) -> Exception: ... diff --git a/psycopg2-stubs/extensions.pyi b/psycopg2-stubs/extensions.pyi new file mode 100644 index 000000000..8df89c6bf --- /dev/null +++ b/psycopg2-stubs/extensions.pyi @@ -0,0 +1,309 @@ +from __future__ import annotations + +from datetime import datetime +from decimal import Decimal +from typing import ( + IO, + Any, + Dict, + Iterable, + Iterator, + List, + Mapping, + NamedTuple, + Optional, + Sequence, + Tuple, + Union, +) +from uuid import UUID + +from typing_extensions import Literal + +ISOLATION_LEVEL_AUTOCOMMIT: Literal[0] +ISOLATION_LEVEL_READ_UNCOMMITTED: Literal[4] +ISOLATION_LEVEL_READ_COMMITTED: Literal[1] +ISOLATION_LEVEL_REPEATABLE_READ: Literal[2] +ISOLATION_LEVEL_SERIALIZABLE: Literal[3] +ISOLATION_LEVEL_DEFAULT: None + +STATUS_SETUP: Literal[0] +STATUS_READY: Literal[1] +STATUS_BEGIN: Literal[2] +STATUS_SYNC: Literal[3] +STATUS_ASYNC: Literal[4] +STATUS_PREPARED: Literal[5] + +STATUS_IN_TRANSACTION: Literal[2] + +POLL_OK: Literal[0] +POLL_READ: Literal[1] +POLL_WRITE: Literal[2] +POLL_ERROR: Literal[3] + +_PollConstants = Literal[0, 1, 2, 3] + +TRANSACTION_STATUS_IDLE: Literal[0] +TRANSACTION_STATUS_ACTIVE: Literal[1] +TRANSACTION_STATUS_INTRANS: Literal[2] +TRANSACTION_STATUS_INERROR: Literal[3] +TRANSACTION_STATUS_UNKNOWN: Literal[4] + +_TransactionStatus = Literal[0, 1, 2, 3, 4] + +_SQLType = Union[None, bool, int, float, Decimal, str, bytes, datetime, UUID] + +class cursor: + def __init__(self, conn: _connection) -> None: ... + @property + def description(self) -> Optional[Tuple[Column, ...]]: ... + def close(self) -> None: ... + @property + def closed(self) -> bool: ... + @property + def connection(self) -> _connection: ... + @property + def name(self) -> Optional[str]: ... + scrollable: Optional[bool] + withhold: bool + def execute( + self, + query: str, + vars: Optional[Union[Sequence[_SQLType], Mapping[str, _SQLType]]] = ..., + ) -> None: ... + def executemany( + self, + query: str, + vars_list: Sequence[Union[Sequence[_SQLType], Mapping[str, _SQLType]]], + ) -> None: ... + def callproc( + self, + procname: str, + parameters: Union[Iterable[_SQLType], Mapping[str, _SQLType]] = ..., + ) -> None: ... + def mogrify( + self, + operation: str, + parameters: Optional[Union[Sequence[_SQLType], Mapping[str, _SQLType]]] = ..., + ) -> bytes: ... + def setinputsizes(self, sizes: int) -> None: ... + def fetchone(self) -> Optional[Tuple[Any, ...]]: ... + def fetchmany(self, size: int = ...) -> List[Tuple[Any, ...]]: ... + def fetchall(self) -> List[Tuple[Any, ...]]: ... + def scroll( + self, value: int, mode: Union[Literal["relative"], Literal["absolute"]] = ... + ) -> None: ... + arraysize: int + itersize: int + @property + def rowcount(self) -> int: ... + @property + def rownumber(self) -> int: ... + @property + def lastrowid(self) -> Optional[int]: ... + @property + def query(self) -> Optional[str]: ... + @property + def statusmessage(self) -> Optional[str]: ... + def cast(self, oid: int, s: str) -> Any: ... + tzinfo_factory: Any + def nextset(self) -> None: ... + def setoutputsize(self, size: int, column: int = ...) -> None: ... + def copy_from( + self, + file: IO[str], + table: str, + sep: str = ..., + null: str = ..., + size: int = ..., + columns: Optional[Iterable[str]] = ..., + ) -> None: ... + def copy_to( + self, + file: IO[str], + table: str, + sep: str = ..., + null: str = ..., + columns: Optional[str] = ..., + ) -> None: ... + def copy_expert(self, sql: str, file: IO[str], size: int = ...) -> None: ... + def __enter__(self) -> cursor: ... + def __exit__(self, exc_type: None, exc_value: None, traceback: None) -> None: ... + def __iter__(self) -> Iterator[Tuple[Any, ...]]: ... + def __next__(self) -> Tuple[Any, ...]: ... + +_cursor = cursor +_IsolationLevelsCodes = Literal[0, 1, 2, 3, 4] + +_IsolationLevels = Literal[ + "READ UNCOMMIITED", + "READ COMMITTED", + "REPEATABLE READ", + "SERIALIZABLE", + _IsolationLevelsCodes, +] + +class connection: + def __init__(self, dsn: str) -> None: ... + def cursor( + self, + name: Optional[str] = ..., + cursor_factory: Optional[Any] = ..., + scrollable: Optional[bool] = ..., + withhold: bool = ..., + ) -> _cursor: ... + def commit(self) -> None: ... + def rollback(self) -> None: ... + def close(self) -> None: ... + def xid(self, format_id: str, gtrid: str, bqual: Any) -> Xid: ... + def tpc_begin(self, xid: Union[str, Xid]) -> None: ... + def tpc_preparse(self) -> None: ... + def tpc_commit(self, xid: Union[str, Xid] = ...) -> None: ... + def tpc_rollback(self, xid: Union[str, Xid] = ...) -> None: ... + def tpc_recover(self) -> None: ... + @property + def closed(self) -> int: ... + def cancel(self) -> None: ... + def reset(self) -> None: ... + @property + def dsn(self) -> str: ... + def set_session( + self, + isolation_level: Optional[_IsolationLevels] = ..., + readonly: Optional[bool] = ..., + deferrable: Optional[bool] = ..., + autocommit: Optional[bool] = ..., + ) -> None: ... + autocommit: bool + isolation_level: _IsolationLevelsCodes + readonly: Optional[bool] + deferrable: Optional[bool] + def set_isolation_level(self, level: _IsolationLevelsCodes) -> None: ... + encoding: str + def set_client_encoding(self, enc: str) -> None: ... + @property + def notices(self) -> List[str]: ... + notifies: List[Notify] + cursor_factory: Any + info: ConnectionInfo + @property + def status(self) -> int: ... + def lobject( + self, + oid: int = ..., + mode: str = ..., + new_oid: int = ..., + new_file: Any = ..., + lobject_factory: Any = ..., + ) -> _lobject: ... + @property + def async_(self) -> Literal[0, 1]: ... + def poll(self) -> _PollConstants: ... + def fileno(self) -> Any: ... + def isexecuting(self) -> bool: ... + pgconn_ptr: Any + def get_native_connection(self) -> Any: ... + def get_transaction_status(self) -> _TransactionStatus: ... + @property + def protocol_version(self) -> int: ... + @property + def server_version(self) -> int: ... + def get_backend_pid(self) -> int: ... + def get_parameter_status(self, parameter: str) -> Optional[str]: ... + def get_dsn_parameters(self) -> Dict[str, str]: ... + def __enter__(self) -> connection: ... + def __exit__(self, exc_type: None, exc_value: None, traceback: None) -> None: ... + +class Xid: ... +class lobject: ... + +_lobject = lobject + +class Notify: + def __init__(self, pid: str, channel: str, payload: str) -> None: ... + channel: str + payload: str + pid: str + +_connection = connection + +class ConnectionInfo: + def __init__(self, connection: connection) -> None: ... + dbname: str + user: str + password: str + host: str + port: int + options: str + dsn_parameters: Dict[str, str] + status: int + transaction_status: int + def parameter_status(self, name: str) -> str: ... + protocol_version: int + server_version: int + error_message: Optional[str] + socket: int + backend_pid: int + needs_password: bool + used_password: bool + ssl_in_use: bool + def ssl_attribute(self, name: str) -> str: ... + ssl_attribute_names: List[str] + +class Column(NamedTuple): + name: Optional[str] + type_code: Optional[int] + display_size: Optional[int] + internal_size: Optional[int] + precision: Optional[int] + scale: Optional[int] + null_ok: None + table_column: Optional[str] + table_oid: Optional[int] + +class Diagnostics: + @property + def column_name(self) -> Optional[str]: ... + @property + def constraint_name(self) -> Optional[str]: ... + @property + def context(self) -> Optional[str]: ... + @property + def datatype_name(self) -> Optional[str]: ... + @property + def internal_position(self) -> Optional[str]: ... + @property + def internal_query(self) -> Optional[str]: ... + @property + def message_detail(self) -> Optional[str]: ... + @property + def message_hint(self) -> Optional[str]: ... + @property + def message_primary(self) -> Optional[str]: ... + @property + def schema_name(self) -> Optional[str]: ... + @property + def severity(self) -> Optional[str]: ... + @property + def severity_nonlocalized(self) -> Optional[str]: ... + @property + def source_file(self) -> Optional[str]: ... + @property + def source_function(self) -> Optional[str]: ... + @property + def source_line(self) -> Optional[str]: ... + @property + def sqlstate(self) -> Optional[str]: ... + @property + def statement_position(self) -> Optional[str]: ... + @property + def table_name(self) -> Optional[str]: ... + +def parse_dsn(dsn: str) -> Dict[str, str]: ... +def quote_ident(str: str, scope: Union[connection, cursor]) -> str: ... +def encrypt_password( + password: str, + user: str, + scope: Optional[Union[connection, cursor]] = ..., + algorithm: Optional[str] = ..., +) -> str: ... diff --git a/psycopg2-stubs/tz.pyi b/psycopg2-stubs/tz.pyi new file mode 100644 index 000000000..da8cdc061 --- /dev/null +++ b/psycopg2-stubs/tz.pyi @@ -0,0 +1,13 @@ +import datetime + +ZERO = datetime.timedelta(0) + +class FixedOffsetTimezone(datetime.tzinfo): ... + +STDOFFSET: datetime.timedelta +DSTOFFSET: datetime.timedelta +DSTDIFF: datetime.timedelta + +class LocalTimezone(datetime.tzinfo): ... + +LOCAL: LocalTimezone diff --git a/pyproject.toml b/pyproject.toml index 6c6875f12..c5a9f0200 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -10,6 +10,7 @@ keywords = ["django", "types", "mypy", "stubs"] packages = [ { include = "django-stubs" }, + { include = "psycopg2-stubs" }, ] [tool.poetry.dependencies] @@ -23,6 +24,8 @@ mypy = "^0.790.0" isort = "^5.6" django = "^3.1" flake8 = "^3.8" +psycopg2 = "^2.8" +ipython = "^7.19" [tool.black] line-length = 88 diff --git a/tests/trout/models.py b/tests/trout/models.py index 3194bbd44..b8a65b0b5 100644 --- a/tests/trout/models.py +++ b/tests/trout/models.py @@ -1,8 +1,12 @@ +import sys +from collections import namedtuple from datetime import time, timedelta from decimal import Decimal -from typing import Dict, List, Optional, Union +from io import StringIO +from typing import Any, Dict, List, NamedTuple, Optional, Tuple, Union from uuid import UUID +import psycopg2 from django.contrib.postgres.fields import ( ArrayField, CICharField, @@ -11,8 +15,11 @@ HStoreField, JSONField, ) -from django.db import models +from django.db import connection, connections, models +from django.db.backends.utils import CursorWrapper from django.db.models.manager import RelatedManager +from psycopg2 import ProgrammingError +from psycopg2.extensions import parse_dsn class User(models.Model): @@ -501,3 +508,180 @@ def main() -> None: print(comment.null_str_specified) if comment.null_str_specified is not None: print(comment.null_str_specified) + + +def raw_database_queries() -> None: + + with connection.cursor() as cursor: + cursor.execute("select 1;") + results = cursor.fetchall() + for r in results: + print(r) + + baz = "baz" + + cursor.execute("UPDATE bar SET foo = 1 WHERE baz = %s", [baz]) + cursor.execute("SELECT foo FROM bar WHERE baz = %(baz)s", {"baz": baz}) + row = cursor.fetchone() + print(row) + + cursor.executemany("select 1;", []) + + cursor.executemany( + "INSERT INTO table (id, name) VALUES (%s, %s)", + ((1, "a"), (2, "b"), (3, "c")), + ) + + cursor.executemany( + "INSERT INTO table (id, name) VALUES (%s, %s)", + [(1, "a"), (2, "b"), (3, "c")], + ) + + cursor.execute("SELECT id, parent_id FROM test LIMIT 2") + results = namedtuplefetchall(cursor) + print(results) + + cursor.execute("SELECT id, parent_id FROM test LIMIT 2") + results_2 = dictfetchall(cursor) + print(results_2) + + with connections["my_db_alias"].cursor() as cursor: + cursor.execute("select 1;") + + with connection.cursor() as cursor: + cursor.callproc("test_procedure", [1, "test"]) + + cursor.execute("SELECT * FROM test;") + for record in cursor: + print(record) + + +def test_psycopg2() -> None: + with connection.cursor() as cursor: + cur = cursor.cursor + cur.execute("SELECT * FROM test;") + for record in cur: + print(record) + + cur.execute("SELECT * FROM test WHERE id = %s", (3,)) + assert cur.fetchone() == (3, 42, "bar") + + cur.execute("SELECT * FROM test;") + assert cur.fetchmany(2) == [(1, 100, "abc'def"), (2, None, "dada")] + assert cur.fetchmany(2) == [(3, 42, "bar")] + assert cur.fetchmany(2) == [] + + cur.execute("SELECT * FROM test;") + assert cur.fetchall() == [ + (1, 100, "abc'def"), + (2, None, "dada"), + (3, 42, "bar"), + ] + + try: + cur.scroll(1000 * 1000) + except (ProgrammingError, IndexError) as exc: + print(exc) + + cur.arraysize = 10 + cur.itersize = 100 + + try: + cur.execute("SELECT * FROM barf") + except psycopg2.Error as e: + assert e.pgcode == "42P01" + assert e.pgerror == ( + """ +ERROR: relation "barf" does not exist +LINE 1: SELECT * FROM barf +""" + ) + + f = StringIO("42\tfoo\n74\tbar\n") + cur.copy_from(f, "test", columns=("num", "data")) + cur.execute("select * from test where id > 5;") + cur.fetchall() + cur.copy_from(f, '"TABLE"') + cur.copy_to(sys.stdout, "test", sep="|") + + cur.copy_expert("COPY test TO STDOUT WITH CSV HEADER", sys.stdout) + + conn = psycopg2.connect("dbname=test user=postgres password=secret") + conn = psycopg2.connect(dbname="test", user="postgres", password="secret") + + print(conn.isolation_level) + + with conn: + with conn.cursor() as curs: + curs.execute("select 1") + + with conn: + with conn.cursor() as curs: + curs.execute("select 2") + conn.close() + + assert parse_dsn("dbname=test user=postgres password=secret") == { + "password": "secret", + "user": "postgres", + "dbname": "test", + } + assert parse_dsn("postgresql://someone@example.com/somedb?connect_timeout=10") == { + "host": "example.com", + "user": "someone", + "dbname": "somedb", + "connect_timeout": "10", + } + + for name in connections: + cursor = connections[name].cursor() + cursor.execute("SELECT 1;") + assert cursor.fetchone() is not None + + +def test_psycopg_top_level_exports() -> None: + psycopg2.BINARY + psycopg2.Binary + psycopg2.DATETIME + psycopg2.DataError + psycopg2.DatabaseError + psycopg2.Date + psycopg2.DateFromTicks + psycopg2.Error + psycopg2.IntegrityError + psycopg2.InterfaceError + psycopg2.InternalError + psycopg2.NUMBER + psycopg2.NotSupportedError + psycopg2.OperationalError + psycopg2.ProgrammingError + psycopg2.ROWID + psycopg2.STRING + psycopg2.Time + psycopg2.TimeFromTicks + psycopg2.Timestamp + psycopg2.TimestampFromTicks + psycopg2.Warning + psycopg2.connect + psycopg2.errors + psycopg2.extensions + psycopg2.paramstyle + psycopg2.threadsafety + psycopg2.tz + + +def namedtuplefetchall(cursor: CursorWrapper) -> List[Tuple[Any, ...]]: + "Return all rows from a cursor as a namedtuple" + desc = cursor.description + assert desc is not None + nt_result = namedtuple("Result", [col[0] for col in desc]) # type: ignore [misc] + return [nt_result(*row) for row in cursor.fetchall()] + + +def dictfetchall(cursor: CursorWrapper) -> List[Dict[str, Any]]: + "Return all rows from a cursor as a dict" + assert cursor.description is not None + columns = [] + for col in cursor.description: + if col.name is not None: + columns.append(col.name) + return [dict(zip(columns, row)) for row in cursor.fetchall()] diff --git a/tox.ini b/tox.ini new file mode 100644 index 000000000..743bef7c2 --- /dev/null +++ b/tox.ini @@ -0,0 +1,47 @@ +[pytest] +addopts = --pdbcls IPython.terminal.debugger:TerminalPdb +filterwarnings = + ; all warnings that are not ignored should raise an error + error + ; pytest wants to remove the `message` kwarg to pytest.raises, but there isn't + ; an alternative at the moment. + ; https://github.com/pytest-dev/pytest/issues/3974 + ignore::pytest.PytestDeprecationWarning +[flake8] +ignore = + ; formatting handled by black + ; https://pycodestyle.readthedocs.io/en/latest/intro.html#error-codes + ; https://github.com/ambv/black/issues/429 + E101, + E111, + E114, + E115, + E116, + E117, + E121, + E122, + E123, + E124, + E125, + E126, + E127, + E128, + E129, + E131, + E133, + E2, + E3, + E5, + E701, + E702, + E703, + E704, + W1, + W2, + W3, + W503, + W504, + F401, + F821, + ; wrong in type stubs '__all__ = []' for some reason + F822 From 6ca1054392acb8a79a1f24787c98474fcc6aa88d Mon Sep 17 00:00:00 2001 From: Steve Dignam Date: Mon, 18 Jan 2021 18:01:10 -0500 Subject: [PATCH 20/88] release: 0.3.0 --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index c5a9f0200..89e7f4e61 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "django-types" -version = "0.2.1" +version = "0.3.0" description = "Type stubs for Django" repository = "https://github.com/sbdchd/django-types" readme = "README.md" From eeb7505b7fe142f8f87fc4ba42d85dbef1119aef Mon Sep 17 00:00:00 2001 From: Steve Dignam Date: Tue, 19 Jan 2021 13:30:49 -0500 Subject: [PATCH 21/88] fix: cursor.execute param types Param should probably be `Sequence[Any] | Dict[str, Any]` but I'm trying to see how far I can get before I have to do that. --- django-stubs/db/backends/utils.pyi | 5 ++-- psycopg2-stubs/extensions.pyi | 6 +++-- tests/trout/models.py | 41 +++++++++++++++++++++++++++++- 3 files changed, 47 insertions(+), 5 deletions(-) diff --git a/django-stubs/db/backends/utils.pyi b/django-stubs/db/backends/utils.pyi index 5a2aadffa..6fa2fd6b2 100644 --- a/django-stubs/db/backends/utils.pyi +++ b/django-stubs/db/backends/utils.pyi @@ -25,7 +25,8 @@ from typing_extensions import Literal logger: Any # Python types that can be adapted to SQL. -_SQLType = Union[None, bool, int, float, Decimal, str, bytes, datetime, UUID] +_Mixed = Union[None, bool, int, float, Decimal, str, bytes, datetime, UUID] +_SQLType = Union[_Mixed, Sequence[_Mixed], Mapping[str, _Mixed]] class CursorWrapper: cursor: psycopg2.extensions.cursor = ... @@ -46,7 +47,7 @@ class CursorWrapper: def callproc( self, procname: str, - params: Optional[List[_SQLType]] = ..., + params: Optional[Sequence[_SQLType]] = ..., kparams: Optional[Mapping[str, int]] = ..., ) -> None: ... def execute( diff --git a/psycopg2-stubs/extensions.pyi b/psycopg2-stubs/extensions.pyi index 8df89c6bf..311ecf8b6 100644 --- a/psycopg2-stubs/extensions.pyi +++ b/psycopg2-stubs/extensions.pyi @@ -51,7 +51,9 @@ TRANSACTION_STATUS_UNKNOWN: Literal[4] _TransactionStatus = Literal[0, 1, 2, 3, 4] -_SQLType = Union[None, bool, int, float, Decimal, str, bytes, datetime, UUID] +_Mixed = Union[None, bool, int, float, Decimal, str, bytes, datetime, UUID] +_SQLType = Union[_Mixed, Sequence[_Mixed], Mapping[str, _Mixed]] + class cursor: def __init__(self, conn: _connection) -> None: ... @@ -79,7 +81,7 @@ class cursor: def callproc( self, procname: str, - parameters: Union[Iterable[_SQLType], Mapping[str, _SQLType]] = ..., + parameters: Union[Sequence[_SQLType], Mapping[str, _SQLType]] = ..., ) -> None: ... def mogrify( self, diff --git a/tests/trout/models.py b/tests/trout/models.py index b8a65b0b5..2613316c4 100644 --- a/tests/trout/models.py +++ b/tests/trout/models.py @@ -3,7 +3,7 @@ from datetime import time, timedelta from decimal import Decimal from io import StringIO -from typing import Any, Dict, List, NamedTuple, Optional, Tuple, Union +from typing import Any, Dict, Iterable, List, NamedTuple, Optional, Tuple, Union from uuid import UUID import psycopg2 @@ -555,6 +555,45 @@ def raw_database_queries() -> None: for record in cursor: print(record) + other_field_values = ["id-1", "id-2"] + + with connection.cursor() as cursor: + cursor.execute( + """ + SELECT id, name + FROM + table + WHERE + field = %s AND other_field = ANY(%s); + """, + ["foo", list(other_field_values)], + ) + cursor.execute( + """ + SELECT id, name + FROM table + WHERE + id = %(foo)s + and name = ANY(%(bar)s) + and address = ANY(%(buzz)s) + """, + dict(foo="foo", bar=["id-1", "id-2"], buzz=[1, 2, 3]), + ) + cursor.execute("", {"foo_ids": ("foo", "bar")}) + + cursor.execute("", ["id-foo", ["foo", "bar", "buzz"]]) + + +def get_data() -> Dict[str, Dict[str, str]]: + with connection.cursor() as cursor: + cursor.execute( + """ + select id, json_object_agg("name", "value") from table + """ + ) + # Argument 1 to "dict" has incompatible type "List[Tuple[Any, ...]]"; expected "Iterable[Tuple[str, Dict[str, str]]]" + return dict(cursor.fetchall()) # type: ignore [arg-type] + def test_psycopg2() -> None: with connection.cursor() as cursor: From 0889d8c90610512da9ff5bdfaf94ff500a31f84e Mon Sep 17 00:00:00 2001 From: Steve Dignam Date: Thu, 25 Feb 2021 10:54:55 -0500 Subject: [PATCH 22/88] bump: version to 0.3.1 --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 89e7f4e61..b3a1430fe 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "django-types" -version = "0.3.0" +version = "0.3.1" description = "Type stubs for Django" repository = "https://github.com/sbdchd/django-types" readme = "README.md" From 4e07e57c83f540bc82164c8560e8ae89a51a071b Mon Sep 17 00:00:00 2001 From: Steve Dignam Date: Fri, 26 Feb 2021 09:22:29 -0500 Subject: [PATCH 23/88] fix(django): add missing generic types params (#2) Key change is to also fix HttpHeaders to such that `.get()` returns `str | None` instead of `Any | None`. --- django-stubs/apps/registry.pyi | 6 +- django-stubs/conf/__init__.pyi | 2 +- django-stubs/conf/global_settings.pyi | 6 +- django-stubs/conf/urls/i18n.pyi | 2 +- django-stubs/conf/urls/static.pyi | 4 +- django-stubs/contrib/admin/actions.pyi | 4 +- django-stubs/contrib/admin/checks.pyi | 12 +- django-stubs/contrib/admin/decorators.pyi | 2 +- django-stubs/contrib/admin/filters.pyi | 25 +-- django-stubs/contrib/admin/helpers.pyi | 8 +- django-stubs/contrib/admin/models.pyi | 16 +- django-stubs/contrib/admin/options.pyi | 76 ++++----- django-stubs/contrib/admin/sites.pyi | 20 ++- .../contrib/admin/templatetags/admin_list.pyi | 4 +- .../contrib/admin/templatetags/admin_urls.pyi | 4 +- .../contrib/admin/templatetags/base.pyi | 4 +- django-stubs/contrib/admin/tests.pyi | 2 +- django-stubs/contrib/admin/utils.pyi | 38 +++-- .../contrib/admin/views/autocomplete.pyi | 2 +- .../contrib/admin/views/decorators.pyi | 6 +- django-stubs/contrib/admin/views/main.pyi | 42 ++--- django-stubs/contrib/admin/widgets.pyi | 4 +- django-stubs/contrib/admindocs/middleware.pyi | 4 +- django-stubs/contrib/admindocs/utils.pyi | 12 +- django-stubs/contrib/admindocs/views.pyi | 6 +- django-stubs/contrib/auth/__init__.pyi | 2 +- django-stubs/contrib/auth/admin.pyi | 4 +- django-stubs/contrib/auth/backends.pyi | 2 +- django-stubs/contrib/auth/base_user.pyi | 2 +- django-stubs/contrib/auth/hashers.pyi | 2 +- django-stubs/contrib/auth/mixins.pyi | 2 +- django-stubs/contrib/auth/models.pyi | 6 +- .../contrib/auth/password_validation.pyi | 4 +- django-stubs/contrib/auth/views.pyi | 8 +- django-stubs/contrib/contenttypes/admin.pyi | 2 +- django-stubs/contrib/contenttypes/fields.pyi | 20 ++- django-stubs/contrib/contenttypes/forms.pyi | 8 +- django-stubs/contrib/contenttypes/models.pyi | 6 +- django-stubs/contrib/flatpages/admin.pyi | 2 +- django-stubs/contrib/flatpages/models.pyi | 16 +- django-stubs/contrib/gis/admin/options.pyi | 10 +- django-stubs/contrib/gis/admin/widgets.pyi | 4 +- .../contrib/gis/db/backends/base/features.pyi | 24 +-- .../contrib/gis/db/backends/base/models.pyi | 30 ++-- .../gis/db/backends/base/operations.pyi | 14 +- .../gis/db/backends/mysql/features.pyi | 6 +- .../gis/db/backends/mysql/introspection.pyi | 4 +- .../gis/db/backends/mysql/operations.pyi | 14 +- .../contrib/gis/db/backends/mysql/schema.pyi | 6 +- .../gis/db/backends/oracle/introspection.pyi | 4 +- .../contrib/gis/db/backends/oracle/models.pyi | 6 +- .../gis/db/backends/oracle/operations.pyi | 22 +-- .../contrib/gis/db/backends/oracle/schema.pyi | 6 +- .../gis/db/backends/postgis/adapter.pyi | 4 +- .../gis/db/backends/postgis/introspection.pyi | 4 +- .../gis/db/backends/postgis/models.pyi | 6 +- .../gis/db/backends/postgis/operations.pyi | 44 +++--- .../gis/db/backends/postgis/pgraster.pyi | 10 +- .../gis/db/backends/postgis/schema.pyi | 2 +- .../gis/db/backends/spatialite/adapter.pyi | 2 +- .../gis/db/backends/spatialite/base.pyi | 2 +- .../gis/db/backends/spatialite/features.pyi | 4 +- .../db/backends/spatialite/introspection.pyi | 4 +- .../gis/db/backends/spatialite/models.pyi | 6 +- .../gis/db/backends/spatialite/operations.pyi | 26 ++-- .../gis/db/backends/spatialite/schema.pyi | 6 +- .../contrib/gis/db/backends/utils.pyi | 4 +- .../contrib/gis/db/models/aggregates.pyi | 10 +- django-stubs/contrib/gis/db/models/fields.pyi | 44 +++--- .../contrib/gis/db/models/functions.pyi | 72 ++++++--- .../contrib/gis/db/models/lookups.pyi | 20 +-- django-stubs/contrib/gis/db/models/proxy.pyi | 4 +- .../contrib/gis/db/models/sql/conversion.pyi | 24 +-- django-stubs/contrib/gis/feeds.pyi | 12 +- django-stubs/contrib/gis/forms/fields.pyi | 6 +- django-stubs/contrib/gis/forms/widgets.pyi | 10 +- django-stubs/contrib/gis/gdal/datasource.pyi | 8 +- django-stubs/contrib/gis/gdal/driver.pyi | 4 +- django-stubs/contrib/gis/gdal/envelope.pyi | 18 +-- django-stubs/contrib/gis/gdal/feature.pyi | 22 +-- django-stubs/contrib/gis/gdal/field.pyi | 34 ++--- django-stubs/contrib/gis/gdal/geometries.pyi | 130 ++++++++-------- django-stubs/contrib/gis/gdal/geomtype.pyi | 4 +- django-stubs/contrib/gis/gdal/layer.pyi | 28 ++-- django-stubs/contrib/gis/gdal/libgdal.pyi | 10 +- .../contrib/gis/gdal/prototypes/errcheck.pyi | 22 +-- .../gis/gdal/prototypes/generation.pyi | 24 +-- .../contrib/gis/gdal/prototypes/geom.pyi | 6 +- .../contrib/gis/gdal/prototypes/srs.pyi | 4 +- django-stubs/contrib/gis/gdal/raster/band.pyi | 34 ++--- django-stubs/contrib/gis/gdal/raster/base.pyi | 2 +- .../contrib/gis/gdal/raster/source.pyi | 44 +++--- django-stubs/contrib/gis/gdal/srs.pyi | 44 +++--- django-stubs/contrib/gis/geoip2/base.pyi | 20 +-- django-stubs/contrib/gis/geoip2/resources.pyi | 4 +- django-stubs/contrib/gis/geos/collections.pyi | 6 +- django-stubs/contrib/gis/geos/coordseq.pyi | 26 ++-- django-stubs/contrib/gis/geos/factory.pyi | 4 +- django-stubs/contrib/gis/geos/geometry.pyi | 144 +++++++++--------- django-stubs/contrib/gis/geos/io.pyi | 4 +- django-stubs/contrib/gis/geos/libgeos.pyi | 10 +- django-stubs/contrib/gis/geos/linestring.pyi | 14 +- .../contrib/gis/geos/mutable_list.pyi | 20 +-- django-stubs/contrib/gis/geos/point.pyi | 10 +- django-stubs/contrib/gis/geos/polygon.pyi | 10 +- django-stubs/contrib/gis/geos/prepared.pyi | 18 +-- .../contrib/gis/geos/prototypes/coordseq.pyi | 6 +- .../contrib/gis/geos/prototypes/errcheck.pyi | 14 +- .../contrib/gis/geos/prototypes/io.pyi | 30 ++-- .../gis/geos/prototypes/threadsafe.pyi | 2 +- django-stubs/contrib/gis/measure.pyi | 30 ++-- django-stubs/contrib/gis/ptr.pyi | 2 +- .../contrib/gis/serializers/geojson.pyi | 2 +- django-stubs/contrib/gis/shortcuts.pyi | 6 +- django-stubs/contrib/gis/sitemaps/kml.pyi | 4 +- django-stubs/contrib/gis/sitemaps/views.pyi | 4 +- .../contrib/gis/utils/layermapping.pyi | 24 +-- django-stubs/contrib/gis/utils/ogrinspect.pyi | 4 +- django-stubs/contrib/gis/views.pyi | 2 +- .../humanize/templatetags/humanize.pyi | 2 +- .../contrib/messages/storage/base.pyi | 4 +- .../contrib/postgres/fields/array.pyi | 12 +- .../contrib/postgres/fields/citext.pyi | 12 +- .../contrib/postgres/fields/hstore.pyi | 14 +- .../contrib/postgres/fields/jsonb.pyi | 6 +- .../contrib/postgres/fields/ranges.pyi | 26 ++-- django-stubs/contrib/postgres/lookups.pyi | 4 +- django-stubs/contrib/postgres/search.pyi | 22 +-- django-stubs/contrib/postgres/serializers.pyi | 4 +- django-stubs/contrib/postgres/utils.pyi | 2 +- django-stubs/contrib/redirects/admin.pyi | 2 +- django-stubs/contrib/redirects/models.pyi | 8 +- .../contrib/sessions/backends/base.pyi | 8 +- .../contrib/sessions/base_session.pyi | 2 +- django-stubs/contrib/sitemaps/__init__.pyi | 4 +- django-stubs/contrib/sitemaps/views.pyi | 8 +- django-stubs/contrib/sites/admin.pyi | 2 +- django-stubs/contrib/sites/managers.pyi | 4 +- .../management/commands/runserver.pyi | 4 +- django-stubs/contrib/staticfiles/storage.pyi | 12 +- django-stubs/contrib/staticfiles/utils.pyi | 4 +- django-stubs/core/cache/__init__.pyi | 8 +- django-stubs/core/cache/backends/base.pyi | 6 +- .../core/cache/backends/memcached.pyi | 10 +- django-stubs/core/checks/async_checks.pyi | 2 +- django-stubs/core/checks/registry.pyi | 10 +- .../core/checks/security/sessions.pyi | 4 +- django-stubs/core/checks/urls.pyi | 2 +- django-stubs/core/files/uploadedfile.pyi | 4 +- django-stubs/core/files/utils.pyi | 2 +- django-stubs/core/handlers/asgi.pyi | 14 +- django-stubs/core/handlers/base.pyi | 4 +- django-stubs/core/handlers/exception.pyi | 6 +- django-stubs/core/handlers/wsgi.pyi | 2 +- django-stubs/core/mail/message.pyi | 8 +- django-stubs/core/management/__init__.pyi | 2 +- django-stubs/core/management/base.pyi | 8 +- .../core/management/commands/makemessages.pyi | 2 +- .../core/management/commands/sqlmigrate.pyi | 2 +- django-stubs/core/management/templates.pyi | 10 +- django-stubs/core/management/utils.pyi | 4 +- django-stubs/core/paginator.pyi | 16 +- django-stubs/core/serializers/__init__.pyi | 2 +- django-stubs/core/serializers/base.pyi | 8 +- django-stubs/core/serializers/python.pyi | 2 +- django-stubs/core/serializers/pyyaml.pyi | 6 +- .../core/serializers/xml_serializer.pyi | 6 +- django-stubs/core/validators.pyi | 12 +- django-stubs/db/backends/base/base.pyi | 10 +- django-stubs/db/backends/base/creation.pyi | 4 +- django-stubs/db/backends/base/features.pyi | 4 +- .../db/backends/base/introspection.pyi | 2 +- django-stubs/db/backends/base/operations.pyi | 26 ++-- django-stubs/db/backends/base/schema.pyi | 20 ++- django-stubs/db/backends/base/validation.pyi | 2 +- django-stubs/db/backends/ddl_references.pyi | 28 ++-- django-stubs/db/backends/dummy/features.pyi | 2 +- django-stubs/db/backends/mysql/base.pyi | 28 ++-- django-stubs/db/backends/mysql/compiler.pyi | 4 +- django-stubs/db/backends/mysql/creation.pyi | 4 +- django-stubs/db/backends/mysql/features.pyi | 36 ++--- .../db/backends/mysql/introspection.pyi | 18 ++- django-stubs/db/backends/mysql/operations.pyi | 76 +++++---- django-stubs/db/backends/mysql/schema.pyi | 8 +- django-stubs/db/backends/mysql/validation.pyi | 4 +- django-stubs/db/backends/oracle/base.pyi | 28 ++-- django-stubs/db/backends/oracle/creation.pyi | 2 +- django-stubs/db/backends/oracle/features.pyi | 2 +- .../db/backends/oracle/introspection.pyi | 22 +-- .../db/backends/oracle/operations.pyi | 110 +++++++------ django-stubs/db/backends/oracle/schema.pyi | 6 +- django-stubs/db/backends/oracle/utils.pyi | 6 +- .../db/backends/oracle/validation.pyi | 2 +- .../db/backends/postgresql/features.pyi | 10 +- .../db/backends/postgresql/introspection.pyi | 16 +- .../db/backends/postgresql/schema.pyi | 2 +- django-stubs/db/backends/sqlite3/base.pyi | 2 +- django-stubs/db/migrations/autodetector.pyi | 6 +- django-stubs/db/migrations/executor.pyi | 4 +- django-stubs/db/migrations/graph.pyi | 2 +- .../db/migrations/operations/base.pyi | 2 +- .../db/migrations/operations/fields.pyi | 18 ++- .../db/migrations/operations/models.pyi | 12 +- .../db/migrations/operations/special.pyi | 8 +- .../db/migrations/operations/utils.pyi | 4 +- django-stubs/db/migrations/questioner.pyi | 8 +- django-stubs/db/migrations/recorder.pyi | 2 +- django-stubs/db/migrations/serializer.pyi | 4 +- django-stubs/db/migrations/state.pyi | 12 +- django-stubs/db/models/__init__.pyi | 2 - django-stubs/db/models/base.pyi | 12 +- django-stubs/db/models/deletion.pyi | 22 +-- django-stubs/db/models/enums.pyi | 2 +- django-stubs/db/models/expressions.pyi | 38 ++--- django-stubs/db/models/fields/__init__.pyi | 92 +++++------ django-stubs/db/models/fields/files.pyi | 20 +-- django-stubs/db/models/fields/json.pyi | 70 +++++---- django-stubs/db/models/fields/mixins.pyi | 2 +- django-stubs/db/models/fields/proxy.pyi | 2 +- django-stubs/db/models/fields/related.pyi | 26 ++-- .../db/models/fields/related_descriptors.pyi | 38 ++--- .../db/models/fields/related_lookups.pyi | 22 +-- .../db/models/fields/reverse_related.pyi | 30 ++-- .../db/models/functions/comparison.pyi | 4 +- django-stubs/db/models/lookups.pyi | 26 ++-- django-stubs/db/models/manager.pyi | 18 ++- django-stubs/db/models/options.pyi | 57 +++---- django-stubs/db/models/query.pyi | 23 +-- django-stubs/db/models/query_utils.pyi | 10 +- django-stubs/db/models/signals.pyi | 4 +- django-stubs/db/models/sql/compiler.pyi | 32 ++-- django-stubs/db/models/sql/constants.pyi | 2 +- django-stubs/db/models/sql/datastructures.pyi | 6 +- django-stubs/db/models/sql/query.pyi | 65 ++++---- django-stubs/db/models/sql/subqueries.pyi | 20 +-- django-stubs/db/models/sql/where.pyi | 8 +- django-stubs/db/transaction.pyi | 4 +- django-stubs/db/utils.pyi | 2 +- django-stubs/dispatch/dispatcher.pyi | 12 +- django-stubs/forms/boundfield.pyi | 2 +- django-stubs/forms/fields.pyi | 20 +-- django-stubs/forms/forms.pyi | 8 +- django-stubs/forms/formsets.pyi | 58 +++---- django-stubs/forms/models.pyi | 50 +++--- django-stubs/forms/utils.pyi | 4 +- django-stubs/forms/widgets.pyi | 12 +- django-stubs/http/multipartparser.pyi | 10 +- django-stubs/http/request.pyi | 4 +- django-stubs/http/response.pyi | 4 +- django-stubs/middleware/cache.pyi | 2 +- django-stubs/middleware/csrf.pyi | 4 +- django-stubs/shortcuts.pyi | 10 +- django-stubs/template/backends/jinja2.pyi | 2 +- django-stubs/template/base.pyi | 8 +- django-stubs/template/context.pyi | 4 +- django-stubs/template/context_processors.pyi | 4 +- django-stubs/template/defaultfilters.pyi | 2 +- django-stubs/template/engine.pyi | 2 +- django-stubs/template/library.pyi | 38 ++--- django-stubs/template/loader_tags.pyi | 5 +- django-stubs/template/response.pyi | 8 +- django-stubs/template/smartif.pyi | 8 +- django-stubs/template/utils.pyi | 4 +- django-stubs/templatetags/i18n.pyi | 2 +- django-stubs/test/client.pyi | 22 +-- django-stubs/test/runner.pyi | 10 +- django-stubs/test/selenium.pyi | 4 +- django-stubs/test/testcases.pyi | 40 ++--- django-stubs/test/utils.pyi | 32 ++-- django-stubs/urls/base.pyi | 2 +- django-stubs/urls/resolvers.pyi | 36 +++-- django-stubs/urls/utils.pyi | 4 +- django-stubs/utils/_os.pyi | 4 +- django-stubs/utils/asyncio.pyi | 2 +- django-stubs/utils/autoreload.pyi | 12 +- django-stubs/utils/crypto.pyi | 4 +- django-stubs/utils/datastructures.pyi | 10 +- django-stubs/utils/dateformat.pyi | 12 +- django-stubs/utils/decorators.pyi | 22 +-- django-stubs/utils/deprecation.pyi | 6 +- django-stubs/utils/feedgenerator.pyi | 14 +- django-stubs/utils/functional.pyi | 26 ++-- django-stubs/utils/html.pyi | 2 +- django-stubs/utils/inspect.pyi | 14 +- django-stubs/utils/ipv6.pyi | 6 +- django-stubs/utils/log.pyi | 4 +- django-stubs/utils/regex_helper.pyi | 6 +- django-stubs/utils/safestring.pyi | 2 +- django-stubs/utils/termcolors.pyi | 2 +- django-stubs/utils/text.pyi | 4 +- django-stubs/utils/translation/__init__.pyi | 28 ++-- django-stubs/utils/translation/trans_null.pyi | 12 +- django-stubs/utils/translation/trans_real.pyi | 10 +- django-stubs/utils/version.pyi | 2 +- django-stubs/views/debug.pyi | 14 +- django-stubs/views/decorators/cache.pyi | 4 +- django-stubs/views/decorators/csrf.pyi | 2 +- django-stubs/views/decorators/debug.pyi | 4 +- django-stubs/views/decorators/http.pyi | 13 +- django-stubs/views/decorators/vary.pyi | 2 +- django-stubs/views/generic/dates.pyi | 6 +- django-stubs/views/generic/detail.pyi | 6 +- django-stubs/views/generic/list.pyi | 16 +- django-stubs/views/i18n.pyi | 6 +- django-stubs/views/static.pyi | 2 +- psycopg2-stubs/_range.pyi | 5 + psycopg2-stubs/extensions.pyi | 1 - psycopg2-stubs/extras.pyi | 4 + s/lint | 12 +- tests/trout/models.py | 53 +++++-- 310 files changed, 2180 insertions(+), 1895 deletions(-) create mode 100644 psycopg2-stubs/_range.pyi create mode 100644 psycopg2-stubs/extras.pyi diff --git a/django-stubs/apps/registry.pyi b/django-stubs/apps/registry.pyi index df2e3591d..712f89f4b 100644 --- a/django-stubs/apps/registry.pyi +++ b/django-stubs/apps/registry.pyi @@ -12,7 +12,7 @@ class Apps: apps_ready: bool = ... ready_event: threading.Event = ... loading: bool = ... - _pending_operations: Dict[Tuple[str, str], List] + _pending_operations: Dict[Tuple[str, str], List[Any]] models_ready: bool = ... ready: bool = ... def __init__( @@ -42,7 +42,9 @@ class Apps: def set_installed_apps(self, installed: Iterable[str]) -> None: ... def unset_installed_apps(self) -> None: ... def clear_cache(self) -> None: ... - def lazy_model_operation(self, function: Callable, *model_keys: Any) -> None: ... + def lazy_model_operation( + self, function: Callable[..., Any], *model_keys: Any + ) -> None: ... def do_pending_operations(self, model: Type[Model]) -> None: ... apps: Apps diff --git a/django-stubs/conf/__init__.pyi b/django-stubs/conf/__init__.pyi index f36e61af0..0cf3c5c07 100644 --- a/django-stubs/conf/__init__.pyi +++ b/django-stubs/conf/__init__.pyi @@ -20,7 +20,7 @@ class LazySettings(_DjangoConfLazyObject): settings: LazySettings = ... class Settings: - def __init__(self, settings_module: str): ... + def __init__(self, settings_module: str) -> None: ... def is_overridden(self, setting: str) -> bool: ... class UserSettingsHolder: ... diff --git a/django-stubs/conf/global_settings.pyi b/django-stubs/conf/global_settings.pyi index 6704ccb0b..61294b63f 100644 --- a/django-stubs/conf/global_settings.pyi +++ b/django-stubs/conf/global_settings.pyi @@ -85,7 +85,7 @@ DATABASES: Dict[str, Dict[str, Any]] = ... # Classes used to implement DB routing behavior. class Router(Protocol): - def allow_migrate(self, db, app_label, **hints): ... + def allow_migrate(self, db: Any, app_label: Any, **hints: Any) -> Any: ... DATABASE_ROUTERS: List[Union[str, Router]] = ... @@ -148,7 +148,7 @@ FORCE_SCRIPT_NAME = None # re.compile(r'^SiteSucker.*'), # re.compile(r'^sohu-search'), # ] -DISALLOWED_USER_AGENTS: List[Pattern] = ... +DISALLOWED_USER_AGENTS: List[Pattern[str]] = ... ABSOLUTE_URL_OVERRIDES: Dict[str, Any] = ... @@ -162,7 +162,7 @@ ABSOLUTE_URL_OVERRIDES: Dict[str, Any] = ... # re.compile(r'^/phpmyadmin/'), # re.compile(r'\.(cgi|php|pl)$'), # ] -IGNORABLE_404_URLS: List[Pattern] = ... +IGNORABLE_404_URLS: List[Pattern[str]] = ... # A secret key for this particular Django installation. Used in secret-key # hashing algorithms. Set this in your settings, or Django will complain diff --git a/django-stubs/conf/urls/i18n.pyi b/django-stubs/conf/urls/i18n.pyi index c31925828..3e42fe0fb 100644 --- a/django-stubs/conf/urls/i18n.pyi +++ b/django-stubs/conf/urls/i18n.pyi @@ -7,4 +7,4 @@ def i18n_patterns( ) -> List[List[URLPattern]]: ... def is_language_prefix_patterns_used(urlconf: str) -> Tuple[bool, bool]: ... -urlpatterns: List[Callable] +urlpatterns: List[Callable[..., Any]] diff --git a/django-stubs/conf/urls/static.pyi b/django-stubs/conf/urls/static.pyi index bcad0db70..a77281d5d 100644 --- a/django-stubs/conf/urls/static.pyi +++ b/django-stubs/conf/urls/static.pyi @@ -2,4 +2,6 @@ from typing import Any, Callable, List from django.urls.resolvers import URLPattern -def static(prefix: str, view: Callable = ..., **kwargs: Any) -> List[URLPattern]: ... +def static( + prefix: str, view: Callable[..., Any] = ..., **kwargs: Any +) -> List[URLPattern]: ... diff --git a/django-stubs/contrib/admin/actions.pyi b/django-stubs/contrib/admin/actions.pyi index 80bb90492..222fbf8d0 100644 --- a/django-stubs/contrib/admin/actions.pyi +++ b/django-stubs/contrib/admin/actions.pyi @@ -1,4 +1,4 @@ -from typing import Optional +from typing import Any, Optional from django.contrib.admin.options import ModelAdmin from django.core.handlers.wsgi import WSGIRequest @@ -6,5 +6,5 @@ from django.db.models.query import QuerySet from django.template.response import TemplateResponse def delete_selected( - modeladmin: ModelAdmin, request: WSGIRequest, queryset: QuerySet + modeladmin: ModelAdmin[Any], request: WSGIRequest, queryset: QuerySet[Any] ) -> Optional[TemplateResponse]: ... diff --git a/django-stubs/contrib/admin/checks.pyi b/django-stubs/contrib/admin/checks.pyi index 8772e2fa6..7b52d86a9 100644 --- a/django-stubs/contrib/admin/checks.pyi +++ b/django-stubs/contrib/admin/checks.pyi @@ -12,11 +12,15 @@ def check_admin_app( def check_dependencies(**kwargs: Any) -> List[_CheckError]: ... class BaseModelAdminChecks: - def check(self, admin_obj: BaseModelAdmin, **kwargs: Any) -> List[CheckMessage]: ... + def check( + self, admin_obj: BaseModelAdmin[Any], **kwargs: Any + ) -> List[CheckMessage]: ... class ModelAdminChecks(BaseModelAdminChecks): ... class InlineModelAdminChecks(BaseModelAdminChecks): ... -def must_be(type: Any, option: Any, obj: Any, id: Any): ... -def must_inherit_from(parent: Any, option: Any, obj: Any, id: Any): ... -def refer_to_missing_field(field: Any, option: Any, model: Any, obj: Any, id: Any): ... +def must_be(type: Any, option: Any, obj: Any, id: Any) -> Any: ... +def must_inherit_from(parent: Any, option: Any, obj: Any, id: Any) -> Any: ... +def refer_to_missing_field( + field: Any, option: Any, model: Any, obj: Any, id: Any +) -> Any: ... diff --git a/django-stubs/contrib/admin/decorators.pyi b/django-stubs/contrib/admin/decorators.pyi index e26b2655f..b6ed1c22e 100644 --- a/django-stubs/contrib/admin/decorators.pyi +++ b/django-stubs/contrib/admin/decorators.pyi @@ -2,4 +2,4 @@ from typing import Any, Callable, Optional, Type from django.db.models.base import Model -def register(*models: Type[Model], site: Optional[Any] = ...) -> Callable: ... +def register(*models: Type[Model], site: Optional[Any] = ...) -> Callable[..., Any]: ... diff --git a/django-stubs/contrib/admin/filters.pyi b/django-stubs/contrib/admin/filters.pyi index 64a6ef752..e3c627104 100644 --- a/django-stubs/contrib/admin/filters.pyi +++ b/django-stubs/contrib/admin/filters.pyi @@ -16,11 +16,13 @@ class ListFilter: request: WSGIRequest, params: Dict[str, str], model: Type[Model], - model_admin: ModelAdmin, + model_admin: ModelAdmin[Any], ) -> None: ... def has_output(self) -> bool: ... def choices(self, changelist: Any) -> Optional[Iterator[Dict[str, Any]]]: ... - def queryset(self, request: Any, queryset: QuerySet) -> Optional[QuerySet]: ... + def queryset( + self, request: Any, queryset: QuerySet[Any] + ) -> Optional[QuerySet[Any]]: ... def expected_parameters(self) -> Optional[List[str]]: ... class SimpleListFilter(ListFilter): @@ -30,33 +32,33 @@ class SimpleListFilter(ListFilter): def lookups(self, request: Any, model_admin: Any) -> List[Tuple[Any, str]]: ... class FieldListFilter(ListFilter): - field: Field = ... + field: Field[Any, Any] = ... field_path: Any = ... title: Any = ... def __init__( self, - field: Field, + field: Field[Any, Any], request: WSGIRequest, params: Dict[str, str], model: Type[Model], - model_admin: ModelAdmin, + model_admin: ModelAdmin[Any], field_path: str, ) -> None: ... @classmethod def register( cls, - test: Callable, + test: Callable[..., Any], list_filter_class: Type[FieldListFilter], take_priority: bool = ..., ) -> None: ... @classmethod def create( cls, - field: Field, + field: Field[Any, Any], request: WSGIRequest, params: Dict[str, str], model: Type[Model], - model_admin: ModelAdmin, + model_admin: ModelAdmin[Any], field_path: str, ) -> FieldListFilter: ... @@ -73,7 +75,10 @@ class RelatedFieldListFilter(FieldListFilter): @property def include_empty_choice(self) -> bool: ... def field_choices( - self, field: RelatedField, request: WSGIRequest, model_admin: ModelAdmin + self, + field: RelatedField[Any, Any], + request: WSGIRequest, + model_admin: ModelAdmin[Any], ) -> List[Tuple[str, str]]: ... class BooleanFieldListFilter(FieldListFilter): @@ -107,7 +112,7 @@ class AllValuesFieldListFilter(FieldListFilter): lookup_val: None = ... lookup_val_isnull: None = ... empty_value_display: str = ... - lookup_choices: QuerySet = ... + lookup_choices: QuerySet[Any] = ... class RelatedOnlyFieldListFilter(RelatedFieldListFilter): lookup_kwarg: str diff --git a/django-stubs/contrib/admin/helpers.pyi b/django-stubs/contrib/admin/helpers.pyi index baa90597c..6c5d3d652 100644 --- a/django-stubs/contrib/admin/helpers.pyi +++ b/django-stubs/contrib/admin/helpers.pyi @@ -32,7 +32,7 @@ class AdminForm: @property def errors(self) -> ErrorDict: ... @property - def non_field_errors(self) -> Callable: ... + def non_field_errors(self) -> Callable[..., Any]: ... @property def media(self) -> Media: ... @@ -126,9 +126,9 @@ class InlineAdminFormSet: ) -> Iterator[Dict[str, Union[Dict[str, bool], bool, Widget, str]]]: ... def inline_formset_data(self) -> str: ... @property - def forms(self): ... + def forms(self) -> Any: ... @property - def non_form_errors(self) -> Callable: ... + def non_form_errors(self) -> Callable[..., Any]: ... @property def media(self) -> Media: ... @@ -152,7 +152,7 @@ class InlineAdminForm(AdminForm): def pk_field(self) -> AdminField: ... def fk_field(self) -> AdminField: ... def deletion_field(self) -> AdminField: ... - def ordering_field(self): ... + def ordering_field(self) -> Any: ... class InlineFieldset(Fieldset): formset: Any = ... diff --git a/django-stubs/contrib/admin/models.pyi b/django-stubs/contrib/admin/models.pyi index 461f5f22b..fdd905047 100644 --- a/django-stubs/contrib/admin/models.pyi +++ b/django-stubs/contrib/admin/models.pyi @@ -22,15 +22,13 @@ class LogEntryManager(models.Manager["LogEntry"]): ) -> LogEntry: ... class LogEntry(models.Model): - action_time: models.DateTimeField = ... - user: models.ForeignKey = ... - content_type: models.ForeignKey = models.ForeignKey( - ContentType, on_delete=models.CASCADE - ) - object_id: models.TextField = ... - object_repr: models.CharField = ... - action_flag: models.PositiveSmallIntegerField = ... - change_message: models.TextField = ... + action_time: models.DateTimeField[Any] = ... + user: models.ForeignKey[Any] = ... + content_type: models.ForeignKey[Any] = ... + object_id: models.TextField[Any] = ... + object_repr: models.CharField[Any] = ... + action_flag: models.PositiveSmallIntegerField[Any] = ... + change_message: models.TextField[Any] = ... objects: LogEntryManager = ... def is_addition(self) -> bool: ... def is_change(self) -> bool: ... diff --git a/django-stubs/contrib/admin/options.pyi b/django-stubs/contrib/admin/options.pyi index 28534e8dc..1b89fb787 100644 --- a/django-stubs/contrib/admin/options.pyi +++ b/django-stubs/contrib/admin/options.pyi @@ -93,7 +93,7 @@ class BaseModelAdmin(Generic[_ModelT]): filter_horizontal: Sequence[str] = ... radio_fields: Mapping[str, _Direction] = ... prepopulated_fields: Mapping[str, Sequence[str]] = ... - formfield_overrides: Mapping[Type[Field], Mapping[str, Any]] = ... + formfield_overrides: Mapping[Type[Field[Any, Any]], Mapping[str, Any]] = ... readonly_fields: Sequence[Union[str, Callable[[_ModelT], Any]]] = ... ordering: Sequence[str] = ... sortable_by: Sequence[str] = ... @@ -102,21 +102,21 @@ class BaseModelAdmin(Generic[_ModelT]): checks_class: Any = ... def check(self, **kwargs: Any) -> List[CheckMessage]: ... def formfield_for_dbfield( - self, db_field: Field, request: Optional[HttpRequest], **kwargs: Any - ) -> Optional[Field]: ... + self, db_field: Field[Any, Any], request: Optional[HttpRequest], **kwargs: Any + ) -> Optional[Field[Any, Any]]: ... def formfield_for_choice_field( - self, db_field: Field, request: Optional[HttpRequest], **kwargs: Any + self, db_field: Field[Any, Any], request: Optional[HttpRequest], **kwargs: Any ) -> TypedChoiceField: ... def get_field_queryset( - self, db: None, db_field: RelatedField, request: Optional[HttpRequest] - ) -> Optional[QuerySet]: ... + self, db: None, db_field: RelatedField[Any, Any], request: Optional[HttpRequest] + ) -> Optional[QuerySet[Any]]: ... def formfield_for_foreignkey( - self, db_field: ForeignKey, request: Optional[HttpRequest], **kwargs: Any + self, db_field: ForeignKey[Any], request: Optional[HttpRequest], **kwargs: Any ) -> Optional[ModelChoiceField]: ... def formfield_for_manytomany( self, db_field: ManyToManyField, request: Optional[HttpRequest], **kwargs: Any ) -> ModelMultipleChoiceField: ... - def get_autocomplete_fields(self, request: HttpRequest) -> Tuple: ... + def get_autocomplete_fields(self, request: HttpRequest) -> Tuple[Any, ...]: ... def get_view_on_site_url(self, obj: Optional[_ModelT] = ...) -> Optional[str]: ... def get_empty_value_display(self) -> SafeText: ... def get_exclude( @@ -124,21 +124,23 @@ class BaseModelAdmin(Generic[_ModelT]): ) -> Any: ... def get_fields( self, request: HttpRequest, obj: Optional[_ModelT] = ... - ) -> Sequence[Union[Callable, str]]: ... + ) -> Sequence[Union[Callable[..., Any], str]]: ... def get_fieldsets( self, request: HttpRequest, obj: Optional[_ModelT] = ... ) -> List[Tuple[Optional[str], Dict[str, Any]]]: ... - def get_ordering(self, request: HttpRequest) -> Union[List[str], Tuple]: ... + def get_ordering( + self, request: HttpRequest + ) -> Union[List[str], Tuple[Any, ...]]: ... def get_readonly_fields( self, request: HttpRequest, obj: Optional[_ModelT] = ... - ) -> Union[List[str], Tuple]: ... + ) -> Union[List[str], Tuple[Any, ...]]: ... def get_prepopulated_fields( self, request: HttpRequest, obj: Optional[_ModelT] = ... ) -> Dict[str, Tuple[str]]: ... - def get_queryset(self, request: HttpRequest) -> QuerySet: ... + def get_queryset(self, request: HttpRequest) -> QuerySet[Any]: ... def get_sortable_by( self, request: HttpRequest - ) -> Union[List[Callable], List[str], Tuple]: ... + ) -> Union[List[Callable[..., Any]], List[str], Tuple[Any, ...]]: ... def lookup_allowed(self, lookup: str, value: str) -> bool: ... def to_field_allowed(self, request: HttpRequest, to_field: str) -> bool: ... def has_add_permission(self, request: HttpRequest) -> bool: ... @@ -155,7 +157,7 @@ class BaseModelAdmin(Generic[_ModelT]): class ModelAdmin(BaseModelAdmin[_ModelT]): list_display: Sequence[Union[str, Callable[[_ModelT], Any]]] = ... - list_display_links: Optional[Sequence[Union[str, Callable]]] = ... + list_display_links: Optional[Sequence[Union[str, Callable[..., Any]]]] = ... list_filter: Sequence[ Union[str, Type[ListFilter], Tuple[str, Type[ListFilter]]] ] = ... @@ -168,9 +170,9 @@ class ModelAdmin(BaseModelAdmin[_ModelT]): save_as: bool = ... save_as_continue: bool = ... save_on_top: bool = ... - paginator: Type = ... + paginator: Type[Any] = ... preserve_filters: bool = ... - inlines: Sequence[Type[InlineModelAdmin]] = ... + inlines: Sequence[Type[InlineModelAdmin[Any]]] = ... add_form_template: str = ... change_form_template: str = ... change_list_template: str = ... @@ -179,21 +181,21 @@ class ModelAdmin(BaseModelAdmin[_ModelT]): object_history_template: str = ... popup_response_template: str = ... actions: Sequence[ - Union[Callable[[ModelAdmin, HttpRequest, QuerySet], None], str] + Union[Callable[[ModelAdmin[Any], HttpRequest, QuerySet[Any]], None], str] ] = ... action_form: Any = ... actions_on_top: bool = ... actions_on_bottom: bool = ... actions_selection_counter: bool = ... model: Type[_ModelT] = ... - opts: Options = ... + opts: Options[Any] = ... admin_site: AdminSite = ... def __init__( self, model: Type[_ModelT], admin_site: Optional[AdminSite] ) -> None: ... def get_inline_instances( self, request: HttpRequest, obj: Optional[_ModelT] = ... - ) -> List[InlineModelAdmin]: ... + ) -> List[InlineModelAdmin[Any]]: ... def get_urls(self) -> List[URLPattern]: ... @property def urls(self) -> List[URLPattern]: ... @@ -206,7 +208,7 @@ class ModelAdmin(BaseModelAdmin[_ModelT]): obj: Optional[_ModelT] = ..., change: bool = ..., **kwargs: Any - ): ... + ) -> Any: ... def get_changelist( self, request: HttpRequest, **kwargs: Any ) -> Type[ChangeList]: ... @@ -214,15 +216,15 @@ class ModelAdmin(BaseModelAdmin[_ModelT]): def get_object( self, request: HttpRequest, object_id: str, from_field: None = ... ) -> Optional[_ModelT]: ... - def get_changelist_form(self, request: Any, **kwargs: Any): ... - def get_changelist_formset(self, request: Any, **kwargs: Any): ... + def get_changelist_form(self, request: Any, **kwargs: Any) -> Any: ... + def get_changelist_formset(self, request: Any, **kwargs: Any) -> Any: ... def get_formsets_with_inlines( self, request: HttpRequest, obj: Optional[_ModelT] = ... ) -> Iterator[Any]: ... def get_paginator( self, request: HttpRequest, - queryset: QuerySet, + queryset: QuerySet[Any], per_page: int, orphans: int = ..., allow_empty_first_page: bool = ..., @@ -237,11 +239,13 @@ class ModelAdmin(BaseModelAdmin[_ModelT]): self, request: HttpRequest, object: _ModelT, object_repr: str ) -> LogEntry: ... def action_checkbox(self, obj: _ModelT) -> SafeText: ... - def get_actions(self, request: HttpRequest) -> OrderedDict: ... + def get_actions(self, request: HttpRequest) -> OrderedDict[Any, Any]: ... def get_action_choices( self, request: HttpRequest, default_choices: List[Tuple[str, str]] = ... ) -> List[Tuple[str, str]]: ... - def get_action(self, action: Union[Callable, str]) -> Tuple[Callable, str, str]: ... + def get_action( + self, action: Union[Callable[..., Any], str] + ) -> Tuple[Callable[..., Any], str, str]: ... def get_list_display(self, request: HttpRequest) -> Sequence[str]: ... def get_list_display_links( self, request: HttpRequest, list_display: Sequence[str] @@ -250,15 +254,15 @@ class ModelAdmin(BaseModelAdmin[_ModelT]): def get_list_select_related(self, request: HttpRequest) -> Sequence[str]: ... def get_search_fields(self, request: HttpRequest) -> List[str]: ... def get_search_results( - self, request: HttpRequest, queryset: QuerySet, search_term: str - ) -> Tuple[QuerySet, bool]: ... + self, request: HttpRequest, queryset: QuerySet[Any], search_term: str + ) -> Tuple[QuerySet[Any], bool]: ... def get_preserved_filters(self, request: HttpRequest) -> str: ... def _get_edited_object_pks( self, request: HttpRequest, prefix: str ) -> List[str]: ... def _get_list_editable_queryset( self, request: HttpRequest, prefix: str - ) -> QuerySet: ... + ) -> QuerySet[Any]: ... def construct_change_message( self, request: HttpRequest, @@ -274,12 +278,14 @@ class ModelAdmin(BaseModelAdmin[_ModelT]): extra_tags: str = ..., fail_silently: bool = ..., ) -> None: ... - def save_form(self, request: Any, form: Any, change: Any): ... + def save_form(self, request: Any, form: Any, change: Any) -> Any: ... def save_model( self, request: Any, obj: _ModelT, form: Any, change: Any ) -> None: ... def delete_model(self, request: HttpRequest, obj: _ModelT) -> None: ... - def delete_queryset(self, request: HttpRequest, queryset: QuerySet) -> None: ... + def delete_queryset( + self, request: HttpRequest, queryset: QuerySet[Any] + ) -> None: ... def save_formset( self, request: Any, form: Any, formset: Any, change: Any ) -> None: ... @@ -294,7 +300,7 @@ class ModelAdmin(BaseModelAdmin[_ModelT]): change: bool = ..., form_url: str = ..., obj: Optional[_ModelT] = ..., - ): ... + ) -> Any: ... def response_add( self, request: HttpRequest, obj: _ModelT, post_url_continue: Optional[str] = ... ) -> HttpResponse: ... @@ -306,12 +312,12 @@ class ModelAdmin(BaseModelAdmin[_ModelT]): self, request: HttpRequest, obj: _ModelT ) -> HttpResponseRedirect: ... def response_action( - self, request: HttpRequest, queryset: QuerySet + self, request: HttpRequest, queryset: QuerySet[Any] ) -> Optional[HttpResponseBase]: ... def response_delete( self, request: HttpRequest, obj_display: str, obj_id: int ) -> HttpResponse: ... - def render_delete_form(self, request: Any, context: Any): ... + def render_delete_form(self, request: Any, context: Any) -> Any: ... def get_inline_formsets( self, request: HttpRequest, @@ -342,7 +348,7 @@ class ModelAdmin(BaseModelAdmin[_ModelT]): self, request: HttpRequest, extra_context: Optional[Dict[str, str]] = ... ) -> TemplateResponse: ... def get_deleted_objects( - self, objs: QuerySet, request: HttpRequest + self, objs: QuerySet[Any], request: HttpRequest ) -> Tuple[List[Any], Dict[Any, Any], Set[Any], List[Any]]: ... def delete_view( self, request: HttpRequest, object_id: str, extra_context: None = ... @@ -384,7 +390,7 @@ class InlineModelAdmin(BaseModelAdmin[_ModelT]): ) -> Optional[int]: ... def get_formset( self, request: Any, obj: Optional[_ModelT] = ..., **kwargs: Any - ): ... + ) -> Any: ... class StackedInline(InlineModelAdmin[_ModelT]): ... class TabularInline(InlineModelAdmin[_ModelT]): ... diff --git a/django-stubs/contrib/admin/sites.pyi b/django-stubs/contrib/admin/sites.pyi index 59d88863a..5eb319ba5 100644 --- a/django-stubs/contrib/admin/sites.pyi +++ b/django-stubs/contrib/admin/sites.pyi @@ -27,34 +27,38 @@ class AdminSite: password_change_template: Any = ... password_change_done_template: Any = ... name: str = ... - _registry: Dict[Type[Model], ModelAdmin] + _registry: Dict[Type[Model], ModelAdmin[Any]] def __init__(self, name: str = ...) -> None: ... def check(self, app_configs: Optional[Iterable[AppConfig]]) -> List[Any]: ... def register( self, model_or_iterable: Union[Type[Model], Iterable[Type[Model]]], - admin_class: Optional[Type[ModelAdmin]] = ..., + admin_class: Optional[Type[ModelAdmin[Any]]] = ..., **options: Any ) -> None: ... def unregister( self, model_or_iterable: Union[Type[Model], Iterable[Type[Model]]] ) -> None: ... def is_registered(self, model: Type[Model]) -> bool: ... - def add_action(self, action: Callable, name: Optional[str] = ...) -> None: ... + def add_action( + self, action: Callable[..., Any], name: Optional[str] = ... + ) -> None: ... def disable_action(self, name: str) -> None: ... - def get_action(self, name: str) -> Callable: ... + def get_action(self, name: str) -> Callable[..., Any]: ... @property - def actions(self): ... + def actions(self) -> Any: ... @property - def empty_value_display(self): ... + def empty_value_display(self) -> Any: ... @empty_value_display.setter def empty_value_display(self, empty_value_display: Any) -> None: ... def has_permission(self, request: WSGIRequest) -> bool: ... - def admin_view(self, view: Callable, cacheable: bool = ...) -> Callable: ... + def admin_view( + self, view: Callable[..., Any], cacheable: bool = ... + ) -> Callable[..., Any]: ... def get_urls(self) -> List[URLResolver]: ... @property def urls(self) -> Tuple[List[URLResolver], str, str]: ... - def each_context(self, request: Any): ... + def each_context(self, request: Any) -> Any: ... def password_change( self, request: WSGIRequest, extra_context: Optional[Dict[str, Any]] = ... ) -> TemplateResponse: ... diff --git a/django-stubs/contrib/admin/templatetags/admin_list.pyi b/django-stubs/contrib/admin/templatetags/admin_list.pyi index e4ee9d2e8..bde06513d 100644 --- a/django-stubs/contrib/admin/templatetags/admin_list.pyi +++ b/django-stubs/contrib/admin/templatetags/admin_list.pyi @@ -9,8 +9,6 @@ from django.template.base import Parser, Token from django.template.context import RequestContext from django.utils.safestring import SafeText -from .base import InclusionAdminNode - register: Any DOT: str @@ -24,7 +22,7 @@ def items_for_result( cl: ChangeList, result: Model, form: None ) -> Iterator[SafeText]: ... -class ResultList(list): +class ResultList(List[Any]): form: None = ... def __init__(self, form: None, *items: Any) -> None: ... diff --git a/django-stubs/contrib/admin/templatetags/admin_urls.pyi b/django-stubs/contrib/admin/templatetags/admin_urls.pyi index 020c2ca66..4e47b27b6 100644 --- a/django-stubs/contrib/admin/templatetags/admin_urls.pyi +++ b/django-stubs/contrib/admin/templatetags/admin_urls.pyi @@ -7,10 +7,10 @@ from django.utils.safestring import SafeText register: Any -def admin_urlname(value: Options, arg: SafeText) -> str: ... +def admin_urlname(value: Options[Any], arg: SafeText) -> str: ... def admin_urlquote(value: Union[int, str, UUID]) -> Union[int, str, UUID]: ... def add_preserved_filters( - context: Union[Dict[str, Union[Options, str]], RequestContext], + context: Union[Dict[str, Union[Options[Any], str]], RequestContext], url: str, popup: bool = ..., to_field: Optional[str] = ..., diff --git a/django-stubs/contrib/admin/templatetags/base.pyi b/django-stubs/contrib/admin/templatetags/base.pyi index 6b20af0b9..8ca6f0dbe 100644 --- a/django-stubs/contrib/admin/templatetags/base.pyi +++ b/django-stubs/contrib/admin/templatetags/base.pyi @@ -7,7 +7,7 @@ from django.utils.safestring import SafeText class InclusionAdminNode(InclusionNode): args: List[Any] - func: Callable + func: Callable[..., Any] kwargs: Dict[Any, Any] takes_context: bool template_name: str = ... @@ -15,7 +15,7 @@ class InclusionAdminNode(InclusionNode): self, parser: Parser, token: Token, - func: Callable, + func: Callable[..., Any], template_name: str, takes_context: bool = ..., ) -> None: ... diff --git a/django-stubs/contrib/admin/tests.pyi b/django-stubs/contrib/admin/tests.pyi index 4ae5ea16d..4a0e11bcd 100644 --- a/django-stubs/contrib/admin/tests.pyi +++ b/django-stubs/contrib/admin/tests.pyi @@ -7,7 +7,7 @@ from django.utils.deprecation import MiddlewareMixin class CSPMiddleware(MiddlewareMixin): ... class AdminSeleniumTestCase(SeleniumTestCase, StaticLiveServerTestCase): - def wait_until(self, callback: Callable, timeout: int = ...) -> None: ... + def wait_until(self, callback: Callable[..., Any], timeout: int = ...) -> None: ... def wait_for_popup(self, num_windows: int = ..., timeout: int = ...) -> None: ... def wait_for(self, css_selector: str, timeout: int = ...) -> None: ... def wait_for_text( diff --git a/django-stubs/contrib/admin/utils.pyi b/django-stubs/contrib/admin/utils.pyi index 28d925322..95cbfa0c0 100644 --- a/django-stubs/contrib/admin/utils.pyi +++ b/django-stubs/contrib/admin/utils.pyi @@ -28,20 +28,20 @@ from django.forms.forms import BaseForm class FieldIsAForeignKeyColumnName(Exception): ... -def lookup_needs_distinct(opts: Options, lookup_path: str) -> bool: ... +def lookup_needs_distinct(opts: Options[Any], lookup_path: str) -> bool: ... def prepare_lookup_value( key: str, value: Union[datetime, str] ) -> Union[bool, datetime, str]: ... def quote(s: Union[int, str, UUID]) -> str: ... def unquote(s: str) -> str: ... -def flatten(fields: Any) -> List[Union[Callable, str]]: ... -def flatten_fieldsets(fieldsets: Any) -> List[Union[Callable, str]]: ... +def flatten(fields: Any) -> List[Union[Callable[..., Any], str]]: ... +def flatten_fieldsets(fieldsets: Any) -> List[Union[Callable[..., Any], str]]: ... def get_deleted_objects( objs: Sequence[Optional[Model]], request: WSGIRequest, admin_site: AdminSite ) -> Tuple[List[Any], Dict[Any, Any], Set[Any], List[Any]]: ... class NestedObjects(Collector): - data: collections.OrderedDict + data: collections.OrderedDict[Any, Any] dependencies: Dict[Any, Any] fast_deletes: List[Any] field_updates: Dict[Any, Any] @@ -53,23 +53,29 @@ class NestedObjects(Collector): def add_edge(self, source: Optional[Model], target: Model) -> None: ... def related_objects( self, related: ManyToOneRel, objs: Sequence[Optional[Model]] - ) -> QuerySet: ... - def nested(self, format_callback: Callable = ...) -> List[Any]: ... + ) -> QuerySet[Any]: ... + def nested(self, format_callback: Callable[..., Any] = ...) -> List[Any]: ... -def model_format_dict(obj: Any): ... -def model_ngettext(obj: Union[Options, QuerySet], n: Optional[int] = ...) -> str: ... +def model_format_dict(obj: Any) -> Any: ... +def model_ngettext( + obj: Union[Options[Any], QuerySet[Any]], n: Optional[int] = ... +) -> str: ... def lookup_field( - name: Union[Callable, str], obj: Model, model_admin: BaseModelAdmin = ... -) -> Tuple[Optional[Field], Any, Any]: ... + name: Union[Callable[..., Any], str], + obj: Model, + model_admin: BaseModelAdmin[Any] = ..., +) -> Tuple[Optional[Field[Any, Any]], Any, Any]: ... def label_for_field( - name: Union[Callable, str], + name: Union[Callable[..., Any], str], model: Type[Model], - model_admin: Optional[BaseModelAdmin] = ..., + model_admin: Optional[BaseModelAdmin[Any]] = ..., return_attr: bool = ..., form: Optional[BaseForm] = ..., -) -> Union[Tuple[Optional[str], Union[Callable, Type[str]]], str]: ... +) -> Union[Tuple[Optional[str], Union[Callable[..., Any], Type[str]]], str]: ... def help_text_for_field(name: str, model: Type[Model]) -> str: ... -def display_for_field(value: Any, field: Field, empty_value_display: str) -> str: ... +def display_for_field( + value: Any, field: Field[Any, Any], empty_value_display: str +) -> str: ... def display_for_value( value: Any, empty_value_display: str, boolean: bool = ... ) -> str: ... @@ -77,10 +83,10 @@ def display_for_value( class NotRelationField(Exception): ... def get_model_from_relation( - field: Union[Field, reverse_related.ForeignObjectRel] + field: Union[Field[Any, Any], reverse_related.ForeignObjectRel] ) -> Type[Model]: ... def reverse_field_path(model: Type[Model], path: str) -> Tuple[Type[Model], str]: ... -def get_fields_from_path(model: Type[Model], path: str) -> List[Field]: ... +def get_fields_from_path(model: Type[Model], path: str) -> List[Field[Any, Any]]: ... def construct_change_message( form: AdminPasswordChangeForm, formsets: None, add: bool ) -> List[Dict[str, Dict[str, List[str]]]]: ... diff --git a/django-stubs/contrib/admin/views/autocomplete.pyi b/django-stubs/contrib/admin/views/autocomplete.pyi index e7f2675f3..efd6040da 100644 --- a/django-stubs/contrib/admin/views/autocomplete.pyi +++ b/django-stubs/contrib/admin/views/autocomplete.pyi @@ -5,6 +5,6 @@ from django.core.handlers.wsgi import WSGIRequest from django.views.generic.list import BaseListView class AutocompleteJsonView(BaseListView): - model_admin: ModelAdmin = ... + model_admin: ModelAdmin[Any] = ... term: Any = ... def has_perm(self, request: WSGIRequest, obj: None = ...) -> bool: ... diff --git a/django-stubs/contrib/admin/views/decorators.pyi b/django-stubs/contrib/admin/views/decorators.pyi index f272777b2..a311da750 100644 --- a/django-stubs/contrib/admin/views/decorators.pyi +++ b/django-stubs/contrib/admin/views/decorators.pyi @@ -1,6 +1,6 @@ -from typing import Callable, Optional, TypeVar, overload +from typing import Any, Callable, Optional, TypeVar, overload -_C = TypeVar("_C", bound=Callable) +_C = TypeVar("_C", bound=Callable[..., Any]) @overload def staff_member_required( view_func: _C = ..., redirect_field_name: Optional[str] = ..., login_url: str = ... @@ -10,4 +10,4 @@ def staff_member_required( view_func: None = ..., redirect_field_name: Optional[str] = ..., login_url: str = ..., -) -> Callable: ... +) -> Callable[..., Any]: ... diff --git a/django-stubs/contrib/admin/views/main.pyi b/django-stubs/contrib/admin/views/main.pyi index 170d53aac..2c1b95233 100644 --- a/django-stubs/contrib/admin/views/main.pyi +++ b/django-stubs/contrib/admin/views/main.pyi @@ -22,18 +22,18 @@ IGNORED_PARAMS: Any class ChangeList: model: Type[Model] = ... - opts: Options = ... - lookup_opts: Options = ... - root_queryset: QuerySet = ... + opts: Options[Any] = ... + lookup_opts: Options[Any] = ... + root_queryset: QuerySet[Any] = ... list_display: List[str] = ... list_display_links: List[str] = ... - list_filter: Tuple = ... + list_filter: Tuple[Any, ...] = ... date_hierarchy: None = ... - search_fields: Tuple = ... + search_fields: Tuple[Any, ...] = ... list_select_related: bool = ... list_per_page: int = ... list_max_show_all: int = ... - model_admin: ModelAdmin = ... + model_admin: ModelAdmin[Any] = ... preserved_filters: str = ... sortable_by: Tuple[str] = ... page_num: int = ... @@ -41,7 +41,7 @@ class ChangeList: is_popup: bool = ... to_field: None = ... params: Dict[Any, Any] = ... - list_editable: Tuple = ... + list_editable: Tuple[Any, ...] = ... query: str = ... queryset: Any = ... title: Any = ... @@ -51,17 +51,19 @@ class ChangeList: self, request: WSGIRequest, model: Type[Model], - list_display: Union[List[Union[Callable, str]], Tuple[str]], - list_display_links: Optional[Union[List[Callable], List[str], Tuple[str]]], - list_filter: Union[List[Type[SimpleListFilter]], List[str], Tuple], + list_display: Union[List[Union[Callable[..., Any], str]], Tuple[str]], + list_display_links: Optional[ + Union[List[Callable[..., Any]], List[str], Tuple[str]] + ], + list_filter: Union[List[Type[SimpleListFilter]], List[str], Tuple[Any, ...]], date_hierarchy: Optional[str], - search_fields: Union[List[str], Tuple], - list_select_related: Union[Tuple, bool], + search_fields: Union[List[str], Tuple[Any, ...]], + list_select_related: Union[Tuple[Any, ...], bool], list_per_page: int, list_max_show_all: int, - list_editable: Union[List[str], Tuple], - model_admin: ModelAdmin, - sortable_by: Union[List[Callable], List[str], Tuple], + list_editable: Union[List[str], Tuple[Any, ...]], + model_admin: ModelAdmin[Any], + sortable_by: Union[List[Callable[..., Any]], List[str], Tuple[Any, ...]], ) -> None: ... def get_filters_params(self, params: None = ...) -> Dict[str, str]: ... def get_filters( @@ -82,13 +84,13 @@ class ChangeList: paginator: Any = ... def get_results(self, request: WSGIRequest) -> None: ... def get_ordering_field( - self, field_name: Union[Callable, str] + self, field_name: Union[Callable[..., Any], str] ) -> Optional[Union[CombinedExpression, str]]: ... def get_ordering( - self, request: WSGIRequest, queryset: QuerySet + self, request: WSGIRequest, queryset: QuerySet[Any] ) -> List[Union[OrderBy, Combinable, str]]: ... - def get_ordering_field_columns(self) -> OrderedDict: ... - def get_queryset(self, request: WSGIRequest) -> QuerySet: ... - def apply_select_related(self, qs: QuerySet) -> QuerySet: ... + def get_ordering_field_columns(self) -> OrderedDict[Any, Any]: ... + def get_queryset(self, request: WSGIRequest) -> QuerySet[Any]: ... + def apply_select_related(self, qs: QuerySet[Any]) -> QuerySet[Any]: ... def has_related_field_in_list_display(self) -> bool: ... def url_for_result(self, result: Model) -> str: ... diff --git a/django-stubs/contrib/admin/widgets.pyi b/django-stubs/contrib/admin/widgets.pyi index 81ce95ce8..c7d92608c 100644 --- a/django-stubs/contrib/admin/widgets.pyi +++ b/django-stubs/contrib/admin/widgets.pyi @@ -17,7 +17,7 @@ class FilteredSelectMultiple(forms.SelectMultiple): verbose_name: str, is_stacked: bool, attrs: None = ..., - choices: Tuple = ..., + choices: Tuple[Any, ...] = ..., ) -> None: ... class AdminDateWidget(forms.DateInput): @@ -106,7 +106,7 @@ class AutocompleteMixin: rel: ForeignObjectRel, admin_site: AdminSite, attrs: Optional[Dict[str, str]] = ..., - choices: Tuple = ..., + choices: Tuple[Any, ...] = ..., using: None = ..., ) -> None: ... def get_url(self) -> str: ... diff --git a/django-stubs/contrib/admindocs/middleware.pyi b/django-stubs/contrib/admindocs/middleware.pyi index c34ac2713..306430ef0 100644 --- a/django-stubs/contrib/admindocs/middleware.pyi +++ b/django-stubs/contrib/admindocs/middleware.pyi @@ -8,7 +8,7 @@ class XViewMiddleware(MiddlewareMixin): def process_view( self, request: WSGIRequest, - view_func: Callable, - view_args: Tuple, + view_func: Callable[..., Any], + view_args: Tuple[Any, ...], view_kwargs: Dict[Any, Any], ) -> Optional[HttpResponse]: ... diff --git a/django-stubs/contrib/admindocs/utils.pyi b/django-stubs/contrib/admindocs/utils.pyi index 3b801c541..fdd3c454e 100644 --- a/django-stubs/contrib/admindocs/utils.pyi +++ b/django-stubs/contrib/admindocs/utils.pyi @@ -2,16 +2,16 @@ from typing import Any, Callable, Optional docutils_is_available: bool -def get_view_name(view_func: Callable) -> str: ... -def trim_docstring(docstring: Any): ... -def parse_docstring(docstring: Any): ... +def get_view_name(view_func: Callable[..., Any]) -> str: ... +def trim_docstring(docstring: Any) -> Any: ... +def parse_docstring(docstring: Any) -> Any: ... def parse_rst( text: Any, default_reference_context: Any, thing_being_parsed: Optional[Any] = ... -): ... +) -> Any: ... ROLES: Any -def create_reference_role(rolename: Any, urlbase: Any): ... +def create_reference_role(rolename: Any, urlbase: Any) -> Any: ... def default_reference_role( name: Any, rawtext: Any, @@ -20,7 +20,7 @@ def default_reference_role( inliner: Any, options: Optional[Any] = ..., content: Optional[Any] = ..., -): ... +) -> Any: ... named_group_matcher: Any unnamed_group_matcher: Any diff --git a/django-stubs/contrib/admindocs/views.pyi b/django-stubs/contrib/admindocs/views.pyi index bf44a2dfb..f8294e0d3 100644 --- a/django-stubs/contrib/admindocs/views.pyi +++ b/django-stubs/contrib/admindocs/views.pyi @@ -15,9 +15,9 @@ class ModelIndexView(BaseAdminDocsView): ... class ModelDetailView(BaseAdminDocsView): ... class TemplateDetailView(BaseAdminDocsView): ... -def get_return_data_type(func_name: Any): ... -def get_readable_field_data_type(field: Union[Field, str]) -> str: ... +def get_return_data_type(func_name: Any) -> Any: ... +def get_readable_field_data_type(field: Union[Field[Any, Any], str]) -> str: ... def extract_views_from_urlpatterns( urlpatterns: Any, base: str = ..., namespace: Optional[Any] = ... -): ... +) -> Any: ... def simplify_regex(pattern: str) -> str: ... diff --git a/django-stubs/contrib/auth/__init__.pyi b/django-stubs/contrib/auth/__init__.pyi index 41c97ef67..025724589 100644 --- a/django-stubs/contrib/auth/__init__.pyi +++ b/django-stubs/contrib/auth/__init__.pyi @@ -33,7 +33,7 @@ def get_user_model() -> Type[Model]: ... def get_user( request: Union[HttpRequest, Client] ) -> Union[AbstractBaseUser, AnonymousUser]: ... -def get_permission_codename(action: str, opts: Options) -> str: ... +def get_permission_codename(action: str, opts: Options[Any]) -> str: ... def update_session_auth_hash(request: HttpRequest, user: AbstractBaseUser) -> None: ... default_app_config: str diff --git a/django-stubs/contrib/auth/admin.pyi b/django-stubs/contrib/auth/admin.pyi index 244ac0cc0..9a02c62af 100644 --- a/django-stubs/contrib/auth/admin.pyi +++ b/django-stubs/contrib/auth/admin.pyi @@ -7,9 +7,9 @@ from django.http.response import HttpResponse csrf_protect_m: Any sensitive_post_parameters_m: Any -class GroupAdmin(admin.ModelAdmin): ... +class GroupAdmin(admin.ModelAdmin[Any]): ... -class UserAdmin(admin.ModelAdmin): +class UserAdmin(admin.ModelAdmin[Any]): change_user_password_template: Any = ... add_fieldsets: Any = ... add_form: Any = ... diff --git a/django-stubs/contrib/auth/backends.pyi b/django-stubs/contrib/auth/backends.pyi index f5be33d8a..5d03341ee 100644 --- a/django-stubs/contrib/auth/backends.pyi +++ b/django-stubs/contrib/auth/backends.pyi @@ -40,7 +40,7 @@ class ModelBackend(BaseBackend): is_active: bool = ..., include_superusers: bool = ..., obj: Optional[Model] = ..., - ): ... + ) -> Any: ... class AllowAllUsersModelBackend(ModelBackend): ... diff --git a/django-stubs/contrib/auth/base_user.pyi b/django-stubs/contrib/auth/base_user.pyi index 92c59a0dd..4bef91ae5 100644 --- a/django-stubs/contrib/auth/base_user.pyi +++ b/django-stubs/contrib/auth/base_user.pyi @@ -26,7 +26,7 @@ class AbstractBaseUser(models.Model): password = models.CharField(max_length=128) last_login = models.DateTimeField(blank=True, null=True) - is_active: Union[bool, BooleanField[Union[bool, Combinable], bool]] = ... + is_active: Union[bool, BooleanField[Any]] = ... def get_username(self) -> str: ... def natural_key(self) -> Tuple[str]: ... @property diff --git a/django-stubs/contrib/auth/hashers.pyi b/django-stubs/contrib/auth/hashers.pyi index 3af532a6c..4d9aeed8e 100644 --- a/django-stubs/contrib/auth/hashers.pyi +++ b/django-stubs/contrib/auth/hashers.pyi @@ -7,7 +7,7 @@ def is_password_usable(encoded: Optional[str]) -> bool: ... def check_password( password: Optional[str], encoded: str, - setter: Optional[Callable] = ..., + setter: Optional[Callable[..., Any]] = ..., preferred: str = ..., ) -> bool: ... def make_password( diff --git a/django-stubs/contrib/auth/mixins.pyi b/django-stubs/contrib/auth/mixins.pyi index 9c355a9e9..fbefc023c 100644 --- a/django-stubs/contrib/auth/mixins.pyi +++ b/django-stubs/contrib/auth/mixins.pyi @@ -28,7 +28,7 @@ class PermissionRequiredMixin(AccessMixin): class UserPassesTestMixin(AccessMixin): def test_func(self) -> Optional[bool]: ... - def get_test_func(self) -> Callable: ... + def get_test_func(self) -> Callable[..., Any]: ... def dispatch( self, request: http.HttpRequest, *args: Any, **kwargs: Any ) -> HttpResponse: ... diff --git a/django-stubs/contrib/auth/models.pyi b/django-stubs/contrib/auth/models.pyi index 863d07708..a62b06e10 100644 --- a/django-stubs/contrib/auth/models.pyi +++ b/django-stubs/contrib/auth/models.pyi @@ -43,7 +43,7 @@ class Group(models.Model): name = models.CharField(max_length=150) permissions = models.ManyToManyField(Permission) - def natural_key(self): ... + def natural_key(self) -> Any: ... _T = TypeVar("_T", bound=Model) @@ -69,7 +69,7 @@ class UserManager(BaseUserManager[_T]): include_superusers: bool = ..., backend: Optional[Union[Type[ModelBackend], str]] = ..., obj: Optional[Model] = ..., - ): ... + ) -> Any: ... class PermissionsMixin(models.Model): is_superuser = models.BooleanField() @@ -84,7 +84,7 @@ class PermissionsMixin(models.Model): ) -> bool: ... def has_module_perms(self, app_label: str) -> bool: ... -class AbstractUser(AbstractBaseUser, PermissionsMixin): # type: ignore +class AbstractUser(AbstractBaseUser, PermissionsMixin): username_validator: UnicodeUsernameValidator = ... username = models.CharField(max_length=150) diff --git a/django-stubs/contrib/auth/password_validation.pyi b/django-stubs/contrib/auth/password_validation.pyi index 4d9df3b53..6ac0b71e3 100644 --- a/django-stubs/contrib/auth/password_validation.pyi +++ b/django-stubs/contrib/auth/password_validation.pyi @@ -6,7 +6,9 @@ from django.db.models.base import Model _UserModel = Model class PasswordValidator(Protocol): - def password_changed(self, password: str, user: Optional[_UserModel] = ...): ... + def password_changed( + self, password: str, user: Optional[_UserModel] = ... + ) -> Any: ... def get_default_password_validators() -> List[PasswordValidator]: ... def get_password_validators( diff --git a/django-stubs/contrib/auth/views.pyi b/django-stubs/contrib/auth/views.pyi index 92981a0b3..243aff5e3 100644 --- a/django-stubs/contrib/auth/views.pyi +++ b/django-stubs/contrib/auth/views.pyi @@ -40,9 +40,9 @@ def redirect_to_login( class PasswordContextMixin: extra_context: Any = ... - def get_context_data(self, **kwargs: Any): ... + def get_context_data(self, **kwargs: Any) -> Any: ... -class PasswordResetView(PasswordContextMixin, FormView): +class PasswordResetView(PasswordContextMixin, FormView[Any]): email_template_name: str = ... extra_email_context: Any = ... from_email: Any = ... @@ -57,7 +57,7 @@ INTERNAL_RESET_SESSION_TOKEN: str class PasswordResetDoneView(PasswordContextMixin, TemplateView): title: Any = ... -class PasswordResetConfirmView(PasswordContextMixin, FormView): +class PasswordResetConfirmView(PasswordContextMixin, FormView[Any]): post_reset_login: bool = ... post_reset_login_backend: Any = ... reset_url_token: str = ... @@ -70,7 +70,7 @@ class PasswordResetConfirmView(PasswordContextMixin, FormView): class PasswordResetCompleteView(PasswordContextMixin, TemplateView): title: Any = ... -class PasswordChangeView(PasswordContextMixin, FormView): +class PasswordChangeView(PasswordContextMixin, FormView[Any]): title: Any = ... class PasswordChangeDoneView(PasswordContextMixin, TemplateView): diff --git a/django-stubs/contrib/contenttypes/admin.pyi b/django-stubs/contrib/contenttypes/admin.pyi index bcf3aadf5..4c02e88e4 100644 --- a/django-stubs/contrib/contenttypes/admin.pyi +++ b/django-stubs/contrib/contenttypes/admin.pyi @@ -11,7 +11,7 @@ class GenericInlineModelAdminChecks: self, obj: GenericInlineModelAdmin, parent_model: Type[Model] ) -> List[Any]: ... -class GenericInlineModelAdmin(InlineModelAdmin): +class GenericInlineModelAdmin(InlineModelAdmin[Any]): template: str = ... class GenericStackedInline(GenericInlineModelAdmin): ... diff --git a/django-stubs/contrib/contenttypes/fields.pyi b/django-stubs/contrib/contenttypes/fields.pyi index c2f3d5433..b5aab8bfe 100644 --- a/django-stubs/contrib/contenttypes/fields.pyi +++ b/django-stubs/contrib/contenttypes/fields.pyi @@ -56,9 +56,11 @@ class GenericForeignKey(FieldCacheMixin): ) -> ContentType: ... def get_prefetch_queryset( self, - instances: Union[List[Model], QuerySet], - queryset: Optional[QuerySet] = ..., - ) -> Tuple[List[Model], Callable, Callable, bool, str, bool]: ... + instances: Union[List[Model], QuerySet[Any]], + queryset: Optional[QuerySet[Any]] = ..., + ) -> Tuple[ + List[Model], Callable[..., Any], Callable[..., Any], bool, str, bool + ]: ... def __get__( self, instance: Optional[Model], cls: Type[Model] = ... ) -> Optional[Any]: ... @@ -75,7 +77,7 @@ class GenericRel(ForeignObjectRel): limit_choices_to: Optional[Union[Dict[str, Any], Callable[[], Any]]] = ..., ) -> None: ... -class GenericRelation(ForeignObject): +class GenericRelation(ForeignObject[Any]): rel_class: Any = ... mti_inherited: bool = ... object_id_field_name: Any = ... @@ -92,7 +94,9 @@ class GenericRelation(ForeignObject): limit_choices_to: Optional[Union[Dict[str, Any], Callable[[], Any]]] = ..., **kwargs: Any ) -> None: ... - def resolve_related_fields(self) -> List[Tuple[PositiveIntegerField, Field]]: ... + def resolve_related_fields( + self, + ) -> List[Tuple[PositiveIntegerField[Any], Field[Any, Any]]]: ... def get_path_info( self, filtered_relation: Optional[FilteredRelation] = ... ) -> List[PathInfo]: ... @@ -104,8 +108,10 @@ class GenericRelation(ForeignObject): def get_extra_restriction( self, where_class: Type[WhereNode], alias: Optional[str], remote_alias: str ) -> WhereNode: ... - def bulk_related_objects(self, objs: List[Model], using: str = ...) -> QuerySet: ... + def bulk_related_objects( + self, objs: List[Model], using: str = ... + ) -> QuerySet[Any]: ... class ReverseGenericManyToOneDescriptor(ReverseManyToOneDescriptor): ... -def create_generic_related_manager(superclass: Any, rel: Any): ... +def create_generic_related_manager(superclass: Any, rel: Any) -> Any: ... diff --git a/django-stubs/contrib/contenttypes/forms.pyi b/django-stubs/contrib/contenttypes/forms.pyi index e27d7022f..b1025836d 100644 --- a/django-stubs/contrib/contenttypes/forms.pyi +++ b/django-stubs/contrib/contenttypes/forms.pyi @@ -16,10 +16,10 @@ class BaseGenericInlineFormSet(BaseModelFormSet): queryset: Optional[Any] = ..., **kwargs: Any ) -> None: ... - def initial_form_count(self): ... + def initial_form_count(self) -> Any: ... @classmethod - def get_default_prefix(cls): ... - def save_new(self, form: Any, commit: bool = ...): ... + def get_default_prefix(cls) -> Any: ... + def save_new(self, form: Any, commit: bool = ...) -> Any: ... def generic_inlineformset_factory( model: Any, @@ -38,4 +38,4 @@ def generic_inlineformset_factory( for_concrete_model: bool = ..., min_num: Optional[Any] = ..., validate_min: bool = ..., -): ... +) -> Any: ... diff --git a/django-stubs/contrib/contenttypes/models.pyi b/django-stubs/contrib/contenttypes/models.pyi index 3d725b6ee..6b594873b 100644 --- a/django-stubs/contrib/contenttypes/models.pyi +++ b/django-stubs/contrib/contenttypes/models.pyi @@ -17,12 +17,12 @@ class ContentTypeManager(models.Manager["ContentType"]): class ContentType(models.Model): id: int - app_label: models.CharField = ... - model: models.CharField = ... + app_label: models.CharField[Any] = ... + model: models.CharField[Any] = ... objects: ContentTypeManager = ... @property def name(self) -> str: ... def model_class(self) -> Optional[Type[Model]]: ... def get_object_for_this_type(self, **kwargs: Any) -> Model: ... - def get_all_objects_for_this_type(self, **kwargs: Any) -> QuerySet: ... + def get_all_objects_for_this_type(self, **kwargs: Any) -> QuerySet[Any]: ... def natural_key(self) -> Tuple[str, str]: ... diff --git a/django-stubs/contrib/flatpages/admin.pyi b/django-stubs/contrib/flatpages/admin.pyi index a11f296dd..a0473a5a1 100644 --- a/django-stubs/contrib/flatpages/admin.pyi +++ b/django-stubs/contrib/flatpages/admin.pyi @@ -2,7 +2,7 @@ from typing import Any from django.contrib import admin as admin -class FlatPageAdmin(admin.ModelAdmin): +class FlatPageAdmin(admin.ModelAdmin[Any]): form: Any = ... fieldsets: Any = ... list_display: Any = ... diff --git a/django-stubs/contrib/flatpages/models.pyi b/django-stubs/contrib/flatpages/models.pyi index d44cc9a63..fbeb355b0 100644 --- a/django-stubs/contrib/flatpages/models.pyi +++ b/django-stubs/contrib/flatpages/models.pyi @@ -1,12 +1,14 @@ +from typing import Any + from django.contrib.sites.models import Site from django.db import models class FlatPage(models.Model): - url: models.CharField = ... - title: models.CharField = ... - content: models.TextField = ... - enable_comments: models.BooleanField = ... - template_name: models.CharField = ... - registration_required: models.BooleanField = ... - sites: models.ManyToManyField[Site, Site] = ... + url: models.CharField[Any] = ... + title: models.CharField[Any] = ... + content: models.TextField[Any] = ... + enable_comments: models.BooleanField[Any] = ... + template_name: models.CharField[Any] = ... + registration_required: models.BooleanField[Any] = ... + sites: models.ManyToManyField = ... def get_absolute_url(self) -> str: ... diff --git a/django-stubs/contrib/gis/admin/options.pyi b/django-stubs/contrib/gis/admin/options.pyi index 8e06ffe9a..378e4ec30 100644 --- a/django-stubs/contrib/gis/admin/options.pyi +++ b/django-stubs/contrib/gis/admin/options.pyi @@ -4,7 +4,7 @@ from django.contrib.admin import ModelAdmin as ModelAdmin spherical_mercator_srid: int -class GeoModelAdmin(ModelAdmin): +class GeoModelAdmin(ModelAdmin[Any]): default_lon: int = ... default_lat: int = ... default_zoom: int = ... @@ -35,9 +35,11 @@ class GeoModelAdmin(ModelAdmin): debug: bool = ... widget: Any = ... @property - def media(self): ... - def formfield_for_dbfield(self, db_field: Any, request: Any, **kwargs: Any): ... - def get_map_widget(self, db_field: Any): ... + def media(self) -> Any: ... + def formfield_for_dbfield( + self, db_field: Any, request: Any, **kwargs: Any + ) -> Any: ... + def get_map_widget(self, db_field: Any) -> Any: ... class OSMGeoAdmin(GeoModelAdmin): map_template: str = ... diff --git a/django-stubs/contrib/gis/admin/widgets.pyi b/django-stubs/contrib/gis/admin/widgets.pyi index a1b3888f3..a1c8d2a6f 100644 --- a/django-stubs/contrib/gis/admin/widgets.pyi +++ b/django-stubs/contrib/gis/admin/widgets.pyi @@ -6,5 +6,5 @@ geo_context: Any logger: Any class OpenLayersWidget(Textarea): - def get_context(self, name: Any, value: Any, attrs: Any): ... - def map_options(self): ... + def get_context(self, name: Any, value: Any, attrs: Any) -> Any: ... + def map_options(self) -> Any: ... diff --git a/django-stubs/contrib/gis/db/backends/base/features.pyi b/django-stubs/contrib/gis/db/backends/base/features.pyi index 9f334a203..43c3bffee 100644 --- a/django-stubs/contrib/gis/db/backends/base/features.pyi +++ b/django-stubs/contrib/gis/db/backends/base/features.pyi @@ -20,25 +20,25 @@ class BaseSpatialFeatures: supports_raster: bool = ... supports_geometry_field_unique_index: bool = ... @property - def supports_bbcontains_lookup(self): ... + def supports_bbcontains_lookup(self) -> Any: ... @property - def supports_contained_lookup(self): ... + def supports_contained_lookup(self) -> Any: ... @property - def supports_crosses_lookup(self): ... + def supports_crosses_lookup(self) -> Any: ... @property - def supports_distances_lookups(self): ... + def supports_distances_lookups(self) -> Any: ... @property - def supports_dwithin_lookup(self): ... + def supports_dwithin_lookup(self) -> Any: ... @property - def supports_relate_lookup(self): ... + def supports_relate_lookup(self) -> Any: ... @property - def supports_isvalid_lookup(self): ... + def supports_isvalid_lookup(self) -> Any: ... @property - def supports_collect_aggr(self): ... + def supports_collect_aggr(self) -> Any: ... @property - def supports_extent_aggr(self): ... + def supports_extent_aggr(self) -> Any: ... @property - def supports_make_line_aggr(self): ... + def supports_make_line_aggr(self) -> Any: ... @property - def supports_union_aggr(self): ... - def __getattr__(self, name: Any): ... + def supports_union_aggr(self) -> Any: ... + def __getattr__(self, name: Any) -> Any: ... diff --git a/django-stubs/contrib/gis/db/backends/base/models.pyi b/django-stubs/contrib/gis/db/backends/base/models.pyi index b5d0d7151..40eccde1c 100644 --- a/django-stubs/contrib/gis/db/backends/base/models.pyi +++ b/django-stubs/contrib/gis/db/backends/base/models.pyi @@ -2,32 +2,32 @@ from typing import Any class SpatialRefSysMixin: @property - def srs(self): ... + def srs(self) -> Any: ... @property - def ellipsoid(self): ... + def ellipsoid(self) -> Any: ... @property - def name(self): ... + def name(self) -> Any: ... @property - def spheroid(self): ... + def spheroid(self) -> Any: ... @property - def datum(self): ... + def datum(self) -> Any: ... @property - def projected(self): ... + def projected(self) -> Any: ... @property - def local(self): ... + def local(self) -> Any: ... @property - def geographic(self): ... + def geographic(self) -> Any: ... @property - def linear_name(self): ... + def linear_name(self) -> Any: ... @property - def linear_units(self): ... + def linear_units(self) -> Any: ... @property - def angular_name(self): ... + def angular_name(self) -> Any: ... @property - def angular_units(self): ... + def angular_units(self) -> Any: ... @property - def units(self): ... + def units(self) -> Any: ... @classmethod - def get_units(cls, wkt: Any): ... + def get_units(cls, wkt: Any) -> Any: ... @classmethod - def get_spheroid(cls, wkt: Any, string: bool = ...): ... + def get_spheroid(cls, wkt: Any, string: bool = ...) -> Any: ... diff --git a/django-stubs/contrib/gis/db/backends/base/operations.pyi b/django-stubs/contrib/gis/db/backends/base/operations.pyi index cff5b2fec..161d2272a 100644 --- a/django-stubs/contrib/gis/db/backends/base/operations.pyi +++ b/django-stubs/contrib/gis/db/backends/base/operations.pyi @@ -7,7 +7,7 @@ class BaseSpatialOperations: oracle: bool = ... spatial_version: Any = ... select: str = ... - def select_extent(self): ... + def select_extent(self) -> Any: ... geography: bool = ... geometry: bool = ... disallowed_aggregates: Any = ... @@ -17,17 +17,17 @@ class BaseSpatialOperations: from_text: bool = ... def convert_extent(self, box: Any, srid: Any) -> None: ... def convert_extent3d(self, box: Any, srid: Any) -> None: ... - def geo_quote_name(self, name: Any): ... + def geo_quote_name(self, name: Any) -> Any: ... def geo_db_type(self, f: Any) -> None: ... def get_distance(self, f: Any, value: Any, lookup_type: Any) -> None: ... - def get_geom_placeholder(self, f: Any, value: Any, compiler: Any): ... + def get_geom_placeholder(self, f: Any, value: Any, compiler: Any) -> Any: ... def check_expression_support(self, expression: Any) -> None: ... def spatial_aggregate_name(self, agg_name: Any) -> None: ... - def spatial_function_name(self, func_name: Any): ... + def spatial_function_name(self, func_name: Any) -> Any: ... def geometry_columns(self) -> None: ... def spatial_ref_sys(self) -> None: ... distance_expr_for_lookup: Any = ... - def get_db_converters(self, expression: Any): ... + def get_db_converters(self, expression: Any) -> Any: ... def get_geometry_converter(self, expression: Any) -> None: ... - def get_area_att_for_field(self, field: Any): ... - def get_distance_att_for_field(self, field: Any): ... + def get_area_att_for_field(self, field: Any) -> Any: ... + def get_distance_att_for_field(self, field: Any) -> Any: ... diff --git a/django-stubs/contrib/gis/db/backends/mysql/features.pyi b/django-stubs/contrib/gis/db/backends/mysql/features.pyi index f1f18b0ff..66b956103 100644 --- a/django-stubs/contrib/gis/db/backends/mysql/features.pyi +++ b/django-stubs/contrib/gis/db/backends/mysql/features.pyi @@ -1,3 +1,5 @@ +from typing import Any + from django.contrib.gis.db.backends.base.features import ( BaseSpatialFeatures as BaseSpatialFeatures, ) @@ -12,5 +14,5 @@ class DatabaseFeatures(BaseSpatialFeatures, MySQLDatabaseFeatures): supports_transform: bool = ... supports_null_geometries: bool = ... supports_num_points_poly: bool = ... - def supports_empty_geometry_collection(self): ... - def supports_geometry_field_unique_index(self): ... + def supports_empty_geometry_collection(self) -> Any: ... + def supports_geometry_field_unique_index(self) -> Any: ... # type: ignore [override] diff --git a/django-stubs/contrib/gis/db/backends/mysql/introspection.pyi b/django-stubs/contrib/gis/db/backends/mysql/introspection.pyi index df26da5ee..559d29c8b 100644 --- a/django-stubs/contrib/gis/db/backends/mysql/introspection.pyi +++ b/django-stubs/contrib/gis/db/backends/mysql/introspection.pyi @@ -6,5 +6,5 @@ from django.db.backends.mysql.introspection import ( class MySQLIntrospection(DatabaseIntrospection): data_types_reverse: Any = ... - def get_geometry_type(self, table_name: Any, description: Any): ... - def supports_spatial_index(self, cursor: Any, table_name: Any): ... + def get_geometry_type(self, table_name: Any, description: Any) -> Any: ... + def supports_spatial_index(self, cursor: Any, table_name: Any) -> Any: ... diff --git a/django-stubs/contrib/gis/db/backends/mysql/operations.pyi b/django-stubs/contrib/gis/db/backends/mysql/operations.pyi index a06f8e8af..ec233dcbf 100644 --- a/django-stubs/contrib/gis/db/backends/mysql/operations.pyi +++ b/django-stubs/contrib/gis/db/backends/mysql/operations.pyi @@ -10,11 +10,11 @@ class MySQLOperations(BaseSpatialOperations, DatabaseOperations): name: str = ... geom_func_prefix: str = ... Adapter: Any = ... - def select(self): ... - def from_text(self): ... - def gis_operators(self): ... + def select(self) -> Any: ... # type: ignore [override] + def from_text(self) -> Any: ... # type: ignore [override] + def gis_operators(self) -> Any: ... disallowed_aggregates: Any = ... - def unsupported_functions(self): ... - def geo_db_type(self, f: Any): ... - def get_distance(self, f: Any, value: Any, lookup_type: Any): ... - def get_geometry_converter(self, expression: Any): ... + def unsupported_functions(self) -> Any: ... + def geo_db_type(self, f: Any) -> Any: ... + def get_distance(self, f: Any, value: Any, lookup_type: Any) -> Any: ... + def get_geometry_converter(self, expression: Any) -> Any: ... diff --git a/django-stubs/contrib/gis/db/backends/mysql/schema.pyi b/django-stubs/contrib/gis/db/backends/mysql/schema.pyi index 6cc782f27..db549f00b 100644 --- a/django-stubs/contrib/gis/db/backends/mysql/schema.pyi +++ b/django-stubs/contrib/gis/db/backends/mysql/schema.pyi @@ -9,8 +9,10 @@ class MySQLGISSchemaEditor(DatabaseSchemaEditor): sql_drop_spatial_index: str = ... geometry_sql: Any = ... def __init__(self, *args: Any, **kwargs: Any) -> None: ... - def skip_default(self, field: Any): ... - def column_sql(self, model: Any, field: Any, include_default: bool = ...): ... + def skip_default(self, field: Any) -> Any: ... + def column_sql( + self, model: Any, field: Any, include_default: bool = ... + ) -> Any: ... def create_model(self, model: Any) -> None: ... def add_field(self, model: Any, field: Any) -> None: ... def remove_field(self, model: Any, field: Any) -> None: ... diff --git a/django-stubs/contrib/gis/db/backends/oracle/introspection.pyi b/django-stubs/contrib/gis/db/backends/oracle/introspection.pyi index bf1cec30f..ed50735aa 100644 --- a/django-stubs/contrib/gis/db/backends/oracle/introspection.pyi +++ b/django-stubs/contrib/gis/db/backends/oracle/introspection.pyi @@ -5,5 +5,5 @@ from django.db.backends.oracle.introspection import ( ) class OracleIntrospection(DatabaseIntrospection): - def data_types_reverse(self): ... - def get_geometry_type(self, table_name: Any, description: Any): ... + def data_types_reverse(self) -> Any: ... + def get_geometry_type(self, table_name: Any, description: Any) -> Any: ... diff --git a/django-stubs/contrib/gis/db/backends/oracle/models.pyi b/django-stubs/contrib/gis/db/backends/oracle/models.pyi index 2190df7c3..adf56df16 100644 --- a/django-stubs/contrib/gis/db/backends/oracle/models.pyi +++ b/django-stubs/contrib/gis/db/backends/oracle/models.pyi @@ -14,9 +14,9 @@ class OracleGeometryColumns(models.Model): db_table: str = ... managed: bool = ... @classmethod - def table_name_col(cls): ... + def table_name_col(cls) -> Any: ... @classmethod - def geom_col_name(cls): ... + def geom_col_name(cls) -> Any: ... class OracleSpatialRefSys(models.Model, SpatialRefSysMixin): cs_name: Any = ... @@ -30,4 +30,4 @@ class OracleSpatialRefSys(models.Model, SpatialRefSysMixin): db_table: str = ... managed: bool = ... @property - def wkt(self): ... + def wkt(self) -> Any: ... diff --git a/django-stubs/contrib/gis/db/backends/oracle/operations.pyi b/django-stubs/contrib/gis/db/backends/oracle/operations.pyi index b52e14325..dc06a84d3 100644 --- a/django-stubs/contrib/gis/db/backends/oracle/operations.pyi +++ b/django-stubs/contrib/gis/db/backends/oracle/operations.pyi @@ -24,7 +24,7 @@ class SDORelate(SpatialOperator): def check_relate_argument(self, arg: Any) -> None: ... def as_sql( self, connection: Any, lookup: Any, template_params: Any, sql_params: Any - ): ... + ) -> Any: ... class OracleOperations(BaseSpatialOperations, DatabaseOperations): name: str = ... @@ -37,13 +37,13 @@ class OracleOperations(BaseSpatialOperations, DatabaseOperations): select: str = ... gis_operators: Any = ... unsupported_functions: Any = ... - def geo_quote_name(self, name: Any): ... - def geo_db_type(self, f: Any): ... - def get_distance(self, f: Any, value: Any, lookup_type: Any): ... - def get_geom_placeholder(self, f: Any, value: Any, compiler: Any): ... - def spatial_aggregate_name(self, agg_name: Any): ... - def geometry_columns(self): ... - def spatial_ref_sys(self): ... - def modify_insert_params(self, placeholder: Any, params: Any): ... - def get_geometry_converter(self, expression: Any): ... - def get_area_att_for_field(self, field: Any): ... + def geo_quote_name(self, name: Any) -> Any: ... + def geo_db_type(self, f: Any) -> Any: ... + def get_distance(self, f: Any, value: Any, lookup_type: Any) -> Any: ... + def get_geom_placeholder(self, f: Any, value: Any, compiler: Any) -> Any: ... + def spatial_aggregate_name(self, agg_name: Any) -> Any: ... + def geometry_columns(self) -> Any: ... + def spatial_ref_sys(self) -> Any: ... + def modify_insert_params(self, placeholder: Any, params: Any) -> Any: ... + def get_geometry_converter(self, expression: Any) -> Any: ... + def get_area_att_for_field(self, field: Any) -> Any: ... diff --git a/django-stubs/contrib/gis/db/backends/oracle/schema.pyi b/django-stubs/contrib/gis/db/backends/oracle/schema.pyi index d333685ac..0d4ebcd0b 100644 --- a/django-stubs/contrib/gis/db/backends/oracle/schema.pyi +++ b/django-stubs/contrib/gis/db/backends/oracle/schema.pyi @@ -10,8 +10,10 @@ class OracleGISSchemaEditor(DatabaseSchemaEditor): sql_clear_geometry_field_metadata: str = ... geometry_sql: Any = ... def __init__(self, *args: Any, **kwargs: Any) -> None: ... - def geo_quote_name(self, name: Any): ... - def column_sql(self, model: Any, field: Any, include_default: bool = ...): ... + def geo_quote_name(self, name: Any) -> Any: ... + def column_sql( + self, model: Any, field: Any, include_default: bool = ... + ) -> Any: ... def create_model(self, model: Any) -> None: ... def delete_model(self, model: Any) -> None: ... def add_field(self, model: Any, field: Any) -> None: ... diff --git a/django-stubs/contrib/gis/db/backends/postgis/adapter.pyi b/django-stubs/contrib/gis/db/backends/postgis/adapter.pyi index 5b2d0c84e..df6bdc99d 100644 --- a/django-stubs/contrib/gis/db/backends/postgis/adapter.pyi +++ b/django-stubs/contrib/gis/db/backends/postgis/adapter.pyi @@ -6,8 +6,8 @@ class PostGISAdapter: srid: Any = ... geography: Any = ... def __init__(self, obj: Any, geography: bool = ...) -> None: ... - def __conform__(self, proto: Any): ... + def __conform__(self, proto: Any) -> Any: ... def __eq__(self, other: Any) -> Any: ... def __hash__(self) -> Any: ... def prepare(self, conn: Any) -> None: ... - def getquoted(self): ... + def getquoted(self) -> Any: ... diff --git a/django-stubs/contrib/gis/db/backends/postgis/introspection.pyi b/django-stubs/contrib/gis/db/backends/postgis/introspection.pyi index 635efae5e..6cc2e762b 100644 --- a/django-stubs/contrib/gis/db/backends/postgis/introspection.pyi +++ b/django-stubs/contrib/gis/db/backends/postgis/introspection.pyi @@ -7,5 +7,5 @@ from django.db.backends.postgresql.introspection import ( class PostGISIntrospection(DatabaseIntrospection): postgis_oid_lookup: Any = ... ignored_tables: Any = ... - def get_field_type(self, data_type: Any, description: Any): ... - def get_geometry_type(self, table_name: Any, description: Any): ... + def get_field_type(self, data_type: Any, description: Any) -> Any: ... + def get_geometry_type(self, table_name: Any, description: Any) -> Any: ... diff --git a/django-stubs/contrib/gis/db/backends/postgis/models.pyi b/django-stubs/contrib/gis/db/backends/postgis/models.pyi index 1a3c29e4c..a59a85d8d 100644 --- a/django-stubs/contrib/gis/db/backends/postgis/models.pyi +++ b/django-stubs/contrib/gis/db/backends/postgis/models.pyi @@ -18,9 +18,9 @@ class PostGISGeometryColumns(models.Model): db_table: str = ... managed: bool = ... @classmethod - def table_name_col(cls): ... + def table_name_col(cls) -> Any: ... @classmethod - def geom_col_name(cls): ... + def geom_col_name(cls) -> Any: ... class PostGISSpatialRefSys(models.Model, SpatialRefSysMixin): srid: Any = ... @@ -33,4 +33,4 @@ class PostGISSpatialRefSys(models.Model, SpatialRefSysMixin): db_table: str = ... managed: bool = ... @property - def wkt(self): ... + def wkt(self) -> Any: ... diff --git a/django-stubs/contrib/gis/db/backends/postgis/operations.pyi b/django-stubs/contrib/gis/db/backends/postgis/operations.pyi index 429d2aa51..a7c57777f 100644 --- a/django-stubs/contrib/gis/db/backends/postgis/operations.pyi +++ b/django-stubs/contrib/gis/db/backends/postgis/operations.pyi @@ -15,13 +15,13 @@ class PostGISOperator(SpatialOperator): ) -> None: ... def as_sql( self, connection: Any, lookup: Any, template_params: Any, *args: Any - ): ... - def check_raster(self, lookup: Any, template_params: Any): ... + ) -> Any: ... + def check_raster(self, lookup: Any, template_params: Any) -> Any: ... class ST_Polygon(Func): function: str = ... def __init__(self, expr: Any) -> None: ... - def output_field(self): ... + def output_field(self) -> Any: ... class PostGISOperations(BaseSpatialOperations, DatabaseOperations): name: str = ... @@ -40,22 +40,22 @@ class PostGISOperations(BaseSpatialOperations, DatabaseOperations): unsupported_functions: Any = ... select: str = ... select_extent: Any = ... - def function_names(self): ... - def spatial_version(self): ... - def geo_db_type(self, f: Any): ... - def get_distance(self, f: Any, dist_val: Any, lookup_type: Any): ... - def get_geom_placeholder(self, f: Any, value: Any, compiler: Any): ... - def postgis_geos_version(self): ... - def postgis_lib_version(self): ... - def postgis_proj_version(self): ... - def postgis_version(self): ... - def postgis_full_version(self): ... - def postgis_version_tuple(self): ... - def proj_version_tuple(self): ... - def spatial_aggregate_name(self, agg_name: Any): ... - def geometry_columns(self): ... - def spatial_ref_sys(self): ... - def parse_raster(self, value: Any): ... - def distance_expr_for_lookup(self, lhs: Any, rhs: Any, **kwargs: Any): ... - def get_geometry_converter(self, expression: Any): ... - def get_area_att_for_field(self, field: Any): ... + def function_names(self) -> Any: ... + def spatial_version(self) -> Any: ... + def geo_db_type(self, f: Any) -> Any: ... + def get_distance(self, f: Any, dist_val: Any, lookup_type: Any) -> Any: ... + def get_geom_placeholder(self, f: Any, value: Any, compiler: Any) -> Any: ... + def postgis_geos_version(self) -> Any: ... + def postgis_lib_version(self) -> Any: ... + def postgis_proj_version(self) -> Any: ... + def postgis_version(self) -> Any: ... + def postgis_full_version(self) -> Any: ... + def postgis_version_tuple(self) -> Any: ... + def proj_version_tuple(self) -> Any: ... + def spatial_aggregate_name(self, agg_name: Any) -> Any: ... + def geometry_columns(self) -> Any: ... + def spatial_ref_sys(self) -> Any: ... + def parse_raster(self, value: Any) -> Any: ... + def distance_expr_for_lookup(self, lhs: Any, rhs: Any, **kwargs: Any) -> Any: ... + def get_geometry_converter(self, expression: Any) -> Any: ... + def get_area_att_for_field(self, field: Any) -> Any: ... diff --git a/django-stubs/contrib/gis/db/backends/postgis/pgraster.pyi b/django-stubs/contrib/gis/db/backends/postgis/pgraster.pyi index 9165e3f67..80d80b4f0 100644 --- a/django-stubs/contrib/gis/db/backends/postgis/pgraster.pyi +++ b/django-stubs/contrib/gis/db/backends/postgis/pgraster.pyi @@ -1,7 +1,7 @@ from typing import Any -def pack(structure: Any, data: Any): ... -def unpack(structure: Any, data: Any): ... -def chunk(data: Any, index: Any): ... -def from_pgraster(data: Any): ... -def to_pgraster(rast: Any): ... +def pack(structure: Any, data: Any) -> Any: ... +def unpack(structure: Any, data: Any) -> Any: ... +def chunk(data: Any, index: Any) -> Any: ... +def from_pgraster(data: Any) -> Any: ... +def to_pgraster(rast: Any) -> Any: ... diff --git a/django-stubs/contrib/gis/db/backends/postgis/schema.pyi b/django-stubs/contrib/gis/db/backends/postgis/schema.pyi index 58cdb9851..7946eb45f 100644 --- a/django-stubs/contrib/gis/db/backends/postgis/schema.pyi +++ b/django-stubs/contrib/gis/db/backends/postgis/schema.pyi @@ -8,4 +8,4 @@ class PostGISSchemaEditor(DatabaseSchemaEditor): rast_index_wrapper: str = ... sql_alter_column_to_3d: str = ... sql_alter_column_to_2d: str = ... - def geo_quote_name(self, name: Any): ... + def geo_quote_name(self, name: Any) -> Any: ... diff --git a/django-stubs/contrib/gis/db/backends/spatialite/adapter.pyi b/django-stubs/contrib/gis/db/backends/spatialite/adapter.pyi index 840530620..9556ec009 100644 --- a/django-stubs/contrib/gis/db/backends/spatialite/adapter.pyi +++ b/django-stubs/contrib/gis/db/backends/spatialite/adapter.pyi @@ -3,4 +3,4 @@ from typing import Any from django.contrib.gis.db.backends.base.adapter import WKTAdapter as WKTAdapter class SpatiaLiteAdapter(WKTAdapter): - def __conform__(self, protocol: Any): ... + def __conform__(self, protocol: Any) -> Any: ... diff --git a/django-stubs/contrib/gis/db/backends/spatialite/base.pyi b/django-stubs/contrib/gis/db/backends/spatialite/base.pyi index 6f13c4d28..22b2f8cd0 100644 --- a/django-stubs/contrib/gis/db/backends/spatialite/base.pyi +++ b/django-stubs/contrib/gis/db/backends/spatialite/base.pyi @@ -10,5 +10,5 @@ class DatabaseWrapper(SQLiteDatabaseWrapper): ops_class: Any = ... lib_spatialite_paths: Any = ... def __init__(self, *args: Any, **kwargs: Any) -> None: ... - def get_new_connection(self, conn_params: Any): ... + def get_new_connection(self, conn_params: Any) -> Any: ... def prepare_database(self) -> None: ... diff --git a/django-stubs/contrib/gis/db/backends/spatialite/features.pyi b/django-stubs/contrib/gis/db/backends/spatialite/features.pyi index 7c3b93cf9..eb951599c 100644 --- a/django-stubs/contrib/gis/db/backends/spatialite/features.pyi +++ b/django-stubs/contrib/gis/db/backends/spatialite/features.pyi @@ -1,3 +1,5 @@ +from typing import Any + from django.contrib.gis.db.backends.base.features import ( BaseSpatialFeatures as BaseSpatialFeatures, ) @@ -7,4 +9,4 @@ from django.db.backends.sqlite3.features import ( class DatabaseFeatures(BaseSpatialFeatures, SQLiteDatabaseFeatures): supports_3d_storage: bool = ... - def supports_area_geodetic(self): ... + def supports_area_geodetic(self) -> Any: ... # type: ignore [override] diff --git a/django-stubs/contrib/gis/db/backends/spatialite/introspection.pyi b/django-stubs/contrib/gis/db/backends/spatialite/introspection.pyi index 5b94040b5..69d91fc2a 100644 --- a/django-stubs/contrib/gis/db/backends/spatialite/introspection.pyi +++ b/django-stubs/contrib/gis/db/backends/spatialite/introspection.pyi @@ -12,5 +12,5 @@ class GeoFlexibleFieldLookupDict(FlexibleFieldLookupDict): class SpatiaLiteIntrospection(DatabaseIntrospection): data_types_reverse: Any = ... - def get_geometry_type(self, table_name: Any, description: Any): ... - def get_constraints(self, cursor: Any, table_name: Any): ... + def get_geometry_type(self, table_name: Any, description: Any) -> Any: ... + def get_constraints(self, cursor: Any, table_name: Any) -> Any: ... diff --git a/django-stubs/contrib/gis/db/backends/spatialite/models.pyi b/django-stubs/contrib/gis/db/backends/spatialite/models.pyi index 09d35d9a4..9294e5bdc 100644 --- a/django-stubs/contrib/gis/db/backends/spatialite/models.pyi +++ b/django-stubs/contrib/gis/db/backends/spatialite/models.pyi @@ -17,9 +17,9 @@ class SpatialiteGeometryColumns(models.Model): db_table: str = ... managed: bool = ... @classmethod - def table_name_col(cls): ... + def table_name_col(cls) -> Any: ... @classmethod - def geom_col_name(cls): ... + def geom_col_name(cls) -> Any: ... class SpatialiteSpatialRefSys(models.Model, SpatialRefSysMixin): srid: Any = ... @@ -33,4 +33,4 @@ class SpatialiteSpatialRefSys(models.Model, SpatialRefSysMixin): db_table: str = ... managed: bool = ... @property - def wkt(self): ... + def wkt(self) -> Any: ... diff --git a/django-stubs/contrib/gis/db/backends/spatialite/operations.pyi b/django-stubs/contrib/gis/db/backends/spatialite/operations.pyi index 67d02ad37..215a9cf7c 100644 --- a/django-stubs/contrib/gis/db/backends/spatialite/operations.pyi +++ b/django-stubs/contrib/gis/db/backends/spatialite/operations.pyi @@ -7,7 +7,7 @@ from django.db.backends.sqlite3.operations import DatabaseOperations class SpatialiteNullCheckOperator(SpatialOperator): def as_sql( self, connection: Any, lookup: Any, template_params: Any, sql_params: Any - ): ... + ) -> Any: ... class SpatiaLiteOperations(BaseSpatialOperations, DatabaseOperations): name: str = ... @@ -21,16 +21,16 @@ class SpatiaLiteOperations(BaseSpatialOperations, DatabaseOperations): disallowed_aggregates: Any = ... select: str = ... function_names: Any = ... - def unsupported_functions(self): ... - def spatial_version(self): ... + def unsupported_functions(self) -> Any: ... + def spatial_version(self) -> Any: ... def geo_db_type(self, f: Any) -> None: ... - def get_distance(self, f: Any, value: Any, lookup_type: Any): ... - def geos_version(self): ... - def proj4_version(self): ... - def lwgeom_version(self): ... - def spatialite_version(self): ... - def spatialite_version_tuple(self): ... - def spatial_aggregate_name(self, agg_name: Any): ... - def geometry_columns(self): ... - def spatial_ref_sys(self): ... - def get_geometry_converter(self, expression: Any): ... + def get_distance(self, f: Any, value: Any, lookup_type: Any) -> Any: ... + def geos_version(self) -> Any: ... + def proj4_version(self) -> Any: ... + def lwgeom_version(self) -> Any: ... + def spatialite_version(self) -> Any: ... + def spatialite_version_tuple(self) -> Any: ... + def spatial_aggregate_name(self, agg_name: Any) -> Any: ... + def geometry_columns(self) -> Any: ... + def spatial_ref_sys(self) -> Any: ... + def get_geometry_converter(self, expression: Any) -> Any: ... diff --git a/django-stubs/contrib/gis/db/backends/spatialite/schema.pyi b/django-stubs/contrib/gis/db/backends/spatialite/schema.pyi index 983af7a3e..b1099989a 100644 --- a/django-stubs/contrib/gis/db/backends/spatialite/schema.pyi +++ b/django-stubs/contrib/gis/db/backends/spatialite/schema.pyi @@ -15,8 +15,10 @@ class SpatialiteSchemaEditor(DatabaseSchemaEditor): geometry_tables: Any = ... geometry_sql: Any = ... def __init__(self, *args: Any, **kwargs: Any) -> None: ... - def geo_quote_name(self, name: Any): ... - def column_sql(self, model: Any, field: Any, include_default: bool = ...): ... + def geo_quote_name(self, name: Any) -> Any: ... + def column_sql( + self, model: Any, field: Any, include_default: bool = ... + ) -> Any: ... def remove_geometry_metadata(self, model: Any, field: Any) -> None: ... def create_model(self, model: Any) -> None: ... def delete_model(self, model: Any, **kwargs: Any) -> None: ... diff --git a/django-stubs/contrib/gis/db/backends/utils.pyi b/django-stubs/contrib/gis/db/backends/utils.pyi index 41a78fd94..7a046d028 100644 --- a/django-stubs/contrib/gis/db/backends/utils.pyi +++ b/django-stubs/contrib/gis/db/backends/utils.pyi @@ -6,7 +6,7 @@ class SpatialOperator: func: Any = ... def __init__(self, op: Optional[Any] = ..., func: Optional[Any] = ...) -> None: ... @property - def default_template(self): ... + def default_template(self) -> Any: ... def as_sql( self, connection: Any, lookup: Any, template_params: Any, sql_params: Any - ): ... + ) -> Any: ... diff --git a/django-stubs/contrib/gis/db/models/aggregates.pyi b/django-stubs/contrib/gis/db/models/aggregates.pyi index f2feb5b8a..d68f70087 100644 --- a/django-stubs/contrib/gis/db/models/aggregates.pyi +++ b/django-stubs/contrib/gis/db/models/aggregates.pyi @@ -5,15 +5,17 @@ from django.db.models import Aggregate class GeoAggregate(Aggregate): function: Any = ... is_extent: bool = ... - def output_field(self): ... + def output_field(self) -> Any: ... def as_sql( self, compiler: Any, connection: Any, function: Optional[Any] = ..., **extra_context: Any - ): ... - def as_oracle(self, compiler: Any, connection: Any, **extra_context: Any): ... + ) -> Any: ... + def as_oracle( + self, compiler: Any, connection: Any, **extra_context: Any + ) -> Any: ... def resolve_expression( self, query: Optional[Any] = ..., @@ -21,7 +23,7 @@ class GeoAggregate(Aggregate): reuse: Optional[Any] = ..., summarize: bool = ..., for_save: bool = ..., - ): ... + ) -> Any: ... class Collect(GeoAggregate): name: str = ... diff --git a/django-stubs/contrib/gis/db/models/fields.pyi b/django-stubs/contrib/gis/db/models/fields.pyi index f78577bcb..c686edaa1 100644 --- a/django-stubs/contrib/gis/db/models/fields.pyi +++ b/django-stubs/contrib/gis/db/models/fields.pyi @@ -47,21 +47,21 @@ class BaseSpatialField(Field[_ST, _GT]): validators: Iterable[_ValidatorCallable] = ..., error_messages: Optional[_ErrorMessagesToOverride] = ..., ): ... - def deconstruct(self): ... - def db_type(self, connection: Any): ... - def spheroid(self, connection: Any): ... - def units(self, connection: Any): ... - def units_name(self, connection: Any): ... - def geodetic(self, connection: Any): ... - def get_placeholder(self, value: Any, compiler: Any, connection: Any): ... - def get_srid(self, obj: Any): ... + def deconstruct(self) -> Any: ... + def db_type(self, connection: Any) -> Any: ... + def spheroid(self, connection: Any) -> Any: ... + def units(self, connection: Any) -> Any: ... + def units_name(self, connection: Any) -> Any: ... + def geodetic(self, connection: Any) -> Any: ... + def get_placeholder(self, value: Any, compiler: Any, connection: Any) -> Any: ... + def get_srid(self, obj: Any) -> Any: ... def get_db_prep_value( self, value: Any, connection: Any, *args: Any, **kwargs: Any - ): ... - def get_raster_prep_value(self, value: Any, is_candidate: Any): ... - def get_prep_value(self, value: Any): ... + ) -> Any: ... + def get_raster_prep_value(self, value: Any, is_candidate: Any) -> Any: ... + def get_prep_value(self, value: Any) -> Any: ... -class GeometryField(BaseSpatialField): +class GeometryField(BaseSpatialField[Any, Any]): description: Any = ... form_class: Any = ... geom_type: str = ... @@ -98,9 +98,9 @@ class GeometryField(BaseSpatialField): validators: Iterable[_ValidatorCallable] = ..., error_messages: Optional[_ErrorMessagesToOverride] = ..., ): ... - def deconstruct(self): ... - def formfield(self, **kwargs: Any): ... - def select_format(self, compiler: Any, sql: Any, params: Any): ... + def deconstruct(self) -> Any: ... + def formfield(self, **kwargs: Any) -> Any: ... + def select_format(self, compiler: Any, sql: Any, params: Any) -> Any: ... class PointField(GeometryField): geom_type: str = ... @@ -144,15 +144,15 @@ class GeometryCollectionField(GeometryField): form_class: Any = ... description: Any = ... -class ExtentField(Field): +class ExtentField(Field[Any, Any]): description: Any = ... - def get_internal_type(self): ... - def select_format(self, compiler: Any, sql: Any, params: Any): ... + def get_internal_type(self) -> Any: ... + def select_format(self, compiler: Any, sql: Any, params: Any) -> Any: ... -class RasterField(BaseSpatialField): +class RasterField(BaseSpatialField[Any, Any]): description: Any = ... geom_type: str = ... geography: bool = ... - def db_type(self, connection: Any): ... - def from_db_value(self, value: Any, expression: Any, connection: Any): ... - def get_transform(self, name: Any): ... + def db_type(self, connection: Any) -> Any: ... + def from_db_value(self, value: Any, expression: Any, connection: Any) -> Any: ... + def get_transform(self, name: Any) -> Any: ... diff --git a/django-stubs/contrib/gis/db/models/functions.pyi b/django-stubs/contrib/gis/db/models/functions.pyi index 1e764fca3..11838f5e2 100644 --- a/django-stubs/contrib/gis/db/models/functions.pyi +++ b/django-stubs/contrib/gis/db/models/functions.pyi @@ -9,32 +9,38 @@ class GeoFuncMixin: function: Any = ... geom_param_pos: Any = ... def __init__(self, *expressions: Any, **extra: Any) -> None: ... - def geo_field(self): ... + def geo_field(self) -> Any: ... def as_sql( self, compiler: Any, connection: Any, function: Optional[Any] = ..., **extra_context: Any - ): ... - def resolve_expression(self, *args: Any, **kwargs: Any): ... + ) -> Any: ... + def resolve_expression(self, *args: Any, **kwargs: Any) -> Any: ... class GeoFunc(GeoFuncMixin, Func): ... class GeomOutputGeoFunc(GeoFunc): - def output_field(self): ... + def output_field(self) -> Any: ... class SQLiteDecimalToFloatMixin: - def as_sqlite(self, compiler: Any, connection: Any, **extra_context: Any): ... + def as_sqlite( + self, compiler: Any, connection: Any, **extra_context: Any + ) -> Any: ... class OracleToleranceMixin: tolerance: float = ... - def as_oracle(self, compiler: Any, connection: Any, **extra_context: Any): ... + def as_oracle( + self, compiler: Any, connection: Any, **extra_context: Any + ) -> Any: ... class Area(OracleToleranceMixin, GeoFunc): arity: int = ... - def output_field(self): ... - def as_sqlite(self, compiler: Any, connection: Any, **extra_context: Any): ... + def output_field(self) -> Any: ... + def as_sqlite( + self, compiler: Any, connection: Any, **extra_context: Any + ) -> Any: ... class Azimuth(GeoFunc): output_field: Any = ... @@ -51,7 +57,9 @@ class AsGeoJSON(GeoFunc): precision: int = ..., **extra: Any ) -> None: ... - def as_oracle(self, compiler: Any, connection: Any, **extra_context: Any): ... + def as_oracle( + self, compiler: Any, connection: Any, **extra_context: Any + ) -> Any: ... class AsGML(GeoFunc): geom_param_pos: Any = ... @@ -59,7 +67,9 @@ class AsGML(GeoFunc): def __init__( self, expression: Any, version: int = ..., precision: int = ..., **extra: Any ) -> None: ... - def as_oracle(self, compiler: Any, connection: Any, **extra_context: Any): ... + def as_oracle( + self, compiler: Any, connection: Any, **extra_context: Any + ) -> Any: ... class AsKML(GeoFunc): output_field: Any = ... @@ -81,7 +91,9 @@ class AsWKT(GeoFunc): class BoundingCircle(OracleToleranceMixin, GeoFunc): def __init__(self, expression: Any, num_seg: int = ..., **extra: Any) -> None: ... - def as_oracle(self, compiler: Any, connection: Any, **extra_context: Any): ... + def as_oracle( + self, compiler: Any, connection: Any, **extra_context: Any + ) -> Any: ... class Centroid(OracleToleranceMixin, GeomOutputGeoFunc): arity: int = ... @@ -91,8 +103,8 @@ class Difference(OracleToleranceMixin, GeomOutputGeoFunc): geom_param_pos: Any = ... class DistanceResultMixin: - def output_field(self): ... - def source_is_geography(self): ... + def output_field(self) -> Any: ... + def source_is_geography(self) -> Any: ... class Distance(DistanceResultMixin, OracleToleranceMixin, GeoFunc): geom_param_pos: Any = ... @@ -100,8 +112,12 @@ class Distance(DistanceResultMixin, OracleToleranceMixin, GeoFunc): def __init__( self, expr1: Any, expr2: Any, spheroid: Optional[Any] = ..., **extra: Any ) -> None: ... - def as_postgresql(self, compiler: Any, connection: Any, **extra_context: Any): ... - def as_sqlite(self, compiler: Any, connection: Any, **extra_context: Any): ... + def as_postgresql( + self, compiler: Any, connection: Any, **extra_context: Any + ) -> Any: ... + def as_sqlite( + self, compiler: Any, connection: Any, **extra_context: Any + ) -> Any: ... class Envelope(GeomOutputGeoFunc): arity: int = ... @@ -114,7 +130,7 @@ class GeoHash(GeoFunc): def __init__( self, expression: Any, precision: Optional[Any] = ..., **extra: Any ) -> None: ... - def as_mysql(self, compiler: Any, connection: Any, **extra_context: Any): ... + def as_mysql(self, compiler: Any, connection: Any, **extra_context: Any) -> Any: ... class GeometryDistance(GeoFunc): output_field: Any = ... @@ -130,13 +146,19 @@ class Intersection(OracleToleranceMixin, GeomOutputGeoFunc): class IsValid(OracleToleranceMixin, GeoFuncMixin, StandardTransform): lookup_name: str = ... output_field: Any = ... - def as_oracle(self, compiler: Any, connection: Any, **extra_context: Any): ... + def as_oracle( + self, compiler: Any, connection: Any, **extra_context: Any + ) -> Any: ... class Length(DistanceResultMixin, OracleToleranceMixin, GeoFunc): spheroid: Any = ... def __init__(self, expr1: Any, spheroid: bool = ..., **extra: Any) -> None: ... - def as_postgresql(self, compiler: Any, connection: Any, **extra_context: Any): ... - def as_sqlite(self, compiler: Any, connection: Any, **extra_context: Any): ... + def as_postgresql( + self, compiler: Any, connection: Any, **extra_context: Any + ) -> Any: ... + def as_sqlite( + self, compiler: Any, connection: Any, **extra_context: Any + ) -> Any: ... class LineLocatePoint(GeoFunc): output_field: Any = ... @@ -159,8 +181,12 @@ class NumPoints(GeoFunc): class Perimeter(DistanceResultMixin, OracleToleranceMixin, GeoFunc): arity: int = ... - def as_postgresql(self, compiler: Any, connection: Any, **extra_context: Any): ... - def as_sqlite(self, compiler: Any, connection: Any, **extra_context: Any): ... + def as_postgresql( + self, compiler: Any, connection: Any, **extra_context: Any + ) -> Any: ... + def as_sqlite( + self, compiler: Any, connection: Any, **extra_context: Any + ) -> Any: ... class PointOnSurface(OracleToleranceMixin, GeomOutputGeoFunc): arity: int = ... @@ -184,7 +210,9 @@ class Transform(GeomOutputGeoFunc): def __init__(self, expression: Any, srid: Any, **extra: Any) -> None: ... class Translate(Scale): - def as_sqlite(self, compiler: Any, connection: Any, **extra_context: Any): ... + def as_sqlite( + self, compiler: Any, connection: Any, **extra_context: Any + ) -> Any: ... class Union(OracleToleranceMixin, GeomOutputGeoFunc): arity: int = ... diff --git a/django-stubs/contrib/gis/db/models/lookups.pyi b/django-stubs/contrib/gis/db/models/lookups.pyi index 02794235f..eea2236f2 100644 --- a/django-stubs/contrib/gis/db/models/lookups.pyi +++ b/django-stubs/contrib/gis/db/models/lookups.pyi @@ -4,7 +4,7 @@ from django.db.models import Lookup, Transform class RasterBandTransform(Transform): ... -class GISLookup(Lookup): +class GISLookup(Lookup[Any]): sql_template: Any = ... transform_func: Any = ... distance: bool = ... @@ -14,11 +14,11 @@ class GISLookup(Lookup): def __init__(self, lhs: Any, rhs: Any) -> None: ... def process_rhs_params(self) -> None: ... def process_band_indices(self, only_lhs: bool = ...) -> None: ... - def get_db_prep_lookup(self, value: Any, connection: Any): ... + def get_db_prep_lookup(self, value: Any, connection: Any) -> Any: ... rhs: Any = ... - def process_rhs(self, compiler: Any, connection: Any): ... - def get_rhs_op(self, connection: Any, rhs: Any): ... - def as_sql(self, compiler: Any, connection: Any): ... + def process_rhs(self, compiler: Any, connection: Any) -> Any: ... + def get_rhs_op(self, connection: Any, rhs: Any) -> Any: ... + def as_sql(self, compiler: Any, connection: Any) -> Any: ... class OverlapsLeftLookup(GISLookup): lookup_name: str = ... @@ -87,7 +87,7 @@ class RelateLookup(GISLookup): lookup_name: str = ... sql_template: str = ... pattern_regex: Any = ... - def process_rhs(self, compiler: Any, connection: Any): ... + def process_rhs(self, compiler: Any, connection: Any) -> Any: ... class TouchesLookup(GISLookup): lookup_name: str = ... @@ -99,16 +99,16 @@ class DistanceLookupBase(GISLookup): distance: bool = ... sql_template: str = ... def process_rhs_params(self) -> None: ... - def process_distance(self, compiler: Any, connection: Any): ... + def process_distance(self, compiler: Any, connection: Any) -> Any: ... class DWithinLookup(DistanceLookupBase): lookup_name: str = ... sql_template: str = ... - def process_distance(self, compiler: Any, connection: Any): ... - def process_rhs(self, compiler: Any, connection: Any): ... + def process_distance(self, compiler: Any, connection: Any) -> Any: ... + def process_rhs(self, compiler: Any, connection: Any) -> Any: ... class DistanceLookupFromFunction(DistanceLookupBase): - def as_sql(self, compiler: Any, connection: Any): ... + def as_sql(self, compiler: Any, connection: Any) -> Any: ... class DistanceGTLookup(DistanceLookupFromFunction): lookup_name: str = ... diff --git a/django-stubs/contrib/gis/db/models/proxy.pyi b/django-stubs/contrib/gis/db/models/proxy.pyi index 56ecd21a9..837460bc6 100644 --- a/django-stubs/contrib/gis/db/models/proxy.pyi +++ b/django-stubs/contrib/gis/db/models/proxy.pyi @@ -6,5 +6,5 @@ class SpatialProxy(DeferredAttribute): def __init__( self, klass: Any, field: Any, load_func: Optional[Any] = ... ) -> None: ... - def __get__(self, instance: Any, cls: Optional[Any] = ...): ... - def __set__(self, instance: Any, value: Any): ... + def __get__(self, instance: Any, cls: Optional[Any] = ...) -> Any: ... + def __set__(self, instance: Any, value: Any) -> Any: ... diff --git a/django-stubs/contrib/gis/db/models/sql/conversion.pyi b/django-stubs/contrib/gis/db/models/sql/conversion.pyi index 87b4c6cd4..a68f6c9f6 100644 --- a/django-stubs/contrib/gis/db/models/sql/conversion.pyi +++ b/django-stubs/contrib/gis/db/models/sql/conversion.pyi @@ -2,18 +2,22 @@ from typing import Any from django.db import models as models -class AreaField(models.FloatField): +class AreaField(models.FloatField[Any]): geo_field: Any = ... def __init__(self, geo_field: Any) -> None: ... - def get_prep_value(self, value: Any): ... - def get_db_prep_value(self, value: Any, connection: Any, prepared: bool = ...): ... - def from_db_value(self, value: Any, expression: Any, connection: Any): ... - def get_internal_type(self): ... + def get_prep_value(self, value: Any) -> Any: ... + def get_db_prep_value( + self, value: Any, connection: Any, prepared: bool = ... + ) -> Any: ... + def from_db_value(self, value: Any, expression: Any, connection: Any) -> Any: ... + def get_internal_type(self) -> Any: ... -class DistanceField(models.FloatField): +class DistanceField(models.FloatField[Any]): geo_field: Any = ... def __init__(self, geo_field: Any) -> None: ... - def get_prep_value(self, value: Any): ... - def get_db_prep_value(self, value: Any, connection: Any, prepared: bool = ...): ... - def from_db_value(self, value: Any, expression: Any, connection: Any): ... - def get_internal_type(self): ... + def get_prep_value(self, value: Any) -> Any: ... + def get_db_prep_value( + self, value: Any, connection: Any, prepared: bool = ... + ) -> Any: ... + def from_db_value(self, value: Any, expression: Any, connection: Any) -> Any: ... + def get_internal_type(self) -> Any: ... diff --git a/django-stubs/contrib/gis/feeds.pyi b/django-stubs/contrib/gis/feeds.pyi index c5dc445fd..d2eed625c 100644 --- a/django-stubs/contrib/gis/feeds.pyi +++ b/django-stubs/contrib/gis/feeds.pyi @@ -4,7 +4,7 @@ from django.contrib.syndication.views import Feed as BaseFeed from django.utils.feedgenerator import Atom1Feed, Rss201rev2Feed class GeoFeedMixin: - def georss_coords(self, coords: Any): ... + def georss_coords(self, coords: Any) -> Any: ... def add_georss_point( self, handler: Any, coords: Any, w3c_geo: bool = ... ) -> None: ... @@ -13,21 +13,21 @@ class GeoFeedMixin: ) -> None: ... class GeoRSSFeed(Rss201rev2Feed, GeoFeedMixin): - def rss_attributes(self): ... + def rss_attributes(self) -> Any: ... def add_item_elements(self, handler: Any, item: Any) -> None: ... def add_root_elements(self, handler: Any) -> None: ... class GeoAtom1Feed(Atom1Feed, GeoFeedMixin): - def root_attributes(self): ... + def root_attributes(self) -> Any: ... def add_item_elements(self, handler: Any, item: Any) -> None: ... def add_root_elements(self, handler: Any) -> None: ... class W3CGeoFeed(Rss201rev2Feed, GeoFeedMixin): - def rss_attributes(self): ... + def rss_attributes(self) -> Any: ... def add_item_elements(self, handler: Any, item: Any) -> None: ... def add_root_elements(self, handler: Any) -> None: ... class Feed(BaseFeed): feed_type: Any = ... - def feed_extra_kwargs(self, obj: Any): ... - def item_extra_kwargs(self, item: Any): ... + def feed_extra_kwargs(self, obj: Any) -> Any: ... + def item_extra_kwargs(self, item: Any) -> Any: ... diff --git a/django-stubs/contrib/gis/forms/fields.pyi b/django-stubs/contrib/gis/forms/fields.pyi index e6b8fefb1..06f039fe9 100644 --- a/django-stubs/contrib/gis/forms/fields.pyi +++ b/django-stubs/contrib/gis/forms/fields.pyi @@ -14,9 +14,9 @@ class GeometryField(forms.Field): geom_type: Optional[Any] = ..., **kwargs: Any ) -> None: ... - def to_python(self, value: Any): ... - def clean(self, value: Any): ... - def has_changed(self, initial: Any, data: Any): ... + def to_python(self, value: Any) -> Any: ... + def clean(self, value: Any) -> Any: ... + def has_changed(self, initial: Any, data: Any) -> Any: ... class GeometryCollectionField(GeometryField): geom_type: str = ... diff --git a/django-stubs/contrib/gis/forms/widgets.pyi b/django-stubs/contrib/gis/forms/widgets.pyi index 710a2bd20..f5a86b92b 100644 --- a/django-stubs/contrib/gis/forms/widgets.pyi +++ b/django-stubs/contrib/gis/forms/widgets.pyi @@ -14,9 +14,9 @@ class BaseGeometryWidget(Widget): template_name: str = ... attrs: Any = ... def __init__(self, attrs: Optional[Any] = ...) -> None: ... - def serialize(self, value: Any): ... - def deserialize(self, value: Any): ... - def get_context(self, name: Any, value: Any, attrs: Any): ... + def serialize(self, value: Any) -> Any: ... + def deserialize(self, value: Any) -> Any: ... + def get_context(self, name: Any, value: Any, attrs: Any) -> Any: ... class OpenLayersWidget(BaseGeometryWidget): template_name: str = ... @@ -24,8 +24,8 @@ class OpenLayersWidget(BaseGeometryWidget): class Media: css: Any = ... js: Any = ... - def serialize(self, value: Any): ... - def deserialize(self, value: Any): ... + def serialize(self, value: Any) -> Any: ... + def deserialize(self, value: Any) -> Any: ... class OSMWidget(OpenLayersWidget): template_name: str = ... diff --git a/django-stubs/contrib/gis/gdal/datasource.pyi b/django-stubs/contrib/gis/gdal/datasource.pyi index 4c39d6350..d79e7e209 100644 --- a/django-stubs/contrib/gis/gdal/datasource.pyi +++ b/django-stubs/contrib/gis/gdal/datasource.pyi @@ -14,9 +14,9 @@ class DataSource(GDALBase): write: bool = ..., encoding: str = ..., ) -> None: ... - def __getitem__(self, index: Any): ... - def __len__(self): ... + def __getitem__(self, index: Any) -> Any: ... + def __len__(self) -> Any: ... @property - def layer_count(self): ... + def layer_count(self) -> Any: ... @property - def name(self): ... + def name(self) -> Any: ... diff --git a/django-stubs/contrib/gis/gdal/driver.pyi b/django-stubs/contrib/gis/gdal/driver.pyi index da635d0f7..cddf50248 100644 --- a/django-stubs/contrib/gis/gdal/driver.pyi +++ b/django-stubs/contrib/gis/gdal/driver.pyi @@ -8,6 +8,6 @@ class Driver(GDALBase): @classmethod def ensure_registered(cls) -> None: ... @classmethod - def driver_count(cls): ... + def driver_count(cls) -> Any: ... @property - def name(self): ... + def name(self) -> Any: ... diff --git a/django-stubs/contrib/gis/gdal/envelope.pyi b/django-stubs/contrib/gis/gdal/envelope.pyi index 0a8814b14..965d511fc 100644 --- a/django-stubs/contrib/gis/gdal/envelope.pyi +++ b/django-stubs/contrib/gis/gdal/envelope.pyi @@ -6,20 +6,20 @@ class OGREnvelope(Structure): ... class Envelope: def __init__(self, *args: Any) -> None: ... def __eq__(self, other: Any) -> Any: ... - def expand_to_include(self, *args: Any): ... + def expand_to_include(self, *args: Any) -> Any: ... @property - def min_x(self): ... + def min_x(self) -> Any: ... @property - def min_y(self): ... + def min_y(self) -> Any: ... @property - def max_x(self): ... + def max_x(self) -> Any: ... @property - def max_y(self): ... + def max_y(self) -> Any: ... @property - def ur(self): ... + def ur(self) -> Any: ... @property - def ll(self): ... + def ll(self) -> Any: ... @property - def tuple(self): ... + def tuple(self) -> Any: ... @property - def wkt(self): ... + def wkt(self) -> Any: ... diff --git a/django-stubs/contrib/gis/gdal/feature.pyi b/django-stubs/contrib/gis/gdal/feature.pyi index 5fa1d2e6c..5d912fa66 100644 --- a/django-stubs/contrib/gis/gdal/feature.pyi +++ b/django-stubs/contrib/gis/gdal/feature.pyi @@ -6,22 +6,22 @@ class Feature(GDALBase): destructor: Any = ... ptr: Any = ... def __init__(self, feat: Any, layer: Any) -> None: ... - def __getitem__(self, index: Any): ... - def __len__(self): ... + def __getitem__(self, index: Any) -> Any: ... + def __len__(self) -> Any: ... def __eq__(self, other: Any) -> Any: ... @property - def encoding(self): ... + def encoding(self) -> Any: ... @property - def fid(self): ... + def fid(self) -> Any: ... @property - def layer_name(self): ... + def layer_name(self) -> Any: ... @property - def num_fields(self): ... + def num_fields(self) -> Any: ... @property - def fields(self): ... + def fields(self) -> Any: ... @property - def geom(self): ... + def geom(self) -> Any: ... @property - def geom_type(self): ... - def get(self, field: Any): ... - def index(self, field_name: Any): ... + def geom_type(self) -> Any: ... + def get(self, field: Any) -> Any: ... + def index(self, field_name: Any) -> Any: ... diff --git a/django-stubs/contrib/gis/gdal/field.pyi b/django-stubs/contrib/gis/gdal/field.pyi index 2033a8e87..28a00b92a 100644 --- a/django-stubs/contrib/gis/gdal/field.pyi +++ b/django-stubs/contrib/gis/gdal/field.pyi @@ -6,34 +6,34 @@ class Field(GDALBase): ptr: Any = ... __class__: Any = ... def __init__(self, feat: Any, index: Any) -> None: ... - def as_double(self): ... - def as_int(self, is_64: bool = ...): ... - def as_string(self): ... - def as_datetime(self): ... + def as_double(self) -> Any: ... + def as_int(self, is_64: bool = ...) -> Any: ... + def as_string(self) -> Any: ... + def as_datetime(self) -> Any: ... @property - def is_set(self): ... + def is_set(self) -> Any: ... @property - def name(self): ... + def name(self) -> Any: ... @property - def precision(self): ... + def precision(self) -> Any: ... @property - def type(self): ... + def type(self) -> Any: ... @property - def type_name(self): ... + def type_name(self) -> Any: ... @property - def value(self): ... + def value(self) -> Any: ... @property - def width(self): ... + def width(self) -> Any: ... class OFTInteger(Field): @property - def value(self): ... + def value(self) -> Any: ... @property - def type(self): ... + def type(self) -> Any: ... class OFTReal(Field): @property - def value(self): ... + def value(self) -> Any: ... class OFTString(Field): ... class OFTWideString(Field): ... @@ -41,15 +41,15 @@ class OFTBinary(Field): ... class OFTDate(Field): @property - def value(self): ... + def value(self) -> Any: ... class OFTDateTime(Field): @property - def value(self): ... + def value(self) -> Any: ... class OFTTime(Field): @property - def value(self): ... + def value(self) -> Any: ... class OFTInteger64(OFTInteger): ... class OFTIntegerList(Field): ... diff --git a/django-stubs/contrib/gis/gdal/geometries.pyi b/django-stubs/contrib/gis/gdal/geometries.pyi index 15e50f8bc..979d81062 100644 --- a/django-stubs/contrib/gis/gdal/geometries.pyi +++ b/django-stubs/contrib/gis/gdal/geometries.pyi @@ -9,127 +9,127 @@ class OGRGeometry(GDALBase): __class__: Any = ... def __init__(self, geom_input: Any, srs: Optional[Any] = ...) -> None: ... @classmethod - def from_bbox(cls, bbox: Any): ... + def from_bbox(cls, bbox: Any) -> Any: ... @staticmethod - def from_json(geom_input: Any): ... + def from_json(geom_input: Any) -> Any: ... @classmethod - def from_gml(cls, gml_string: Any): ... - def __or__(self, other: Any): ... - def __and__(self, other: Any): ... - def __sub__(self, other: Any): ... - def __xor__(self, other: Any): ... + def from_gml(cls, gml_string: Any) -> Any: ... + def __or__(self, other: Any) -> Any: ... + def __and__(self, other: Any) -> Any: ... + def __sub__(self, other: Any) -> Any: ... + def __xor__(self, other: Any) -> Any: ... def __eq__(self, other: Any) -> Any: ... @property - def dimension(self): ... + def dimension(self) -> Any: ... coord_dim: Any = ... @property - def geom_count(self): ... + def geom_count(self) -> Any: ... @property - def point_count(self): ... + def point_count(self) -> Any: ... @property - def num_points(self): ... + def num_points(self) -> Any: ... @property - def num_coords(self): ... + def num_coords(self) -> Any: ... @property - def geom_type(self): ... + def geom_type(self) -> Any: ... @property - def geom_name(self): ... + def geom_name(self) -> Any: ... @property - def area(self): ... + def area(self) -> Any: ... @property - def envelope(self): ... + def envelope(self) -> Any: ... @property - def empty(self): ... + def empty(self) -> Any: ... @property - def extent(self): ... + def extent(self) -> Any: ... srid: Any = ... @property - def geos(self): ... + def geos(self) -> Any: ... @property - def gml(self): ... + def gml(self) -> Any: ... @property - def hex(self): ... + def hex(self) -> Any: ... @property - def json(self): ... + def json(self) -> Any: ... geojson: Any = ... @property - def kml(self): ... + def kml(self) -> Any: ... @property - def wkb_size(self): ... + def wkb_size(self) -> Any: ... @property - def wkb(self): ... + def wkb(self) -> Any: ... @property - def wkt(self): ... + def wkt(self) -> Any: ... @property - def ewkt(self): ... - def clone(self): ... + def ewkt(self) -> Any: ... + def clone(self) -> Any: ... def close_rings(self) -> None: ... - def transform(self, coord_trans: Any, clone: bool = ...): ... - def intersects(self, other: Any): ... - def equals(self, other: Any): ... - def disjoint(self, other: Any): ... - def touches(self, other: Any): ... - def crosses(self, other: Any): ... - def within(self, other: Any): ... - def contains(self, other: Any): ... - def overlaps(self, other: Any): ... - @property - def boundary(self): ... - @property - def convex_hull(self): ... - def difference(self, other: Any): ... - def intersection(self, other: Any): ... - def sym_difference(self, other: Any): ... - def union(self, other: Any): ... + def transform(self, coord_trans: Any, clone: bool = ...) -> Any: ... + def intersects(self, other: Any) -> Any: ... + def equals(self, other: Any) -> Any: ... + def disjoint(self, other: Any) -> Any: ... + def touches(self, other: Any) -> Any: ... + def crosses(self, other: Any) -> Any: ... + def within(self, other: Any) -> Any: ... + def contains(self, other: Any) -> Any: ... + def overlaps(self, other: Any) -> Any: ... + @property + def boundary(self) -> Any: ... + @property + def convex_hull(self) -> Any: ... + def difference(self, other: Any) -> Any: ... + def intersection(self, other: Any) -> Any: ... + def sym_difference(self, other: Any) -> Any: ... + def union(self, other: Any) -> Any: ... class Point(OGRGeometry): @property - def x(self): ... + def x(self) -> Any: ... @property - def y(self): ... + def y(self) -> Any: ... @property - def z(self): ... + def z(self) -> Any: ... @property - def tuple(self): ... + def tuple(self) -> Any: ... coords: Any = ... class LineString(OGRGeometry): - def __getitem__(self, index: Any): ... - def __len__(self): ... + def __getitem__(self, index: Any) -> Any: ... + def __len__(self) -> Any: ... @property - def tuple(self): ... + def tuple(self) -> Any: ... coords: Any = ... @property - def x(self): ... + def x(self) -> Any: ... @property - def y(self): ... + def y(self) -> Any: ... @property - def z(self): ... + def z(self) -> Any: ... class LinearRing(LineString): ... class Polygon(OGRGeometry): - def __len__(self): ... - def __getitem__(self, index: Any): ... + def __len__(self) -> Any: ... + def __getitem__(self, index: Any) -> Any: ... @property - def shell(self): ... + def shell(self) -> Any: ... exterior_ring: Any = ... @property - def tuple(self): ... + def tuple(self) -> Any: ... coords: Any = ... @property - def point_count(self): ... + def point_count(self) -> Any: ... @property - def centroid(self): ... + def centroid(self) -> Any: ... class GeometryCollection(OGRGeometry): - def __getitem__(self, index: Any): ... - def __len__(self): ... + def __getitem__(self, index: Any) -> Any: ... + def __len__(self) -> Any: ... def add(self, geom: Any) -> None: ... @property - def point_count(self): ... + def point_count(self) -> Any: ... @property - def tuple(self): ... + def tuple(self) -> Any: ... coords: Any = ... class MultiPoint(GeometryCollection): ... diff --git a/django-stubs/contrib/gis/gdal/geomtype.pyi b/django-stubs/contrib/gis/gdal/geomtype.pyi index 5deeccaab..2c0797940 100644 --- a/django-stubs/contrib/gis/gdal/geomtype.pyi +++ b/django-stubs/contrib/gis/gdal/geomtype.pyi @@ -6,7 +6,7 @@ class OGRGeomType: def __init__(self, type_input: Any) -> None: ... def __eq__(self, other: Any) -> Any: ... @property - def name(self): ... + def name(self) -> Any: ... @property - def django(self): ... + def django(self) -> Any: ... def to_multi(self) -> None: ... diff --git a/django-stubs/contrib/gis/gdal/layer.pyi b/django-stubs/contrib/gis/gdal/layer.pyi index 3cbc41c34..d1a7cc1df 100644 --- a/django-stubs/contrib/gis/gdal/layer.pyi +++ b/django-stubs/contrib/gis/gdal/layer.pyi @@ -5,28 +5,28 @@ from django.contrib.gis.gdal.base import GDALBase as GDALBase class Layer(GDALBase): ptr: Any = ... def __init__(self, layer_ptr: Any, ds: Any) -> None: ... - def __getitem__(self, index: Any): ... + def __getitem__(self, index: Any) -> Any: ... def __iter__(self) -> Any: ... - def __len__(self): ... + def __len__(self) -> Any: ... @property - def extent(self): ... + def extent(self) -> Any: ... @property - def name(self): ... + def name(self) -> Any: ... @property - def num_fields(self): ... + def num_fields(self) -> Any: ... @property - def geom_type(self): ... + def geom_type(self) -> Any: ... @property - def srs(self): ... + def srs(self) -> Any: ... @property - def fields(self): ... + def fields(self) -> Any: ... @property - def field_types(self): ... + def field_types(self) -> Any: ... @property - def field_widths(self): ... + def field_widths(self) -> Any: ... @property - def field_precisions(self): ... + def field_precisions(self) -> Any: ... spatial_filter: Any = ... - def get_fields(self, field_name: Any): ... - def get_geoms(self, geos: bool = ...): ... - def test_capability(self, capability: Any): ... + def get_fields(self, field_name: Any) -> Any: ... + def get_geoms(self, geos: bool = ...) -> Any: ... + def test_capability(self, capability: Any) -> Any: ... diff --git a/django-stubs/contrib/gis/gdal/libgdal.pyi b/django-stubs/contrib/gis/gdal/libgdal.pyi index 3bc24d4e5..5b5c38627 100644 --- a/django-stubs/contrib/gis/gdal/libgdal.pyi +++ b/django-stubs/contrib/gis/gdal/libgdal.pyi @@ -6,15 +6,15 @@ lib_names: Any lgdal: Any lwingdal: Any -def std_call(func: Any): ... -def gdal_version(): ... -def gdal_full_version(): ... -def gdal_version_info(): ... +def std_call(func: Any) -> Any: ... +def gdal_version() -> Any: ... +def gdal_full_version() -> Any: ... +def gdal_version_info() -> Any: ... GDAL_VERSION: Any CPLErrorHandler: Any def err_handler(error_class: Any, error_number: Any, message: Any) -> None: ... -def function(name: Any, args: Any, restype: Any): ... +def function(name: Any, args: Any, restype: Any) -> Any: ... set_error_handler: Any diff --git a/django-stubs/contrib/gis/gdal/prototypes/errcheck.pyi b/django-stubs/contrib/gis/gdal/prototypes/errcheck.pyi index cb7c31c1d..29db21223 100644 --- a/django-stubs/contrib/gis/gdal/prototypes/errcheck.pyi +++ b/django-stubs/contrib/gis/gdal/prototypes/errcheck.pyi @@ -1,18 +1,18 @@ from typing import Any, Optional -def arg_byref(args: Any, offset: int = ...): ... -def ptr_byref(args: Any, offset: int = ...): ... +def arg_byref(args: Any, offset: int = ...) -> Any: ... +def ptr_byref(args: Any, offset: int = ...) -> Any: ... def check_const_string( result: Any, func: Any, cargs: Any, offset: Optional[Any] = ..., cpl: bool = ... -): ... +) -> Any: ... def check_string( result: Any, func: Any, cargs: Any, offset: int = ..., str_result: bool = ... -): ... -def check_envelope(result: Any, func: Any, cargs: Any, offset: int = ...): ... -def check_geom(result: Any, func: Any, cargs: Any): ... -def check_geom_offset(result: Any, func: Any, cargs: Any, offset: int = ...): ... -def check_srs(result: Any, func: Any, cargs: Any): ... -def check_arg_errcode(result: Any, func: Any, cargs: Any, cpl: bool = ...): ... +) -> Any: ... +def check_envelope(result: Any, func: Any, cargs: Any, offset: int = ...) -> Any: ... +def check_geom(result: Any, func: Any, cargs: Any) -> Any: ... +def check_geom_offset(result: Any, func: Any, cargs: Any, offset: int = ...) -> Any: ... +def check_srs(result: Any, func: Any, cargs: Any) -> Any: ... +def check_arg_errcode(result: Any, func: Any, cargs: Any, cpl: bool = ...) -> Any: ... def check_errcode(result: Any, func: Any, cargs: Any, cpl: bool = ...) -> None: ... -def check_pointer(result: Any, func: Any, cargs: Any): ... -def check_str_arg(result: Any, func: Any, cargs: Any): ... +def check_pointer(result: Any, func: Any, cargs: Any) -> Any: ... +def check_str_arg(result: Any, func: Any, cargs: Any) -> Any: ... diff --git a/django-stubs/contrib/gis/gdal/prototypes/generation.pyi b/django-stubs/contrib/gis/gdal/prototypes/generation.pyi index 0a3787a8e..170e5a9e2 100644 --- a/django-stubs/contrib/gis/gdal/prototypes/generation.pyi +++ b/django-stubs/contrib/gis/gdal/prototypes/generation.pyi @@ -3,28 +3,30 @@ from typing import Any, Optional class gdal_char_p(c_char_p): ... -def bool_output(func: Any, argtypes: Any, errcheck: Optional[Any] = ...): ... +def bool_output(func: Any, argtypes: Any, errcheck: Optional[Any] = ...) -> Any: ... def double_output( func: Any, argtypes: Any, errcheck: bool = ..., strarg: bool = ..., cpl: bool = ... -): ... -def geom_output(func: Any, argtypes: Any, offset: Optional[Any] = ...): ... -def int_output(func: Any, argtypes: Any, errcheck: Optional[Any] = ...): ... -def int64_output(func: Any, argtypes: Any): ... -def srs_output(func: Any, argtypes: Any): ... +) -> Any: ... +def geom_output(func: Any, argtypes: Any, offset: Optional[Any] = ...) -> Any: ... +def int_output(func: Any, argtypes: Any, errcheck: Optional[Any] = ...) -> Any: ... +def int64_output(func: Any, argtypes: Any) -> Any: ... +def srs_output(func: Any, argtypes: Any) -> Any: ... def const_string_output( func: Any, argtypes: Any, offset: Optional[Any] = ..., decoding: Optional[Any] = ..., cpl: bool = ..., -): ... +) -> Any: ... def string_output( func: Any, argtypes: Any, offset: int = ..., str_result: bool = ..., decoding: Optional[Any] = ..., -): ... -def void_output(func: Any, argtypes: Any, errcheck: bool = ..., cpl: bool = ...): ... -def voidptr_output(func: Any, argtypes: Any, errcheck: bool = ...): ... -def chararray_output(func: Any, argtypes: Any, errcheck: bool = ...): ... +) -> Any: ... +def void_output( + func: Any, argtypes: Any, errcheck: bool = ..., cpl: bool = ... +) -> Any: ... +def voidptr_output(func: Any, argtypes: Any, errcheck: bool = ...) -> Any: ... +def chararray_output(func: Any, argtypes: Any, errcheck: bool = ...) -> Any: ... diff --git a/django-stubs/contrib/gis/gdal/prototypes/geom.pyi b/django-stubs/contrib/gis/gdal/prototypes/geom.pyi index 562c3e995..6a10b4c26 100644 --- a/django-stubs/contrib/gis/gdal/prototypes/geom.pyi +++ b/django-stubs/contrib/gis/gdal/prototypes/geom.pyi @@ -1,8 +1,8 @@ from typing import Any -def env_func(f: Any, argtypes: Any): ... -def pnt_func(f: Any): ... -def topology_func(f: Any): ... +def env_func(f: Any, argtypes: Any) -> Any: ... +def pnt_func(f: Any) -> Any: ... +def topology_func(f: Any) -> Any: ... from_json: Any to_json: Any diff --git a/django-stubs/contrib/gis/gdal/prototypes/srs.pyi b/django-stubs/contrib/gis/gdal/prototypes/srs.pyi index 2070150c9..7fd3f24ba 100644 --- a/django-stubs/contrib/gis/gdal/prototypes/srs.pyi +++ b/django-stubs/contrib/gis/gdal/prototypes/srs.pyi @@ -1,7 +1,7 @@ from typing import Any -def srs_double(f: Any): ... -def units_func(f: Any): ... +def srs_double(f: Any) -> Any: ... +def units_func(f: Any) -> Any: ... clone_srs: Any new_srs: Any diff --git a/django-stubs/contrib/gis/gdal/raster/band.pyi b/django-stubs/contrib/gis/gdal/raster/band.pyi index 2bc9a7695..201ca0756 100644 --- a/django-stubs/contrib/gis/gdal/raster/band.pyi +++ b/django-stubs/contrib/gis/gdal/raster/band.pyi @@ -1,4 +1,4 @@ -from typing import Any, Optional +from typing import Any, List, Optional from django.contrib.gis.gdal.raster.base import GDALRasterBase as GDALRasterBase @@ -6,28 +6,28 @@ class GDALBand(GDALRasterBase): source: Any = ... def __init__(self, source: Any, index: Any) -> None: ... @property - def description(self): ... + def description(self) -> Any: ... @property - def width(self): ... + def width(self) -> Any: ... @property - def height(self): ... + def height(self) -> Any: ... @property - def pixel_count(self): ... - def statistics(self, refresh: bool = ..., approximate: bool = ...): ... + def pixel_count(self) -> Any: ... + def statistics(self, refresh: bool = ..., approximate: bool = ...) -> Any: ... @property - def min(self): ... + def min(self) -> Any: ... @property - def max(self): ... + def max(self) -> Any: ... @property - def mean(self): ... + def mean(self) -> Any: ... @property - def std(self): ... + def std(self) -> Any: ... @property - def nodata_value(self): ... + def nodata_value(self) -> Any: ... @nodata_value.setter def nodata_value(self, value: Any) -> None: ... - def datatype(self, as_string: bool = ...): ... - def color_interp(self, as_string: bool = ...): ... + def datatype(self, as_string: bool = ...) -> Any: ... + def color_interp(self, as_string: bool = ...) -> Any: ... def data( self, data: Optional[Any] = ..., @@ -35,11 +35,11 @@ class GDALBand(GDALRasterBase): size: Optional[Any] = ..., shape: Optional[Any] = ..., as_memoryview: bool = ..., - ): ... + ) -> Any: ... -class BandList(list): +class BandList(List[Any]): source: Any = ... def __init__(self, source: Any) -> None: ... def __iter__(self) -> Any: ... - def __len__(self): ... - def __getitem__(self, index: Any): ... + def __len__(self) -> Any: ... + def __getitem__(self, index: Any) -> Any: ... diff --git a/django-stubs/contrib/gis/gdal/raster/base.pyi b/django-stubs/contrib/gis/gdal/raster/base.pyi index 4b3fc5cc5..fabfebf44 100644 --- a/django-stubs/contrib/gis/gdal/raster/base.pyi +++ b/django-stubs/contrib/gis/gdal/raster/base.pyi @@ -4,6 +4,6 @@ from django.contrib.gis.gdal.base import GDALBase as GDALBase class GDALRasterBase(GDALBase): @property - def metadata(self): ... + def metadata(self) -> Any: ... @metadata.setter def metadata(self, value: Any) -> None: ... diff --git a/django-stubs/contrib/gis/gdal/raster/source.pyi b/django-stubs/contrib/gis/gdal/raster/source.pyi index 3bc2af016..e3fd2626e 100644 --- a/django-stubs/contrib/gis/gdal/raster/source.pyi +++ b/django-stubs/contrib/gis/gdal/raster/source.pyi @@ -1,16 +1,16 @@ -from typing import Any, Optional +from typing import Any, List, Optional from django.contrib.gis.gdal.raster.base import GDALRasterBase as GDALRasterBase -class TransformPoint(list): +class TransformPoint(List[Any]): indices: Any = ... def __init__(self, raster: Any, prop: Any) -> None: ... @property - def x(self): ... + def x(self) -> Any: ... @x.setter def x(self, value: Any) -> None: ... @property - def y(self): ... + def y(self) -> Any: ... @y.setter def y(self, value: Any) -> None: ... @@ -19,38 +19,40 @@ class GDALRaster(GDALRasterBase): def __init__(self, ds_input: Any, write: bool = ...) -> None: ... def __del__(self) -> None: ... @property - def vsi_buffer(self): ... - def is_vsi_based(self): ... + def vsi_buffer(self) -> Any: ... + def is_vsi_based(self) -> Any: ... @property - def name(self): ... - def driver(self): ... + def name(self) -> Any: ... + def driver(self) -> Any: ... @property - def width(self): ... + def width(self) -> Any: ... @property - def height(self): ... + def height(self) -> Any: ... @property - def srs(self): ... + def srs(self) -> Any: ... @srs.setter def srs(self, value: Any) -> None: ... @property - def srid(self): ... + def srid(self) -> Any: ... @srid.setter def srid(self, value: Any) -> None: ... @property - def geotransform(self): ... + def geotransform(self) -> Any: ... @geotransform.setter def geotransform(self, values: Any) -> None: ... @property - def origin(self): ... + def origin(self) -> Any: ... @property - def scale(self): ... + def scale(self) -> Any: ... @property - def skew(self): ... + def skew(self) -> Any: ... @property - def extent(self): ... + def extent(self) -> Any: ... @property - def bands(self): ... - def warp(self, ds_input: Any, resampling: str = ..., max_error: float = ...): ... + def bands(self) -> Any: ... + def warp( + self, ds_input: Any, resampling: str = ..., max_error: float = ... + ) -> Any: ... def transform( self, srid: Any, @@ -58,6 +60,6 @@ class GDALRaster(GDALRasterBase): name: Optional[Any] = ..., resampling: str = ..., max_error: float = ..., - ): ... + ) -> Any: ... @property - def info(self): ... + def info(self) -> Any: ... diff --git a/django-stubs/contrib/gis/gdal/srs.pyi b/django-stubs/contrib/gis/gdal/srs.pyi index 12229d179..9de926a7d 100644 --- a/django-stubs/contrib/gis/gdal/srs.pyi +++ b/django-stubs/contrib/gis/gdal/srs.pyi @@ -14,54 +14,54 @@ class SpatialReference(GDALBase): def __init__( self, srs_input: str = ..., srs_type: str = ..., axis_order: Optional[Any] = ... ) -> None: ... - def __getitem__(self, target: Any): ... - def attr_value(self, target: Any, index: int = ...): ... - def auth_name(self, target: Any): ... - def auth_code(self, target: Any): ... - def clone(self): ... + def __getitem__(self, target: Any) -> Any: ... + def attr_value(self, target: Any, index: int = ...) -> Any: ... + def auth_name(self, target: Any) -> Any: ... + def auth_code(self, target: Any) -> Any: ... + def clone(self) -> Any: ... def from_esri(self) -> None: ... def identify_epsg(self) -> None: ... def to_esri(self) -> None: ... def validate(self) -> None: ... @property - def name(self): ... + def name(self) -> Any: ... @property - def srid(self): ... + def srid(self) -> Any: ... @property - def linear_name(self): ... + def linear_name(self) -> Any: ... @property - def linear_units(self): ... + def linear_units(self) -> Any: ... @property - def angular_name(self): ... + def angular_name(self) -> Any: ... @property - def angular_units(self): ... + def angular_units(self) -> Any: ... @property - def units(self): ... + def units(self) -> Any: ... @property - def ellipsoid(self): ... + def ellipsoid(self) -> Any: ... @property - def semi_major(self): ... + def semi_major(self) -> Any: ... @property - def semi_minor(self): ... + def semi_minor(self) -> Any: ... @property - def inverse_flattening(self): ... + def inverse_flattening(self) -> Any: ... @property - def geographic(self): ... + def geographic(self) -> Any: ... @property - def local(self): ... + def local(self) -> Any: ... @property - def projected(self): ... + def projected(self) -> Any: ... def import_epsg(self, epsg: Any) -> None: ... def import_proj(self, proj: Any) -> None: ... def import_user_input(self, user_input: Any) -> None: ... def import_wkt(self, wkt: Any) -> None: ... def import_xml(self, xml: Any) -> None: ... @property - def wkt(self): ... + def wkt(self) -> Any: ... @property - def proj(self): ... + def proj(self) -> Any: ... @property - def proj4(self): ... + def proj4(self) -> Any: ... class CoordTransform(GDALBase): destructor: Any = ... diff --git a/django-stubs/contrib/gis/geoip2/base.pyi b/django-stubs/contrib/gis/geoip2/base.pyi index ccf56ae40..87ef45e4e 100644 --- a/django-stubs/contrib/gis/geoip2/base.pyi +++ b/django-stubs/contrib/gis/geoip2/base.pyi @@ -19,15 +19,15 @@ class GeoIP2: city: Optional[Any] = ..., ) -> None: ... def __del__(self) -> None: ... - def city(self, query: Any): ... - def country_code(self, query: Any): ... - def country_name(self, query: Any): ... - def country(self, query: Any): ... - def coords(self, query: Any, ordering: Any = ...): ... - def lon_lat(self, query: Any): ... - def lat_lon(self, query: Any): ... - def geos(self, query: Any): ... + def city(self, query: Any) -> Any: ... + def country_code(self, query: Any) -> Any: ... + def country_name(self, query: Any) -> Any: ... + def country(self, query: Any) -> Any: ... + def coords(self, query: Any, ordering: Any = ...) -> Any: ... + def lon_lat(self, query: Any) -> Any: ... + def lat_lon(self, query: Any) -> Any: ... + def geos(self, query: Any) -> Any: ... @property - def info(self): ... + def info(self) -> Any: ... @classmethod - def open(cls, full_path: Any, cache: Any): ... + def open(cls, full_path: Any, cache: Any) -> Any: ... diff --git a/django-stubs/contrib/gis/geoip2/resources.pyi b/django-stubs/contrib/gis/geoip2/resources.pyi index 2936c61fa..217bfc8b7 100644 --- a/django-stubs/contrib/gis/geoip2/resources.pyi +++ b/django-stubs/contrib/gis/geoip2/resources.pyi @@ -1,4 +1,4 @@ from typing import Any -def City(response: Any): ... -def Country(response: Any): ... +def City(response: Any) -> Any: ... +def Country(response: Any) -> Any: ... diff --git a/django-stubs/contrib/gis/geos/collections.pyi b/django-stubs/contrib/gis/geos/collections.pyi index 8bcb045a8..578a23cfd 100644 --- a/django-stubs/contrib/gis/geos/collections.pyi +++ b/django-stubs/contrib/gis/geos/collections.pyi @@ -6,11 +6,11 @@ from django.contrib.gis.geos.geometry import LinearGeometryMixin as LinearGeomet class GeometryCollection(GEOSGeometry): def __init__(self, *args: Any, **kwargs: Any) -> None: ... def __iter__(self) -> Any: ... - def __len__(self): ... + def __len__(self) -> Any: ... @property - def kml(self): ... + def kml(self) -> Any: ... @property - def tuple(self): ... + def tuple(self) -> Any: ... coords: Any = ... class MultiPoint(GeometryCollection): ... diff --git a/django-stubs/contrib/gis/geos/coordseq.pyi b/django-stubs/contrib/gis/geos/coordseq.pyi index 69afc3d52..b44d0e61e 100644 --- a/django-stubs/contrib/gis/geos/coordseq.pyi +++ b/django-stubs/contrib/gis/geos/coordseq.pyi @@ -6,27 +6,27 @@ class GEOSCoordSeq(GEOSBase): ptr_type: Any = ... def __init__(self, ptr: Any, z: bool = ...) -> None: ... def __iter__(self) -> Any: ... - def __len__(self): ... - def __getitem__(self, index: Any): ... + def __len__(self) -> Any: ... + def __getitem__(self, index: Any) -> Any: ... def __setitem__(self, index: Any, value: Any) -> None: ... - def getOrdinate(self, dimension: Any, index: Any): ... + def getOrdinate(self, dimension: Any, index: Any) -> Any: ... def setOrdinate(self, dimension: Any, index: Any, value: Any) -> None: ... - def getX(self, index: Any): ... + def getX(self, index: Any) -> Any: ... def setX(self, index: Any, value: Any) -> None: ... - def getY(self, index: Any): ... + def getY(self, index: Any) -> Any: ... def setY(self, index: Any, value: Any) -> None: ... - def getZ(self, index: Any): ... + def getZ(self, index: Any) -> Any: ... def setZ(self, index: Any, value: Any) -> None: ... @property - def size(self): ... + def size(self) -> Any: ... @property - def dims(self): ... + def dims(self) -> Any: ... @property - def hasz(self): ... - def clone(self): ... + def hasz(self) -> Any: ... + def clone(self) -> Any: ... @property - def kml(self): ... + def kml(self) -> Any: ... @property - def tuple(self): ... + def tuple(self) -> Any: ... @property - def is_counterclockwise(self): ... + def is_counterclockwise(self) -> Any: ... diff --git a/django-stubs/contrib/gis/geos/factory.pyi b/django-stubs/contrib/gis/geos/factory.pyi index 99d436108..81aeee71a 100644 --- a/django-stubs/contrib/gis/geos/factory.pyi +++ b/django-stubs/contrib/gis/geos/factory.pyi @@ -1,4 +1,4 @@ from typing import Any -def fromfile(file_h: Any): ... -def fromstr(string: Any, **kwargs: Any): ... +def fromfile(file_h: Any) -> Any: ... +def fromstr(string: Any, **kwargs: Any) -> Any: ... diff --git a/django-stubs/contrib/gis/geos/geometry.pyi b/django-stubs/contrib/gis/geos/geometry.pyi index d45dcbad3..c54fde72e 100644 --- a/django-stubs/contrib/gis/geos/geometry.pyi +++ b/django-stubs/contrib/gis/geos/geometry.pyi @@ -12,90 +12,90 @@ class GEOSGeometryBase(GEOSBase): has_cs: bool = ... __class__: Any = ... def __init__(self, ptr: Any, cls: Any) -> None: ... - def __copy__(self): ... - def __deepcopy__(self, memodict: Any): ... + def __copy__(self) -> Any: ... + def __deepcopy__(self, memodict: Any) -> Any: ... @staticmethod - def from_ewkt(ewkt: Any): ... + def from_ewkt(ewkt: Any) -> Any: ... @classmethod - def from_gml(cls, gml_string: Any): ... + def from_gml(cls, gml_string: Any) -> Any: ... def __eq__(self, other: Any) -> Any: ... def __hash__(self) -> Any: ... - def __or__(self, other: Any): ... - def __and__(self, other: Any): ... - def __sub__(self, other: Any): ... - def __xor__(self, other: Any): ... + def __or__(self, other: Any) -> Any: ... + def __and__(self, other: Any) -> Any: ... + def __sub__(self, other: Any) -> Any: ... + def __xor__(self, other: Any) -> Any: ... @property - def coord_seq(self): ... + def coord_seq(self) -> Any: ... @property - def geom_type(self): ... + def geom_type(self) -> Any: ... @property - def geom_typeid(self): ... + def geom_typeid(self) -> Any: ... @property - def num_geom(self): ... + def num_geom(self) -> Any: ... @property - def num_coords(self): ... + def num_coords(self) -> Any: ... @property - def num_points(self): ... + def num_points(self) -> Any: ... @property - def dims(self): ... + def dims(self) -> Any: ... def normalize(self) -> None: ... @property - def empty(self): ... + def empty(self) -> Any: ... @property - def hasz(self): ... + def hasz(self) -> Any: ... @property - def ring(self): ... + def ring(self) -> Any: ... @property - def simple(self): ... + def simple(self) -> Any: ... @property - def valid(self): ... + def valid(self) -> Any: ... @property - def valid_reason(self): ... - def contains(self, other: Any): ... - def covers(self, other: Any): ... - def crosses(self, other: Any): ... - def disjoint(self, other: Any): ... - def equals(self, other: Any): ... - def equals_exact(self, other: Any, tolerance: int = ...): ... - def intersects(self, other: Any): ... - def overlaps(self, other: Any): ... - def relate_pattern(self, other: Any, pattern: Any): ... - def touches(self, other: Any): ... - def within(self, other: Any): ... + def valid_reason(self) -> Any: ... + def contains(self, other: Any) -> Any: ... + def covers(self, other: Any) -> Any: ... + def crosses(self, other: Any) -> Any: ... + def disjoint(self, other: Any) -> Any: ... + def equals(self, other: Any) -> Any: ... + def equals_exact(self, other: Any, tolerance: int = ...) -> Any: ... + def intersects(self, other: Any) -> Any: ... + def overlaps(self, other: Any) -> Any: ... + def relate_pattern(self, other: Any, pattern: Any) -> Any: ... + def touches(self, other: Any) -> Any: ... + def within(self, other: Any) -> Any: ... @property - def srid(self): ... + def srid(self) -> Any: ... @srid.setter def srid(self, srid: Any) -> None: ... @property - def ewkt(self): ... + def ewkt(self) -> Any: ... @property - def wkt(self): ... + def wkt(self) -> Any: ... @property - def hex(self): ... + def hex(self) -> Any: ... @property - def hexewkb(self): ... + def hexewkb(self) -> Any: ... @property - def json(self): ... + def json(self) -> Any: ... geojson: Any = ... @property - def wkb(self): ... + def wkb(self) -> Any: ... @property - def ewkb(self): ... + def ewkb(self) -> Any: ... @property - def kml(self): ... + def kml(self) -> Any: ... @property - def prepared(self): ... + def prepared(self) -> Any: ... @property - def ogr(self): ... + def ogr(self) -> Any: ... @property - def srs(self): ... + def srs(self) -> Any: ... @property - def crs(self): ... + def crs(self) -> Any: ... ptr: Any = ... - def transform(self, ct: Any, clone: bool = ...): ... + def transform(self, ct: Any, clone: bool = ...) -> Any: ... @property - def boundary(self): ... - def buffer(self, width: Any, quadsegs: int = ...): ... + def boundary(self) -> Any: ... + def buffer(self, width: Any, quadsegs: int = ...) -> Any: ... def buffer_with_style( self, width: Any, @@ -103,41 +103,43 @@ class GEOSGeometryBase(GEOSBase): end_cap_style: int = ..., join_style: int = ..., mitre_limit: float = ..., - ): ... + ) -> Any: ... @property - def centroid(self): ... + def centroid(self) -> Any: ... @property - def convex_hull(self): ... - def difference(self, other: Any): ... + def convex_hull(self) -> Any: ... + def difference(self, other: Any) -> Any: ... @property - def envelope(self): ... - def intersection(self, other: Any): ... + def envelope(self) -> Any: ... + def intersection(self, other: Any) -> Any: ... @property - def point_on_surface(self): ... - def relate(self, other: Any): ... - def simplify(self, tolerance: float = ..., preserve_topology: bool = ...): ... - def sym_difference(self, other: Any): ... + def point_on_surface(self) -> Any: ... + def relate(self, other: Any) -> Any: ... + def simplify( + self, tolerance: float = ..., preserve_topology: bool = ... + ) -> Any: ... + def sym_difference(self, other: Any) -> Any: ... @property - def unary_union(self): ... - def union(self, other: Any): ... + def unary_union(self) -> Any: ... + def union(self, other: Any) -> Any: ... @property - def area(self): ... - def distance(self, other: Any): ... + def area(self) -> Any: ... + def distance(self, other: Any) -> Any: ... @property - def extent(self): ... + def extent(self) -> Any: ... @property - def length(self): ... - def clone(self): ... + def length(self) -> Any: ... + def clone(self) -> Any: ... class LinearGeometryMixin: - def interpolate(self, distance: Any): ... - def interpolate_normalized(self, distance: Any): ... - def project(self, point: Any): ... - def project_normalized(self, point: Any): ... + def interpolate(self, distance: Any) -> Any: ... + def interpolate_normalized(self, distance: Any) -> Any: ... + def project(self, point: Any) -> Any: ... + def project_normalized(self, point: Any) -> Any: ... @property - def merged(self): ... + def merged(self) -> Any: ... @property - def closed(self): ... + def closed(self) -> Any: ... class GEOSGeometry(GEOSGeometryBase, ListMixin): srid: Any = ... diff --git a/django-stubs/contrib/gis/geos/io.pyi b/django-stubs/contrib/gis/geos/io.pyi index a2e536d01..c1fed95a3 100644 --- a/django-stubs/contrib/gis/geos/io.pyi +++ b/django-stubs/contrib/gis/geos/io.pyi @@ -5,7 +5,7 @@ from django.contrib.gis.geos.prototypes.io import WKTWriter as WKTWriter from django.contrib.gis.geos.prototypes.io import _WKBReader, _WKTReader class WKBReader(_WKBReader): - def read(self, wkb: Any): ... + def read(self, wkb: Any) -> Any: ... class WKTReader(_WKTReader): - def read(self, wkt: Any): ... + def read(self, wkt: Any) -> Any: ... diff --git a/django-stubs/contrib/gis/geos/libgeos.pyi b/django-stubs/contrib/gis/geos/libgeos.pyi index 49ab87fb1..0d6a4155e 100644 --- a/django-stubs/contrib/gis/geos/libgeos.pyi +++ b/django-stubs/contrib/gis/geos/libgeos.pyi @@ -3,7 +3,7 @@ from typing import Any, Optional logger: Any -def load_geos(): ... +def load_geos() -> Any: ... NOTICEFUNC: Any @@ -37,8 +37,8 @@ class GEOSFuncFactory: errcheck: Optional[Any] = ..., argtypes: Optional[Any] = ... ) -> None: ... - def __call__(self, *args: Any): ... - def func(self): ... + def __call__(self, *args: Any) -> Any: ... + def func(self) -> Any: ... -def geos_version(): ... -def geos_version_tuple(): ... +def geos_version() -> Any: ... +def geos_version_tuple() -> Any: ... diff --git a/django-stubs/contrib/gis/geos/linestring.pyi b/django-stubs/contrib/gis/geos/linestring.pyi index b9580b7f7..68700c8ae 100644 --- a/django-stubs/contrib/gis/geos/linestring.pyi +++ b/django-stubs/contrib/gis/geos/linestring.pyi @@ -7,19 +7,19 @@ class LineString(LinearGeometryMixin, GEOSGeometry): has_cs: bool = ... def __init__(self, *args: Any, **kwargs: Any) -> None: ... def __iter__(self) -> Any: ... - def __len__(self): ... + def __len__(self) -> Any: ... @property - def tuple(self): ... + def tuple(self) -> Any: ... coords: Any = ... @property - def array(self): ... + def array(self) -> Any: ... @property - def x(self): ... + def x(self) -> Any: ... @property - def y(self): ... + def y(self) -> Any: ... @property - def z(self): ... + def z(self) -> Any: ... class LinearRing(LineString): @property - def is_counterclockwise(self): ... + def is_counterclockwise(self) -> Any: ... diff --git a/django-stubs/contrib/gis/geos/mutable_list.pyi b/django-stubs/contrib/gis/geos/mutable_list.pyi index 8bbac613f..f5c3ed88d 100644 --- a/django-stubs/contrib/gis/geos/mutable_list.pyi +++ b/django-stubs/contrib/gis/geos/mutable_list.pyi @@ -2,23 +2,23 @@ from typing import Any, Optional class ListMixin: def __init__(self, *args: Any, **kwargs: Any) -> None: ... - def __getitem__(self, index: Any): ... + def __getitem__(self, index: Any) -> Any: ... def __delitem__(self, index: Any) -> None: ... def __setitem__(self, index: Any, val: Any) -> None: ... - def __add__(self, other: Any): ... - def __radd__(self, other: Any): ... - def __iadd__(self, other: Any): ... - def __mul__(self, n: Any): ... - def __rmul__(self, n: Any): ... - def __imul__(self, n: Any): ... + def __add__(self, other: Any) -> Any: ... + def __radd__(self, other: Any) -> Any: ... + def __iadd__(self, other: Any) -> Any: ... + def __mul__(self, n: Any) -> Any: ... + def __rmul__(self, n: Any) -> Any: ... + def __imul__(self, n: Any) -> Any: ... def __eq__(self, other: Any) -> Any: ... def __lt__(self, other: Any) -> Any: ... - def count(self, val: Any): ... - def index(self, val: Any): ... + def count(self, val: Any) -> Any: ... + def index(self, val: Any) -> Any: ... def append(self, val: Any) -> None: ... def extend(self, vals: Any) -> None: ... def insert(self, index: Any, val: Any) -> None: ... - def pop(self, index: int = ...): ... + def pop(self, index: int = ...) -> Any: ... def remove(self, val: Any) -> None: ... def reverse(self) -> None: ... def sort(self, key: Optional[Any] = ..., reverse: bool = ...) -> None: ... diff --git a/django-stubs/contrib/gis/geos/point.pyi b/django-stubs/contrib/gis/geos/point.pyi index aab3ae3cf..3a8034a49 100644 --- a/django-stubs/contrib/gis/geos/point.pyi +++ b/django-stubs/contrib/gis/geos/point.pyi @@ -12,21 +12,21 @@ class Point(GEOSGeometry): srid: Optional[Any] = ..., ) -> None: ... def __iter__(self) -> Any: ... - def __len__(self): ... + def __len__(self) -> Any: ... @property - def x(self): ... + def x(self) -> Any: ... @x.setter def x(self, value: Any) -> None: ... @property - def y(self): ... + def y(self) -> Any: ... @y.setter def y(self, value: Any) -> None: ... @property - def z(self): ... + def z(self) -> Any: ... @z.setter def z(self, value: Any) -> None: ... @property - def tuple(self): ... + def tuple(self) -> Any: ... @tuple.setter def tuple(self, tup: Any) -> None: ... coords: Any = ... diff --git a/django-stubs/contrib/gis/geos/polygon.pyi b/django-stubs/contrib/gis/geos/polygon.pyi index d6aac49ce..a1dc6a6da 100644 --- a/django-stubs/contrib/gis/geos/polygon.pyi +++ b/django-stubs/contrib/gis/geos/polygon.pyi @@ -5,15 +5,15 @@ from django.contrib.gis.geos.geometry import GEOSGeometry as GEOSGeometry class Polygon(GEOSGeometry): def __init__(self, *args: Any, **kwargs: Any) -> None: ... def __iter__(self) -> Any: ... - def __len__(self): ... + def __len__(self) -> Any: ... @classmethod - def from_bbox(cls, bbox: Any): ... + def from_bbox(cls, bbox: Any) -> Any: ... @property - def num_interior_rings(self): ... + def num_interior_rings(self) -> Any: ... exterior_ring: Any = ... shell: Any = ... @property - def tuple(self): ... + def tuple(self) -> Any: ... coords: Any = ... @property - def kml(self): ... + def kml(self) -> Any: ... diff --git a/django-stubs/contrib/gis/geos/prepared.pyi b/django-stubs/contrib/gis/geos/prepared.pyi index 98f79da94..731332e3c 100644 --- a/django-stubs/contrib/gis/geos/prepared.pyi +++ b/django-stubs/contrib/gis/geos/prepared.pyi @@ -7,12 +7,12 @@ class PreparedGeometry(GEOSBase): destructor: Any = ... ptr: Any = ... def __init__(self, geom: Any) -> None: ... - def contains(self, other: Any): ... - def contains_properly(self, other: Any): ... - def covers(self, other: Any): ... - def intersects(self, other: Any): ... - def crosses(self, other: Any): ... - def disjoint(self, other: Any): ... - def overlaps(self, other: Any): ... - def touches(self, other: Any): ... - def within(self, other: Any): ... + def contains(self, other: Any) -> Any: ... + def contains_properly(self, other: Any) -> Any: ... + def covers(self, other: Any) -> Any: ... + def intersects(self, other: Any) -> Any: ... + def crosses(self, other: Any) -> Any: ... + def disjoint(self, other: Any) -> Any: ... + def overlaps(self, other: Any) -> Any: ... + def touches(self, other: Any) -> Any: ... + def within(self, other: Any) -> Any: ... diff --git a/django-stubs/contrib/gis/geos/prototypes/coordseq.pyi b/django-stubs/contrib/gis/geos/prototypes/coordseq.pyi index c4a510524..78ef56d91 100644 --- a/django-stubs/contrib/gis/geos/prototypes/coordseq.pyi +++ b/django-stubs/contrib/gis/geos/prototypes/coordseq.pyi @@ -2,8 +2,8 @@ from typing import Any from django.contrib.gis.geos.libgeos import GEOSFuncFactory as GEOSFuncFactory -def check_cs_op(result: Any, func: Any, cargs: Any): ... -def check_cs_get(result: Any, func: Any, cargs: Any): ... +def check_cs_op(result: Any, func: Any, cargs: Any) -> Any: ... +def check_cs_get(result: Any, func: Any, cargs: Any) -> Any: ... class CsInt(GEOSFuncFactory): argtypes: Any = ... @@ -19,7 +19,7 @@ class CsOperation(GEOSFuncFactory): class CsOutput(GEOSFuncFactory): restype: Any = ... @staticmethod - def errcheck(result: Any, func: Any, cargs: Any): ... + def errcheck(result: Any, func: Any, cargs: Any) -> Any: ... cs_clone: Any create_cs: Any diff --git a/django-stubs/contrib/gis/geos/prototypes/errcheck.pyi b/django-stubs/contrib/gis/geos/prototypes/errcheck.pyi index cb1d18476..fb59af59b 100644 --- a/django-stubs/contrib/gis/geos/prototypes/errcheck.pyi +++ b/django-stubs/contrib/gis/geos/prototypes/errcheck.pyi @@ -2,10 +2,10 @@ from typing import Any free: Any -def last_arg_byref(args: Any): ... -def check_dbl(result: Any, func: Any, cargs: Any): ... -def check_geom(result: Any, func: Any, cargs: Any): ... -def check_minus_one(result: Any, func: Any, cargs: Any): ... -def check_predicate(result: Any, func: Any, cargs: Any): ... -def check_sized_string(result: Any, func: Any, cargs: Any): ... -def check_string(result: Any, func: Any, cargs: Any): ... +def last_arg_byref(args: Any) -> Any: ... +def check_dbl(result: Any, func: Any, cargs: Any) -> Any: ... +def check_geom(result: Any, func: Any, cargs: Any) -> Any: ... +def check_minus_one(result: Any, func: Any, cargs: Any) -> Any: ... +def check_predicate(result: Any, func: Any, cargs: Any) -> Any: ... +def check_sized_string(result: Any, func: Any, cargs: Any) -> Any: ... +def check_string(result: Any, func: Any, cargs: Any) -> Any: ... diff --git a/django-stubs/contrib/gis/geos/prototypes/io.pyi b/django-stubs/contrib/gis/geos/prototypes/io.pyi index 9ee704dff..bdeff353d 100644 --- a/django-stubs/contrib/gis/geos/prototypes/io.pyi +++ b/django-stubs/contrib/gis/geos/prototypes/io.pyi @@ -66,12 +66,12 @@ class IOBase(GEOSBase): class _WKTReader(IOBase): ptr_type: Any = ... destructor: Any = ... - def read(self, wkt: Any): ... + def read(self, wkt: Any) -> Any: ... class _WKBReader(IOBase): ptr_type: Any = ... destructor: Any = ... - def read(self, wkb: Any): ... + def read(self, wkb: Any) -> Any: ... class WKTWriter(IOBase): ptr_type: Any = ... @@ -79,17 +79,17 @@ class WKTWriter(IOBase): def __init__( self, dim: int = ..., trim: bool = ..., precision: Optional[Any] = ... ) -> None: ... - def write(self, geom: Any): ... + def write(self, geom: Any) -> Any: ... @property - def outdim(self): ... + def outdim(self) -> Any: ... @outdim.setter def outdim(self, new_dim: Any) -> None: ... @property - def trim(self): ... + def trim(self) -> Any: ... @trim.setter def trim(self, flag: Any) -> None: ... @property - def precision(self): ... + def precision(self) -> Any: ... @precision.setter def precision(self, precision: Any) -> None: ... @@ -98,15 +98,15 @@ class WKBWriter(IOBase): destructor: Any = ... geos_version: Any = ... def __init__(self, dim: int = ...) -> None: ... - def write(self, geom: Any): ... - def write_hex(self, geom: Any): ... + def write(self, geom: Any) -> Any: ... + def write_hex(self, geom: Any) -> Any: ... byteorder: Any = ... @property - def outdim(self): ... + def outdim(self) -> Any: ... @outdim.setter def outdim(self, new_dim: Any) -> None: ... @property - def srid(self): ... + def srid(self) -> Any: ... @srid.setter def srid(self, include: Any) -> None: ... @@ -119,8 +119,8 @@ class ThreadLocalIO(threading.local): thread_context: Any -def wkt_r(): ... -def wkt_w(dim: int = ..., trim: bool = ..., precision: Optional[Any] = ...): ... -def wkb_r(): ... -def wkb_w(dim: int = ...): ... -def ewkb_w(dim: int = ...): ... +def wkt_r() -> Any: ... +def wkt_w(dim: int = ..., trim: bool = ..., precision: Optional[Any] = ...) -> Any: ... +def wkb_r() -> Any: ... +def wkb_w(dim: int = ...) -> Any: ... +def ewkb_w(dim: int = ...) -> Any: ... diff --git a/django-stubs/contrib/gis/geos/prototypes/threadsafe.pyi b/django-stubs/contrib/gis/geos/prototypes/threadsafe.pyi index e78ae7af2..f916b0cbc 100644 --- a/django-stubs/contrib/gis/geos/prototypes/threadsafe.pyi +++ b/django-stubs/contrib/gis/geos/prototypes/threadsafe.pyi @@ -18,7 +18,7 @@ class GEOSFunc: cfunc: Any = ... thread_context: Any = ... def __init__(self, func_name: Any) -> None: ... - def __call__(self, *args: Any): ... + def __call__(self, *args: Any) -> Any: ... argtypes: Any = ... restype: Any = ... errcheck: Any = ... diff --git a/django-stubs/contrib/gis/measure.pyi b/django-stubs/contrib/gis/measure.pyi index b02f65672..2ee3201d6 100644 --- a/django-stubs/contrib/gis/measure.pyi +++ b/django-stubs/contrib/gis/measure.pyi @@ -7,36 +7,36 @@ class MeasureBase: LALIAS: Any = ... def __init__(self, default_unit: Optional[Any] = ..., **kwargs: Any) -> None: ... standard: Any = ... - def __getattr__(self, name: Any): ... + def __getattr__(self, name: Any) -> Any: ... def __eq__(self, other: Any) -> Any: ... def __lt__(self, other: Any) -> Any: ... - def __add__(self, other: Any): ... - def __iadd__(self, other: Any): ... - def __sub__(self, other: Any): ... - def __isub__(self, other: Any): ... - def __mul__(self, other: Any): ... - def __imul__(self, other: Any): ... - def __rmul__(self, other: Any): ... - def __truediv__(self, other: Any): ... - def __itruediv__(self, other: Any): ... - def __bool__(self): ... - def default_units(self, kwargs: Any): ... + def __add__(self, other: Any) -> Any: ... + def __iadd__(self, other: Any) -> Any: ... + def __sub__(self, other: Any) -> Any: ... + def __isub__(self, other: Any) -> Any: ... + def __mul__(self, other: Any) -> Any: ... + def __imul__(self, other: Any) -> Any: ... + def __rmul__(self, other: Any) -> Any: ... + def __truediv__(self, other: Any) -> Any: ... + def __itruediv__(self, other: Any) -> Any: ... + def __bool__(self) -> Any: ... + def default_units(self, kwargs: Any) -> Any: ... @classmethod - def unit_attname(cls, unit_str: Any): ... + def unit_attname(cls, unit_str: Any) -> Any: ... class Distance(MeasureBase): STANDARD_UNIT: str = ... UNITS: Any = ... ALIAS: Any = ... LALIAS: Any = ... - def __mul__(self, other: Any): ... + def __mul__(self, other: Any) -> Any: ... class Area(MeasureBase): STANDARD_UNIT: Any = ... UNITS: Any = ... ALIAS: Any = ... LALIAS: Any = ... - def __truediv__(self, other: Any): ... + def __truediv__(self, other: Any) -> Any: ... D = Distance A = Area diff --git a/django-stubs/contrib/gis/ptr.pyi b/django-stubs/contrib/gis/ptr.pyi index 8d3110c87..10de23b5f 100644 --- a/django-stubs/contrib/gis/ptr.pyi +++ b/django-stubs/contrib/gis/ptr.pyi @@ -5,7 +5,7 @@ class CPointerBase: destructor: Any = ... null_ptr_exception_class: Any = ... @property - def ptr(self): ... + def ptr(self) -> Any: ... @ptr.setter def ptr(self, ptr: Any) -> None: ... def __del__(self) -> None: ... diff --git a/django-stubs/contrib/gis/serializers/geojson.pyi b/django-stubs/contrib/gis/serializers/geojson.pyi index 098243305..936ae7a03 100644 --- a/django-stubs/contrib/gis/serializers/geojson.pyi +++ b/django-stubs/contrib/gis/serializers/geojson.pyi @@ -7,7 +7,7 @@ class Serializer(JSONSerializer): def end_serialization(self) -> None: ... geometry_field: Any = ... def start_object(self, obj: Any) -> None: ... - def get_dump_object(self, obj: Any): ... + def get_dump_object(self, obj: Any) -> Any: ... def handle_field(self, obj: Any, field: Any) -> None: ... class Deserializer: diff --git a/django-stubs/contrib/gis/shortcuts.pyi b/django-stubs/contrib/gis/shortcuts.pyi index ec69fd459..df669774c 100644 --- a/django-stubs/contrib/gis/shortcuts.pyi +++ b/django-stubs/contrib/gis/shortcuts.pyi @@ -1,5 +1,5 @@ from typing import Any -def compress_kml(kml: Any): ... -def render_to_kml(*args: Any, **kwargs: Any): ... -def render_to_kmz(*args: Any, **kwargs: Any): ... +def compress_kml(kml: Any) -> Any: ... +def render_to_kml(*args: Any, **kwargs: Any) -> Any: ... +def render_to_kmz(*args: Any, **kwargs: Any) -> Any: ... diff --git a/django-stubs/contrib/gis/sitemaps/kml.pyi b/django-stubs/contrib/gis/sitemaps/kml.pyi index cc61d6113..81ee0c69e 100644 --- a/django-stubs/contrib/gis/sitemaps/kml.pyi +++ b/django-stubs/contrib/gis/sitemaps/kml.pyi @@ -6,8 +6,8 @@ class KMLSitemap(Sitemap): geo_format: str = ... locations: Any = ... def __init__(self, locations: Optional[Any] = ...) -> None: ... - def items(self): ... - def location(self, obj: Any): ... + def items(self) -> Any: ... + def location(self, obj: Any) -> Any: ... class KMZSitemap(KMLSitemap): geo_format: str = ... diff --git a/django-stubs/contrib/gis/sitemaps/views.pyi b/django-stubs/contrib/gis/sitemaps/views.pyi index 11cdaea37..43e4782d2 100644 --- a/django-stubs/contrib/gis/sitemaps/views.pyi +++ b/django-stubs/contrib/gis/sitemaps/views.pyi @@ -7,11 +7,11 @@ def kml( field_name: Optional[Any] = ..., compress: bool = ..., using: Any = ..., -): ... +) -> Any: ... def kmz( request: Any, label: Any, model: Any, field_name: Optional[Any] = ..., using: Any = ..., -): ... +) -> Any: ... diff --git a/django-stubs/contrib/gis/utils/layermapping.pyi b/django-stubs/contrib/gis/utils/layermapping.pyi index c3c4d0f05..1d98e19f4 100644 --- a/django-stubs/contrib/gis/utils/layermapping.pyi +++ b/django-stubs/contrib/gis/utils/layermapping.pyi @@ -35,21 +35,21 @@ class LayerMapping: unique: Optional[Any] = ..., using: Optional[Any] = ..., ) -> None: ... - def check_fid_range(self, fid_range: Any): ... + def check_fid_range(self, fid_range: Any) -> Any: ... geom_field: bool = ... fields: Any = ... coord_dim: Any = ... - def check_layer(self): ... - def check_srs(self, source_srs: Any): ... + def check_layer(self) -> Any: ... + def check_srs(self, source_srs: Any) -> Any: ... def check_unique(self, unique: Any) -> None: ... - def feature_kwargs(self, feat: Any): ... - def unique_kwargs(self, kwargs: Any): ... - def verify_ogr_field(self, ogr_field: Any, model_field: Any): ... - def verify_fk(self, feat: Any, rel_model: Any, rel_mapping: Any): ... - def verify_geom(self, geom: Any, model_field: Any): ... - def coord_transform(self): ... - def geometry_field(self): ... - def make_multi(self, geom_type: Any, model_field: Any): ... + def feature_kwargs(self, feat: Any) -> Any: ... + def unique_kwargs(self, kwargs: Any) -> Any: ... + def verify_ogr_field(self, ogr_field: Any, model_field: Any) -> Any: ... + def verify_fk(self, feat: Any, rel_model: Any, rel_mapping: Any) -> Any: ... + def verify_geom(self, geom: Any, model_field: Any) -> Any: ... + def coord_transform(self) -> Any: ... + def geometry_field(self) -> Any: ... + def make_multi(self, geom_type: Any, model_field: Any) -> Any: ... def save( self, verbose: bool = ..., @@ -59,4 +59,4 @@ class LayerMapping: silent: bool = ..., stream: Any = ..., strict: bool = ..., - ): ... + ) -> Any: ... diff --git a/django-stubs/contrib/gis/utils/ogrinspect.pyi b/django-stubs/contrib/gis/utils/ogrinspect.pyi index 632a1e92f..eac2f7c4f 100644 --- a/django-stubs/contrib/gis/utils/ogrinspect.pyi +++ b/django-stubs/contrib/gis/utils/ogrinspect.pyi @@ -2,5 +2,5 @@ from typing import Any def mapping( data_source: Any, geom_name: str = ..., layer_key: int = ..., multi_geom: bool = ... -): ... -def ogrinspect(*args: Any, **kwargs: Any): ... +) -> Any: ... +def ogrinspect(*args: Any, **kwargs: Any) -> Any: ... diff --git a/django-stubs/contrib/gis/views.pyi b/django-stubs/contrib/gis/views.pyi index d5d38d3ac..f4dcde9e2 100644 --- a/django-stubs/contrib/gis/views.pyi +++ b/django-stubs/contrib/gis/views.pyi @@ -1,3 +1,3 @@ from typing import Any, Optional -def feed(request: Any, url: Any, feed_dict: Optional[Any] = ...): ... +def feed(request: Any, url: Any, feed_dict: Optional[Any] = ...) -> Any: ... diff --git a/django-stubs/contrib/humanize/templatetags/humanize.pyi b/django-stubs/contrib/humanize/templatetags/humanize.pyi index eb2026879..cde290de8 100644 --- a/django-stubs/contrib/humanize/templatetags/humanize.pyi +++ b/django-stubs/contrib/humanize/templatetags/humanize.pyi @@ -9,7 +9,7 @@ register: template.Library def ordinal(value: Optional[Union[str, SupportsInt]]) -> Optional[str]: ... def intcomma(value: Optional[Union[str, SupportsInt]], use_l10n: bool = ...) -> str: ... -intword_converters: Tuple[Tuple[int, Callable]] +intword_converters: Tuple[Tuple[int, Callable[..., Any]]] def intword(value: Optional[Union[str, SupportsInt]]) -> Optional[Union[int, str]]: ... def apnumber(value: Optional[Union[str, SupportsInt]]) -> Optional[Union[int, str]]: ... diff --git a/django-stubs/contrib/messages/storage/base.pyi b/django-stubs/contrib/messages/storage/base.pyi index 37ff22e46..0b7dbdb59 100644 --- a/django-stubs/contrib/messages/storage/base.pyi +++ b/django-stubs/contrib/messages/storage/base.pyi @@ -23,8 +23,8 @@ class BaseStorage: added_new: bool = ... def __init__(self, request: HttpRequest, *args: Any, **kwargs: Any) -> None: ... def __len__(self) -> int: ... - def __iter__(self): ... - def __contains__(self, item: Any): ... + def __iter__(self) -> Any: ... + def __contains__(self, item: Any) -> Any: ... def update(self, response: HttpResponseBase) -> Optional[List[Message]]: ... def add( self, level: int, message: str, extra_tags: Optional[str] = ... diff --git a/django-stubs/contrib/postgres/fields/array.pyi b/django-stubs/contrib/postgres/fields/array.pyi index 7099e8c4f..46cfdbc47 100644 --- a/django-stubs/contrib/postgres/fields/array.pyi +++ b/django-stubs/contrib/postgres/fields/array.pyi @@ -38,7 +38,7 @@ class ArrayField( @overload def __init__( self: ArrayField[List[Any]], - base_field: Field, + base_field: Field[Any, Any], size: Optional[int] = ..., verbose_name: Optional[Union[str, bytes]] = ..., name: Optional[str] = ..., @@ -65,7 +65,7 @@ class ArrayField( @overload def __init__( self: ArrayField[Optional[List[Any]]], - base_field: Field, + base_field: Field[Any, Any], size: Optional[int] = ..., verbose_name: Optional[Union[str, bytes]] = ..., name: Optional[str] = ..., @@ -89,8 +89,8 @@ class ArrayField( validators: Iterable[_ValidatorCallable] = ..., error_messages: Optional[_ErrorMessagesToOverride] = ..., ) -> None: ... - def __get__(self: ArrayField[_T], instance: Any, owner: Any) -> _T: ... - def __set__(self: ArrayField[_T], instance: Any, value: _T) -> None: ... + def __get__(self: ArrayField[_T], instance: Any, owner: Any) -> _T: ... # type: ignore [override] + def __set__(self: ArrayField[_T], instance: Any, value: _T) -> None: ... # type: ignore [override] @property - def description(self): ... - def get_transform(self, name: Any): ... + def description(self) -> str: ... # type: ignore [override] + def get_transform(self, name: Any) -> Any: ... diff --git a/django-stubs/contrib/postgres/fields/citext.pyi b/django-stubs/contrib/postgres/fields/citext.pyi index 7296d3c8b..49c3430f5 100644 --- a/django-stubs/contrib/postgres/fields/citext.pyi +++ b/django-stubs/contrib/postgres/fields/citext.pyi @@ -75,8 +75,8 @@ class CICharField(CIText, CharField[_C]): validators: Iterable[_ValidatorCallable] = ..., error_messages: Optional[_ErrorMessagesToOverride] = ..., ) -> None: ... - def __get__(self: CICharField[_C], instance: Any, owner: Any) -> _C: ... - def __set__(self, instance: Any, value: _C) -> None: ... + def __get__(self: CICharField[_C], instance: Any, owner: Any) -> _C: ... # type: ignore [override] + def __set__(self, instance: Any, value: _C) -> None: ... # type: ignore [override] class CIEmailField(CIText, EmailField[_C]): @overload @@ -129,8 +129,8 @@ class CIEmailField(CIText, EmailField[_C]): validators: Iterable[_ValidatorCallable] = ..., error_messages: Optional[_ErrorMessagesToOverride] = ..., ) -> None: ... - def __get__(self: CIEmailField[_C], instance: Any, owner: Any) -> _C: ... - def __set__(self, instance: Any, value: _C) -> None: ... + def __get__(self: CIEmailField[_C], instance: Any, owner: Any) -> _C: ... # type: ignore [override] + def __set__(self, instance: Any, value: _C) -> None: ... # type: ignore [override] class CITextField(CIText, TextField[_C]): @overload @@ -183,5 +183,5 @@ class CITextField(CIText, TextField[_C]): validators: Iterable[_ValidatorCallable] = ..., error_messages: Optional[_ErrorMessagesToOverride] = ..., ) -> None: ... - def __get__(self: CITextField[_C], instance: Any, owner: Any) -> _C: ... - def __set__(self, instance: Any, value: _C) -> None: ... + def __get__(self: CITextField[_C], instance: Any, owner: Any) -> _C: ... # type: ignore [override] + def __set__(self, instance: Any, value: _C) -> None: ... # type: ignore [override] diff --git a/django-stubs/contrib/postgres/fields/hstore.pyi b/django-stubs/contrib/postgres/fields/hstore.pyi index 6fa88eb22..f7d1700b9 100644 --- a/django-stubs/contrib/postgres/fields/hstore.pyi +++ b/django-stubs/contrib/postgres/fields/hstore.pyi @@ -49,7 +49,7 @@ class HStoreField(Generic[_T], CheckFieldDefaultMixin, Field[Any, Any]): db_tablespace: Optional[str] = ..., validators: Iterable[_ValidatorCallable] = ..., error_messages: Optional[_ErrorMessagesToOverride] = ..., - ): ... + ) -> None: ... @overload def __init__( self: HStoreField[Optional[Dict[str, Optional[str]]]], @@ -74,17 +74,17 @@ class HStoreField(Generic[_T], CheckFieldDefaultMixin, Field[Any, Any]): db_tablespace: Optional[str] = ..., validators: Iterable[_ValidatorCallable] = ..., error_messages: Optional[_ErrorMessagesToOverride] = ..., - ): ... - def get_transform(self, name) -> Any: ... - def __get__(self: HStoreField[_T], instance: Any, owner: Any) -> _T: ... + ) -> None: ... + def get_transform(self, name: Any) -> Any: ... + def __get__(self: HStoreField[_T], instance: Any, owner: Any) -> _T: ... # type: ignore [override] def __set__(self: HStoreField[_T], instance: Any, value: _T) -> None: ... class KeyTransform(Transform): - def __init__(self, key_name: str, *args: Any, **kwargs: Any): ... + def __init__(self, key_name: str, *args: Any, **kwargs: Any) -> None: ... class KeyTransformFactory: - def __init__(self, key_name: str): ... - def __call__(self, *args, **kwargs) -> KeyTransform: ... + def __init__(self, key_name: str) -> None: ... + def __call__(self, *args: Any, **kwargs: Any) -> KeyTransform: ... class KeysTransform(Transform): ... class ValuesTransform(Transform): ... diff --git a/django-stubs/contrib/postgres/fields/jsonb.pyi b/django-stubs/contrib/postgres/fields/jsonb.pyi index 18cdfb334..922c40c9a 100644 --- a/django-stubs/contrib/postgres/fields/jsonb.pyi +++ b/django-stubs/contrib/postgres/fields/jsonb.pyi @@ -11,9 +11,9 @@ class JsonAdapter: def __init__( self, adapted: Any, dumps: Optional[Any] = ..., encoder: Optional[Any] = ... ) -> None: ... - def dumps(self, obj: Any): ... + def dumps(self, obj: Any) -> Any: ... -class JSONField(CheckFieldDefaultMixin, Field): +class JSONField(CheckFieldDefaultMixin, Field[Any, Any]): empty_strings_allowed: bool = ... description: Any = ... default_error_messages: Any = ... @@ -25,7 +25,7 @@ class JSONField(CheckFieldDefaultMixin, Field): encoder: Optional[Type[JSONEncoder]] = ..., **kwargs: Any ) -> None: ... - def value_to_string(self, obj: Any): ... + def value_to_string(self, obj: Any) -> Any: ... class KeyTransform(Transform): operator: str = ... diff --git a/django-stubs/contrib/postgres/fields/ranges.pyi b/django-stubs/contrib/postgres/fields/ranges.pyi index a6beabb11..f34339675 100644 --- a/django-stubs/contrib/postgres/fields/ranges.pyi +++ b/django-stubs/contrib/postgres/fields/ranges.pyi @@ -1,33 +1,33 @@ from typing import Any from django.db import models -from psycopg2.extras import DateRange, DateTimeTZRange, NumericRange # type: ignore +from psycopg2.extras import DateRange, DateTimeTZRange, NumericRange -class RangeField(models.Field): +class RangeField(models.Field[Any, Any]): empty_strings_allowed: bool = ... base_field: Any = ... range_type: Any = ... - def get_prep_value(self, value: Any): ... - def to_python(self, value: Any): ... - def value_to_string(self, obj: Any): ... + def get_prep_value(self, value: Any) -> Any: ... + def to_python(self, value: Any) -> Any: ... + def value_to_string(self, obj: Any) -> Any: ... class IntegerRangeField(RangeField): - def __get__(self, instance, owner) -> NumericRange: ... + def __get__(self, instance: Any, owner: Any) -> NumericRange: ... # type: ignore [override] class BigIntegerRangeField(RangeField): - def __get__(self, instance, owner) -> NumericRange: ... + def __get__(self, instance: Any, owner: Any) -> NumericRange: ... # type: ignore [override] class DecimalRangeField(RangeField): - def __get__(self, instance, owner) -> NumericRange: ... + def __get__(self, instance: Any, owner: Any) -> NumericRange: ... # type: ignore [override] class FloatRangeField(RangeField): - def __get__(self, instance, owner) -> NumericRange: ... + def __get__(self, instance: Any, owner: Any) -> NumericRange: ... # type: ignore [override] class DateTimeRangeField(RangeField): - def __get__(self, instance, owner) -> DateTimeTZRange: ... + def __get__(self, instance: Any, owner: Any) -> DateTimeTZRange: ... # type: ignore [override] class DateRangeField(RangeField): - def __get__(self, instance, owner) -> DateRange: ... + def __get__(self, instance: Any, owner: Any) -> DateRange: ... # type: ignore [override] class RangeOperators: EQUAL: str @@ -44,4 +44,6 @@ class RangeOperators: class RangeBoundary(models.Expression): lower: str upper: str - def __init__(self, inclusive_lower: bool = ..., inclusive_upper: bool = ...): ... + def __init__( + self, inclusive_lower: bool = ..., inclusive_upper: bool = ... + ) -> None: ... diff --git a/django-stubs/contrib/postgres/lookups.pyi b/django-stubs/contrib/postgres/lookups.pyi index bd855fa73..bdab81d74 100644 --- a/django-stubs/contrib/postgres/lookups.pyi +++ b/django-stubs/contrib/postgres/lookups.pyi @@ -1,9 +1,11 @@ +from typing import Any + from django.db.models import Lookup, Transform from django.db.models.lookups import Exact from .search import SearchVectorExact -class PostgresSimpleLookup(Lookup): +class PostgresSimpleLookup(Lookup[Any]): operator: str class DataContains(PostgresSimpleLookup): ... diff --git a/django-stubs/contrib/postgres/search.pyi b/django-stubs/contrib/postgres/search.pyi index 663a71cc2..30c7ccd13 100644 --- a/django-stubs/contrib/postgres/search.pyi +++ b/django-stubs/contrib/postgres/search.pyi @@ -12,23 +12,23 @@ from django.db.models.lookups import Lookup _Expression = Union[str, Combinable, "SearchQueryCombinable"] -class SearchVectorExact(Lookup): ... -class SearchVectorField(Field): ... -class SearchQueryField(Field): ... +class SearchVectorExact(Lookup[Any]): ... +class SearchVectorField(Field[Any, Any]): ... +class SearchQueryField(Field[Any, Any]): ... class SearchVectorCombinable: ADD: str = ... class SearchVector(SearchVectorCombinable, Func): config: Optional[Any] = ... - def __init__(self, *expressions: _Expression, **extra: Any): ... + def __init__(self, *expressions: _Expression, **extra: Any) -> None: ... class CombinedSearchVector(SearchVectorCombinable, CombinedExpression): def __init__( self, - lhs, - connector, - rhs, + lhs: Any, + connector: Any, + rhs: Any, config: Optional[_Expression] = ..., output_field: Optional[_OutputField] = ..., ): ... @@ -59,9 +59,9 @@ class SearchQuery(SearchQueryCombinable, Value): # type: ignore class CombinedSearchQuery(SearchQueryCombinable, CombinedExpression): # type: ignore def __init__( self, - lhs, - connector, - rhs, + lhs: Any, + connector: Any, + rhs: Any, config: Optional[_Expression] = ..., output_field: Optional[_OutputField] = ..., ) -> None: ... @@ -75,7 +75,7 @@ class SearchRank(Func): ) -> None: ... class TrigramBase(Func): - def __init__(self, expression: _Expression, string, **extra: Any) -> None: ... + def __init__(self, expression: _Expression, string: str, **extra: Any) -> None: ... class TrigramSimilarity(TrigramBase): ... class TrigramDistance(TrigramBase): ... diff --git a/django-stubs/contrib/postgres/serializers.pyi b/django-stubs/contrib/postgres/serializers.pyi index 9de94024e..fc81fa705 100644 --- a/django-stubs/contrib/postgres/serializers.pyi +++ b/django-stubs/contrib/postgres/serializers.pyi @@ -1,4 +1,6 @@ +from typing import Any + from django.db.migrations.serializer import BaseSerializer as BaseSerializer class RangeSerializer(BaseSerializer): - def serialize(self): ... + def serialize(self) -> Any: ... diff --git a/django-stubs/contrib/postgres/utils.pyi b/django-stubs/contrib/postgres/utils.pyi index 2dec3060c..2531dddf7 100644 --- a/django-stubs/contrib/postgres/utils.pyi +++ b/django-stubs/contrib/postgres/utils.pyi @@ -1,3 +1,3 @@ from typing import Any -def prefix_validation_error(error: Any, prefix: Any, code: Any, params: Any): ... +def prefix_validation_error(error: Any, prefix: Any, code: Any, params: Any) -> Any: ... diff --git a/django-stubs/contrib/redirects/admin.pyi b/django-stubs/contrib/redirects/admin.pyi index dc71b2d75..4d5b82481 100644 --- a/django-stubs/contrib/redirects/admin.pyi +++ b/django-stubs/contrib/redirects/admin.pyi @@ -2,7 +2,7 @@ from typing import Any from django.contrib import admin as admin -class RedirectAdmin(admin.ModelAdmin): +class RedirectAdmin(admin.ModelAdmin[Any]): list_display: Any = ... list_filter: Any = ... search_fields: Any = ... diff --git a/django-stubs/contrib/redirects/models.pyi b/django-stubs/contrib/redirects/models.pyi index b732632d9..c82e4d7db 100644 --- a/django-stubs/contrib/redirects/models.pyi +++ b/django-stubs/contrib/redirects/models.pyi @@ -1,6 +1,8 @@ +from typing import Any + from django.db import models class Redirect(models.Model): - site: models.ForeignKey = ... - old_path: models.CharField = ... - new_path: models.CharField = ... + site: models.ForeignKey[Any] = ... + old_path: models.CharField[Any] = ... + new_path: models.CharField[Any] = ... diff --git a/django-stubs/contrib/sessions/backends/base.pyi b/django-stubs/contrib/sessions/backends/base.pyi index ff0e2ae93..b7325f6a8 100644 --- a/django-stubs/contrib/sessions/backends/base.pyi +++ b/django-stubs/contrib/sessions/backends/base.pyi @@ -18,10 +18,10 @@ class SessionBase(Dict[str, Any]): def delete_test_cookie(self) -> None: ... def encode(self, session_dict: Dict[str, Any]) -> str: ... def decode(self, session_data: Union[bytes, str]) -> Dict[str, Any]: ... - def has_key(self, key: Any): ... - def keys(self): ... - def values(self): ... - def items(self): ... + def has_key(self, key: Any) -> Any: ... + def keys(self) -> Any: ... + def values(self) -> Any: ... + def items(self) -> Any: ... def clear(self) -> None: ... def is_empty(self) -> bool: ... session_key: Any = ... diff --git a/django-stubs/contrib/sessions/base_session.pyi b/django-stubs/contrib/sessions/base_session.pyi index f9e7431fb..f26817121 100644 --- a/django-stubs/contrib/sessions/base_session.pyi +++ b/django-stubs/contrib/sessions/base_session.pyi @@ -4,7 +4,7 @@ from typing import Any, Dict, Optional, Type from django.contrib.sessions.backends.base import SessionBase from django.db import models -class BaseSessionManager(models.Manager): +class BaseSessionManager(models.Manager[Any]): def encode(self, session_dict: Dict[str, int]) -> str: ... def save( self, session_key: str, session_dict: Dict[str, int], expire_date: datetime diff --git a/django-stubs/contrib/sitemaps/__init__.pyi b/django-stubs/contrib/sitemaps/__init__.pyi index c4126213c..0c8857575 100644 --- a/django-stubs/contrib/sitemaps/__init__.pyi +++ b/django-stubs/contrib/sitemaps/__init__.pyi @@ -39,11 +39,11 @@ class Sitemap: class GenericSitemap(Sitemap): priority: Optional[float] = ... changefreq: Optional[str] = ... - queryset: QuerySet = ... + queryset: QuerySet[Any] = ... date_field: None = ... def __init__( self, - info_dict: Dict[str, Union[datetime, QuerySet, str]], + info_dict: Dict[str, Union[datetime, QuerySet[Any], str]], priority: Optional[float] = ..., changefreq: Optional[str] = ..., protocol: Optional[str] = ..., diff --git a/django-stubs/contrib/sitemaps/views.pyi b/django-stubs/contrib/sitemaps/views.pyi index 5245f766d..8f49acd9a 100644 --- a/django-stubs/contrib/sitemaps/views.pyi +++ b/django-stubs/contrib/sitemaps/views.pyi @@ -1,11 +1,11 @@ from collections import OrderedDict -from typing import Callable, Dict, Optional, Type, Union +from typing import Any, Callable, Dict, Optional, Type, Union from django.contrib.sitemaps import GenericSitemap, Sitemap from django.http.request import HttpRequest from django.template.response import TemplateResponse -def x_robots_tag(func: Callable) -> Callable: ... +def x_robots_tag(func: Callable[..., Any]) -> Callable[..., Any]: ... def index( request: HttpRequest, sitemaps: Dict[str, Union[Type[Sitemap], Sitemap]], @@ -15,7 +15,9 @@ def index( ) -> TemplateResponse: ... def sitemap( request: HttpRequest, - sitemaps: Union[Dict[str, Type[Sitemap]], Dict[str, GenericSitemap], OrderedDict], + sitemaps: Union[ + Dict[str, Type[Sitemap]], Dict[str, GenericSitemap], OrderedDict[Any, Any] + ], section: Optional[str] = ..., template_name: str = ..., content_type: str = ..., diff --git a/django-stubs/contrib/sites/admin.pyi b/django-stubs/contrib/sites/admin.pyi index c80181fab..4db09a5a3 100644 --- a/django-stubs/contrib/sites/admin.pyi +++ b/django-stubs/contrib/sites/admin.pyi @@ -2,6 +2,6 @@ from typing import Any from django.contrib import admin as admin -class SiteAdmin(admin.ModelAdmin): +class SiteAdmin(admin.ModelAdmin[Any]): list_display: Any = ... search_fields: Any = ... diff --git a/django-stubs/contrib/sites/managers.pyi b/django-stubs/contrib/sites/managers.pyi index 45ae26d4b..eb31ca32a 100644 --- a/django-stubs/contrib/sites/managers.pyi +++ b/django-stubs/contrib/sites/managers.pyi @@ -1,6 +1,6 @@ -from typing import Optional +from typing import Any, Optional from django.db import models -class CurrentSiteManager(models.Manager): +class CurrentSiteManager(models.Manager[Any]): def __init__(self, field_name: Optional[str] = ...) -> None: ... diff --git a/django-stubs/contrib/staticfiles/management/commands/runserver.pyi b/django-stubs/contrib/staticfiles/management/commands/runserver.pyi index 65c80d7d5..6be2de8c5 100644 --- a/django-stubs/contrib/staticfiles/management/commands/runserver.pyi +++ b/django-stubs/contrib/staticfiles/management/commands/runserver.pyi @@ -1,5 +1,3 @@ -from django.core.management.commands.runserver import ( - Command as RunserverCommand, # type: ignore -) +from django.core.management.commands.runserver import Command as RunserverCommand class Command(RunserverCommand): ... diff --git a/django-stubs/contrib/staticfiles/storage.pyi b/django-stubs/contrib/staticfiles/storage.pyi index c53e16394..0164e5818 100644 --- a/django-stubs/contrib/staticfiles/storage.pyi +++ b/django-stubs/contrib/staticfiles/storage.pyi @@ -28,10 +28,10 @@ class HashedFilesMixin: self, name: str, content: Optional[File] = ..., filename: Optional[str] = ... ) -> str: ... def url_converter( - self, name: str, hashed_files: OrderedDict, template: str = ... - ) -> Callable: ... + self, name: str, hashed_files: OrderedDict[Any, Any], template: str = ... + ) -> Callable[..., Any]: ... def post_process( - self, paths: OrderedDict, dry_run: bool = ..., **options: Any + self, paths: OrderedDict[Any, Any], dry_run: bool = ..., **options: Any ) -> Iterator[Tuple[str, str, bool]]: ... def clean_name(self, name: str) -> str: ... def hash_key(self, name: str) -> str: ... @@ -43,17 +43,17 @@ class ManifestFilesMixin(HashedFilesMixin): manifest_strict: bool = ... def __init__(self, *args: Any, **kwargs: Any) -> None: ... def read_manifest(self) -> Any: ... - def load_manifest(self) -> OrderedDict: ... + def load_manifest(self) -> OrderedDict[Any, Any]: ... def save_manifest(self) -> None: ... class _MappingCache: cache: Any = ... def __init__(self, cache: Any) -> None: ... def __setitem__(self, key: Any, value: Any) -> None: ... - def __getitem__(self, key: Any): ... + def __getitem__(self, key: Any) -> Any: ... def clear(self) -> None: ... def update(self, data: Any) -> None: ... - def get(self, key: Any, default: Optional[Any] = ...): ... + def get(self, key: Any, default: Optional[Any] = ...) -> Any: ... class CachedFilesMixin(HashedFilesMixin): def __init__(self, *args: Any, **kwargs: Any) -> None: ... diff --git a/django-stubs/contrib/staticfiles/utils.pyi b/django-stubs/contrib/staticfiles/utils.pyi index 497481fec..e68690ecf 100644 --- a/django-stubs/contrib/staticfiles/utils.pyi +++ b/django-stubs/contrib/staticfiles/utils.pyi @@ -1,10 +1,10 @@ from collections import OrderedDict -from typing import Iterator, List, Optional, Tuple, Union +from typing import Any, Iterator, List, Optional, Tuple, Union from django.core.files.storage import FileSystemStorage def matches_patterns( - path: str, patterns: Union[List[str], Tuple[str], OrderedDict] = ... + path: str, patterns: Union[List[str], Tuple[str], OrderedDict[Any, Any]] = ... ) -> bool: ... def get_files( storage: FileSystemStorage, ignore_patterns: List[str] = ..., location: str = ... diff --git a/django-stubs/core/cache/__init__.pyi b/django-stubs/core/cache/__init__.pyi index 320eef957..6401fbc6e 100644 --- a/django-stubs/core/cache/__init__.pyi +++ b/django-stubs/core/cache/__init__.pyi @@ -10,14 +10,14 @@ DEFAULT_CACHE_ALIAS: str class CacheHandler: def __init__(self) -> None: ... def __getitem__(self, alias: str) -> BaseCache: ... - def all(self): ... + def all(self) -> Any: ... class DefaultCacheProxy: def __getattr__( self, name: str - ) -> Union[Callable, Dict[str, float], OrderedDict, int]: ... - def __setattr__(self, name: str, value: Callable) -> None: ... - def __delattr__(self, name: Any): ... + ) -> Union[Callable[..., Any], Dict[str, float], OrderedDict[Any, Any], int]: ... + def __setattr__(self, name: str, value: Callable[..., Any]) -> None: ... + def __delattr__(self, name: Any) -> Any: ... def __contains__(self, key: str) -> bool: ... cache: Any diff --git a/django-stubs/core/cache/backends/base.pyi b/django-stubs/core/cache/backends/base.pyi index 7b9c69399..cd92bcd96 100644 --- a/django-stubs/core/cache/backends/base.pyi +++ b/django-stubs/core/cache/backends/base.pyi @@ -9,13 +9,15 @@ DEFAULT_TIMEOUT: Any MEMCACHE_MAX_KEY_LENGTH: int def default_key_func(key: Any, key_prefix: str, version: Any) -> str: ... -def get_key_func(key_func: Optional[Union[Callable, str]]) -> Callable: ... +def get_key_func( + key_func: Optional[Union[Callable[..., Any], str]] +) -> Callable[..., Any]: ... class BaseCache: default_timeout: int = ... key_prefix: str = ... version: int = ... - key_func: Callable = ... + key_func: Callable[..., Any] = ... def __init__(self, params: Dict[str, Any]) -> None: ... def get_backend_timeout(self, timeout: Any = ...) -> Optional[float]: ... def make_key(self, key: Any, version: Optional[Any] = ...) -> str: ... diff --git a/django-stubs/core/cache/backends/memcached.pyi b/django-stubs/core/cache/backends/memcached.pyi index ef875a26f..42ff9c5e1 100644 --- a/django-stubs/core/cache/backends/memcached.pyi +++ b/django-stubs/core/cache/backends/memcached.pyi @@ -1,10 +1,14 @@ +from typing import Any + from django.core.cache.backends.base import BaseCache class BaseMemcachedCache(BaseCache): - def __init__(self, server, params, library, value_not_found_exception) -> None: ... + def __init__( + self, server: Any, params: Any, library: Any, value_not_found_exception: Any + ) -> None: ... class MemcachedCache(BaseMemcachedCache): - def __init__(self, server, params): ... + def __init__(self, server: Any, params: Any) -> None: ... class PyLibMCCache(BaseMemcachedCache): - def __init__(self, server, params): ... + def __init__(self, server: Any, params: Any) -> None: ... diff --git a/django-stubs/core/checks/async_checks.pyi b/django-stubs/core/checks/async_checks.pyi index 0ec26e3c5..c0afa9109 100644 --- a/django-stubs/core/checks/async_checks.pyi +++ b/django-stubs/core/checks/async_checks.pyi @@ -6,4 +6,4 @@ E001: Any def check_async_unsafe( app_configs: Optional[Sequence[AppConfig]] = ..., **kwargs: Any -): ... +) -> Any: ... diff --git a/django-stubs/core/checks/registry.pyi b/django-stubs/core/checks/registry.pyi index f1a960370..d03775173 100644 --- a/django-stubs/core/checks/registry.pyi +++ b/django-stubs/core/checks/registry.pyi @@ -18,15 +18,15 @@ class Tags: _CheckCallable = Callable[..., List[CheckMessage]] class CheckRegistry: - registered_checks: Set[Callable] = ... - deployment_checks: Set[Callable] = ... + registered_checks: Set[Callable[..., Any]] = ... + deployment_checks: Set[Callable[..., Any]] = ... def __init__(self) -> None: ... def register( self, check: Optional[Union[_CheckCallable, str]] = ..., *tags: str, **kwargs: Any - ) -> Callable: ... + ) -> Callable[..., Any]: ... def run_checks( self, app_configs: Optional[List[AppConfig]] = ..., @@ -35,7 +35,9 @@ class CheckRegistry: ) -> List[CheckMessage]: ... def tag_exists(self, tag: str, include_deployment_checks: bool = ...) -> bool: ... def tags_available(self, deployment_checks: bool = ...) -> Set[str]: ... - def get_checks(self, include_deployment_checks: bool = ...) -> List[Callable]: ... + def get_checks( + self, include_deployment_checks: bool = ... + ) -> List[Callable[..., Any]]: ... registry: Any register: Any diff --git a/django-stubs/core/checks/security/sessions.pyi b/django-stubs/core/checks/security/sessions.pyi index a9565d397..3f79a957d 100644 --- a/django-stubs/core/checks/security/sessions.pyi +++ b/django-stubs/core/checks/security/sessions.pyi @@ -3,13 +3,13 @@ from typing import Any, List, Optional, Sequence from django.apps.config import AppConfig from django.core.checks.messages import Warning -def add_session_cookie_message(message: Any): ... +def add_session_cookie_message(message: Any) -> Any: ... W010: Any W011: Any W012: Any -def add_httponly_message(message: Any): ... +def add_httponly_message(message: Any) -> Any: ... W013: Any W014: Any diff --git a/django-stubs/core/checks/urls.pyi b/django-stubs/core/checks/urls.pyi index c6386e99a..f78f2d449 100644 --- a/django-stubs/core/checks/urls.pyi +++ b/django-stubs/core/checks/urls.pyi @@ -8,7 +8,7 @@ def check_url_config( app_configs: Optional[Sequence[AppConfig]] = ..., **kwargs: Any ) -> List[CheckMessage]: ... def check_resolver( - resolver: Union[Tuple[str, Callable], URLPattern, URLResolver] + resolver: Union[Tuple[str, Callable[..., Any]], URLPattern, URLResolver] ) -> List[CheckMessage]: ... def check_url_namespaces_unique( app_configs: Optional[Sequence[AppConfig]] = ..., **kwargs: Any diff --git a/django-stubs/core/files/uploadedfile.pyi b/django-stubs/core/files/uploadedfile.pyi index 1370da247..f5c6632e5 100644 --- a/django-stubs/core/files/uploadedfile.pyi +++ b/django-stubs/core/files/uploadedfile.pyi @@ -8,7 +8,7 @@ class UploadedFile(File): content_type_extra: Optional[Dict[str, str]] = ... def __init__( self, - file: Optional[IO] = ..., + file: Optional[IO[Any]] = ..., name: Optional[str] = ..., content_type: Optional[str] = ..., size: Optional[int] = ..., @@ -31,7 +31,7 @@ class InMemoryUploadedFile(UploadedFile): field_name: Optional[str] = ... def __init__( self, - file: IO, + file: IO[Any], field_name: Optional[str], name: Optional[str], content_type: Optional[str], diff --git a/django-stubs/core/files/utils.pyi b/django-stubs/core/files/utils.pyi index c25e9526d..04a6a15f9 100644 --- a/django-stubs/core/files/utils.pyi +++ b/django-stubs/core/files/utils.pyi @@ -20,4 +20,4 @@ class FileProxyMixin: def readable(self) -> bool: ... def writable(self) -> bool: ... def seekable(self) -> bool: ... - def __iter__(self): ... + def __iter__(self) -> Any: ... diff --git a/django-stubs/core/handlers/asgi.pyi b/django-stubs/core/handlers/asgi.pyi index 38677d2ba..db896ee42 100644 --- a/django-stubs/core/handlers/asgi.pyi +++ b/django-stubs/core/handlers/asgi.pyi @@ -15,20 +15,22 @@ class ASGIRequest(HttpRequest): method: Any = ... META: Any = ... def __init__(self, scope: Any, body_file: Any) -> None: ... - def GET(self): ... + def GET(self) -> Any: ... # type: ignore [override] POST: Any = ... FILES: Any = ... - def COOKIES(self): ... + def COOKIES(self) -> Any: ... # type: ignore [override] class ASGIHandler(base.BaseHandler): request_class: Any = ... chunk_size: Any = ... def __init__(self) -> None: ... async def __call__(self, scope: Any, receive: Any, send: Any) -> None: ... - async def read_body(self, receive: Any): ... - def create_request(self, scope: Any, body_file: Any): ... - def handle_uncaught_exception(self, request: Any, resolver: Any, exc_info: Any): ... + async def read_body(self, receive: Any) -> Any: ... + def create_request(self, scope: Any, body_file: Any) -> Any: ... + def handle_uncaught_exception( + self, request: Any, resolver: Any, exc_info: Any + ) -> Any: ... async def send_response(self, response: Any, send: Any) -> None: ... @classmethod def chunk_bytes(cls, data: Any) -> None: ... - def get_script_prefix(self, scope: Any): ... + def get_script_prefix(self, scope: Any) -> Any: ... diff --git a/django-stubs/core/handlers/base.pyi b/django-stubs/core/handlers/base.pyi index ed3c2163a..ea0ea83dc 100644 --- a/django-stubs/core/handlers/base.pyi +++ b/django-stubs/core/handlers/base.pyi @@ -7,10 +7,10 @@ logger: Any class BaseHandler: def load_middleware(self) -> None: ... - def make_view_atomic(self, view: Callable) -> Callable: ... + def make_view_atomic(self, view: Callable[..., Any]) -> Callable[..., Any]: ... def get_exception_response( self, request: Any, resolver: Any, status_code: Any, exception: Any - ): ... + ) -> Any: ... def get_response(self, request: HttpRequest) -> HttpResponseBase: ... def process_exception_by_middleware( self, exception: Exception, request: HttpRequest diff --git a/django-stubs/core/handlers/exception.pyi b/django-stubs/core/handlers/exception.pyi index a82390ab2..f3259cd3e 100644 --- a/django-stubs/core/handlers/exception.pyi +++ b/django-stubs/core/handlers/exception.pyi @@ -4,7 +4,9 @@ from django.http.request import HttpRequest from django.http.response import HttpResponse from django.urls.resolvers import URLResolver -def convert_exception_to_response(get_response: Callable) -> Callable: ... +def convert_exception_to_response( + get_response: Callable[..., Any] +) -> Callable[..., Any]: ... def response_for_exception(request: HttpRequest, exc: Exception) -> HttpResponse: ... def get_exception_response( request: HttpRequest, @@ -13,4 +15,4 @@ def get_exception_response( exception: Exception, sender: None = ..., ) -> HttpResponse: ... -def handle_uncaught_exception(request: Any, resolver: Any, exc_info: Any): ... +def handle_uncaught_exception(request: Any, resolver: Any, exc_info: Any) -> Any: ... diff --git a/django-stubs/core/handlers/wsgi.pyi b/django-stubs/core/handlers/wsgi.pyi index f7d1a8c7a..117756e70 100644 --- a/django-stubs/core/handlers/wsgi.pyi +++ b/django-stubs/core/handlers/wsgi.pyi @@ -28,7 +28,7 @@ class WSGIHandler(base.BaseHandler): request_class: Any = ... def __init__(self, *args: Any, **kwargs: Any) -> None: ... def __call__( - self, environ: _WSGIEnviron, start_response: Callable + self, environ: _WSGIEnviron, start_response: Callable[..., Any] ) -> HttpResponse: ... def get_path_info(environ: _WSGIEnviron) -> str: ... diff --git a/django-stubs/core/mail/message.pyi b/django-stubs/core/mail/message.pyi index ccc2a1d0f..454744d86 100644 --- a/django-stubs/core/mail/message.pyi +++ b/django-stubs/core/mail/message.pyi @@ -26,13 +26,13 @@ class MIMEMixin: ... class SafeMIMEMessage(MIMEMixin, MIMEMessage): defects: List[Any] epilogue: None - policy: Policy + policy: Policy # type: ignore [no-any-unimported] preamble: None class SafeMIMEText(MIMEMixin, MIMEText): defects: List[Any] epilogue: None - policy: Policy + policy: Policy # type: ignore [no-any-unimported] preamble: None encoding: str = ... def __init__( @@ -42,7 +42,7 @@ class SafeMIMEText(MIMEMixin, MIMEText): class SafeMIMEMultipart(MIMEMixin, MIMEMultipart): defects: List[Any] epilogue: None - policy: Policy + policy: Policy # type: ignore [no-any-unimported] preamble: None encoding: str = ... def __init__( @@ -54,7 +54,7 @@ class SafeMIMEMultipart(MIMEMixin, MIMEMultipart): **_params: Any ) -> None: ... -_AttachmentContent = Union[bytes, EmailMessage, Message, SafeMIMEText, str] +_AttachmentContent = Union[bytes, "EmailMessage", Message, SafeMIMEText, str] _AttachmentTuple = Union[ Tuple[str, _AttachmentContent], Tuple[Optional[str], _AttachmentContent, str], diff --git a/django-stubs/core/management/__init__.pyi b/django-stubs/core/management/__init__.pyi index e80ef2288..52d8a52c0 100644 --- a/django-stubs/core/management/__init__.pyi +++ b/django-stubs/core/management/__init__.pyi @@ -15,7 +15,7 @@ class ManagementUtility: prog_name: str = ... settings_exception: None = ... def __init__(self, argv: List[str] = ...) -> None: ... - def main_help_text(self, commands_only: bool = ...): ... + def main_help_text(self, commands_only: bool = ...) -> Any: ... def fetch_command(self, subcommand: str) -> BaseCommand: ... def autocomplete(self) -> None: ... def execute(self) -> None: ... diff --git a/django-stubs/core/management/base.pyi b/django-stubs/core/management/base.pyi index 675144be8..eb514d89d 100644 --- a/django-stubs/core/management/base.pyi +++ b/django-stubs/core/management/base.pyi @@ -15,15 +15,15 @@ class CommandParser(ArgumentParser): def error(self, message: str) -> Any: ... def handle_default_options(options: Namespace) -> None: ... -def no_translations(handle_func: Callable) -> Callable: ... +def no_translations(handle_func: Callable[..., Any]) -> Callable[..., Any]: ... class DjangoHelpFormatter(HelpFormatter): ... class OutputWrapper(TextIOBase): @property - def style_func(self): ... + def style_func(self) -> Any: ... @style_func.setter - def style_func(self, style_func: Callable[[str], str]): ... + def style_func(self, style_func: Callable[[str], str]) -> Any: ... ending: str = ... def __init__( self, @@ -31,7 +31,7 @@ class OutputWrapper(TextIOBase): style_func: Optional[Callable[[str], str]] = ..., ending: str = ..., ) -> None: ... - def __getattr__(self, name: str) -> Callable: ... + def __getattr__(self, name: str) -> Callable[..., Any]: ... def isatty(self) -> bool: ... def write( # type: ignore[override] self, diff --git a/django-stubs/core/management/commands/makemessages.pyi b/django-stubs/core/management/commands/makemessages.pyi index cbcad756e..c0c5c6857 100644 --- a/django-stubs/core/management/commands/makemessages.pyi +++ b/django-stubs/core/management/commands/makemessages.pyi @@ -2,7 +2,7 @@ from typing import Any, Optional, Pattern, Type from django.core.management.base import BaseCommand -plural_forms_re: Pattern = ... +plural_forms_re: Pattern[str] = ... STATUS_OK: int = ... NO_LOCALE_DIR: Any = ... diff --git a/django-stubs/core/management/commands/sqlmigrate.pyi b/django-stubs/core/management/commands/sqlmigrate.pyi index febeff5a2..ed13606d1 100644 --- a/django-stubs/core/management/commands/sqlmigrate.pyi +++ b/django-stubs/core/management/commands/sqlmigrate.pyi @@ -10,4 +10,4 @@ from django.db.migrations.loader import MigrationLoader as MigrationLoader class Command(BaseCommand): output_transaction: bool = ... - def execute(self, *args: Any, **options: Any): ... + def execute(self, *args: Any, **options: Any) -> Any: ... diff --git a/django-stubs/core/management/templates.pyi b/django-stubs/core/management/templates.pyi index f3df51d75..b3f6a19d1 100644 --- a/django-stubs/core/management/templates.pyi +++ b/django-stubs/core/management/templates.pyi @@ -8,10 +8,10 @@ class TemplateCommand(BaseCommand): app_or_project: Any = ... paths_to_remove: Any = ... verbosity: Any = ... - def handle_template(self, template: Any, subdir: Any): ... + def handle_template(self, template: Any, subdir: Any) -> Any: ... def validate_name(self, name: Any, app_or_project: Any) -> None: ... - def download(self, url: Any): ... - def splitext(self, the_path: Any): ... - def extract(self, filename: Any): ... - def is_url(self, template: Any): ... + def download(self, url: Any) -> Any: ... + def splitext(self, the_path: Any) -> Any: ... + def extract(self, filename: Any) -> Any: ... + def is_url(self, template: Any) -> Any: ... def make_writeable(self, filename: Any) -> None: ... diff --git a/django-stubs/core/management/utils.pyi b/django-stubs/core/management/utils.pyi index 4da7d0861..4a2b2ee2e 100644 --- a/django-stubs/core/management/utils.pyi +++ b/django-stubs/core/management/utils.pyi @@ -10,8 +10,8 @@ def handle_extensions(extensions: List[str]) -> Set[str]: ... def find_command( cmd: str, path: Optional[str] = ..., pathext: Optional[str] = ... ) -> Optional[str]: ... -def get_random_secret_key(): ... +def get_random_secret_key() -> Any: ... def parse_apps_and_model_labels( labels: List[str], ) -> Tuple[Set[Type[Model]], Set[AppConfig]]: ... -def get_command_line_option(argv: Any, option: Any): ... +def get_command_line_option(argv: Any, option: Any) -> Any: ... diff --git a/django-stubs/core/paginator.pyi b/django-stubs/core/paginator.pyi index 1d5bf3705..745129f93 100644 --- a/django-stubs/core/paginator.pyi +++ b/django-stubs/core/paginator.pyi @@ -1,4 +1,4 @@ -from typing import Dict, List, Optional, Protocol, Sequence, Union +from typing import Any, Dict, List, Optional, Protocol, Sequence, Union from django.db.models.base import Model from django.db.models.query import QuerySet @@ -18,7 +18,7 @@ class _SupportsOrdered(Protocol): ordered: bool = ... class Paginator: - object_list: QuerySet = ... + object_list: QuerySet[Any] = ... per_page: int = ... orphans: int = ... allow_empty_first_page: bool = ... @@ -41,18 +41,20 @@ class Paginator: QuerySetPaginator = Paginator -class Page(Sequence): - object_list: QuerySet = ... +class Page(Sequence[Any]): + object_list: QuerySet[Any] = ... number: int = ... paginator: Paginator = ... def __init__( self, - object_list: Union[List[Dict[str, str]], List[Model], List[int], QuerySet, str], + object_list: Union[ + List[Dict[str, str]], List[Model], List[int], QuerySet[Any], str + ], number: int, paginator: Paginator, ) -> None: ... - def __getitem__(self, item): ... - def __len__(self): ... + def __getitem__(self, item: Any) -> Any: ... + def __len__(self) -> Any: ... def has_next(self) -> bool: ... def has_previous(self) -> bool: ... def has_other_pages(self) -> bool: ... diff --git a/django-stubs/core/serializers/__init__.pyi b/django-stubs/core/serializers/__init__.pyi index 813c9431b..c06b38a4d 100644 --- a/django-stubs/core/serializers/__init__.pyi +++ b/django-stubs/core/serializers/__init__.pyi @@ -25,7 +25,7 @@ def unregister_serializer(format: str) -> None: ... def get_serializer(format: str) -> Union[Type[Serializer], BadSerializer]: ... def get_serializer_formats() -> List[str]: ... def get_public_serializer_formats() -> List[str]: ... -def get_deserializer(format: str) -> Union[Callable, Type[Deserializer]]: ... +def get_deserializer(format: str) -> Union[Callable[..., Any], Type[Deserializer]]: ... def serialize(format: str, queryset: Iterable[Model], **options: Any) -> Any: ... def deserialize( format: str, stream_or_string: Any, **options: Any diff --git a/django-stubs/core/serializers/base.pyi b/django-stubs/core/serializers/base.pyi index b9ad37a0d..bae8db5d2 100644 --- a/django-stubs/core/serializers/base.pyi +++ b/django-stubs/core/serializers/base.pyi @@ -81,12 +81,12 @@ class Deserializer: class DeserializedObject: object: Any = ... m2m_data: Dict[str, List[int]] = ... - deferred_fields: Mapping[Field, Any] + deferred_fields: Mapping[Field[Any, Any], Any] def __init__( self, obj: Model, m2m_data: Optional[Dict[str, List[int]]] = ..., - deferred_fields: Optional[Mapping[Field, Any]] = ..., + deferred_fields: Optional[Mapping[Field[Any, Any], Any]] = ..., ) -> None: ... def save( self, save_m2m: bool = ..., using: Optional[str] = ..., **kwargs: Any @@ -99,4 +99,6 @@ def build_instance( def deserialize_m2m_values( field: ManyToManyField, field_value: Any, using: str ) -> List[Any]: ... -def deserialize_fk_value(field: ForeignKey, field_value: Any, using: str) -> Any: ... +def deserialize_fk_value( + field: ForeignKey[Any], field_value: Any, using: str +) -> Any: ... diff --git a/django-stubs/core/serializers/python.pyi b/django-stubs/core/serializers/python.pyi index e8777e14f..3a7d7bd31 100644 --- a/django-stubs/core/serializers/python.pyi +++ b/django-stubs/core/serializers/python.pyi @@ -7,7 +7,7 @@ from django.db.models.base import Model class Serializer(base.Serializer): objects: List[Any] = ... - def get_dump_object(self, obj: Model) -> OrderedDict: ... + def get_dump_object(self, obj: Model) -> OrderedDict[Any, Any]: ... def Deserializer( object_list: List[Dict[str, Any]], diff --git a/django-stubs/core/serializers/pyyaml.pyi b/django-stubs/core/serializers/pyyaml.pyi index 0c88f3fe1..b803d8a55 100644 --- a/django-stubs/core/serializers/pyyaml.pyi +++ b/django-stubs/core/serializers/pyyaml.pyi @@ -4,13 +4,13 @@ from django.core.serializers.python import Serializer as PythonSerializer from yaml import CSafeDumper as SafeDumper class DjangoSafeDumper(SafeDumper): - def represent_decimal(self, data: Any): ... - def represent_ordered_dict(self, data: Any): ... + def represent_decimal(self, data: Any) -> Any: ... + def represent_ordered_dict(self, data: Any) -> Any: ... class Serializer(PythonSerializer): internal_use_only: bool = ... def handle_field(self, obj: Any, field: Any) -> None: ... def end_serialization(self) -> None: ... - def getvalue(self): ... + def getvalue(self) -> Any: ... def Deserializer(stream_or_string: Any, **options: Any) -> None: ... diff --git a/django-stubs/core/serializers/xml_serializer.pyi b/django-stubs/core/serializers/xml_serializer.pyi index 5e3642e20..c668fcc62 100644 --- a/django-stubs/core/serializers/xml_serializer.pyi +++ b/django-stubs/core/serializers/xml_serializer.pyi @@ -27,11 +27,11 @@ class Deserializer(base.Deserializer): ignorenonexistent: bool = ..., **options: Any ) -> None: ... - def __next__(self): ... + def __next__(self) -> Any: ... -def getInnerText(node: Any): ... +def getInnerText(node: Any) -> Any: ... -class DefusedExpatParser(_ExpatParser): +class DefusedExpatParser(_ExpatParser): # type: ignore [misc, no-any-unimported] def __init__(self, *args: Any, **kwargs: Any) -> None: ... def start_doctype_decl( self, name: Any, sysid: Any, pubid: Any, has_internal_subset: Any diff --git a/django-stubs/core/validators.pyi b/django-stubs/core/validators.pyi index d178ca918..f28ebcea4 100644 --- a/django-stubs/core/validators.pyi +++ b/django-stubs/core/validators.pyi @@ -19,7 +19,7 @@ EMPTY_VALUES: Any _Regex = Union[str, Pattern[str]] _ErrorMessage = Union[str, Any] -def _lazy_re_compile(regex: _Regex, flags: int = ...): ... +def _lazy_re_compile(regex: _Regex, flags: int = ...) -> Any: ... class RegexValidator: regex: _Regex = ... @@ -57,9 +57,9 @@ def validate_integer(value: Optional[Union[float, str]]) -> None: ... class EmailValidator: message: str = ... code: str = ... - user_regex: Pattern = ... - domain_regex: Pattern = ... - literal_regex: Pattern = ... + user_regex: Pattern[str] = ... + domain_regex: Pattern[str] = ... + literal_regex: Pattern[str] = ... domain_whitelist: List[str] = ... def __init__( self, @@ -71,9 +71,9 @@ class EmailValidator: def validate_domain_part(self, domain_part: str) -> bool: ... validate_email: EmailValidator = ... -slug_re: Pattern = ... +slug_re: Pattern[str] = ... validate_slug: RegexValidator = ... -slug_unicode_re: Pattern = ... +slug_unicode_re: Pattern[str] = ... validate_unicode_slug: RegexValidator = ... def validate_ipv4_address(value: str) -> None: ... diff --git a/django-stubs/db/backends/base/base.pyi b/django-stubs/db/backends/base/base.pyi index 1e40329cb..821354bb7 100644 --- a/django-stubs/db/backends/base/base.pyi +++ b/django-stubs/db/backends/base/base.pyi @@ -55,8 +55,8 @@ class BaseDatabaseWrapper: allow_thread_sharing: bool = ..., ) -> None: ... def ensure_timezone(self) -> bool: ... - def timezone(self): ... - def timezone_name(self): ... + def timezone(self) -> Any: ... + def timezone_name(self) -> Any: ... @property def queries_logged(self) -> bool: ... @property @@ -87,7 +87,7 @@ class BaseDatabaseWrapper: def validate_no_atomic_block(self) -> None: ... def validate_no_broken_transaction(self) -> None: ... def constraint_checks_disabled(self) -> Iterator[None]: ... - def disable_constraint_checking(self): ... + def disable_constraint_checking(self) -> Any: ... def enable_constraint_checking(self) -> None: ... def check_constraints(self, table_names: Optional[Any] = ...) -> None: ... def is_usable(self) -> None: ... @@ -100,7 +100,7 @@ class BaseDatabaseWrapper: def make_cursor(self, cursor: CursorWrapper) -> CursorWrapper: ... def temporary_connection(self) -> None: ... def schema_editor(self, *args: Any, **kwargs: Any) -> BaseDatabaseSchemaEditor: ... - def on_commit(self, func: Callable) -> None: ... + def on_commit(self, func: Callable[..., Any]) -> None: ... def run_and_clear_commit_hooks(self) -> None: ... - def execute_wrapper(self, wrapper: Callable) -> Iterator[None]: ... + def execute_wrapper(self, wrapper: Callable[..., Any]) -> Iterator[None]: ... def copy(self, alias: None = ..., allow_thread_sharing: None = ...) -> Any: ... diff --git a/django-stubs/db/backends/base/creation.pyi b/django-stubs/db/backends/base/creation.pyi index dbb8bea5c..61a56fb9d 100644 --- a/django-stubs/db/backends/base/creation.pyi +++ b/django-stubs/db/backends/base/creation.pyi @@ -27,7 +27,7 @@ class BaseDatabaseCreation: autoclobber: bool = ..., keepdb: bool = ..., ) -> None: ... - def get_test_db_clone_settings(self, suffix: Any): ... + def get_test_db_clone_settings(self, suffix: Any) -> Any: ... def destroy_test_db( self, old_database_name: str = ..., @@ -35,5 +35,5 @@ class BaseDatabaseCreation: keepdb: bool = ..., suffix: None = ..., ) -> None: ... - def sql_table_creation_suffix(self): ... + def sql_table_creation_suffix(self) -> Any: ... def test_db_signature(self) -> Tuple[str, str, str, str]: ... diff --git a/django-stubs/db/backends/base/features.pyi b/django-stubs/db/backends/base/features.pyi index 8d24f2a55..d21a59a2c 100644 --- a/django-stubs/db/backends/base/features.pyi +++ b/django-stubs/db/backends/base/features.pyi @@ -96,5 +96,5 @@ class BaseDatabaseFeatures: connection: Any = ... def __init__(self, connection: BaseDatabaseWrapper) -> None: ... def supports_explaining_query_execution(self) -> bool: ... - def supports_transactions(self): ... - def supports_stddev(self): ... + def supports_transactions(self) -> Any: ... + def supports_stddev(self) -> Any: ... diff --git a/django-stubs/db/backends/base/introspection.pyi b/django-stubs/db/backends/base/introspection.pyi index 6853f4c4e..853521f17 100644 --- a/django-stubs/db/backends/base/introspection.pyi +++ b/django-stubs/db/backends/base/introspection.pyi @@ -32,5 +32,5 @@ class BaseDatabaseIntrospection: self, cursor: Any, table_name: Any, table_fields: Any = ... ) -> None: ... def get_key_columns(self, cursor: Any, table_name: Any) -> None: ... - def get_primary_key_column(self, cursor: Any, table_name: Any): ... + def get_primary_key_column(self, cursor: Any, table_name: Any) -> Any: ... def get_constraints(self, cursor: Any, table_name: Any) -> None: ... diff --git a/django-stubs/db/backends/base/operations.pyi b/django-stubs/db/backends/base/operations.pyi index 8d52d0b2f..a2cd268ae 100644 --- a/django-stubs/db/backends/base/operations.pyi +++ b/django-stubs/db/backends/base/operations.pyi @@ -28,9 +28,9 @@ class BaseDatabaseOperations: connection: _Connection = ... def __init__(self, connection: Optional[_Connection]) -> 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) -> Any: ... def cache_key_culling_sql(self) -> str: ... - def unification_cast_sql(self, output_field: Field) -> str: ... + def unification_cast_sql(self, output_field: Field[Any, Any]) -> str: ... def date_extract_sql(self, lookup_type: None, field_name: None) -> Any: ... def date_interval_sql(self, timedelta: None) -> Any: ... def date_trunc_sql(self, lookup_type: None, field_name: None) -> Any: ... @@ -48,14 +48,14 @@ class BaseDatabaseOperations: def distinct_sql( self, fields: List[str], params: Optional[List[Any]] ) -> Tuple[List[str], List[Any]]: ... - def fetch_returned_insert_id(self, cursor: Any): ... + def fetch_returned_insert_id(self, cursor: Any) -> Any: ... def field_cast_sql(self, db_type: Optional[str], internal_type: str) -> str: ... def force_no_ordering(self) -> List[Any]: ... def for_update_sql( self, nowait: bool = ..., skip_locked: bool = ..., of: Any = ... - ): ... + ) -> Any: ... def limit_offset_sql(self, low_mark: int, high_mark: Optional[int]) -> str: ... - def last_executed_query(self, cursor: Any, sql: Any, params: Any): ... + def last_executed_query(self, cursor: Any, sql: Any, params: Any) -> Any: ... def last_insert_id( self, cursor: CursorWrapper, table_name: str, pk_name: str ) -> int: ... @@ -64,12 +64,12 @@ class BaseDatabaseOperations: def max_name_length(self) -> None: ... def no_limit_value(self) -> Any: ... def pk_default_value(self) -> str: ... - def prepare_sql_script(self, sql: Any): ... + def prepare_sql_script(self, sql: Any) -> Any: ... def process_clob(self, value: str) -> str: ... def return_insert_id(self) -> None: ... def compiler(self, compiler_name: str) -> Type[SQLCompiler]: ... def quote_name(self, name: str) -> Any: ... - def random_function_sql(self): ... + def random_function_sql(self) -> Any: ... def regex_lookup(self, lookup_type: str) -> Any: ... def savepoint_create_sql(self, sid: str) -> str: ... def savepoint_commit_sql(self, sid: str) -> str: ... @@ -112,13 +112,15 @@ class BaseDatabaseOperations: ) -> Optional[timedelta]: ... def check_expression_support(self, expression: Any) -> None: ... 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 + ) -> Any: ... def binary_placeholder_sql(self, value: Optional[Case]) -> str: ... def modify_insert_params(self, placeholder: str, params: Any) -> Any: ... - def integer_field_range(self, internal_type: Any): ... - def subtract_temporals(self, internal_type: Any, lhs: Any, rhs: Any): ... - def window_frame_start(self, start: Any): ... - def window_frame_end(self, end: Any): ... + def integer_field_range(self, internal_type: Any) -> Any: ... + def subtract_temporals(self, internal_type: Any, lhs: Any, rhs: Any) -> Any: ... + def window_frame_start(self, start: Any) -> Any: ... + def window_frame_end(self, end: Any) -> Any: ... def window_frame_rows_start_end( self, start: Optional[int] = ..., end: Optional[int] = ... ) -> Any: ... diff --git a/django-stubs/db/backends/base/schema.pyi b/django-stubs/db/backends/base/schema.pyi index 8fca57328..66f9ae45a 100644 --- a/django-stubs/db/backends/base/schema.pyi +++ b/django-stubs/db/backends/base/schema.pyi @@ -48,15 +48,17 @@ class BaseDatabaseSchemaEditor(ContextManager[Any]): def execute( self, sql: Union[Statement, str], - params: Optional[Union[List[int], Tuple]] = ..., + params: Optional[Union[List[int], Tuple[Any, ...]]] = ..., ) -> None: ... def quote_name(self, name: str) -> str: ... def column_sql( - self, model: Type[Model], field: Field, include_default: bool = ... + self, model: Type[Model], field: Field[Any, Any], include_default: bool = ... ) -> Tuple[Optional[str], Optional[List[Any]]]: ... - def skip_default(self, field: Any): ... + def skip_default(self, field: Any) -> Any: ... def prepare_default(self, value: Any) -> None: ... - def effective_default(self, field: Field) -> Optional[Union[int, str]]: ... + def effective_default( + self, field: Field[Any, Any] + ) -> Optional[Union[int, str]]: ... def quote_value(self, value: Any) -> None: ... def create_model(self, model: Type[Model]) -> None: ... def delete_model(self, model: Type[Model]) -> None: ... @@ -80,9 +82,13 @@ class BaseDatabaseSchemaEditor(ContextManager[Any]): def alter_db_tablespace( self, model: Any, old_db_tablespace: Any, new_db_tablespace: Any ) -> None: ... - def add_field(self, model: Any, field: Any): ... - def remove_field(self, model: Any, field: Any): ... + def add_field(self, model: Any, field: Any) -> Any: ... + def remove_field(self, model: Any, field: Any) -> Any: ... def alter_field( - self, model: Type[Model], old_field: Field, new_field: Field, strict: bool = ... + self, + model: Type[Model], + old_field: Field[Any, Any], + new_field: Field[Any, Any], + strict: bool = ..., ) -> None: ... def remove_procedure(self, procedure_name: Any, param_types: Any = ...) -> None: ... diff --git a/django-stubs/db/backends/base/validation.pyi b/django-stubs/db/backends/base/validation.pyi index d88b40cf5..470157b96 100644 --- a/django-stubs/db/backends/base/validation.pyi +++ b/django-stubs/db/backends/base/validation.pyi @@ -7,4 +7,4 @@ class BaseDatabaseValidation: connection: Any = ... def __init__(self, connection: BaseDatabaseWrapper) -> None: ... def check(self, **kwargs: Any) -> List[Any]: ... - def check_field(self, field: Field, **kwargs: Any) -> List[Any]: ... + def check_field(self, field: Field[Any, Any], **kwargs: Any) -> List[Any]: ... diff --git a/django-stubs/db/backends/ddl_references.pyi b/django-stubs/db/backends/ddl_references.pyi index c0996e055..587d3c5a4 100644 --- a/django-stubs/db/backends/ddl_references.pyi +++ b/django-stubs/db/backends/ddl_references.pyi @@ -1,8 +1,8 @@ from typing import Any, Callable, Dict, List, Tuple, Union class Reference: - def references_table(self, table: Any): ... - def references_column(self, table: Any, column: Any): ... + def references_table(self, table: Any) -> Any: ... + def references_column(self, table: Any, column: Any) -> Any: ... def rename_table_references(self, old_table: Any, new_table: Any) -> None: ... def rename_column_references( self, table: Any, old_column: Any, new_column: Any @@ -10,8 +10,8 @@ class Reference: class Table(Reference): table: str = ... - quote_name: Callable = ... - def __init__(self, table: str, quote_name: Callable) -> None: ... + quote_name: Callable[..., Any] = ... + def __init__(self, table: str, quote_name: Callable[..., Any]) -> None: ... def references_table(self, table: str) -> bool: ... def rename_table_references(self, old_table: str, new_table: str) -> None: ... @@ -27,23 +27,27 @@ class TableColumns(Table): class Columns(TableColumns): columns: List[str] table: str - quote_name: Callable = ... - col_suffixes: Tuple = ... + quote_name: Callable[..., Any] = ... + col_suffixes: Tuple[Any, ...] = ... def __init__( self, table: str, columns: List[str], - quote_name: Callable, - col_suffixes: Union[List[str], Tuple] = ..., + quote_name: Callable[..., Any], + col_suffixes: Union[List[str], Tuple[Any, ...]] = ..., ) -> None: ... class IndexName(TableColumns): columns: List[str] table: str suffix: str = ... - create_index_name: Callable = ... + create_index_name: Callable[..., Any] = ... def __init__( - self, table: str, columns: List[str], suffix: str, create_index_name: Callable + self, + table: str, + columns: List[str], + suffix: str, + create_index_name: Callable[..., Any], ) -> None: ... class IndexColumns(Columns): @@ -62,7 +66,7 @@ class ForeignKeyName(TableColumns): table: str to_reference: TableColumns = ... suffix_template: str = ... - create_fk_name: Callable = ... + create_fk_name: Callable[..., Any] = ... def __init__( self, from_table: str, @@ -70,7 +74,7 @@ class ForeignKeyName(TableColumns): to_table: str, to_columns: List[str], suffix_template: str, - create_fk_name: Callable, + create_fk_name: Callable[..., Any], ) -> None: ... def references_table(self, table: str) -> bool: ... def references_column(self, table: str, column: str) -> bool: ... diff --git a/django-stubs/db/backends/dummy/features.pyi b/django-stubs/db/backends/dummy/features.pyi index 90b3bfac3..e415659f5 100644 --- a/django-stubs/db/backends/dummy/features.pyi +++ b/django-stubs/db/backends/dummy/features.pyi @@ -3,5 +3,5 @@ from django.db.backends.base.features import ( ) class DummyDatabaseFeatures(BaseDatabaseFeatures): - supports_transactions: bool = ... + supports_transactions: bool = ... # type: ignore [assignment] uses_savepoints: bool = ... diff --git a/django-stubs/db/backends/mysql/base.pyi b/django-stubs/db/backends/mysql/base.pyi index d86041d20..cec57dbe4 100644 --- a/django-stubs/db/backends/mysql/base.pyi +++ b/django-stubs/db/backends/mysql/base.pyi @@ -10,9 +10,9 @@ class CursorWrapper: codes_for_integrityerror: Any = ... cursor: Any = ... def __init__(self, cursor: Any) -> None: ... - def execute(self, query: Any, args: Optional[Any] = ...): ... - def executemany(self, query: Any, args: Any): ... - def __getattr__(self, attr: Any): ... + def execute(self, query: Any, args: Optional[Any] = ...) -> Any: ... + def executemany(self, query: Any, args: Any) -> Any: ... + def __getattr__(self, attr: Any) -> Any: ... def __iter__(self) -> Any: ... class DatabaseWrapper(BaseDatabaseWrapper): @@ -31,18 +31,18 @@ class DatabaseWrapper(BaseDatabaseWrapper): ops_class: Any = ... validation_class: Any = ... isolation_level: Any = ... - def get_connection_params(self): ... - def get_new_connection(self, conn_params: Any): ... + def get_connection_params(self) -> Any: ... + def get_new_connection(self, conn_params: Any) -> Any: ... def init_connection_state(self) -> None: ... - def create_cursor(self, name: Optional[Any] = ...): ... - def disable_constraint_checking(self): ... + def create_cursor(self, name: Optional[Any] = ...) -> Any: ... + def disable_constraint_checking(self) -> Any: ... needs_rollback: Any = ... def enable_constraint_checking(self) -> None: ... def check_constraints(self, table_names: Optional[Any] = ...) -> None: ... - def is_usable(self): ... - def display_name(self): ... - def data_type_check_constraints(self): ... - def mysql_server_info(self): ... - def mysql_version(self): ... - def mysql_is_mariadb(self): ... - def sql_mode(self): ... + def is_usable(self) -> Any: ... + def display_name(self) -> Any: ... # type: ignore [override] + def data_type_check_constraints(self) -> Any: ... + def mysql_server_info(self) -> Any: ... + def mysql_version(self) -> Any: ... + def mysql_is_mariadb(self) -> Any: ... + def sql_mode(self) -> Any: ... diff --git a/django-stubs/db/backends/mysql/compiler.pyi b/django-stubs/db/backends/mysql/compiler.pyi index aa6e1e4c1..944ef3cd1 100644 --- a/django-stubs/db/backends/mysql/compiler.pyi +++ b/django-stubs/db/backends/mysql/compiler.pyi @@ -3,12 +3,12 @@ from typing import Any from django.db.models.sql import compiler as compiler class SQLCompiler(compiler.SQLCompiler): - def as_subquery_condition(self, alias: Any, columns: Any, compiler: Any): ... + def as_subquery_condition(self, alias: Any, columns: Any, compiler: Any) -> Any: ... class SQLInsertCompiler(compiler.SQLInsertCompiler, SQLCompiler): ... class SQLDeleteCompiler(compiler.SQLDeleteCompiler, SQLCompiler): - def as_sql(self): ... + def as_sql(self) -> Any: ... # type: ignore [override] class SQLUpdateCompiler(compiler.SQLUpdateCompiler, SQLCompiler): ... class SQLAggregateCompiler(compiler.SQLAggregateCompiler, SQLCompiler): ... diff --git a/django-stubs/db/backends/mysql/creation.pyi b/django-stubs/db/backends/mysql/creation.pyi index cce664ed3..dfb80efbc 100644 --- a/django-stubs/db/backends/mysql/creation.pyi +++ b/django-stubs/db/backends/mysql/creation.pyi @@ -1,6 +1,8 @@ +from typing import Any + from django.db.backends.base.creation import ( BaseDatabaseCreation as BaseDatabaseCreation, ) class DatabaseCreation(BaseDatabaseCreation): - def sql_table_creation_suffix(self): ... + def sql_table_creation_suffix(self) -> Any: ... diff --git a/django-stubs/db/backends/mysql/features.pyi b/django-stubs/db/backends/mysql/features.pyi index 0c85e519c..8508f9df1 100644 --- a/django-stubs/db/backends/mysql/features.pyi +++ b/django-stubs/db/backends/mysql/features.pyi @@ -38,24 +38,24 @@ class DatabaseFeatures(BaseDatabaseFeatures): supports_partial_indexes: bool = ... supports_order_by_nulls_modifier: bool = ... order_by_nulls_first: bool = ... - def update_can_self_select(self): ... - def can_introspect_foreign_keys(self): ... - def can_return_columns_from_insert(self): ... + def update_can_self_select(self) -> Any: ... # type: ignore [override] + def can_introspect_foreign_keys(self) -> Any: ... # type: ignore [override] + def can_return_columns_from_insert(self) -> Any: ... can_return_rows_from_bulk_insert: Any = ... - def has_zoneinfo_database(self): ... - def is_sql_auto_is_null_enabled(self): ... - def supports_over_clause(self): ... + def has_zoneinfo_database(self) -> Any: ... # type: ignore [override] + def is_sql_auto_is_null_enabled(self) -> Any: ... + def supports_over_clause(self) -> Any: ... # type: ignore [override] supports_frame_range_fixed_distance: Any = ... - def supports_column_check_constraints(self): ... + def supports_column_check_constraints(self) -> Any: ... # type: ignore [override] supports_table_check_constraints: Any = ... - def can_introspect_check_constraints(self): ... - def has_select_for_update_skip_locked(self): ... - def has_select_for_update_nowait(self): ... - def needs_explain_extended(self): ... - def supports_explain_analyze(self): ... - def supported_explain_formats(self): ... - def supports_transactions(self): ... - def ignores_table_name_case(self): ... - def supports_default_in_lead_lag(self): ... - def supports_json_field(self): ... - def can_introspect_json_field(self): ... + def can_introspect_check_constraints(self) -> Any: ... + def has_select_for_update_skip_locked(self) -> Any: ... # type: ignore [override] + def has_select_for_update_nowait(self) -> Any: ... # type: ignore [override] + def needs_explain_extended(self) -> Any: ... + def supports_explain_analyze(self) -> Any: ... + def supported_explain_formats(self) -> Any: ... + def supports_transactions(self) -> Any: ... + def ignores_table_name_case(self) -> Any: ... # type: ignore [override] + def supports_default_in_lead_lag(self) -> Any: ... + def supports_json_field(self) -> Any: ... + def can_introspect_json_field(self) -> Any: ... diff --git a/django-stubs/db/backends/mysql/introspection.pyi b/django-stubs/db/backends/mysql/introspection.pyi index f3852f92c..e2636b733 100644 --- a/django-stubs/db/backends/mysql/introspection.pyi +++ b/django-stubs/db/backends/mysql/introspection.pyi @@ -13,11 +13,13 @@ InfoLine = namedtuple( class DatabaseIntrospection(BaseDatabaseIntrospection): data_types_reverse: Any = ... - def get_field_type(self, data_type: Any, description: Any): ... - def get_table_list(self, cursor: Any): ... - def get_table_description(self, cursor: Any, table_name: Any): ... - def get_sequences(self, cursor: Any, table_name: Any, table_fields: Any = ...): ... - def get_relations(self, cursor: Any, table_name: Any): ... - def get_key_columns(self, cursor: Any, table_name: Any): ... - def get_storage_engine(self, cursor: Any, table_name: Any): ... - def get_constraints(self, cursor: Any, table_name: Any): ... + def get_field_type(self, data_type: Any, description: Any) -> Any: ... + def get_table_list(self, cursor: Any) -> Any: ... + def get_table_description(self, cursor: Any, table_name: Any) -> Any: ... + def get_sequences( + self, cursor: Any, table_name: Any, table_fields: Any = ... + ) -> Any: ... + def get_relations(self, cursor: Any, table_name: Any) -> Any: ... + def get_key_columns(self, cursor: Any, table_name: Any) -> Any: ... + def get_storage_engine(self, cursor: Any, table_name: Any) -> Any: ... + def get_constraints(self, cursor: Any, table_name: Any) -> Any: ... diff --git a/django-stubs/db/backends/mysql/operations.pyi b/django-stubs/db/backends/mysql/operations.pyi index 66624afe9..939657485 100644 --- a/django-stubs/db/backends/mysql/operations.pyi +++ b/django-stubs/db/backends/mysql/operations.pyi @@ -10,40 +10,50 @@ class DatabaseOperations(BaseDatabaseOperations): cast_data_types: Any = ... cast_char_field_without_max_length: str = ... explain_prefix: str = ... - def date_extract_sql(self, lookup_type: Any, field_name: Any): ... - def date_trunc_sql(self, lookup_type: Any, field_name: Any): ... - def datetime_cast_date_sql(self, field_name: Any, tzname: Any): ... - def datetime_cast_time_sql(self, field_name: Any, tzname: Any): ... - def datetime_extract_sql(self, lookup_type: Any, field_name: Any, tzname: Any): ... - def datetime_trunc_sql(self, lookup_type: Any, field_name: Any, tzname: Any): ... - def time_trunc_sql(self, lookup_type: Any, field_name: Any): ... - def date_interval_sql(self, timedelta: Any): ... - def fetch_returned_insert_rows(self, cursor: Any): ... - def format_for_duration_arithmetic(self, sql: Any): ... - def force_no_ordering(self): ... - def last_executed_query(self, cursor: Any, sql: Any, params: Any): ... - def no_limit_value(self): ... - def quote_name(self, name: Any): ... - def random_function_sql(self): ... - def return_insert_columns(self, fields: Any): ... - def sequence_reset_by_name_sql(self, style: Any, sequences: Any): ... - def validate_autopk_value(self, value: Any): ... - def adapt_datetimefield_value(self, value: Any): ... - def adapt_timefield_value(self, value: Any): ... - def max_name_length(self): ... - def bulk_insert_sql(self, fields: Any, placeholder_rows: Any): ... - def combine_expression(self, connector: Any, sub_expressions: Any): ... - def get_db_converters(self, expression: Any): ... + def date_extract_sql(self, lookup_type: Any, field_name: Any) -> Any: ... + def date_trunc_sql(self, lookup_type: Any, field_name: Any) -> Any: ... + def datetime_cast_date_sql(self, field_name: Any, tzname: Any) -> Any: ... + def datetime_cast_time_sql(self, field_name: Any, tzname: Any) -> Any: ... + def datetime_extract_sql( + self, lookup_type: Any, field_name: Any, tzname: Any + ) -> Any: ... + def datetime_trunc_sql( + self, lookup_type: Any, field_name: Any, tzname: Any + ) -> Any: ... + def time_trunc_sql(self, lookup_type: Any, field_name: Any) -> Any: ... + def date_interval_sql(self, timedelta: Any) -> Any: ... + def fetch_returned_insert_rows(self, cursor: Any) -> Any: ... + def format_for_duration_arithmetic(self, sql: Any) -> Any: ... + def force_no_ordering(self) -> Any: ... + def last_executed_query(self, cursor: Any, sql: Any, params: Any) -> Any: ... + def no_limit_value(self) -> Any: ... + def quote_name(self, name: Any) -> Any: ... + def random_function_sql(self) -> Any: ... + def return_insert_columns(self, fields: Any) -> Any: ... + def sequence_reset_by_name_sql(self, style: Any, sequences: Any) -> Any: ... + def validate_autopk_value(self, value: Any) -> Any: ... + def adapt_datetimefield_value(self, value: Any) -> Any: ... + def adapt_timefield_value(self, value: Any) -> Any: ... + def max_name_length(self) -> Any: ... + def bulk_insert_sql(self, fields: Any, placeholder_rows: Any) -> Any: ... + def combine_expression(self, connector: Any, sub_expressions: Any) -> Any: ... + def get_db_converters(self, expression: Any) -> Any: ... def convert_booleanfield_value( self, value: Any, expression: Any, connection: Any - ): ... + ) -> Any: ... def convert_datetimefield_value( self, value: Any, expression: Any, connection: Any - ): ... - def convert_uuidfield_value(self, value: Any, expression: Any, connection: Any): ... - def binary_placeholder_sql(self, value: Any): ... - def subtract_temporals(self, internal_type: Any, lhs: Any, rhs: Any): ... - def explain_query_prefix(self, format: Optional[Any] = ..., **options: Any): ... - def regex_lookup(self, lookup_type: Any): ... - def insert_statement(self, ignore_conflicts: bool = ...): ... - def lookup_cast(self, lookup_type: Any, internal_type: Optional[Any] = ...): ... + ) -> Any: ... + def convert_uuidfield_value( + self, value: Any, expression: Any, connection: Any + ) -> Any: ... + def binary_placeholder_sql(self, value: Any) -> Any: ... + def subtract_temporals(self, internal_type: Any, lhs: Any, rhs: Any) -> Any: ... + def explain_query_prefix( + self, format: Optional[Any] = ..., **options: Any + ) -> Any: ... + def regex_lookup(self, lookup_type: Any) -> Any: ... + def insert_statement(self, ignore_conflicts: bool = ...) -> Any: ... + def lookup_cast( + self, lookup_type: Any, internal_type: Optional[Any] = ... + ) -> Any: ... diff --git a/django-stubs/db/backends/mysql/schema.pyi b/django-stubs/db/backends/mysql/schema.pyi index 778f5a99b..08a39c899 100644 --- a/django-stubs/db/backends/mysql/schema.pyi +++ b/django-stubs/db/backends/mysql/schema.pyi @@ -18,9 +18,9 @@ class DatabaseSchemaEditor(BaseDatabaseSchemaEditor): sql_delete_pk: str = ... sql_create_index: str = ... @property - def sql_delete_check(self): ... + def sql_delete_check(self) -> Any: ... # type: ignore [override] @property - def sql_rename_column(self): ... - def quote_value(self, value: Any): ... - def skip_default(self, field: Any): ... + def sql_rename_column(self) -> Any: ... # type: ignore [override] + def quote_value(self, value: Any) -> Any: ... + def skip_default(self, field: Any) -> Any: ... def add_field(self, model: Any, field: Any) -> None: ... diff --git a/django-stubs/db/backends/mysql/validation.pyi b/django-stubs/db/backends/mysql/validation.pyi index 6a7149ffb..6c48b113b 100644 --- a/django-stubs/db/backends/mysql/validation.pyi +++ b/django-stubs/db/backends/mysql/validation.pyi @@ -5,5 +5,5 @@ from django.db.backends.base.validation import ( ) class DatabaseValidation(BaseDatabaseValidation): - def check(self, **kwargs: Any): ... - def check_field_type(self, field: Any, field_type: Any): ... + def check(self, **kwargs: Any) -> Any: ... + def check_field_type(self, field: Any, field_type: Any) -> Any: ... diff --git a/django-stubs/db/backends/oracle/base.pyi b/django-stubs/db/backends/oracle/base.pyi index 491fd340e..ecd1fcaef 100644 --- a/django-stubs/db/backends/oracle/base.pyi +++ b/django-stubs/db/backends/oracle/base.pyi @@ -5,7 +5,7 @@ from django.db.backends.base.base import BaseDatabaseWrapper as BaseDatabaseWrap def wrap_oracle_errors() -> None: ... class _UninitializedOperatorsDescriptor: - def __get__(self, instance: Any, cls: Optional[Any] = ...): ... + def __get__(self, instance: Any, cls: Optional[Any] = ...) -> Any: ... class DatabaseWrapper(BaseDatabaseWrapper): vendor: str = ... @@ -23,15 +23,15 @@ class DatabaseWrapper(BaseDatabaseWrapper): ops_class: Any = ... validation_class: Any = ... def __init__(self, *args: Any, **kwargs: Any) -> None: ... - def get_connection_params(self): ... - def get_new_connection(self, conn_params: Any): ... + def get_connection_params(self) -> Any: ... + def get_new_connection(self, conn_params: Any) -> Any: ... pattern_ops: Any = ... def init_connection_state(self) -> None: ... - def create_cursor(self, name: Optional[Any] = ...): ... + def create_cursor(self, name: Optional[Any] = ...) -> Any: ... def check_constraints(self, table_names: Optional[Any] = ...) -> None: ... - def is_usable(self): ... - def cx_oracle_version(self): ... - def oracle_version(self): ... + def is_usable(self) -> Any: ... + def cx_oracle_version(self) -> Any: ... + def oracle_version(self) -> Any: ... class OracleParam: force_bytes: Any = ... @@ -41,18 +41,18 @@ class OracleParam: class VariableWrapper: var: Any = ... def __init__(self, var: Any) -> None: ... - def bind_parameter(self, cursor: Any): ... - def __getattr__(self, key: Any): ... + def bind_parameter(self, cursor: Any) -> Any: ... + def __getattr__(self, key: Any) -> Any: ... def __setattr__(self, key: Any, value: Any) -> None: ... class FormatStylePlaceholderCursor: charset: str = ... cursor: Any = ... def __init__(self, connection: Any) -> None: ... - def execute(self, query: Any, params: Optional[Any] = ...): ... - def executemany(self, query: Any, params: Optional[Any] = ...): ... + def execute(self, query: Any, params: Optional[Any] = ...) -> Any: ... + def executemany(self, query: Any, params: Optional[Any] = ...) -> Any: ... def close(self) -> None: ... - def var(self, *args: Any): ... - def arrayvar(self, *args: Any): ... - def __getattr__(self, attr: Any): ... + def var(self, *args: Any) -> Any: ... + def arrayvar(self, *args: Any) -> Any: ... + def __getattr__(self, attr: Any) -> Any: ... def __iter__(self) -> Any: ... diff --git a/django-stubs/db/backends/oracle/creation.pyi b/django-stubs/db/backends/oracle/creation.pyi index 3ccc8006d..ad04794ea 100644 --- a/django-stubs/db/backends/oracle/creation.pyi +++ b/django-stubs/db/backends/oracle/creation.pyi @@ -8,4 +8,4 @@ TEST_DATABASE_PREFIX: str class DatabaseCreation(BaseDatabaseCreation): def set_as_test_mirror(self, primary_settings_dict: Any) -> None: ... - def test_db_signature(self): ... + def test_db_signature(self) -> Any: ... diff --git a/django-stubs/db/backends/oracle/features.pyi b/django-stubs/db/backends/oracle/features.pyi index da984a7e5..e939af00d 100644 --- a/django-stubs/db/backends/oracle/features.pyi +++ b/django-stubs/db/backends/oracle/features.pyi @@ -14,7 +14,7 @@ class DatabaseFeatures(BaseDatabaseFeatures): can_return_columns_from_insert: bool = ... can_introspect_autofield: bool = ... supports_subqueries_in_group_by: bool = ... - supports_transactions: bool = ... + supports_transactions: bool = ... # type: ignore [assignment] supports_timezones: bool = ... has_native_duration_field: bool = ... can_defer_constraint_checks: bool = ... diff --git a/django-stubs/db/backends/oracle/introspection.pyi b/django-stubs/db/backends/oracle/introspection.pyi index afa8daec5..f93916d03 100644 --- a/django-stubs/db/backends/oracle/introspection.pyi +++ b/django-stubs/db/backends/oracle/introspection.pyi @@ -8,13 +8,15 @@ FieldInfo: Any class DatabaseIntrospection(BaseDatabaseIntrospection): cache_bust_counter: int = ... - def data_types_reverse(self): ... - def get_field_type(self, data_type: Any, description: Any): ... - def get_table_list(self, cursor: Any): ... - def get_table_description(self, cursor: Any, table_name: Any): ... - def identifier_converter(self, name: Any): ... - def get_sequences(self, cursor: Any, table_name: Any, table_fields: Any = ...): ... - def get_relations(self, cursor: Any, table_name: Any): ... - def get_key_columns(self, cursor: Any, table_name: Any): ... - def get_primary_key_column(self, cursor: Any, table_name: Any): ... - def get_constraints(self, cursor: Any, table_name: Any): ... + def data_types_reverse(self) -> Any: ... + def get_field_type(self, data_type: Any, description: Any) -> Any: ... + def get_table_list(self, cursor: Any) -> Any: ... + def get_table_description(self, cursor: Any, table_name: Any) -> Any: ... + def identifier_converter(self, name: Any) -> Any: ... + def get_sequences( + self, cursor: Any, table_name: Any, table_fields: Any = ... + ) -> Any: ... + def get_relations(self, cursor: Any, table_name: Any) -> Any: ... + def get_key_columns(self, cursor: Any, table_name: Any) -> Any: ... + def get_primary_key_column(self, cursor: Any, table_name: Any) -> Any: ... + def get_constraints(self, cursor: Any, table_name: Any) -> Any: ... diff --git a/django-stubs/db/backends/oracle/operations.pyi b/django-stubs/db/backends/oracle/operations.pyi index 91d200bf1..4388f8089 100644 --- a/django-stubs/db/backends/oracle/operations.pyi +++ b/django-stubs/db/backends/oracle/operations.pyi @@ -9,58 +9,76 @@ class DatabaseOperations(BaseDatabaseOperations): set_operators: Any = ... cast_char_field_without_max_length: str = ... cast_data_types: Any = ... - def cache_key_culling_sql(self): ... - def date_extract_sql(self, lookup_type: Any, field_name: Any): ... - def date_trunc_sql(self, lookup_type: Any, field_name: Any): ... - def datetime_cast_date_sql(self, field_name: Any, tzname: Any): ... - def datetime_cast_time_sql(self, field_name: Any, tzname: Any): ... - def datetime_extract_sql(self, lookup_type: Any, field_name: Any, tzname: Any): ... - def datetime_trunc_sql(self, lookup_type: Any, field_name: Any, tzname: Any): ... - def time_trunc_sql(self, lookup_type: Any, field_name: Any): ... - def get_db_converters(self, expression: Any): ... - def convert_textfield_value(self, value: Any, expression: Any, connection: Any): ... + def cache_key_culling_sql(self) -> Any: ... + def date_extract_sql(self, lookup_type: Any, field_name: Any) -> Any: ... + def date_trunc_sql(self, lookup_type: Any, field_name: Any) -> Any: ... + def datetime_cast_date_sql(self, field_name: Any, tzname: Any) -> Any: ... + def datetime_cast_time_sql(self, field_name: Any, tzname: Any) -> Any: ... + def datetime_extract_sql( + self, lookup_type: Any, field_name: Any, tzname: Any + ) -> Any: ... + def datetime_trunc_sql( + self, lookup_type: Any, field_name: Any, tzname: Any + ) -> Any: ... + def time_trunc_sql(self, lookup_type: Any, field_name: Any) -> Any: ... + def get_db_converters(self, expression: Any) -> Any: ... + def convert_textfield_value( + self, value: Any, expression: Any, connection: Any + ) -> Any: ... def convert_binaryfield_value( self, value: Any, expression: Any, connection: Any - ): ... + ) -> Any: ... def convert_booleanfield_value( self, value: Any, expression: Any, connection: Any - ): ... + ) -> Any: ... def convert_datetimefield_value( self, value: Any, expression: Any, connection: Any - ): ... - def convert_datefield_value(self, value: Any, expression: Any, connection: Any): ... - def convert_timefield_value(self, value: Any, expression: Any, connection: Any): ... - def convert_uuidfield_value(self, value: Any, expression: Any, connection: Any): ... + ) -> Any: ... + def convert_datefield_value( + self, value: Any, expression: Any, connection: Any + ) -> Any: ... + def convert_timefield_value( + self, value: Any, expression: Any, connection: Any + ) -> Any: ... + def convert_uuidfield_value( + self, value: Any, expression: Any, connection: Any + ) -> Any: ... @staticmethod - def convert_empty_string(value: Any, expression: Any, connection: Any): ... + def convert_empty_string(value: Any, expression: Any, connection: Any) -> Any: ... @staticmethod - def convert_empty_bytes(value: Any, expression: Any, connection: Any): ... - def deferrable_sql(self): ... - def fetch_returned_insert_columns(self, cursor: Any, returning_params: Any): ... - def field_cast_sql(self, db_type: Any, internal_type: Any): ... + def convert_empty_bytes(value: Any, expression: Any, connection: Any) -> Any: ... + def deferrable_sql(self) -> Any: ... + def fetch_returned_insert_columns( + self, cursor: Any, returning_params: Any + ) -> Any: ... + def field_cast_sql(self, db_type: Any, internal_type: Any) -> Any: ... def no_limit_value(self) -> None: ... - def limit_offset_sql(self, low_mark: Any, high_mark: Any): ... - def last_executed_query(self, cursor: Any, sql: Any, params: Any): ... - def last_insert_id(self, cursor: Any, table_name: Any, pk_name: Any): ... - def lookup_cast(self, lookup_type: Any, internal_type: Optional[Any] = ...): ... - def max_in_list_size(self): ... - def max_name_length(self): ... - def pk_default_value(self): ... - def prep_for_iexact_query(self, x: Any): ... - def process_clob(self, value: Any): ... - def quote_name(self, name: Any): ... - def random_function_sql(self): ... - def regex_lookup(self, lookup_type: Any): ... - def return_insert_columns(self, fields: Any): ... - def sequence_reset_by_name_sql(self, style: Any, sequences: Any): ... - def sequence_reset_sql(self, style: Any, model_list: Any): ... - def start_transaction_sql(self): ... - def tablespace_sql(self, tablespace: Any, inline: bool = ...): ... - def adapt_datefield_value(self, value: Any): ... - def adapt_datetimefield_value(self, value: Any): ... - def adapt_timefield_value(self, value: Any): ... - def combine_expression(self, connector: Any, sub_expressions: Any): ... - def bulk_insert_sql(self, fields: Any, placeholder_rows: Any): ... - def subtract_temporals(self, internal_type: Any, lhs: Any, rhs: Any): ... - def bulk_batch_size(self, fields: Any, objs: Any): ... - def conditional_expression_supported_in_where_clause(self, expression: Any): ... + def limit_offset_sql(self, low_mark: Any, high_mark: Any) -> Any: ... + def last_executed_query(self, cursor: Any, sql: Any, params: Any) -> Any: ... + def last_insert_id(self, cursor: Any, table_name: Any, pk_name: Any) -> Any: ... + def lookup_cast( + self, lookup_type: Any, internal_type: Optional[Any] = ... + ) -> Any: ... + def max_in_list_size(self) -> Any: ... + def max_name_length(self) -> Any: ... + def pk_default_value(self) -> Any: ... + def prep_for_iexact_query(self, x: Any) -> Any: ... + def process_clob(self, value: Any) -> Any: ... + def quote_name(self, name: Any) -> Any: ... + def random_function_sql(self) -> Any: ... + def regex_lookup(self, lookup_type: Any) -> Any: ... + def return_insert_columns(self, fields: Any) -> Any: ... + def sequence_reset_by_name_sql(self, style: Any, sequences: Any) -> Any: ... + def sequence_reset_sql(self, style: Any, model_list: Any) -> Any: ... + def start_transaction_sql(self) -> Any: ... + def tablespace_sql(self, tablespace: Any, inline: bool = ...) -> Any: ... + def adapt_datefield_value(self, value: Any) -> Any: ... + def adapt_datetimefield_value(self, value: Any) -> Any: ... + def adapt_timefield_value(self, value: Any) -> Any: ... + def combine_expression(self, connector: Any, sub_expressions: Any) -> Any: ... + def bulk_insert_sql(self, fields: Any, placeholder_rows: Any) -> Any: ... + def subtract_temporals(self, internal_type: Any, lhs: Any, rhs: Any) -> Any: ... + def bulk_batch_size(self, fields: Any, objs: Any) -> Any: ... + def conditional_expression_supported_in_where_clause( + self, expression: Any + ) -> Any: ... diff --git a/django-stubs/db/backends/oracle/schema.pyi b/django-stubs/db/backends/oracle/schema.pyi index 0753f8471..d1d44e4fd 100644 --- a/django-stubs/db/backends/oracle/schema.pyi +++ b/django-stubs/db/backends/oracle/schema.pyi @@ -15,11 +15,11 @@ class DatabaseSchemaEditor(BaseDatabaseSchemaEditor): sql_create_column_inline_fk: str = ... sql_delete_table: str = ... sql_create_index: str = ... - def quote_value(self, value: Any): ... + def quote_value(self, value: Any) -> Any: ... def remove_field(self, model: Any, field: Any) -> None: ... def delete_model(self, model: Any) -> None: ... def alter_field( self, model: Any, old_field: Any, new_field: Any, strict: bool = ... ) -> None: ... - def normalize_name(self, name: Any): ... - def prepare_default(self, value: Any): ... + def normalize_name(self, name: Any) -> Any: ... + def prepare_default(self, value: Any) -> Any: ... diff --git a/django-stubs/db/backends/oracle/utils.pyi b/django-stubs/db/backends/oracle/utils.pyi index 3fc6c9577..081b0a743 100644 --- a/django-stubs/db/backends/oracle/utils.pyi +++ b/django-stubs/db/backends/oracle/utils.pyi @@ -6,13 +6,13 @@ class InsertVar: db_type: Any = ... bound_param: Any = ... def __init__(self, field: Any) -> None: ... - def bind_parameter(self, cursor: Any): ... - def get_value(self): ... + def bind_parameter(self, cursor: Any) -> Any: ... + def get_value(self) -> Any: ... class Oracle_datetime(datetime.datetime): input_size: Any = ... @classmethod - def from_datetime(cls, dt: Any): ... + def from_datetime(cls, dt: Any) -> Any: ... class BulkInsertMapper: BLOB: str = ... diff --git a/django-stubs/db/backends/oracle/validation.pyi b/django-stubs/db/backends/oracle/validation.pyi index 62e2019d6..b7a74179f 100644 --- a/django-stubs/db/backends/oracle/validation.pyi +++ b/django-stubs/db/backends/oracle/validation.pyi @@ -5,4 +5,4 @@ from django.db.backends.base.validation import ( ) class DatabaseValidation(BaseDatabaseValidation): - def check_field_type(self, field: Any, field_type: Any): ... + def check_field_type(self, field: Any, field_type: Any) -> Any: ... diff --git a/django-stubs/db/backends/postgresql/features.pyi b/django-stubs/db/backends/postgresql/features.pyi index 2ad76ec2c..abe1de024 100644 --- a/django-stubs/db/backends/postgresql/features.pyi +++ b/django-stubs/db/backends/postgresql/features.pyi @@ -19,7 +19,7 @@ class DatabaseFeatures(BaseDatabaseFeatures): has_select_for_update_skip_locked: bool = ... can_release_savepoints: bool = ... supports_tablespaces: bool = ... - supports_transactions: bool = ... + supports_transactions: bool = ... # type: ignore [assignment] can_introspect_autofield: bool = ... can_introspect_ip_address_field: bool = ... can_introspect_materialized_views: bool = ... @@ -45,10 +45,10 @@ class DatabaseFeatures(BaseDatabaseFeatures): supports_deferrable_unique_constraints: bool = ... has_json_operators: bool = ... json_key_contains_list_matching_requires_list: bool = ... - def is_postgresql_9_6(self): ... - def is_postgresql_10(self): ... - def is_postgresql_11(self): ... - def is_postgresql_12(self): ... + def is_postgresql_9_6(self) -> Any: ... + def is_postgresql_10(self) -> Any: ... + def is_postgresql_11(self) -> Any: ... + def is_postgresql_12(self) -> Any: ... has_bloom_index: Any = ... has_brin_autosummarize: Any = ... has_phraseto_tsquery: Any = ... diff --git a/django-stubs/db/backends/postgresql/introspection.pyi b/django-stubs/db/backends/postgresql/introspection.pyi index 4977f7ccf..9f3c6447d 100644 --- a/django-stubs/db/backends/postgresql/introspection.pyi +++ b/django-stubs/db/backends/postgresql/introspection.pyi @@ -7,10 +7,12 @@ from django.db.backends.base.introspection import ( class DatabaseIntrospection(BaseDatabaseIntrospection): data_types_reverse: Any = ... ignored_tables: Any = ... - def get_field_type(self, data_type: Any, description: Any): ... - def get_table_list(self, cursor: Any): ... - def get_table_description(self, cursor: Any, table_name: Any): ... - def get_sequences(self, cursor: Any, table_name: Any, table_fields: Any = ...): ... - def get_relations(self, cursor: Any, table_name: Any): ... - def get_key_columns(self, cursor: Any, table_name: Any): ... - def get_constraints(self, cursor: Any, table_name: Any): ... + def get_field_type(self, data_type: Any, description: Any) -> Any: ... + def get_table_list(self, cursor: Any) -> Any: ... + def get_table_description(self, cursor: Any, table_name: Any) -> Any: ... + def get_sequences( + self, cursor: Any, table_name: Any, table_fields: Any = ... + ) -> Any: ... + def get_relations(self, cursor: Any, table_name: Any) -> Any: ... + def get_key_columns(self, cursor: Any, table_name: Any) -> Any: ... + def get_constraints(self, cursor: Any, table_name: Any) -> Any: ... diff --git a/django-stubs/db/backends/postgresql/schema.pyi b/django-stubs/db/backends/postgresql/schema.pyi index dc4add2ed..626cb68b7 100644 --- a/django-stubs/db/backends/postgresql/schema.pyi +++ b/django-stubs/db/backends/postgresql/schema.pyi @@ -16,7 +16,7 @@ class DatabaseSchemaEditor(BaseDatabaseSchemaEditor): sql_create_column_inline_fk: str = ... sql_delete_fk: str = ... sql_delete_procedure: str = ... - def quote_value(self, value: Any): ... + def quote_value(self, value: Any) -> Any: ... def add_index(self, model: Any, index: Any, concurrently: bool = ...) -> None: ... def remove_index( self, model: Any, index: Any, concurrently: bool = ... diff --git a/django-stubs/db/backends/sqlite3/base.pyi b/django-stubs/db/backends/sqlite3/base.pyi index a468c3e63..c6165e500 100644 --- a/django-stubs/db/backends/sqlite3/base.pyi +++ b/django-stubs/db/backends/sqlite3/base.pyi @@ -3,7 +3,7 @@ from typing import Any, Callable from django.db.backends.base.base import BaseDatabaseWrapper -def decoder(conv_func: Callable) -> Callable: ... +def decoder(conv_func: Callable[..., Any]) -> Callable[..., Any]: ... class DatabaseWrapper(BaseDatabaseWrapper): ... diff --git a/django-stubs/db/migrations/autodetector.pyi b/django-stubs/db/migrations/autodetector.pyi index 149eec08d..53b30c9c7 100644 --- a/django-stubs/db/migrations/autodetector.pyi +++ b/django-stubs/db/migrations/autodetector.pyi @@ -27,8 +27,10 @@ class MigrationAutodetector: ) -> Dict[str, List[Migration]]: ... def deep_deconstruct(self, obj: Any) -> Any: ... def only_relation_agnostic_fields( - self, fields: List[Tuple[str, Field]] - ) -> List[Tuple[str, List[Any], Dict[str, Union[Callable, int, str]]]]: ... + self, fields: List[Tuple[str, Field[Any, Any]]] + ) -> List[ + Tuple[str, List[Any], Dict[str, Union[Callable[..., Any], int, str]]] + ]: ... def check_dependency( self, operation: Operation, diff --git a/django-stubs/db/migrations/executor.pyi b/django-stubs/db/migrations/executor.pyi index 63591c58e..a66475229 100644 --- a/django-stubs/db/migrations/executor.pyi +++ b/django-stubs/db/migrations/executor.pyi @@ -12,11 +12,11 @@ class MigrationExecutor: connection: Any = ... loader: MigrationLoader = ... recorder: MigrationRecorder = ... - progress_callback: Callable = ... + progress_callback: Callable[..., Any] = ... def __init__( self, connection: Optional[Union[DefaultConnectionProxy, BaseDatabaseWrapper]], - progress_callback: Optional[Callable] = ..., + progress_callback: Optional[Callable[..., Any]] = ..., ) -> None: ... def migration_plan( self, diff --git a/django-stubs/db/migrations/graph.pyi b/django-stubs/db/migrations/graph.pyi index 3af42618c..5aad82b93 100644 --- a/django-stubs/db/migrations/graph.pyi +++ b/django-stubs/db/migrations/graph.pyi @@ -56,7 +56,7 @@ class MigrationGraph: def backwards_plan( self, target: Union[Tuple[str, str], Node] ) -> List[Tuple[str, str]]: ... - def iterative_dfs(self, start: Any, forwards: bool = ...): ... + def iterative_dfs(self, start: Any, forwards: bool = ...) -> Any: ... def root_nodes(self, app: Optional[str] = ...) -> List[Tuple[str, str]]: ... def leaf_nodes(self, app: Optional[str] = ...) -> List[Tuple[str, str]]: ... def ensure_not_cyclic(self) -> None: ... diff --git a/django-stubs/db/migrations/operations/base.pyi b/django-stubs/db/migrations/operations/base.pyi index 0cdb388cf..0224f70ef 100644 --- a/django-stubs/db/migrations/operations/base.pyi +++ b/django-stubs/db/migrations/operations/base.pyi @@ -6,7 +6,7 @@ class Operation: atomic: bool = ... elidable: bool = ... serialization_expand_args: Any = ... - def deconstruct(self): ... + def deconstruct(self) -> Any: ... def state_forwards(self, app_label: Any, state: Any) -> None: ... def database_forwards( self, app_label: Any, schema_editor: Any, from_state: Any, to_state: Any diff --git a/django-stubs/db/migrations/operations/fields.pyi b/django-stubs/db/migrations/operations/fields.pyi index 0563a8d22..83288b1b0 100644 --- a/django-stubs/db/migrations/operations/fields.pyi +++ b/django-stubs/db/migrations/operations/fields.pyi @@ -9,17 +9,21 @@ class FieldOperation(Operation): model_name_lower: str name: str = ... def __init__( - self, model_name: str, name: str, field: Optional[Field] = ... + self, model_name: str, name: str, field: Optional[Field[Any, Any]] = ... ) -> None: ... def name_lower(self) -> str: ... def is_same_model_operation(self, operation: FieldOperation) -> bool: ... def is_same_field_operation(self, operation: AddField) -> bool: ... class AddField(FieldOperation): - field: Field = ... + field: Field[Any, Any] = ... preserve_default: bool = ... def __init__( - self, model_name: str, name: str, field: Field, preserve_default: bool = ... + self, + model_name: str, + name: str, + field: Field[Any, Any], + preserve_default: bool = ..., ) -> None: ... class RemoveField(FieldOperation): ... @@ -28,12 +32,16 @@ class AlterField(FieldOperation): field: Any = ... preserve_default: Any = ... def __init__( - self, model_name: str, name: str, field: Field, preserve_default: bool = ... + self, + model_name: str, + name: str, + field: Field[Any, Any], + preserve_default: bool = ..., ) -> None: ... class RenameField(FieldOperation): old_name: Any = ... new_name: Any = ... def __init__(self, model_name: str, old_name: str, new_name: str) -> None: ... - def old_name_lower(self): ... + def old_name_lower(self) -> Any: ... def new_name_lower(self) -> str: ... diff --git a/django-stubs/db/migrations/operations/models.pyi b/django-stubs/db/migrations/operations/models.pyi index 3564da55f..8c26e6426 100644 --- a/django-stubs/db/migrations/operations/models.pyi +++ b/django-stubs/db/migrations/operations/models.pyi @@ -12,17 +12,17 @@ class ModelOperation(Operation): def name_lower(self) -> str: ... class CreateModel(ModelOperation): - fields: Sequence[Tuple[str, Field]] = ... + fields: Sequence[Tuple[str, Field[Any, Any]]] = ... options: Any = ... bases: Optional[Sequence[Union[type, str]]] = ... - managers: Optional[Sequence[Tuple[str, Manager]]] = ... + managers: Optional[Sequence[Tuple[str, Manager[Any]]]] = ... def __init__( self, name: str, - fields: Sequence[Tuple[str, Field]], + fields: Sequence[Tuple[str, Field[Any, Any]]], options: Optional[Dict[str, Any]] = ..., bases: Optional[Sequence[Union[type, str]]] = ..., - managers: Optional[Sequence[Tuple[str, Manager]]] = ..., + managers: Optional[Sequence[Tuple[str, Manager[Any]]]] = ..., ) -> None: ... def model_to_key(self, model: str) -> List[str]: ... @@ -71,7 +71,7 @@ class AlterModelManagers(ModelOptionOperation): class IndexOperation(Operation): option_name: str = ... - def model_name_lower(self): ... + def model_name_lower(self) -> Any: ... class AddIndex(IndexOperation): model_name: str = ... @@ -84,7 +84,7 @@ class RemoveIndex(IndexOperation): def __init__(self, model_name: str, name: Union[str, Index]) -> None: ... class AddConstraint(IndexOperation): - def __init__(self, model_name: str, constraint: BaseConstraint): ... + def __init__(self, model_name: str, constraint: BaseConstraint) -> None: ... class RemoveConstraint(IndexOperation): def __init__(self, model_name: str, name: str) -> None: ... diff --git a/django-stubs/db/migrations/operations/special.pyi b/django-stubs/db/migrations/operations/special.pyi index 25dd00f73..3679610eb 100644 --- a/django-stubs/db/migrations/operations/special.pyi +++ b/django-stubs/db/migrations/operations/special.pyi @@ -30,13 +30,13 @@ class RunSQL(Operation): ) -> None: ... class RunPython(Operation): - code: Callable = ... - reverse_code: Optional[Callable] = ... + code: Callable[..., Any] = ... + reverse_code: Optional[Callable[..., Any]] = ... hints: Optional[Dict[str, Any]] = ... def __init__( self, - code: Callable, - reverse_code: Optional[Callable] = ..., + code: Callable[..., Any], + reverse_code: Optional[Callable[..., Any]] = ..., atomic: Optional[bool] = ..., hints: Optional[Dict[str, Any]] = ..., elidable: bool = ..., diff --git a/django-stubs/db/migrations/operations/utils.pyi b/django-stubs/db/migrations/operations/utils.pyi index 108b82827..06e636fa2 100644 --- a/django-stubs/db/migrations/operations/utils.pyi +++ b/django-stubs/db/migrations/operations/utils.pyi @@ -1,6 +1,8 @@ +from typing import Any + from django.db.migrations.state import ProjectState from django.db.models.fields import Field def is_referenced_by_foreign_key( - state: ProjectState, model_name_lower: str, field: Field, field_name: str + state: ProjectState, model_name_lower: str, field: Field[Any, Any], field_name: str ) -> bool: ... diff --git a/django-stubs/db/migrations/questioner.pyi b/django-stubs/db/migrations/questioner.pyi index 906ffb3b3..ead3edbae 100644 --- a/django-stubs/db/migrations/questioner.pyi +++ b/django-stubs/db/migrations/questioner.pyi @@ -15,9 +15,13 @@ class MigrationQuestioner: ) -> None: ... def ask_initial(self, app_label: str) -> bool: ... def ask_not_null_addition(self, field_name: str, model_name: str) -> None: ... - def ask_not_null_alteration(self, field_name: Any, model_name: Any): ... + def ask_not_null_alteration(self, field_name: Any, model_name: Any) -> Any: ... def ask_rename( - self, model_name: str, old_name: str, new_name: str, field_instance: Field + self, + model_name: str, + old_name: str, + new_name: str, + field_instance: Field[Any, Any], ) -> bool: ... def ask_rename_model( self, old_model_state: ModelState, new_model_state: ModelState diff --git a/django-stubs/db/migrations/recorder.pyi b/django-stubs/db/migrations/recorder.pyi index e26cb6924..668832980 100644 --- a/django-stubs/db/migrations/recorder.pyi +++ b/django-stubs/db/migrations/recorder.pyi @@ -12,7 +12,7 @@ class MigrationRecorder: connection: Optional[BaseDatabaseWrapper] = ... def __init__(self, connection: Optional[BaseDatabaseWrapper]) -> None: ... @property - def migration_qs(self) -> QuerySet: ... + def migration_qs(self) -> QuerySet[Any]: ... def has_table(self) -> bool: ... def ensure_schema(self) -> None: ... def applied_migrations(self) -> Set[Tuple[str, str]]: ... diff --git a/django-stubs/db/migrations/serializer.pyi b/django-stubs/db/migrations/serializer.pyi index 3dc3ceded..f31755d8c 100644 --- a/django-stubs/db/migrations/serializer.pyi +++ b/django-stubs/db/migrations/serializer.pyi @@ -14,7 +14,9 @@ class DecimalSerializer(BaseSerializer): ... class DeconstructableSerializer(BaseSerializer): @staticmethod def serialize_deconstructed( - path: str, args: List[Any], kwargs: Dict[str, Union[Callable, int, str]] + path: str, + args: List[Any], + kwargs: Dict[str, Union[Callable[..., Any], int, str]], ) -> Tuple[str, Set[str]]: ... class DictionarySerializer(BaseSerializer): ... diff --git a/django-stubs/db/migrations/state.pyi b/django-stubs/db/migrations/state.pyi index 2d626c7ce..c4e587635 100644 --- a/django-stubs/db/migrations/state.pyi +++ b/django-stubs/db/migrations/state.pyi @@ -22,24 +22,24 @@ class AppConfigStub(AppConfig): ... class ModelState: name: str app_label: str - fields: List[Tuple[str, Field]] + fields: List[Tuple[str, Field[Any, Any]]] options: Dict[str, Any] = ... bases: Tuple[Type[Model]] = ... - managers: List[Tuple[str, Manager]] = ... + managers: List[Tuple[str, Manager[Any]]] = ... def __init__( self, app_label: str, name: str, - fields: List[Tuple[str, Field]], + fields: List[Tuple[str, Field[Any, Any]]], options: Optional[Dict[str, Any]] = ..., bases: Optional[Sequence[Union[Type[Model], str]]] = ..., - managers: Optional[List[Tuple[str, Manager]]] = ..., + managers: Optional[List[Tuple[str, Manager[Any]]]] = ..., ) -> None: ... def clone(self) -> ModelState: ... - def construct_managers(self) -> Iterator[Tuple[str, Manager]]: ... + def construct_managers(self) -> Iterator[Tuple[str, Manager[Any]]]: ... @classmethod def from_model(cls, model: Type[Model], exclude_rels: bool = ...) -> ModelState: ... - def get_field_by_name(self, name: str) -> Field: ... + def get_field_by_name(self, name: str) -> Field[Any, Any]: ... @property def name_lower(self) -> str: ... def render(self, apps: Apps) -> Any: ... diff --git a/django-stubs/db/models/__init__.pyi b/django-stubs/db/models/__init__.pyi index 7c7985e1d..c2b95ce82 100644 --- a/django-stubs/db/models/__init__.pyi +++ b/django-stubs/db/models/__init__.pyi @@ -55,7 +55,6 @@ from .fields import BigIntegerField as BigIntegerField from .fields import BinaryField as BinaryField from .fields import BooleanField as BooleanField from .fields import CharField as CharField -from .fields import CommaSeparatedIntegerField as CommaSeparatedIntegerField from .fields import DateField as DateField from .fields import DateTimeField as DateTimeField from .fields import DecimalField as DecimalField @@ -68,7 +67,6 @@ from .fields import FloatField as FloatField from .fields import GenericIPAddressField as GenericIPAddressField from .fields import IntegerField as IntegerField from .fields import IPAddressField as IPAddressField -from .fields import NullBooleanField as NullBooleanField from .fields import PositiveIntegerField as PositiveIntegerField from .fields import PositiveSmallIntegerField as PositiveSmallIntegerField from .fields import SlugField as SlugField diff --git a/django-stubs/db/models/base.pyi b/django-stubs/db/models/base.pyi index b4aede726..40b27b93d 100644 --- a/django-stubs/db/models/base.pyi +++ b/django-stubs/db/models/base.pyi @@ -43,9 +43,9 @@ class Model(metaclass=ModelBase): # objects: BaseManager[Any] pk: Any = ... _state: ModelState - def __init__(self: _Self, *args, **kwargs) -> None: ... + def __init__(self: _Self, *args: Any, **kwargs: Any) -> None: ... @classmethod - def add_to_class(cls, name: str, value: Any): ... + def add_to_class(cls, name: str, value: Any) -> Any: ... @classmethod def from_db( cls, db: Optional[str], field_names: Collection[str], values: Collection[Any] @@ -60,7 +60,9 @@ class Model(metaclass=ModelBase): def clean_fields(self, exclude: Optional[Collection[str]] = ...) -> None: ... def validate_unique(self, exclude: Optional[Collection[str]] = ...) -> None: ... def unique_error_message( - self, model_class: Type[_Self], unique_check: Collection[Union[Callable, str]] + self, + model_class: Type[_Self], + unique_check: Collection[Union[Callable[..., Any], str]], ) -> ValidationError: ... def save( self, @@ -76,11 +78,11 @@ class Model(metaclass=ModelBase): force_update: bool = ..., using: Optional[str] = ..., update_fields: Optional[Iterable[str]] = ..., - ): ... + ) -> Any: ... def refresh_from_db( self: _Self, using: Optional[str] = ..., fields: Optional[List[str]] = ... ) -> None: ... def get_deferred_fields(self) -> Set[str]: ... @classmethod def check(cls, **kwargs: Any) -> List[CheckMessage]: ... - def __getstate__(self) -> dict: ... + def __getstate__(self) -> Dict[Any, Any]: ... diff --git a/django-stubs/db/models/deletion.pyi b/django-stubs/db/models/deletion.pyi index 93904a81e..7460ec2a1 100644 --- a/django-stubs/db/models/deletion.pyi +++ b/django-stubs/db/models/deletion.pyi @@ -5,14 +5,16 @@ from django.db.models.base import Model from django.db.models.fields import Field from django.db.models.options import Options -def CASCADE(collector, field, sub_objs, using): ... -def SET_NULL(collector, field, sub_objs, using): ... -def SET_DEFAULT(collector, field, sub_objs, using): ... -def DO_NOTHING(collector, field, sub_objs, using): ... -def PROTECT(collector, field, sub_objs, using): ... -def RESTRICT(collector, field, sub_objs, using): ... -def SET(value: Any) -> Callable: ... -def get_candidate_relations_to_delete(opts: Options) -> Iterable[Field]: ... +def CASCADE(collector: Any, field: Any, sub_objs: Any, using: Any) -> Any: ... +def SET_NULL(collector: Any, field: Any, sub_objs: Any, using: Any) -> Any: ... +def SET_DEFAULT(collector: Any, field: Any, sub_objs: Any, using: Any) -> Any: ... +def DO_NOTHING(collector: Any, field: Any, sub_objs: Any, using: Any) -> Any: ... +def PROTECT(collector: Any, field: Any, sub_objs: Any, using: Any) -> Any: ... +def RESTRICT(collector: Any, field: Any, sub_objs: Any, using: Any) -> Any: ... +def SET(value: Any) -> Callable[..., Any]: ... +def get_candidate_relations_to_delete( + opts: Options[Any], +) -> Iterable[Field[Any, Any]]: ... class ProtectedError(IntegrityError): ... class RestrictedError(IntegrityError): ... @@ -27,5 +29,7 @@ class Collector: **kwargs: Any ) -> None: ... def can_fast_delete( - self, objs: Union[Model, Iterable[Model]], from_field: Optional[Field] = ... + self, + objs: Union[Model, Iterable[Model]], + from_field: Optional[Field[Any, Any]] = ..., ) -> bool: ... diff --git a/django-stubs/db/models/enums.pyi b/django-stubs/db/models/enums.pyi index 557312ec7..12bd15966 100644 --- a/django-stubs/db/models/enums.pyi +++ b/django-stubs/db/models/enums.pyi @@ -9,7 +9,7 @@ class ChoicesMeta(enum.EnumMeta): def __contains__(self, item: Any) -> bool: ... class Choices(enum.Enum, metaclass=ChoicesMeta): - def __str__(self): ... + def __str__(self) -> Any: ... @property def label(self) -> str: ... @property diff --git a/django-stubs/db/models/expressions.pyi b/django-stubs/db/models/expressions.pyi index e1aea2726..ade1ece64 100644 --- a/django-stubs/db/models/expressions.pyi +++ b/django-stubs/db/models/expressions.pyi @@ -22,7 +22,7 @@ from django.db.models.lookups import Lookup from django.db.models.query import _BaseQuerySet from django.db.models.sql.compiler import SQLCompiler -_OutputField = Union[Field, str] +_OutputField = Union[Field[Any, Any], str] class SQLiteNumericMixin: def as_sqlite( @@ -80,7 +80,7 @@ class BaseExpression: filterable: bool = ... window_compatible: bool = ... def __init__(self, output_field: Optional[_OutputField] = ...) -> None: ... - def get_db_converters(self, connection: Any) -> List[Callable]: ... + def get_db_converters(self, connection: Any) -> List[Callable[..., Any]]: ... def get_source_expressions(self) -> List[Any]: ... def set_source_expressions(self, exprs: Sequence[Combinable]) -> None: ... @property @@ -98,20 +98,20 @@ class BaseExpression: for_save: bool = ..., ) -> _Self: ... @property - def field(self) -> Field: ... + def field(self) -> Field[Any, Any]: ... @property - def output_field(self) -> Field: ... + def output_field(self) -> Field[Any, Any]: ... @property - def convert_value(self) -> Callable: ... - def get_lookup(self, lookup: str) -> Optional[Type[Lookup]]: ... + def convert_value(self) -> Callable[..., Any]: ... + def get_lookup(self, lookup: str) -> Optional[Type[Lookup[Any]]]: ... def get_transform(self, name: str) -> Optional[Type[Expression]]: ... def relabeled_clone(self, change_map: Dict[Optional[str], str]) -> Expression: ... def copy(self) -> BaseExpression: ... def get_group_by_cols(self: _Self) -> List[_Self]: ... - def get_source_fields(self) -> List[Optional[Field]]: ... + def get_source_fields(self) -> List[Optional[Field[Any, Any]]]: ... def asc(self, **kwargs: Any) -> Expression: ... def desc(self, **kwargs: Any) -> Expression: ... - def reverse_ordering(self): ... + def reverse_ordering(self) -> Any: ... def flatten(self) -> Iterator[Expression]: ... def deconstruct(self) -> Any: ... def as_sqlite(self, compiler: SQLCompiler, connection: Any) -> Any: ... @@ -120,7 +120,7 @@ class BaseExpression: ) -> Any: ... def as_mysql(self, compiler: Any, connection: Any) -> Any: ... def as_postgresql(self, compiler: Any, connection: Any) -> Any: ... - def as_oracle(self, compiler: Any, connection: Any): ... + def as_oracle(self, compiler: Any, connection: Any) -> Any: ... class Expression(BaseExpression, Combinable): ... @@ -138,7 +138,7 @@ class CombinedExpression(SQLiteNumericMixin, Expression): class F(Combinable): name: str - def __init__(self, name: str): ... + def __init__(self, name: str) -> None: ... def resolve_expression( self: _Self, query: Any = ..., @@ -147,20 +147,20 @@ class F(Combinable): summarize: bool = ..., for_save: bool = ..., ) -> _Self: ... - def asc(self, **kwargs) -> OrderBy: ... - def desc(self, **kwargs) -> OrderBy: ... + def asc(self, **kwargs: Any) -> OrderBy: ... + def desc(self, **kwargs: Any) -> OrderBy: ... def deconstruct(self) -> Any: ... class OuterRef(F): - def __init__(self, name: Union[str, OuterRef]): ... + def __init__(self, name: Union[str, OuterRef]) -> None: ... class Subquery(Expression): template: str = ... - queryset: QuerySet = ... + queryset: QuerySet[Any] = ... extra: Dict[Any, Any] = ... def __init__( self, - queryset: _BaseQuerySet, + queryset: _BaseQuerySet[Any], output_field: Optional[_OutputField] = ..., **extra: Any ) -> None: ... @@ -245,14 +245,16 @@ class ExpressionWrapper(Expression): class Col(Expression): def __init__( self, alias: str, target: str, output_field: Optional[_OutputField] = ... - ): ... + ) -> None: ... class SimpleCol(Expression): contains_column_references: bool = ... - def __init__(self, target: Field, output_field: Optional[_OutputField] = ...): ... + def __init__( + self, target: Field[Any, Any], output_field: Optional[_OutputField] = ... + ) -> None: ... class Ref(Expression): - def __init__(self, refs: str, source: Expression): ... + def __init__(self, refs: str, source: Expression) -> None: ... class ExpressionList(Func): def __init__( diff --git a/django-stubs/db/models/fields/__init__.pyi b/django-stubs/db/models/fields/__init__.pyi index 1da8102b6..6395a36b6 100644 --- a/django-stubs/db/models/fields/__init__.pyi +++ b/django-stubs/db/models/fields/__init__.pyi @@ -38,7 +38,7 @@ _FieldChoices = Iterable[Union[_Choice, _ChoiceNamedGroup]] _ValidatorCallable = Callable[..., None] _ErrorMessagesToOverride = Dict[str, Any] -_T = TypeVar("_T", bound="Field") +_T = TypeVar("_T", bound="Field[Any, Any]") # __set__ value type _ST = TypeVar("_ST") # __get__ return type @@ -52,7 +52,7 @@ class Field(RegisterLookupMixin, Generic[_ST, _GT]): attname: str auto_created: bool primary_key: bool - remote_field: Field + remote_field: Field[_ST, _GT] is_relation: bool related_model: Optional[Type[Model]] one_to_many: Optional[bool] = ... @@ -97,16 +97,16 @@ class Field(RegisterLookupMixin, Generic[_ST, _GT]): validators: Iterable[_ValidatorCallable] = ..., error_messages: Optional[_ErrorMessagesToOverride] = ..., ): ... - def __set__(self, instance, value: _ST) -> None: ... + def __set__(self, instance: Any, value: _ST) -> None: ... # class access @overload - def __get__(self: _T, instance: None, owner) -> _T: ... + def __get__(self: _T, instance: None, owner: Any) -> _T: ... # Model instance access @overload - def __get__(self, instance: Model, owner) -> _GT: ... + def __get__(self, instance: Model, owner: Any) -> _GT: ... # non-Model instances @overload - def __get__(self: _T, instance, owner) -> _T: ... + def __get__(self: _T, instance: Any, owner: Any) -> _T: ... def deconstruct(self) -> Any: ... def set_attributes_from_name(self, name: str) -> None: ... def db_type(self, connection: Any) -> str: ... @@ -117,7 +117,7 @@ class Field(RegisterLookupMixin, Generic[_ST, _GT]): def get_db_prep_save(self, value: Any, connection: Any) -> Any: ... def get_internal_type(self) -> str: ... # TODO: plugin support - def formfield(self, **kwargs) -> Any: ... + def formfield(self, **kwargs: Any) -> Any: ... def save_form_data(self, instance: Model, data: Any) -> None: ... def contribute_to_class( self, cls: Type[Model], name: str, private_only: bool = ... @@ -138,7 +138,9 @@ class Field(RegisterLookupMixin, Generic[_ST, _GT]): def validators(self) -> List[_ValidatorCallable]: ... def validate(self, value: Any, model_instance: Model) -> None: ... def run_validators(self, value: Any) -> None: ... - def get_col(self, alias: str, output_field: Optional[Field] = ...) -> Col: ... + def get_col( + self, alias: str, output_field: Optional[Field[Any, Any]] = ... + ) -> Col: ... @property def cached_col(self) -> Col: ... def value_from_object(self, obj: Model) -> _GT: ... @@ -195,13 +197,13 @@ class IntegerField(Generic[_C], Field[Union[float, int, str, Combinable], int]): validators: Iterable[_ValidatorCallable] = ..., error_messages: Optional[_ErrorMessagesToOverride] = ..., ) -> None: ... - def __get__(self, instance: Any, owner: Any) -> _C: ... + def __get__(self, instance: Any, owner: Any) -> _C: ... # type: ignore [override] def __set__( self, instance: Any, value: Union[str, float, int, Combinable, _C] ) -> None: ... class PositiveIntegerRelDbTypeMixin: - def rel_db_type(self, connection: Any): ... + def rel_db_type(self, connection: Any) -> Any: ... class PositiveIntegerField(PositiveIntegerRelDbTypeMixin, IntegerField[_C]): @overload @@ -254,7 +256,7 @@ class PositiveIntegerField(PositiveIntegerRelDbTypeMixin, IntegerField[_C]): validators: Iterable[_ValidatorCallable] = ..., error_messages: Optional[_ErrorMessagesToOverride] = ..., ) -> None: ... - def __get__(self, instance: Any, owner: Any) -> _C: ... + def __get__(self, instance: Any, owner: Any) -> _C: ... # type: ignore [override] def __set__( self, instance: Any, value: Union[str, float, int, Combinable, _C] ) -> None: ... @@ -310,7 +312,7 @@ class PositiveSmallIntegerField(PositiveIntegerRelDbTypeMixin, IntegerField[_C]) validators: Iterable[_ValidatorCallable] = ..., error_messages: Optional[_ErrorMessagesToOverride] = ..., ) -> None: ... - def __get__(self, instance: Any, owner: Any) -> _C: ... + def __get__(self, instance: Any, owner: Any) -> _C: ... # type: ignore [override] def __set__( self, instance: Any, value: Union[str, float, int, Combinable, _C] ) -> None: ... @@ -366,7 +368,7 @@ class SmallIntegerField(IntegerField[_C]): validators: Iterable[_ValidatorCallable] = ..., error_messages: Optional[_ErrorMessagesToOverride] = ..., ) -> None: ... - def __get__(self, instance: Any, owner: Any) -> _C: ... + def __get__(self, instance: Any, owner: Any) -> _C: ... # type: ignore [override] def __set__( self, instance: Any, value: Union[str, float, int, Combinable, _C] ) -> None: ... @@ -422,7 +424,7 @@ class BigIntegerField(IntegerField[_C]): validators: Iterable[_ValidatorCallable] = ..., error_messages: Optional[_ErrorMessagesToOverride] = ..., ) -> None: ... - def __get__(self, instance: Any, owner: Any) -> _C: ... + def __get__(self, instance: Any, owner: Any) -> _C: ... # type: ignore [override] def __set__( self, instance: Any, value: Union[str, float, int, Combinable, _C] ) -> None: ... @@ -478,7 +480,7 @@ class FloatField(Generic[_C], Field[Union[float, int, str, Combinable], float]): validators: Iterable[_ValidatorCallable] = ..., error_messages: Optional[_ErrorMessagesToOverride] = ..., ) -> None: ... - def __get__(self, instance: Any, owner: Any) -> _C: ... + def __get__(self, instance: Any, owner: Any) -> _C: ... # type: ignore [override] def __set__( self, instance: Any, value: Union[str, float, int, Combinable, _C] ) -> None: ... @@ -535,8 +537,8 @@ class DecimalField( validators: Iterable[_ValidatorCallable] = ..., error_messages: Optional[_ErrorMessagesToOverride] = ..., ): ... - def __get__(self, instance: Any, owner: Any) -> _C: ... - def __set__( + def __get__(self, instance: Any, owner: Any) -> _C: ... # type: ignore [override] + def __set__( # type: ignore [override] self, instance: Any, value: Union[str, float, Combinable, _C] ) -> None: ... @@ -595,8 +597,8 @@ class CharField(Generic[_C], Field[str, str]): validators: Iterable[_ValidatorCallable] = ..., error_messages: Optional[_ErrorMessagesToOverride] = ..., ) -> None: ... - def __get__(self, instance: Any, owner: Any) -> _C: ... - def __set__(self, instance: Any, value: _C) -> None: ... + def __get__(self, instance: Any, owner: Any) -> _C: ... # type: ignore [override] + def __set__(self, instance: Any, value: _C) -> None: ... # type: ignore [override] class SlugField(CharField[_C]): @overload @@ -651,8 +653,8 @@ class SlugField(CharField[_C]): validators: Iterable[_ValidatorCallable] = ..., error_messages: Optional[_ErrorMessagesToOverride] = ..., ): ... - def __get__(self: SlugField[_C], instance: Any, owner: Any) -> _C: ... - def __set__(self, instance: Any, value: _C) -> None: ... + def __get__(self: SlugField[_C], instance: Any, owner: Any) -> _C: ... # type: ignore [override] + def __set__(self, instance: Any, value: _C) -> None: ... # type: ignore [override] class EmailField(CharField[_C]): @overload @@ -705,8 +707,8 @@ class EmailField(CharField[_C]): validators: Iterable[_ValidatorCallable] = ..., error_messages: Optional[_ErrorMessagesToOverride] = ..., ) -> None: ... - def __get__(self, instance: Any, owner: Any) -> _C: ... - def __set__(self, instance: Any, value: _C) -> None: ... + def __get__(self, instance: Any, owner: Any) -> _C: ... # type: ignore [override] + def __set__(self, instance: Any, value: _C) -> None: ... # type: ignore [override] class URLField(CharField[_C]): @overload @@ -759,8 +761,8 @@ class URLField(CharField[_C]): validators: Iterable[_ValidatorCallable] = ..., error_messages: Optional[_ErrorMessagesToOverride] = ..., ) -> None: ... - def __get__(self, instance: Any, owner: Any) -> _C: ... - def __set__(self, instance: Any, value: _C) -> None: ... + def __get__(self, instance: Any, owner: Any) -> _C: ... # type: ignore [override] + def __set__(self, instance: Any, value: _C) -> None: ... # type: ignore [override] class TextField(Generic[_C], Field[str, str]): @overload @@ -815,8 +817,8 @@ class TextField(Generic[_C], Field[str, str]): validators: Iterable[_ValidatorCallable] = ..., error_messages: Optional[_ErrorMessagesToOverride] = ..., ) -> None: ... - def __get__(self: TextField[_C], instance: Any, owner: Any) -> _C: ... - def __set__(self, instance: Any, value: _C) -> None: ... + def __get__(self: TextField[_C], instance: Any, owner: Any) -> _C: ... # type: ignore [override] + def __set__(self, instance: Any, value: _C) -> None: ... # type: ignore [override] class BooleanField(Generic[_C], Field[Union[bool, Combinable], bool]): @overload @@ -869,8 +871,8 @@ class BooleanField(Generic[_C], Field[Union[bool, Combinable], bool]): validators: Iterable[_ValidatorCallable] = ..., error_messages: Optional[_ErrorMessagesToOverride] = ..., ): ... - def __get__(self, instance: Any, owner: Any) -> _C: ... - def __set__(self, instance: Any, value: _C) -> None: ... + def __get__(self, instance: Any, owner: Any) -> _C: ... # type: ignore [override] + def __set__(self, instance: Any, value: _C) -> None: ... # type: ignore [override] class IPAddressField(Generic[_C], Field[Union[str, Combinable], str]): @overload @@ -923,8 +925,8 @@ class IPAddressField(Generic[_C], Field[Union[str, Combinable], str]): validators: Iterable[_ValidatorCallable] = ..., error_messages: Optional[_ErrorMessagesToOverride] = ..., ): ... - def __get__(self, instance: Any, owner: Any) -> _C: ... - def __set__(self, instance: Any, value: _C) -> None: ... + def __get__(self, instance: Any, owner: Any) -> _C: ... # type: ignore [override] + def __set__(self, instance: Any, value: _C) -> None: ... # type: ignore [override] class GenericIPAddressField( Generic[_C], Field[Union[str, int, Callable[..., Any], Combinable], str] @@ -979,8 +981,8 @@ class GenericIPAddressField( validators: Iterable[_ValidatorCallable] = ..., error_messages: Optional[_ErrorMessagesToOverride] = ..., ) -> None: ... - def __get__(self, instance: Any, owner: Any) -> _C: ... - def __set__(self, instance: Any, value: _C) -> None: ... + def __get__(self, instance: Any, owner: Any) -> _C: ... # type: ignore [override] + def __set__(self, instance: Any, value: _C) -> None: ... # type: ignore [override] class DateTimeCheckMixin: ... @@ -1060,8 +1062,8 @@ class TimeField( validators: Iterable[_ValidatorCallable] = ..., error_messages: Optional[_ErrorMessagesToOverride] = ..., ): ... - def __get__(self, instance: Any, owner: Any) -> _C: ... - def __set__(self, instance: Any, value: _C) -> None: ... + def __get__(self, instance: Any, owner: Any) -> _C: ... # type: ignore [override] + def __set__(self, instance: Any, value: _C) -> None: ... # type: ignore [override] _DT = TypeVar("_DT", bound=Optional[datetime]) @@ -1116,8 +1118,8 @@ class DateTimeField( validators: Iterable[_ValidatorCallable] = ..., error_messages: Optional[_ErrorMessagesToOverride] = ..., ) -> None: ... - def __get__(self, instance: Any, owner: Any) -> _DT: ... - def __set__(self, instance: Any, value: _DT) -> None: ... + def __get__(self, instance: Any, owner: Any) -> _DT: ... # type: ignore [override] + def __set__(self, instance: Any, value: _DT) -> None: ... # type: ignore [override] class UUIDField(Generic[_C], Field[Union[str, uuid.UUID], uuid.UUID]): @overload @@ -1170,8 +1172,8 @@ class UUIDField(Generic[_C], Field[Union[str, uuid.UUID], uuid.UUID]): validators: Iterable[_ValidatorCallable] = ..., error_messages: Optional[_ErrorMessagesToOverride] = ..., ) -> None: ... - def __get__(self, instance: Any, owner: Any) -> _C: ... - def __set__(self, instance: Any, value: Union[str, _C]) -> None: ... + def __get__(self, instance: Any, owner: Any) -> _C: ... # type: ignore [override] + def __set__(self, instance: Any, value: Union[str, _C]) -> None: ... # type: ignore [override] class FilePathField(Generic[_C], Field[str, str]): path: Any = ... @@ -1233,8 +1235,8 @@ class FilePathField(Generic[_C], Field[str, str]): validators: Iterable[_ValidatorCallable] = ..., error_messages: Optional[_ErrorMessagesToOverride] = ..., ): ... - def __get__(self, instance: Any, owner: Any) -> _C: ... - def __set__(self, instance: Any, value: _C) -> None: ... + def __get__(self, instance: Any, owner: Any) -> _C: ... # type: ignore [override] + def __set__(self, instance: Any, value: _C) -> None: ... # type: ignore [override] class BinaryField(Generic[_C], Field[Union[bytes, bytearray, memoryview], bytes]): @overload @@ -1287,8 +1289,8 @@ class BinaryField(Generic[_C], Field[Union[bytes, bytearray, memoryview], bytes] validators: Iterable[_ValidatorCallable] = ..., error_messages: Optional[_ErrorMessagesToOverride] = ..., ): ... - def __get__(self, instance: Any, owner: Any) -> _C: ... - def __set__(self, instance: Any, value: _C) -> None: ... + def __get__(self, instance: Any, owner: Any) -> _C: ... # type: ignore [override] + def __set__(self, instance: Any, value: _C) -> None: ... # type: ignore [override] class DurationField(Generic[_C], Field[timedelta, timedelta]): @overload @@ -1341,7 +1343,7 @@ class DurationField(Generic[_C], Field[timedelta, timedelta]): validators: Iterable[_ValidatorCallable] = ..., error_messages: Optional[_ErrorMessagesToOverride] = ..., ): ... - def __get__(self, instance: Any, owner: Any) -> _C: ... - def __set__(self, instance: Any, value: _C) -> None: ... + def __get__(self, instance: Any, owner: Any) -> _C: ... # type: ignore [override] + def __set__(self, instance: Any, value: _C) -> None: ... # type: ignore [override] class BigAutoField(AutoField): ... diff --git a/django-stubs/db/models/fields/files.pyi b/django-stubs/db/models/fields/files.pyi index 03d10e75a..2cdc36397 100644 --- a/django-stubs/db/models/fields/files.pyi +++ b/django-stubs/db/models/fields/files.pyi @@ -39,14 +39,14 @@ class FileDescriptor: self, instance: Optional[Model], cls: Type[Model] = ... ) -> Union[FieldFile, FileDescriptor]: ... -_T = TypeVar("_T", bound="Field") +_T = TypeVar("_T", bound="Field[Any, Any]") -class FileField(Field): +class FileField(Field[Any, Any]): storage: Any = ... - upload_to: Union[str, Callable] = ... + upload_to: Union[str, Callable[..., Any]] = ... def __init__( self, - upload_to: Union[str, Callable, Path] = ..., + upload_to: Union[str, Callable[..., Any], Path] = ..., storage: Optional[Union[Storage, Callable[[], Storage]]] = ..., verbose_name: Optional[Union[str, bytes]] = ..., name: Optional[str] = ..., @@ -71,13 +71,13 @@ class FileField(Field): ): ... # class access @overload # type: ignore - def __get__(self, instance: None, owner) -> FileDescriptor: ... + def __get__(self, instance: None, owner: Any) -> FileDescriptor: ... # Model instance access @overload - def __get__(self, instance: Model, owner) -> Any: ... + def __get__(self, instance: Model, owner: Any) -> Any: ... # non-Model instances @overload - def __get__(self: _T, instance, owner) -> _T: ... + def __get__(self: _T, instance: Any, owner: Any) -> _T: ... def generate_filename(self, instance: Optional[Model], filename: str) -> str: ... class ImageFileDescriptor(FileDescriptor): @@ -99,13 +99,13 @@ class ImageField(FileField): ) -> None: ... # class access @overload # type: ignore - def __get__(self, instance: None, owner) -> ImageFileDescriptor: ... + def __get__(self, instance: None, owner: Any) -> ImageFileDescriptor: ... # Model instance access @overload - def __get__(self, instance: Model, owner) -> Any: ... + def __get__(self, instance: Model, owner: Any) -> Any: ... # non-Model instances @overload - def __get__(self: _T, instance, owner) -> _T: ... + def __get__(self: _T, instance: Any, owner: Any) -> _T: ... def update_dimension_fields( self, instance: Model, force: bool = ..., *args: Any, **kwargs: Any ) -> None: ... diff --git a/django-stubs/db/models/fields/json.pyi b/django-stubs/db/models/fields/json.pyi index ad5cd125c..982eae5d4 100644 --- a/django-stubs/db/models/fields/json.pyi +++ b/django-stubs/db/models/fields/json.pyi @@ -6,7 +6,7 @@ from django.db.models.lookups import PostgresOperatorLookup, Transform from . import Field from .mixins import CheckFieldDefaultMixin -class JSONField(CheckFieldDefaultMixin, Field): +class JSONField(CheckFieldDefaultMixin, Field[Any, Any]): empty_strings_allowed: bool = ... description: Any = ... default_error_messages: Any = ... @@ -20,35 +20,37 @@ class JSONField(CheckFieldDefaultMixin, Field): decoder: Optional[Any] = ..., **kwargs: Any ) -> None: ... - def check(self, **kwargs: Any): ... - def deconstruct(self): ... - def from_db_value(self, value: Any, expression: Any, connection: Any): ... - def get_internal_type(self): ... - def get_prep_value(self, value: Any): ... - def get_transform(self, name: Any): ... + def check(self, **kwargs: Any) -> Any: ... + def deconstruct(self) -> Any: ... + def from_db_value(self, value: Any, expression: Any, connection: Any) -> Any: ... + def get_internal_type(self) -> Any: ... + def get_prep_value(self, value: Any) -> Any: ... + def get_transform(self, name: Any) -> Any: ... def validate(self, value: Any, model_instance: Any) -> None: ... - def value_to_string(self, obj: Any): ... - def formfield(self, **kwargs: Any): ... + def value_to_string(self, obj: Any) -> Any: ... + def formfield(self, **kwargs: Any) -> Any: ... class DataContains(PostgresOperatorLookup): lookup_name: str = ... postgres_operator: str = ... - def as_sql(self, compiler: Any, connection: Any): ... + def as_sql(self, compiler: Any, connection: Any) -> Any: ... class ContainedBy(PostgresOperatorLookup): lookup_name: str = ... postgres_operator: str = ... - def as_sql(self, compiler: Any, connection: Any): ... + def as_sql(self, compiler: Any, connection: Any) -> Any: ... class HasKeyLookup(PostgresOperatorLookup): logical_operator: Any = ... - def as_sql(self, compiler: Any, connection: Any, template: Optional[Any] = ...): ... - def as_mysql(self, compiler: Any, connection: Any): ... - def as_oracle(self, compiler: Any, connection: Any): ... + def as_sql( + self, compiler: Any, connection: Any, template: Optional[Any] = ... + ) -> Any: ... + def as_mysql(self, compiler: Any, connection: Any) -> Any: ... + def as_oracle(self, compiler: Any, connection: Any) -> Any: ... lhs: Any = ... rhs: Any = ... - def as_postgresql(self, compiler: Any, connection: Any): ... - def as_sqlite(self, compiler: Any, connection: Any): ... + def as_postgresql(self, compiler: Any, connection: Any) -> Any: ... + def as_sqlite(self, compiler: Any, connection: Any) -> Any: ... class HasKey(HasKeyLookup): lookup_name: str = ... @@ -59,7 +61,7 @@ class HasKeys(HasKeyLookup): lookup_name: str = ... postgres_operator: str = ... logical_operator: str = ... - def get_prep_lookup(self): ... + def get_prep_lookup(self) -> Any: ... class HasAnyKeys(HasKeys): lookup_name: str = ... @@ -68,17 +70,19 @@ class HasAnyKeys(HasKeys): class JSONExact(lookups.Exact): can_use_none_as_rhs: bool = ... - def process_rhs(self, compiler: Any, connection: Any): ... + def process_rhs(self, compiler: Any, connection: Any) -> Any: ... class KeyTransform(Transform): postgres_operator: str = ... postgres_nested_operator: str = ... key_name: Any = ... def __init__(self, key_name: Any, *args: Any, **kwargs: Any) -> None: ... - def preprocess_lhs(self, compiler: Any, connection: Any, lhs_only: bool = ...): ... - def as_mysql(self, compiler: Any, connection: Any): ... - def as_oracle(self, compiler: Any, connection: Any): ... - def as_postgresql(self, compiler: Any, connection: Any): ... + def preprocess_lhs( + self, compiler: Any, connection: Any, lhs_only: bool = ... + ) -> Any: ... + def as_mysql(self, compiler: Any, connection: Any) -> Any: ... + def as_oracle(self, compiler: Any, connection: Any) -> Any: ... + def as_postgresql(self, compiler: Any, connection: Any) -> Any: ... class KeyTextTransform(KeyTransform): postgres_operator: str = ... @@ -88,18 +92,18 @@ class KeyTransformTextLookupMixin: def __init__(self, key_transform: Any, *args: Any, **kwargs: Any) -> None: ... class CaseInsensitiveMixin: - def process_rhs(self, compiler: Any, connection: Any): ... + def process_rhs(self, compiler: Any, connection: Any) -> Any: ... class KeyTransformIsNull(lookups.IsNull): - def as_oracle(self, compiler: Any, connection: Any): ... - def as_sqlite(self, compiler: Any, connection: Any): ... + def as_oracle(self, compiler: Any, connection: Any) -> Any: ... + def as_sqlite(self, compiler: Any, connection: Any) -> Any: ... class KeyTransformIn(lookups.In): - def process_rhs(self, compiler: Any, connection: Any): ... + def process_rhs(self, compiler: Any, connection: Any) -> Any: ... class KeyTransformExact(JSONExact): - def process_rhs(self, compiler: Any, connection: Any): ... - def as_oracle(self, compiler: Any, connection: Any): ... + def process_rhs(self, compiler: Any, connection: Any) -> Any: ... + def as_oracle(self, compiler: Any, connection: Any) -> Any: ... class KeyTransformIExact( CaseInsensitiveMixin, KeyTransformTextLookupMixin, lookups.IExact @@ -121,14 +125,16 @@ class KeyTransformIRegex( ): ... class KeyTransformNumericLookupMixin: - def process_rhs(self, compiler: Any, connection: Any): ... + def process_rhs(self, compiler: Any, connection: Any) -> Any: ... -class KeyTransformLt(KeyTransformNumericLookupMixin, lookups.LessThan): ... +class KeyTransformLt(KeyTransformNumericLookupMixin, lookups.LessThan[Any]): ... class KeyTransformLte(KeyTransformNumericLookupMixin, lookups.LessThanOrEqual): ... class KeyTransformGt(KeyTransformNumericLookupMixin, lookups.GreaterThan): ... -class KeyTransformGte(KeyTransformNumericLookupMixin, lookups.GreaterThanOrEqual): ... +class KeyTransformGte( + KeyTransformNumericLookupMixin, lookups.GreaterThanOrEqual[Any] +): ... class KeyTransformFactory: key_name: Any = ... def __init__(self, key_name: Any) -> None: ... - def __call__(self, *args: Any, **kwargs: Any): ... + def __call__(self, *args: Any, **kwargs: Any) -> Any: ... diff --git a/django-stubs/db/models/fields/mixins.pyi b/django-stubs/db/models/fields/mixins.pyi index fddb6595d..fe41ac2ce 100644 --- a/django-stubs/db/models/fields/mixins.pyi +++ b/django-stubs/db/models/fields/mixins.pyi @@ -14,4 +14,4 @@ class FieldCacheMixin: def delete_cached_value(self, instance: Model) -> None: ... class CheckFieldDefaultMixin: - def check(self, **kwargs: Any): ... + def check(self, **kwargs: Any) -> Any: ... diff --git a/django-stubs/db/models/fields/proxy.pyi b/django-stubs/db/models/fields/proxy.pyi index ef647530a..325e67dce 100644 --- a/django-stubs/db/models/fields/proxy.pyi +++ b/django-stubs/db/models/fields/proxy.pyi @@ -2,5 +2,5 @@ from typing import Any from django.db.models import fields -class OrderWrt(fields.IntegerField): +class OrderWrt(fields.IntegerField[Any]): def __init__(self, *args: Any, **kwargs: Any) -> None: ... diff --git a/django-stubs/db/models/fields/related.pyi b/django-stubs/db/models/fields/related.pyi index 180da1c1c..940ab28d5 100644 --- a/django-stubs/db/models/fields/related.pyi +++ b/django-stubs/db/models/fields/related.pyi @@ -46,7 +46,7 @@ from django.db.models.query_utils import PathInfo, Q from typing_extensions import Literal _T = TypeVar("_T", bound=models.Model) -_F = TypeVar("_F", bound=models.Field) +_F = TypeVar("_F", bound=models.Field[Any, Any]) _Choice = Tuple[Any, str] _ChoiceNamedGroup = Tuple[str, Iterable[_Choice]] _FieldChoices = Iterable[Union[_Choice, _ChoiceNamedGroup]] @@ -77,9 +77,9 @@ class RelatedField(FieldCacheMixin, Field[_ST, _GT]): def get_limit_choices_to(self) -> Dict[str, int]: ... def related_query_name(self) -> str: ... @property - def target_field(self) -> Field: ... + def target_field(self) -> Field[Any, Any]: ... -_M = TypeVar("_M", bound=Model) +_M = TypeVar("_M", bound=Optional[Model]) class ForeignObject(RelatedField[_M, _M]): def __init__( @@ -114,7 +114,7 @@ class ForeignObject(RelatedField[_M, _M]): error_messages: Optional[_ErrorMessagesToOverride] = ..., ): ... -class ForeignKey(Generic[_M], ForeignObject[_M, _M]): +class ForeignKey(Generic[_M], ForeignObject[_M]): @overload def __init__( self: ForeignKey[_M], @@ -183,7 +183,7 @@ class ForeignKey(Generic[_M], ForeignObject[_M, _M]): ): ... # class access @overload # type: ignore - def __get__(self, instance: None, owner) -> ForwardManyToOneDescriptor: ... + def __get__(self, instance: None, owner: Any) -> ForwardManyToOneDescriptor: ... # Model instance access @overload def __get__(self: ForeignKey[_M], instance: Any, owner: Any) -> _M: ... @@ -193,7 +193,7 @@ class ForeignKey(Generic[_M], ForeignObject[_M, _M]): ) -> Optional[_M]: ... # non-Model instances @overload - def __get__(self: _F, instance, owner) -> _F: ... + def __get__(self: _F, instance: Any, owner: Any) -> _F: ... class OneToOneField(Generic[_M], RelatedField[_M, _M]): @overload @@ -264,7 +264,7 @@ class OneToOneField(Generic[_M], RelatedField[_M, _M]): ): ... # class access @overload # type: ignore - def __get__(self, instance: None, owner) -> ForwardOneToOneDescriptor: ... + def __get__(self, instance: None, owner: Any) -> ForwardOneToOneDescriptor: ... # Model instance access @overload def __get__(self: OneToOneField[_M], instance: Any, owner: Any) -> _M: ... @@ -274,7 +274,7 @@ class OneToOneField(Generic[_M], RelatedField[_M, _M]): ) -> Optional[_M]: ... # non-Model instances @overload - def __get__(self: _F, instance, owner) -> _F: ... + def __get__(self: _F, instance: Any, owner: Any) -> _F: ... class ManyToManyField(RelatedField[Sequence[Any], RelatedManager[Any]]): @@ -318,19 +318,19 @@ class ManyToManyField(RelatedField[Sequence[Any], RelatedManager[Any]]): ) -> None: ... # class access @overload # type: ignore - def __get__(self, instance: None, owner) -> ManyToManyDescriptor: ... + def __get__(self, instance: None, owner: Any) -> ManyToManyDescriptor: ... # Model instance access @overload - def __get__(self, instance: Model, owner) -> RelatedManager[Any]: ... + def __get__(self, instance: Model, owner: Any) -> RelatedManager[Any]: ... # non-Model instances @overload - def __get__(self: _F, instance, owner) -> _F: ... + def __get__(self: _F, instance: Any, owner: Any) -> _F: ... def get_path_info(self, filtered_relation: None = ...) -> List[PathInfo]: ... def get_reverse_path_info( self, filtered_relation: None = ... ) -> List[PathInfo]: ... def contribute_to_related_class( - self, cls: Type[Model], related: RelatedField + self, cls: Type[Model], related: RelatedField[Any, Any] ) -> None: ... def m2m_db_table(self) -> str: ... def m2m_column_name(self) -> str: ... @@ -340,5 +340,5 @@ class ManyToManyField(RelatedField[Sequence[Any], RelatedManager[Any]]): def m2m_reverse_target_field_name(self) -> str: ... def create_many_to_many_intermediary_model( - field: Type[Field], klass: Type[Model] + field: Type[Field[Any, Any]], klass: Type[Model] ) -> Type[Model]: ... diff --git a/django-stubs/db/models/fields/related_descriptors.pyi b/django-stubs/db/models/fields/related_descriptors.pyi index 201262d19..df60e5bed 100644 --- a/django-stubs/db/models/fields/related_descriptors.pyi +++ b/django-stubs/db/models/fields/related_descriptors.pyi @@ -12,23 +12,25 @@ _T = TypeVar("_T") class ForwardManyToOneDescriptor: RelatedObjectDoesNotExist: Type[ObjectDoesNotExist] - field: Field = ... - def __init__(self, field_with_rel: Field) -> None: ... + field: Field[Any, Any] = ... + def __init__(self, field_with_rel: Field[Any, Any]) -> None: ... def is_cached(self, instance: Model) -> bool: ... - def get_queryset(self, **hints: Any) -> QuerySet: ... + def get_queryset(self, **hints: Any) -> QuerySet[Any]: ... def get_prefetch_queryset( - self, instances: List[Model], queryset: Optional[QuerySet] = ... - ) -> Tuple[QuerySet, Callable, Callable, bool, str, bool]: ... + self, instances: List[Model], queryset: Optional[QuerySet[Any]] = ... + ) -> Tuple[ + QuerySet[Any], Callable[..., Any], Callable[..., Any], bool, str, bool + ]: ... def get_object(self, instance: Model) -> Model: ... def __get__( self, instance: Optional[Model], cls: Type[Model] = ... ) -> Optional[Union[Model, ForwardManyToOneDescriptor]]: ... def __set__(self, instance: Model, value: Optional[Model]) -> None: ... - def __reduce__(self) -> Tuple[Callable, Tuple[Type[Model], str]]: ... + def __reduce__(self) -> Tuple[Callable[..., Any], Tuple[Type[Model], str]]: ... class ForwardOneToOneDescriptor(ForwardManyToOneDescriptor): RelatedObjectDoesNotExist: Type[ObjectDoesNotExist] - field: OneToOneField + field: OneToOneField[Any] def get_object(self, instance: Model) -> Model: ... class ReverseOneToOneDescriptor: @@ -36,40 +38,42 @@ class ReverseOneToOneDescriptor: related: OneToOneRel = ... def __init__(self, related: OneToOneRel) -> None: ... def is_cached(self, instance: Model) -> bool: ... - def get_queryset(self, **hints: Any) -> QuerySet: ... + def get_queryset(self, **hints: Any) -> QuerySet[Any]: ... def get_prefetch_queryset( - self, instances: List[Model], queryset: Optional[QuerySet] = ... - ) -> Tuple[QuerySet, Callable, Callable, bool, str, bool]: ... + self, instances: List[Model], queryset: Optional[QuerySet[Any]] = ... + ) -> Tuple[ + QuerySet[Any], Callable[..., Any], Callable[..., Any], bool, str, bool + ]: ... def __get__( self, instance: Optional[Model], cls: Type[Model] = ... ) -> Union[Model, ReverseOneToOneDescriptor]: ... def __set__(self, instance: Model, value: Optional[Model]) -> None: ... - def __reduce__(self) -> Tuple[Callable, Tuple[Type[Model], str]]: ... + def __reduce__(self) -> Tuple[Callable[..., Any], Tuple[Type[Model], str]]: ... class ReverseManyToOneDescriptor: rel: FieldCacheMixin = ... field: FieldCacheMixin = ... def __init__(self, rel: FieldCacheMixin) -> None: ... - def related_manager_cls(self): ... + def related_manager_cls(self) -> Any: ... def __get__( self, instance: Optional[Model], cls: Type[Model] = ... ) -> ReverseManyToOneDescriptor: ... def __set__(self, instance: Model, value: List[Model]) -> Any: ... -def create_reverse_many_to_one_manager(superclass: Any, rel: Any): ... +def create_reverse_many_to_one_manager(superclass: Any, rel: Any) -> Any: ... class ManyToManyDescriptor(ReverseManyToOneDescriptor): - field: RelatedField + field: RelatedField[Any, Any] rel: ManyToManyRel reverse: bool = ... def __init__(self, rel: ManyToManyRel, reverse: bool = ...) -> None: ... @property def through(self) -> Type[Model]: ... - def related_manager_cls(self): ... + def related_manager_cls(self) -> Any: ... class _ForwardManyToManyManager(Generic[_T]): - def all(self) -> QuerySet: ... + def all(self) -> QuerySet[Any]: ... def create_forward_many_to_many_manager( superclass: Any, rel: Any, reverse: Any -) -> _ForwardManyToManyManager: ... +) -> _ForwardManyToManyManager[Any]: ... diff --git a/django-stubs/db/models/fields/related_lookups.pyi b/django-stubs/db/models/fields/related_lookups.pyi index f1096238e..cc1dd69e4 100644 --- a/django-stubs/db/models/fields/related_lookups.pyi +++ b/django-stubs/db/models/fields/related_lookups.pyi @@ -16,20 +16,20 @@ from django.db.models.lookups import ( class MultiColSource: alias: str - field: Field - sources: Tuple[Field, Field] - targets: Tuple[Field, Field] + field: Field[Any, Any] + sources: Tuple[Field[Any, Any], Field[Any, Any]] + targets: Tuple[Field[Any, Any], Field[Any, Any]] contains_aggregate: bool = ... - output_field: Field = ... + output_field: Field[Any, Any] = ... def __init__( self, alias: str, - targets: Tuple[Field, Field], - sources: Tuple[Field, Field], - field: Field, + targets: Tuple[Field[Any, Any], Field[Any, Any]], + sources: Tuple[Field[Any, Any], Field[Any, Any]], + field: Field[Any, Any], ) -> None: ... - def relabeled_clone(self, relabels: OrderedDict) -> MultiColSource: ... - def get_lookup(self, lookup: str) -> Type[BuiltinLookup]: ... + def relabeled_clone(self, relabels: OrderedDict[Any, Any]) -> MultiColSource: ... + def get_lookup(self, lookup: str) -> Type[BuiltinLookup[Any]]: ... def get_normalized_value(value: Any, lhs: Expression) -> Tuple[None]: ... @@ -44,8 +44,8 @@ class RelatedLookupMixin: def get_prep_lookup(self) -> Any: ... class RelatedExact(RelatedLookupMixin, Exact): ... -class RelatedLessThan(RelatedLookupMixin, LessThan): ... +class RelatedLessThan(RelatedLookupMixin, LessThan[Any]): ... class RelatedGreaterThan(RelatedLookupMixin, GreaterThan): ... -class RelatedGreaterThanOrEqual(RelatedLookupMixin, GreaterThanOrEqual): ... +class RelatedGreaterThanOrEqual(RelatedLookupMixin, GreaterThanOrEqual[Any]): ... class RelatedLessThanOrEqual(RelatedLookupMixin, LessThanOrEqual): ... class RelatedIsNull(RelatedLookupMixin, IsNull): ... diff --git a/django-stubs/db/models/fields/reverse_related.pyi b/django-stubs/db/models/fields/reverse_related.pyi index adee3afce..45bb5a155 100644 --- a/django-stubs/db/models/fields/reverse_related.pyi +++ b/django-stubs/db/models/fields/reverse_related.pyi @@ -20,43 +20,43 @@ class ForeignObjectRel(FieldCacheMixin): is_relation: bool = ... related_model: Type[Model] null: bool = ... - field: RelatedField = ... + field: RelatedField[Any, Any] = ... model: Union[Type[Model], str] = ... related_name: Optional[str] = ... related_query_name: Optional[str] = ... limit_choices_to: Optional[Union[Dict[str, Any], Callable[[], Any]]] = ... parent_link: bool = ... - on_delete: Callable = ... + on_delete: Callable[..., Any] = ... symmetrical: bool = ... multiple: bool = ... field_name: Optional[str] = ... def __init__( self, - field: RelatedField, + field: RelatedField[Any, Any], to: Union[Type[Model], str], related_name: Optional[str] = ..., related_query_name: Optional[str] = ..., limit_choices_to: Optional[Union[Dict[str, Any], Callable[[], Any]]] = ..., parent_link: bool = ..., - on_delete: Optional[Callable] = ..., + on_delete: Optional[Callable[..., Any]] = ..., ) -> None: ... @property def hidden(self) -> bool: ... @property def name(self) -> str: ... @property - def remote_field(self) -> RelatedField: ... + def remote_field(self) -> RelatedField[Any, Any]: ... @property def target_field(self) -> AutoField: ... - def get_lookup(self, lookup_name: str) -> Type[BuiltinLookup]: ... + def get_lookup(self, lookup_name: str) -> Type[BuiltinLookup[Any]]: ... def get_internal_type(self) -> str: ... @property - def db_type(self) -> Callable: ... + def db_type(self) -> Callable[..., Any]: ... def get_choices( self, include_blank: bool = ..., blank_choice: List[Tuple[str, str]] = ... ) -> List[Tuple[int, str]]: ... def is_hidden(self) -> bool: ... - def get_joining_columns(self) -> Tuple: ... + def get_joining_columns(self) -> Tuple[Any, ...]: ... def get_extra_restriction( self, where_class: Type[WhereNode], alias: str, related_alias: str ) -> Optional[Union[StartsWith, WhereNode]]: ... @@ -71,28 +71,28 @@ class ForeignObjectRel(FieldCacheMixin): class ManyToOneRel(ForeignObjectRel): def __init__( self, - field: ForeignKey, + field: ForeignKey[Any], to: Union[Type[Model], str], field_name: Optional[str], related_name: Optional[str] = ..., related_query_name: Optional[str] = ..., limit_choices_to: Optional[Union[Dict[str, Any], Callable[[], Any]]] = ..., parent_link: bool = ..., - on_delete: Callable = ..., + on_delete: Callable[..., Any] = ..., ) -> None: ... - def get_related_field(self) -> Field: ... + def get_related_field(self) -> Field[Any, Any]: ... class OneToOneRel(ManyToOneRel): def __init__( self, - field: OneToOneField, + field: OneToOneField[Any], to: Union[Type[Model], str], field_name: Optional[str], related_name: Optional[str] = ..., related_query_name: Optional[str] = ..., limit_choices_to: Optional[Dict[str, str]] = ..., parent_link: bool = ..., - on_delete: Callable = ..., + on_delete: Callable[..., Any] = ..., ) -> None: ... class ManyToManyRel(ForeignObjectRel): @@ -101,7 +101,7 @@ class ManyToManyRel(ForeignObjectRel): db_constraint: bool = ... def __init__( self, - field: RelatedField, + field: RelatedField[Any, Any], to: Union[Type[Model], str], related_name: Optional[str] = ..., related_query_name: Optional[str] = ..., @@ -111,4 +111,4 @@ class ManyToManyRel(ForeignObjectRel): through_fields: Optional[Tuple[str, str]] = ..., db_constraint: bool = ..., ) -> None: ... - def get_related_field(self) -> Field: ... + def get_related_field(self) -> Field[Any, Any]: ... diff --git a/django-stubs/db/models/functions/comparison.pyi b/django-stubs/db/models/functions/comparison.pyi index e2a61aaeb..a2ede67eb 100644 --- a/django-stubs/db/models/functions/comparison.pyi +++ b/django-stubs/db/models/functions/comparison.pyi @@ -4,7 +4,9 @@ from django.db.models import Func from django.db.models.fields import Field class Cast(Func): - def __init__(self, expression: Any, output_field: Union[str, Field]) -> None: ... + def __init__( + self, expression: Any, output_field: Union[str, Field[Any, Any]] + ) -> None: ... class Coalesce(Func): ... class Greatest(Func): ... diff --git a/django-stubs/db/models/lookups.pyi b/django-stubs/db/models/lookups.pyi index f9fec9b74..68f0252ec 100644 --- a/django-stubs/db/models/lookups.pyi +++ b/django-stubs/db/models/lookups.pyi @@ -31,7 +31,7 @@ class Lookup(Generic[_T]): bilateral_transforms: List[Type[Transform]] = ... def __init__( self, - lhs: Union[Expression, TextField, related_lookups.MultiColSource], + lhs: Union[Expression, TextField[Any], related_lookups.MultiColSource], rhs: Any, ) -> None: ... def apply_bilateral_transforms(self, value: Expression) -> Transform: ... @@ -39,7 +39,7 @@ class Lookup(Generic[_T]): self, compiler: SQLCompiler, connection: DatabaseWrapper, - rhs: Optional[OrderedSet] = ..., + rhs: Optional[OrderedSet[Any]] = ..., ) -> Tuple[List[str], List[str]]: ... def get_source_expressions(self) -> List[Expression]: ... def set_source_expressions(self, new_exprs: List[Expression]) -> None: ... @@ -83,16 +83,16 @@ class FieldGetDbPrepValueIterableMixin(FieldGetDbPrepValueMixin): self, compiler: SQLCompiler, connection: DatabaseWrapper, sql: str, param: Any ) -> Any: ... -class PostgresOperatorLookup(FieldGetDbPrepValueMixin, Lookup): +class PostgresOperatorLookup(FieldGetDbPrepValueMixin, Lookup[Any]): postgres_operator: Any = ... - def as_postgresql(self, compiler: Any, connection: Any): ... + def as_postgresql(self, compiler: Any, connection: Any) -> Any: ... -class Exact(FieldGetDbPrepValueMixin, BuiltinLookup): ... -class IExact(BuiltinLookup): ... -class GreaterThan(FieldGetDbPrepValueMixin, BuiltinLookup): ... +class Exact(FieldGetDbPrepValueMixin, BuiltinLookup[Any]): ... +class IExact(BuiltinLookup[Any]): ... +class GreaterThan(FieldGetDbPrepValueMixin, BuiltinLookup[Any]): ... class GreaterThanOrEqual(FieldGetDbPrepValueMixin, BuiltinLookup[_T]): ... class LessThan(FieldGetDbPrepValueMixin, BuiltinLookup[_T]): ... -class LessThanOrEqual(FieldGetDbPrepValueMixin, BuiltinLookup): ... +class LessThanOrEqual(FieldGetDbPrepValueMixin, BuiltinLookup[Any]): ... class IntegerFieldFloatRounding: rhs: Any = ... @@ -103,8 +103,8 @@ class IntegerGreaterThanOrEqual( ): ... class IntegerLessThan(IntegerFieldFloatRounding, LessThan[Union[int, float]]): ... -class In(FieldGetDbPrepValueIterableMixin, BuiltinLookup): - def split_parameter_list_as_sql(self, compiler: Any, connection: Any): ... +class In(FieldGetDbPrepValueIterableMixin, BuiltinLookup[Any]): + def split_parameter_list_as_sql(self, compiler: Any, connection: Any) -> Any: ... class PatternLookup(BuiltinLookup[str]): param_pattern: str = ... @@ -115,12 +115,12 @@ class StartsWith(PatternLookup): ... class IStartsWith(StartsWith): ... class EndsWith(PatternLookup): ... class IEndsWith(EndsWith): ... -class Range(FieldGetDbPrepValueIterableMixin, BuiltinLookup): ... +class Range(FieldGetDbPrepValueIterableMixin, BuiltinLookup[Any]): ... class IsNull(BuiltinLookup[bool]): ... class Regex(BuiltinLookup[str]): ... class IRegex(Regex): ... -class YearLookup(Lookup): +class YearLookup(Lookup[Any]): def year_lookup_bounds( self, connection: DatabaseWrapper, year: int ) -> List[str]: ... @@ -137,7 +137,7 @@ class YearLte(YearComparisonLookup): ... class UUIDTextMixin: rhs: Any = ... - def process_rhs(self, qn: Any, connection: Any): ... + def process_rhs(self, qn: Any, connection: Any) -> Any: ... class UUIDIExact(UUIDTextMixin, IExact): ... class UUIDContains(UUIDTextMixin, Contains): ... diff --git a/django-stubs/db/models/manager.pyi b/django-stubs/db/models/manager.pyi index 991caad80..0187d9a21 100644 --- a/django-stubs/db/models/manager.pyi +++ b/django-stubs/db/models/manager.pyi @@ -4,7 +4,7 @@ from django.db.models.base import Model from django.db.models.query import QuerySet _T = TypeVar("_T", bound=Model, covariant=True) -_M = TypeVar("_M", bound="BaseManager") +_M = TypeVar("_M", bound="BaseManager[Any]") class BaseManager(QuerySet[_T]): creation_counter: int = ... @@ -15,11 +15,13 @@ class BaseManager(QuerySet[_T]): db: str _db: Optional[str] def __init__(self) -> None: ... - def deconstruct(self) -> Tuple[bool, str, None, Tuple, Dict[str, int]]: ... + def deconstruct( + self, + ) -> Tuple[bool, str, None, Tuple[Any, ...], Dict[str, int]]: ... def check(self, **kwargs: Any) -> List[Any]: ... @classmethod def from_queryset( - cls, queryset_class: Type[QuerySet], class_name: Optional[str] = ... + cls, queryset_class: Type[QuerySet[Any]], class_name: Optional[str] = ... ) -> Any: ... @classmethod def _get_queryset_methods(cls, queryset_class: type) -> Dict[str, Any]: ... @@ -45,9 +47,11 @@ class RelatedManager(Manager[_T]): def clear(self) -> None: ... class ManagerDescriptor: - manager: Manager = ... - def __init__(self, manager: Manager) -> None: ... - def __get__(self, instance: Optional[Model], cls: Type[Model] = ...) -> Manager: ... + manager: Manager[Any] = ... + def __init__(self, manager: Manager[Any]) -> None: ... + def __get__( + self, instance: Optional[Model], cls: Type[Model] = ... + ) -> Manager[Any]: ... -class EmptyManager(Manager): +class EmptyManager(Manager[Any]): def __init__(self, model: Type[Model]) -> None: ... diff --git a/django-stubs/db/models/options.pyi b/django-stubs/db/models/options.pyi index 45e81fba7..af580f82a 100644 --- a/django-stubs/db/models/options.pyi +++ b/django-stubs/db/models/options.pyi @@ -1,4 +1,3 @@ -import collections from typing import ( Any, Callable, @@ -42,28 +41,28 @@ def make_immutable_fields_list( name: str, data: Union[ Iterator[Any], - List[Union[ArrayField, CIText]], - List[Union[Field, FieldCacheMixin]], + List[Union[ArrayField[Any], CIText]], + List[Union[Field[Any, Any], FieldCacheMixin]], ], -) -> ImmutableList: ... +) -> ImmutableList[Any]: ... _M = TypeVar("_M", bound=Model) class Options(Generic[_M]): - base_manager: Manager - concrete_fields: ImmutableList + base_manager: Manager[Any] + concrete_fields: ImmutableList[Any] constraints: List[BaseConstraint] - default_manager: Manager - fields: ImmutableList - local_concrete_fields: ImmutableList - related_objects: ImmutableList + default_manager: Manager[Any] + fields: ImmutableList[Any] + local_concrete_fields: ImmutableList[Any] + related_objects: ImmutableList[Any] FORWARD_PROPERTIES: Any = ... REVERSE_PROPERTIES: Any = ... default_apps: Any = ... - local_fields: List[Field] = ... + local_fields: List[Field[Any, Any]] = ... local_many_to_many: List[ManyToManyField] = ... private_fields: List[Any] = ... - local_managers: List[Manager] = ... + local_managers: List[Manager[Any]] = ... base_manager_name: Optional[str] = ... default_manager_name: Optional[str] = ... model_name: Optional[str] = ... @@ -72,8 +71,8 @@ class Options(Generic[_M]): db_table: str = ... ordering: Optional[Sequence[str]] = ... indexes: List[Any] = ... - unique_together: Union[List[Any], Tuple] = ... - index_together: Union[List[Any], Tuple] = ... + unique_together: Union[List[Any], Tuple[Any, ...]] = ... + index_together: Union[List[Any], Tuple[Any, ...]] = ... select_on_save: bool = ... default_permissions: Sequence[str] = ... permissions: List[Any] = ... @@ -85,7 +84,7 @@ class Options(Generic[_M]): required_db_features: List[Any] = ... required_db_vendor: None = ... meta: Optional[type] = ... - pk: Optional[Field] = ... + pk: Optional[Field[Any, Any]] = ... auto_field: Optional[AutoField] = ... abstract: bool = ... managed: bool = ... @@ -93,7 +92,7 @@ class Options(Generic[_M]): proxy_for_model: Optional[Type[Model]] = ... concrete_model: Optional[Type[Model]] = ... swappable: None = ... - parents: collections.OrderedDict = ... + parents: Dict[Any, Any] = ... auto_created: bool = ... related_fkey_lookups: List[Any] = ... apps: Apps = ... @@ -110,13 +109,13 @@ class Options(Generic[_M]): @property def app_config(self) -> AppConfig: ... @property - def installed(self): ... + def installed(self) -> Any: ... def contribute_to_class(self, cls: Type[Model], name: str) -> None: ... - def add_manager(self, manager: Manager) -> None: ... + def add_manager(self, manager: Manager[Any]) -> None: ... def add_field( - self, field: Union[GenericForeignKey, Field], private: bool = ... + self, field: Union[GenericForeignKey, Field[Any, Any]], private: bool = ... ) -> None: ... - def setup_pk(self, field: Field) -> None: ... + def setup_pk(self, field: Field[Any, Any]) -> None: ... def setup_proxy(self, target: Type[Model]) -> None: ... def can_migrate(self, connection: Union[DatabaseWrapper, str]) -> bool: ... @property @@ -126,19 +125,23 @@ class Options(Generic[_M]): @property def many_to_many(self) -> List[ManyToManyField]: ... @property - def fields_map(self) -> Dict[str, Union[Field, ForeignObjectRel]]: ... + def fields_map(self) -> Dict[str, Union[Field[Any, Any], ForeignObjectRel]]: ... @property - def managers(self) -> List[Manager]: ... + def managers(self) -> List[Manager[Any]]: ... @property - def managers_map(self) -> Dict[str, Manager]: ... + def managers_map(self) -> Dict[str, Manager[Any]]: ... @property - def db_returning_fields(self) -> List[Field]: ... - def get_field(self, field_name: Union[Callable, str]) -> Field: ... + def db_returning_fields(self) -> List[Field[Any, Any]]: ... + def get_field( + self, field_name: Union[Callable[..., Any], str] + ) -> Field[Any, Any]: ... def get_base_chain(self, model: Type[Model]) -> List[Type[Model]]: ... def get_parent_list(self) -> List[Type[Model]]: ... - def get_ancestor_link(self, ancestor: Type[Model]) -> Optional[OneToOneField]: ... + def get_ancestor_link( + self, ancestor: Type[Model] + ) -> Optional[OneToOneField[Any]]: ... def get_path_to_parent(self, parent: Type[Model]) -> List[PathInfo]: ... def get_path_from_parent(self, parent: Type[Model]) -> List[PathInfo]: ... def get_fields( self, include_parents: bool = ..., include_hidden: bool = ... - ) -> List[Union[Field, ForeignObjectRel]]: ... + ) -> List[Union[Field[Any, Any], ForeignObjectRel]]: ... diff --git a/django-stubs/db/models/query.pyi b/django-stubs/db/models/query.pyi index 21f490e36..937a2d017 100644 --- a/django-stubs/db/models/query.pyi +++ b/django-stubs/db/models/query.pyi @@ -28,7 +28,7 @@ from django.db.models.query_utils import Q as Q # noqa: F401 from django.db.models.sql.query import Query, RawQuery _T = TypeVar("_T", bound=models.Model, covariant=True) -_QS = TypeVar("_QS", bound="_BaseQuerySet") +_QS = TypeVar("_QS", bound="_BaseQuerySet[Any]") class _BaseQuerySet(Generic[_T], Sized): model: Type[_T] @@ -44,7 +44,7 @@ class _BaseQuerySet(Generic[_T], Sized): def as_manager(cls) -> Manager[Any]: ... def __len__(self) -> int: ... def __bool__(self) -> bool: ... - def __class_getitem__(cls, item: Type[_T]): ... + def __class_getitem__(cls, item: Type[_T]) -> Any: ... def __getstate__(self) -> Dict[str, Any]: ... # Technically, the other QuerySet must be of the same type _T, but _T is covariant def __and__(self: _QS, other: _BaseQuerySet[_T]) -> _QS: ... @@ -85,7 +85,7 @@ class _BaseQuerySet(Generic[_T], Sized): params: Any = ..., translations: Optional[Dict[str, str]] = ..., using: Optional[str] = ..., - ) -> RawQuerySet: ... + ) -> RawQuerySet[Any]: ... # The type of values may be overridden to be more specific in the mypy plugin, depending on the fields param def values( self, *fields: Union[str, Combinable], **expressions: Any @@ -155,7 +155,10 @@ _Row = TypeVar("_Row", covariant=True) class BaseIterable(Sequence[_Row]): def __init__( - self, queryset: _BaseQuerySet, chunked_fetch: bool = ..., chunk_size: int = ... + self, + queryset: _BaseQuerySet[Any], + chunked_fetch: bool = ..., + chunk_size: int = ..., ): ... def __iter__(self) -> Iterator[_Row]: ... def __contains__(self, x: object) -> bool: ... @@ -167,16 +170,16 @@ class BaseIterable(Sequence[_Row]): class ModelIterable(BaseIterable[Model]): ... class ValuesIterable(BaseIterable[Dict[str, Any]]): ... -class ValuesListIterable(BaseIterable[Tuple]): ... +class ValuesListIterable(BaseIterable[Tuple[Any, ...]]): ... class NamedValuesListIterable(ValuesListIterable): ... -class FlatValuesListIterable(BaseIterable): +class FlatValuesListIterable(BaseIterable[Any]): def __iter__(self) -> Iterator[Any]: ... class ValuesQuerySet(_BaseQuerySet[_T], Collection[_Row], Sized): def __contains__(self, x: object) -> bool: ... - def __iter__(self) -> Iterator[_Row]: ... # type: ignore - @overload # type: ignore + def __iter__(self) -> Iterator[_Row]: ... + @overload def __getitem__(self, i: int) -> _Row: ... @overload def __getitem__(self: _QS, s: slice) -> _QS: ... @@ -225,14 +228,14 @@ class Prefetch(object): def __init__( self, lookup: str, - queryset: Optional[QuerySet] = ..., + queryset: Optional[QuerySet[Any]] = ..., to_attr: Optional[str] = ..., ) -> None: ... def __getstate__(self) -> Dict[str, Any]: ... def add_prefix(self, prefix: str) -> None: ... def get_current_prefetch_to(self, level: int) -> str: ... def get_current_to_attr(self, level: int) -> Tuple[str, str]: ... - def get_current_queryset(self, level) -> Optional[QuerySet]: ... + def get_current_queryset(self, level: int) -> Optional[QuerySet[Any]]: ... def prefetch_related_objects( model_instances: Iterable[_T], *related_lookups: Union[str, Prefetch] diff --git a/django-stubs/db/models/query_utils.pyi b/django-stubs/db/models/query_utils.pyi index 6eaa2521a..74dddbf82 100644 --- a/django-stubs/db/models/query_utils.pyi +++ b/django-stubs/db/models/query_utils.pyi @@ -54,11 +54,11 @@ class Q(tree.Node): summarize: bool = ..., for_save: bool = ..., ) -> WhereNode: ... - def deconstruct(self) -> Tuple[str, Tuple, Dict[str, str]]: ... + def deconstruct(self) -> Tuple[str, Tuple[Any, ...], Dict[str, str]]: ... class DeferredAttribute: field_name: str = ... - field: Field + field: Field[Any, Any] def __init__(self, field_name: str) -> None: ... class RegisterLookupMixin: @@ -74,10 +74,12 @@ class RegisterLookupMixin: cls, lookup: Any, lookup_name: Optional[str] = ... ) -> Type[Any]: ... @classmethod - def _unregister_lookup(cls, lookup: Any, lookup_name: Optional[str] = ...): ... + def _unregister_lookup( + cls, lookup: Any, lookup_name: Optional[str] = ... + ) -> Any: ... def select_related_descend( - field: Field, + field: Field[Any, Any], restricted: bool, requested: Optional[Mapping[str, Any]], load_fields: Optional[Collection[str]], diff --git a/django-stubs/db/models/signals.pyi b/django-stubs/db/models/signals.pyi index bd8da952c..35a83b86f 100644 --- a/django-stubs/db/models/signals.pyi +++ b/django-stubs/db/models/signals.pyi @@ -9,7 +9,7 @@ class_prepared: Any class ModelSignal(Signal): def connect( # type: ignore self, - receiver: Callable, + receiver: Callable[..., Any], sender: Optional[Union[Type[Model], str]] = ..., weak: bool = ..., dispatch_uid: None = ..., @@ -17,7 +17,7 @@ class ModelSignal(Signal): ) -> None: ... def disconnect( # type: ignore self, - receiver: Callable = ..., + receiver: Callable[..., Any] = ..., sender: Optional[Union[Type[Model], str]] = ..., dispatch_uid: None = ..., apps: Optional[Apps] = ..., diff --git a/django-stubs/db/models/sql/compiler.pyi b/django-stubs/db/models/sql/compiler.pyi index ed3e091fa..12fcccf08 100644 --- a/django-stubs/db/models/sql/compiler.pyi +++ b/django-stubs/db/models/sql/compiler.pyi @@ -49,7 +49,9 @@ class SQLCompiler: order_by: List[Tuple[Expression, Tuple[str, List[Union[int, str]], bool]]], ) -> List[Tuple[str, List[float]]]: ... def collapse_group_by( - self, expressions: List[Expression], having: Union[List[Expression], Tuple] + self, + expressions: List[Expression], + having: Union[List[Expression], Tuple[Any, ...]], ) -> List[Expression]: ... def get_select( self, @@ -101,13 +103,15 @@ class SQLCompiler: ] = ..., restricted: Optional[bool] = ..., ) -> List[Dict[str, Any]]: ... - def get_select_for_update_of_arguments(self): ... + def get_select_for_update_of_arguments(self) -> Any: ... def deferred_to_columns(self) -> Dict[Type[Model], Set[str]]: ... def get_converters( self, expressions: List[Expression] - ) -> Dict[int, Tuple[List[Callable], Expression]]: ... + ) -> Dict[int, Tuple[List[Callable[..., Any]], Expression]]: ... def apply_converters( - self, rows: chain, converters: Dict[int, Tuple[List[Callable], Expression]] + self, + rows: chain[Any], + converters: Dict[int, Tuple[List[Callable[..., Any]], Expression]], ) -> Iterator[ Union[ List[Optional[Union[bytes, datetime, int, str]]], @@ -130,28 +134,28 @@ class SQLCompiler: ) -> Optional[Any]: ... def as_subquery_condition( self, alias: str, columns: List[str], compiler: SQLCompiler - ) -> Tuple[str, Tuple]: ... + ) -> Tuple[str, Tuple[Any, ...]]: ... def explain_query(self) -> Iterator[str]: ... class SQLInsertCompiler(SQLCompiler): returning_fields: Any = ... returning_params: Any = ... - def field_as_sql(self, field: Any, val: Any): ... - def prepare_value(self, field: Any, value: Any): ... - def pre_save_val(self, field: Any, obj: Any): ... - def assemble_as_sql(self, fields: Any, value_rows: Any): ... - def as_sql(self): ... + def field_as_sql(self, field: Any, val: Any) -> Any: ... + def prepare_value(self, field: Any, value: Any) -> Any: ... + def pre_save_val(self, field: Any, obj: Any) -> Any: ... + def assemble_as_sql(self, fields: Any, value_rows: Any) -> Any: ... + def as_sql(self) -> Any: ... # type: ignore [override] class SQLDeleteCompiler(SQLCompiler): - def single_alias(self): ... - def as_sql(self): ... + def single_alias(self) -> Any: ... + def as_sql(self) -> Any: ... # type: ignore [override] class SQLUpdateCompiler(SQLCompiler): - def as_sql(self): ... + def as_sql(self) -> Any: ... # type: ignore [override] class SQLAggregateCompiler(SQLCompiler): col_count: Any = ... - def as_sql(self): ... + def as_sql(self) -> Any: ... # type: ignore [override] def cursor_iter( cursor: Any, sentinel: Any, col_count: Optional[int], itersize: int diff --git a/django-stubs/db/models/sql/constants.pyi b/django-stubs/db/models/sql/constants.pyi index 70be2be6b..d2f820f26 100644 --- a/django-stubs/db/models/sql/constants.pyi +++ b/django-stubs/db/models/sql/constants.pyi @@ -7,7 +7,7 @@ SINGLE: str = ... CURSOR: str = ... NO_RESULTS: str = ... -ORDER_PATTERN: Pattern = ... +ORDER_PATTERN: Pattern[str] = ... ORDER_DIR: Dict[str, Tuple[str, str]] = ... INNER: str = ... diff --git a/django-stubs/db/models/sql/datastructures.pyi b/django-stubs/db/models/sql/datastructures.pyi index a53403e3e..470e3620a 100644 --- a/django-stubs/db/models/sql/datastructures.pyi +++ b/django-stubs/db/models/sql/datastructures.pyi @@ -19,7 +19,7 @@ class Join: parent_alias: str = ... table_alias: Optional[str] = ... join_type: str = ... - join_cols: Tuple = ... + join_cols: Tuple[Any, ...] = ... join_field: FieldCacheMixin = ... nullable: bool = ... filtered_relation: Optional[FilteredRelation] = ... @@ -37,7 +37,7 @@ class Join: self, compiler: SQLCompiler, connection: Any ) -> Tuple[str, List[Union[int, str]]]: ... def relabeled_clone( - self, change_map: Union[Dict[str, str], OrderedDict] + self, change_map: Union[Dict[str, str], OrderedDict[Any, Any]] ) -> Join: ... def equals( self, other: Union[BaseTable, Join], with_filtered_relation: bool @@ -55,5 +55,5 @@ class BaseTable: def as_sql( self, compiler: SQLCompiler, connection: Any ) -> Tuple[str, List[Any]]: ... - def relabeled_clone(self, change_map: OrderedDict) -> BaseTable: ... + def relabeled_clone(self, change_map: OrderedDict[Any, Any]) -> BaseTable: ... def equals(self, other: Join, with_filtered_relation: bool) -> bool: ... diff --git a/django-stubs/db/models/sql/query.pyi b/django-stubs/db/models/sql/query.pyi index dfa5c19eb..cfe5446a8 100644 --- a/django-stubs/db/models/sql/query.pyi +++ b/django-stubs/db/models/sql/query.pyi @@ -1,9 +1,10 @@ -import collections from collections import OrderedDict, namedtuple from typing import ( Any, Callable, + Counter, Dict, + FrozenSet, Iterable, Iterator, List, @@ -41,15 +42,17 @@ class RawQuery: def chain(self, using: str) -> RawQuery: ... def clone(self, using: str) -> RawQuery: ... def get_columns(self) -> List[str]: ... - def __iter__(self): ... + def __iter__(self) -> Any: ... class Query: base_table: str related_ids: Optional[List[int]] - related_updates: Dict[Type[Model], List[Tuple[Field, None, Union[int, str]]]] + related_updates: Dict[ + Type[Model], List[Tuple[Field[Any, Any], None, Union[int, str]]] + ] values: List[Any] alias_prefix: str = ... - subq_aliases: frozenset = ... + subq_aliases: FrozenSet[Any] = ... compiler: str = ... model: Optional[Type[Model]] = ... alias_refcount: Dict[str, int] = ... @@ -63,24 +66,24 @@ class Query: filter_is_sticky: bool = ... subquery: bool = ... group_by: Optional[Union[Sequence[Combinable], Sequence[str], bool]] = ... - order_by: Tuple = ... + order_by: Tuple[Any, ...] = ... distinct: bool = ... - distinct_fields: Tuple = ... + distinct_fields: Tuple[Any, ...] = ... select_for_update: bool = ... select_for_update_nowait: bool = ... select_for_update_skip_locked: bool = ... - select_for_update_of: Tuple = ... + select_for_update_of: Tuple[Any, ...] = ... select_related: Union[Dict[str, Any], bool] = ... max_depth: int = ... - values_select: Tuple = ... + values_select: Tuple[Any, ...] = ... annotation_select_mask: Optional[Set[str]] = ... combinator: Optional[str] = ... combinator_all: bool = ... - combined_queries: Tuple = ... + combined_queries: Tuple[Any, ...] = ... extra_select_mask: Optional[Set[str]] = ... - extra_tables: Tuple = ... - extra_order_by: Union[List[str], Tuple] = ... - deferred_loading: Tuple[Union[Set[str], frozenset], bool] = ... + extra_tables: Tuple[Any, ...] = ... + extra_order_by: Union[List[str], Tuple[Any, ...]] = ... + deferred_loading: Tuple[Union[Set[str], FrozenSet[Any]], bool] = ... explain_query: bool = ... explain_format: Optional[str] = ... explain_options: Dict[str, int] = ... @@ -90,12 +93,12 @@ class Query: self, model: Optional[Type[Model]], where: Type[WhereNode] = ... ) -> None: ... @property - def extra(self) -> OrderedDict: ... + def extra(self) -> OrderedDict[Any, Any]: ... @property - def annotations(self) -> OrderedDict: ... + def annotations(self) -> OrderedDict[Any, Any]: ... @property def has_select_fields(self) -> bool: ... - def sql_with_params(self) -> Tuple[str, Tuple]: ... + def sql_with_params(self) -> Tuple[str, Tuple[Any, ...]]: ... def __deepcopy__(self, memo: Dict[str, Any]) -> Query: ... def get_compiler( self, using: Optional[str] = ..., connection: Any = ... @@ -103,7 +106,7 @@ class Query: def clone(self) -> Query: ... def chain(self, klass: Optional[Type[Query]] = ...) -> Query: ... def relabeled_clone( - self, change_map: Union[Dict[Any, Any], OrderedDict] + self, change_map: Union[Dict[Any, Any], OrderedDict[Any, Any]] ) -> Query: ... def get_count(self, using: str) -> int: ... def has_filters(self) -> WhereNode: ... @@ -112,14 +115,16 @@ class Query: self, using: str, format: Optional[str] = ..., **options: Any ) -> str: ... def combine(self, rhs: Query, connector: str) -> None: ... - def deferred_to_data(self, target: Dict[Any, Any], callback: Callable) -> None: ... + def deferred_to_data( + self, target: Dict[Any, Any], callback: Callable[..., Any] + ) -> None: ... def ref_alias(self, alias: str) -> None: ... def unref_alias(self, alias: str, amount: int = ...) -> None: ... def promote_joins(self, aliases: Set[str]) -> None: ... def demote_joins(self, aliases: Set[str]) -> None: ... def reset_refcounts(self, to_counts: Dict[str, int]) -> None: ... def change_aliases( - self, change_map: Union[Dict[Any, Any], OrderedDict] + self, change_map: Union[Dict[Any, Any], OrderedDict[Any, Any]] ) -> None: ... def bump_prefix(self, outer_query: Query) -> None: ... def get_initial_alias(self) -> str: ... @@ -167,8 +172,8 @@ class Query: reuse_with_filtered_relation: bool = ..., ) -> JoinInfo: ... def trim_joins( - self, targets: Tuple[Field], joins: List[str], path: List[PathInfo] - ) -> Tuple[Tuple[Field], str, List[str]]: ... + self, targets: Tuple[Field[Any, Any]], joins: List[str], path: List[PathInfo] + ) -> Tuple[Tuple[Field[Any, Any]], str, List[str]]: ... def resolve_ref( self, name: str, @@ -178,10 +183,10 @@ class Query: ) -> Expression: ... def split_exclude( self, - filter_expr: Tuple[str, Union[QuerySet, int]], + filter_expr: Tuple[str, Union[QuerySet[Any], int]], can_reuse: Set[str], names_with_path: List[Tuple[str, List[PathInfo]]], - ) -> Tuple[WhereNode, Tuple]: ... + ) -> Tuple[WhereNode, Tuple[Any, ...]]: ... def set_empty(self) -> None: ... def is_empty(self) -> bool: ... def set_limits( @@ -218,24 +223,24 @@ class Query: self, target: Dict[Type[Model], Set[str]], model: Type[Model], - fields: Set[Field], + fields: Set[Field[Any, Any]], ) -> None: ... def set_annotation_mask( - self, names: Optional[Union[List[str], Set[str], Tuple]] + self, names: Optional[Union[List[str], Set[str], Tuple[Any, ...]]] ) -> None: ... def append_annotation_mask(self, names: List[str]) -> None: ... - def set_extra_mask(self, names: Union[List[str], Tuple]) -> None: ... - def set_values(self, fields: Union[List[str], Tuple]) -> None: ... + def set_extra_mask(self, names: Union[List[str], Tuple[Any, ...]]) -> None: ... + def set_values(self, fields: Union[List[str], Tuple[Any, ...]]) -> None: ... def trim_start( self, names_with_path: List[Tuple[str, List[PathInfo]]] ) -> Tuple[str, bool]: ... - def is_nullable(self, field: Field) -> bool: ... + def is_nullable(self, field: Field[Any, Any]) -> bool: ... def build_lookup( self, lookups: Sequence[str], lhs: Union[RegisterLookupMixin, Query], rhs: Optional[Query], - ) -> Lookup: ... + ) -> Lookup[Any]: ... def try_transform( self, lhs: Union[RegisterLookupMixin, Query], name: str ) -> Transform: ... @@ -245,9 +250,9 @@ class JoinPromoter: negated: bool = ... effective_connector: str = ... num_children: int = ... - votes: collections.Counter = ... + votes: Counter[Any] = ... def __init__(self, connector: str, num_children: int, negated: bool) -> None: ... def add_votes( - self, votes: Union[Iterator[Any], List[Any], Set[str], Tuple] + self, votes: Union[Iterator[Any], List[Any], Set[str], Tuple[Any, ...]] ) -> None: ... def update_join_types(self, query: Query) -> Set[str]: ... diff --git a/django-stubs/db/models/sql/subqueries.pyi b/django-stubs/db/models/sql/subqueries.pyi index 2edbdce26..c66b81c45 100644 --- a/django-stubs/db/models/sql/subqueries.pyi +++ b/django-stubs/db/models/sql/subqueries.pyi @@ -8,15 +8,15 @@ from django.db.models.sql.query import Query from django.db.models.sql.where import WhereNode class DeleteQuery(Query): - select: Tuple + select: Tuple[Any, ...] where_class: Type[WhereNode] where: WhereNode = ... def do_query(self, table: str, where: WhereNode, using: str) -> int: ... def delete_batch(self, pk_list: Union[List[int], List[str]], using: str) -> int: ... - def delete_qs(self, query: QuerySet, using: str) -> int: ... + def delete_qs(self, query: QuerySet[Any], using: str) -> int: ... class UpdateQuery(Query): - select: Tuple + select: Tuple[Any, ...] where_class: Type[WhereNode] def __init__(self, *args: Any, **kwargs: Any) -> None: ... where: WhereNode = ... @@ -25,28 +25,28 @@ class UpdateQuery(Query): ) -> None: ... def add_update_values(self, values: Dict[str, Any]) -> None: ... def add_update_fields( - self, values_seq: List[Tuple[Field, Optional[Type[Model]], Case]] + self, values_seq: List[Tuple[Field[Any, Any], Optional[Type[Model]], Case]] ) -> None: ... def add_related_update( - self, model: Type[Model], field: Field, value: Union[int, str] + self, model: Type[Model], field: Field[Any, Any], value: Union[int, str] ) -> None: ... def get_related_updates(self) -> List[UpdateQuery]: ... class InsertQuery(Query): - select: Tuple + select: Tuple[Any, ...] where: WhereNode where_class: Type[WhereNode] - fields: Iterable[Field] = ... + fields: Iterable[Field[Any, Any]] = ... objs: List[Model] = ... raw: bool = ... def __init__(self, *args: Any, **kwargs: Any) -> None: ... def insert_values( - self, fields: Iterable[Field], objs: List[Model], raw: bool = ... + self, fields: Iterable[Field[Any, Any]], objs: List[Model], raw: bool = ... ) -> None: ... class AggregateQuery(Query): - select: Tuple - sub_params: Tuple + select: Tuple[Any, ...] + sub_params: Tuple[Any, ...] where: WhereNode where_class: Type[WhereNode] def add_subquery(self, query: Query, using: str) -> None: ... diff --git a/django-stubs/db/models/sql/where.pyi b/django-stubs/db/models/sql/where.pyi index d76845306..448864d37 100644 --- a/django-stubs/db/models/sql/where.pyi +++ b/django-stubs/db/models/sql/where.pyi @@ -23,11 +23,11 @@ class WhereNode(tree.Node): def as_sql(self, compiler: SQLCompiler, connection: Any) -> Any: ... def get_group_by_cols(self) -> List[Expression]: ... def relabel_aliases( - self, change_map: Union[Dict[Optional[str], str], OrderedDict] + self, change_map: Union[Dict[Optional[str], str], OrderedDict[Any, Any]] ) -> None: ... def clone(self) -> WhereNode: ... def relabeled_clone( - self, change_map: Union[Dict[Optional[str], str], OrderedDict] + self, change_map: Union[Dict[Optional[str], str], OrderedDict[Any, Any]] ) -> WhereNode: ... def resolve_expression(self, *args: Any, **kwargs: Any) -> WhereNode: ... @@ -55,4 +55,6 @@ class SubqueryConstraint: def __init__( self, alias: str, columns: List[str], targets: List[str], query_object: Query ) -> None: ... - def as_sql(self, compiler: SQLCompiler, connection: Any) -> Tuple[str, Tuple]: ... + def as_sql( + self, compiler: SQLCompiler, connection: Any + ) -> Tuple[str, Tuple[Any, ...]]: ... diff --git a/django-stubs/db/transaction.pyi b/django-stubs/db/transaction.pyi index 28d4f65b6..3cf1f6f99 100644 --- a/django-stubs/db/transaction.pyi +++ b/django-stubs/db/transaction.pyi @@ -18,9 +18,9 @@ def get_rollback(using: Optional[str] = ...) -> bool: ... def set_rollback(rollback: bool, using: Optional[str] = ...) -> None: ... @contextmanager def mark_for_rollback_on_error(using: Optional[str] = ...) -> Iterator[None]: ... -def on_commit(func: Callable, using: Optional[str] = ...) -> None: ... +def on_commit(func: Callable[..., Any], using: Optional[str] = ...) -> None: ... -_C = TypeVar("_C", bound=Callable) # Any callable +_C = TypeVar("_C", bound=Callable[..., Any]) # Don't inherit from ContextDecorator, so we can provide a more specific signature for __call__ class Atomic: diff --git a/django-stubs/db/utils.pyi b/django-stubs/db/utils.pyi index 251199ddd..ccb48063d 100644 --- a/django-stubs/db/utils.pyi +++ b/django-stubs/db/utils.pyi @@ -29,7 +29,7 @@ class ConnectionHandler: def __getitem__(self, alias: str) -> DefaultConnectionProxy: ... def __setitem__(self, key: Any, value: Any) -> None: ... def __delitem__(self, key: Any) -> None: ... - def __iter__(self): ... + def __iter__(self) -> Any: ... def all(self) -> List[Any]: ... def close_all(self) -> None: ... diff --git a/django-stubs/dispatch/dispatcher.pyi b/django-stubs/dispatch/dispatcher.pyi index 5acacc93c..e249e27f9 100644 --- a/django-stubs/dispatch/dispatcher.pyi +++ b/django-stubs/dispatch/dispatcher.pyi @@ -14,23 +14,25 @@ class Signal: ) -> None: ... def connect( self, - receiver: Callable, + receiver: Callable[..., Any], sender: Optional[object] = ..., weak: bool = ..., dispatch_uid: Optional[str] = ..., ) -> None: ... def disconnect( self, - receiver: Optional[Callable] = ..., + receiver: Optional[Callable[..., Any]] = ..., sender: Optional[object] = ..., dispatch_uid: Optional[str] = ..., ) -> bool: ... def has_listeners(self, sender: Any = ...) -> bool: ... def send( self, sender: Any, **named: Any - ) -> List[Tuple[Callable, Optional[str]]]: ... + ) -> List[Tuple[Callable[..., Any], Optional[str]]]: ... def send_robust( self, sender: Any, **named: Any - ) -> List[Tuple[Callable, Union[ValueError, str]]]: ... + ) -> List[Tuple[Callable[..., Any], Union[ValueError, str]]]: ... -def receiver(signal: Union[List[Signal], Signal], **kwargs: Any) -> Callable: ... +def receiver( + signal: Union[List[Signal], Signal], **kwargs: Any +) -> Callable[..., Any]: ... diff --git a/django-stubs/forms/boundfield.pyi b/django-stubs/forms/boundfield.pyi index b50a1454e..ff373157b 100644 --- a/django-stubs/forms/boundfield.pyi +++ b/django-stubs/forms/boundfield.pyi @@ -20,7 +20,7 @@ class BoundField: def __init__(self, form: BaseForm, field: Field, name: str) -> None: ... def subwidgets(self) -> List[BoundWidget]: ... def __bool__(self) -> bool: ... - def __iter__(self): ... + def __iter__(self) -> Any: ... def __len__(self) -> int: ... def __getitem__( self, idx: Union[int, slice, str] diff --git a/django-stubs/forms/fields.pyi b/django-stubs/forms/fields.pyi index 60b24e911..7e29dfa88 100644 --- a/django-stubs/forms/fields.pyi +++ b/django-stubs/forms/fields.pyi @@ -167,7 +167,7 @@ class RegexField(CharField): regex: str = ... def __init__( self, - regex: Union[str, Pattern], + regex: Union[str, Pattern[str]], max_length: Optional[Any] = ..., min_length: Optional[Any] = ..., strip: bool = ..., @@ -205,7 +205,7 @@ class FileField(Field): disabled: bool = ..., label_suffix: Optional[Any] = ..., ) -> None: ... - def clean(self, data: Any, initial: Optional[Any] = ...): ... + def clean(self, data: Any, initial: Optional[Any] = ...) -> Any: ... class ImageField(FileField): ... class URLField(CharField): ... @@ -213,8 +213,8 @@ class BooleanField(Field): ... class NullBooleanField(BooleanField): ... class CallableChoiceIterator: - choices_func: Callable = ... - def __init__(self, choices_func: Callable) -> None: ... + choices_func: Callable[..., Any] = ... + def __init__(self, choices_func: Callable[..., Any]) -> None: ... def __iter__(self) -> None: ... class ChoiceField(Field): @@ -236,7 +236,7 @@ class ChoiceField(Field): def valid_value(self, value: str) -> bool: ... class TypedChoiceField(ChoiceField): - coerce: Union[Callable, Type[Any]] = ... + coerce: Union[Callable[..., Any], Type[Any]] = ... empty_value: Optional[str] = ... def __init__( self, @@ -259,7 +259,7 @@ class TypedChoiceField(ChoiceField): class MultipleChoiceField(ChoiceField): ... class TypedMultipleChoiceField(MultipleChoiceField): - coerce: Union[Callable, Type[float]] = ... + coerce: Union[Callable[..., Any], Type[float]] = ... empty_value: Optional[List[Any]] = ... def __init__( self, @@ -416,7 +416,7 @@ class JSONField(CharField): def __init__( self, encoder: Optional[Any] = ..., decoder: Optional[Any] = ..., **kwargs: Any ) -> None: ... - def to_python(self, value: Any): ... - def bound_data(self, data: Any, initial: Any): ... - def prepare_value(self, value: Any): ... - def has_changed(self, initial: Any, data: Any): ... + def to_python(self, value: Any) -> Any: ... + def bound_data(self, data: Any, initial: Any) -> Any: ... + def prepare_value(self, value: Any) -> Any: ... + def has_changed(self, initial: Any, data: Any) -> Any: ... diff --git a/django-stubs/forms/forms.pyi b/django-stubs/forms/forms.pyi index 4eaa8e143..7066e88d6 100644 --- a/django-stubs/forms/forms.pyi +++ b/django-stubs/forms/forms.pyi @@ -59,7 +59,7 @@ class BaseForm: def add_error( self, field: Optional[str], error: Union[ValidationError, str] ) -> None: ... - def has_error(self, field: Any, code: Optional[Any] = ...): ... + def has_error(self, field: Any, code: Optional[Any] = ...) -> Any: ... def full_clean(self) -> None: ... def clean(self) -> Dict[str, Any]: ... def has_changed(self) -> bool: ... @@ -67,9 +67,9 @@ class BaseForm: def changed_data(self) -> List[str]: ... @property def media(self) -> Media: ... - def is_multipart(self): ... - def hidden_fields(self): ... - def visible_fields(self): ... + def is_multipart(self) -> Any: ... + def hidden_fields(self) -> Any: ... + def visible_fields(self) -> Any: ... def get_initial_for_field(self, field: Field, field_name: str) -> Any: ... def _html_output( self, diff --git a/django-stubs/forms/formsets.pyi b/django-stubs/forms/formsets.pyi index dab81a99c..93762c0fa 100644 --- a/django-stubs/forms/formsets.pyi +++ b/django-stubs/forms/formsets.pyi @@ -34,46 +34,46 @@ class BaseFormSet(Sized, Mapping[str, Any]): error_class: Any = ..., form_kwargs: Optional[Any] = ..., ) -> None: ... - def __iter__(self): ... - def __getitem__(self, index: Any): ... - def __len__(self): ... - def __bool__(self): ... - def management_form(self): ... - def total_form_count(self): ... - def initial_form_count(self): ... + def __iter__(self) -> Any: ... + def __getitem__(self, index: Any) -> Any: ... + def __len__(self) -> Any: ... + def __bool__(self) -> Any: ... + def management_form(self) -> Any: ... + def total_form_count(self) -> Any: ... + def initial_form_count(self) -> Any: ... @property - def forms(self): ... - def get_form_kwargs(self, index: Any): ... + def forms(self) -> Any: ... + def get_form_kwargs(self, index: Any) -> Any: ... @property - def initial_forms(self): ... + def initial_forms(self) -> Any: ... @property - def extra_forms(self): ... + def extra_forms(self) -> Any: ... @property - def empty_form(self): ... + def empty_form(self) -> Any: ... @property - def cleaned_data(self): ... + def cleaned_data(self) -> Any: ... @property - def deleted_forms(self): ... + def deleted_forms(self) -> Any: ... @property - def ordered_forms(self): ... + def ordered_forms(self) -> Any: ... @classmethod - def get_default_prefix(cls): ... - def non_form_errors(self): ... + def get_default_prefix(cls) -> Any: ... + def non_form_errors(self) -> Any: ... @property - def errors(self): ... - def total_error_count(self): ... - def is_valid(self): ... - def full_clean(self): ... + def errors(self) -> Any: ... + def total_error_count(self) -> Any: ... + def is_valid(self) -> Any: ... + def full_clean(self) -> Any: ... def clean(self) -> None: ... - def has_changed(self): ... + def has_changed(self) -> Any: ... def add_fields(self, form: Any, index: Any) -> None: ... - def add_prefix(self, index: Any): ... - def is_multipart(self): ... + def add_prefix(self, index: Any) -> Any: ... + def is_multipart(self) -> Any: ... @property - def media(self): ... - def as_table(self): ... - def as_p(self): ... - def as_ul(self): ... + def media(self) -> Any: ... + def as_table(self) -> Any: ... + def as_p(self) -> Any: ... + def as_ul(self) -> Any: ... def formset_factory( form: Any, @@ -85,5 +85,5 @@ def formset_factory( validate_max: bool = ..., min_num: Optional[Any] = ..., validate_min: bool = ..., -): ... +) -> Any: ... def all_valid(formsets: Sequence[Any]) -> bool: ... diff --git a/django-stubs/forms/models.pyi b/django-stubs/forms/models.pyi index e5520c72f..6c31e4a25 100644 --- a/django-stubs/forms/models.pyi +++ b/django-stubs/forms/models.pyi @@ -35,7 +35,7 @@ from typing_extensions import Literal ALL_FIELDS: str -_Fields = Union[List[Union[Callable, str]], Sequence[str], Literal["__all__"]] +_Fields = Union[List[Union[Callable[..., Any], str]], Sequence[str], Literal["__all__"]] _Labels = Dict[str, str] _ErrorMessages = Dict[str, Dict[str, str]] @@ -55,7 +55,7 @@ def fields_for_model( fields: Optional[_Fields] = ..., exclude: Optional[_Fields] = ..., widgets: Optional[Union[Dict[str, Type[Input]], Dict[str, Widget]]] = ..., - formfield_callback: Optional[Union[Callable, str]] = ..., + formfield_callback: Optional[Union[Callable[..., Any], str]] = ..., localized_fields: Optional[Union[Tuple[str], str]] = ..., labels: Optional[_Labels] = ..., help_texts: Optional[Dict[str, str]] = ..., @@ -107,7 +107,9 @@ def modelform_factory( form: Type[ModelForm] = ..., fields: Optional[_Fields] = ..., exclude: Optional[_Fields] = ..., - formfield_callback: Optional[Union[str, Callable[[models.Field], Field]]] = ..., + formfield_callback: Optional[ + Union[str, Callable[[models.Field[Any, Any]], Field]] + ] = ..., widgets: Optional[MutableMapping[str, Widget]] = ..., localized_fields: Optional[Sequence[str]] = ..., labels: Optional[MutableMapping[str, str]] = ..., @@ -132,30 +134,30 @@ class BaseModelFormSet(BaseFormSet): initial: Optional[Any] = ..., **kwargs: Any ) -> None: ... - def initial_form_count(self): ... - def get_queryset(self): ... - def save_new(self, form: Any, commit: bool = ...): ... - def save_existing(self, form: Any, instance: Any, commit: bool = ...): ... + def initial_form_count(self) -> Any: ... + def get_queryset(self) -> Any: ... + def save_new(self, form: Any, commit: bool = ...) -> Any: ... + def save_existing(self, form: Any, instance: Any, commit: bool = ...) -> Any: ... def delete_existing(self, obj: Any, commit: bool = ...) -> None: ... saved_forms: Any = ... save_m2m: Any = ... - def save(self, commit: bool = ...): ... + def save(self, commit: bool = ...) -> Any: ... def clean(self) -> None: ... def validate_unique(self) -> None: ... - def get_unique_error_message(self, unique_check: Any): ... - def get_date_error_message(self, date_check: Any): ... - def get_form_error(self): ... + def get_unique_error_message(self, unique_check: Any) -> Any: ... + def get_date_error_message(self, date_check: Any) -> Any: ... + def get_form_error(self) -> Any: ... changed_objects: Any = ... deleted_objects: Any = ... - def save_existing_objects(self, commit: bool = ...): ... + def save_existing_objects(self, commit: bool = ...) -> Any: ... new_objects: Any = ... - def save_new_objects(self, commit: bool = ...): ... - def add_fields(self, form: Any, index: Any): ... + def save_new_objects(self, commit: bool = ...) -> Any: ... + def add_fields(self, form: Any, index: Any) -> Any: ... def modelformset_factory( model: Type[Model], form: Type[ModelForm] = ..., - formfield_callback: Optional[Callable] = ..., + formfield_callback: Optional[Callable[..., Any]] = ..., formset: Type[BaseModelFormSet] = ..., extra: int = ..., can_delete: bool = ..., @@ -188,12 +190,12 @@ class BaseInlineFormSet(BaseModelFormSet): queryset: Optional[Any] = ..., **kwargs: Any ) -> None: ... - def initial_form_count(self): ... + def initial_form_count(self) -> Any: ... @classmethod - def get_default_prefix(cls): ... - def save_new(self, form: Any, commit: bool = ...): ... + def get_default_prefix(cls) -> Any: ... + def save_new(self, form: Any, commit: bool = ...) -> Any: ... def add_fields(self, form: Any, index: Any) -> None: ... - def get_unique_error_message(self, unique_check: Any): ... + def get_unique_error_message(self, unique_check: Any) -> Any: ... def inlineformset_factory( parent_model: Type[Model], @@ -207,7 +209,7 @@ def inlineformset_factory( can_order: bool = ..., can_delete: bool = ..., max_num: Optional[int] = ..., - formfield_callback: Optional[Callable] = ..., + formfield_callback: Optional[Callable[..., Any]] = ..., widgets: Optional[Dict[str, Any]] = ..., validate_max: bool = ..., localized_fields: Optional[Sequence[str]] = ..., @@ -240,7 +242,7 @@ class InlineForeignKeyField(Field): class ModelChoiceIterator: field: ModelChoiceField = ... - queryset: Optional[QuerySet] = ... + queryset: Optional[QuerySet[Any]] = ... def __init__(self, field: ModelChoiceField) -> None: ... def __iter__(self) -> Iterator[Tuple[Union[int, str], str]]: ... def __len__(self) -> int: ... @@ -262,7 +264,7 @@ class ModelChoiceField(ChoiceField): to_field_name: None = ... def __init__( self, - queryset: Optional[Union[Manager, QuerySet]], + queryset: Optional[Union[Manager[Any], QuerySet[Any]]], *, empty_label: Optional[str] = ..., required: bool = ..., @@ -295,11 +297,11 @@ class ModelMultipleChoiceField(ModelChoiceField): widget: Any = ... hidden_widget: Any = ... default_error_messages: Any = ... - def __init__(self, queryset: _BaseQuerySet, **kwargs: Any) -> None: ... + def __init__(self, queryset: _BaseQuerySet[Any], **kwargs: Any) -> None: ... def _get_foreign_key( parent_model: Type[Model], model: Type[Model], fk_name: Optional[str] = ..., can_fail: bool = ..., -) -> ForeignKey: ... +) -> ForeignKey[Any]: ... diff --git a/django-stubs/forms/utils.pyi b/django-stubs/forms/utils.pyi index 92fc2115e..d32819e3d 100644 --- a/django-stubs/forms/utils.pyi +++ b/django-stubs/forms/utils.pyi @@ -8,14 +8,14 @@ from django.utils.safestring import SafeText def pretty_name(name: str) -> str: ... def flatatt(attrs: Dict[str, Any]) -> SafeText: ... -class ErrorDict(dict): +class ErrorDict(Dict[str, Any]): def as_data(self) -> Dict[str, List[ValidationError]]: ... def get_json_data(self, escape_html: bool = ...) -> Dict[str, Any]: ... def as_json(self, escape_html: bool = ...) -> str: ... def as_ul(self) -> str: ... def as_text(self) -> str: ... -class ErrorList(UserList): +class ErrorList(UserList[Any]): data: List[Union[ValidationError, str]] error_class: str = ... def __init__( diff --git a/django-stubs/forms/widgets.pyi b/django-stubs/forms/widgets.pyi index e5f5415a6..85e45b89b 100644 --- a/django-stubs/forms/widgets.pyi +++ b/django-stubs/forms/widgets.pyi @@ -34,7 +34,7 @@ class Media: ) -> None: ... def render(self) -> str: ... def render_js(self) -> List[str]: ... - def render_css(self) -> chain: ... + def render_css(self) -> chain[Any]: ... def absolute_path(self, path: str) -> str: ... def __getitem__(self, name: str) -> Media: ... @staticmethod @@ -89,7 +89,9 @@ class URLInput(Input): ... class PasswordInput(Input): render_value: bool = ... - def __init__(self, attrs: Optional[_OptAttrs] = ..., render_value: bool = ...): ... + def __init__( + self, attrs: Optional[_OptAttrs] = ..., render_value: bool = ... + ) -> None: ... class HiddenInput(Input): choices: Iterable[Tuple[str, str]] @@ -122,9 +124,11 @@ class DateTimeInput(DateTimeBaseInput): ... class TimeInput(DateTimeBaseInput): ... class CheckboxInput(Input): - check_test: Callable = ... + check_test: Callable[..., Any] = ... def __init__( - self, attrs: Optional[_OptAttrs] = ..., check_test: Optional[Callable] = ... + self, + attrs: Optional[_OptAttrs] = ..., + check_test: Optional[Callable[..., Any]] = ..., ) -> None: ... class ChoiceWidget(Widget): diff --git a/django-stubs/http/multipartparser.pyi b/django-stubs/http/multipartparser.pyi index fbabab0d0..b23072c21 100644 --- a/django-stubs/http/multipartparser.pyi +++ b/django-stubs/http/multipartparser.pyi @@ -12,10 +12,10 @@ class MultiPartParser: self, META: Dict[str, Any], input_data: Union[StringIO, BytesIO], - upload_handlers: Union[List[Any], ImmutableList], + upload_handlers: Union[List[Any], ImmutableList[Any]], encoding: Optional[str] = ..., ) -> None: ... - def parse(self) -> Tuple[QueryDict, MultiValueDict]: ... + def parse(self) -> Tuple[QueryDict, MultiValueDict[Any, Any]]: ... def handle_file_complete( self, old_field_name: str, counters: List[int] ) -> None: ... @@ -27,7 +27,7 @@ class LazyStream: def __init__( self, producer: Union[BoundaryIter, ChunkIter], length: None = ... ) -> None: ... - def tell(self): ... + def tell(self) -> Any: ... def read(self, size: Optional[int] = ...) -> bytes: ... def __next__(self) -> bytes: ... def close(self) -> None: ... @@ -39,7 +39,7 @@ class ChunkIter: chunk_size: int = ... def __init__(self, flo: BytesIO, chunk_size: int = ...) -> None: ... def __next__(self) -> bytes: ... - def __iter__(self): ... + def __iter__(self) -> Any: ... class InterBoundaryIter: def __init__(self, stream: LazyStream, boundary: bytes) -> None: ... @@ -48,7 +48,7 @@ class InterBoundaryIter: class BoundaryIter: def __init__(self, stream: LazyStream, boundary: bytes) -> None: ... - def __iter__(self): ... + def __iter__(self) -> Any: ... def __next__(self) -> bytes: ... class Parser: diff --git a/django-stubs/http/request.pyi b/django-stubs/http/request.pyi index 127a6c4e9..0950561c0 100644 --- a/django-stubs/http/request.pyi +++ b/django-stubs/http/request.pyi @@ -29,7 +29,7 @@ from django.utils.datastructures import ( ) RAISE_ERROR: object = ... -host_validation_re: Pattern = ... +host_validation_re: Pattern[str] = ... class UnreadablePostError(IOError): ... class RawPostDataException(Exception): ... @@ -39,7 +39,7 @@ UploadHandlerList = Union[ ImmutableList[uploadhandler.FileUploadHandler], ] -class HttpHeaders(CaseInsensitiveMapping): +class HttpHeaders(CaseInsensitiveMapping[str, str]): HTTP_PREFIX: str = ... UNPREFIXED_HEADERS: Set[str] = ... def __init__(self, environ: Mapping[str, Any]) -> None: ... diff --git a/django-stubs/http/response.pyi b/django-stubs/http/response.pyi index cc97a0aae..73319e53d 100644 --- a/django-stubs/http/response.pyi +++ b/django-stubs/http/response.pyi @@ -24,7 +24,7 @@ class BadHeaderError(ValueError): ... class HttpResponseBase(Iterable[Any]): status_code: int = ... - cookies: SimpleCookie = ... + cookies: SimpleCookie = ... # type: ignore [no-any-unimported] reason_phrase: str = ... charset: str = ... closed: bool = ... @@ -74,7 +74,7 @@ class HttpResponseBase(Iterable[Any]): def readable(self) -> bool: ... def seekable(self) -> bool: ... def writable(self) -> bool: ... - def writelines(self, lines: Iterable[object]): ... + def writelines(self, lines: Iterable[object]) -> Any: ... def __iter__(self) -> Iterator[Any]: ... class HttpResponse(HttpResponseBase): diff --git a/django-stubs/middleware/cache.pyi b/django-stubs/middleware/cache.pyi index dcbecc8ad..88bbfdfe6 100644 --- a/django-stubs/middleware/cache.pyi +++ b/django-stubs/middleware/cache.pyi @@ -27,7 +27,7 @@ class CacheMiddleware(UpdateCacheMiddleware, FetchFromCacheMiddleware): cache: BaseCache = ... def __init__( self, - get_response: Optional[Callable] = ..., + get_response: Optional[Callable[..., Any]] = ..., cache_timeout: Optional[float] = ..., **kwargs: Any ) -> None: ... diff --git a/django-stubs/middleware/csrf.pyi b/django-stubs/middleware/csrf.pyi index 54ee411c8..27958e7dd 100644 --- a/django-stubs/middleware/csrf.pyi +++ b/django-stubs/middleware/csrf.pyi @@ -24,8 +24,8 @@ class CsrfViewMiddleware(MiddlewareMixin): def process_view( self, request: HttpRequest, - callback: Optional[Callable], - callback_args: Tuple, + callback: Optional[Callable[..., Any]], + callback_args: Tuple[Any, ...], callback_kwargs: Dict[str, Any], ) -> Optional[HttpResponseForbidden]: ... def process_response( diff --git a/django-stubs/shortcuts.pyi b/django-stubs/shortcuts.pyi index 007326457..b4c042746 100644 --- a/django-stubs/shortcuts.pyi +++ b/django-stubs/shortcuts.pyi @@ -47,21 +47,21 @@ class SupportsGetAbsoluteUrl(Protocol): ... @overload def redirect( - to: Union[Callable, str, SupportsGetAbsoluteUrl], + to: Union[Callable[..., Any], str, SupportsGetAbsoluteUrl], *args: Any, permanent: Literal[True], **kwargs: Any ) -> HttpResponsePermanentRedirect: ... @overload def redirect( - to: Union[Callable, str, SupportsGetAbsoluteUrl], + to: Union[Callable[..., Any], str, SupportsGetAbsoluteUrl], *args: Any, permanent: Literal[False], **kwargs: Any ) -> HttpResponseRedirect: ... @overload def redirect( - to: Union[Callable, str, SupportsGetAbsoluteUrl], + to: Union[Callable[..., Any], str, SupportsGetAbsoluteUrl], *args: Any, permanent: bool = ..., **kwargs: Any @@ -75,4 +75,6 @@ def get_object_or_404( def get_list_or_404( klass: Union[Type[_T], Manager[_T], QuerySet[_T]], *args: Any, **kwargs: Any ) -> List[_T]: ... -def resolve_url(to: Union[Callable, Model, str], *args: Any, **kwargs: Any) -> str: ... +def resolve_url( + to: Union[Callable[..., Any], Model, str], *args: Any, **kwargs: Any +) -> str: ... diff --git a/django-stubs/template/backends/jinja2.pyi b/django-stubs/template/backends/jinja2.pyi index 623bd409a..fbb37014b 100644 --- a/django-stubs/template/backends/jinja2.pyi +++ b/django-stubs/template/backends/jinja2.pyi @@ -8,7 +8,7 @@ class Jinja2(BaseEngine): context_processors: List[str] = ... def __init__(self, params: Dict[str, Any]) -> None: ... @property - def template_context_processors(self) -> List[Callable]: ... + def template_context_processors(self) -> List[Callable[..., Any]]: ... class Origin: name: str = ... diff --git a/django-stubs/template/base.pyi b/django-stubs/template/base.pyi index 98196afe9..1cdb8b217 100644 --- a/django-stubs/template/base.pyi +++ b/django-stubs/template/base.pyi @@ -122,8 +122,8 @@ class DebugLexer(Lexer): class Parser: tokens: Union[List[Token], str] = ... - tags: Dict[str, Callable] = ... - filters: Dict[str, Callable] = ... + tags: Dict[str, Callable[..., Any]] = ... + filters: Dict[str, Callable[..., Any]] = ... command_stack: List[Tuple[str, Token]] = ... libraries: Dict[str, Library] = ... origin: Optional[Origin] = ... @@ -150,7 +150,7 @@ class Parser: def delete_first_token(self) -> None: ... def add_library(self, lib: Library) -> None: ... def compile_filter(self, token: str) -> FilterExpression: ... - def find_filter(self, filter_name: str) -> Callable: ... + def find_filter(self, filter_name: str) -> Callable[..., Any]: ... constant_string: Any filter_raw_string: Any @@ -166,7 +166,7 @@ class FilterExpression: ) -> Any: ... @staticmethod def args_check( - name: str, func: Callable, provided: List[Tuple[bool, Any]] + name: str, func: Callable[..., Any], provided: List[Tuple[bool, Any]] ) -> bool: ... class Variable: diff --git a/django-stubs/template/context.pyi b/django-stubs/template/context.pyi index a43767e67..2e82fcfc0 100644 --- a/django-stubs/template/context.pyi +++ b/django-stubs/template/context.pyi @@ -9,7 +9,7 @@ _ContextValues = Union[Dict[str, Any], "Context"] class ContextPopException(Exception): ... -class ContextDict(dict): +class ContextDict(Dict[Any, Any]): context: BaseContext = ... def __init__(self, context: BaseContext, *args: Any, **kwargs: Any) -> None: ... def __enter__(self) -> ContextDict: ... @@ -74,7 +74,7 @@ class RequestContext(Context): self, request: HttpRequest, dict_: Optional[Dict[str, Any]] = ..., - processors: Optional[List[Callable]] = ..., + processors: Optional[List[Callable[..., Any]]] = ..., use_l10n: None = ..., use_tz: None = ..., autoescape: bool = ..., diff --git a/django-stubs/template/context_processors.pyi b/django-stubs/template/context_processors.pyi index 5aa817e7c..422c76da5 100644 --- a/django-stubs/template/context_processors.pyi +++ b/django-stubs/template/context_processors.pyi @@ -5,11 +5,11 @@ from django.http.request import HttpRequest from django.utils.functional import SimpleLazyObject def csrf(request: HttpRequest) -> Dict[str, SimpleLazyObject]: ... -def debug(request: HttpRequest) -> Dict[str, Union[Callable, bool]]: ... +def debug(request: HttpRequest) -> Dict[str, Union[Callable[..., Any], bool]]: ... def i18n( request: WSGIRequest, ) -> Dict[str, Union[List[Tuple[str, str]], bool, str]]: ... def tz(request: HttpRequest) -> Dict[str, str]: ... def static(request: HttpRequest) -> Dict[str, str]: ... -def media(request: Any): ... +def media(request: Any) -> Any: ... def request(request: HttpRequest) -> Dict[str, HttpRequest]: ... diff --git a/django-stubs/template/defaultfilters.pyi b/django-stubs/template/defaultfilters.pyi index a4fca1351..7242bf843 100644 --- a/django-stubs/template/defaultfilters.pyi +++ b/django-stubs/template/defaultfilters.pyi @@ -8,7 +8,7 @@ from django.utils.safestring import SafeText register: Any -def stringfilter(func: Callable) -> Callable: ... +def stringfilter(func: Callable[..., Any]) -> Callable[..., Any]: ... def addslashes(value: str) -> str: ... def capfirst(value: str) -> str: ... def escapejs_filter(value: str) -> SafeText: ... diff --git a/django-stubs/template/engine.pyi b/django-stubs/template/engine.pyi index eba1f3c2e..bd0ed6266 100644 --- a/django-stubs/template/engine.pyi +++ b/django-stubs/template/engine.pyi @@ -10,7 +10,7 @@ from .base import Template _Loader = Any class Engine: - template_context_processors: Tuple[Callable] + template_context_processors: Tuple[Callable[..., Any]] template_loaders: List[Loader] default_builtins: Any = ... dirs: List[str] = ... diff --git a/django-stubs/template/library.pyi b/django-stubs/template/library.pyi index 424a76c2d..4232f66d2 100644 --- a/django-stubs/template/library.pyi +++ b/django-stubs/template/library.pyi @@ -9,35 +9,37 @@ from .base import Node, Template class InvalidTemplateLibrary(Exception): ... class Library: - filters: Dict[str, Callable] = ... - tags: Dict[str, Callable] = ... + filters: Dict[str, Callable[..., Any]] = ... + tags: Dict[str, Callable[..., Any]] = ... def __init__(self) -> None: ... def tag( self, - name: Optional[Union[Callable, str]] = ..., - compile_function: Optional[Union[Callable, str]] = ..., - ) -> Callable: ... - def tag_function(self, func: Callable) -> Callable: ... + name: Optional[Union[Callable[..., Any], str]] = ..., + compile_function: Optional[Union[Callable[..., Any], str]] = ..., + ) -> Callable[..., Any]: ... + def tag_function(self, func: Callable[..., Any]) -> Callable[..., Any]: ... def filter( self, - name: Optional[Union[Callable, str]] = ..., - filter_func: Optional[Union[Callable, str]] = ..., + name: Optional[Union[Callable[..., Any], str]] = ..., + filter_func: Optional[Union[Callable[..., Any], str]] = ..., **flags: Any - ) -> Callable: ... - def filter_function(self, func: Callable, **flags: Any) -> Callable: ... + ) -> Callable[..., Any]: ... + def filter_function( + self, func: Callable[..., Any], **flags: Any + ) -> Callable[..., Any]: ... def simple_tag( self, - func: Optional[Union[Callable, str]] = ..., + func: Optional[Union[Callable[..., Any], str]] = ..., takes_context: Optional[bool] = ..., name: Optional[str] = ..., - ) -> Callable: ... + ) -> Callable[..., Any]: ... def inclusion_tag( self, filename: Union[Template, str], func: None = ..., takes_context: Optional[bool] = ..., name: Optional[str] = ..., - ) -> Callable: ... + ) -> Callable[..., Any]: ... class TagHelperNode(Node): func: Any = ... @@ -46,7 +48,7 @@ class TagHelperNode(Node): kwargs: Any = ... def __init__( self, - func: Callable, + func: Callable[..., Any], takes_context: Optional[bool], args: List[FilterExpression], kwargs: Dict[str, FilterExpression], @@ -57,7 +59,7 @@ class TagHelperNode(Node): class SimpleNode(TagHelperNode): args: List[FilterExpression] - func: Callable + func: Callable[..., Any] kwargs: Dict[str, FilterExpression] origin: Origin takes_context: Optional[bool] @@ -65,7 +67,7 @@ class SimpleNode(TagHelperNode): target_var: Optional[str] = ... def __init__( self, - func: Callable, + func: Callable[..., Any], takes_context: Optional[bool], args: List[FilterExpression], kwargs: Dict[str, FilterExpression], @@ -74,7 +76,7 @@ class SimpleNode(TagHelperNode): class InclusionNode(TagHelperNode): args: List[FilterExpression] - func: Callable + func: Callable[..., Any] kwargs: Dict[str, FilterExpression] origin: Origin takes_context: Optional[bool] @@ -82,7 +84,7 @@ class InclusionNode(TagHelperNode): filename: Union[Template, str] = ... def __init__( self, - func: Callable, + func: Callable[..., Any], takes_context: Optional[bool], args: List[FilterExpression], kwargs: Dict[str, FilterExpression], diff --git a/django-stubs/template/loader_tags.pyi b/django-stubs/template/loader_tags.pyi index 256079273..b2488ed00 100644 --- a/django-stubs/template/loader_tags.pyi +++ b/django-stubs/template/loader_tags.pyi @@ -1,5 +1,4 @@ -import collections -from typing import Any, Dict, List, Optional, Union +from typing import Any, DefaultDict, Dict, List, Optional, Union from django.template.base import FilterExpression, NodeList, Origin, Parser, Token from django.template.context import Context @@ -11,7 +10,7 @@ register: Any BLOCK_CONTEXT_KEY: str class BlockContext: - blocks: collections.defaultdict = ... + blocks: DefaultDict[Any, Any] = ... def __init__(self) -> None: ... def add_blocks(self, blocks: Dict[str, BlockNode]) -> None: ... def pop(self, name: str) -> BlockNode: ... diff --git a/django-stubs/template/response.pyi b/django-stubs/template/response.pyi index a74acf7f2..aea1b70bc 100644 --- a/django-stubs/template/response.pyi +++ b/django-stubs/template/response.pyi @@ -14,7 +14,7 @@ class ContentNotRenderedError(Exception): ... class SimpleTemplateResponse(HttpResponse): content: Any = ... closed: bool - cookies: SimpleCookie + cookies: SimpleCookie[Any] status_code: int rendering_attrs: Any = ... template_name: Union[List[str], Template, str] = ... @@ -37,7 +37,7 @@ class SimpleTemplateResponse(HttpResponse): ) -> Optional[Dict[str, Any]]: ... @property def rendered_content(self) -> str: ... - def add_post_render_callback(self, callback: Callable) -> None: ... + def add_post_render_callback(self, callback: Callable[..., Any]) -> None: ... def render(self) -> SimpleTemplateResponse: ... @property def is_rendered(self) -> bool: ... @@ -48,9 +48,9 @@ class TemplateResponse(SimpleTemplateResponse): closed: bool context: RequestContext context_data: Optional[Dict[str, Any]] - cookies: SimpleCookie + cookies: SimpleCookie[Any] csrf_cookie_set: bool - json: functools.partial + json: functools.partial[Any] redirect_chain: List[Tuple[str, int]] request: Dict[str, Union[int, str]] status_code: int diff --git a/django-stubs/template/smartif.pyi b/django-stubs/template/smartif.pyi index a60d2fa33..70e2eff0e 100644 --- a/django-stubs/template/smartif.pyi +++ b/django-stubs/template/smartif.pyi @@ -11,10 +11,10 @@ class TokenBase: second: Any = ... def nud(self, parser: Any) -> None: ... def led(self, left: Any, parser: Any) -> None: ... - def display(self): ... + def display(self) -> Any: ... -def infix(bp: Any, func: Any): ... -def prefix(bp: Any, func: Any): ... +def infix(bp: Any, func: Any) -> Any: ... +def prefix(bp: Any, func: Any) -> Any: ... OPERATORS: Any @@ -23,7 +23,7 @@ class Literal(TokenBase): lbp: int = ... value: Optional[_Token] = ... def __init__(self, value: Optional[_Token]) -> None: ... - def display(self): ... + def display(self) -> Any: ... def eval(self, context: Dict[Any, Any]) -> Optional[_Token]: ... class EndToken(TokenBase): diff --git a/django-stubs/template/utils.pyi b/django-stubs/template/utils.pyi index f7e456a29..57de8c6c6 100644 --- a/django-stubs/template/utils.pyi +++ b/django-stubs/template/utils.pyi @@ -7,10 +7,10 @@ from django.template.backends.base import BaseEngine class InvalidTemplateEngineError(ImproperlyConfigured): ... class EngineHandler: - templates: collections.OrderedDict + templates: collections.OrderedDict[Any, Any] def __init__(self, templates: List[Dict[str, Any]] = ...) -> None: ... def __getitem__(self, alias: str) -> BaseEngine: ... def __iter__(self) -> Any: ... def all(self) -> List[BaseEngine]: ... -def get_app_template_dirs(dirname: str) -> Tuple: ... +def get_app_template_dirs(dirname: str) -> Tuple[Any, ...]: ... diff --git a/django-stubs/templatetags/i18n.pyi b/django-stubs/templatetags/i18n.pyi index 69e415e18..856e98e75 100644 --- a/django-stubs/templatetags/i18n.pyi +++ b/django-stubs/templatetags/i18n.pyi @@ -18,7 +18,7 @@ class GetLanguageInfoListNode(Node): languages: FilterExpression = ... variable: str = ... def __init__(self, languages: FilterExpression, variable: str) -> None: ... - def get_language_info(self, language: Any): ... + def get_language_info(self, language: Any) -> Any: ... class GetCurrentLanguageNode(Node): variable: str = ... diff --git a/django-stubs/test/client.pyi b/django-stubs/test/client.pyi index b9e464ba2..ea626edb6 100644 --- a/django-stubs/test/client.pyi +++ b/django-stubs/test/client.pyi @@ -13,8 +13,8 @@ from django.http.response import HttpResponse, HttpResponseBase BOUNDARY: str = ... MULTIPART_CONTENT: str = ... -CONTENT_TYPE_RE: Pattern = ... -JSON_CONTENT_TYPE_RE: Pattern = ... +CONTENT_TYPE_RE: Pattern[str] = ... +JSON_CONTENT_TYPE_RE: Pattern[str] = ... class RedirectCycleError(Exception): last_response: HttpResponseBase = ... @@ -41,7 +41,7 @@ def encode_file(boundary: str, key: str, file: Any) -> List[bytes]: ... class RequestFactory: json_encoder: Type[JSONEncoder] defaults: Dict[str, str] - cookies: SimpleCookie + cookies: SimpleCookie # type: ignore [no-any-unimported] errors: BytesIO def __init__( self, *, json_encoder: Type[JSONEncoder] = ..., **defaults: Any @@ -126,7 +126,7 @@ class Client(RequestFactory): follow: bool = ..., secure: bool = ..., **extra: Any - ) -> HttpResponse: ... # type: ignore + ) -> HttpResponse: ... def post( # type: ignore self, path: str, @@ -135,7 +135,7 @@ class Client(RequestFactory): follow: bool = ..., secure: bool = ..., **extra: Any - ) -> HttpResponse: ... # type: ignore + ) -> HttpResponse: ... def head( # type: ignore self, path: str, @@ -143,10 +143,10 @@ class Client(RequestFactory): follow: bool = ..., secure: bool = ..., **extra: Any - ) -> HttpResponse: ... # type: ignore + ) -> HttpResponse: ... def trace( # type: ignore self, path: str, follow: bool = ..., secure: bool = ..., **extra: Any - ) -> HttpResponse: ... # type: ignore + ) -> HttpResponse: ... def options( # type: ignore self, path: str, @@ -155,7 +155,7 @@ class Client(RequestFactory): follow: bool = ..., secure: bool = ..., **extra: Any - ) -> HttpResponse: ... # type: ignore + ) -> HttpResponse: ... def put( # type: ignore self, path: str, @@ -164,7 +164,7 @@ class Client(RequestFactory): follow: bool = ..., secure: bool = ..., **extra: Any - ) -> HttpResponse: ... # type: ignore + ) -> HttpResponse: ... def patch( # type: ignore self, path: str, @@ -173,7 +173,7 @@ class Client(RequestFactory): follow: bool = ..., secure: bool = ..., **extra: Any - ) -> HttpResponse: ... # type: ignore + ) -> HttpResponse: ... def delete( # type: ignore self, path: str, @@ -182,7 +182,7 @@ class Client(RequestFactory): follow: bool = ..., secure: bool = ..., **extra: Any - ) -> HttpResponse: ... # type: ignore + ) -> HttpResponse: ... def store_exc_info(self, **kwargs: Any) -> None: ... @property def session(self) -> SessionBase: ... diff --git a/django-stubs/test/runner.pyi b/django-stubs/test/runner.pyi index 3f4855518..3c763bd60 100644 --- a/django-stubs/test/runner.pyi +++ b/django-stubs/test/runner.pyi @@ -36,7 +36,7 @@ class RemoteTestResult: testsRun: int = ... def __init__(self) -> None: ... @property - def test_index(self): ... + def test_index(self) -> Any: ... def check_picklable(self, test: Any, err: Any) -> None: ... def _confirm_picklable(self, obj: Any) -> None: ... def check_subtest_picklable(self, test: Any, subtest: Any) -> None: ... @@ -60,7 +60,7 @@ class RemoteTestRunner: def __init__( self, failfast: bool = ..., resultclass: Optional[Any] = ... ) -> None: ... - def run(self, test: Any): ... + def run(self, test: Any) -> Any: ... def default_test_processes() -> int: ... @@ -72,7 +72,7 @@ class ParallelTestSuite(TestSuite): processes: Any = ... failfast: Any = ... def __init__(self, suite: Any, processes: Any, failfast: bool = ...) -> None: ... - def run(self, result: Any): ... # type: ignore[override] + def run(self, result: Any) -> Any: ... # type: ignore[override] class DiscoverRunner: test_suite: Any = ... @@ -144,10 +144,10 @@ def reorder_suite( def partition_suite_by_type( suite: TestSuite, classes: Tuple[Type[TestCase], Type[SimpleTestCase]], - bins: List[OrderedSet], + bins: List[OrderedSet[Any]], reverse: bool = ..., ) -> None: ... -def partition_suite_by_case(suite: Any): ... +def partition_suite_by_case(suite: Any) -> Any: ... def filter_tests_by_tags( suite: TestSuite, tags: Set[str], exclude_tags: Set[str] ) -> TestSuite: ... diff --git a/django-stubs/test/selenium.pyi b/django-stubs/test/selenium.pyi index bc5f46914..1495d3900 100644 --- a/django-stubs/test/selenium.pyi +++ b/django-stubs/test/selenium.pyi @@ -6,8 +6,8 @@ class SeleniumTestCaseBase: browsers: Any = ... browser: Any = ... @classmethod - def import_webdriver(cls, browser: Any): ... - def create_webdriver(self): ... + def import_webdriver(cls, browser: Any) -> Any: ... + def create_webdriver(self) -> Any: ... class SeleniumTestCase(LiveServerTestCase): implicit_wait: int = ... diff --git a/django-stubs/test/testcases.pyi b/django-stubs/test/testcases.pyi index 9c46b93af..5c25448d6 100644 --- a/django-stubs/test/testcases.pyi +++ b/django-stubs/test/testcases.pyi @@ -45,16 +45,16 @@ class _AssertTemplateUsedContext: def on_template_render( self, sender: Any, signal: Any, template: Any, context: Any, **kwargs: Any ) -> None: ... - def test(self): ... - def message(self): ... - def __enter__(self): ... - def __exit__(self, exc_type: Any, exc_value: Any, traceback: Any): ... + def test(self) -> Any: ... + def message(self) -> Any: ... + def __enter__(self) -> Any: ... + def __exit__(self, exc_type: Any, exc_value: Any, traceback: Any) -> Any: ... class _AssertTemplateNotUsedContext(_AssertTemplateUsedContext): ... class _CursorFailure: cls_name: str = ... - wrapped: Callable = ... + wrapped: Callable[..., Any] = ... def __init__(self, cls_name: Any, wrapped: Any) -> None: ... def __call__(self) -> None: ... @@ -186,7 +186,7 @@ class TransactionTestCase(SimpleTestCase): serialized_rollback: bool = ... def assertQuerysetEqual( self, - qs: Union[Iterator[Any], List[Model], QuerySet, RawQuerySet], + qs: Union[Iterator[Any], List[Model], QuerySet[Any], RawQuerySet[Any]], values: Union[ List[None], List[Tuple[str, str]], @@ -194,9 +194,9 @@ class TransactionTestCase(SimpleTestCase): List[int], List[str], Set[str], - QuerySet, + QuerySet[Any], ], - transform: Union[Callable, Type[str]] = ..., + transform: Union[Callable[..., Any], Type[str]] = ..., ordered: bool = ..., msg: Optional[str] = ..., ) -> None: ... @@ -219,14 +219,16 @@ class TestCase(TransactionTestCase): def setUpTestData(cls) -> None: ... class CheckCondition: - conditions: Tuple[Tuple[Callable, str]] = ... + conditions: Tuple[Tuple[Callable[..., Any], str]] = ... def __init__(self, *conditions: Any) -> None: ... - def add_condition(self, condition: Callable, reason: str) -> CheckCondition: ... + def add_condition( + self, condition: Callable[..., Any], reason: str + ) -> CheckCondition: ... def __get__(self, instance: None, cls: Type[TransactionTestCase] = ...) -> bool: ... -def skipIfDBFeature(*features: Any) -> Callable: ... -def skipUnlessDBFeature(*features: Any) -> Callable: ... -def skipUnlessAnyDBFeature(*features: Any) -> Callable: ... +def skipIfDBFeature(*features: Any) -> Callable[..., Any]: ... +def skipUnlessDBFeature(*features: Any) -> Callable[..., Any]: ... +def skipUnlessAnyDBFeature(*features: Any) -> Callable[..., Any]: ... class QuietWSGIRequestHandler(WSGIRequestHandler): ... @@ -234,16 +236,16 @@ class FSFilesHandler(WSGIHandler): application: Any = ... base_url: Any = ... def __init__(self, application: Any) -> None: ... - def file_path(self, url: Any): ... - def serve(self, request: Any): ... + def file_path(self, url: Any) -> Any: ... + def serve(self, request: Any) -> Any: ... class _StaticFilesHandler(FSFilesHandler): - def get_base_dir(self): ... - def get_base_url(self): ... + def get_base_dir(self) -> Any: ... + def get_base_url(self) -> Any: ... class _MediaFilesHandler(FSFilesHandler): - def get_base_dir(self): ... - def get_base_url(self): ... + def get_base_dir(self) -> Any: ... + def get_base_url(self) -> Any: ... class LiveServerThread(threading.Thread): host: str = ... diff --git a/django-stubs/test/utils.pyi b/django-stubs/test/utils.pyi index 4f6e62841..9040f7af1 100644 --- a/django-stubs/test/utils.pyi +++ b/django-stubs/test/utils.pyi @@ -28,8 +28,8 @@ from django.test.runner import DiscoverRunner from django.test.testcases import SimpleTestCase _TestClass = Type[SimpleTestCase] -_DecoratedTest = Union[Callable, _TestClass] -_C = TypeVar("_C", bound=Callable) # Any callable +_DecoratedTest = Union[Callable[..., Any], _TestClass] +_C = TypeVar("_C", bound=Callable[..., Any]) TZ_SUPPORT: bool = ... @@ -38,7 +38,7 @@ class Approximate: places: int = ... def __init__(self, val: Union[Decimal, float], places: int = ...) -> None: ... -class ContextList(list): +class ContextList(List[Any]): def get(self, key: str, default: Optional[str] = ...) -> str: ... def keys(self) -> Set[str]: ... @@ -80,15 +80,15 @@ class modify_settings(override_settings): class override_system_checks(TestContextDecorator): registry: CheckRegistry = ... - new_checks: List[Callable] = ... - deployment_checks: Optional[List[Callable]] = ... + new_checks: List[Callable[..., Any]] = ... + deployment_checks: Optional[List[Callable[..., Any]]] = ... def __init__( self, - new_checks: List[Callable], - deployment_checks: Optional[List[Callable]] = ..., + new_checks: List[Callable[..., Any]], + deployment_checks: Optional[List[Callable[..., Any]]] = ..., ) -> None: ... - old_checks: Set[Callable] = ... - old_deployment_checks: Set[Callable] = ... + old_checks: Set[Callable[..., Any]] = ... + old_deployment_checks: Set[Callable[..., Any]] = ... class CaptureQueriesContext: connection: Any = ... @@ -96,7 +96,7 @@ class CaptureQueriesContext: initial_queries: int = ... final_queries: Optional[int] = ... def __init__(self, connection: Any) -> None: ... - def __iter__(self): ... + def __iter__(self) -> Any: ... def __getitem__(self, index: int) -> Dict[str, str]: ... def __len__(self) -> int: ... @property @@ -106,13 +106,13 @@ class CaptureQueriesContext: class ignore_warnings(TestContextDecorator): ignore_kwargs: Dict[str, Any] = ... - filter_func: Callable = ... + filter_func: Callable[..., Any] = ... def __init__(self, **kwargs: Any) -> None: ... - catch_warnings: ContextManager[Optional[list]] = ... + catch_warnings: ContextManager[Optional[List[Any]]] = ... requires_tz_support: Any -def isolate_lru_cache(lru_cache_object: Callable) -> Iterator[None]: ... +def isolate_lru_cache(lru_cache_object: Callable[..., Any]) -> Iterator[None]: ... class override_script_prefix(TestContextDecorator): prefix: str = ... @@ -134,7 +134,7 @@ class isolate_apps(TestContextDecorator): @contextmanager def extend_sys_path(*paths: str) -> Iterator[None]: ... @contextmanager -def captured_output(stream_name) -> Iterator[StringIO]: ... +def captured_output(stream_name: Any) -> Iterator[StringIO]: ... @contextmanager def captured_stdin() -> Iterator[StringIO]: ... @contextmanager @@ -143,7 +143,7 @@ def captured_stdout() -> Iterator[StringIO]: ... def captured_stderr() -> Iterator[StringIO]: ... @contextmanager def freeze_time(t: float) -> Iterator[None]: ... -def tag(*tags: str): ... +def tag(*tags: str) -> Any: ... _Signature = str _TestDatabase = Tuple[str, List[str]] @@ -165,6 +165,6 @@ def require_jinja2(test_func: _C) -> _C: ... @contextmanager def register_lookup( field: Type[RegisterLookupMixin], - *lookups: Type[Union[Lookup, Transform]], + *lookups: Type[Union[Lookup[Any], Transform]], lookup_name: Optional[str] = ... ) -> Iterator[None]: ... diff --git a/django-stubs/urls/base.pyi b/django-stubs/urls/base.pyi index b8b4daeb2..f1d78b3d6 100644 --- a/django-stubs/urls/base.pyi +++ b/django-stubs/urls/base.pyi @@ -4,7 +4,7 @@ from django.urls.resolvers import ResolverMatch def resolve(path: str, urlconf: Optional[str] = ...) -> ResolverMatch: ... def reverse( - viewname: Optional[Union[Callable, str]], + viewname: Optional[Union[Callable[..., Any], str]], urlconf: Optional[str] = ..., args: Optional[Sequence[Any]] = ..., kwargs: Optional[Dict[str, Any]] = ..., diff --git a/django-stubs/urls/resolvers.pyi b/django-stubs/urls/resolvers.pyi index 6f327ab54..f910b98c1 100644 --- a/django-stubs/urls/resolvers.pyi +++ b/django-stubs/urls/resolvers.pyi @@ -4,8 +4,8 @@ from django.urls.converters import UUIDConverter from django.utils.datastructures import MultiValueDict class ResolverMatch: - func: Callable = ... - args: Tuple = ... + func: Callable[..., Any] = ... + args: Tuple[Any, ...] = ... kwargs: Dict[str, Any] = ... url_name: Optional[str] = ... app_names: List[str] = ... @@ -16,8 +16,8 @@ class ResolverMatch: route: str = ... def __init__( self, - func: Callable, - args: Tuple, + func: Callable[..., Any], + args: Tuple[Any, ...], kwargs: Dict[str, Any], url_name: Optional[str] = ..., app_names: Optional[List[Optional[str]]] = ..., @@ -30,7 +30,7 @@ class ResolverMatch: def get_resolver(urlconf: Optional[str] = ...) -> URLResolver: ... def get_ns_resolver( - ns_pattern: str, resolver: URLResolver, converters: Tuple + ns_pattern: str, resolver: URLResolver, converters: Tuple[Any, ...] ) -> URLResolver: ... class LocaleRegexDescriptor: @@ -50,7 +50,9 @@ class RegexPattern(CheckURLMixin): def __init__( self, regex: str, name: Optional[str] = ..., is_endpoint: bool = ... ) -> None: ... - def match(self, path: str) -> Optional[Tuple[str, Tuple, Dict[str, str]]]: ... + def match( + self, path: str + ) -> Optional[Tuple[str, Tuple[Any, ...], Dict[str, str]]]: ... def check(self) -> List[Warning]: ... class RoutePattern(CheckURLMixin): @@ -62,7 +64,7 @@ class RoutePattern(CheckURLMixin): ) -> None: ... def match( self, path: str - ) -> Optional[Tuple[str, Tuple, Dict[str, Union[int, str]]]]: ... + ) -> Optional[Tuple[str, Tuple[Any, ...], Dict[str, Union[int, str]]]]: ... def check(self) -> List[Warning]: ... class LocalePrefixPattern: @@ -70,23 +72,25 @@ class LocalePrefixPattern: converters: Dict[Any, Any] = ... def __init__(self, prefix_default_language: bool = ...) -> None: ... @property - def regex(self): ... + def regex(self) -> Any: ... @property def language_prefix(self) -> str: ... - def match(self, path: str) -> Optional[Tuple[str, Tuple, Dict[str, Any]]]: ... + def match( + self, path: str + ) -> Optional[Tuple[str, Tuple[Any, ...], Dict[str, Any]]]: ... def check(self) -> List[Any]: ... def describe(self) -> str: ... class URLPattern: lookup_str: str pattern: Any = ... - callback: Callable = ... + callback: Callable[..., Any] = ... default_args: Optional[Dict[str, str]] = ... name: Optional[str] = ... def __init__( self, pattern: Any, - callback: Callable, + callback: Callable[..., Any], default_args: Optional[Dict[str, str]] = ..., name: Optional[str] = ..., ) -> None: ... @@ -94,8 +98,8 @@ class URLPattern: def resolve(self, path: str) -> Optional[ResolverMatch]: ... class URLResolver: - url_patterns: List[Tuple[str, Callable]] - urlconf_module: Optional[List[Tuple[str, Callable]]] + url_patterns: List[Tuple[str, Callable[..., Any]]] + urlconf_module: Optional[List[Tuple[str, Callable[..., Any]]]] pattern: Any = ... urlconf_name: Optional[str] = ... callback: None = ... @@ -103,7 +107,7 @@ class URLResolver: namespace: Optional[str] = ... app_name: Optional[str] = ... _local: Any - _reverse_dict: MultiValueDict + _reverse_dict: MultiValueDict[Any, Any] def __init__( self, pattern: Any, @@ -113,7 +117,7 @@ class URLResolver: namespace: Optional[str] = ..., ) -> None: ... @property - def reverse_dict(self) -> MultiValueDict: ... + def reverse_dict(self) -> MultiValueDict[Any, Any]: ... @property def namespace_dict(self) -> Dict[str, Tuple[str, URLResolver]]: ... @property @@ -121,7 +125,7 @@ class URLResolver: def resolve(self, path: str) -> ResolverMatch: ... def resolve_error_handler( self, view_type: int - ) -> Tuple[Callable, Dict[str, Any]]: ... + ) -> Tuple[Callable[..., Any], Dict[str, Any]]: ... def reverse(self, lookup_view: str, *args: Any, **kwargs: Any) -> str: ... def _is_callback(self, name: str) -> bool: ... def _populate(self) -> None: ... diff --git a/django-stubs/urls/utils.pyi b/django-stubs/urls/utils.pyi index 79349df67..3cb631c47 100644 --- a/django-stubs/urls/utils.pyi +++ b/django-stubs/urls/utils.pyi @@ -1,4 +1,4 @@ -from typing import Callable, Tuple, Union +from typing import Any, Callable, Tuple, Union -def get_callable(lookup_view: Union[Callable, str]) -> Callable: ... +def get_callable(lookup_view: Union[Callable[..., Any], str]) -> Callable[..., Any]: ... def get_mod_func(callback: str) -> Tuple[str, str]: ... diff --git a/django-stubs/utils/_os.pyi b/django-stubs/utils/_os.pyi index a609fa527..096ccf751 100644 --- a/django-stubs/utils/_os.pyi +++ b/django-stubs/utils/_os.pyi @@ -4,8 +4,8 @@ from typing import Any, Union abspathu = abspath -def upath(path: Any): ... -def npath(path: Any): ... +def upath(path: Any) -> Any: ... +def npath(path: Any) -> Any: ... def safe_join(base: Union[bytes, str], *paths: Any) -> str: ... def symlinks_supported() -> Any: ... def to_path(value: Union[Path, str]) -> Path: ... diff --git a/django-stubs/utils/asyncio.pyi b/django-stubs/utils/asyncio.pyi index 8a9a62d88..87f416c54 100644 --- a/django-stubs/utils/asyncio.pyi +++ b/django-stubs/utils/asyncio.pyi @@ -1,3 +1,3 @@ from typing import Any -def async_unsafe(message: Any): ... +def async_unsafe(message: Any) -> Any: ... diff --git a/django-stubs/utils/autoreload.pyi b/django-stubs/utils/autoreload.pyi index 33c4e4992..09cd2dc6f 100644 --- a/django-stubs/utils/autoreload.pyi +++ b/django-stubs/utils/autoreload.pyi @@ -25,9 +25,9 @@ I18N_MODIFIED: int def gen_filenames(only_new: bool = ...) -> List[str]: ... def clean_files(filelist: List[Optional[str]]) -> List[str]: ... def reset_translations() -> None: ... -def inotify_code_changed(): ... -def code_changed(): ... -def check_errors(fn: Callable) -> Callable: ... +def inotify_code_changed() -> Any: ... +def code_changed() -> Any: ... +def check_errors(fn: Callable[..., Any]) -> Callable[..., Any]: ... def raise_last_exception() -> None: ... def ensure_echo_on() -> None: ... def reloader_thread() -> None: ... @@ -79,6 +79,8 @@ class WatchmanReloader(BaseReloader): def get_reloader() -> BaseReloader: ... def start_django( - reloader: BaseReloader, main_func: Callable, *args: Any, **kwargs: Any + reloader: BaseReloader, main_func: Callable[..., Any], *args: Any, **kwargs: Any +) -> None: ... +def run_with_reloader( + main_func: Callable[..., Any], *args: Any, **kwargs: Any ) -> None: ... -def run_with_reloader(main_func: Callable, *args: Any, **kwargs: Any) -> None: ... diff --git a/django-stubs/utils/crypto.pyi b/django-stubs/utils/crypto.pyi index fb7c1653a..959cc8f0b 100644 --- a/django-stubs/utils/crypto.pyi +++ b/django-stubs/utils/crypto.pyi @@ -1,5 +1,5 @@ from hmac import HMAC -from typing import Callable, Optional, Union +from typing import Any, Callable, Optional, Union using_sysrandom: bool @@ -13,5 +13,5 @@ def pbkdf2( salt: Union[bytes, str], iterations: int, dklen: int = ..., - digest: Optional[Callable] = ..., + digest: Optional[Callable[..., Any]] = ..., ) -> bytes: ... diff --git a/django-stubs/utils/datastructures.pyi b/django-stubs/utils/datastructures.pyi index d283ad014..2f5763be2 100644 --- a/django-stubs/utils/datastructures.pyi +++ b/django-stubs/utils/datastructures.pyi @@ -31,7 +31,7 @@ class OrderedSet(MutableSet[_K]): class MultiValueDictKeyError(KeyError): ... -_D = TypeVar("_D", bound="MultiValueDict") +_D = TypeVar("_D", bound="MultiValueDict[Any, Any]") class MultiValueDict(MutableMapping[_K, _V]): @overload @@ -75,11 +75,11 @@ class DictWrapper(Dict[str, _V]): self, data: Iterable[Tuple[str, _V]], func: Callable[[_V], _V], prefix: str ) -> None: ... -_T = TypeVar("_T", bound="CaseInsensitiveMapping") +_T = TypeVar("_T", bound="CaseInsensitiveMapping[Any, Any]") -class CaseInsensitiveMapping(Mapping): +class CaseInsensitiveMapping(Mapping[_K, _V]): def __init__(self, data: Any) -> None: ... - def __getitem__(self, key: str) -> Any: ... + def __getitem__(self, key: _K) -> Any: ... def __len__(self) -> int: ... - def __iter__(self) -> Iterator[str]: ... + def __iter__(self) -> Iterator[_K]: ... def copy(self: _T) -> _T: ... diff --git a/django-stubs/utils/dateformat.pyi b/django-stubs/utils/dateformat.pyi index 9c95bc143..911156153 100644 --- a/django-stubs/utils/dateformat.pyi +++ b/django-stubs/utils/dateformat.pyi @@ -34,20 +34,20 @@ class DateFormat(TimeFormat): data: Union[datetime, str] timezone: Optional[FixedOffset] year_days: Any = ... - def b(self): ... + def b(self) -> Any: ... def c(self) -> str: ... def d(self) -> str: ... - def D(self): ... - def E(self): ... - def F(self): ... + def D(self) -> Any: ... + def E(self) -> Any: ... + def F(self) -> Any: ... def I(self) -> str: ... def j(self) -> int: ... - def l(self): ... + def l(self) -> Any: ... def L(self) -> bool: ... def m(self) -> str: ... def M(self) -> str: ... def n(self) -> int: ... - def N(self): ... + def N(self) -> Any: ... def o(self) -> int: ... def r(self) -> str: ... def S(self) -> str: ... diff --git a/django-stubs/utils/decorators.pyi b/django-stubs/utils/decorators.pyi index ae56897e4..a5d2f4d37 100644 --- a/django-stubs/utils/decorators.pyi +++ b/django-stubs/utils/decorators.pyi @@ -3,20 +3,24 @@ from typing import Any, Callable, Iterable, Optional, Type, TypeVar, Union from django.utils.deprecation import MiddlewareMixin from django.views.generic.base import View -_T = TypeVar("_T", bound=Union[View, Callable]) # Any callable +_T = TypeVar("_T", bound=Union[View, Callable[..., Any]]) # Any callable class classonlymethod(classmethod): ... def method_decorator( - decorator: Union[Callable, Iterable[Callable]], name: str = ... + decorator: Union[Callable[..., Any], Iterable[Callable[..., Any]]], name: str = ... ) -> Callable[[_T], _T]: ... -def decorator_from_middleware_with_args(middleware_class: type) -> Callable: ... -def decorator_from_middleware(middleware_class: type) -> Callable: ... -def available_attrs(fn: Callable): ... -def make_middleware_decorator(middleware_class: Type[MiddlewareMixin]) -> Callable: ... +def decorator_from_middleware_with_args( + middleware_class: type, +) -> Callable[..., Any]: ... +def decorator_from_middleware(middleware_class: type) -> Callable[..., Any]: ... +def available_attrs(fn: Callable[..., Any]) -> Any: ... +def make_middleware_decorator( + middleware_class: Type[MiddlewareMixin], +) -> Callable[..., Any]: ... class classproperty: - fget: Optional[Callable] = ... - def __init__(self, method: Optional[Callable] = ...) -> None: ... + fget: Optional[Callable[..., Any]] = ... + def __init__(self, method: Optional[Callable[..., Any]] = ...) -> None: ... def __get__(self, instance: Any, cls: Optional[type] = ...) -> Any: ... - def getter(self, method: Callable) -> classproperty: ... + def getter(self, method: Callable[..., Any]) -> classproperty: ... diff --git a/django-stubs/utils/deprecation.pyi b/django-stubs/utils/deprecation.pyi index 726645976..d2b9eb086 100644 --- a/django-stubs/utils/deprecation.pyi +++ b/django-stubs/utils/deprecation.pyi @@ -20,16 +20,16 @@ class warn_about_renamed_method: new_method_name: str, deprecation_warning: Type[DeprecationWarning], ) -> None: ... - def __call__(self, f: Callable) -> Callable: ... + def __call__(self, f: Callable[..., Any]) -> Callable[..., Any]: ... class RenameMethodsBase(type): renamed_methods: Any = ... - def __new__(cls, name: Any, bases: Any, attrs: Any): ... + def __new__(cls, name: Any, bases: Any, attrs: Any) -> Any: ... class DeprecationInstanceCheck(type): alternative: str deprecation_warning: Type[Warning] - def __instancecheck__(self, instance: Any): ... + def __instancecheck__(self, instance: Any) -> Any: ... GetResponseCallable = Callable[[HttpRequest], HttpResponse] diff --git a/django-stubs/utils/feedgenerator.pyi b/django-stubs/utils/feedgenerator.pyi index ea6358b57..edc0ef070 100644 --- a/django-stubs/utils/feedgenerator.pyi +++ b/django-stubs/utils/feedgenerator.pyi @@ -38,18 +38,18 @@ class SyndicationFeed: comments: None = ..., unique_id: Optional[str] = ..., unique_id_is_permalink: Optional[bool] = ..., - categories: Optional[Tuple] = ..., + categories: Optional[Tuple[Any, ...]] = ..., item_copyright: Optional[str] = ..., ttl: None = ..., updateddate: Optional[datetime] = ..., enclosures: Optional[List[Enclosure]] = ..., **kwargs: Any ) -> None: ... - def num_items(self): ... + def num_items(self) -> Any: ... def root_attributes(self) -> Dict[Any, Any]: ... - def add_root_elements(self, handler: ContentHandler) -> None: ... + def add_root_elements(self, handler: ContentHandler) -> None: ... # type: ignore [no-any-unimported] def item_attributes(self, item: Dict[str, Any]) -> Dict[Any, Any]: ... - def add_item_elements( + def add_item_elements( # type: ignore [no-any-unimported] self, handler: ContentHandler, item: Dict[str, Any] ) -> None: ... def write(self, outfile: Any, encoding: Any) -> None: ... @@ -64,8 +64,8 @@ class Enclosure: class RssFeed(SyndicationFeed): content_type: str = ... - def write_items(self, handler: ContentHandler) -> None: ... - def endChannelElement(self, handler: ContentHandler) -> None: ... + def write_items(self, handler: ContentHandler) -> None: ... # type: ignore [no-any-unimported] + def endChannelElement(self, handler: ContentHandler) -> None: ... # type: ignore [no-any-unimported] class RssUserland091Feed(RssFeed): ... class Rss201rev2Feed(RssFeed): ... @@ -73,6 +73,6 @@ class Rss201rev2Feed(RssFeed): ... class Atom1Feed(SyndicationFeed): content_type: str = ... ns: str = ... - def write_items(self, handler: ContentHandler) -> None: ... + def write_items(self, handler: ContentHandler) -> None: ... # type: ignore [no-any-unimported] DefaultFeed = Rss201rev2Feed diff --git a/django-stubs/utils/functional.pyi b/django-stubs/utils/functional.pyi index 8e51dcf10..8e4b282bb 100644 --- a/django-stubs/utils/functional.pyi +++ b/django-stubs/utils/functional.pyi @@ -15,7 +15,7 @@ from typing import ( from django.db.models.base import Model -def curry(_curried_func: Any, *args: Any, **kwargs: Any): ... +def curry(_curried_func: Any, *args: Any, **kwargs: Any) -> Any: ... _T = TypeVar("_T") @@ -23,7 +23,7 @@ class cached_property(Generic[_T]): func: Callable[..., _T] = ... __doc__: Any = ... name: str = ... - def __init__(self, func: Callable[..., _T], name: Optional[str] = ...): ... + def __init__(self, func: Callable[..., _T], name: Optional[str] = ...) -> None: ... @overload def __get__( self, instance: None, cls: Type[Any] = ... @@ -33,23 +33,25 @@ class cached_property(Generic[_T]): class Promise: ... -def lazy(func: Union[Callable, Type[str]], *resultclasses: Any) -> Callable: ... -def lazystr(text: Any): ... -def keep_lazy(*resultclasses: Any) -> Callable: ... -def keep_lazy_text(func: Callable) -> Callable: ... +def lazy( + func: Union[Callable[..., Any], Type[str]], *resultclasses: Any +) -> Callable[..., Any]: ... +def lazystr(text: Any) -> Any: ... +def keep_lazy(*resultclasses: Any) -> Callable[..., Any]: ... +def keep_lazy_text(func: Callable[..., Any]) -> Callable[..., Any]: ... empty: Any -def new_method_proxy(func: Any): ... +def new_method_proxy(func: Any) -> Any: ... class LazyObject: def __init__(self) -> None: ... __getattr__: Any = ... def __setattr__(self, name: str, value: Any) -> None: ... def __delattr__(self, name: str) -> None: ... - def __reduce__(self) -> Tuple[Callable, Tuple[Model]]: ... - def __copy__(self): ... - def __deepcopy__(self, memo: Any): ... + def __reduce__(self) -> Tuple[Callable[..., Any], Tuple[Model]]: ... + def __copy__(self) -> Any: ... + def __deepcopy__(self, memo: Any) -> Any: ... __bytes__: Any = ... __bool__: Any = ... __dir__: Any = ... @@ -66,12 +68,12 @@ class LazyObject: def unpickle_lazyobject(wrapped: Model) -> Model: ... class SimpleLazyObject(LazyObject): - def __init__(self, func: Callable) -> None: ... + def __init__(self, func: Callable[..., Any]) -> None: ... def __copy__(self) -> List[int]: ... def __deepcopy__(self, memo: Dict[Any, Any]) -> List[int]: ... _PartitionMember = TypeVar("_PartitionMember") def partition( - predicate: Callable, values: List[_PartitionMember] + predicate: Callable[..., Any], values: List[_PartitionMember] ) -> Tuple[List[_PartitionMember], List[_PartitionMember]]: ... diff --git a/django-stubs/utils/html.pyi b/django-stubs/utils/html.pyi index 2f697d746..2b9dc47f8 100644 --- a/django-stubs/utils/html.pyi +++ b/django-stubs/utils/html.pyi @@ -39,4 +39,4 @@ def urlize( autoescape: bool = ..., ) -> str: ... def avoid_wrapping(value: str) -> str: ... -def html_safe(klass: Any): ... +def html_safe(klass: Any) -> Any: ... diff --git a/django-stubs/utils/inspect.pyi b/django-stubs/utils/inspect.pyi index 9ae4d4f42..8563da031 100644 --- a/django-stubs/utils/inspect.pyi +++ b/django-stubs/utils/inspect.pyi @@ -1,8 +1,8 @@ -from typing import Callable, List, Tuple +from typing import Any, Callable, List, Tuple -def get_func_args(func: Callable) -> List[str]: ... -def get_func_full_args(func: Callable) -> List[Tuple[str]]: ... -def func_accepts_kwargs(func: Callable) -> bool: ... -def func_accepts_var_args(func: Callable) -> bool: ... -def method_has_no_args(meth: Callable) -> bool: ... -def func_supports_parameter(func: Callable, parameter: str) -> bool: ... +def get_func_args(func: Callable[..., Any]) -> List[str]: ... +def get_func_full_args(func: Callable[..., Any]) -> List[Tuple[str]]: ... +def func_accepts_kwargs(func: Callable[..., Any]) -> bool: ... +def func_accepts_var_args(func: Callable[..., Any]) -> bool: ... +def method_has_no_args(meth: Callable[..., Any]) -> bool: ... +def func_supports_parameter(func: Callable[..., Any], parameter: str) -> bool: ... diff --git a/django-stubs/utils/ipv6.pyi b/django-stubs/utils/ipv6.pyi index c96b4c95b..83c3de246 100644 --- a/django-stubs/utils/ipv6.pyi +++ b/django-stubs/utils/ipv6.pyi @@ -1,6 +1,4 @@ -from typing import Any - def clean_ipv6_address( - ip_str: Any, unpack_ipv4: bool = ..., error_message: Any = ... -): ... + ip_str: str, unpack_ipv4: bool = ..., error_message: str = ... +) -> str: ... def is_valid_ipv6_address(ip_str: str) -> bool: ... diff --git a/django-stubs/utils/log.pyi b/django-stubs/utils/log.pyi index 0c0a4b480..509bd6688 100644 --- a/django-stubs/utils/log.pyi +++ b/django-stubs/utils/log.pyi @@ -24,8 +24,8 @@ class AdminEmailHandler(logging.Handler): def format_subject(self, subject: str) -> str: ... class CallbackFilter(logging.Filter): - callback: Callable = ... - def __init__(self, callback: Callable) -> None: ... + callback: Callable[..., Any] = ... + def __init__(self, callback: Callable[..., Any]) -> None: ... def filter(self, record: Union[str, LogRecord]) -> bool: ... class RequireDebugFalse(logging.Filter): diff --git a/django-stubs/utils/regex_helper.pyi b/django-stubs/utils/regex_helper.pyi index 7f94850ea..a8432302d 100644 --- a/django-stubs/utils/regex_helper.pyi +++ b/django-stubs/utils/regex_helper.pyi @@ -2,9 +2,9 @@ from typing import Any, Iterator, List, Optional, Tuple, Type, Union ESCAPE_MAPPINGS: Any -class Choice(list): ... -class Group(list): ... -class NonCapture(list): ... +class Choice(List[Any]): ... +class Group(List[Any]): ... +class NonCapture(List[Any]): ... def normalize(pattern: str) -> List[Tuple[str, List[str]]]: ... def next_char(input_iter: Any) -> None: ... diff --git a/django-stubs/utils/safestring.pyi b/django-stubs/utils/safestring.pyi index 04fa2f62c..499489e87 100644 --- a/django-stubs/utils/safestring.pyi +++ b/django-stubs/utils/safestring.pyi @@ -17,7 +17,7 @@ class SafeText(str, SafeData): SafeString = SafeText -_C = TypeVar("_C", bound=Callable) +_C = TypeVar("_C", bound=Callable[..., Any]) @overload def mark_safe(s: _SD) -> _SD: ... @overload diff --git a/django-stubs/utils/termcolors.pyi b/django-stubs/utils/termcolors.pyi index ff9013fea..ec4f9e970 100644 --- a/django-stubs/utils/termcolors.pyi +++ b/django-stubs/utils/termcolors.pyi @@ -9,7 +9,7 @@ opt_dict: Any def colorize( text: Optional[str] = ..., opts: Sequence[str] = ..., **kwargs: Any ) -> str: ... -def make_style(opts: Tuple = ..., **kwargs: Any) -> Callable: ... +def make_style(opts: Tuple[Any, ...] = ..., **kwargs: Any) -> Callable[..., Any]: ... NOCOLOR_PALETTE: str DARK_PALETTE: str diff --git a/django-stubs/utils/text.pyi b/django-stubs/utils/text.pyi index 550220618..8aa10d0e1 100644 --- a/django-stubs/utils/text.pyi +++ b/django-stubs/utils/text.pyi @@ -35,8 +35,8 @@ class StreamingBuffer: def __init__(self) -> None: ... def write(self, val: bytes) -> None: ... def read(self) -> bytes: ... - def flush(self): ... - def close(self): ... + def flush(self) -> Any: ... + def close(self) -> Any: ... def compress_sequence(sequence: Iterable[bytes]) -> Iterator[bytes]: ... diff --git a/django-stubs/utils/translation/__init__.pyi b/django-stubs/utils/translation/__init__.pyi index 042aac31b..55cb21800 100644 --- a/django-stubs/utils/translation/__init__.pyi +++ b/django-stubs/utils/translation/__init__.pyi @@ -9,20 +9,20 @@ LANGUAGE_SESSION_KEY: str class TranslatorCommentWarning(SyntaxWarning): ... class Trans: - activate: Callable - check_for_language: functools._lru_cache_wrapper - deactivate: Callable - deactivate_all: Callable - get_language: Callable - get_language_bidi: Callable - get_language_from_path: Callable - get_language_from_request: Callable - gettext: Callable - gettext_noop: Callable - ngettext: Callable - npgettext: Callable - pgettext: Callable - def __getattr__(self, real_name: Any): ... + activate: Callable[..., Any] + check_for_language: functools._lru_cache_wrapper[Any] + deactivate: Callable[..., Any] + deactivate_all: Callable[..., Any] + get_language: Callable[..., Any] + get_language_bidi: Callable[..., Any] + get_language_from_path: Callable[..., Any] + get_language_from_request: Callable[..., Any] + gettext: Callable[..., Any] + gettext_noop: Callable[..., Any] + ngettext: Callable[..., Any] + npgettext: Callable[..., Any] + pgettext: Callable[..., Any] + def __getattr__(self, real_name: Any) -> Any: ... def gettext_noop(message: str) -> str: ... diff --git a/django-stubs/utils/translation/trans_null.pyi b/django-stubs/utils/translation/trans_null.pyi index 3d8418fe9..66643f520 100644 --- a/django-stubs/utils/translation/trans_null.pyi +++ b/django-stubs/utils/translation/trans_null.pyi @@ -1,6 +1,6 @@ from typing import Any -def gettext(message: Any): ... +def gettext(message: Any) -> Any: ... gettext_noop = gettext gettext_lazy = gettext @@ -10,14 +10,14 @@ def ngettext(singular: str, plural: str, number: int) -> str: ... ngettext_lazy = ngettext -def pgettext(context: Any, message: Any): ... -def npgettext(context: Any, singular: Any, plural: Any, number: Any): ... -def activate(x: Any): ... -def deactivate(): ... +def pgettext(context: Any, message: Any) -> Any: ... +def npgettext(context: Any, singular: Any, plural: Any, number: Any) -> Any: ... +def activate(x: Any) -> Any: ... +def deactivate() -> Any: ... deactivate_all = deactivate -def get_language(): ... +def get_language() -> Any: ... def get_language_bidi() -> bool: ... def check_for_language(x: str) -> bool: ... def get_language_from_request(request: None, check_path: bool = ...) -> str: ... diff --git a/django-stubs/utils/translation/trans_real.pyi b/django-stubs/utils/translation/trans_real.pyi index a332461e4..10092b748 100644 --- a/django-stubs/utils/translation/trans_real.pyi +++ b/django-stubs/utils/translation/trans_real.pyi @@ -14,7 +14,7 @@ def reset_cache(**kwargs: Any) -> None: ... class DjangoTranslation(gettext_module.GNUTranslations): domain: str = ... - plural: Callable = ... + plural: Callable[..., Any] = ... def __init__( self, language: str, @@ -22,7 +22,7 @@ class DjangoTranslation(gettext_module.GNUTranslations): localedirs: Optional[List[str]] = ..., ) -> None: ... def merge(self, other: NullTranslations) -> None: ... - def language(self): ... + def language(self) -> Any: ... def to_language(self) -> str: ... def translation(language: str) -> DjangoTranslation: ... @@ -31,7 +31,7 @@ def deactivate() -> None: ... def deactivate_all() -> None: ... def get_language() -> Optional[str]: ... def get_language_bidi() -> bool: ... -def catalog(): ... +def catalog() -> Any: ... def gettext(message: str) -> str: ... def pgettext(context: str, message: str) -> str: ... def gettext_noop(message: str) -> str: ... @@ -42,10 +42,10 @@ def ngettext(singular: str, plural: str, number: float) -> str: ... def npgettext(context: str, singular: str, plural: str, number: int) -> str: ... def all_locale_paths() -> List[str]: ... def check_for_language(lang_code: Optional[str]) -> bool: ... -def get_languages() -> OrderedDict: ... +def get_languages() -> OrderedDict[Any, Any]: ... def get_supported_language_variant( lang_code: Optional[str], strict: bool = ... ) -> str: ... def get_language_from_path(path: str, strict: bool = ...) -> Optional[str]: ... def get_language_from_request(request: WSGIRequest, check_path: bool = ...) -> str: ... -def parse_accept_lang_header(lang_string: str) -> Tuple: ... +def parse_accept_lang_header(lang_string: str) -> Tuple[Any, ...]: ... diff --git a/django-stubs/utils/version.pyi b/django-stubs/utils/version.pyi index db6f842ea..185ff74b4 100644 --- a/django-stubs/utils/version.pyi +++ b/django-stubs/utils/version.pyi @@ -11,5 +11,5 @@ def get_complete_version( version: Optional[Tuple[int, int, int, str, int]] = ... ) -> Tuple[int, int, int, str, int]: ... def get_docs_version(version: None = ...) -> str: ... -def get_git_changeset(): ... +def get_git_changeset() -> Any: ... def get_version_tuple(version: str) -> Tuple[int, int, int]: ... diff --git a/django-stubs/views/debug.pyi b/django-stubs/views/debug.pyi index 01c3a4cd7..346eebe7a 100644 --- a/django-stubs/views/debug.pyi +++ b/django-stubs/views/debug.pyi @@ -12,21 +12,23 @@ CLEANSED_SUBSTITUTE: str CURRENT_DIR: Any class CallableSettingWrapper: - def __init__(self, callable_setting: Union[Callable, Type[Any]]) -> None: ... + def __init__( + self, callable_setting: Union[Callable[..., Any], Type[Any]] + ) -> None: ... def cleanse_setting(key: Union[int, str], value: Any) -> Any: ... def get_safe_settings() -> Dict[str, Any]: ... def technical_500_response( request: Any, exc_type: Any, exc_value: Any, tb: Any, status_code: int = ... -): ... +) -> Any: ... def get_default_exception_reporter_filter() -> ExceptionReporterFilter: ... def get_exception_reporter_filter( request: Optional[HttpRequest], ) -> ExceptionReporterFilter: ... class ExceptionReporterFilter: - def get_post_parameters(self, request: Any): ... - def get_traceback_frame_variables(self, request: Any, tb_frame: Any): ... + def get_post_parameters(self, request: Any) -> Any: ... + def get_traceback_frame_variables(self, request: Any, tb_frame: Any) -> Any: ... class SafeExceptionReporterFilter(ExceptionReporterFilter): def is_active(self, request: Optional[HttpRequest]) -> bool: ... @@ -39,7 +41,7 @@ class SafeExceptionReporterFilter(ExceptionReporterFilter): def cleanse_special_types( self, request: Optional[HttpRequest], value: Any ) -> Any: ... - def get_traceback_frame_variables(self, request: Any, tb_frame: Any): ... + def get_traceback_frame_variables(self, request: Any, tb_frame: Any) -> Any: ... class ExceptionReporter: request: Optional[HttpRequest] = ... @@ -70,7 +72,7 @@ class ExceptionReporter: context_lines: int, loader: Optional[SourceLoader] = ..., module_name: Optional[str] = ..., - ): ... + ) -> Any: ... def technical_404_response( request: HttpRequest, exception: Http404 diff --git a/django-stubs/views/decorators/cache.pyi b/django-stubs/views/decorators/cache.pyi index 15ee83d1e..5cabe0b9b 100644 --- a/django-stubs/views/decorators/cache.pyi +++ b/django-stubs/views/decorators/cache.pyi @@ -4,6 +4,6 @@ _F = TypeVar("_F", bound=Callable[..., Any]) def cache_page( timeout: float, *, cache: Optional[Any] = ..., key_prefix: Optional[Any] = ... -) -> Callable: ... -def cache_control(**kwargs: Any) -> Callable: ... +) -> Callable[..., Any]: ... +def cache_control(**kwargs: Any) -> Callable[..., Any]: ... def never_cache(view_func: _F) -> _F: ... diff --git a/django-stubs/views/decorators/csrf.pyi b/django-stubs/views/decorators/csrf.pyi index 016f6669d..7e8a3474e 100644 --- a/django-stubs/views/decorators/csrf.pyi +++ b/django-stubs/views/decorators/csrf.pyi @@ -12,7 +12,7 @@ class _EnsureCsrfCookie(CsrfViewMiddleware): get_response: None def process_view( self, request: Any, callback: Any, callback_args: Any, callback_kwargs: Any - ): ... + ) -> Any: ... ensure_csrf_cookie: Any diff --git a/django-stubs/views/decorators/debug.pyi b/django-stubs/views/decorators/debug.pyi index e437d4e1f..47b2f6251 100644 --- a/django-stubs/views/decorators/debug.pyi +++ b/django-stubs/views/decorators/debug.pyi @@ -1,4 +1,4 @@ from typing import Any, Callable -def sensitive_variables(*variables: Any) -> Callable: ... -def sensitive_post_parameters(*parameters: Any) -> Callable: ... +def sensitive_variables(*variables: Any) -> Callable[..., Any]: ... +def sensitive_post_parameters(*parameters: Any) -> Callable[..., Any]: ... diff --git a/django-stubs/views/decorators/http.pyi b/django-stubs/views/decorators/http.pyi index 649e0f29a..be2c065a1 100644 --- a/django-stubs/views/decorators/http.pyi +++ b/django-stubs/views/decorators/http.pyi @@ -2,13 +2,14 @@ from typing import Any, Callable, List, Optional, TypeVar _F = TypeVar("_F", bound=Callable[..., Any]) -def conditional_page(_F) -> _F: ... +def conditional_page(func: _F) -> _F: ... def require_http_methods(request_method_list: List[str]) -> Callable[[_F], _F]: ... -def require_GET(_F) -> _F: ... -def require_POST(_F) -> _F: ... -def require_safe(_F) -> _F: ... +def require_GET(func: _F) -> _F: ... +def require_POST(func: _F) -> _F: ... +def require_safe(func: _F) -> _F: ... def condition( - etag_func: Optional[Callable] = ..., last_modified_func: Optional[Callable] = ... -) -> Callable: ... + etag_func: Optional[Callable[..., Any]] = ..., + last_modified_func: Optional[Callable[..., Any]] = ..., +) -> Callable[..., Any]: ... def etag(etag_func: Callable[..., Any]) -> Callable[[_F], _F]: ... def last_modified(last_modified_func: Callable[..., Any]) -> Callable[[_F], _F]: ... diff --git a/django-stubs/views/decorators/vary.pyi b/django-stubs/views/decorators/vary.pyi index 0601a4ae6..622f22f75 100644 --- a/django-stubs/views/decorators/vary.pyi +++ b/django-stubs/views/decorators/vary.pyi @@ -2,5 +2,5 @@ from typing import Any, Callable, TypeVar _F = TypeVar("_F", bound=Callable[..., Any]) -def vary_on_headers(*headers: Any) -> Callable: ... +def vary_on_headers(*headers: Any) -> Callable[..., Any]: ... def vary_on_cookie(func: _F) -> _F: ... diff --git a/django-stubs/views/generic/dates.pyi b/django-stubs/views/generic/dates.pyi index fcdf309ca..aef325deb 100644 --- a/django-stubs/views/generic/dates.pyi +++ b/django-stubs/views/generic/dates.pyi @@ -61,14 +61,14 @@ class BaseDateListView(MultipleObjectMixin, DateMixin, View): ) -> HttpResponse: ... def get(self, request: HttpRequest, *args: Any, **kwargs: Any) -> HttpResponse: ... def get_dated_items(self) -> DatedItems: ... - def get_dated_queryset(self, **lookup: Any) -> models.query.QuerySet: ... + def get_dated_queryset(self, **lookup: Any) -> models.query.QuerySet[Any]: ... def get_date_list_period(self) -> str: ... def get_date_list( self, - queryset: models.query.QuerySet, + queryset: models.query.QuerySet[Any], date_type: Optional[str] = ..., ordering: str = ..., - ) -> models.query.QuerySet: ... + ) -> models.query.QuerySet[Any]: ... class BaseArchiveIndexView(BaseDateListView): ... class ArchiveIndexView(MultipleObjectTemplateResponseMixin, BaseArchiveIndexView): ... diff --git a/django-stubs/views/generic/detail.pyi b/django-stubs/views/generic/detail.pyi index c04542255..71d56239d 100644 --- a/django-stubs/views/generic/detail.pyi +++ b/django-stubs/views/generic/detail.pyi @@ -6,16 +6,16 @@ from django.views.generic.base import ContextMixin, TemplateResponseMixin, View class SingleObjectMixin(ContextMixin): model: Type[models.Model] = ... - queryset: models.query.QuerySet = ... + queryset: models.query.QuerySet[Any] = ... slug_field: str = ... context_object_name: str = ... slug_url_kwarg: str = ... pk_url_kwarg: str = ... query_pk_and_slug: bool = ... def get_object( - self, queryset: Optional[models.query.QuerySet] = ... + self, queryset: Optional[models.query.QuerySet[Any]] = ... ) -> models.Model: ... - def get_queryset(self) -> models.query.QuerySet: ... + def get_queryset(self) -> models.query.QuerySet[Any]: ... def get_slug_field(self) -> str: ... def get_context_object_name(self, obj: Any) -> Optional[str]: ... diff --git a/django-stubs/views/generic/list.pyi b/django-stubs/views/generic/list.pyi index d6cfbf558..97adce263 100644 --- a/django-stubs/views/generic/list.pyi +++ b/django-stubs/views/generic/list.pyi @@ -8,7 +8,7 @@ from django.views.generic.base import ContextMixin, TemplateResponseMixin, View class MultipleObjectMixin(ContextMixin): allow_empty: bool = ... - queryset: Optional[QuerySet] = ... + queryset: Optional[QuerySet[Any]] = ... model: Optional[Type[Model]] = ... paginate_by: int = ... paginate_orphans: int = ... @@ -16,15 +16,15 @@ class MultipleObjectMixin(ContextMixin): paginator_class: Type[Paginator] = ... page_kwarg: str = ... ordering: Sequence[str] = ... - def get_queryset(self) -> QuerySet: ... + def get_queryset(self) -> QuerySet[Any]: ... def get_ordering(self) -> Sequence[str]: ... def paginate_queryset( - self, queryset: _BaseQuerySet, page_size: int - ) -> Tuple[Paginator, int, QuerySet, bool]: ... - def get_paginate_by(self, queryset: _BaseQuerySet) -> Optional[int]: ... + self, queryset: _BaseQuerySet[Any], page_size: int + ) -> Tuple[Paginator, int, QuerySet[Any], bool]: ... + def get_paginate_by(self, queryset: _BaseQuerySet[Any]) -> Optional[int]: ... def get_paginator( self, - queryset: QuerySet, + queryset: QuerySet[Any], per_page: int, orphans: int = ..., allow_empty_first_page: bool = ..., @@ -32,7 +32,9 @@ class MultipleObjectMixin(ContextMixin): ) -> Paginator: ... def get_paginate_orphans(self) -> int: ... def get_allow_empty(self) -> bool: ... - def get_context_object_name(self, object_list: _BaseQuerySet) -> Optional[str]: ... + def get_context_object_name( + self, object_list: _BaseQuerySet[Any] + ) -> Optional[str]: ... class BaseListView(MultipleObjectMixin, View): def get(self, request: HttpRequest, *args: Any, **kwargs: Any) -> HttpResponse: ... diff --git a/django-stubs/views/i18n.pyi b/django-stubs/views/i18n.pyi index c2706f64c..0325f1d29 100644 --- a/django-stubs/views/i18n.pyi +++ b/django-stubs/views/i18n.pyi @@ -14,13 +14,13 @@ js_catalog_template: str def render_javascript_catalog( catalog: Optional[Any] = ..., plural: Optional[Any] = ... -): ... +) -> Any: ... def null_javascript_catalog( request: Any, domain: Optional[Any] = ..., packages: Optional[Any] = ... -): ... +) -> Any: ... class JavaScriptCatalog(View): - head: Callable + head: Callable[..., Any] domain: str = ... packages: List[str] = ... translation: DjangoTranslation = ... diff --git a/django-stubs/views/static.pyi b/django-stubs/views/static.pyi index 4d914b006..1a4d17bbc 100644 --- a/django-stubs/views/static.pyi +++ b/django-stubs/views/static.pyi @@ -10,7 +10,7 @@ def serve( DEFAULT_DIRECTORY_INDEX_TEMPLATE: str template_translatable: Any -def directory_index(path: Any, fullpath: Any): ... +def directory_index(path: Any, fullpath: Any) -> Any: ... def was_modified_since( header: Optional[str] = ..., mtime: float = ..., size: int = ... ) -> bool: ... diff --git a/psycopg2-stubs/_range.pyi b/psycopg2-stubs/_range.pyi new file mode 100644 index 000000000..b218cf83c --- /dev/null +++ b/psycopg2-stubs/_range.pyi @@ -0,0 +1,5 @@ +class Range: ... +class NumericRange(Range): ... +class DateRange(Range): ... +class DateTimeRange(Range): ... +class DateTimeTZRange(Range): ... diff --git a/psycopg2-stubs/extensions.pyi b/psycopg2-stubs/extensions.pyi index 311ecf8b6..f2cb77c4e 100644 --- a/psycopg2-stubs/extensions.pyi +++ b/psycopg2-stubs/extensions.pyi @@ -54,7 +54,6 @@ _TransactionStatus = Literal[0, 1, 2, 3, 4] _Mixed = Union[None, bool, int, float, Decimal, str, bytes, datetime, UUID] _SQLType = Union[_Mixed, Sequence[_Mixed], Mapping[str, _Mixed]] - class cursor: def __init__(self, conn: _connection) -> None: ... @property diff --git a/psycopg2-stubs/extras.pyi b/psycopg2-stubs/extras.pyi new file mode 100644 index 000000000..972fd4564 --- /dev/null +++ b/psycopg2-stubs/extras.pyi @@ -0,0 +1,4 @@ +from psycopg2._range import DateRange as DateRange +from psycopg2._range import DateTimeTZRange as DateTimeTZRange +from psycopg2._range import NumericRange as NumericRange +from psycopg2._range import Range as Range diff --git a/s/lint b/s/lint index 5ddacd870..a109e5765 100755 --- a/s/lint +++ b/s/lint @@ -9,15 +9,15 @@ fi # format code if [[ $CI ]]; then - ./.venv/bin/black --check . - ./.venv/bin/isort --check-only . + ./.venv/bin/black --check tests typings + ./.venv/bin/isort --check-only tests typings else - ./.venv/bin/black . - ./.venv/bin/isort . + ./.venv/bin/black tests typings + ./.venv/bin/isort tests typings fi # type check code -./.venv/bin/mypy tests +./.venv/bin/mypy tests typings # lint -./.venv/bin/flake8 tests +./.venv/bin/flake8 tests typings diff --git a/tests/trout/models.py b/tests/trout/models.py index 2613316c4..9c4d3af3d 100644 --- a/tests/trout/models.py +++ b/tests/trout/models.py @@ -18,6 +18,8 @@ from django.db import connection, connections, models from django.db.backends.utils import CursorWrapper from django.db.models.manager import RelatedManager +from django.http.request import HttpRequest +from django.views.decorators.http import require_GET, require_POST from psycopg2 import ProgrammingError from psycopg2.extensions import parse_dsn @@ -161,6 +163,10 @@ class Comment(models.Model): "User", on_delete=models.CASCADE, help_text="owner of the comment" ) + auth_token = models.ForeignKey["Optional[User]"]( + "User", null=True, on_delete=models.CASCADE, help_text="" + ) + user_type = models.ForeignKey(User, on_delete=models.CASCADE) user_str = models.ForeignKey("User", on_delete=models.CASCADE) # type: ignore [var-annotated] nullable_user_type = models.ForeignKey(User, on_delete=models.CASCADE, null=True) @@ -196,11 +202,19 @@ def process_non_nullable( def main() -> None: + request = HttpRequest() + header = request.headers.get("FOO") + if header is not None and not isinstance(header, str): + print(header) # type: ignore [unreachable] + else: + print(header) + post = Post() print(post.id) # type: ignore [attr-defined] comment = Comment() + comment.auth_token = User() comment.save() # Django way to duplicate an instance @@ -560,23 +574,23 @@ def raw_database_queries() -> None: with connection.cursor() as cursor: cursor.execute( """ - SELECT id, name - FROM - table - WHERE - field = %s AND other_field = ANY(%s); - """, + SELECT id, name + FROM + table + WHERE + field = %s AND other_field = ANY(%s); + """, ["foo", list(other_field_values)], ) cursor.execute( """ - SELECT id, name - FROM table - WHERE - id = %(foo)s - and name = ANY(%(bar)s) - and address = ANY(%(buzz)s) - """, + SELECT id, name + FROM table + WHERE + id = %(foo)s + and name = ANY(%(bar)s) + and address = ANY(%(buzz)s) + """, dict(foo="foo", bar=["id-1", "id-2"], buzz=[1, 2, 3]), ) cursor.execute("", {"foo_ids": ("foo", "bar")}) @@ -677,6 +691,19 @@ def test_psycopg2() -> None: assert cursor.fetchone() is not None +# test decorators + + +@require_POST +def post_data_view(request: HttpRequest, id: str) -> None: + return None + + +@require_GET +def get_data_view(request: HttpRequest, id: str) -> None: + return None + + def test_psycopg_top_level_exports() -> None: psycopg2.BINARY psycopg2.Binary From 9fd3372db1c126c58c86d0d7f47f4933faac6907 Mon Sep 17 00:00:00 2001 From: Steve Dignam Date: Fri, 26 Feb 2021 09:27:22 -0500 Subject: [PATCH 24/88] ref: move stubs into typings folder to enable linting --- django-stubs | 1 + psycopg2-stubs | 1 + {django-stubs => typings/django}/__init__.pyi | 0 {django-stubs => typings/django}/apps/__init__.pyi | 0 {django-stubs => typings/django}/apps/config.pyi | 0 {django-stubs => typings/django}/apps/registry.pyi | 0 {django-stubs => typings/django}/conf/__init__.pyi | 0 {django-stubs => typings/django}/conf/global_settings.pyi | 0 {django-stubs => typings/django}/conf/locale/__init__.pyi | 0 {django-stubs => typings/django}/conf/urls/__init__.pyi | 0 {django-stubs => typings/django}/conf/urls/i18n.pyi | 0 {django-stubs => typings/django}/conf/urls/static.pyi | 0 {django-stubs => typings/django}/contrib/__init__.pyi | 0 {django-stubs => typings/django}/contrib/admin/__init__.pyi | 0 {django-stubs => typings/django}/contrib/admin/actions.pyi | 0 {django-stubs => typings/django}/contrib/admin/apps.pyi | 0 {django-stubs => typings/django}/contrib/admin/checks.pyi | 0 {django-stubs => typings/django}/contrib/admin/decorators.pyi | 0 {django-stubs => typings/django}/contrib/admin/exceptions.pyi | 0 {django-stubs => typings/django}/contrib/admin/filters.pyi | 0 {django-stubs => typings/django}/contrib/admin/forms.pyi | 0 {django-stubs => typings/django}/contrib/admin/helpers.pyi | 0 .../django}/contrib/admin/migrations/__init__.pyi | 0 {django-stubs => typings/django}/contrib/admin/models.pyi | 0 {django-stubs => typings/django}/contrib/admin/options.pyi | 0 {django-stubs => typings/django}/contrib/admin/sites.pyi | 0 .../django}/contrib/admin/templatetags/__init__.pyi | 0 .../django}/contrib/admin/templatetags/admin_list.pyi | 0 .../django}/contrib/admin/templatetags/admin_modify.pyi | 0 .../django}/contrib/admin/templatetags/admin_static.pyi | 0 .../django}/contrib/admin/templatetags/admin_urls.pyi | 0 .../django}/contrib/admin/templatetags/base.pyi | 0 .../django}/contrib/admin/templatetags/log.pyi | 0 {django-stubs => typings/django}/contrib/admin/tests.pyi | 0 {django-stubs => typings/django}/contrib/admin/utils.pyi | 0 .../django}/contrib/admin/views/__init__.pyi | 0 .../django}/contrib/admin/views/autocomplete.pyi | 0 .../django}/contrib/admin/views/decorators.pyi | 0 {django-stubs => typings/django}/contrib/admin/views/main.pyi | 0 {django-stubs => typings/django}/contrib/admin/widgets.pyi | 0 {django-stubs => typings/django}/contrib/admindocs/__init__.pyi | 0 {django-stubs => typings/django}/contrib/admindocs/apps.pyi | 0 .../django}/contrib/admindocs/middleware.pyi | 0 {django-stubs => typings/django}/contrib/admindocs/urls.pyi | 0 {django-stubs => typings/django}/contrib/admindocs/utils.pyi | 0 {django-stubs => typings/django}/contrib/admindocs/views.pyi | 0 {django-stubs => typings/django}/contrib/auth/__init__.pyi | 0 {django-stubs => typings/django}/contrib/auth/admin.pyi | 0 {django-stubs => typings/django}/contrib/auth/apps.pyi | 0 {django-stubs => typings/django}/contrib/auth/backends.pyi | 0 {django-stubs => typings/django}/contrib/auth/base_user.pyi | 0 {django-stubs => typings/django}/contrib/auth/checks.pyi | 0 .../django}/contrib/auth/context_processors.pyi | 0 {django-stubs => typings/django}/contrib/auth/decorators.pyi | 0 {django-stubs => typings/django}/contrib/auth/forms.pyi | 0 .../django}/contrib/auth/handlers/__init__.pyi | 0 .../django}/contrib/auth/handlers/modwsgi.pyi | 0 {django-stubs => typings/django}/contrib/auth/hashers.pyi | 0 .../django}/contrib/auth/management/__init__.pyi | 0 .../django}/contrib/auth/management/commands/__init__.pyi | 0 .../django}/contrib/auth/management/commands/changepassword.pyi | 0 .../django}/contrib/auth/management/commands/createsuperuser.pyi | 0 {django-stubs => typings/django}/contrib/auth/middleware.pyi | 0 .../django}/contrib/auth/migrations/__init__.pyi | 0 {django-stubs => typings/django}/contrib/auth/mixins.pyi | 0 {django-stubs => typings/django}/contrib/auth/models.pyi | 0 .../django}/contrib/auth/password_validation.pyi | 0 {django-stubs => typings/django}/contrib/auth/signals.pyi | 0 {django-stubs => typings/django}/contrib/auth/tokens.pyi | 0 {django-stubs => typings/django}/contrib/auth/urls.pyi | 0 {django-stubs => typings/django}/contrib/auth/validators.pyi | 0 {django-stubs => typings/django}/contrib/auth/views.pyi | 0 .../django}/contrib/contenttypes/__init__.pyi | 0 {django-stubs => typings/django}/contrib/contenttypes/admin.pyi | 0 {django-stubs => typings/django}/contrib/contenttypes/apps.pyi | 0 {django-stubs => typings/django}/contrib/contenttypes/checks.pyi | 0 {django-stubs => typings/django}/contrib/contenttypes/fields.pyi | 0 {django-stubs => typings/django}/contrib/contenttypes/forms.pyi | 0 .../django}/contrib/contenttypes/management/__init__.pyi | 0 .../contrib/contenttypes/management/commands/__init__.pyi | 0 .../management/commands/remove_stale_contenttypes.pyi | 0 .../django}/contrib/contenttypes/migrations/__init__.pyi | 0 {django-stubs => typings/django}/contrib/contenttypes/models.pyi | 0 {django-stubs => typings/django}/contrib/contenttypes/views.pyi | 0 {django-stubs => typings/django}/contrib/flatpages/__init__.pyi | 0 {django-stubs => typings/django}/contrib/flatpages/admin.pyi | 0 {django-stubs => typings/django}/contrib/flatpages/apps.pyi | 0 {django-stubs => typings/django}/contrib/flatpages/forms.pyi | 0 .../django}/contrib/flatpages/middleware.pyi | 0 .../django}/contrib/flatpages/migrations/__init__.pyi | 0 {django-stubs => typings/django}/contrib/flatpages/models.pyi | 0 {django-stubs => typings/django}/contrib/flatpages/sitemaps.pyi | 0 .../django}/contrib/flatpages/templatetags/__init__.pyi | 0 .../django}/contrib/flatpages/templatetags/flatpages.pyi | 0 {django-stubs => typings/django}/contrib/flatpages/urls.pyi | 0 {django-stubs => typings/django}/contrib/flatpages/views.pyi | 0 {django-stubs => typings/django}/contrib/gis/__init__.pyi | 0 {django-stubs => typings/django}/contrib/gis/admin/__init__.pyi | 0 {django-stubs => typings/django}/contrib/gis/admin/options.pyi | 0 {django-stubs => typings/django}/contrib/gis/admin/widgets.pyi | 0 {django-stubs => typings/django}/contrib/gis/apps.pyi | 0 {django-stubs => typings/django}/contrib/gis/db/__init__.pyi | 0 .../django}/contrib/gis/db/backends/__init__.pyi | 0 .../django}/contrib/gis/db/backends/base/__init__.pyi | 0 .../django}/contrib/gis/db/backends/base/adapter.pyi | 0 .../django}/contrib/gis/db/backends/base/features.pyi | 0 .../django}/contrib/gis/db/backends/base/models.pyi | 0 .../django}/contrib/gis/db/backends/base/operations.pyi | 0 .../django}/contrib/gis/db/backends/mysql/__init__.pyi | 0 .../django}/contrib/gis/db/backends/mysql/base.pyi | 0 .../django}/contrib/gis/db/backends/mysql/features.pyi | 0 .../django}/contrib/gis/db/backends/mysql/introspection.pyi | 0 .../django}/contrib/gis/db/backends/mysql/operations.pyi | 0 .../django}/contrib/gis/db/backends/mysql/schema.pyi | 0 .../django}/contrib/gis/db/backends/oracle/__init__.pyi | 0 .../django}/contrib/gis/db/backends/oracle/adapter.pyi | 0 .../django}/contrib/gis/db/backends/oracle/base.pyi | 0 .../django}/contrib/gis/db/backends/oracle/features.pyi | 0 .../django}/contrib/gis/db/backends/oracle/introspection.pyi | 0 .../django}/contrib/gis/db/backends/oracle/models.pyi | 0 .../django}/contrib/gis/db/backends/oracle/operations.pyi | 0 .../django}/contrib/gis/db/backends/oracle/schema.pyi | 0 .../django}/contrib/gis/db/backends/postgis/__init__.pyi | 0 .../django}/contrib/gis/db/backends/postgis/adapter.pyi | 0 .../django}/contrib/gis/db/backends/postgis/base.pyi | 0 .../django}/contrib/gis/db/backends/postgis/const.pyi | 0 .../django}/contrib/gis/db/backends/postgis/features.pyi | 0 .../django}/contrib/gis/db/backends/postgis/introspection.pyi | 0 .../django}/contrib/gis/db/backends/postgis/models.pyi | 0 .../django}/contrib/gis/db/backends/postgis/operations.pyi | 0 .../django}/contrib/gis/db/backends/postgis/pgraster.pyi | 0 .../django}/contrib/gis/db/backends/postgis/schema.pyi | 0 .../django}/contrib/gis/db/backends/spatialite/__init__.pyi | 0 .../django}/contrib/gis/db/backends/spatialite/adapter.pyi | 0 .../django}/contrib/gis/db/backends/spatialite/base.pyi | 0 .../django}/contrib/gis/db/backends/spatialite/client.pyi | 0 .../django}/contrib/gis/db/backends/spatialite/features.pyi | 0 .../django}/contrib/gis/db/backends/spatialite/introspection.pyi | 0 .../django}/contrib/gis/db/backends/spatialite/models.pyi | 0 .../django}/contrib/gis/db/backends/spatialite/operations.pyi | 0 .../django}/contrib/gis/db/backends/spatialite/schema.pyi | 0 .../django}/contrib/gis/db/backends/utils.pyi | 0 .../django}/contrib/gis/db/models/__init__.pyi | 0 .../django}/contrib/gis/db/models/aggregates.pyi | 0 .../django}/contrib/gis/db/models/fields.pyi | 0 .../django}/contrib/gis/db/models/functions.pyi | 0 .../django}/contrib/gis/db/models/lookups.pyi | 0 {django-stubs => typings/django}/contrib/gis/db/models/proxy.pyi | 0 .../django}/contrib/gis/db/models/sql/__init__.pyi | 0 .../django}/contrib/gis/db/models/sql/conversion.pyi | 0 {django-stubs => typings/django}/contrib/gis/feeds.pyi | 0 {django-stubs => typings/django}/contrib/gis/forms/__init__.pyi | 0 {django-stubs => typings/django}/contrib/gis/forms/fields.pyi | 0 {django-stubs => typings/django}/contrib/gis/forms/widgets.pyi | 0 {django-stubs => typings/django}/contrib/gis/gdal/__init__.pyi | 0 {django-stubs => typings/django}/contrib/gis/gdal/base.pyi | 0 {django-stubs => typings/django}/contrib/gis/gdal/datasource.pyi | 0 {django-stubs => typings/django}/contrib/gis/gdal/driver.pyi | 0 {django-stubs => typings/django}/contrib/gis/gdal/envelope.pyi | 0 {django-stubs => typings/django}/contrib/gis/gdal/error.pyi | 0 {django-stubs => typings/django}/contrib/gis/gdal/feature.pyi | 0 {django-stubs => typings/django}/contrib/gis/gdal/field.pyi | 0 {django-stubs => typings/django}/contrib/gis/gdal/geometries.pyi | 0 {django-stubs => typings/django}/contrib/gis/gdal/geomtype.pyi | 0 {django-stubs => typings/django}/contrib/gis/gdal/layer.pyi | 0 {django-stubs => typings/django}/contrib/gis/gdal/libgdal.pyi | 0 .../django}/contrib/gis/gdal/prototypes/__init__.pyi | 0 .../django}/contrib/gis/gdal/prototypes/ds.pyi | 0 .../django}/contrib/gis/gdal/prototypes/errcheck.pyi | 0 .../django}/contrib/gis/gdal/prototypes/generation.pyi | 0 .../django}/contrib/gis/gdal/prototypes/geom.pyi | 0 .../django}/contrib/gis/gdal/prototypes/raster.pyi | 0 .../django}/contrib/gis/gdal/prototypes/srs.pyi | 0 .../django}/contrib/gis/gdal/raster/__init__.pyi | 0 .../django}/contrib/gis/gdal/raster/band.pyi | 0 .../django}/contrib/gis/gdal/raster/base.pyi | 0 .../django}/contrib/gis/gdal/raster/const.pyi | 0 .../django}/contrib/gis/gdal/raster/source.pyi | 0 {django-stubs => typings/django}/contrib/gis/gdal/srs.pyi | 0 {django-stubs => typings/django}/contrib/gis/geoip2/__init__.pyi | 0 {django-stubs => typings/django}/contrib/gis/geoip2/base.pyi | 0 .../django}/contrib/gis/geoip2/resources.pyi | 0 {django-stubs => typings/django}/contrib/gis/geometry.pyi | 0 {django-stubs => typings/django}/contrib/gis/geos/__init__.pyi | 0 {django-stubs => typings/django}/contrib/gis/geos/base.pyi | 0 .../django}/contrib/gis/geos/collections.pyi | 0 {django-stubs => typings/django}/contrib/gis/geos/coordseq.pyi | 0 {django-stubs => typings/django}/contrib/gis/geos/error.pyi | 0 {django-stubs => typings/django}/contrib/gis/geos/factory.pyi | 0 {django-stubs => typings/django}/contrib/gis/geos/geometry.pyi | 0 {django-stubs => typings/django}/contrib/gis/geos/io.pyi | 0 {django-stubs => typings/django}/contrib/gis/geos/libgeos.pyi | 0 {django-stubs => typings/django}/contrib/gis/geos/linestring.pyi | 0 .../django}/contrib/gis/geos/mutable_list.pyi | 0 {django-stubs => typings/django}/contrib/gis/geos/point.pyi | 0 {django-stubs => typings/django}/contrib/gis/geos/polygon.pyi | 0 {django-stubs => typings/django}/contrib/gis/geos/prepared.pyi | 0 .../django}/contrib/gis/geos/prototypes/__init__.pyi | 0 .../django}/contrib/gis/geos/prototypes/coordseq.pyi | 0 .../django}/contrib/gis/geos/prototypes/errcheck.pyi | 0 .../django}/contrib/gis/geos/prototypes/geom.pyi | 0 .../django}/contrib/gis/geos/prototypes/io.pyi | 0 .../django}/contrib/gis/geos/prototypes/misc.pyi | 0 .../django}/contrib/gis/geos/prototypes/predicates.pyi | 0 .../django}/contrib/gis/geos/prototypes/prepared.pyi | 0 .../django}/contrib/gis/geos/prototypes/threadsafe.pyi | 0 .../django}/contrib/gis/geos/prototypes/topology.pyi | 0 {django-stubs => typings/django}/contrib/gis/measure.pyi | 0 {django-stubs => typings/django}/contrib/gis/ptr.pyi | 0 .../django}/contrib/gis/serializers/__init__.pyi | 0 .../django}/contrib/gis/serializers/geojson.pyi | 0 {django-stubs => typings/django}/contrib/gis/shortcuts.pyi | 0 .../django}/contrib/gis/sitemaps/__init__.pyi | 0 {django-stubs => typings/django}/contrib/gis/sitemaps/kml.pyi | 0 {django-stubs => typings/django}/contrib/gis/sitemaps/views.pyi | 0 {django-stubs => typings/django}/contrib/gis/utils/__init__.pyi | 0 .../django}/contrib/gis/utils/layermapping.pyi | 0 {django-stubs => typings/django}/contrib/gis/utils/ogrinfo.pyi | 0 .../django}/contrib/gis/utils/ogrinspect.pyi | 0 {django-stubs => typings/django}/contrib/gis/utils/srs.pyi | 0 {django-stubs => typings/django}/contrib/gis/views.pyi | 0 {django-stubs => typings/django}/contrib/humanize/__init__.pyi | 0 {django-stubs => typings/django}/contrib/humanize/apps.pyi | 0 .../django}/contrib/humanize/templatetags/__init__.pyi | 0 .../django}/contrib/humanize/templatetags/humanize.pyi | 0 {django-stubs => typings/django}/contrib/messages/__init__.pyi | 0 {django-stubs => typings/django}/contrib/messages/api.pyi | 0 {django-stubs => typings/django}/contrib/messages/apps.pyi | 0 {django-stubs => typings/django}/contrib/messages/constants.pyi | 0 .../django}/contrib/messages/context_processors.pyi | 0 {django-stubs => typings/django}/contrib/messages/middleware.pyi | 0 .../django}/contrib/messages/storage/__init__.pyi | 0 .../django}/contrib/messages/storage/base.pyi | 0 .../django}/contrib/messages/storage/cookie.pyi | 0 .../django}/contrib/messages/storage/fallback.pyi | 0 .../django}/contrib/messages/storage/session.pyi | 0 {django-stubs => typings/django}/contrib/messages/utils.pyi | 0 {django-stubs => typings/django}/contrib/messages/views.pyi | 0 {django-stubs => typings/django}/contrib/postgres/__init__.pyi | 0 .../django}/contrib/postgres/aggregates/__init__.pyi | 0 .../django}/contrib/postgres/aggregates/general.pyi | 0 .../django}/contrib/postgres/aggregates/mixins.pyi | 0 .../django}/contrib/postgres/aggregates/statistics.pyi | 0 {django-stubs => typings/django}/contrib/postgres/apps.pyi | 0 .../django}/contrib/postgres/constraints.pyi | 0 .../django}/contrib/postgres/fields/__init__.pyi | 0 .../django}/contrib/postgres/fields/array.pyi | 0 .../django}/contrib/postgres/fields/citext.pyi | 0 .../django}/contrib/postgres/fields/hstore.pyi | 0 .../django}/contrib/postgres/fields/jsonb.pyi | 0 .../django}/contrib/postgres/fields/mixins.pyi | 0 .../django}/contrib/postgres/fields/ranges.pyi | 0 .../django}/contrib/postgres/fields/utils.pyi | 0 {django-stubs => typings/django}/contrib/postgres/functions.pyi | 0 {django-stubs => typings/django}/contrib/postgres/indexes.pyi | 0 {django-stubs => typings/django}/contrib/postgres/lookups.pyi | 0 {django-stubs => typings/django}/contrib/postgres/operations.pyi | 0 {django-stubs => typings/django}/contrib/postgres/search.pyi | 0 .../django}/contrib/postgres/serializers.pyi | 0 {django-stubs => typings/django}/contrib/postgres/signals.pyi | 0 {django-stubs => typings/django}/contrib/postgres/utils.pyi | 0 {django-stubs => typings/django}/contrib/postgres/validators.pyi | 0 {django-stubs => typings/django}/contrib/redirects/__init__.pyi | 0 {django-stubs => typings/django}/contrib/redirects/admin.pyi | 0 {django-stubs => typings/django}/contrib/redirects/apps.pyi | 0 .../django}/contrib/redirects/middleware.pyi | 0 .../django}/contrib/redirects/migrations/__init__.pyi | 0 {django-stubs => typings/django}/contrib/redirects/models.pyi | 0 {django-stubs => typings/django}/contrib/sessions/__init__.pyi | 0 {django-stubs => typings/django}/contrib/sessions/apps.pyi | 0 .../django}/contrib/sessions/backends/__init__.pyi | 0 .../django}/contrib/sessions/backends/base.pyi | 0 .../django}/contrib/sessions/backends/cache.pyi | 0 .../django}/contrib/sessions/backends/cached_db.pyi | 0 .../django}/contrib/sessions/backends/db.pyi | 0 .../django}/contrib/sessions/backends/file.pyi | 0 .../django}/contrib/sessions/backends/signed_cookies.pyi | 0 .../django}/contrib/sessions/base_session.pyi | 0 {django-stubs => typings/django}/contrib/sessions/exceptions.pyi | 0 .../django}/contrib/sessions/management/__init__.pyi | 0 .../django}/contrib/sessions/management/commands/__init__.pyi | 0 .../contrib/sessions/management/commands/clearsessions.pyi | 0 {django-stubs => typings/django}/contrib/sessions/middleware.pyi | 0 .../django}/contrib/sessions/migrations/__init__.pyi | 0 {django-stubs => typings/django}/contrib/sessions/models.pyi | 0 .../django}/contrib/sessions/serializers.pyi | 0 {django-stubs => typings/django}/contrib/sitemaps/__init__.pyi | 0 {django-stubs => typings/django}/contrib/sitemaps/apps.pyi | 0 .../django}/contrib/sitemaps/management/__init__.pyi | 0 .../django}/contrib/sitemaps/management/commands/__init__.pyi | 0 .../django}/contrib/sitemaps/management/commands/ping_google.pyi | 0 {django-stubs => typings/django}/contrib/sitemaps/views.pyi | 0 {django-stubs => typings/django}/contrib/sites/__init__.pyi | 0 {django-stubs => typings/django}/contrib/sites/admin.pyi | 0 {django-stubs => typings/django}/contrib/sites/apps.pyi | 0 {django-stubs => typings/django}/contrib/sites/management.pyi | 0 {django-stubs => typings/django}/contrib/sites/managers.pyi | 0 {django-stubs => typings/django}/contrib/sites/middleware.pyi | 0 .../django}/contrib/sites/migrations/__init__.pyi | 0 {django-stubs => typings/django}/contrib/sites/models.pyi | 0 {django-stubs => typings/django}/contrib/sites/requests.pyi | 0 {django-stubs => typings/django}/contrib/sites/shortcuts.pyi | 0 .../django}/contrib/staticfiles/__init__.pyi | 0 {django-stubs => typings/django}/contrib/staticfiles/apps.pyi | 0 {django-stubs => typings/django}/contrib/staticfiles/checks.pyi | 0 {django-stubs => typings/django}/contrib/staticfiles/finders.pyi | 0 .../django}/contrib/staticfiles/handlers.pyi | 0 .../django}/contrib/staticfiles/management/__init__.pyi | 0 .../django}/contrib/staticfiles/management/commands/__init__.pyi | 0 .../contrib/staticfiles/management/commands/collectstatic.pyi | 0 .../contrib/staticfiles/management/commands/findstatic.pyi | 0 .../contrib/staticfiles/management/commands/runserver.pyi | 0 {django-stubs => typings/django}/contrib/staticfiles/storage.pyi | 0 .../django}/contrib/staticfiles/templatetags/__init__.pyi | 0 .../django}/contrib/staticfiles/templatetags/staticfiles.pyi | 0 {django-stubs => typings/django}/contrib/staticfiles/testing.pyi | 0 {django-stubs => typings/django}/contrib/staticfiles/urls.pyi | 0 {django-stubs => typings/django}/contrib/staticfiles/utils.pyi | 0 {django-stubs => typings/django}/contrib/staticfiles/views.pyi | 0 .../django}/contrib/syndication/__init__.pyi | 0 {django-stubs => typings/django}/contrib/syndication/apps.pyi | 0 {django-stubs => typings/django}/contrib/syndication/views.pyi | 0 {django-stubs => typings/django}/core/__init__.pyi | 0 {django-stubs => typings/django}/core/asgi.pyi | 0 {django-stubs => typings/django}/core/cache/__init__.pyi | 0 .../django}/core/cache/backends/__init__.pyi | 0 {django-stubs => typings/django}/core/cache/backends/base.pyi | 0 {django-stubs => typings/django}/core/cache/backends/db.pyi | 0 {django-stubs => typings/django}/core/cache/backends/dummy.pyi | 0 .../django}/core/cache/backends/filebased.pyi | 0 {django-stubs => typings/django}/core/cache/backends/locmem.pyi | 0 .../django}/core/cache/backends/memcached.pyi | 0 {django-stubs => typings/django}/core/cache/utils.pyi | 0 {django-stubs => typings/django}/core/checks/__init__.pyi | 0 {django-stubs => typings/django}/core/checks/async_checks.pyi | 0 {django-stubs => typings/django}/core/checks/caches.pyi | 0 .../django}/core/checks/compatibility/__init__.pyi | 0 {django-stubs => typings/django}/core/checks/database.pyi | 0 {django-stubs => typings/django}/core/checks/messages.pyi | 0 {django-stubs => typings/django}/core/checks/model_checks.pyi | 0 {django-stubs => typings/django}/core/checks/registry.pyi | 0 .../django}/core/checks/security/__init__.pyi | 0 {django-stubs => typings/django}/core/checks/security/base.pyi | 0 {django-stubs => typings/django}/core/checks/security/csrf.pyi | 0 .../django}/core/checks/security/sessions.pyi | 0 {django-stubs => typings/django}/core/checks/templates.pyi | 0 {django-stubs => typings/django}/core/checks/translation.pyi | 0 {django-stubs => typings/django}/core/checks/urls.pyi | 0 {django-stubs => typings/django}/core/exceptions.pyi | 0 {django-stubs => typings/django}/core/files/__init__.pyi | 0 {django-stubs => typings/django}/core/files/base.pyi | 0 {django-stubs => typings/django}/core/files/images.pyi | 0 {django-stubs => typings/django}/core/files/locks.pyi | 0 {django-stubs => typings/django}/core/files/move.pyi | 0 {django-stubs => typings/django}/core/files/storage.pyi | 0 {django-stubs => typings/django}/core/files/temp.pyi | 0 {django-stubs => typings/django}/core/files/uploadedfile.pyi | 0 {django-stubs => typings/django}/core/files/uploadhandler.pyi | 0 {django-stubs => typings/django}/core/files/utils.pyi | 0 {django-stubs => typings/django}/core/handlers/__init__.pyi | 0 {django-stubs => typings/django}/core/handlers/asgi.pyi | 0 {django-stubs => typings/django}/core/handlers/base.pyi | 0 {django-stubs => typings/django}/core/handlers/exception.pyi | 0 {django-stubs => typings/django}/core/handlers/wsgi.pyi | 0 {django-stubs => typings/django}/core/mail/__init__.pyi | 0 {django-stubs => typings/django}/core/mail/backends/__init__.pyi | 0 {django-stubs => typings/django}/core/mail/backends/base.pyi | 0 {django-stubs => typings/django}/core/mail/backends/console.pyi | 0 {django-stubs => typings/django}/core/mail/backends/dummy.pyi | 0 .../django}/core/mail/backends/filebased.pyi | 0 {django-stubs => typings/django}/core/mail/backends/locmem.pyi | 0 {django-stubs => typings/django}/core/mail/backends/smtp.pyi | 0 {django-stubs => typings/django}/core/mail/message.pyi | 0 {django-stubs => typings/django}/core/mail/utils.pyi | 0 {django-stubs => typings/django}/core/management/__init__.pyi | 0 {django-stubs => typings/django}/core/management/base.pyi | 0 {django-stubs => typings/django}/core/management/color.pyi | 0 .../django}/core/management/commands/__init__.pyi | 0 .../django}/core/management/commands/check.pyi | 0 .../django}/core/management/commands/compilemessages.pyi | 0 .../django}/core/management/commands/createcachetable.pyi | 0 .../django}/core/management/commands/dbshell.pyi | 0 .../django}/core/management/commands/diffsettings.pyi | 0 .../django}/core/management/commands/dumpdata.pyi | 0 .../django}/core/management/commands/flush.pyi | 0 .../django}/core/management/commands/inspectdb.pyi | 0 .../django}/core/management/commands/loaddata.pyi | 0 .../django}/core/management/commands/makemessages.pyi | 0 .../django}/core/management/commands/makemigrations.pyi | 0 .../django}/core/management/commands/migrate.pyi | 0 .../django}/core/management/commands/runserver.pyi | 0 .../django}/core/management/commands/sendtestemail.pyi | 0 .../django}/core/management/commands/shell.pyi | 0 .../django}/core/management/commands/showmigrations.pyi | 0 .../django}/core/management/commands/sqlflush.pyi | 0 .../django}/core/management/commands/sqlmigrate.pyi | 0 .../django}/core/management/commands/sqlsequencereset.pyi | 0 .../django}/core/management/commands/squashmigrations.pyi | 0 .../django}/core/management/commands/startapp.pyi | 0 .../django}/core/management/commands/startproject.pyi | 0 .../django}/core/management/commands/test.pyi | 0 .../django}/core/management/commands/testserver.pyi | 0 {django-stubs => typings/django}/core/management/sql.pyi | 0 {django-stubs => typings/django}/core/management/templates.pyi | 0 {django-stubs => typings/django}/core/management/utils.pyi | 0 {django-stubs => typings/django}/core/paginator.pyi | 0 {django-stubs => typings/django}/core/serializers/__init__.pyi | 0 {django-stubs => typings/django}/core/serializers/base.pyi | 0 {django-stubs => typings/django}/core/serializers/json.pyi | 0 {django-stubs => typings/django}/core/serializers/python.pyi | 0 {django-stubs => typings/django}/core/serializers/pyyaml.pyi | 0 .../django}/core/serializers/xml_serializer.pyi | 0 {django-stubs => typings/django}/core/servers/__init__.pyi | 0 {django-stubs => typings/django}/core/servers/basehttp.pyi | 0 {django-stubs => typings/django}/core/signals.pyi | 0 {django-stubs => typings/django}/core/signing.pyi | 0 {django-stubs => typings/django}/core/validators.pyi | 0 {django-stubs => typings/django}/core/wsgi.pyi | 0 {django-stubs => typings/django}/db/__init__.pyi | 0 {django-stubs => typings/django}/db/backends/__init__.pyi | 0 {django-stubs => typings/django}/db/backends/base/__init__.pyi | 0 {django-stubs => typings/django}/db/backends/base/base.pyi | 0 {django-stubs => typings/django}/db/backends/base/client.pyi | 0 {django-stubs => typings/django}/db/backends/base/creation.pyi | 0 {django-stubs => typings/django}/db/backends/base/features.pyi | 0 .../django}/db/backends/base/introspection.pyi | 0 {django-stubs => typings/django}/db/backends/base/operations.pyi | 0 {django-stubs => typings/django}/db/backends/base/schema.pyi | 0 {django-stubs => typings/django}/db/backends/base/validation.pyi | 0 {django-stubs => typings/django}/db/backends/ddl_references.pyi | 0 {django-stubs => typings/django}/db/backends/dummy/__init__.pyi | 0 {django-stubs => typings/django}/db/backends/dummy/base.pyi | 0 {django-stubs => typings/django}/db/backends/dummy/features.pyi | 0 {django-stubs => typings/django}/db/backends/mysql/__init__.pyi | 0 {django-stubs => typings/django}/db/backends/mysql/base.pyi | 0 {django-stubs => typings/django}/db/backends/mysql/client.pyi | 0 {django-stubs => typings/django}/db/backends/mysql/compiler.pyi | 0 {django-stubs => typings/django}/db/backends/mysql/creation.pyi | 0 {django-stubs => typings/django}/db/backends/mysql/features.pyi | 0 .../django}/db/backends/mysql/introspection.pyi | 0 .../django}/db/backends/mysql/operations.pyi | 0 {django-stubs => typings/django}/db/backends/mysql/schema.pyi | 0 .../django}/db/backends/mysql/validation.pyi | 0 {django-stubs => typings/django}/db/backends/oracle/__init__.pyi | 0 {django-stubs => typings/django}/db/backends/oracle/base.pyi | 0 {django-stubs => typings/django}/db/backends/oracle/client.pyi | 0 {django-stubs => typings/django}/db/backends/oracle/creation.pyi | 0 {django-stubs => typings/django}/db/backends/oracle/features.pyi | 0 .../django}/db/backends/oracle/functions.pyi | 0 .../django}/db/backends/oracle/introspection.pyi | 0 .../django}/db/backends/oracle/operations.pyi | 0 {django-stubs => typings/django}/db/backends/oracle/schema.pyi | 0 {django-stubs => typings/django}/db/backends/oracle/utils.pyi | 0 .../django}/db/backends/oracle/validation.pyi | 0 .../django}/db/backends/postgresql/__init__.pyi | 0 {django-stubs => typings/django}/db/backends/postgresql/base.pyi | 0 .../django}/db/backends/postgresql/client.pyi | 0 .../django}/db/backends/postgresql/creation.pyi | 0 .../django}/db/backends/postgresql/features.pyi | 0 .../django}/db/backends/postgresql/introspection.pyi | 0 .../django}/db/backends/postgresql/operations.pyi | 0 .../django}/db/backends/postgresql/schema.pyi | 0 .../django}/db/backends/postgresql/test_import_all.yml | 0 {django-stubs => typings/django}/db/backends/signals.pyi | 0 .../django}/db/backends/sqlite3/__init__.pyi | 0 {django-stubs => typings/django}/db/backends/sqlite3/base.pyi | 0 {django-stubs => typings/django}/db/backends/sqlite3/client.pyi | 0 .../django}/db/backends/sqlite3/creation.pyi | 0 .../django}/db/backends/sqlite3/features.pyi | 0 .../django}/db/backends/sqlite3/introspection.pyi | 0 .../django}/db/backends/sqlite3/operations.pyi | 0 {django-stubs => typings/django}/db/backends/sqlite3/schema.pyi | 0 {django-stubs => typings/django}/db/backends/utils.pyi | 0 {django-stubs => typings/django}/db/migrations/__init__.pyi | 0 {django-stubs => typings/django}/db/migrations/autodetector.pyi | 0 {django-stubs => typings/django}/db/migrations/exceptions.pyi | 0 {django-stubs => typings/django}/db/migrations/executor.pyi | 0 {django-stubs => typings/django}/db/migrations/graph.pyi | 0 {django-stubs => typings/django}/db/migrations/loader.pyi | 0 {django-stubs => typings/django}/db/migrations/migration.pyi | 0 .../django}/db/migrations/operations/__init__.pyi | 0 .../django}/db/migrations/operations/base.pyi | 0 .../django}/db/migrations/operations/fields.pyi | 0 .../django}/db/migrations/operations/models.pyi | 0 .../django}/db/migrations/operations/special.pyi | 0 .../django}/db/migrations/operations/utils.pyi | 0 {django-stubs => typings/django}/db/migrations/optimizer.pyi | 0 {django-stubs => typings/django}/db/migrations/questioner.pyi | 0 {django-stubs => typings/django}/db/migrations/recorder.pyi | 0 {django-stubs => typings/django}/db/migrations/serializer.pyi | 0 {django-stubs => typings/django}/db/migrations/state.pyi | 0 .../django}/db/migrations/topological_sort.pyi | 0 {django-stubs => typings/django}/db/migrations/utils.pyi | 0 {django-stubs => typings/django}/db/migrations/writer.pyi | 0 {django-stubs => typings/django}/db/models/__init__.pyi | 0 {django-stubs => typings/django}/db/models/aggregates.pyi | 0 {django-stubs => typings/django}/db/models/base.pyi | 0 {django-stubs => typings/django}/db/models/constants.pyi | 0 {django-stubs => typings/django}/db/models/constraints.pyi | 0 {django-stubs => typings/django}/db/models/deletion.pyi | 0 {django-stubs => typings/django}/db/models/enums.pyi | 0 {django-stubs => typings/django}/db/models/expressions.pyi | 0 {django-stubs => typings/django}/db/models/fields/__init__.pyi | 0 {django-stubs => typings/django}/db/models/fields/files.pyi | 0 {django-stubs => typings/django}/db/models/fields/json.pyi | 0 {django-stubs => typings/django}/db/models/fields/mixins.pyi | 0 {django-stubs => typings/django}/db/models/fields/proxy.pyi | 0 {django-stubs => typings/django}/db/models/fields/related.pyi | 0 .../django}/db/models/fields/related_descriptors.pyi | 0 .../django}/db/models/fields/related_lookups.pyi | 0 .../django}/db/models/fields/reverse_related.pyi | 0 .../django}/db/models/functions/__init__.pyi | 0 .../django}/db/models/functions/comparison.pyi | 0 .../django}/db/models/functions/datetime.pyi | 0 {django-stubs => typings/django}/db/models/functions/math.pyi | 0 {django-stubs => typings/django}/db/models/functions/mixins.pyi | 0 {django-stubs => typings/django}/db/models/functions/text.pyi | 0 {django-stubs => typings/django}/db/models/functions/window.pyi | 0 {django-stubs => typings/django}/db/models/indexes.pyi | 0 {django-stubs => typings/django}/db/models/lookups.pyi | 0 {django-stubs => typings/django}/db/models/manager.pyi | 0 {django-stubs => typings/django}/db/models/options.pyi | 0 {django-stubs => typings/django}/db/models/query.pyi | 0 {django-stubs => typings/django}/db/models/query_utils.pyi | 0 {django-stubs => typings/django}/db/models/signals.pyi | 0 {django-stubs => typings/django}/db/models/sql/__init__.pyi | 0 {django-stubs => typings/django}/db/models/sql/compiler.pyi | 0 {django-stubs => typings/django}/db/models/sql/constants.pyi | 0 .../django}/db/models/sql/datastructures.pyi | 0 {django-stubs => typings/django}/db/models/sql/query.pyi | 0 {django-stubs => typings/django}/db/models/sql/subqueries.pyi | 0 {django-stubs => typings/django}/db/models/sql/where.pyi | 0 {django-stubs => typings/django}/db/models/utils.pyi | 0 {django-stubs => typings/django}/db/transaction.pyi | 0 {django-stubs => typings/django}/db/utils.pyi | 0 {django-stubs => typings/django}/dispatch/__init__.pyi | 0 {django-stubs => typings/django}/dispatch/dispatcher.pyi | 0 {django-stubs => typings/django}/forms/__init__.pyi | 0 {django-stubs => typings/django}/forms/boundfield.pyi | 0 {django-stubs => typings/django}/forms/fields.pyi | 0 {django-stubs => typings/django}/forms/forms.pyi | 0 {django-stubs => typings/django}/forms/formsets.pyi | 0 {django-stubs => typings/django}/forms/models.pyi | 0 {django-stubs => typings/django}/forms/renderers.pyi | 0 {django-stubs => typings/django}/forms/utils.pyi | 0 {django-stubs => typings/django}/forms/widgets.pyi | 0 {django-stubs => typings/django}/http/__init__.pyi | 0 {django-stubs => typings/django}/http/cookie.pyi | 0 {django-stubs => typings/django}/http/multipartparser.pyi | 0 {django-stubs => typings/django}/http/request.pyi | 0 {django-stubs => typings/django}/http/response.pyi | 0 {django-stubs => typings/django}/middleware/__init__.pyi | 0 {django-stubs => typings/django}/middleware/cache.pyi | 0 {django-stubs => typings/django}/middleware/clickjacking.pyi | 0 {django-stubs => typings/django}/middleware/common.pyi | 0 {django-stubs => typings/django}/middleware/csrf.pyi | 0 {django-stubs => typings/django}/middleware/gzip.pyi | 0 {django-stubs => typings/django}/middleware/http.pyi | 0 {django-stubs => typings/django}/middleware/locale.pyi | 0 {django-stubs => typings/django}/middleware/security.pyi | 0 {django-stubs => typings/django}/shortcuts.pyi | 0 {django-stubs => typings/django}/template/__init__.pyi | 0 {django-stubs => typings/django}/template/backends/__init__.pyi | 0 {django-stubs => typings/django}/template/backends/base.pyi | 0 {django-stubs => typings/django}/template/backends/django.pyi | 0 {django-stubs => typings/django}/template/backends/dummy.pyi | 0 {django-stubs => typings/django}/template/backends/jinja2.pyi | 0 {django-stubs => typings/django}/template/backends/utils.pyi | 0 {django-stubs => typings/django}/template/base.pyi | 0 {django-stubs => typings/django}/template/context.pyi | 0 {django-stubs => typings/django}/template/context_processors.pyi | 0 {django-stubs => typings/django}/template/defaultfilters.pyi | 0 {django-stubs => typings/django}/template/defaulttags.pyi | 0 {django-stubs => typings/django}/template/engine.pyi | 0 {django-stubs => typings/django}/template/exceptions.pyi | 0 {django-stubs => typings/django}/template/library.pyi | 0 {django-stubs => typings/django}/template/loader.pyi | 0 {django-stubs => typings/django}/template/loader_tags.pyi | 0 {django-stubs => typings/django}/template/loaders/__init__.pyi | 0 .../django}/template/loaders/app_directories.pyi | 0 {django-stubs => typings/django}/template/loaders/base.pyi | 0 {django-stubs => typings/django}/template/loaders/cached.pyi | 0 {django-stubs => typings/django}/template/loaders/filesystem.pyi | 0 {django-stubs => typings/django}/template/loaders/locmem.pyi | 0 {django-stubs => typings/django}/template/response.pyi | 0 {django-stubs => typings/django}/template/smartif.pyi | 0 {django-stubs => typings/django}/template/utils.pyi | 0 {django-stubs => typings/django}/templatetags/__init__.pyi | 0 {django-stubs => typings/django}/templatetags/cache.pyi | 0 {django-stubs => typings/django}/templatetags/i18n.pyi | 0 {django-stubs => typings/django}/templatetags/l10n.pyi | 0 {django-stubs => typings/django}/templatetags/static.pyi | 0 {django-stubs => typings/django}/templatetags/tz.pyi | 0 {django-stubs => typings/django}/test/__init__.pyi | 0 {django-stubs => typings/django}/test/client.pyi | 0 {django-stubs => typings/django}/test/html.pyi | 0 {django-stubs => typings/django}/test/runner.pyi | 0 {django-stubs => typings/django}/test/selenium.pyi | 0 {django-stubs => typings/django}/test/signals.pyi | 0 {django-stubs => typings/django}/test/testcases.pyi | 0 {django-stubs => typings/django}/test/utils.pyi | 0 {django-stubs => typings/django}/urls/__init__.pyi | 0 {django-stubs => typings/django}/urls/base.pyi | 0 {django-stubs => typings/django}/urls/conf.pyi | 0 {django-stubs => typings/django}/urls/converters.pyi | 0 {django-stubs => typings/django}/urls/exceptions.pyi | 0 {django-stubs => typings/django}/urls/resolvers.pyi | 0 {django-stubs => typings/django}/urls/utils.pyi | 0 {django-stubs => typings/django}/utils/__init__.pyi | 0 {django-stubs => typings/django}/utils/_os.pyi | 0 {django-stubs => typings/django}/utils/archive.pyi | 0 {django-stubs => typings/django}/utils/asyncio.pyi | 0 {django-stubs => typings/django}/utils/autoreload.pyi | 0 {django-stubs => typings/django}/utils/baseconv.pyi | 0 {django-stubs => typings/django}/utils/cache.pyi | 0 {django-stubs => typings/django}/utils/crypto.pyi | 0 {django-stubs => typings/django}/utils/datastructures.pyi | 0 {django-stubs => typings/django}/utils/dateformat.pyi | 0 {django-stubs => typings/django}/utils/dateparse.pyi | 0 {django-stubs => typings/django}/utils/dates.pyi | 0 {django-stubs => typings/django}/utils/datetime_safe.pyi | 0 {django-stubs => typings/django}/utils/deconstruct.pyi | 0 {django-stubs => typings/django}/utils/decorators.pyi | 0 {django-stubs => typings/django}/utils/deprecation.pyi | 0 {django-stubs => typings/django}/utils/duration.pyi | 0 {django-stubs => typings/django}/utils/encoding.pyi | 0 {django-stubs => typings/django}/utils/feedgenerator.pyi | 0 {django-stubs => typings/django}/utils/formats.pyi | 0 {django-stubs => typings/django}/utils/functional.pyi | 0 {django-stubs => typings/django}/utils/hashable.pyi | 0 {django-stubs => typings/django}/utils/html.pyi | 0 {django-stubs => typings/django}/utils/http.pyi | 0 {django-stubs => typings/django}/utils/inspect.pyi | 0 {django-stubs => typings/django}/utils/ipv6.pyi | 0 {django-stubs => typings/django}/utils/itercompat.pyi | 0 {django-stubs => typings/django}/utils/jslex.pyi | 0 {django-stubs => typings/django}/utils/log.pyi | 0 {django-stubs => typings/django}/utils/lorem_ipsum.pyi | 0 {django-stubs => typings/django}/utils/module_loading.pyi | 0 {django-stubs => typings/django}/utils/numberformat.pyi | 0 {django-stubs => typings/django}/utils/regex_helper.pyi | 0 {django-stubs => typings/django}/utils/safestring.pyi | 0 {django-stubs => typings/django}/utils/six.pyi | 0 {django-stubs => typings/django}/utils/termcolors.pyi | 0 {django-stubs => typings/django}/utils/text.pyi | 0 {django-stubs => typings/django}/utils/timesince.pyi | 0 {django-stubs => typings/django}/utils/timezone.pyi | 0 {django-stubs => typings/django}/utils/topological_sort.pyi | 0 {django-stubs => typings/django}/utils/translation/__init__.pyi | 0 {django-stubs => typings/django}/utils/translation/reloader.pyi | 0 {django-stubs => typings/django}/utils/translation/template.pyi | 0 .../django}/utils/translation/trans_null.pyi | 0 .../django}/utils/translation/trans_real.pyi | 0 {django-stubs => typings/django}/utils/tree.pyi | 0 {django-stubs => typings/django}/utils/version.pyi | 0 {django-stubs => typings/django}/utils/xmlutils.pyi | 0 {django-stubs => typings/django}/views/__init__.pyi | 0 {django-stubs => typings/django}/views/csrf.pyi | 0 {django-stubs => typings/django}/views/debug.pyi | 0 {django-stubs => typings/django}/views/decorators/__init__.pyi | 0 {django-stubs => typings/django}/views/decorators/cache.pyi | 0 .../django}/views/decorators/clickjacking.pyi | 0 {django-stubs => typings/django}/views/decorators/csrf.pyi | 0 {django-stubs => typings/django}/views/decorators/debug.pyi | 0 {django-stubs => typings/django}/views/decorators/gzip.pyi | 0 {django-stubs => typings/django}/views/decorators/http.pyi | 0 {django-stubs => typings/django}/views/decorators/vary.pyi | 0 {django-stubs => typings/django}/views/defaults.pyi | 0 {django-stubs => typings/django}/views/generic/__init__.pyi | 0 {django-stubs => typings/django}/views/generic/base.pyi | 0 {django-stubs => typings/django}/views/generic/dates.pyi | 0 {django-stubs => typings/django}/views/generic/detail.pyi | 0 {django-stubs => typings/django}/views/generic/edit.pyi | 0 {django-stubs => typings/django}/views/generic/list.pyi | 0 {django-stubs => typings/django}/views/i18n.pyi | 0 {django-stubs => typings/django}/views/static.pyi | 0 {psycopg2-stubs => typings/psycopg2}/__init__.pyi | 0 {psycopg2-stubs => typings/psycopg2}/_range.pyi | 0 {psycopg2-stubs => typings/psycopg2}/errors.pyi | 0 {psycopg2-stubs => typings/psycopg2}/extensions.pyi | 0 {psycopg2-stubs => typings/psycopg2}/extras.pyi | 0 {psycopg2-stubs => typings/psycopg2}/tz.pyi | 0 682 files changed, 2 insertions(+) create mode 120000 django-stubs create mode 120000 psycopg2-stubs rename {django-stubs => typings/django}/__init__.pyi (100%) rename {django-stubs => typings/django}/apps/__init__.pyi (100%) rename {django-stubs => typings/django}/apps/config.pyi (100%) rename {django-stubs => typings/django}/apps/registry.pyi (100%) rename {django-stubs => typings/django}/conf/__init__.pyi (100%) rename {django-stubs => typings/django}/conf/global_settings.pyi (100%) rename {django-stubs => typings/django}/conf/locale/__init__.pyi (100%) rename {django-stubs => typings/django}/conf/urls/__init__.pyi (100%) rename {django-stubs => typings/django}/conf/urls/i18n.pyi (100%) rename {django-stubs => typings/django}/conf/urls/static.pyi (100%) rename {django-stubs => typings/django}/contrib/__init__.pyi (100%) rename {django-stubs => typings/django}/contrib/admin/__init__.pyi (100%) rename {django-stubs => typings/django}/contrib/admin/actions.pyi (100%) rename {django-stubs => typings/django}/contrib/admin/apps.pyi (100%) rename {django-stubs => typings/django}/contrib/admin/checks.pyi (100%) rename {django-stubs => typings/django}/contrib/admin/decorators.pyi (100%) rename {django-stubs => typings/django}/contrib/admin/exceptions.pyi (100%) rename {django-stubs => typings/django}/contrib/admin/filters.pyi (100%) rename {django-stubs => typings/django}/contrib/admin/forms.pyi (100%) rename {django-stubs => typings/django}/contrib/admin/helpers.pyi (100%) rename {django-stubs => typings/django}/contrib/admin/migrations/__init__.pyi (100%) rename {django-stubs => typings/django}/contrib/admin/models.pyi (100%) rename {django-stubs => typings/django}/contrib/admin/options.pyi (100%) rename {django-stubs => typings/django}/contrib/admin/sites.pyi (100%) rename {django-stubs => typings/django}/contrib/admin/templatetags/__init__.pyi (100%) rename {django-stubs => typings/django}/contrib/admin/templatetags/admin_list.pyi (100%) rename {django-stubs => typings/django}/contrib/admin/templatetags/admin_modify.pyi (100%) rename {django-stubs => typings/django}/contrib/admin/templatetags/admin_static.pyi (100%) rename {django-stubs => typings/django}/contrib/admin/templatetags/admin_urls.pyi (100%) rename {django-stubs => typings/django}/contrib/admin/templatetags/base.pyi (100%) rename {django-stubs => typings/django}/contrib/admin/templatetags/log.pyi (100%) rename {django-stubs => typings/django}/contrib/admin/tests.pyi (100%) rename {django-stubs => typings/django}/contrib/admin/utils.pyi (100%) rename {django-stubs => typings/django}/contrib/admin/views/__init__.pyi (100%) rename {django-stubs => typings/django}/contrib/admin/views/autocomplete.pyi (100%) rename {django-stubs => typings/django}/contrib/admin/views/decorators.pyi (100%) rename {django-stubs => typings/django}/contrib/admin/views/main.pyi (100%) rename {django-stubs => typings/django}/contrib/admin/widgets.pyi (100%) rename {django-stubs => typings/django}/contrib/admindocs/__init__.pyi (100%) rename {django-stubs => typings/django}/contrib/admindocs/apps.pyi (100%) rename {django-stubs => typings/django}/contrib/admindocs/middleware.pyi (100%) rename {django-stubs => typings/django}/contrib/admindocs/urls.pyi (100%) rename {django-stubs => typings/django}/contrib/admindocs/utils.pyi (100%) rename {django-stubs => typings/django}/contrib/admindocs/views.pyi (100%) rename {django-stubs => typings/django}/contrib/auth/__init__.pyi (100%) rename {django-stubs => typings/django}/contrib/auth/admin.pyi (100%) rename {django-stubs => typings/django}/contrib/auth/apps.pyi (100%) rename {django-stubs => typings/django}/contrib/auth/backends.pyi (100%) rename {django-stubs => typings/django}/contrib/auth/base_user.pyi (100%) rename {django-stubs => typings/django}/contrib/auth/checks.pyi (100%) rename {django-stubs => typings/django}/contrib/auth/context_processors.pyi (100%) rename {django-stubs => typings/django}/contrib/auth/decorators.pyi (100%) rename {django-stubs => typings/django}/contrib/auth/forms.pyi (100%) rename {django-stubs => typings/django}/contrib/auth/handlers/__init__.pyi (100%) rename {django-stubs => typings/django}/contrib/auth/handlers/modwsgi.pyi (100%) rename {django-stubs => typings/django}/contrib/auth/hashers.pyi (100%) rename {django-stubs => typings/django}/contrib/auth/management/__init__.pyi (100%) rename {django-stubs => typings/django}/contrib/auth/management/commands/__init__.pyi (100%) rename {django-stubs => typings/django}/contrib/auth/management/commands/changepassword.pyi (100%) rename {django-stubs => typings/django}/contrib/auth/management/commands/createsuperuser.pyi (100%) rename {django-stubs => typings/django}/contrib/auth/middleware.pyi (100%) rename {django-stubs => typings/django}/contrib/auth/migrations/__init__.pyi (100%) rename {django-stubs => typings/django}/contrib/auth/mixins.pyi (100%) rename {django-stubs => typings/django}/contrib/auth/models.pyi (100%) rename {django-stubs => typings/django}/contrib/auth/password_validation.pyi (100%) rename {django-stubs => typings/django}/contrib/auth/signals.pyi (100%) rename {django-stubs => typings/django}/contrib/auth/tokens.pyi (100%) rename {django-stubs => typings/django}/contrib/auth/urls.pyi (100%) rename {django-stubs => typings/django}/contrib/auth/validators.pyi (100%) rename {django-stubs => typings/django}/contrib/auth/views.pyi (100%) rename {django-stubs => typings/django}/contrib/contenttypes/__init__.pyi (100%) rename {django-stubs => typings/django}/contrib/contenttypes/admin.pyi (100%) rename {django-stubs => typings/django}/contrib/contenttypes/apps.pyi (100%) rename {django-stubs => typings/django}/contrib/contenttypes/checks.pyi (100%) rename {django-stubs => typings/django}/contrib/contenttypes/fields.pyi (100%) rename {django-stubs => typings/django}/contrib/contenttypes/forms.pyi (100%) rename {django-stubs => typings/django}/contrib/contenttypes/management/__init__.pyi (100%) rename {django-stubs => typings/django}/contrib/contenttypes/management/commands/__init__.pyi (100%) rename {django-stubs => typings/django}/contrib/contenttypes/management/commands/remove_stale_contenttypes.pyi (100%) rename {django-stubs => typings/django}/contrib/contenttypes/migrations/__init__.pyi (100%) rename {django-stubs => typings/django}/contrib/contenttypes/models.pyi (100%) rename {django-stubs => typings/django}/contrib/contenttypes/views.pyi (100%) rename {django-stubs => typings/django}/contrib/flatpages/__init__.pyi (100%) rename {django-stubs => typings/django}/contrib/flatpages/admin.pyi (100%) rename {django-stubs => typings/django}/contrib/flatpages/apps.pyi (100%) rename {django-stubs => typings/django}/contrib/flatpages/forms.pyi (100%) rename {django-stubs => typings/django}/contrib/flatpages/middleware.pyi (100%) rename {django-stubs => typings/django}/contrib/flatpages/migrations/__init__.pyi (100%) rename {django-stubs => typings/django}/contrib/flatpages/models.pyi (100%) rename {django-stubs => typings/django}/contrib/flatpages/sitemaps.pyi (100%) rename {django-stubs => typings/django}/contrib/flatpages/templatetags/__init__.pyi (100%) rename {django-stubs => typings/django}/contrib/flatpages/templatetags/flatpages.pyi (100%) rename {django-stubs => typings/django}/contrib/flatpages/urls.pyi (100%) rename {django-stubs => typings/django}/contrib/flatpages/views.pyi (100%) rename {django-stubs => typings/django}/contrib/gis/__init__.pyi (100%) rename {django-stubs => typings/django}/contrib/gis/admin/__init__.pyi (100%) rename {django-stubs => typings/django}/contrib/gis/admin/options.pyi (100%) rename {django-stubs => typings/django}/contrib/gis/admin/widgets.pyi (100%) rename {django-stubs => typings/django}/contrib/gis/apps.pyi (100%) rename {django-stubs => typings/django}/contrib/gis/db/__init__.pyi (100%) rename {django-stubs => typings/django}/contrib/gis/db/backends/__init__.pyi (100%) rename {django-stubs => typings/django}/contrib/gis/db/backends/base/__init__.pyi (100%) rename {django-stubs => typings/django}/contrib/gis/db/backends/base/adapter.pyi (100%) rename {django-stubs => typings/django}/contrib/gis/db/backends/base/features.pyi (100%) rename {django-stubs => typings/django}/contrib/gis/db/backends/base/models.pyi (100%) rename {django-stubs => typings/django}/contrib/gis/db/backends/base/operations.pyi (100%) rename {django-stubs => typings/django}/contrib/gis/db/backends/mysql/__init__.pyi (100%) rename {django-stubs => typings/django}/contrib/gis/db/backends/mysql/base.pyi (100%) rename {django-stubs => typings/django}/contrib/gis/db/backends/mysql/features.pyi (100%) rename {django-stubs => typings/django}/contrib/gis/db/backends/mysql/introspection.pyi (100%) rename {django-stubs => typings/django}/contrib/gis/db/backends/mysql/operations.pyi (100%) rename {django-stubs => typings/django}/contrib/gis/db/backends/mysql/schema.pyi (100%) rename {django-stubs => typings/django}/contrib/gis/db/backends/oracle/__init__.pyi (100%) rename {django-stubs => typings/django}/contrib/gis/db/backends/oracle/adapter.pyi (100%) rename {django-stubs => typings/django}/contrib/gis/db/backends/oracle/base.pyi (100%) rename {django-stubs => typings/django}/contrib/gis/db/backends/oracle/features.pyi (100%) rename {django-stubs => typings/django}/contrib/gis/db/backends/oracle/introspection.pyi (100%) rename {django-stubs => typings/django}/contrib/gis/db/backends/oracle/models.pyi (100%) rename {django-stubs => typings/django}/contrib/gis/db/backends/oracle/operations.pyi (100%) rename {django-stubs => typings/django}/contrib/gis/db/backends/oracle/schema.pyi (100%) rename {django-stubs => typings/django}/contrib/gis/db/backends/postgis/__init__.pyi (100%) rename {django-stubs => typings/django}/contrib/gis/db/backends/postgis/adapter.pyi (100%) rename {django-stubs => typings/django}/contrib/gis/db/backends/postgis/base.pyi (100%) rename {django-stubs => typings/django}/contrib/gis/db/backends/postgis/const.pyi (100%) rename {django-stubs => typings/django}/contrib/gis/db/backends/postgis/features.pyi (100%) rename {django-stubs => typings/django}/contrib/gis/db/backends/postgis/introspection.pyi (100%) rename {django-stubs => typings/django}/contrib/gis/db/backends/postgis/models.pyi (100%) rename {django-stubs => typings/django}/contrib/gis/db/backends/postgis/operations.pyi (100%) rename {django-stubs => typings/django}/contrib/gis/db/backends/postgis/pgraster.pyi (100%) rename {django-stubs => typings/django}/contrib/gis/db/backends/postgis/schema.pyi (100%) rename {django-stubs => typings/django}/contrib/gis/db/backends/spatialite/__init__.pyi (100%) rename {django-stubs => typings/django}/contrib/gis/db/backends/spatialite/adapter.pyi (100%) rename {django-stubs => typings/django}/contrib/gis/db/backends/spatialite/base.pyi (100%) rename {django-stubs => typings/django}/contrib/gis/db/backends/spatialite/client.pyi (100%) rename {django-stubs => typings/django}/contrib/gis/db/backends/spatialite/features.pyi (100%) rename {django-stubs => typings/django}/contrib/gis/db/backends/spatialite/introspection.pyi (100%) rename {django-stubs => typings/django}/contrib/gis/db/backends/spatialite/models.pyi (100%) rename {django-stubs => typings/django}/contrib/gis/db/backends/spatialite/operations.pyi (100%) rename {django-stubs => typings/django}/contrib/gis/db/backends/spatialite/schema.pyi (100%) rename {django-stubs => typings/django}/contrib/gis/db/backends/utils.pyi (100%) rename {django-stubs => typings/django}/contrib/gis/db/models/__init__.pyi (100%) rename {django-stubs => typings/django}/contrib/gis/db/models/aggregates.pyi (100%) rename {django-stubs => typings/django}/contrib/gis/db/models/fields.pyi (100%) rename {django-stubs => typings/django}/contrib/gis/db/models/functions.pyi (100%) rename {django-stubs => typings/django}/contrib/gis/db/models/lookups.pyi (100%) rename {django-stubs => typings/django}/contrib/gis/db/models/proxy.pyi (100%) rename {django-stubs => typings/django}/contrib/gis/db/models/sql/__init__.pyi (100%) rename {django-stubs => typings/django}/contrib/gis/db/models/sql/conversion.pyi (100%) rename {django-stubs => typings/django}/contrib/gis/feeds.pyi (100%) rename {django-stubs => typings/django}/contrib/gis/forms/__init__.pyi (100%) rename {django-stubs => typings/django}/contrib/gis/forms/fields.pyi (100%) rename {django-stubs => typings/django}/contrib/gis/forms/widgets.pyi (100%) rename {django-stubs => typings/django}/contrib/gis/gdal/__init__.pyi (100%) rename {django-stubs => typings/django}/contrib/gis/gdal/base.pyi (100%) rename {django-stubs => typings/django}/contrib/gis/gdal/datasource.pyi (100%) rename {django-stubs => typings/django}/contrib/gis/gdal/driver.pyi (100%) rename {django-stubs => typings/django}/contrib/gis/gdal/envelope.pyi (100%) rename {django-stubs => typings/django}/contrib/gis/gdal/error.pyi (100%) rename {django-stubs => typings/django}/contrib/gis/gdal/feature.pyi (100%) rename {django-stubs => typings/django}/contrib/gis/gdal/field.pyi (100%) rename {django-stubs => typings/django}/contrib/gis/gdal/geometries.pyi (100%) rename {django-stubs => typings/django}/contrib/gis/gdal/geomtype.pyi (100%) rename {django-stubs => typings/django}/contrib/gis/gdal/layer.pyi (100%) rename {django-stubs => typings/django}/contrib/gis/gdal/libgdal.pyi (100%) rename {django-stubs => typings/django}/contrib/gis/gdal/prototypes/__init__.pyi (100%) rename {django-stubs => typings/django}/contrib/gis/gdal/prototypes/ds.pyi (100%) rename {django-stubs => typings/django}/contrib/gis/gdal/prototypes/errcheck.pyi (100%) rename {django-stubs => typings/django}/contrib/gis/gdal/prototypes/generation.pyi (100%) rename {django-stubs => typings/django}/contrib/gis/gdal/prototypes/geom.pyi (100%) rename {django-stubs => typings/django}/contrib/gis/gdal/prototypes/raster.pyi (100%) rename {django-stubs => typings/django}/contrib/gis/gdal/prototypes/srs.pyi (100%) rename {django-stubs => typings/django}/contrib/gis/gdal/raster/__init__.pyi (100%) rename {django-stubs => typings/django}/contrib/gis/gdal/raster/band.pyi (100%) rename {django-stubs => typings/django}/contrib/gis/gdal/raster/base.pyi (100%) rename {django-stubs => typings/django}/contrib/gis/gdal/raster/const.pyi (100%) rename {django-stubs => typings/django}/contrib/gis/gdal/raster/source.pyi (100%) rename {django-stubs => typings/django}/contrib/gis/gdal/srs.pyi (100%) rename {django-stubs => typings/django}/contrib/gis/geoip2/__init__.pyi (100%) rename {django-stubs => typings/django}/contrib/gis/geoip2/base.pyi (100%) rename {django-stubs => typings/django}/contrib/gis/geoip2/resources.pyi (100%) rename {django-stubs => typings/django}/contrib/gis/geometry.pyi (100%) rename {django-stubs => typings/django}/contrib/gis/geos/__init__.pyi (100%) rename {django-stubs => typings/django}/contrib/gis/geos/base.pyi (100%) rename {django-stubs => typings/django}/contrib/gis/geos/collections.pyi (100%) rename {django-stubs => typings/django}/contrib/gis/geos/coordseq.pyi (100%) rename {django-stubs => typings/django}/contrib/gis/geos/error.pyi (100%) rename {django-stubs => typings/django}/contrib/gis/geos/factory.pyi (100%) rename {django-stubs => typings/django}/contrib/gis/geos/geometry.pyi (100%) rename {django-stubs => typings/django}/contrib/gis/geos/io.pyi (100%) rename {django-stubs => typings/django}/contrib/gis/geos/libgeos.pyi (100%) rename {django-stubs => typings/django}/contrib/gis/geos/linestring.pyi (100%) rename {django-stubs => typings/django}/contrib/gis/geos/mutable_list.pyi (100%) rename {django-stubs => typings/django}/contrib/gis/geos/point.pyi (100%) rename {django-stubs => typings/django}/contrib/gis/geos/polygon.pyi (100%) rename {django-stubs => typings/django}/contrib/gis/geos/prepared.pyi (100%) rename {django-stubs => typings/django}/contrib/gis/geos/prototypes/__init__.pyi (100%) rename {django-stubs => typings/django}/contrib/gis/geos/prototypes/coordseq.pyi (100%) rename {django-stubs => typings/django}/contrib/gis/geos/prototypes/errcheck.pyi (100%) rename {django-stubs => typings/django}/contrib/gis/geos/prototypes/geom.pyi (100%) rename {django-stubs => typings/django}/contrib/gis/geos/prototypes/io.pyi (100%) rename {django-stubs => typings/django}/contrib/gis/geos/prototypes/misc.pyi (100%) rename {django-stubs => typings/django}/contrib/gis/geos/prototypes/predicates.pyi (100%) rename {django-stubs => typings/django}/contrib/gis/geos/prototypes/prepared.pyi (100%) rename {django-stubs => typings/django}/contrib/gis/geos/prototypes/threadsafe.pyi (100%) rename {django-stubs => typings/django}/contrib/gis/geos/prototypes/topology.pyi (100%) rename {django-stubs => typings/django}/contrib/gis/measure.pyi (100%) rename {django-stubs => typings/django}/contrib/gis/ptr.pyi (100%) rename {django-stubs => typings/django}/contrib/gis/serializers/__init__.pyi (100%) rename {django-stubs => typings/django}/contrib/gis/serializers/geojson.pyi (100%) rename {django-stubs => typings/django}/contrib/gis/shortcuts.pyi (100%) rename {django-stubs => typings/django}/contrib/gis/sitemaps/__init__.pyi (100%) rename {django-stubs => typings/django}/contrib/gis/sitemaps/kml.pyi (100%) rename {django-stubs => typings/django}/contrib/gis/sitemaps/views.pyi (100%) rename {django-stubs => typings/django}/contrib/gis/utils/__init__.pyi (100%) rename {django-stubs => typings/django}/contrib/gis/utils/layermapping.pyi (100%) rename {django-stubs => typings/django}/contrib/gis/utils/ogrinfo.pyi (100%) rename {django-stubs => typings/django}/contrib/gis/utils/ogrinspect.pyi (100%) rename {django-stubs => typings/django}/contrib/gis/utils/srs.pyi (100%) rename {django-stubs => typings/django}/contrib/gis/views.pyi (100%) rename {django-stubs => typings/django}/contrib/humanize/__init__.pyi (100%) rename {django-stubs => typings/django}/contrib/humanize/apps.pyi (100%) rename {django-stubs => typings/django}/contrib/humanize/templatetags/__init__.pyi (100%) rename {django-stubs => typings/django}/contrib/humanize/templatetags/humanize.pyi (100%) rename {django-stubs => typings/django}/contrib/messages/__init__.pyi (100%) rename {django-stubs => typings/django}/contrib/messages/api.pyi (100%) rename {django-stubs => typings/django}/contrib/messages/apps.pyi (100%) rename {django-stubs => typings/django}/contrib/messages/constants.pyi (100%) rename {django-stubs => typings/django}/contrib/messages/context_processors.pyi (100%) rename {django-stubs => typings/django}/contrib/messages/middleware.pyi (100%) rename {django-stubs => typings/django}/contrib/messages/storage/__init__.pyi (100%) rename {django-stubs => typings/django}/contrib/messages/storage/base.pyi (100%) rename {django-stubs => typings/django}/contrib/messages/storage/cookie.pyi (100%) rename {django-stubs => typings/django}/contrib/messages/storage/fallback.pyi (100%) rename {django-stubs => typings/django}/contrib/messages/storage/session.pyi (100%) rename {django-stubs => typings/django}/contrib/messages/utils.pyi (100%) rename {django-stubs => typings/django}/contrib/messages/views.pyi (100%) rename {django-stubs => typings/django}/contrib/postgres/__init__.pyi (100%) rename {django-stubs => typings/django}/contrib/postgres/aggregates/__init__.pyi (100%) rename {django-stubs => typings/django}/contrib/postgres/aggregates/general.pyi (100%) rename {django-stubs => typings/django}/contrib/postgres/aggregates/mixins.pyi (100%) rename {django-stubs => typings/django}/contrib/postgres/aggregates/statistics.pyi (100%) rename {django-stubs => typings/django}/contrib/postgres/apps.pyi (100%) rename {django-stubs => typings/django}/contrib/postgres/constraints.pyi (100%) rename {django-stubs => typings/django}/contrib/postgres/fields/__init__.pyi (100%) rename {django-stubs => typings/django}/contrib/postgres/fields/array.pyi (100%) rename {django-stubs => typings/django}/contrib/postgres/fields/citext.pyi (100%) rename {django-stubs => typings/django}/contrib/postgres/fields/hstore.pyi (100%) rename {django-stubs => typings/django}/contrib/postgres/fields/jsonb.pyi (100%) rename {django-stubs => typings/django}/contrib/postgres/fields/mixins.pyi (100%) rename {django-stubs => typings/django}/contrib/postgres/fields/ranges.pyi (100%) rename {django-stubs => typings/django}/contrib/postgres/fields/utils.pyi (100%) rename {django-stubs => typings/django}/contrib/postgres/functions.pyi (100%) rename {django-stubs => typings/django}/contrib/postgres/indexes.pyi (100%) rename {django-stubs => typings/django}/contrib/postgres/lookups.pyi (100%) rename {django-stubs => typings/django}/contrib/postgres/operations.pyi (100%) rename {django-stubs => typings/django}/contrib/postgres/search.pyi (100%) rename {django-stubs => typings/django}/contrib/postgres/serializers.pyi (100%) rename {django-stubs => typings/django}/contrib/postgres/signals.pyi (100%) rename {django-stubs => typings/django}/contrib/postgres/utils.pyi (100%) rename {django-stubs => typings/django}/contrib/postgres/validators.pyi (100%) rename {django-stubs => typings/django}/contrib/redirects/__init__.pyi (100%) rename {django-stubs => typings/django}/contrib/redirects/admin.pyi (100%) rename {django-stubs => typings/django}/contrib/redirects/apps.pyi (100%) rename {django-stubs => typings/django}/contrib/redirects/middleware.pyi (100%) rename {django-stubs => typings/django}/contrib/redirects/migrations/__init__.pyi (100%) rename {django-stubs => typings/django}/contrib/redirects/models.pyi (100%) rename {django-stubs => typings/django}/contrib/sessions/__init__.pyi (100%) rename {django-stubs => typings/django}/contrib/sessions/apps.pyi (100%) rename {django-stubs => typings/django}/contrib/sessions/backends/__init__.pyi (100%) rename {django-stubs => typings/django}/contrib/sessions/backends/base.pyi (100%) rename {django-stubs => typings/django}/contrib/sessions/backends/cache.pyi (100%) rename {django-stubs => typings/django}/contrib/sessions/backends/cached_db.pyi (100%) rename {django-stubs => typings/django}/contrib/sessions/backends/db.pyi (100%) rename {django-stubs => typings/django}/contrib/sessions/backends/file.pyi (100%) rename {django-stubs => typings/django}/contrib/sessions/backends/signed_cookies.pyi (100%) rename {django-stubs => typings/django}/contrib/sessions/base_session.pyi (100%) rename {django-stubs => typings/django}/contrib/sessions/exceptions.pyi (100%) rename {django-stubs => typings/django}/contrib/sessions/management/__init__.pyi (100%) rename {django-stubs => typings/django}/contrib/sessions/management/commands/__init__.pyi (100%) rename {django-stubs => typings/django}/contrib/sessions/management/commands/clearsessions.pyi (100%) rename {django-stubs => typings/django}/contrib/sessions/middleware.pyi (100%) rename {django-stubs => typings/django}/contrib/sessions/migrations/__init__.pyi (100%) rename {django-stubs => typings/django}/contrib/sessions/models.pyi (100%) rename {django-stubs => typings/django}/contrib/sessions/serializers.pyi (100%) rename {django-stubs => typings/django}/contrib/sitemaps/__init__.pyi (100%) rename {django-stubs => typings/django}/contrib/sitemaps/apps.pyi (100%) rename {django-stubs => typings/django}/contrib/sitemaps/management/__init__.pyi (100%) rename {django-stubs => typings/django}/contrib/sitemaps/management/commands/__init__.pyi (100%) rename {django-stubs => typings/django}/contrib/sitemaps/management/commands/ping_google.pyi (100%) rename {django-stubs => typings/django}/contrib/sitemaps/views.pyi (100%) rename {django-stubs => typings/django}/contrib/sites/__init__.pyi (100%) rename {django-stubs => typings/django}/contrib/sites/admin.pyi (100%) rename {django-stubs => typings/django}/contrib/sites/apps.pyi (100%) rename {django-stubs => typings/django}/contrib/sites/management.pyi (100%) rename {django-stubs => typings/django}/contrib/sites/managers.pyi (100%) rename {django-stubs => typings/django}/contrib/sites/middleware.pyi (100%) rename {django-stubs => typings/django}/contrib/sites/migrations/__init__.pyi (100%) rename {django-stubs => typings/django}/contrib/sites/models.pyi (100%) rename {django-stubs => typings/django}/contrib/sites/requests.pyi (100%) rename {django-stubs => typings/django}/contrib/sites/shortcuts.pyi (100%) rename {django-stubs => typings/django}/contrib/staticfiles/__init__.pyi (100%) rename {django-stubs => typings/django}/contrib/staticfiles/apps.pyi (100%) rename {django-stubs => typings/django}/contrib/staticfiles/checks.pyi (100%) rename {django-stubs => typings/django}/contrib/staticfiles/finders.pyi (100%) rename {django-stubs => typings/django}/contrib/staticfiles/handlers.pyi (100%) rename {django-stubs => typings/django}/contrib/staticfiles/management/__init__.pyi (100%) rename {django-stubs => typings/django}/contrib/staticfiles/management/commands/__init__.pyi (100%) rename {django-stubs => typings/django}/contrib/staticfiles/management/commands/collectstatic.pyi (100%) rename {django-stubs => typings/django}/contrib/staticfiles/management/commands/findstatic.pyi (100%) rename {django-stubs => typings/django}/contrib/staticfiles/management/commands/runserver.pyi (100%) rename {django-stubs => typings/django}/contrib/staticfiles/storage.pyi (100%) rename {django-stubs => typings/django}/contrib/staticfiles/templatetags/__init__.pyi (100%) rename {django-stubs => typings/django}/contrib/staticfiles/templatetags/staticfiles.pyi (100%) rename {django-stubs => typings/django}/contrib/staticfiles/testing.pyi (100%) rename {django-stubs => typings/django}/contrib/staticfiles/urls.pyi (100%) rename {django-stubs => typings/django}/contrib/staticfiles/utils.pyi (100%) rename {django-stubs => typings/django}/contrib/staticfiles/views.pyi (100%) rename {django-stubs => typings/django}/contrib/syndication/__init__.pyi (100%) rename {django-stubs => typings/django}/contrib/syndication/apps.pyi (100%) rename {django-stubs => typings/django}/contrib/syndication/views.pyi (100%) rename {django-stubs => typings/django}/core/__init__.pyi (100%) rename {django-stubs => typings/django}/core/asgi.pyi (100%) rename {django-stubs => typings/django}/core/cache/__init__.pyi (100%) rename {django-stubs => typings/django}/core/cache/backends/__init__.pyi (100%) rename {django-stubs => typings/django}/core/cache/backends/base.pyi (100%) rename {django-stubs => typings/django}/core/cache/backends/db.pyi (100%) rename {django-stubs => typings/django}/core/cache/backends/dummy.pyi (100%) rename {django-stubs => typings/django}/core/cache/backends/filebased.pyi (100%) rename {django-stubs => typings/django}/core/cache/backends/locmem.pyi (100%) rename {django-stubs => typings/django}/core/cache/backends/memcached.pyi (100%) rename {django-stubs => typings/django}/core/cache/utils.pyi (100%) rename {django-stubs => typings/django}/core/checks/__init__.pyi (100%) rename {django-stubs => typings/django}/core/checks/async_checks.pyi (100%) rename {django-stubs => typings/django}/core/checks/caches.pyi (100%) rename {django-stubs => typings/django}/core/checks/compatibility/__init__.pyi (100%) rename {django-stubs => typings/django}/core/checks/database.pyi (100%) rename {django-stubs => typings/django}/core/checks/messages.pyi (100%) rename {django-stubs => typings/django}/core/checks/model_checks.pyi (100%) rename {django-stubs => typings/django}/core/checks/registry.pyi (100%) rename {django-stubs => typings/django}/core/checks/security/__init__.pyi (100%) rename {django-stubs => typings/django}/core/checks/security/base.pyi (100%) rename {django-stubs => typings/django}/core/checks/security/csrf.pyi (100%) rename {django-stubs => typings/django}/core/checks/security/sessions.pyi (100%) rename {django-stubs => typings/django}/core/checks/templates.pyi (100%) rename {django-stubs => typings/django}/core/checks/translation.pyi (100%) rename {django-stubs => typings/django}/core/checks/urls.pyi (100%) rename {django-stubs => typings/django}/core/exceptions.pyi (100%) rename {django-stubs => typings/django}/core/files/__init__.pyi (100%) rename {django-stubs => typings/django}/core/files/base.pyi (100%) rename {django-stubs => typings/django}/core/files/images.pyi (100%) rename {django-stubs => typings/django}/core/files/locks.pyi (100%) rename {django-stubs => typings/django}/core/files/move.pyi (100%) rename {django-stubs => typings/django}/core/files/storage.pyi (100%) rename {django-stubs => typings/django}/core/files/temp.pyi (100%) rename {django-stubs => typings/django}/core/files/uploadedfile.pyi (100%) rename {django-stubs => typings/django}/core/files/uploadhandler.pyi (100%) rename {django-stubs => typings/django}/core/files/utils.pyi (100%) rename {django-stubs => typings/django}/core/handlers/__init__.pyi (100%) rename {django-stubs => typings/django}/core/handlers/asgi.pyi (100%) rename {django-stubs => typings/django}/core/handlers/base.pyi (100%) rename {django-stubs => typings/django}/core/handlers/exception.pyi (100%) rename {django-stubs => typings/django}/core/handlers/wsgi.pyi (100%) rename {django-stubs => typings/django}/core/mail/__init__.pyi (100%) rename {django-stubs => typings/django}/core/mail/backends/__init__.pyi (100%) rename {django-stubs => typings/django}/core/mail/backends/base.pyi (100%) rename {django-stubs => typings/django}/core/mail/backends/console.pyi (100%) rename {django-stubs => typings/django}/core/mail/backends/dummy.pyi (100%) rename {django-stubs => typings/django}/core/mail/backends/filebased.pyi (100%) rename {django-stubs => typings/django}/core/mail/backends/locmem.pyi (100%) rename {django-stubs => typings/django}/core/mail/backends/smtp.pyi (100%) rename {django-stubs => typings/django}/core/mail/message.pyi (100%) rename {django-stubs => typings/django}/core/mail/utils.pyi (100%) rename {django-stubs => typings/django}/core/management/__init__.pyi (100%) rename {django-stubs => typings/django}/core/management/base.pyi (100%) rename {django-stubs => typings/django}/core/management/color.pyi (100%) rename {django-stubs => typings/django}/core/management/commands/__init__.pyi (100%) rename {django-stubs => typings/django}/core/management/commands/check.pyi (100%) rename {django-stubs => typings/django}/core/management/commands/compilemessages.pyi (100%) rename {django-stubs => typings/django}/core/management/commands/createcachetable.pyi (100%) rename {django-stubs => typings/django}/core/management/commands/dbshell.pyi (100%) rename {django-stubs => typings/django}/core/management/commands/diffsettings.pyi (100%) rename {django-stubs => typings/django}/core/management/commands/dumpdata.pyi (100%) rename {django-stubs => typings/django}/core/management/commands/flush.pyi (100%) rename {django-stubs => typings/django}/core/management/commands/inspectdb.pyi (100%) rename {django-stubs => typings/django}/core/management/commands/loaddata.pyi (100%) rename {django-stubs => typings/django}/core/management/commands/makemessages.pyi (100%) rename {django-stubs => typings/django}/core/management/commands/makemigrations.pyi (100%) rename {django-stubs => typings/django}/core/management/commands/migrate.pyi (100%) rename {django-stubs => typings/django}/core/management/commands/runserver.pyi (100%) rename {django-stubs => typings/django}/core/management/commands/sendtestemail.pyi (100%) rename {django-stubs => typings/django}/core/management/commands/shell.pyi (100%) rename {django-stubs => typings/django}/core/management/commands/showmigrations.pyi (100%) rename {django-stubs => typings/django}/core/management/commands/sqlflush.pyi (100%) rename {django-stubs => typings/django}/core/management/commands/sqlmigrate.pyi (100%) rename {django-stubs => typings/django}/core/management/commands/sqlsequencereset.pyi (100%) rename {django-stubs => typings/django}/core/management/commands/squashmigrations.pyi (100%) rename {django-stubs => typings/django}/core/management/commands/startapp.pyi (100%) rename {django-stubs => typings/django}/core/management/commands/startproject.pyi (100%) rename {django-stubs => typings/django}/core/management/commands/test.pyi (100%) rename {django-stubs => typings/django}/core/management/commands/testserver.pyi (100%) rename {django-stubs => typings/django}/core/management/sql.pyi (100%) rename {django-stubs => typings/django}/core/management/templates.pyi (100%) rename {django-stubs => typings/django}/core/management/utils.pyi (100%) rename {django-stubs => typings/django}/core/paginator.pyi (100%) rename {django-stubs => typings/django}/core/serializers/__init__.pyi (100%) rename {django-stubs => typings/django}/core/serializers/base.pyi (100%) rename {django-stubs => typings/django}/core/serializers/json.pyi (100%) rename {django-stubs => typings/django}/core/serializers/python.pyi (100%) rename {django-stubs => typings/django}/core/serializers/pyyaml.pyi (100%) rename {django-stubs => typings/django}/core/serializers/xml_serializer.pyi (100%) rename {django-stubs => typings/django}/core/servers/__init__.pyi (100%) rename {django-stubs => typings/django}/core/servers/basehttp.pyi (100%) rename {django-stubs => typings/django}/core/signals.pyi (100%) rename {django-stubs => typings/django}/core/signing.pyi (100%) rename {django-stubs => typings/django}/core/validators.pyi (100%) rename {django-stubs => typings/django}/core/wsgi.pyi (100%) rename {django-stubs => typings/django}/db/__init__.pyi (100%) rename {django-stubs => typings/django}/db/backends/__init__.pyi (100%) rename {django-stubs => typings/django}/db/backends/base/__init__.pyi (100%) rename {django-stubs => typings/django}/db/backends/base/base.pyi (100%) rename {django-stubs => typings/django}/db/backends/base/client.pyi (100%) rename {django-stubs => typings/django}/db/backends/base/creation.pyi (100%) rename {django-stubs => typings/django}/db/backends/base/features.pyi (100%) rename {django-stubs => typings/django}/db/backends/base/introspection.pyi (100%) rename {django-stubs => typings/django}/db/backends/base/operations.pyi (100%) rename {django-stubs => typings/django}/db/backends/base/schema.pyi (100%) rename {django-stubs => typings/django}/db/backends/base/validation.pyi (100%) rename {django-stubs => typings/django}/db/backends/ddl_references.pyi (100%) rename {django-stubs => typings/django}/db/backends/dummy/__init__.pyi (100%) rename {django-stubs => typings/django}/db/backends/dummy/base.pyi (100%) rename {django-stubs => typings/django}/db/backends/dummy/features.pyi (100%) rename {django-stubs => typings/django}/db/backends/mysql/__init__.pyi (100%) rename {django-stubs => typings/django}/db/backends/mysql/base.pyi (100%) rename {django-stubs => typings/django}/db/backends/mysql/client.pyi (100%) rename {django-stubs => typings/django}/db/backends/mysql/compiler.pyi (100%) rename {django-stubs => typings/django}/db/backends/mysql/creation.pyi (100%) rename {django-stubs => typings/django}/db/backends/mysql/features.pyi (100%) rename {django-stubs => typings/django}/db/backends/mysql/introspection.pyi (100%) rename {django-stubs => typings/django}/db/backends/mysql/operations.pyi (100%) rename {django-stubs => typings/django}/db/backends/mysql/schema.pyi (100%) rename {django-stubs => typings/django}/db/backends/mysql/validation.pyi (100%) rename {django-stubs => typings/django}/db/backends/oracle/__init__.pyi (100%) rename {django-stubs => typings/django}/db/backends/oracle/base.pyi (100%) rename {django-stubs => typings/django}/db/backends/oracle/client.pyi (100%) rename {django-stubs => typings/django}/db/backends/oracle/creation.pyi (100%) rename {django-stubs => typings/django}/db/backends/oracle/features.pyi (100%) rename {django-stubs => typings/django}/db/backends/oracle/functions.pyi (100%) rename {django-stubs => typings/django}/db/backends/oracle/introspection.pyi (100%) rename {django-stubs => typings/django}/db/backends/oracle/operations.pyi (100%) rename {django-stubs => typings/django}/db/backends/oracle/schema.pyi (100%) rename {django-stubs => typings/django}/db/backends/oracle/utils.pyi (100%) rename {django-stubs => typings/django}/db/backends/oracle/validation.pyi (100%) rename {django-stubs => typings/django}/db/backends/postgresql/__init__.pyi (100%) rename {django-stubs => typings/django}/db/backends/postgresql/base.pyi (100%) rename {django-stubs => typings/django}/db/backends/postgresql/client.pyi (100%) rename {django-stubs => typings/django}/db/backends/postgresql/creation.pyi (100%) rename {django-stubs => typings/django}/db/backends/postgresql/features.pyi (100%) rename {django-stubs => typings/django}/db/backends/postgresql/introspection.pyi (100%) rename {django-stubs => typings/django}/db/backends/postgresql/operations.pyi (100%) rename {django-stubs => typings/django}/db/backends/postgresql/schema.pyi (100%) rename {django-stubs => typings/django}/db/backends/postgresql/test_import_all.yml (100%) rename {django-stubs => typings/django}/db/backends/signals.pyi (100%) rename {django-stubs => typings/django}/db/backends/sqlite3/__init__.pyi (100%) rename {django-stubs => typings/django}/db/backends/sqlite3/base.pyi (100%) rename {django-stubs => typings/django}/db/backends/sqlite3/client.pyi (100%) rename {django-stubs => typings/django}/db/backends/sqlite3/creation.pyi (100%) rename {django-stubs => typings/django}/db/backends/sqlite3/features.pyi (100%) rename {django-stubs => typings/django}/db/backends/sqlite3/introspection.pyi (100%) rename {django-stubs => typings/django}/db/backends/sqlite3/operations.pyi (100%) rename {django-stubs => typings/django}/db/backends/sqlite3/schema.pyi (100%) rename {django-stubs => typings/django}/db/backends/utils.pyi (100%) rename {django-stubs => typings/django}/db/migrations/__init__.pyi (100%) rename {django-stubs => typings/django}/db/migrations/autodetector.pyi (100%) rename {django-stubs => typings/django}/db/migrations/exceptions.pyi (100%) rename {django-stubs => typings/django}/db/migrations/executor.pyi (100%) rename {django-stubs => typings/django}/db/migrations/graph.pyi (100%) rename {django-stubs => typings/django}/db/migrations/loader.pyi (100%) rename {django-stubs => typings/django}/db/migrations/migration.pyi (100%) rename {django-stubs => typings/django}/db/migrations/operations/__init__.pyi (100%) rename {django-stubs => typings/django}/db/migrations/operations/base.pyi (100%) rename {django-stubs => typings/django}/db/migrations/operations/fields.pyi (100%) rename {django-stubs => typings/django}/db/migrations/operations/models.pyi (100%) rename {django-stubs => typings/django}/db/migrations/operations/special.pyi (100%) rename {django-stubs => typings/django}/db/migrations/operations/utils.pyi (100%) rename {django-stubs => typings/django}/db/migrations/optimizer.pyi (100%) rename {django-stubs => typings/django}/db/migrations/questioner.pyi (100%) rename {django-stubs => typings/django}/db/migrations/recorder.pyi (100%) rename {django-stubs => typings/django}/db/migrations/serializer.pyi (100%) rename {django-stubs => typings/django}/db/migrations/state.pyi (100%) rename {django-stubs => typings/django}/db/migrations/topological_sort.pyi (100%) rename {django-stubs => typings/django}/db/migrations/utils.pyi (100%) rename {django-stubs => typings/django}/db/migrations/writer.pyi (100%) rename {django-stubs => typings/django}/db/models/__init__.pyi (100%) rename {django-stubs => typings/django}/db/models/aggregates.pyi (100%) rename {django-stubs => typings/django}/db/models/base.pyi (100%) rename {django-stubs => typings/django}/db/models/constants.pyi (100%) rename {django-stubs => typings/django}/db/models/constraints.pyi (100%) rename {django-stubs => typings/django}/db/models/deletion.pyi (100%) rename {django-stubs => typings/django}/db/models/enums.pyi (100%) rename {django-stubs => typings/django}/db/models/expressions.pyi (100%) rename {django-stubs => typings/django}/db/models/fields/__init__.pyi (100%) rename {django-stubs => typings/django}/db/models/fields/files.pyi (100%) rename {django-stubs => typings/django}/db/models/fields/json.pyi (100%) rename {django-stubs => typings/django}/db/models/fields/mixins.pyi (100%) rename {django-stubs => typings/django}/db/models/fields/proxy.pyi (100%) rename {django-stubs => typings/django}/db/models/fields/related.pyi (100%) rename {django-stubs => typings/django}/db/models/fields/related_descriptors.pyi (100%) rename {django-stubs => typings/django}/db/models/fields/related_lookups.pyi (100%) rename {django-stubs => typings/django}/db/models/fields/reverse_related.pyi (100%) rename {django-stubs => typings/django}/db/models/functions/__init__.pyi (100%) rename {django-stubs => typings/django}/db/models/functions/comparison.pyi (100%) rename {django-stubs => typings/django}/db/models/functions/datetime.pyi (100%) rename {django-stubs => typings/django}/db/models/functions/math.pyi (100%) rename {django-stubs => typings/django}/db/models/functions/mixins.pyi (100%) rename {django-stubs => typings/django}/db/models/functions/text.pyi (100%) rename {django-stubs => typings/django}/db/models/functions/window.pyi (100%) rename {django-stubs => typings/django}/db/models/indexes.pyi (100%) rename {django-stubs => typings/django}/db/models/lookups.pyi (100%) rename {django-stubs => typings/django}/db/models/manager.pyi (100%) rename {django-stubs => typings/django}/db/models/options.pyi (100%) rename {django-stubs => typings/django}/db/models/query.pyi (100%) rename {django-stubs => typings/django}/db/models/query_utils.pyi (100%) rename {django-stubs => typings/django}/db/models/signals.pyi (100%) rename {django-stubs => typings/django}/db/models/sql/__init__.pyi (100%) rename {django-stubs => typings/django}/db/models/sql/compiler.pyi (100%) rename {django-stubs => typings/django}/db/models/sql/constants.pyi (100%) rename {django-stubs => typings/django}/db/models/sql/datastructures.pyi (100%) rename {django-stubs => typings/django}/db/models/sql/query.pyi (100%) rename {django-stubs => typings/django}/db/models/sql/subqueries.pyi (100%) rename {django-stubs => typings/django}/db/models/sql/where.pyi (100%) rename {django-stubs => typings/django}/db/models/utils.pyi (100%) rename {django-stubs => typings/django}/db/transaction.pyi (100%) rename {django-stubs => typings/django}/db/utils.pyi (100%) rename {django-stubs => typings/django}/dispatch/__init__.pyi (100%) rename {django-stubs => typings/django}/dispatch/dispatcher.pyi (100%) rename {django-stubs => typings/django}/forms/__init__.pyi (100%) rename {django-stubs => typings/django}/forms/boundfield.pyi (100%) rename {django-stubs => typings/django}/forms/fields.pyi (100%) rename {django-stubs => typings/django}/forms/forms.pyi (100%) rename {django-stubs => typings/django}/forms/formsets.pyi (100%) rename {django-stubs => typings/django}/forms/models.pyi (100%) rename {django-stubs => typings/django}/forms/renderers.pyi (100%) rename {django-stubs => typings/django}/forms/utils.pyi (100%) rename {django-stubs => typings/django}/forms/widgets.pyi (100%) rename {django-stubs => typings/django}/http/__init__.pyi (100%) rename {django-stubs => typings/django}/http/cookie.pyi (100%) rename {django-stubs => typings/django}/http/multipartparser.pyi (100%) rename {django-stubs => typings/django}/http/request.pyi (100%) rename {django-stubs => typings/django}/http/response.pyi (100%) rename {django-stubs => typings/django}/middleware/__init__.pyi (100%) rename {django-stubs => typings/django}/middleware/cache.pyi (100%) rename {django-stubs => typings/django}/middleware/clickjacking.pyi (100%) rename {django-stubs => typings/django}/middleware/common.pyi (100%) rename {django-stubs => typings/django}/middleware/csrf.pyi (100%) rename {django-stubs => typings/django}/middleware/gzip.pyi (100%) rename {django-stubs => typings/django}/middleware/http.pyi (100%) rename {django-stubs => typings/django}/middleware/locale.pyi (100%) rename {django-stubs => typings/django}/middleware/security.pyi (100%) rename {django-stubs => typings/django}/shortcuts.pyi (100%) rename {django-stubs => typings/django}/template/__init__.pyi (100%) rename {django-stubs => typings/django}/template/backends/__init__.pyi (100%) rename {django-stubs => typings/django}/template/backends/base.pyi (100%) rename {django-stubs => typings/django}/template/backends/django.pyi (100%) rename {django-stubs => typings/django}/template/backends/dummy.pyi (100%) rename {django-stubs => typings/django}/template/backends/jinja2.pyi (100%) rename {django-stubs => typings/django}/template/backends/utils.pyi (100%) rename {django-stubs => typings/django}/template/base.pyi (100%) rename {django-stubs => typings/django}/template/context.pyi (100%) rename {django-stubs => typings/django}/template/context_processors.pyi (100%) rename {django-stubs => typings/django}/template/defaultfilters.pyi (100%) rename {django-stubs => typings/django}/template/defaulttags.pyi (100%) rename {django-stubs => typings/django}/template/engine.pyi (100%) rename {django-stubs => typings/django}/template/exceptions.pyi (100%) rename {django-stubs => typings/django}/template/library.pyi (100%) rename {django-stubs => typings/django}/template/loader.pyi (100%) rename {django-stubs => typings/django}/template/loader_tags.pyi (100%) rename {django-stubs => typings/django}/template/loaders/__init__.pyi (100%) rename {django-stubs => typings/django}/template/loaders/app_directories.pyi (100%) rename {django-stubs => typings/django}/template/loaders/base.pyi (100%) rename {django-stubs => typings/django}/template/loaders/cached.pyi (100%) rename {django-stubs => typings/django}/template/loaders/filesystem.pyi (100%) rename {django-stubs => typings/django}/template/loaders/locmem.pyi (100%) rename {django-stubs => typings/django}/template/response.pyi (100%) rename {django-stubs => typings/django}/template/smartif.pyi (100%) rename {django-stubs => typings/django}/template/utils.pyi (100%) rename {django-stubs => typings/django}/templatetags/__init__.pyi (100%) rename {django-stubs => typings/django}/templatetags/cache.pyi (100%) rename {django-stubs => typings/django}/templatetags/i18n.pyi (100%) rename {django-stubs => typings/django}/templatetags/l10n.pyi (100%) rename {django-stubs => typings/django}/templatetags/static.pyi (100%) rename {django-stubs => typings/django}/templatetags/tz.pyi (100%) rename {django-stubs => typings/django}/test/__init__.pyi (100%) rename {django-stubs => typings/django}/test/client.pyi (100%) rename {django-stubs => typings/django}/test/html.pyi (100%) rename {django-stubs => typings/django}/test/runner.pyi (100%) rename {django-stubs => typings/django}/test/selenium.pyi (100%) rename {django-stubs => typings/django}/test/signals.pyi (100%) rename {django-stubs => typings/django}/test/testcases.pyi (100%) rename {django-stubs => typings/django}/test/utils.pyi (100%) rename {django-stubs => typings/django}/urls/__init__.pyi (100%) rename {django-stubs => typings/django}/urls/base.pyi (100%) rename {django-stubs => typings/django}/urls/conf.pyi (100%) rename {django-stubs => typings/django}/urls/converters.pyi (100%) rename {django-stubs => typings/django}/urls/exceptions.pyi (100%) rename {django-stubs => typings/django}/urls/resolvers.pyi (100%) rename {django-stubs => typings/django}/urls/utils.pyi (100%) rename {django-stubs => typings/django}/utils/__init__.pyi (100%) rename {django-stubs => typings/django}/utils/_os.pyi (100%) rename {django-stubs => typings/django}/utils/archive.pyi (100%) rename {django-stubs => typings/django}/utils/asyncio.pyi (100%) rename {django-stubs => typings/django}/utils/autoreload.pyi (100%) rename {django-stubs => typings/django}/utils/baseconv.pyi (100%) rename {django-stubs => typings/django}/utils/cache.pyi (100%) rename {django-stubs => typings/django}/utils/crypto.pyi (100%) rename {django-stubs => typings/django}/utils/datastructures.pyi (100%) rename {django-stubs => typings/django}/utils/dateformat.pyi (100%) rename {django-stubs => typings/django}/utils/dateparse.pyi (100%) rename {django-stubs => typings/django}/utils/dates.pyi (100%) rename {django-stubs => typings/django}/utils/datetime_safe.pyi (100%) rename {django-stubs => typings/django}/utils/deconstruct.pyi (100%) rename {django-stubs => typings/django}/utils/decorators.pyi (100%) rename {django-stubs => typings/django}/utils/deprecation.pyi (100%) rename {django-stubs => typings/django}/utils/duration.pyi (100%) rename {django-stubs => typings/django}/utils/encoding.pyi (100%) rename {django-stubs => typings/django}/utils/feedgenerator.pyi (100%) rename {django-stubs => typings/django}/utils/formats.pyi (100%) rename {django-stubs => typings/django}/utils/functional.pyi (100%) rename {django-stubs => typings/django}/utils/hashable.pyi (100%) rename {django-stubs => typings/django}/utils/html.pyi (100%) rename {django-stubs => typings/django}/utils/http.pyi (100%) rename {django-stubs => typings/django}/utils/inspect.pyi (100%) rename {django-stubs => typings/django}/utils/ipv6.pyi (100%) rename {django-stubs => typings/django}/utils/itercompat.pyi (100%) rename {django-stubs => typings/django}/utils/jslex.pyi (100%) rename {django-stubs => typings/django}/utils/log.pyi (100%) rename {django-stubs => typings/django}/utils/lorem_ipsum.pyi (100%) rename {django-stubs => typings/django}/utils/module_loading.pyi (100%) rename {django-stubs => typings/django}/utils/numberformat.pyi (100%) rename {django-stubs => typings/django}/utils/regex_helper.pyi (100%) rename {django-stubs => typings/django}/utils/safestring.pyi (100%) rename {django-stubs => typings/django}/utils/six.pyi (100%) rename {django-stubs => typings/django}/utils/termcolors.pyi (100%) rename {django-stubs => typings/django}/utils/text.pyi (100%) rename {django-stubs => typings/django}/utils/timesince.pyi (100%) rename {django-stubs => typings/django}/utils/timezone.pyi (100%) rename {django-stubs => typings/django}/utils/topological_sort.pyi (100%) rename {django-stubs => typings/django}/utils/translation/__init__.pyi (100%) rename {django-stubs => typings/django}/utils/translation/reloader.pyi (100%) rename {django-stubs => typings/django}/utils/translation/template.pyi (100%) rename {django-stubs => typings/django}/utils/translation/trans_null.pyi (100%) rename {django-stubs => typings/django}/utils/translation/trans_real.pyi (100%) rename {django-stubs => typings/django}/utils/tree.pyi (100%) rename {django-stubs => typings/django}/utils/version.pyi (100%) rename {django-stubs => typings/django}/utils/xmlutils.pyi (100%) rename {django-stubs => typings/django}/views/__init__.pyi (100%) rename {django-stubs => typings/django}/views/csrf.pyi (100%) rename {django-stubs => typings/django}/views/debug.pyi (100%) rename {django-stubs => typings/django}/views/decorators/__init__.pyi (100%) rename {django-stubs => typings/django}/views/decorators/cache.pyi (100%) rename {django-stubs => typings/django}/views/decorators/clickjacking.pyi (100%) rename {django-stubs => typings/django}/views/decorators/csrf.pyi (100%) rename {django-stubs => typings/django}/views/decorators/debug.pyi (100%) rename {django-stubs => typings/django}/views/decorators/gzip.pyi (100%) rename {django-stubs => typings/django}/views/decorators/http.pyi (100%) rename {django-stubs => typings/django}/views/decorators/vary.pyi (100%) rename {django-stubs => typings/django}/views/defaults.pyi (100%) rename {django-stubs => typings/django}/views/generic/__init__.pyi (100%) rename {django-stubs => typings/django}/views/generic/base.pyi (100%) rename {django-stubs => typings/django}/views/generic/dates.pyi (100%) rename {django-stubs => typings/django}/views/generic/detail.pyi (100%) rename {django-stubs => typings/django}/views/generic/edit.pyi (100%) rename {django-stubs => typings/django}/views/generic/list.pyi (100%) rename {django-stubs => typings/django}/views/i18n.pyi (100%) rename {django-stubs => typings/django}/views/static.pyi (100%) rename {psycopg2-stubs => typings/psycopg2}/__init__.pyi (100%) rename {psycopg2-stubs => typings/psycopg2}/_range.pyi (100%) rename {psycopg2-stubs => typings/psycopg2}/errors.pyi (100%) rename {psycopg2-stubs => typings/psycopg2}/extensions.pyi (100%) rename {psycopg2-stubs => typings/psycopg2}/extras.pyi (100%) rename {psycopg2-stubs => typings/psycopg2}/tz.pyi (100%) diff --git a/django-stubs b/django-stubs new file mode 120000 index 000000000..71d175bbc --- /dev/null +++ b/django-stubs @@ -0,0 +1 @@ +./typings/django \ No newline at end of file diff --git a/psycopg2-stubs b/psycopg2-stubs new file mode 120000 index 000000000..71a112e06 --- /dev/null +++ b/psycopg2-stubs @@ -0,0 +1 @@ +./typings/psycopg2 \ No newline at end of file diff --git a/django-stubs/__init__.pyi b/typings/django/__init__.pyi similarity index 100% rename from django-stubs/__init__.pyi rename to typings/django/__init__.pyi diff --git a/django-stubs/apps/__init__.pyi b/typings/django/apps/__init__.pyi similarity index 100% rename from django-stubs/apps/__init__.pyi rename to typings/django/apps/__init__.pyi diff --git a/django-stubs/apps/config.pyi b/typings/django/apps/config.pyi similarity index 100% rename from django-stubs/apps/config.pyi rename to typings/django/apps/config.pyi diff --git a/django-stubs/apps/registry.pyi b/typings/django/apps/registry.pyi similarity index 100% rename from django-stubs/apps/registry.pyi rename to typings/django/apps/registry.pyi diff --git a/django-stubs/conf/__init__.pyi b/typings/django/conf/__init__.pyi similarity index 100% rename from django-stubs/conf/__init__.pyi rename to typings/django/conf/__init__.pyi diff --git a/django-stubs/conf/global_settings.pyi b/typings/django/conf/global_settings.pyi similarity index 100% rename from django-stubs/conf/global_settings.pyi rename to typings/django/conf/global_settings.pyi diff --git a/django-stubs/conf/locale/__init__.pyi b/typings/django/conf/locale/__init__.pyi similarity index 100% rename from django-stubs/conf/locale/__init__.pyi rename to typings/django/conf/locale/__init__.pyi diff --git a/django-stubs/conf/urls/__init__.pyi b/typings/django/conf/urls/__init__.pyi similarity index 100% rename from django-stubs/conf/urls/__init__.pyi rename to typings/django/conf/urls/__init__.pyi diff --git a/django-stubs/conf/urls/i18n.pyi b/typings/django/conf/urls/i18n.pyi similarity index 100% rename from django-stubs/conf/urls/i18n.pyi rename to typings/django/conf/urls/i18n.pyi diff --git a/django-stubs/conf/urls/static.pyi b/typings/django/conf/urls/static.pyi similarity index 100% rename from django-stubs/conf/urls/static.pyi rename to typings/django/conf/urls/static.pyi diff --git a/django-stubs/contrib/__init__.pyi b/typings/django/contrib/__init__.pyi similarity index 100% rename from django-stubs/contrib/__init__.pyi rename to typings/django/contrib/__init__.pyi diff --git a/django-stubs/contrib/admin/__init__.pyi b/typings/django/contrib/admin/__init__.pyi similarity index 100% rename from django-stubs/contrib/admin/__init__.pyi rename to typings/django/contrib/admin/__init__.pyi diff --git a/django-stubs/contrib/admin/actions.pyi b/typings/django/contrib/admin/actions.pyi similarity index 100% rename from django-stubs/contrib/admin/actions.pyi rename to typings/django/contrib/admin/actions.pyi diff --git a/django-stubs/contrib/admin/apps.pyi b/typings/django/contrib/admin/apps.pyi similarity index 100% rename from django-stubs/contrib/admin/apps.pyi rename to typings/django/contrib/admin/apps.pyi diff --git a/django-stubs/contrib/admin/checks.pyi b/typings/django/contrib/admin/checks.pyi similarity index 100% rename from django-stubs/contrib/admin/checks.pyi rename to typings/django/contrib/admin/checks.pyi diff --git a/django-stubs/contrib/admin/decorators.pyi b/typings/django/contrib/admin/decorators.pyi similarity index 100% rename from django-stubs/contrib/admin/decorators.pyi rename to typings/django/contrib/admin/decorators.pyi diff --git a/django-stubs/contrib/admin/exceptions.pyi b/typings/django/contrib/admin/exceptions.pyi similarity index 100% rename from django-stubs/contrib/admin/exceptions.pyi rename to typings/django/contrib/admin/exceptions.pyi diff --git a/django-stubs/contrib/admin/filters.pyi b/typings/django/contrib/admin/filters.pyi similarity index 100% rename from django-stubs/contrib/admin/filters.pyi rename to typings/django/contrib/admin/filters.pyi diff --git a/django-stubs/contrib/admin/forms.pyi b/typings/django/contrib/admin/forms.pyi similarity index 100% rename from django-stubs/contrib/admin/forms.pyi rename to typings/django/contrib/admin/forms.pyi diff --git a/django-stubs/contrib/admin/helpers.pyi b/typings/django/contrib/admin/helpers.pyi similarity index 100% rename from django-stubs/contrib/admin/helpers.pyi rename to typings/django/contrib/admin/helpers.pyi diff --git a/django-stubs/contrib/admin/migrations/__init__.pyi b/typings/django/contrib/admin/migrations/__init__.pyi similarity index 100% rename from django-stubs/contrib/admin/migrations/__init__.pyi rename to typings/django/contrib/admin/migrations/__init__.pyi diff --git a/django-stubs/contrib/admin/models.pyi b/typings/django/contrib/admin/models.pyi similarity index 100% rename from django-stubs/contrib/admin/models.pyi rename to typings/django/contrib/admin/models.pyi diff --git a/django-stubs/contrib/admin/options.pyi b/typings/django/contrib/admin/options.pyi similarity index 100% rename from django-stubs/contrib/admin/options.pyi rename to typings/django/contrib/admin/options.pyi diff --git a/django-stubs/contrib/admin/sites.pyi b/typings/django/contrib/admin/sites.pyi similarity index 100% rename from django-stubs/contrib/admin/sites.pyi rename to typings/django/contrib/admin/sites.pyi diff --git a/django-stubs/contrib/admin/templatetags/__init__.pyi b/typings/django/contrib/admin/templatetags/__init__.pyi similarity index 100% rename from django-stubs/contrib/admin/templatetags/__init__.pyi rename to typings/django/contrib/admin/templatetags/__init__.pyi diff --git a/django-stubs/contrib/admin/templatetags/admin_list.pyi b/typings/django/contrib/admin/templatetags/admin_list.pyi similarity index 100% rename from django-stubs/contrib/admin/templatetags/admin_list.pyi rename to typings/django/contrib/admin/templatetags/admin_list.pyi diff --git a/django-stubs/contrib/admin/templatetags/admin_modify.pyi b/typings/django/contrib/admin/templatetags/admin_modify.pyi similarity index 100% rename from django-stubs/contrib/admin/templatetags/admin_modify.pyi rename to typings/django/contrib/admin/templatetags/admin_modify.pyi diff --git a/django-stubs/contrib/admin/templatetags/admin_static.pyi b/typings/django/contrib/admin/templatetags/admin_static.pyi similarity index 100% rename from django-stubs/contrib/admin/templatetags/admin_static.pyi rename to typings/django/contrib/admin/templatetags/admin_static.pyi diff --git a/django-stubs/contrib/admin/templatetags/admin_urls.pyi b/typings/django/contrib/admin/templatetags/admin_urls.pyi similarity index 100% rename from django-stubs/contrib/admin/templatetags/admin_urls.pyi rename to typings/django/contrib/admin/templatetags/admin_urls.pyi diff --git a/django-stubs/contrib/admin/templatetags/base.pyi b/typings/django/contrib/admin/templatetags/base.pyi similarity index 100% rename from django-stubs/contrib/admin/templatetags/base.pyi rename to typings/django/contrib/admin/templatetags/base.pyi diff --git a/django-stubs/contrib/admin/templatetags/log.pyi b/typings/django/contrib/admin/templatetags/log.pyi similarity index 100% rename from django-stubs/contrib/admin/templatetags/log.pyi rename to typings/django/contrib/admin/templatetags/log.pyi diff --git a/django-stubs/contrib/admin/tests.pyi b/typings/django/contrib/admin/tests.pyi similarity index 100% rename from django-stubs/contrib/admin/tests.pyi rename to typings/django/contrib/admin/tests.pyi diff --git a/django-stubs/contrib/admin/utils.pyi b/typings/django/contrib/admin/utils.pyi similarity index 100% rename from django-stubs/contrib/admin/utils.pyi rename to typings/django/contrib/admin/utils.pyi diff --git a/django-stubs/contrib/admin/views/__init__.pyi b/typings/django/contrib/admin/views/__init__.pyi similarity index 100% rename from django-stubs/contrib/admin/views/__init__.pyi rename to typings/django/contrib/admin/views/__init__.pyi diff --git a/django-stubs/contrib/admin/views/autocomplete.pyi b/typings/django/contrib/admin/views/autocomplete.pyi similarity index 100% rename from django-stubs/contrib/admin/views/autocomplete.pyi rename to typings/django/contrib/admin/views/autocomplete.pyi diff --git a/django-stubs/contrib/admin/views/decorators.pyi b/typings/django/contrib/admin/views/decorators.pyi similarity index 100% rename from django-stubs/contrib/admin/views/decorators.pyi rename to typings/django/contrib/admin/views/decorators.pyi diff --git a/django-stubs/contrib/admin/views/main.pyi b/typings/django/contrib/admin/views/main.pyi similarity index 100% rename from django-stubs/contrib/admin/views/main.pyi rename to typings/django/contrib/admin/views/main.pyi diff --git a/django-stubs/contrib/admin/widgets.pyi b/typings/django/contrib/admin/widgets.pyi similarity index 100% rename from django-stubs/contrib/admin/widgets.pyi rename to typings/django/contrib/admin/widgets.pyi diff --git a/django-stubs/contrib/admindocs/__init__.pyi b/typings/django/contrib/admindocs/__init__.pyi similarity index 100% rename from django-stubs/contrib/admindocs/__init__.pyi rename to typings/django/contrib/admindocs/__init__.pyi diff --git a/django-stubs/contrib/admindocs/apps.pyi b/typings/django/contrib/admindocs/apps.pyi similarity index 100% rename from django-stubs/contrib/admindocs/apps.pyi rename to typings/django/contrib/admindocs/apps.pyi diff --git a/django-stubs/contrib/admindocs/middleware.pyi b/typings/django/contrib/admindocs/middleware.pyi similarity index 100% rename from django-stubs/contrib/admindocs/middleware.pyi rename to typings/django/contrib/admindocs/middleware.pyi diff --git a/django-stubs/contrib/admindocs/urls.pyi b/typings/django/contrib/admindocs/urls.pyi similarity index 100% rename from django-stubs/contrib/admindocs/urls.pyi rename to typings/django/contrib/admindocs/urls.pyi diff --git a/django-stubs/contrib/admindocs/utils.pyi b/typings/django/contrib/admindocs/utils.pyi similarity index 100% rename from django-stubs/contrib/admindocs/utils.pyi rename to typings/django/contrib/admindocs/utils.pyi diff --git a/django-stubs/contrib/admindocs/views.pyi b/typings/django/contrib/admindocs/views.pyi similarity index 100% rename from django-stubs/contrib/admindocs/views.pyi rename to typings/django/contrib/admindocs/views.pyi diff --git a/django-stubs/contrib/auth/__init__.pyi b/typings/django/contrib/auth/__init__.pyi similarity index 100% rename from django-stubs/contrib/auth/__init__.pyi rename to typings/django/contrib/auth/__init__.pyi diff --git a/django-stubs/contrib/auth/admin.pyi b/typings/django/contrib/auth/admin.pyi similarity index 100% rename from django-stubs/contrib/auth/admin.pyi rename to typings/django/contrib/auth/admin.pyi diff --git a/django-stubs/contrib/auth/apps.pyi b/typings/django/contrib/auth/apps.pyi similarity index 100% rename from django-stubs/contrib/auth/apps.pyi rename to typings/django/contrib/auth/apps.pyi diff --git a/django-stubs/contrib/auth/backends.pyi b/typings/django/contrib/auth/backends.pyi similarity index 100% rename from django-stubs/contrib/auth/backends.pyi rename to typings/django/contrib/auth/backends.pyi diff --git a/django-stubs/contrib/auth/base_user.pyi b/typings/django/contrib/auth/base_user.pyi similarity index 100% rename from django-stubs/contrib/auth/base_user.pyi rename to typings/django/contrib/auth/base_user.pyi diff --git a/django-stubs/contrib/auth/checks.pyi b/typings/django/contrib/auth/checks.pyi similarity index 100% rename from django-stubs/contrib/auth/checks.pyi rename to typings/django/contrib/auth/checks.pyi diff --git a/django-stubs/contrib/auth/context_processors.pyi b/typings/django/contrib/auth/context_processors.pyi similarity index 100% rename from django-stubs/contrib/auth/context_processors.pyi rename to typings/django/contrib/auth/context_processors.pyi diff --git a/django-stubs/contrib/auth/decorators.pyi b/typings/django/contrib/auth/decorators.pyi similarity index 100% rename from django-stubs/contrib/auth/decorators.pyi rename to typings/django/contrib/auth/decorators.pyi diff --git a/django-stubs/contrib/auth/forms.pyi b/typings/django/contrib/auth/forms.pyi similarity index 100% rename from django-stubs/contrib/auth/forms.pyi rename to typings/django/contrib/auth/forms.pyi diff --git a/django-stubs/contrib/auth/handlers/__init__.pyi b/typings/django/contrib/auth/handlers/__init__.pyi similarity index 100% rename from django-stubs/contrib/auth/handlers/__init__.pyi rename to typings/django/contrib/auth/handlers/__init__.pyi diff --git a/django-stubs/contrib/auth/handlers/modwsgi.pyi b/typings/django/contrib/auth/handlers/modwsgi.pyi similarity index 100% rename from django-stubs/contrib/auth/handlers/modwsgi.pyi rename to typings/django/contrib/auth/handlers/modwsgi.pyi diff --git a/django-stubs/contrib/auth/hashers.pyi b/typings/django/contrib/auth/hashers.pyi similarity index 100% rename from django-stubs/contrib/auth/hashers.pyi rename to typings/django/contrib/auth/hashers.pyi diff --git a/django-stubs/contrib/auth/management/__init__.pyi b/typings/django/contrib/auth/management/__init__.pyi similarity index 100% rename from django-stubs/contrib/auth/management/__init__.pyi rename to typings/django/contrib/auth/management/__init__.pyi diff --git a/django-stubs/contrib/auth/management/commands/__init__.pyi b/typings/django/contrib/auth/management/commands/__init__.pyi similarity index 100% rename from django-stubs/contrib/auth/management/commands/__init__.pyi rename to typings/django/contrib/auth/management/commands/__init__.pyi diff --git a/django-stubs/contrib/auth/management/commands/changepassword.pyi b/typings/django/contrib/auth/management/commands/changepassword.pyi similarity index 100% rename from django-stubs/contrib/auth/management/commands/changepassword.pyi rename to typings/django/contrib/auth/management/commands/changepassword.pyi diff --git a/django-stubs/contrib/auth/management/commands/createsuperuser.pyi b/typings/django/contrib/auth/management/commands/createsuperuser.pyi similarity index 100% rename from django-stubs/contrib/auth/management/commands/createsuperuser.pyi rename to typings/django/contrib/auth/management/commands/createsuperuser.pyi diff --git a/django-stubs/contrib/auth/middleware.pyi b/typings/django/contrib/auth/middleware.pyi similarity index 100% rename from django-stubs/contrib/auth/middleware.pyi rename to typings/django/contrib/auth/middleware.pyi diff --git a/django-stubs/contrib/auth/migrations/__init__.pyi b/typings/django/contrib/auth/migrations/__init__.pyi similarity index 100% rename from django-stubs/contrib/auth/migrations/__init__.pyi rename to typings/django/contrib/auth/migrations/__init__.pyi diff --git a/django-stubs/contrib/auth/mixins.pyi b/typings/django/contrib/auth/mixins.pyi similarity index 100% rename from django-stubs/contrib/auth/mixins.pyi rename to typings/django/contrib/auth/mixins.pyi diff --git a/django-stubs/contrib/auth/models.pyi b/typings/django/contrib/auth/models.pyi similarity index 100% rename from django-stubs/contrib/auth/models.pyi rename to typings/django/contrib/auth/models.pyi diff --git a/django-stubs/contrib/auth/password_validation.pyi b/typings/django/contrib/auth/password_validation.pyi similarity index 100% rename from django-stubs/contrib/auth/password_validation.pyi rename to typings/django/contrib/auth/password_validation.pyi diff --git a/django-stubs/contrib/auth/signals.pyi b/typings/django/contrib/auth/signals.pyi similarity index 100% rename from django-stubs/contrib/auth/signals.pyi rename to typings/django/contrib/auth/signals.pyi diff --git a/django-stubs/contrib/auth/tokens.pyi b/typings/django/contrib/auth/tokens.pyi similarity index 100% rename from django-stubs/contrib/auth/tokens.pyi rename to typings/django/contrib/auth/tokens.pyi diff --git a/django-stubs/contrib/auth/urls.pyi b/typings/django/contrib/auth/urls.pyi similarity index 100% rename from django-stubs/contrib/auth/urls.pyi rename to typings/django/contrib/auth/urls.pyi diff --git a/django-stubs/contrib/auth/validators.pyi b/typings/django/contrib/auth/validators.pyi similarity index 100% rename from django-stubs/contrib/auth/validators.pyi rename to typings/django/contrib/auth/validators.pyi diff --git a/django-stubs/contrib/auth/views.pyi b/typings/django/contrib/auth/views.pyi similarity index 100% rename from django-stubs/contrib/auth/views.pyi rename to typings/django/contrib/auth/views.pyi diff --git a/django-stubs/contrib/contenttypes/__init__.pyi b/typings/django/contrib/contenttypes/__init__.pyi similarity index 100% rename from django-stubs/contrib/contenttypes/__init__.pyi rename to typings/django/contrib/contenttypes/__init__.pyi diff --git a/django-stubs/contrib/contenttypes/admin.pyi b/typings/django/contrib/contenttypes/admin.pyi similarity index 100% rename from django-stubs/contrib/contenttypes/admin.pyi rename to typings/django/contrib/contenttypes/admin.pyi diff --git a/django-stubs/contrib/contenttypes/apps.pyi b/typings/django/contrib/contenttypes/apps.pyi similarity index 100% rename from django-stubs/contrib/contenttypes/apps.pyi rename to typings/django/contrib/contenttypes/apps.pyi diff --git a/django-stubs/contrib/contenttypes/checks.pyi b/typings/django/contrib/contenttypes/checks.pyi similarity index 100% rename from django-stubs/contrib/contenttypes/checks.pyi rename to typings/django/contrib/contenttypes/checks.pyi diff --git a/django-stubs/contrib/contenttypes/fields.pyi b/typings/django/contrib/contenttypes/fields.pyi similarity index 100% rename from django-stubs/contrib/contenttypes/fields.pyi rename to typings/django/contrib/contenttypes/fields.pyi diff --git a/django-stubs/contrib/contenttypes/forms.pyi b/typings/django/contrib/contenttypes/forms.pyi similarity index 100% rename from django-stubs/contrib/contenttypes/forms.pyi rename to typings/django/contrib/contenttypes/forms.pyi diff --git a/django-stubs/contrib/contenttypes/management/__init__.pyi b/typings/django/contrib/contenttypes/management/__init__.pyi similarity index 100% rename from django-stubs/contrib/contenttypes/management/__init__.pyi rename to typings/django/contrib/contenttypes/management/__init__.pyi diff --git a/django-stubs/contrib/contenttypes/management/commands/__init__.pyi b/typings/django/contrib/contenttypes/management/commands/__init__.pyi similarity index 100% rename from django-stubs/contrib/contenttypes/management/commands/__init__.pyi rename to typings/django/contrib/contenttypes/management/commands/__init__.pyi diff --git a/django-stubs/contrib/contenttypes/management/commands/remove_stale_contenttypes.pyi b/typings/django/contrib/contenttypes/management/commands/remove_stale_contenttypes.pyi similarity index 100% rename from django-stubs/contrib/contenttypes/management/commands/remove_stale_contenttypes.pyi rename to typings/django/contrib/contenttypes/management/commands/remove_stale_contenttypes.pyi diff --git a/django-stubs/contrib/contenttypes/migrations/__init__.pyi b/typings/django/contrib/contenttypes/migrations/__init__.pyi similarity index 100% rename from django-stubs/contrib/contenttypes/migrations/__init__.pyi rename to typings/django/contrib/contenttypes/migrations/__init__.pyi diff --git a/django-stubs/contrib/contenttypes/models.pyi b/typings/django/contrib/contenttypes/models.pyi similarity index 100% rename from django-stubs/contrib/contenttypes/models.pyi rename to typings/django/contrib/contenttypes/models.pyi diff --git a/django-stubs/contrib/contenttypes/views.pyi b/typings/django/contrib/contenttypes/views.pyi similarity index 100% rename from django-stubs/contrib/contenttypes/views.pyi rename to typings/django/contrib/contenttypes/views.pyi diff --git a/django-stubs/contrib/flatpages/__init__.pyi b/typings/django/contrib/flatpages/__init__.pyi similarity index 100% rename from django-stubs/contrib/flatpages/__init__.pyi rename to typings/django/contrib/flatpages/__init__.pyi diff --git a/django-stubs/contrib/flatpages/admin.pyi b/typings/django/contrib/flatpages/admin.pyi similarity index 100% rename from django-stubs/contrib/flatpages/admin.pyi rename to typings/django/contrib/flatpages/admin.pyi diff --git a/django-stubs/contrib/flatpages/apps.pyi b/typings/django/contrib/flatpages/apps.pyi similarity index 100% rename from django-stubs/contrib/flatpages/apps.pyi rename to typings/django/contrib/flatpages/apps.pyi diff --git a/django-stubs/contrib/flatpages/forms.pyi b/typings/django/contrib/flatpages/forms.pyi similarity index 100% rename from django-stubs/contrib/flatpages/forms.pyi rename to typings/django/contrib/flatpages/forms.pyi diff --git a/django-stubs/contrib/flatpages/middleware.pyi b/typings/django/contrib/flatpages/middleware.pyi similarity index 100% rename from django-stubs/contrib/flatpages/middleware.pyi rename to typings/django/contrib/flatpages/middleware.pyi diff --git a/django-stubs/contrib/flatpages/migrations/__init__.pyi b/typings/django/contrib/flatpages/migrations/__init__.pyi similarity index 100% rename from django-stubs/contrib/flatpages/migrations/__init__.pyi rename to typings/django/contrib/flatpages/migrations/__init__.pyi diff --git a/django-stubs/contrib/flatpages/models.pyi b/typings/django/contrib/flatpages/models.pyi similarity index 100% rename from django-stubs/contrib/flatpages/models.pyi rename to typings/django/contrib/flatpages/models.pyi diff --git a/django-stubs/contrib/flatpages/sitemaps.pyi b/typings/django/contrib/flatpages/sitemaps.pyi similarity index 100% rename from django-stubs/contrib/flatpages/sitemaps.pyi rename to typings/django/contrib/flatpages/sitemaps.pyi diff --git a/django-stubs/contrib/flatpages/templatetags/__init__.pyi b/typings/django/contrib/flatpages/templatetags/__init__.pyi similarity index 100% rename from django-stubs/contrib/flatpages/templatetags/__init__.pyi rename to typings/django/contrib/flatpages/templatetags/__init__.pyi diff --git a/django-stubs/contrib/flatpages/templatetags/flatpages.pyi b/typings/django/contrib/flatpages/templatetags/flatpages.pyi similarity index 100% rename from django-stubs/contrib/flatpages/templatetags/flatpages.pyi rename to typings/django/contrib/flatpages/templatetags/flatpages.pyi diff --git a/django-stubs/contrib/flatpages/urls.pyi b/typings/django/contrib/flatpages/urls.pyi similarity index 100% rename from django-stubs/contrib/flatpages/urls.pyi rename to typings/django/contrib/flatpages/urls.pyi diff --git a/django-stubs/contrib/flatpages/views.pyi b/typings/django/contrib/flatpages/views.pyi similarity index 100% rename from django-stubs/contrib/flatpages/views.pyi rename to typings/django/contrib/flatpages/views.pyi diff --git a/django-stubs/contrib/gis/__init__.pyi b/typings/django/contrib/gis/__init__.pyi similarity index 100% rename from django-stubs/contrib/gis/__init__.pyi rename to typings/django/contrib/gis/__init__.pyi diff --git a/django-stubs/contrib/gis/admin/__init__.pyi b/typings/django/contrib/gis/admin/__init__.pyi similarity index 100% rename from django-stubs/contrib/gis/admin/__init__.pyi rename to typings/django/contrib/gis/admin/__init__.pyi diff --git a/django-stubs/contrib/gis/admin/options.pyi b/typings/django/contrib/gis/admin/options.pyi similarity index 100% rename from django-stubs/contrib/gis/admin/options.pyi rename to typings/django/contrib/gis/admin/options.pyi diff --git a/django-stubs/contrib/gis/admin/widgets.pyi b/typings/django/contrib/gis/admin/widgets.pyi similarity index 100% rename from django-stubs/contrib/gis/admin/widgets.pyi rename to typings/django/contrib/gis/admin/widgets.pyi diff --git a/django-stubs/contrib/gis/apps.pyi b/typings/django/contrib/gis/apps.pyi similarity index 100% rename from django-stubs/contrib/gis/apps.pyi rename to typings/django/contrib/gis/apps.pyi diff --git a/django-stubs/contrib/gis/db/__init__.pyi b/typings/django/contrib/gis/db/__init__.pyi similarity index 100% rename from django-stubs/contrib/gis/db/__init__.pyi rename to typings/django/contrib/gis/db/__init__.pyi diff --git a/django-stubs/contrib/gis/db/backends/__init__.pyi b/typings/django/contrib/gis/db/backends/__init__.pyi similarity index 100% rename from django-stubs/contrib/gis/db/backends/__init__.pyi rename to typings/django/contrib/gis/db/backends/__init__.pyi diff --git a/django-stubs/contrib/gis/db/backends/base/__init__.pyi b/typings/django/contrib/gis/db/backends/base/__init__.pyi similarity index 100% rename from django-stubs/contrib/gis/db/backends/base/__init__.pyi rename to typings/django/contrib/gis/db/backends/base/__init__.pyi diff --git a/django-stubs/contrib/gis/db/backends/base/adapter.pyi b/typings/django/contrib/gis/db/backends/base/adapter.pyi similarity index 100% rename from django-stubs/contrib/gis/db/backends/base/adapter.pyi rename to typings/django/contrib/gis/db/backends/base/adapter.pyi diff --git a/django-stubs/contrib/gis/db/backends/base/features.pyi b/typings/django/contrib/gis/db/backends/base/features.pyi similarity index 100% rename from django-stubs/contrib/gis/db/backends/base/features.pyi rename to typings/django/contrib/gis/db/backends/base/features.pyi diff --git a/django-stubs/contrib/gis/db/backends/base/models.pyi b/typings/django/contrib/gis/db/backends/base/models.pyi similarity index 100% rename from django-stubs/contrib/gis/db/backends/base/models.pyi rename to typings/django/contrib/gis/db/backends/base/models.pyi diff --git a/django-stubs/contrib/gis/db/backends/base/operations.pyi b/typings/django/contrib/gis/db/backends/base/operations.pyi similarity index 100% rename from django-stubs/contrib/gis/db/backends/base/operations.pyi rename to typings/django/contrib/gis/db/backends/base/operations.pyi diff --git a/django-stubs/contrib/gis/db/backends/mysql/__init__.pyi b/typings/django/contrib/gis/db/backends/mysql/__init__.pyi similarity index 100% rename from django-stubs/contrib/gis/db/backends/mysql/__init__.pyi rename to typings/django/contrib/gis/db/backends/mysql/__init__.pyi diff --git a/django-stubs/contrib/gis/db/backends/mysql/base.pyi b/typings/django/contrib/gis/db/backends/mysql/base.pyi similarity index 100% rename from django-stubs/contrib/gis/db/backends/mysql/base.pyi rename to typings/django/contrib/gis/db/backends/mysql/base.pyi diff --git a/django-stubs/contrib/gis/db/backends/mysql/features.pyi b/typings/django/contrib/gis/db/backends/mysql/features.pyi similarity index 100% rename from django-stubs/contrib/gis/db/backends/mysql/features.pyi rename to typings/django/contrib/gis/db/backends/mysql/features.pyi diff --git a/django-stubs/contrib/gis/db/backends/mysql/introspection.pyi b/typings/django/contrib/gis/db/backends/mysql/introspection.pyi similarity index 100% rename from django-stubs/contrib/gis/db/backends/mysql/introspection.pyi rename to typings/django/contrib/gis/db/backends/mysql/introspection.pyi diff --git a/django-stubs/contrib/gis/db/backends/mysql/operations.pyi b/typings/django/contrib/gis/db/backends/mysql/operations.pyi similarity index 100% rename from django-stubs/contrib/gis/db/backends/mysql/operations.pyi rename to typings/django/contrib/gis/db/backends/mysql/operations.pyi diff --git a/django-stubs/contrib/gis/db/backends/mysql/schema.pyi b/typings/django/contrib/gis/db/backends/mysql/schema.pyi similarity index 100% rename from django-stubs/contrib/gis/db/backends/mysql/schema.pyi rename to typings/django/contrib/gis/db/backends/mysql/schema.pyi diff --git a/django-stubs/contrib/gis/db/backends/oracle/__init__.pyi b/typings/django/contrib/gis/db/backends/oracle/__init__.pyi similarity index 100% rename from django-stubs/contrib/gis/db/backends/oracle/__init__.pyi rename to typings/django/contrib/gis/db/backends/oracle/__init__.pyi diff --git a/django-stubs/contrib/gis/db/backends/oracle/adapter.pyi b/typings/django/contrib/gis/db/backends/oracle/adapter.pyi similarity index 100% rename from django-stubs/contrib/gis/db/backends/oracle/adapter.pyi rename to typings/django/contrib/gis/db/backends/oracle/adapter.pyi diff --git a/django-stubs/contrib/gis/db/backends/oracle/base.pyi b/typings/django/contrib/gis/db/backends/oracle/base.pyi similarity index 100% rename from django-stubs/contrib/gis/db/backends/oracle/base.pyi rename to typings/django/contrib/gis/db/backends/oracle/base.pyi diff --git a/django-stubs/contrib/gis/db/backends/oracle/features.pyi b/typings/django/contrib/gis/db/backends/oracle/features.pyi similarity index 100% rename from django-stubs/contrib/gis/db/backends/oracle/features.pyi rename to typings/django/contrib/gis/db/backends/oracle/features.pyi diff --git a/django-stubs/contrib/gis/db/backends/oracle/introspection.pyi b/typings/django/contrib/gis/db/backends/oracle/introspection.pyi similarity index 100% rename from django-stubs/contrib/gis/db/backends/oracle/introspection.pyi rename to typings/django/contrib/gis/db/backends/oracle/introspection.pyi diff --git a/django-stubs/contrib/gis/db/backends/oracle/models.pyi b/typings/django/contrib/gis/db/backends/oracle/models.pyi similarity index 100% rename from django-stubs/contrib/gis/db/backends/oracle/models.pyi rename to typings/django/contrib/gis/db/backends/oracle/models.pyi diff --git a/django-stubs/contrib/gis/db/backends/oracle/operations.pyi b/typings/django/contrib/gis/db/backends/oracle/operations.pyi similarity index 100% rename from django-stubs/contrib/gis/db/backends/oracle/operations.pyi rename to typings/django/contrib/gis/db/backends/oracle/operations.pyi diff --git a/django-stubs/contrib/gis/db/backends/oracle/schema.pyi b/typings/django/contrib/gis/db/backends/oracle/schema.pyi similarity index 100% rename from django-stubs/contrib/gis/db/backends/oracle/schema.pyi rename to typings/django/contrib/gis/db/backends/oracle/schema.pyi diff --git a/django-stubs/contrib/gis/db/backends/postgis/__init__.pyi b/typings/django/contrib/gis/db/backends/postgis/__init__.pyi similarity index 100% rename from django-stubs/contrib/gis/db/backends/postgis/__init__.pyi rename to typings/django/contrib/gis/db/backends/postgis/__init__.pyi diff --git a/django-stubs/contrib/gis/db/backends/postgis/adapter.pyi b/typings/django/contrib/gis/db/backends/postgis/adapter.pyi similarity index 100% rename from django-stubs/contrib/gis/db/backends/postgis/adapter.pyi rename to typings/django/contrib/gis/db/backends/postgis/adapter.pyi diff --git a/django-stubs/contrib/gis/db/backends/postgis/base.pyi b/typings/django/contrib/gis/db/backends/postgis/base.pyi similarity index 100% rename from django-stubs/contrib/gis/db/backends/postgis/base.pyi rename to typings/django/contrib/gis/db/backends/postgis/base.pyi diff --git a/django-stubs/contrib/gis/db/backends/postgis/const.pyi b/typings/django/contrib/gis/db/backends/postgis/const.pyi similarity index 100% rename from django-stubs/contrib/gis/db/backends/postgis/const.pyi rename to typings/django/contrib/gis/db/backends/postgis/const.pyi diff --git a/django-stubs/contrib/gis/db/backends/postgis/features.pyi b/typings/django/contrib/gis/db/backends/postgis/features.pyi similarity index 100% rename from django-stubs/contrib/gis/db/backends/postgis/features.pyi rename to typings/django/contrib/gis/db/backends/postgis/features.pyi diff --git a/django-stubs/contrib/gis/db/backends/postgis/introspection.pyi b/typings/django/contrib/gis/db/backends/postgis/introspection.pyi similarity index 100% rename from django-stubs/contrib/gis/db/backends/postgis/introspection.pyi rename to typings/django/contrib/gis/db/backends/postgis/introspection.pyi diff --git a/django-stubs/contrib/gis/db/backends/postgis/models.pyi b/typings/django/contrib/gis/db/backends/postgis/models.pyi similarity index 100% rename from django-stubs/contrib/gis/db/backends/postgis/models.pyi rename to typings/django/contrib/gis/db/backends/postgis/models.pyi diff --git a/django-stubs/contrib/gis/db/backends/postgis/operations.pyi b/typings/django/contrib/gis/db/backends/postgis/operations.pyi similarity index 100% rename from django-stubs/contrib/gis/db/backends/postgis/operations.pyi rename to typings/django/contrib/gis/db/backends/postgis/operations.pyi diff --git a/django-stubs/contrib/gis/db/backends/postgis/pgraster.pyi b/typings/django/contrib/gis/db/backends/postgis/pgraster.pyi similarity index 100% rename from django-stubs/contrib/gis/db/backends/postgis/pgraster.pyi rename to typings/django/contrib/gis/db/backends/postgis/pgraster.pyi diff --git a/django-stubs/contrib/gis/db/backends/postgis/schema.pyi b/typings/django/contrib/gis/db/backends/postgis/schema.pyi similarity index 100% rename from django-stubs/contrib/gis/db/backends/postgis/schema.pyi rename to typings/django/contrib/gis/db/backends/postgis/schema.pyi diff --git a/django-stubs/contrib/gis/db/backends/spatialite/__init__.pyi b/typings/django/contrib/gis/db/backends/spatialite/__init__.pyi similarity index 100% rename from django-stubs/contrib/gis/db/backends/spatialite/__init__.pyi rename to typings/django/contrib/gis/db/backends/spatialite/__init__.pyi diff --git a/django-stubs/contrib/gis/db/backends/spatialite/adapter.pyi b/typings/django/contrib/gis/db/backends/spatialite/adapter.pyi similarity index 100% rename from django-stubs/contrib/gis/db/backends/spatialite/adapter.pyi rename to typings/django/contrib/gis/db/backends/spatialite/adapter.pyi diff --git a/django-stubs/contrib/gis/db/backends/spatialite/base.pyi b/typings/django/contrib/gis/db/backends/spatialite/base.pyi similarity index 100% rename from django-stubs/contrib/gis/db/backends/spatialite/base.pyi rename to typings/django/contrib/gis/db/backends/spatialite/base.pyi diff --git a/django-stubs/contrib/gis/db/backends/spatialite/client.pyi b/typings/django/contrib/gis/db/backends/spatialite/client.pyi similarity index 100% rename from django-stubs/contrib/gis/db/backends/spatialite/client.pyi rename to typings/django/contrib/gis/db/backends/spatialite/client.pyi diff --git a/django-stubs/contrib/gis/db/backends/spatialite/features.pyi b/typings/django/contrib/gis/db/backends/spatialite/features.pyi similarity index 100% rename from django-stubs/contrib/gis/db/backends/spatialite/features.pyi rename to typings/django/contrib/gis/db/backends/spatialite/features.pyi diff --git a/django-stubs/contrib/gis/db/backends/spatialite/introspection.pyi b/typings/django/contrib/gis/db/backends/spatialite/introspection.pyi similarity index 100% rename from django-stubs/contrib/gis/db/backends/spatialite/introspection.pyi rename to typings/django/contrib/gis/db/backends/spatialite/introspection.pyi diff --git a/django-stubs/contrib/gis/db/backends/spatialite/models.pyi b/typings/django/contrib/gis/db/backends/spatialite/models.pyi similarity index 100% rename from django-stubs/contrib/gis/db/backends/spatialite/models.pyi rename to typings/django/contrib/gis/db/backends/spatialite/models.pyi diff --git a/django-stubs/contrib/gis/db/backends/spatialite/operations.pyi b/typings/django/contrib/gis/db/backends/spatialite/operations.pyi similarity index 100% rename from django-stubs/contrib/gis/db/backends/spatialite/operations.pyi rename to typings/django/contrib/gis/db/backends/spatialite/operations.pyi diff --git a/django-stubs/contrib/gis/db/backends/spatialite/schema.pyi b/typings/django/contrib/gis/db/backends/spatialite/schema.pyi similarity index 100% rename from django-stubs/contrib/gis/db/backends/spatialite/schema.pyi rename to typings/django/contrib/gis/db/backends/spatialite/schema.pyi diff --git a/django-stubs/contrib/gis/db/backends/utils.pyi b/typings/django/contrib/gis/db/backends/utils.pyi similarity index 100% rename from django-stubs/contrib/gis/db/backends/utils.pyi rename to typings/django/contrib/gis/db/backends/utils.pyi diff --git a/django-stubs/contrib/gis/db/models/__init__.pyi b/typings/django/contrib/gis/db/models/__init__.pyi similarity index 100% rename from django-stubs/contrib/gis/db/models/__init__.pyi rename to typings/django/contrib/gis/db/models/__init__.pyi diff --git a/django-stubs/contrib/gis/db/models/aggregates.pyi b/typings/django/contrib/gis/db/models/aggregates.pyi similarity index 100% rename from django-stubs/contrib/gis/db/models/aggregates.pyi rename to typings/django/contrib/gis/db/models/aggregates.pyi diff --git a/django-stubs/contrib/gis/db/models/fields.pyi b/typings/django/contrib/gis/db/models/fields.pyi similarity index 100% rename from django-stubs/contrib/gis/db/models/fields.pyi rename to typings/django/contrib/gis/db/models/fields.pyi diff --git a/django-stubs/contrib/gis/db/models/functions.pyi b/typings/django/contrib/gis/db/models/functions.pyi similarity index 100% rename from django-stubs/contrib/gis/db/models/functions.pyi rename to typings/django/contrib/gis/db/models/functions.pyi diff --git a/django-stubs/contrib/gis/db/models/lookups.pyi b/typings/django/contrib/gis/db/models/lookups.pyi similarity index 100% rename from django-stubs/contrib/gis/db/models/lookups.pyi rename to typings/django/contrib/gis/db/models/lookups.pyi diff --git a/django-stubs/contrib/gis/db/models/proxy.pyi b/typings/django/contrib/gis/db/models/proxy.pyi similarity index 100% rename from django-stubs/contrib/gis/db/models/proxy.pyi rename to typings/django/contrib/gis/db/models/proxy.pyi diff --git a/django-stubs/contrib/gis/db/models/sql/__init__.pyi b/typings/django/contrib/gis/db/models/sql/__init__.pyi similarity index 100% rename from django-stubs/contrib/gis/db/models/sql/__init__.pyi rename to typings/django/contrib/gis/db/models/sql/__init__.pyi diff --git a/django-stubs/contrib/gis/db/models/sql/conversion.pyi b/typings/django/contrib/gis/db/models/sql/conversion.pyi similarity index 100% rename from django-stubs/contrib/gis/db/models/sql/conversion.pyi rename to typings/django/contrib/gis/db/models/sql/conversion.pyi diff --git a/django-stubs/contrib/gis/feeds.pyi b/typings/django/contrib/gis/feeds.pyi similarity index 100% rename from django-stubs/contrib/gis/feeds.pyi rename to typings/django/contrib/gis/feeds.pyi diff --git a/django-stubs/contrib/gis/forms/__init__.pyi b/typings/django/contrib/gis/forms/__init__.pyi similarity index 100% rename from django-stubs/contrib/gis/forms/__init__.pyi rename to typings/django/contrib/gis/forms/__init__.pyi diff --git a/django-stubs/contrib/gis/forms/fields.pyi b/typings/django/contrib/gis/forms/fields.pyi similarity index 100% rename from django-stubs/contrib/gis/forms/fields.pyi rename to typings/django/contrib/gis/forms/fields.pyi diff --git a/django-stubs/contrib/gis/forms/widgets.pyi b/typings/django/contrib/gis/forms/widgets.pyi similarity index 100% rename from django-stubs/contrib/gis/forms/widgets.pyi rename to typings/django/contrib/gis/forms/widgets.pyi diff --git a/django-stubs/contrib/gis/gdal/__init__.pyi b/typings/django/contrib/gis/gdal/__init__.pyi similarity index 100% rename from django-stubs/contrib/gis/gdal/__init__.pyi rename to typings/django/contrib/gis/gdal/__init__.pyi diff --git a/django-stubs/contrib/gis/gdal/base.pyi b/typings/django/contrib/gis/gdal/base.pyi similarity index 100% rename from django-stubs/contrib/gis/gdal/base.pyi rename to typings/django/contrib/gis/gdal/base.pyi diff --git a/django-stubs/contrib/gis/gdal/datasource.pyi b/typings/django/contrib/gis/gdal/datasource.pyi similarity index 100% rename from django-stubs/contrib/gis/gdal/datasource.pyi rename to typings/django/contrib/gis/gdal/datasource.pyi diff --git a/django-stubs/contrib/gis/gdal/driver.pyi b/typings/django/contrib/gis/gdal/driver.pyi similarity index 100% rename from django-stubs/contrib/gis/gdal/driver.pyi rename to typings/django/contrib/gis/gdal/driver.pyi diff --git a/django-stubs/contrib/gis/gdal/envelope.pyi b/typings/django/contrib/gis/gdal/envelope.pyi similarity index 100% rename from django-stubs/contrib/gis/gdal/envelope.pyi rename to typings/django/contrib/gis/gdal/envelope.pyi diff --git a/django-stubs/contrib/gis/gdal/error.pyi b/typings/django/contrib/gis/gdal/error.pyi similarity index 100% rename from django-stubs/contrib/gis/gdal/error.pyi rename to typings/django/contrib/gis/gdal/error.pyi diff --git a/django-stubs/contrib/gis/gdal/feature.pyi b/typings/django/contrib/gis/gdal/feature.pyi similarity index 100% rename from django-stubs/contrib/gis/gdal/feature.pyi rename to typings/django/contrib/gis/gdal/feature.pyi diff --git a/django-stubs/contrib/gis/gdal/field.pyi b/typings/django/contrib/gis/gdal/field.pyi similarity index 100% rename from django-stubs/contrib/gis/gdal/field.pyi rename to typings/django/contrib/gis/gdal/field.pyi diff --git a/django-stubs/contrib/gis/gdal/geometries.pyi b/typings/django/contrib/gis/gdal/geometries.pyi similarity index 100% rename from django-stubs/contrib/gis/gdal/geometries.pyi rename to typings/django/contrib/gis/gdal/geometries.pyi diff --git a/django-stubs/contrib/gis/gdal/geomtype.pyi b/typings/django/contrib/gis/gdal/geomtype.pyi similarity index 100% rename from django-stubs/contrib/gis/gdal/geomtype.pyi rename to typings/django/contrib/gis/gdal/geomtype.pyi diff --git a/django-stubs/contrib/gis/gdal/layer.pyi b/typings/django/contrib/gis/gdal/layer.pyi similarity index 100% rename from django-stubs/contrib/gis/gdal/layer.pyi rename to typings/django/contrib/gis/gdal/layer.pyi diff --git a/django-stubs/contrib/gis/gdal/libgdal.pyi b/typings/django/contrib/gis/gdal/libgdal.pyi similarity index 100% rename from django-stubs/contrib/gis/gdal/libgdal.pyi rename to typings/django/contrib/gis/gdal/libgdal.pyi diff --git a/django-stubs/contrib/gis/gdal/prototypes/__init__.pyi b/typings/django/contrib/gis/gdal/prototypes/__init__.pyi similarity index 100% rename from django-stubs/contrib/gis/gdal/prototypes/__init__.pyi rename to typings/django/contrib/gis/gdal/prototypes/__init__.pyi diff --git a/django-stubs/contrib/gis/gdal/prototypes/ds.pyi b/typings/django/contrib/gis/gdal/prototypes/ds.pyi similarity index 100% rename from django-stubs/contrib/gis/gdal/prototypes/ds.pyi rename to typings/django/contrib/gis/gdal/prototypes/ds.pyi diff --git a/django-stubs/contrib/gis/gdal/prototypes/errcheck.pyi b/typings/django/contrib/gis/gdal/prototypes/errcheck.pyi similarity index 100% rename from django-stubs/contrib/gis/gdal/prototypes/errcheck.pyi rename to typings/django/contrib/gis/gdal/prototypes/errcheck.pyi diff --git a/django-stubs/contrib/gis/gdal/prototypes/generation.pyi b/typings/django/contrib/gis/gdal/prototypes/generation.pyi similarity index 100% rename from django-stubs/contrib/gis/gdal/prototypes/generation.pyi rename to typings/django/contrib/gis/gdal/prototypes/generation.pyi diff --git a/django-stubs/contrib/gis/gdal/prototypes/geom.pyi b/typings/django/contrib/gis/gdal/prototypes/geom.pyi similarity index 100% rename from django-stubs/contrib/gis/gdal/prototypes/geom.pyi rename to typings/django/contrib/gis/gdal/prototypes/geom.pyi diff --git a/django-stubs/contrib/gis/gdal/prototypes/raster.pyi b/typings/django/contrib/gis/gdal/prototypes/raster.pyi similarity index 100% rename from django-stubs/contrib/gis/gdal/prototypes/raster.pyi rename to typings/django/contrib/gis/gdal/prototypes/raster.pyi diff --git a/django-stubs/contrib/gis/gdal/prototypes/srs.pyi b/typings/django/contrib/gis/gdal/prototypes/srs.pyi similarity index 100% rename from django-stubs/contrib/gis/gdal/prototypes/srs.pyi rename to typings/django/contrib/gis/gdal/prototypes/srs.pyi diff --git a/django-stubs/contrib/gis/gdal/raster/__init__.pyi b/typings/django/contrib/gis/gdal/raster/__init__.pyi similarity index 100% rename from django-stubs/contrib/gis/gdal/raster/__init__.pyi rename to typings/django/contrib/gis/gdal/raster/__init__.pyi diff --git a/django-stubs/contrib/gis/gdal/raster/band.pyi b/typings/django/contrib/gis/gdal/raster/band.pyi similarity index 100% rename from django-stubs/contrib/gis/gdal/raster/band.pyi rename to typings/django/contrib/gis/gdal/raster/band.pyi diff --git a/django-stubs/contrib/gis/gdal/raster/base.pyi b/typings/django/contrib/gis/gdal/raster/base.pyi similarity index 100% rename from django-stubs/contrib/gis/gdal/raster/base.pyi rename to typings/django/contrib/gis/gdal/raster/base.pyi diff --git a/django-stubs/contrib/gis/gdal/raster/const.pyi b/typings/django/contrib/gis/gdal/raster/const.pyi similarity index 100% rename from django-stubs/contrib/gis/gdal/raster/const.pyi rename to typings/django/contrib/gis/gdal/raster/const.pyi diff --git a/django-stubs/contrib/gis/gdal/raster/source.pyi b/typings/django/contrib/gis/gdal/raster/source.pyi similarity index 100% rename from django-stubs/contrib/gis/gdal/raster/source.pyi rename to typings/django/contrib/gis/gdal/raster/source.pyi diff --git a/django-stubs/contrib/gis/gdal/srs.pyi b/typings/django/contrib/gis/gdal/srs.pyi similarity index 100% rename from django-stubs/contrib/gis/gdal/srs.pyi rename to typings/django/contrib/gis/gdal/srs.pyi diff --git a/django-stubs/contrib/gis/geoip2/__init__.pyi b/typings/django/contrib/gis/geoip2/__init__.pyi similarity index 100% rename from django-stubs/contrib/gis/geoip2/__init__.pyi rename to typings/django/contrib/gis/geoip2/__init__.pyi diff --git a/django-stubs/contrib/gis/geoip2/base.pyi b/typings/django/contrib/gis/geoip2/base.pyi similarity index 100% rename from django-stubs/contrib/gis/geoip2/base.pyi rename to typings/django/contrib/gis/geoip2/base.pyi diff --git a/django-stubs/contrib/gis/geoip2/resources.pyi b/typings/django/contrib/gis/geoip2/resources.pyi similarity index 100% rename from django-stubs/contrib/gis/geoip2/resources.pyi rename to typings/django/contrib/gis/geoip2/resources.pyi diff --git a/django-stubs/contrib/gis/geometry.pyi b/typings/django/contrib/gis/geometry.pyi similarity index 100% rename from django-stubs/contrib/gis/geometry.pyi rename to typings/django/contrib/gis/geometry.pyi diff --git a/django-stubs/contrib/gis/geos/__init__.pyi b/typings/django/contrib/gis/geos/__init__.pyi similarity index 100% rename from django-stubs/contrib/gis/geos/__init__.pyi rename to typings/django/contrib/gis/geos/__init__.pyi diff --git a/django-stubs/contrib/gis/geos/base.pyi b/typings/django/contrib/gis/geos/base.pyi similarity index 100% rename from django-stubs/contrib/gis/geos/base.pyi rename to typings/django/contrib/gis/geos/base.pyi diff --git a/django-stubs/contrib/gis/geos/collections.pyi b/typings/django/contrib/gis/geos/collections.pyi similarity index 100% rename from django-stubs/contrib/gis/geos/collections.pyi rename to typings/django/contrib/gis/geos/collections.pyi diff --git a/django-stubs/contrib/gis/geos/coordseq.pyi b/typings/django/contrib/gis/geos/coordseq.pyi similarity index 100% rename from django-stubs/contrib/gis/geos/coordseq.pyi rename to typings/django/contrib/gis/geos/coordseq.pyi diff --git a/django-stubs/contrib/gis/geos/error.pyi b/typings/django/contrib/gis/geos/error.pyi similarity index 100% rename from django-stubs/contrib/gis/geos/error.pyi rename to typings/django/contrib/gis/geos/error.pyi diff --git a/django-stubs/contrib/gis/geos/factory.pyi b/typings/django/contrib/gis/geos/factory.pyi similarity index 100% rename from django-stubs/contrib/gis/geos/factory.pyi rename to typings/django/contrib/gis/geos/factory.pyi diff --git a/django-stubs/contrib/gis/geos/geometry.pyi b/typings/django/contrib/gis/geos/geometry.pyi similarity index 100% rename from django-stubs/contrib/gis/geos/geometry.pyi rename to typings/django/contrib/gis/geos/geometry.pyi diff --git a/django-stubs/contrib/gis/geos/io.pyi b/typings/django/contrib/gis/geos/io.pyi similarity index 100% rename from django-stubs/contrib/gis/geos/io.pyi rename to typings/django/contrib/gis/geos/io.pyi diff --git a/django-stubs/contrib/gis/geos/libgeos.pyi b/typings/django/contrib/gis/geos/libgeos.pyi similarity index 100% rename from django-stubs/contrib/gis/geos/libgeos.pyi rename to typings/django/contrib/gis/geos/libgeos.pyi diff --git a/django-stubs/contrib/gis/geos/linestring.pyi b/typings/django/contrib/gis/geos/linestring.pyi similarity index 100% rename from django-stubs/contrib/gis/geos/linestring.pyi rename to typings/django/contrib/gis/geos/linestring.pyi diff --git a/django-stubs/contrib/gis/geos/mutable_list.pyi b/typings/django/contrib/gis/geos/mutable_list.pyi similarity index 100% rename from django-stubs/contrib/gis/geos/mutable_list.pyi rename to typings/django/contrib/gis/geos/mutable_list.pyi diff --git a/django-stubs/contrib/gis/geos/point.pyi b/typings/django/contrib/gis/geos/point.pyi similarity index 100% rename from django-stubs/contrib/gis/geos/point.pyi rename to typings/django/contrib/gis/geos/point.pyi diff --git a/django-stubs/contrib/gis/geos/polygon.pyi b/typings/django/contrib/gis/geos/polygon.pyi similarity index 100% rename from django-stubs/contrib/gis/geos/polygon.pyi rename to typings/django/contrib/gis/geos/polygon.pyi diff --git a/django-stubs/contrib/gis/geos/prepared.pyi b/typings/django/contrib/gis/geos/prepared.pyi similarity index 100% rename from django-stubs/contrib/gis/geos/prepared.pyi rename to typings/django/contrib/gis/geos/prepared.pyi diff --git a/django-stubs/contrib/gis/geos/prototypes/__init__.pyi b/typings/django/contrib/gis/geos/prototypes/__init__.pyi similarity index 100% rename from django-stubs/contrib/gis/geos/prototypes/__init__.pyi rename to typings/django/contrib/gis/geos/prototypes/__init__.pyi diff --git a/django-stubs/contrib/gis/geos/prototypes/coordseq.pyi b/typings/django/contrib/gis/geos/prototypes/coordseq.pyi similarity index 100% rename from django-stubs/contrib/gis/geos/prototypes/coordseq.pyi rename to typings/django/contrib/gis/geos/prototypes/coordseq.pyi diff --git a/django-stubs/contrib/gis/geos/prototypes/errcheck.pyi b/typings/django/contrib/gis/geos/prototypes/errcheck.pyi similarity index 100% rename from django-stubs/contrib/gis/geos/prototypes/errcheck.pyi rename to typings/django/contrib/gis/geos/prototypes/errcheck.pyi diff --git a/django-stubs/contrib/gis/geos/prototypes/geom.pyi b/typings/django/contrib/gis/geos/prototypes/geom.pyi similarity index 100% rename from django-stubs/contrib/gis/geos/prototypes/geom.pyi rename to typings/django/contrib/gis/geos/prototypes/geom.pyi diff --git a/django-stubs/contrib/gis/geos/prototypes/io.pyi b/typings/django/contrib/gis/geos/prototypes/io.pyi similarity index 100% rename from django-stubs/contrib/gis/geos/prototypes/io.pyi rename to typings/django/contrib/gis/geos/prototypes/io.pyi diff --git a/django-stubs/contrib/gis/geos/prototypes/misc.pyi b/typings/django/contrib/gis/geos/prototypes/misc.pyi similarity index 100% rename from django-stubs/contrib/gis/geos/prototypes/misc.pyi rename to typings/django/contrib/gis/geos/prototypes/misc.pyi diff --git a/django-stubs/contrib/gis/geos/prototypes/predicates.pyi b/typings/django/contrib/gis/geos/prototypes/predicates.pyi similarity index 100% rename from django-stubs/contrib/gis/geos/prototypes/predicates.pyi rename to typings/django/contrib/gis/geos/prototypes/predicates.pyi diff --git a/django-stubs/contrib/gis/geos/prototypes/prepared.pyi b/typings/django/contrib/gis/geos/prototypes/prepared.pyi similarity index 100% rename from django-stubs/contrib/gis/geos/prototypes/prepared.pyi rename to typings/django/contrib/gis/geos/prototypes/prepared.pyi diff --git a/django-stubs/contrib/gis/geos/prototypes/threadsafe.pyi b/typings/django/contrib/gis/geos/prototypes/threadsafe.pyi similarity index 100% rename from django-stubs/contrib/gis/geos/prototypes/threadsafe.pyi rename to typings/django/contrib/gis/geos/prototypes/threadsafe.pyi diff --git a/django-stubs/contrib/gis/geos/prototypes/topology.pyi b/typings/django/contrib/gis/geos/prototypes/topology.pyi similarity index 100% rename from django-stubs/contrib/gis/geos/prototypes/topology.pyi rename to typings/django/contrib/gis/geos/prototypes/topology.pyi diff --git a/django-stubs/contrib/gis/measure.pyi b/typings/django/contrib/gis/measure.pyi similarity index 100% rename from django-stubs/contrib/gis/measure.pyi rename to typings/django/contrib/gis/measure.pyi diff --git a/django-stubs/contrib/gis/ptr.pyi b/typings/django/contrib/gis/ptr.pyi similarity index 100% rename from django-stubs/contrib/gis/ptr.pyi rename to typings/django/contrib/gis/ptr.pyi diff --git a/django-stubs/contrib/gis/serializers/__init__.pyi b/typings/django/contrib/gis/serializers/__init__.pyi similarity index 100% rename from django-stubs/contrib/gis/serializers/__init__.pyi rename to typings/django/contrib/gis/serializers/__init__.pyi diff --git a/django-stubs/contrib/gis/serializers/geojson.pyi b/typings/django/contrib/gis/serializers/geojson.pyi similarity index 100% rename from django-stubs/contrib/gis/serializers/geojson.pyi rename to typings/django/contrib/gis/serializers/geojson.pyi diff --git a/django-stubs/contrib/gis/shortcuts.pyi b/typings/django/contrib/gis/shortcuts.pyi similarity index 100% rename from django-stubs/contrib/gis/shortcuts.pyi rename to typings/django/contrib/gis/shortcuts.pyi diff --git a/django-stubs/contrib/gis/sitemaps/__init__.pyi b/typings/django/contrib/gis/sitemaps/__init__.pyi similarity index 100% rename from django-stubs/contrib/gis/sitemaps/__init__.pyi rename to typings/django/contrib/gis/sitemaps/__init__.pyi diff --git a/django-stubs/contrib/gis/sitemaps/kml.pyi b/typings/django/contrib/gis/sitemaps/kml.pyi similarity index 100% rename from django-stubs/contrib/gis/sitemaps/kml.pyi rename to typings/django/contrib/gis/sitemaps/kml.pyi diff --git a/django-stubs/contrib/gis/sitemaps/views.pyi b/typings/django/contrib/gis/sitemaps/views.pyi similarity index 100% rename from django-stubs/contrib/gis/sitemaps/views.pyi rename to typings/django/contrib/gis/sitemaps/views.pyi diff --git a/django-stubs/contrib/gis/utils/__init__.pyi b/typings/django/contrib/gis/utils/__init__.pyi similarity index 100% rename from django-stubs/contrib/gis/utils/__init__.pyi rename to typings/django/contrib/gis/utils/__init__.pyi diff --git a/django-stubs/contrib/gis/utils/layermapping.pyi b/typings/django/contrib/gis/utils/layermapping.pyi similarity index 100% rename from django-stubs/contrib/gis/utils/layermapping.pyi rename to typings/django/contrib/gis/utils/layermapping.pyi diff --git a/django-stubs/contrib/gis/utils/ogrinfo.pyi b/typings/django/contrib/gis/utils/ogrinfo.pyi similarity index 100% rename from django-stubs/contrib/gis/utils/ogrinfo.pyi rename to typings/django/contrib/gis/utils/ogrinfo.pyi diff --git a/django-stubs/contrib/gis/utils/ogrinspect.pyi b/typings/django/contrib/gis/utils/ogrinspect.pyi similarity index 100% rename from django-stubs/contrib/gis/utils/ogrinspect.pyi rename to typings/django/contrib/gis/utils/ogrinspect.pyi diff --git a/django-stubs/contrib/gis/utils/srs.pyi b/typings/django/contrib/gis/utils/srs.pyi similarity index 100% rename from django-stubs/contrib/gis/utils/srs.pyi rename to typings/django/contrib/gis/utils/srs.pyi diff --git a/django-stubs/contrib/gis/views.pyi b/typings/django/contrib/gis/views.pyi similarity index 100% rename from django-stubs/contrib/gis/views.pyi rename to typings/django/contrib/gis/views.pyi diff --git a/django-stubs/contrib/humanize/__init__.pyi b/typings/django/contrib/humanize/__init__.pyi similarity index 100% rename from django-stubs/contrib/humanize/__init__.pyi rename to typings/django/contrib/humanize/__init__.pyi diff --git a/django-stubs/contrib/humanize/apps.pyi b/typings/django/contrib/humanize/apps.pyi similarity index 100% rename from django-stubs/contrib/humanize/apps.pyi rename to typings/django/contrib/humanize/apps.pyi diff --git a/django-stubs/contrib/humanize/templatetags/__init__.pyi b/typings/django/contrib/humanize/templatetags/__init__.pyi similarity index 100% rename from django-stubs/contrib/humanize/templatetags/__init__.pyi rename to typings/django/contrib/humanize/templatetags/__init__.pyi diff --git a/django-stubs/contrib/humanize/templatetags/humanize.pyi b/typings/django/contrib/humanize/templatetags/humanize.pyi similarity index 100% rename from django-stubs/contrib/humanize/templatetags/humanize.pyi rename to typings/django/contrib/humanize/templatetags/humanize.pyi diff --git a/django-stubs/contrib/messages/__init__.pyi b/typings/django/contrib/messages/__init__.pyi similarity index 100% rename from django-stubs/contrib/messages/__init__.pyi rename to typings/django/contrib/messages/__init__.pyi diff --git a/django-stubs/contrib/messages/api.pyi b/typings/django/contrib/messages/api.pyi similarity index 100% rename from django-stubs/contrib/messages/api.pyi rename to typings/django/contrib/messages/api.pyi diff --git a/django-stubs/contrib/messages/apps.pyi b/typings/django/contrib/messages/apps.pyi similarity index 100% rename from django-stubs/contrib/messages/apps.pyi rename to typings/django/contrib/messages/apps.pyi diff --git a/django-stubs/contrib/messages/constants.pyi b/typings/django/contrib/messages/constants.pyi similarity index 100% rename from django-stubs/contrib/messages/constants.pyi rename to typings/django/contrib/messages/constants.pyi diff --git a/django-stubs/contrib/messages/context_processors.pyi b/typings/django/contrib/messages/context_processors.pyi similarity index 100% rename from django-stubs/contrib/messages/context_processors.pyi rename to typings/django/contrib/messages/context_processors.pyi diff --git a/django-stubs/contrib/messages/middleware.pyi b/typings/django/contrib/messages/middleware.pyi similarity index 100% rename from django-stubs/contrib/messages/middleware.pyi rename to typings/django/contrib/messages/middleware.pyi diff --git a/django-stubs/contrib/messages/storage/__init__.pyi b/typings/django/contrib/messages/storage/__init__.pyi similarity index 100% rename from django-stubs/contrib/messages/storage/__init__.pyi rename to typings/django/contrib/messages/storage/__init__.pyi diff --git a/django-stubs/contrib/messages/storage/base.pyi b/typings/django/contrib/messages/storage/base.pyi similarity index 100% rename from django-stubs/contrib/messages/storage/base.pyi rename to typings/django/contrib/messages/storage/base.pyi diff --git a/django-stubs/contrib/messages/storage/cookie.pyi b/typings/django/contrib/messages/storage/cookie.pyi similarity index 100% rename from django-stubs/contrib/messages/storage/cookie.pyi rename to typings/django/contrib/messages/storage/cookie.pyi diff --git a/django-stubs/contrib/messages/storage/fallback.pyi b/typings/django/contrib/messages/storage/fallback.pyi similarity index 100% rename from django-stubs/contrib/messages/storage/fallback.pyi rename to typings/django/contrib/messages/storage/fallback.pyi diff --git a/django-stubs/contrib/messages/storage/session.pyi b/typings/django/contrib/messages/storage/session.pyi similarity index 100% rename from django-stubs/contrib/messages/storage/session.pyi rename to typings/django/contrib/messages/storage/session.pyi diff --git a/django-stubs/contrib/messages/utils.pyi b/typings/django/contrib/messages/utils.pyi similarity index 100% rename from django-stubs/contrib/messages/utils.pyi rename to typings/django/contrib/messages/utils.pyi diff --git a/django-stubs/contrib/messages/views.pyi b/typings/django/contrib/messages/views.pyi similarity index 100% rename from django-stubs/contrib/messages/views.pyi rename to typings/django/contrib/messages/views.pyi diff --git a/django-stubs/contrib/postgres/__init__.pyi b/typings/django/contrib/postgres/__init__.pyi similarity index 100% rename from django-stubs/contrib/postgres/__init__.pyi rename to typings/django/contrib/postgres/__init__.pyi diff --git a/django-stubs/contrib/postgres/aggregates/__init__.pyi b/typings/django/contrib/postgres/aggregates/__init__.pyi similarity index 100% rename from django-stubs/contrib/postgres/aggregates/__init__.pyi rename to typings/django/contrib/postgres/aggregates/__init__.pyi diff --git a/django-stubs/contrib/postgres/aggregates/general.pyi b/typings/django/contrib/postgres/aggregates/general.pyi similarity index 100% rename from django-stubs/contrib/postgres/aggregates/general.pyi rename to typings/django/contrib/postgres/aggregates/general.pyi diff --git a/django-stubs/contrib/postgres/aggregates/mixins.pyi b/typings/django/contrib/postgres/aggregates/mixins.pyi similarity index 100% rename from django-stubs/contrib/postgres/aggregates/mixins.pyi rename to typings/django/contrib/postgres/aggregates/mixins.pyi diff --git a/django-stubs/contrib/postgres/aggregates/statistics.pyi b/typings/django/contrib/postgres/aggregates/statistics.pyi similarity index 100% rename from django-stubs/contrib/postgres/aggregates/statistics.pyi rename to typings/django/contrib/postgres/aggregates/statistics.pyi diff --git a/django-stubs/contrib/postgres/apps.pyi b/typings/django/contrib/postgres/apps.pyi similarity index 100% rename from django-stubs/contrib/postgres/apps.pyi rename to typings/django/contrib/postgres/apps.pyi diff --git a/django-stubs/contrib/postgres/constraints.pyi b/typings/django/contrib/postgres/constraints.pyi similarity index 100% rename from django-stubs/contrib/postgres/constraints.pyi rename to typings/django/contrib/postgres/constraints.pyi diff --git a/django-stubs/contrib/postgres/fields/__init__.pyi b/typings/django/contrib/postgres/fields/__init__.pyi similarity index 100% rename from django-stubs/contrib/postgres/fields/__init__.pyi rename to typings/django/contrib/postgres/fields/__init__.pyi diff --git a/django-stubs/contrib/postgres/fields/array.pyi b/typings/django/contrib/postgres/fields/array.pyi similarity index 100% rename from django-stubs/contrib/postgres/fields/array.pyi rename to typings/django/contrib/postgres/fields/array.pyi diff --git a/django-stubs/contrib/postgres/fields/citext.pyi b/typings/django/contrib/postgres/fields/citext.pyi similarity index 100% rename from django-stubs/contrib/postgres/fields/citext.pyi rename to typings/django/contrib/postgres/fields/citext.pyi diff --git a/django-stubs/contrib/postgres/fields/hstore.pyi b/typings/django/contrib/postgres/fields/hstore.pyi similarity index 100% rename from django-stubs/contrib/postgres/fields/hstore.pyi rename to typings/django/contrib/postgres/fields/hstore.pyi diff --git a/django-stubs/contrib/postgres/fields/jsonb.pyi b/typings/django/contrib/postgres/fields/jsonb.pyi similarity index 100% rename from django-stubs/contrib/postgres/fields/jsonb.pyi rename to typings/django/contrib/postgres/fields/jsonb.pyi diff --git a/django-stubs/contrib/postgres/fields/mixins.pyi b/typings/django/contrib/postgres/fields/mixins.pyi similarity index 100% rename from django-stubs/contrib/postgres/fields/mixins.pyi rename to typings/django/contrib/postgres/fields/mixins.pyi diff --git a/django-stubs/contrib/postgres/fields/ranges.pyi b/typings/django/contrib/postgres/fields/ranges.pyi similarity index 100% rename from django-stubs/contrib/postgres/fields/ranges.pyi rename to typings/django/contrib/postgres/fields/ranges.pyi diff --git a/django-stubs/contrib/postgres/fields/utils.pyi b/typings/django/contrib/postgres/fields/utils.pyi similarity index 100% rename from django-stubs/contrib/postgres/fields/utils.pyi rename to typings/django/contrib/postgres/fields/utils.pyi diff --git a/django-stubs/contrib/postgres/functions.pyi b/typings/django/contrib/postgres/functions.pyi similarity index 100% rename from django-stubs/contrib/postgres/functions.pyi rename to typings/django/contrib/postgres/functions.pyi diff --git a/django-stubs/contrib/postgres/indexes.pyi b/typings/django/contrib/postgres/indexes.pyi similarity index 100% rename from django-stubs/contrib/postgres/indexes.pyi rename to typings/django/contrib/postgres/indexes.pyi diff --git a/django-stubs/contrib/postgres/lookups.pyi b/typings/django/contrib/postgres/lookups.pyi similarity index 100% rename from django-stubs/contrib/postgres/lookups.pyi rename to typings/django/contrib/postgres/lookups.pyi diff --git a/django-stubs/contrib/postgres/operations.pyi b/typings/django/contrib/postgres/operations.pyi similarity index 100% rename from django-stubs/contrib/postgres/operations.pyi rename to typings/django/contrib/postgres/operations.pyi diff --git a/django-stubs/contrib/postgres/search.pyi b/typings/django/contrib/postgres/search.pyi similarity index 100% rename from django-stubs/contrib/postgres/search.pyi rename to typings/django/contrib/postgres/search.pyi diff --git a/django-stubs/contrib/postgres/serializers.pyi b/typings/django/contrib/postgres/serializers.pyi similarity index 100% rename from django-stubs/contrib/postgres/serializers.pyi rename to typings/django/contrib/postgres/serializers.pyi diff --git a/django-stubs/contrib/postgres/signals.pyi b/typings/django/contrib/postgres/signals.pyi similarity index 100% rename from django-stubs/contrib/postgres/signals.pyi rename to typings/django/contrib/postgres/signals.pyi diff --git a/django-stubs/contrib/postgres/utils.pyi b/typings/django/contrib/postgres/utils.pyi similarity index 100% rename from django-stubs/contrib/postgres/utils.pyi rename to typings/django/contrib/postgres/utils.pyi diff --git a/django-stubs/contrib/postgres/validators.pyi b/typings/django/contrib/postgres/validators.pyi similarity index 100% rename from django-stubs/contrib/postgres/validators.pyi rename to typings/django/contrib/postgres/validators.pyi diff --git a/django-stubs/contrib/redirects/__init__.pyi b/typings/django/contrib/redirects/__init__.pyi similarity index 100% rename from django-stubs/contrib/redirects/__init__.pyi rename to typings/django/contrib/redirects/__init__.pyi diff --git a/django-stubs/contrib/redirects/admin.pyi b/typings/django/contrib/redirects/admin.pyi similarity index 100% rename from django-stubs/contrib/redirects/admin.pyi rename to typings/django/contrib/redirects/admin.pyi diff --git a/django-stubs/contrib/redirects/apps.pyi b/typings/django/contrib/redirects/apps.pyi similarity index 100% rename from django-stubs/contrib/redirects/apps.pyi rename to typings/django/contrib/redirects/apps.pyi diff --git a/django-stubs/contrib/redirects/middleware.pyi b/typings/django/contrib/redirects/middleware.pyi similarity index 100% rename from django-stubs/contrib/redirects/middleware.pyi rename to typings/django/contrib/redirects/middleware.pyi diff --git a/django-stubs/contrib/redirects/migrations/__init__.pyi b/typings/django/contrib/redirects/migrations/__init__.pyi similarity index 100% rename from django-stubs/contrib/redirects/migrations/__init__.pyi rename to typings/django/contrib/redirects/migrations/__init__.pyi diff --git a/django-stubs/contrib/redirects/models.pyi b/typings/django/contrib/redirects/models.pyi similarity index 100% rename from django-stubs/contrib/redirects/models.pyi rename to typings/django/contrib/redirects/models.pyi diff --git a/django-stubs/contrib/sessions/__init__.pyi b/typings/django/contrib/sessions/__init__.pyi similarity index 100% rename from django-stubs/contrib/sessions/__init__.pyi rename to typings/django/contrib/sessions/__init__.pyi diff --git a/django-stubs/contrib/sessions/apps.pyi b/typings/django/contrib/sessions/apps.pyi similarity index 100% rename from django-stubs/contrib/sessions/apps.pyi rename to typings/django/contrib/sessions/apps.pyi diff --git a/django-stubs/contrib/sessions/backends/__init__.pyi b/typings/django/contrib/sessions/backends/__init__.pyi similarity index 100% rename from django-stubs/contrib/sessions/backends/__init__.pyi rename to typings/django/contrib/sessions/backends/__init__.pyi diff --git a/django-stubs/contrib/sessions/backends/base.pyi b/typings/django/contrib/sessions/backends/base.pyi similarity index 100% rename from django-stubs/contrib/sessions/backends/base.pyi rename to typings/django/contrib/sessions/backends/base.pyi diff --git a/django-stubs/contrib/sessions/backends/cache.pyi b/typings/django/contrib/sessions/backends/cache.pyi similarity index 100% rename from django-stubs/contrib/sessions/backends/cache.pyi rename to typings/django/contrib/sessions/backends/cache.pyi diff --git a/django-stubs/contrib/sessions/backends/cached_db.pyi b/typings/django/contrib/sessions/backends/cached_db.pyi similarity index 100% rename from django-stubs/contrib/sessions/backends/cached_db.pyi rename to typings/django/contrib/sessions/backends/cached_db.pyi diff --git a/django-stubs/contrib/sessions/backends/db.pyi b/typings/django/contrib/sessions/backends/db.pyi similarity index 100% rename from django-stubs/contrib/sessions/backends/db.pyi rename to typings/django/contrib/sessions/backends/db.pyi diff --git a/django-stubs/contrib/sessions/backends/file.pyi b/typings/django/contrib/sessions/backends/file.pyi similarity index 100% rename from django-stubs/contrib/sessions/backends/file.pyi rename to typings/django/contrib/sessions/backends/file.pyi diff --git a/django-stubs/contrib/sessions/backends/signed_cookies.pyi b/typings/django/contrib/sessions/backends/signed_cookies.pyi similarity index 100% rename from django-stubs/contrib/sessions/backends/signed_cookies.pyi rename to typings/django/contrib/sessions/backends/signed_cookies.pyi diff --git a/django-stubs/contrib/sessions/base_session.pyi b/typings/django/contrib/sessions/base_session.pyi similarity index 100% rename from django-stubs/contrib/sessions/base_session.pyi rename to typings/django/contrib/sessions/base_session.pyi diff --git a/django-stubs/contrib/sessions/exceptions.pyi b/typings/django/contrib/sessions/exceptions.pyi similarity index 100% rename from django-stubs/contrib/sessions/exceptions.pyi rename to typings/django/contrib/sessions/exceptions.pyi diff --git a/django-stubs/contrib/sessions/management/__init__.pyi b/typings/django/contrib/sessions/management/__init__.pyi similarity index 100% rename from django-stubs/contrib/sessions/management/__init__.pyi rename to typings/django/contrib/sessions/management/__init__.pyi diff --git a/django-stubs/contrib/sessions/management/commands/__init__.pyi b/typings/django/contrib/sessions/management/commands/__init__.pyi similarity index 100% rename from django-stubs/contrib/sessions/management/commands/__init__.pyi rename to typings/django/contrib/sessions/management/commands/__init__.pyi diff --git a/django-stubs/contrib/sessions/management/commands/clearsessions.pyi b/typings/django/contrib/sessions/management/commands/clearsessions.pyi similarity index 100% rename from django-stubs/contrib/sessions/management/commands/clearsessions.pyi rename to typings/django/contrib/sessions/management/commands/clearsessions.pyi diff --git a/django-stubs/contrib/sessions/middleware.pyi b/typings/django/contrib/sessions/middleware.pyi similarity index 100% rename from django-stubs/contrib/sessions/middleware.pyi rename to typings/django/contrib/sessions/middleware.pyi diff --git a/django-stubs/contrib/sessions/migrations/__init__.pyi b/typings/django/contrib/sessions/migrations/__init__.pyi similarity index 100% rename from django-stubs/contrib/sessions/migrations/__init__.pyi rename to typings/django/contrib/sessions/migrations/__init__.pyi diff --git a/django-stubs/contrib/sessions/models.pyi b/typings/django/contrib/sessions/models.pyi similarity index 100% rename from django-stubs/contrib/sessions/models.pyi rename to typings/django/contrib/sessions/models.pyi diff --git a/django-stubs/contrib/sessions/serializers.pyi b/typings/django/contrib/sessions/serializers.pyi similarity index 100% rename from django-stubs/contrib/sessions/serializers.pyi rename to typings/django/contrib/sessions/serializers.pyi diff --git a/django-stubs/contrib/sitemaps/__init__.pyi b/typings/django/contrib/sitemaps/__init__.pyi similarity index 100% rename from django-stubs/contrib/sitemaps/__init__.pyi rename to typings/django/contrib/sitemaps/__init__.pyi diff --git a/django-stubs/contrib/sitemaps/apps.pyi b/typings/django/contrib/sitemaps/apps.pyi similarity index 100% rename from django-stubs/contrib/sitemaps/apps.pyi rename to typings/django/contrib/sitemaps/apps.pyi diff --git a/django-stubs/contrib/sitemaps/management/__init__.pyi b/typings/django/contrib/sitemaps/management/__init__.pyi similarity index 100% rename from django-stubs/contrib/sitemaps/management/__init__.pyi rename to typings/django/contrib/sitemaps/management/__init__.pyi diff --git a/django-stubs/contrib/sitemaps/management/commands/__init__.pyi b/typings/django/contrib/sitemaps/management/commands/__init__.pyi similarity index 100% rename from django-stubs/contrib/sitemaps/management/commands/__init__.pyi rename to typings/django/contrib/sitemaps/management/commands/__init__.pyi diff --git a/django-stubs/contrib/sitemaps/management/commands/ping_google.pyi b/typings/django/contrib/sitemaps/management/commands/ping_google.pyi similarity index 100% rename from django-stubs/contrib/sitemaps/management/commands/ping_google.pyi rename to typings/django/contrib/sitemaps/management/commands/ping_google.pyi diff --git a/django-stubs/contrib/sitemaps/views.pyi b/typings/django/contrib/sitemaps/views.pyi similarity index 100% rename from django-stubs/contrib/sitemaps/views.pyi rename to typings/django/contrib/sitemaps/views.pyi diff --git a/django-stubs/contrib/sites/__init__.pyi b/typings/django/contrib/sites/__init__.pyi similarity index 100% rename from django-stubs/contrib/sites/__init__.pyi rename to typings/django/contrib/sites/__init__.pyi diff --git a/django-stubs/contrib/sites/admin.pyi b/typings/django/contrib/sites/admin.pyi similarity index 100% rename from django-stubs/contrib/sites/admin.pyi rename to typings/django/contrib/sites/admin.pyi diff --git a/django-stubs/contrib/sites/apps.pyi b/typings/django/contrib/sites/apps.pyi similarity index 100% rename from django-stubs/contrib/sites/apps.pyi rename to typings/django/contrib/sites/apps.pyi diff --git a/django-stubs/contrib/sites/management.pyi b/typings/django/contrib/sites/management.pyi similarity index 100% rename from django-stubs/contrib/sites/management.pyi rename to typings/django/contrib/sites/management.pyi diff --git a/django-stubs/contrib/sites/managers.pyi b/typings/django/contrib/sites/managers.pyi similarity index 100% rename from django-stubs/contrib/sites/managers.pyi rename to typings/django/contrib/sites/managers.pyi diff --git a/django-stubs/contrib/sites/middleware.pyi b/typings/django/contrib/sites/middleware.pyi similarity index 100% rename from django-stubs/contrib/sites/middleware.pyi rename to typings/django/contrib/sites/middleware.pyi diff --git a/django-stubs/contrib/sites/migrations/__init__.pyi b/typings/django/contrib/sites/migrations/__init__.pyi similarity index 100% rename from django-stubs/contrib/sites/migrations/__init__.pyi rename to typings/django/contrib/sites/migrations/__init__.pyi diff --git a/django-stubs/contrib/sites/models.pyi b/typings/django/contrib/sites/models.pyi similarity index 100% rename from django-stubs/contrib/sites/models.pyi rename to typings/django/contrib/sites/models.pyi diff --git a/django-stubs/contrib/sites/requests.pyi b/typings/django/contrib/sites/requests.pyi similarity index 100% rename from django-stubs/contrib/sites/requests.pyi rename to typings/django/contrib/sites/requests.pyi diff --git a/django-stubs/contrib/sites/shortcuts.pyi b/typings/django/contrib/sites/shortcuts.pyi similarity index 100% rename from django-stubs/contrib/sites/shortcuts.pyi rename to typings/django/contrib/sites/shortcuts.pyi diff --git a/django-stubs/contrib/staticfiles/__init__.pyi b/typings/django/contrib/staticfiles/__init__.pyi similarity index 100% rename from django-stubs/contrib/staticfiles/__init__.pyi rename to typings/django/contrib/staticfiles/__init__.pyi diff --git a/django-stubs/contrib/staticfiles/apps.pyi b/typings/django/contrib/staticfiles/apps.pyi similarity index 100% rename from django-stubs/contrib/staticfiles/apps.pyi rename to typings/django/contrib/staticfiles/apps.pyi diff --git a/django-stubs/contrib/staticfiles/checks.pyi b/typings/django/contrib/staticfiles/checks.pyi similarity index 100% rename from django-stubs/contrib/staticfiles/checks.pyi rename to typings/django/contrib/staticfiles/checks.pyi diff --git a/django-stubs/contrib/staticfiles/finders.pyi b/typings/django/contrib/staticfiles/finders.pyi similarity index 100% rename from django-stubs/contrib/staticfiles/finders.pyi rename to typings/django/contrib/staticfiles/finders.pyi diff --git a/django-stubs/contrib/staticfiles/handlers.pyi b/typings/django/contrib/staticfiles/handlers.pyi similarity index 100% rename from django-stubs/contrib/staticfiles/handlers.pyi rename to typings/django/contrib/staticfiles/handlers.pyi diff --git a/django-stubs/contrib/staticfiles/management/__init__.pyi b/typings/django/contrib/staticfiles/management/__init__.pyi similarity index 100% rename from django-stubs/contrib/staticfiles/management/__init__.pyi rename to typings/django/contrib/staticfiles/management/__init__.pyi diff --git a/django-stubs/contrib/staticfiles/management/commands/__init__.pyi b/typings/django/contrib/staticfiles/management/commands/__init__.pyi similarity index 100% rename from django-stubs/contrib/staticfiles/management/commands/__init__.pyi rename to typings/django/contrib/staticfiles/management/commands/__init__.pyi diff --git a/django-stubs/contrib/staticfiles/management/commands/collectstatic.pyi b/typings/django/contrib/staticfiles/management/commands/collectstatic.pyi similarity index 100% rename from django-stubs/contrib/staticfiles/management/commands/collectstatic.pyi rename to typings/django/contrib/staticfiles/management/commands/collectstatic.pyi diff --git a/django-stubs/contrib/staticfiles/management/commands/findstatic.pyi b/typings/django/contrib/staticfiles/management/commands/findstatic.pyi similarity index 100% rename from django-stubs/contrib/staticfiles/management/commands/findstatic.pyi rename to typings/django/contrib/staticfiles/management/commands/findstatic.pyi diff --git a/django-stubs/contrib/staticfiles/management/commands/runserver.pyi b/typings/django/contrib/staticfiles/management/commands/runserver.pyi similarity index 100% rename from django-stubs/contrib/staticfiles/management/commands/runserver.pyi rename to typings/django/contrib/staticfiles/management/commands/runserver.pyi diff --git a/django-stubs/contrib/staticfiles/storage.pyi b/typings/django/contrib/staticfiles/storage.pyi similarity index 100% rename from django-stubs/contrib/staticfiles/storage.pyi rename to typings/django/contrib/staticfiles/storage.pyi diff --git a/django-stubs/contrib/staticfiles/templatetags/__init__.pyi b/typings/django/contrib/staticfiles/templatetags/__init__.pyi similarity index 100% rename from django-stubs/contrib/staticfiles/templatetags/__init__.pyi rename to typings/django/contrib/staticfiles/templatetags/__init__.pyi diff --git a/django-stubs/contrib/staticfiles/templatetags/staticfiles.pyi b/typings/django/contrib/staticfiles/templatetags/staticfiles.pyi similarity index 100% rename from django-stubs/contrib/staticfiles/templatetags/staticfiles.pyi rename to typings/django/contrib/staticfiles/templatetags/staticfiles.pyi diff --git a/django-stubs/contrib/staticfiles/testing.pyi b/typings/django/contrib/staticfiles/testing.pyi similarity index 100% rename from django-stubs/contrib/staticfiles/testing.pyi rename to typings/django/contrib/staticfiles/testing.pyi diff --git a/django-stubs/contrib/staticfiles/urls.pyi b/typings/django/contrib/staticfiles/urls.pyi similarity index 100% rename from django-stubs/contrib/staticfiles/urls.pyi rename to typings/django/contrib/staticfiles/urls.pyi diff --git a/django-stubs/contrib/staticfiles/utils.pyi b/typings/django/contrib/staticfiles/utils.pyi similarity index 100% rename from django-stubs/contrib/staticfiles/utils.pyi rename to typings/django/contrib/staticfiles/utils.pyi diff --git a/django-stubs/contrib/staticfiles/views.pyi b/typings/django/contrib/staticfiles/views.pyi similarity index 100% rename from django-stubs/contrib/staticfiles/views.pyi rename to typings/django/contrib/staticfiles/views.pyi diff --git a/django-stubs/contrib/syndication/__init__.pyi b/typings/django/contrib/syndication/__init__.pyi similarity index 100% rename from django-stubs/contrib/syndication/__init__.pyi rename to typings/django/contrib/syndication/__init__.pyi diff --git a/django-stubs/contrib/syndication/apps.pyi b/typings/django/contrib/syndication/apps.pyi similarity index 100% rename from django-stubs/contrib/syndication/apps.pyi rename to typings/django/contrib/syndication/apps.pyi diff --git a/django-stubs/contrib/syndication/views.pyi b/typings/django/contrib/syndication/views.pyi similarity index 100% rename from django-stubs/contrib/syndication/views.pyi rename to typings/django/contrib/syndication/views.pyi diff --git a/django-stubs/core/__init__.pyi b/typings/django/core/__init__.pyi similarity index 100% rename from django-stubs/core/__init__.pyi rename to typings/django/core/__init__.pyi diff --git a/django-stubs/core/asgi.pyi b/typings/django/core/asgi.pyi similarity index 100% rename from django-stubs/core/asgi.pyi rename to typings/django/core/asgi.pyi diff --git a/django-stubs/core/cache/__init__.pyi b/typings/django/core/cache/__init__.pyi similarity index 100% rename from django-stubs/core/cache/__init__.pyi rename to typings/django/core/cache/__init__.pyi diff --git a/django-stubs/core/cache/backends/__init__.pyi b/typings/django/core/cache/backends/__init__.pyi similarity index 100% rename from django-stubs/core/cache/backends/__init__.pyi rename to typings/django/core/cache/backends/__init__.pyi diff --git a/django-stubs/core/cache/backends/base.pyi b/typings/django/core/cache/backends/base.pyi similarity index 100% rename from django-stubs/core/cache/backends/base.pyi rename to typings/django/core/cache/backends/base.pyi diff --git a/django-stubs/core/cache/backends/db.pyi b/typings/django/core/cache/backends/db.pyi similarity index 100% rename from django-stubs/core/cache/backends/db.pyi rename to typings/django/core/cache/backends/db.pyi diff --git a/django-stubs/core/cache/backends/dummy.pyi b/typings/django/core/cache/backends/dummy.pyi similarity index 100% rename from django-stubs/core/cache/backends/dummy.pyi rename to typings/django/core/cache/backends/dummy.pyi diff --git a/django-stubs/core/cache/backends/filebased.pyi b/typings/django/core/cache/backends/filebased.pyi similarity index 100% rename from django-stubs/core/cache/backends/filebased.pyi rename to typings/django/core/cache/backends/filebased.pyi diff --git a/django-stubs/core/cache/backends/locmem.pyi b/typings/django/core/cache/backends/locmem.pyi similarity index 100% rename from django-stubs/core/cache/backends/locmem.pyi rename to typings/django/core/cache/backends/locmem.pyi diff --git a/django-stubs/core/cache/backends/memcached.pyi b/typings/django/core/cache/backends/memcached.pyi similarity index 100% rename from django-stubs/core/cache/backends/memcached.pyi rename to typings/django/core/cache/backends/memcached.pyi diff --git a/django-stubs/core/cache/utils.pyi b/typings/django/core/cache/utils.pyi similarity index 100% rename from django-stubs/core/cache/utils.pyi rename to typings/django/core/cache/utils.pyi diff --git a/django-stubs/core/checks/__init__.pyi b/typings/django/core/checks/__init__.pyi similarity index 100% rename from django-stubs/core/checks/__init__.pyi rename to typings/django/core/checks/__init__.pyi diff --git a/django-stubs/core/checks/async_checks.pyi b/typings/django/core/checks/async_checks.pyi similarity index 100% rename from django-stubs/core/checks/async_checks.pyi rename to typings/django/core/checks/async_checks.pyi diff --git a/django-stubs/core/checks/caches.pyi b/typings/django/core/checks/caches.pyi similarity index 100% rename from django-stubs/core/checks/caches.pyi rename to typings/django/core/checks/caches.pyi diff --git a/django-stubs/core/checks/compatibility/__init__.pyi b/typings/django/core/checks/compatibility/__init__.pyi similarity index 100% rename from django-stubs/core/checks/compatibility/__init__.pyi rename to typings/django/core/checks/compatibility/__init__.pyi diff --git a/django-stubs/core/checks/database.pyi b/typings/django/core/checks/database.pyi similarity index 100% rename from django-stubs/core/checks/database.pyi rename to typings/django/core/checks/database.pyi diff --git a/django-stubs/core/checks/messages.pyi b/typings/django/core/checks/messages.pyi similarity index 100% rename from django-stubs/core/checks/messages.pyi rename to typings/django/core/checks/messages.pyi diff --git a/django-stubs/core/checks/model_checks.pyi b/typings/django/core/checks/model_checks.pyi similarity index 100% rename from django-stubs/core/checks/model_checks.pyi rename to typings/django/core/checks/model_checks.pyi diff --git a/django-stubs/core/checks/registry.pyi b/typings/django/core/checks/registry.pyi similarity index 100% rename from django-stubs/core/checks/registry.pyi rename to typings/django/core/checks/registry.pyi diff --git a/django-stubs/core/checks/security/__init__.pyi b/typings/django/core/checks/security/__init__.pyi similarity index 100% rename from django-stubs/core/checks/security/__init__.pyi rename to typings/django/core/checks/security/__init__.pyi diff --git a/django-stubs/core/checks/security/base.pyi b/typings/django/core/checks/security/base.pyi similarity index 100% rename from django-stubs/core/checks/security/base.pyi rename to typings/django/core/checks/security/base.pyi diff --git a/django-stubs/core/checks/security/csrf.pyi b/typings/django/core/checks/security/csrf.pyi similarity index 100% rename from django-stubs/core/checks/security/csrf.pyi rename to typings/django/core/checks/security/csrf.pyi diff --git a/django-stubs/core/checks/security/sessions.pyi b/typings/django/core/checks/security/sessions.pyi similarity index 100% rename from django-stubs/core/checks/security/sessions.pyi rename to typings/django/core/checks/security/sessions.pyi diff --git a/django-stubs/core/checks/templates.pyi b/typings/django/core/checks/templates.pyi similarity index 100% rename from django-stubs/core/checks/templates.pyi rename to typings/django/core/checks/templates.pyi diff --git a/django-stubs/core/checks/translation.pyi b/typings/django/core/checks/translation.pyi similarity index 100% rename from django-stubs/core/checks/translation.pyi rename to typings/django/core/checks/translation.pyi diff --git a/django-stubs/core/checks/urls.pyi b/typings/django/core/checks/urls.pyi similarity index 100% rename from django-stubs/core/checks/urls.pyi rename to typings/django/core/checks/urls.pyi diff --git a/django-stubs/core/exceptions.pyi b/typings/django/core/exceptions.pyi similarity index 100% rename from django-stubs/core/exceptions.pyi rename to typings/django/core/exceptions.pyi diff --git a/django-stubs/core/files/__init__.pyi b/typings/django/core/files/__init__.pyi similarity index 100% rename from django-stubs/core/files/__init__.pyi rename to typings/django/core/files/__init__.pyi diff --git a/django-stubs/core/files/base.pyi b/typings/django/core/files/base.pyi similarity index 100% rename from django-stubs/core/files/base.pyi rename to typings/django/core/files/base.pyi diff --git a/django-stubs/core/files/images.pyi b/typings/django/core/files/images.pyi similarity index 100% rename from django-stubs/core/files/images.pyi rename to typings/django/core/files/images.pyi diff --git a/django-stubs/core/files/locks.pyi b/typings/django/core/files/locks.pyi similarity index 100% rename from django-stubs/core/files/locks.pyi rename to typings/django/core/files/locks.pyi diff --git a/django-stubs/core/files/move.pyi b/typings/django/core/files/move.pyi similarity index 100% rename from django-stubs/core/files/move.pyi rename to typings/django/core/files/move.pyi diff --git a/django-stubs/core/files/storage.pyi b/typings/django/core/files/storage.pyi similarity index 100% rename from django-stubs/core/files/storage.pyi rename to typings/django/core/files/storage.pyi diff --git a/django-stubs/core/files/temp.pyi b/typings/django/core/files/temp.pyi similarity index 100% rename from django-stubs/core/files/temp.pyi rename to typings/django/core/files/temp.pyi diff --git a/django-stubs/core/files/uploadedfile.pyi b/typings/django/core/files/uploadedfile.pyi similarity index 100% rename from django-stubs/core/files/uploadedfile.pyi rename to typings/django/core/files/uploadedfile.pyi diff --git a/django-stubs/core/files/uploadhandler.pyi b/typings/django/core/files/uploadhandler.pyi similarity index 100% rename from django-stubs/core/files/uploadhandler.pyi rename to typings/django/core/files/uploadhandler.pyi diff --git a/django-stubs/core/files/utils.pyi b/typings/django/core/files/utils.pyi similarity index 100% rename from django-stubs/core/files/utils.pyi rename to typings/django/core/files/utils.pyi diff --git a/django-stubs/core/handlers/__init__.pyi b/typings/django/core/handlers/__init__.pyi similarity index 100% rename from django-stubs/core/handlers/__init__.pyi rename to typings/django/core/handlers/__init__.pyi diff --git a/django-stubs/core/handlers/asgi.pyi b/typings/django/core/handlers/asgi.pyi similarity index 100% rename from django-stubs/core/handlers/asgi.pyi rename to typings/django/core/handlers/asgi.pyi diff --git a/django-stubs/core/handlers/base.pyi b/typings/django/core/handlers/base.pyi similarity index 100% rename from django-stubs/core/handlers/base.pyi rename to typings/django/core/handlers/base.pyi diff --git a/django-stubs/core/handlers/exception.pyi b/typings/django/core/handlers/exception.pyi similarity index 100% rename from django-stubs/core/handlers/exception.pyi rename to typings/django/core/handlers/exception.pyi diff --git a/django-stubs/core/handlers/wsgi.pyi b/typings/django/core/handlers/wsgi.pyi similarity index 100% rename from django-stubs/core/handlers/wsgi.pyi rename to typings/django/core/handlers/wsgi.pyi diff --git a/django-stubs/core/mail/__init__.pyi b/typings/django/core/mail/__init__.pyi similarity index 100% rename from django-stubs/core/mail/__init__.pyi rename to typings/django/core/mail/__init__.pyi diff --git a/django-stubs/core/mail/backends/__init__.pyi b/typings/django/core/mail/backends/__init__.pyi similarity index 100% rename from django-stubs/core/mail/backends/__init__.pyi rename to typings/django/core/mail/backends/__init__.pyi diff --git a/django-stubs/core/mail/backends/base.pyi b/typings/django/core/mail/backends/base.pyi similarity index 100% rename from django-stubs/core/mail/backends/base.pyi rename to typings/django/core/mail/backends/base.pyi diff --git a/django-stubs/core/mail/backends/console.pyi b/typings/django/core/mail/backends/console.pyi similarity index 100% rename from django-stubs/core/mail/backends/console.pyi rename to typings/django/core/mail/backends/console.pyi diff --git a/django-stubs/core/mail/backends/dummy.pyi b/typings/django/core/mail/backends/dummy.pyi similarity index 100% rename from django-stubs/core/mail/backends/dummy.pyi rename to typings/django/core/mail/backends/dummy.pyi diff --git a/django-stubs/core/mail/backends/filebased.pyi b/typings/django/core/mail/backends/filebased.pyi similarity index 100% rename from django-stubs/core/mail/backends/filebased.pyi rename to typings/django/core/mail/backends/filebased.pyi diff --git a/django-stubs/core/mail/backends/locmem.pyi b/typings/django/core/mail/backends/locmem.pyi similarity index 100% rename from django-stubs/core/mail/backends/locmem.pyi rename to typings/django/core/mail/backends/locmem.pyi diff --git a/django-stubs/core/mail/backends/smtp.pyi b/typings/django/core/mail/backends/smtp.pyi similarity index 100% rename from django-stubs/core/mail/backends/smtp.pyi rename to typings/django/core/mail/backends/smtp.pyi diff --git a/django-stubs/core/mail/message.pyi b/typings/django/core/mail/message.pyi similarity index 100% rename from django-stubs/core/mail/message.pyi rename to typings/django/core/mail/message.pyi diff --git a/django-stubs/core/mail/utils.pyi b/typings/django/core/mail/utils.pyi similarity index 100% rename from django-stubs/core/mail/utils.pyi rename to typings/django/core/mail/utils.pyi diff --git a/django-stubs/core/management/__init__.pyi b/typings/django/core/management/__init__.pyi similarity index 100% rename from django-stubs/core/management/__init__.pyi rename to typings/django/core/management/__init__.pyi diff --git a/django-stubs/core/management/base.pyi b/typings/django/core/management/base.pyi similarity index 100% rename from django-stubs/core/management/base.pyi rename to typings/django/core/management/base.pyi diff --git a/django-stubs/core/management/color.pyi b/typings/django/core/management/color.pyi similarity index 100% rename from django-stubs/core/management/color.pyi rename to typings/django/core/management/color.pyi diff --git a/django-stubs/core/management/commands/__init__.pyi b/typings/django/core/management/commands/__init__.pyi similarity index 100% rename from django-stubs/core/management/commands/__init__.pyi rename to typings/django/core/management/commands/__init__.pyi diff --git a/django-stubs/core/management/commands/check.pyi b/typings/django/core/management/commands/check.pyi similarity index 100% rename from django-stubs/core/management/commands/check.pyi rename to typings/django/core/management/commands/check.pyi diff --git a/django-stubs/core/management/commands/compilemessages.pyi b/typings/django/core/management/commands/compilemessages.pyi similarity index 100% rename from django-stubs/core/management/commands/compilemessages.pyi rename to typings/django/core/management/commands/compilemessages.pyi diff --git a/django-stubs/core/management/commands/createcachetable.pyi b/typings/django/core/management/commands/createcachetable.pyi similarity index 100% rename from django-stubs/core/management/commands/createcachetable.pyi rename to typings/django/core/management/commands/createcachetable.pyi diff --git a/django-stubs/core/management/commands/dbshell.pyi b/typings/django/core/management/commands/dbshell.pyi similarity index 100% rename from django-stubs/core/management/commands/dbshell.pyi rename to typings/django/core/management/commands/dbshell.pyi diff --git a/django-stubs/core/management/commands/diffsettings.pyi b/typings/django/core/management/commands/diffsettings.pyi similarity index 100% rename from django-stubs/core/management/commands/diffsettings.pyi rename to typings/django/core/management/commands/diffsettings.pyi diff --git a/django-stubs/core/management/commands/dumpdata.pyi b/typings/django/core/management/commands/dumpdata.pyi similarity index 100% rename from django-stubs/core/management/commands/dumpdata.pyi rename to typings/django/core/management/commands/dumpdata.pyi diff --git a/django-stubs/core/management/commands/flush.pyi b/typings/django/core/management/commands/flush.pyi similarity index 100% rename from django-stubs/core/management/commands/flush.pyi rename to typings/django/core/management/commands/flush.pyi diff --git a/django-stubs/core/management/commands/inspectdb.pyi b/typings/django/core/management/commands/inspectdb.pyi similarity index 100% rename from django-stubs/core/management/commands/inspectdb.pyi rename to typings/django/core/management/commands/inspectdb.pyi diff --git a/django-stubs/core/management/commands/loaddata.pyi b/typings/django/core/management/commands/loaddata.pyi similarity index 100% rename from django-stubs/core/management/commands/loaddata.pyi rename to typings/django/core/management/commands/loaddata.pyi diff --git a/django-stubs/core/management/commands/makemessages.pyi b/typings/django/core/management/commands/makemessages.pyi similarity index 100% rename from django-stubs/core/management/commands/makemessages.pyi rename to typings/django/core/management/commands/makemessages.pyi diff --git a/django-stubs/core/management/commands/makemigrations.pyi b/typings/django/core/management/commands/makemigrations.pyi similarity index 100% rename from django-stubs/core/management/commands/makemigrations.pyi rename to typings/django/core/management/commands/makemigrations.pyi diff --git a/django-stubs/core/management/commands/migrate.pyi b/typings/django/core/management/commands/migrate.pyi similarity index 100% rename from django-stubs/core/management/commands/migrate.pyi rename to typings/django/core/management/commands/migrate.pyi diff --git a/django-stubs/core/management/commands/runserver.pyi b/typings/django/core/management/commands/runserver.pyi similarity index 100% rename from django-stubs/core/management/commands/runserver.pyi rename to typings/django/core/management/commands/runserver.pyi diff --git a/django-stubs/core/management/commands/sendtestemail.pyi b/typings/django/core/management/commands/sendtestemail.pyi similarity index 100% rename from django-stubs/core/management/commands/sendtestemail.pyi rename to typings/django/core/management/commands/sendtestemail.pyi diff --git a/django-stubs/core/management/commands/shell.pyi b/typings/django/core/management/commands/shell.pyi similarity index 100% rename from django-stubs/core/management/commands/shell.pyi rename to typings/django/core/management/commands/shell.pyi diff --git a/django-stubs/core/management/commands/showmigrations.pyi b/typings/django/core/management/commands/showmigrations.pyi similarity index 100% rename from django-stubs/core/management/commands/showmigrations.pyi rename to typings/django/core/management/commands/showmigrations.pyi diff --git a/django-stubs/core/management/commands/sqlflush.pyi b/typings/django/core/management/commands/sqlflush.pyi similarity index 100% rename from django-stubs/core/management/commands/sqlflush.pyi rename to typings/django/core/management/commands/sqlflush.pyi diff --git a/django-stubs/core/management/commands/sqlmigrate.pyi b/typings/django/core/management/commands/sqlmigrate.pyi similarity index 100% rename from django-stubs/core/management/commands/sqlmigrate.pyi rename to typings/django/core/management/commands/sqlmigrate.pyi diff --git a/django-stubs/core/management/commands/sqlsequencereset.pyi b/typings/django/core/management/commands/sqlsequencereset.pyi similarity index 100% rename from django-stubs/core/management/commands/sqlsequencereset.pyi rename to typings/django/core/management/commands/sqlsequencereset.pyi diff --git a/django-stubs/core/management/commands/squashmigrations.pyi b/typings/django/core/management/commands/squashmigrations.pyi similarity index 100% rename from django-stubs/core/management/commands/squashmigrations.pyi rename to typings/django/core/management/commands/squashmigrations.pyi diff --git a/django-stubs/core/management/commands/startapp.pyi b/typings/django/core/management/commands/startapp.pyi similarity index 100% rename from django-stubs/core/management/commands/startapp.pyi rename to typings/django/core/management/commands/startapp.pyi diff --git a/django-stubs/core/management/commands/startproject.pyi b/typings/django/core/management/commands/startproject.pyi similarity index 100% rename from django-stubs/core/management/commands/startproject.pyi rename to typings/django/core/management/commands/startproject.pyi diff --git a/django-stubs/core/management/commands/test.pyi b/typings/django/core/management/commands/test.pyi similarity index 100% rename from django-stubs/core/management/commands/test.pyi rename to typings/django/core/management/commands/test.pyi diff --git a/django-stubs/core/management/commands/testserver.pyi b/typings/django/core/management/commands/testserver.pyi similarity index 100% rename from django-stubs/core/management/commands/testserver.pyi rename to typings/django/core/management/commands/testserver.pyi diff --git a/django-stubs/core/management/sql.pyi b/typings/django/core/management/sql.pyi similarity index 100% rename from django-stubs/core/management/sql.pyi rename to typings/django/core/management/sql.pyi diff --git a/django-stubs/core/management/templates.pyi b/typings/django/core/management/templates.pyi similarity index 100% rename from django-stubs/core/management/templates.pyi rename to typings/django/core/management/templates.pyi diff --git a/django-stubs/core/management/utils.pyi b/typings/django/core/management/utils.pyi similarity index 100% rename from django-stubs/core/management/utils.pyi rename to typings/django/core/management/utils.pyi diff --git a/django-stubs/core/paginator.pyi b/typings/django/core/paginator.pyi similarity index 100% rename from django-stubs/core/paginator.pyi rename to typings/django/core/paginator.pyi diff --git a/django-stubs/core/serializers/__init__.pyi b/typings/django/core/serializers/__init__.pyi similarity index 100% rename from django-stubs/core/serializers/__init__.pyi rename to typings/django/core/serializers/__init__.pyi diff --git a/django-stubs/core/serializers/base.pyi b/typings/django/core/serializers/base.pyi similarity index 100% rename from django-stubs/core/serializers/base.pyi rename to typings/django/core/serializers/base.pyi diff --git a/django-stubs/core/serializers/json.pyi b/typings/django/core/serializers/json.pyi similarity index 100% rename from django-stubs/core/serializers/json.pyi rename to typings/django/core/serializers/json.pyi diff --git a/django-stubs/core/serializers/python.pyi b/typings/django/core/serializers/python.pyi similarity index 100% rename from django-stubs/core/serializers/python.pyi rename to typings/django/core/serializers/python.pyi diff --git a/django-stubs/core/serializers/pyyaml.pyi b/typings/django/core/serializers/pyyaml.pyi similarity index 100% rename from django-stubs/core/serializers/pyyaml.pyi rename to typings/django/core/serializers/pyyaml.pyi diff --git a/django-stubs/core/serializers/xml_serializer.pyi b/typings/django/core/serializers/xml_serializer.pyi similarity index 100% rename from django-stubs/core/serializers/xml_serializer.pyi rename to typings/django/core/serializers/xml_serializer.pyi diff --git a/django-stubs/core/servers/__init__.pyi b/typings/django/core/servers/__init__.pyi similarity index 100% rename from django-stubs/core/servers/__init__.pyi rename to typings/django/core/servers/__init__.pyi diff --git a/django-stubs/core/servers/basehttp.pyi b/typings/django/core/servers/basehttp.pyi similarity index 100% rename from django-stubs/core/servers/basehttp.pyi rename to typings/django/core/servers/basehttp.pyi diff --git a/django-stubs/core/signals.pyi b/typings/django/core/signals.pyi similarity index 100% rename from django-stubs/core/signals.pyi rename to typings/django/core/signals.pyi diff --git a/django-stubs/core/signing.pyi b/typings/django/core/signing.pyi similarity index 100% rename from django-stubs/core/signing.pyi rename to typings/django/core/signing.pyi diff --git a/django-stubs/core/validators.pyi b/typings/django/core/validators.pyi similarity index 100% rename from django-stubs/core/validators.pyi rename to typings/django/core/validators.pyi diff --git a/django-stubs/core/wsgi.pyi b/typings/django/core/wsgi.pyi similarity index 100% rename from django-stubs/core/wsgi.pyi rename to typings/django/core/wsgi.pyi diff --git a/django-stubs/db/__init__.pyi b/typings/django/db/__init__.pyi similarity index 100% rename from django-stubs/db/__init__.pyi rename to typings/django/db/__init__.pyi diff --git a/django-stubs/db/backends/__init__.pyi b/typings/django/db/backends/__init__.pyi similarity index 100% rename from django-stubs/db/backends/__init__.pyi rename to typings/django/db/backends/__init__.pyi diff --git a/django-stubs/db/backends/base/__init__.pyi b/typings/django/db/backends/base/__init__.pyi similarity index 100% rename from django-stubs/db/backends/base/__init__.pyi rename to typings/django/db/backends/base/__init__.pyi diff --git a/django-stubs/db/backends/base/base.pyi b/typings/django/db/backends/base/base.pyi similarity index 100% rename from django-stubs/db/backends/base/base.pyi rename to typings/django/db/backends/base/base.pyi diff --git a/django-stubs/db/backends/base/client.pyi b/typings/django/db/backends/base/client.pyi similarity index 100% rename from django-stubs/db/backends/base/client.pyi rename to typings/django/db/backends/base/client.pyi diff --git a/django-stubs/db/backends/base/creation.pyi b/typings/django/db/backends/base/creation.pyi similarity index 100% rename from django-stubs/db/backends/base/creation.pyi rename to typings/django/db/backends/base/creation.pyi diff --git a/django-stubs/db/backends/base/features.pyi b/typings/django/db/backends/base/features.pyi similarity index 100% rename from django-stubs/db/backends/base/features.pyi rename to typings/django/db/backends/base/features.pyi diff --git a/django-stubs/db/backends/base/introspection.pyi b/typings/django/db/backends/base/introspection.pyi similarity index 100% rename from django-stubs/db/backends/base/introspection.pyi rename to typings/django/db/backends/base/introspection.pyi diff --git a/django-stubs/db/backends/base/operations.pyi b/typings/django/db/backends/base/operations.pyi similarity index 100% rename from django-stubs/db/backends/base/operations.pyi rename to typings/django/db/backends/base/operations.pyi diff --git a/django-stubs/db/backends/base/schema.pyi b/typings/django/db/backends/base/schema.pyi similarity index 100% rename from django-stubs/db/backends/base/schema.pyi rename to typings/django/db/backends/base/schema.pyi diff --git a/django-stubs/db/backends/base/validation.pyi b/typings/django/db/backends/base/validation.pyi similarity index 100% rename from django-stubs/db/backends/base/validation.pyi rename to typings/django/db/backends/base/validation.pyi diff --git a/django-stubs/db/backends/ddl_references.pyi b/typings/django/db/backends/ddl_references.pyi similarity index 100% rename from django-stubs/db/backends/ddl_references.pyi rename to typings/django/db/backends/ddl_references.pyi diff --git a/django-stubs/db/backends/dummy/__init__.pyi b/typings/django/db/backends/dummy/__init__.pyi similarity index 100% rename from django-stubs/db/backends/dummy/__init__.pyi rename to typings/django/db/backends/dummy/__init__.pyi diff --git a/django-stubs/db/backends/dummy/base.pyi b/typings/django/db/backends/dummy/base.pyi similarity index 100% rename from django-stubs/db/backends/dummy/base.pyi rename to typings/django/db/backends/dummy/base.pyi diff --git a/django-stubs/db/backends/dummy/features.pyi b/typings/django/db/backends/dummy/features.pyi similarity index 100% rename from django-stubs/db/backends/dummy/features.pyi rename to typings/django/db/backends/dummy/features.pyi diff --git a/django-stubs/db/backends/mysql/__init__.pyi b/typings/django/db/backends/mysql/__init__.pyi similarity index 100% rename from django-stubs/db/backends/mysql/__init__.pyi rename to typings/django/db/backends/mysql/__init__.pyi diff --git a/django-stubs/db/backends/mysql/base.pyi b/typings/django/db/backends/mysql/base.pyi similarity index 100% rename from django-stubs/db/backends/mysql/base.pyi rename to typings/django/db/backends/mysql/base.pyi diff --git a/django-stubs/db/backends/mysql/client.pyi b/typings/django/db/backends/mysql/client.pyi similarity index 100% rename from django-stubs/db/backends/mysql/client.pyi rename to typings/django/db/backends/mysql/client.pyi diff --git a/django-stubs/db/backends/mysql/compiler.pyi b/typings/django/db/backends/mysql/compiler.pyi similarity index 100% rename from django-stubs/db/backends/mysql/compiler.pyi rename to typings/django/db/backends/mysql/compiler.pyi diff --git a/django-stubs/db/backends/mysql/creation.pyi b/typings/django/db/backends/mysql/creation.pyi similarity index 100% rename from django-stubs/db/backends/mysql/creation.pyi rename to typings/django/db/backends/mysql/creation.pyi diff --git a/django-stubs/db/backends/mysql/features.pyi b/typings/django/db/backends/mysql/features.pyi similarity index 100% rename from django-stubs/db/backends/mysql/features.pyi rename to typings/django/db/backends/mysql/features.pyi diff --git a/django-stubs/db/backends/mysql/introspection.pyi b/typings/django/db/backends/mysql/introspection.pyi similarity index 100% rename from django-stubs/db/backends/mysql/introspection.pyi rename to typings/django/db/backends/mysql/introspection.pyi diff --git a/django-stubs/db/backends/mysql/operations.pyi b/typings/django/db/backends/mysql/operations.pyi similarity index 100% rename from django-stubs/db/backends/mysql/operations.pyi rename to typings/django/db/backends/mysql/operations.pyi diff --git a/django-stubs/db/backends/mysql/schema.pyi b/typings/django/db/backends/mysql/schema.pyi similarity index 100% rename from django-stubs/db/backends/mysql/schema.pyi rename to typings/django/db/backends/mysql/schema.pyi diff --git a/django-stubs/db/backends/mysql/validation.pyi b/typings/django/db/backends/mysql/validation.pyi similarity index 100% rename from django-stubs/db/backends/mysql/validation.pyi rename to typings/django/db/backends/mysql/validation.pyi diff --git a/django-stubs/db/backends/oracle/__init__.pyi b/typings/django/db/backends/oracle/__init__.pyi similarity index 100% rename from django-stubs/db/backends/oracle/__init__.pyi rename to typings/django/db/backends/oracle/__init__.pyi diff --git a/django-stubs/db/backends/oracle/base.pyi b/typings/django/db/backends/oracle/base.pyi similarity index 100% rename from django-stubs/db/backends/oracle/base.pyi rename to typings/django/db/backends/oracle/base.pyi diff --git a/django-stubs/db/backends/oracle/client.pyi b/typings/django/db/backends/oracle/client.pyi similarity index 100% rename from django-stubs/db/backends/oracle/client.pyi rename to typings/django/db/backends/oracle/client.pyi diff --git a/django-stubs/db/backends/oracle/creation.pyi b/typings/django/db/backends/oracle/creation.pyi similarity index 100% rename from django-stubs/db/backends/oracle/creation.pyi rename to typings/django/db/backends/oracle/creation.pyi diff --git a/django-stubs/db/backends/oracle/features.pyi b/typings/django/db/backends/oracle/features.pyi similarity index 100% rename from django-stubs/db/backends/oracle/features.pyi rename to typings/django/db/backends/oracle/features.pyi diff --git a/django-stubs/db/backends/oracle/functions.pyi b/typings/django/db/backends/oracle/functions.pyi similarity index 100% rename from django-stubs/db/backends/oracle/functions.pyi rename to typings/django/db/backends/oracle/functions.pyi diff --git a/django-stubs/db/backends/oracle/introspection.pyi b/typings/django/db/backends/oracle/introspection.pyi similarity index 100% rename from django-stubs/db/backends/oracle/introspection.pyi rename to typings/django/db/backends/oracle/introspection.pyi diff --git a/django-stubs/db/backends/oracle/operations.pyi b/typings/django/db/backends/oracle/operations.pyi similarity index 100% rename from django-stubs/db/backends/oracle/operations.pyi rename to typings/django/db/backends/oracle/operations.pyi diff --git a/django-stubs/db/backends/oracle/schema.pyi b/typings/django/db/backends/oracle/schema.pyi similarity index 100% rename from django-stubs/db/backends/oracle/schema.pyi rename to typings/django/db/backends/oracle/schema.pyi diff --git a/django-stubs/db/backends/oracle/utils.pyi b/typings/django/db/backends/oracle/utils.pyi similarity index 100% rename from django-stubs/db/backends/oracle/utils.pyi rename to typings/django/db/backends/oracle/utils.pyi diff --git a/django-stubs/db/backends/oracle/validation.pyi b/typings/django/db/backends/oracle/validation.pyi similarity index 100% rename from django-stubs/db/backends/oracle/validation.pyi rename to typings/django/db/backends/oracle/validation.pyi diff --git a/django-stubs/db/backends/postgresql/__init__.pyi b/typings/django/db/backends/postgresql/__init__.pyi similarity index 100% rename from django-stubs/db/backends/postgresql/__init__.pyi rename to typings/django/db/backends/postgresql/__init__.pyi diff --git a/django-stubs/db/backends/postgresql/base.pyi b/typings/django/db/backends/postgresql/base.pyi similarity index 100% rename from django-stubs/db/backends/postgresql/base.pyi rename to typings/django/db/backends/postgresql/base.pyi diff --git a/django-stubs/db/backends/postgresql/client.pyi b/typings/django/db/backends/postgresql/client.pyi similarity index 100% rename from django-stubs/db/backends/postgresql/client.pyi rename to typings/django/db/backends/postgresql/client.pyi diff --git a/django-stubs/db/backends/postgresql/creation.pyi b/typings/django/db/backends/postgresql/creation.pyi similarity index 100% rename from django-stubs/db/backends/postgresql/creation.pyi rename to typings/django/db/backends/postgresql/creation.pyi diff --git a/django-stubs/db/backends/postgresql/features.pyi b/typings/django/db/backends/postgresql/features.pyi similarity index 100% rename from django-stubs/db/backends/postgresql/features.pyi rename to typings/django/db/backends/postgresql/features.pyi diff --git a/django-stubs/db/backends/postgresql/introspection.pyi b/typings/django/db/backends/postgresql/introspection.pyi similarity index 100% rename from django-stubs/db/backends/postgresql/introspection.pyi rename to typings/django/db/backends/postgresql/introspection.pyi diff --git a/django-stubs/db/backends/postgresql/operations.pyi b/typings/django/db/backends/postgresql/operations.pyi similarity index 100% rename from django-stubs/db/backends/postgresql/operations.pyi rename to typings/django/db/backends/postgresql/operations.pyi diff --git a/django-stubs/db/backends/postgresql/schema.pyi b/typings/django/db/backends/postgresql/schema.pyi similarity index 100% rename from django-stubs/db/backends/postgresql/schema.pyi rename to typings/django/db/backends/postgresql/schema.pyi diff --git a/django-stubs/db/backends/postgresql/test_import_all.yml b/typings/django/db/backends/postgresql/test_import_all.yml similarity index 100% rename from django-stubs/db/backends/postgresql/test_import_all.yml rename to typings/django/db/backends/postgresql/test_import_all.yml diff --git a/django-stubs/db/backends/signals.pyi b/typings/django/db/backends/signals.pyi similarity index 100% rename from django-stubs/db/backends/signals.pyi rename to typings/django/db/backends/signals.pyi diff --git a/django-stubs/db/backends/sqlite3/__init__.pyi b/typings/django/db/backends/sqlite3/__init__.pyi similarity index 100% rename from django-stubs/db/backends/sqlite3/__init__.pyi rename to typings/django/db/backends/sqlite3/__init__.pyi diff --git a/django-stubs/db/backends/sqlite3/base.pyi b/typings/django/db/backends/sqlite3/base.pyi similarity index 100% rename from django-stubs/db/backends/sqlite3/base.pyi rename to typings/django/db/backends/sqlite3/base.pyi diff --git a/django-stubs/db/backends/sqlite3/client.pyi b/typings/django/db/backends/sqlite3/client.pyi similarity index 100% rename from django-stubs/db/backends/sqlite3/client.pyi rename to typings/django/db/backends/sqlite3/client.pyi diff --git a/django-stubs/db/backends/sqlite3/creation.pyi b/typings/django/db/backends/sqlite3/creation.pyi similarity index 100% rename from django-stubs/db/backends/sqlite3/creation.pyi rename to typings/django/db/backends/sqlite3/creation.pyi diff --git a/django-stubs/db/backends/sqlite3/features.pyi b/typings/django/db/backends/sqlite3/features.pyi similarity index 100% rename from django-stubs/db/backends/sqlite3/features.pyi rename to typings/django/db/backends/sqlite3/features.pyi diff --git a/django-stubs/db/backends/sqlite3/introspection.pyi b/typings/django/db/backends/sqlite3/introspection.pyi similarity index 100% rename from django-stubs/db/backends/sqlite3/introspection.pyi rename to typings/django/db/backends/sqlite3/introspection.pyi diff --git a/django-stubs/db/backends/sqlite3/operations.pyi b/typings/django/db/backends/sqlite3/operations.pyi similarity index 100% rename from django-stubs/db/backends/sqlite3/operations.pyi rename to typings/django/db/backends/sqlite3/operations.pyi diff --git a/django-stubs/db/backends/sqlite3/schema.pyi b/typings/django/db/backends/sqlite3/schema.pyi similarity index 100% rename from django-stubs/db/backends/sqlite3/schema.pyi rename to typings/django/db/backends/sqlite3/schema.pyi diff --git a/django-stubs/db/backends/utils.pyi b/typings/django/db/backends/utils.pyi similarity index 100% rename from django-stubs/db/backends/utils.pyi rename to typings/django/db/backends/utils.pyi diff --git a/django-stubs/db/migrations/__init__.pyi b/typings/django/db/migrations/__init__.pyi similarity index 100% rename from django-stubs/db/migrations/__init__.pyi rename to typings/django/db/migrations/__init__.pyi diff --git a/django-stubs/db/migrations/autodetector.pyi b/typings/django/db/migrations/autodetector.pyi similarity index 100% rename from django-stubs/db/migrations/autodetector.pyi rename to typings/django/db/migrations/autodetector.pyi diff --git a/django-stubs/db/migrations/exceptions.pyi b/typings/django/db/migrations/exceptions.pyi similarity index 100% rename from django-stubs/db/migrations/exceptions.pyi rename to typings/django/db/migrations/exceptions.pyi diff --git a/django-stubs/db/migrations/executor.pyi b/typings/django/db/migrations/executor.pyi similarity index 100% rename from django-stubs/db/migrations/executor.pyi rename to typings/django/db/migrations/executor.pyi diff --git a/django-stubs/db/migrations/graph.pyi b/typings/django/db/migrations/graph.pyi similarity index 100% rename from django-stubs/db/migrations/graph.pyi rename to typings/django/db/migrations/graph.pyi diff --git a/django-stubs/db/migrations/loader.pyi b/typings/django/db/migrations/loader.pyi similarity index 100% rename from django-stubs/db/migrations/loader.pyi rename to typings/django/db/migrations/loader.pyi diff --git a/django-stubs/db/migrations/migration.pyi b/typings/django/db/migrations/migration.pyi similarity index 100% rename from django-stubs/db/migrations/migration.pyi rename to typings/django/db/migrations/migration.pyi diff --git a/django-stubs/db/migrations/operations/__init__.pyi b/typings/django/db/migrations/operations/__init__.pyi similarity index 100% rename from django-stubs/db/migrations/operations/__init__.pyi rename to typings/django/db/migrations/operations/__init__.pyi diff --git a/django-stubs/db/migrations/operations/base.pyi b/typings/django/db/migrations/operations/base.pyi similarity index 100% rename from django-stubs/db/migrations/operations/base.pyi rename to typings/django/db/migrations/operations/base.pyi diff --git a/django-stubs/db/migrations/operations/fields.pyi b/typings/django/db/migrations/operations/fields.pyi similarity index 100% rename from django-stubs/db/migrations/operations/fields.pyi rename to typings/django/db/migrations/operations/fields.pyi diff --git a/django-stubs/db/migrations/operations/models.pyi b/typings/django/db/migrations/operations/models.pyi similarity index 100% rename from django-stubs/db/migrations/operations/models.pyi rename to typings/django/db/migrations/operations/models.pyi diff --git a/django-stubs/db/migrations/operations/special.pyi b/typings/django/db/migrations/operations/special.pyi similarity index 100% rename from django-stubs/db/migrations/operations/special.pyi rename to typings/django/db/migrations/operations/special.pyi diff --git a/django-stubs/db/migrations/operations/utils.pyi b/typings/django/db/migrations/operations/utils.pyi similarity index 100% rename from django-stubs/db/migrations/operations/utils.pyi rename to typings/django/db/migrations/operations/utils.pyi diff --git a/django-stubs/db/migrations/optimizer.pyi b/typings/django/db/migrations/optimizer.pyi similarity index 100% rename from django-stubs/db/migrations/optimizer.pyi rename to typings/django/db/migrations/optimizer.pyi diff --git a/django-stubs/db/migrations/questioner.pyi b/typings/django/db/migrations/questioner.pyi similarity index 100% rename from django-stubs/db/migrations/questioner.pyi rename to typings/django/db/migrations/questioner.pyi diff --git a/django-stubs/db/migrations/recorder.pyi b/typings/django/db/migrations/recorder.pyi similarity index 100% rename from django-stubs/db/migrations/recorder.pyi rename to typings/django/db/migrations/recorder.pyi diff --git a/django-stubs/db/migrations/serializer.pyi b/typings/django/db/migrations/serializer.pyi similarity index 100% rename from django-stubs/db/migrations/serializer.pyi rename to typings/django/db/migrations/serializer.pyi diff --git a/django-stubs/db/migrations/state.pyi b/typings/django/db/migrations/state.pyi similarity index 100% rename from django-stubs/db/migrations/state.pyi rename to typings/django/db/migrations/state.pyi diff --git a/django-stubs/db/migrations/topological_sort.pyi b/typings/django/db/migrations/topological_sort.pyi similarity index 100% rename from django-stubs/db/migrations/topological_sort.pyi rename to typings/django/db/migrations/topological_sort.pyi diff --git a/django-stubs/db/migrations/utils.pyi b/typings/django/db/migrations/utils.pyi similarity index 100% rename from django-stubs/db/migrations/utils.pyi rename to typings/django/db/migrations/utils.pyi diff --git a/django-stubs/db/migrations/writer.pyi b/typings/django/db/migrations/writer.pyi similarity index 100% rename from django-stubs/db/migrations/writer.pyi rename to typings/django/db/migrations/writer.pyi diff --git a/django-stubs/db/models/__init__.pyi b/typings/django/db/models/__init__.pyi similarity index 100% rename from django-stubs/db/models/__init__.pyi rename to typings/django/db/models/__init__.pyi diff --git a/django-stubs/db/models/aggregates.pyi b/typings/django/db/models/aggregates.pyi similarity index 100% rename from django-stubs/db/models/aggregates.pyi rename to typings/django/db/models/aggregates.pyi diff --git a/django-stubs/db/models/base.pyi b/typings/django/db/models/base.pyi similarity index 100% rename from django-stubs/db/models/base.pyi rename to typings/django/db/models/base.pyi diff --git a/django-stubs/db/models/constants.pyi b/typings/django/db/models/constants.pyi similarity index 100% rename from django-stubs/db/models/constants.pyi rename to typings/django/db/models/constants.pyi diff --git a/django-stubs/db/models/constraints.pyi b/typings/django/db/models/constraints.pyi similarity index 100% rename from django-stubs/db/models/constraints.pyi rename to typings/django/db/models/constraints.pyi diff --git a/django-stubs/db/models/deletion.pyi b/typings/django/db/models/deletion.pyi similarity index 100% rename from django-stubs/db/models/deletion.pyi rename to typings/django/db/models/deletion.pyi diff --git a/django-stubs/db/models/enums.pyi b/typings/django/db/models/enums.pyi similarity index 100% rename from django-stubs/db/models/enums.pyi rename to typings/django/db/models/enums.pyi diff --git a/django-stubs/db/models/expressions.pyi b/typings/django/db/models/expressions.pyi similarity index 100% rename from django-stubs/db/models/expressions.pyi rename to typings/django/db/models/expressions.pyi diff --git a/django-stubs/db/models/fields/__init__.pyi b/typings/django/db/models/fields/__init__.pyi similarity index 100% rename from django-stubs/db/models/fields/__init__.pyi rename to typings/django/db/models/fields/__init__.pyi diff --git a/django-stubs/db/models/fields/files.pyi b/typings/django/db/models/fields/files.pyi similarity index 100% rename from django-stubs/db/models/fields/files.pyi rename to typings/django/db/models/fields/files.pyi diff --git a/django-stubs/db/models/fields/json.pyi b/typings/django/db/models/fields/json.pyi similarity index 100% rename from django-stubs/db/models/fields/json.pyi rename to typings/django/db/models/fields/json.pyi diff --git a/django-stubs/db/models/fields/mixins.pyi b/typings/django/db/models/fields/mixins.pyi similarity index 100% rename from django-stubs/db/models/fields/mixins.pyi rename to typings/django/db/models/fields/mixins.pyi diff --git a/django-stubs/db/models/fields/proxy.pyi b/typings/django/db/models/fields/proxy.pyi similarity index 100% rename from django-stubs/db/models/fields/proxy.pyi rename to typings/django/db/models/fields/proxy.pyi diff --git a/django-stubs/db/models/fields/related.pyi b/typings/django/db/models/fields/related.pyi similarity index 100% rename from django-stubs/db/models/fields/related.pyi rename to typings/django/db/models/fields/related.pyi diff --git a/django-stubs/db/models/fields/related_descriptors.pyi b/typings/django/db/models/fields/related_descriptors.pyi similarity index 100% rename from django-stubs/db/models/fields/related_descriptors.pyi rename to typings/django/db/models/fields/related_descriptors.pyi diff --git a/django-stubs/db/models/fields/related_lookups.pyi b/typings/django/db/models/fields/related_lookups.pyi similarity index 100% rename from django-stubs/db/models/fields/related_lookups.pyi rename to typings/django/db/models/fields/related_lookups.pyi diff --git a/django-stubs/db/models/fields/reverse_related.pyi b/typings/django/db/models/fields/reverse_related.pyi similarity index 100% rename from django-stubs/db/models/fields/reverse_related.pyi rename to typings/django/db/models/fields/reverse_related.pyi diff --git a/django-stubs/db/models/functions/__init__.pyi b/typings/django/db/models/functions/__init__.pyi similarity index 100% rename from django-stubs/db/models/functions/__init__.pyi rename to typings/django/db/models/functions/__init__.pyi diff --git a/django-stubs/db/models/functions/comparison.pyi b/typings/django/db/models/functions/comparison.pyi similarity index 100% rename from django-stubs/db/models/functions/comparison.pyi rename to typings/django/db/models/functions/comparison.pyi diff --git a/django-stubs/db/models/functions/datetime.pyi b/typings/django/db/models/functions/datetime.pyi similarity index 100% rename from django-stubs/db/models/functions/datetime.pyi rename to typings/django/db/models/functions/datetime.pyi diff --git a/django-stubs/db/models/functions/math.pyi b/typings/django/db/models/functions/math.pyi similarity index 100% rename from django-stubs/db/models/functions/math.pyi rename to typings/django/db/models/functions/math.pyi diff --git a/django-stubs/db/models/functions/mixins.pyi b/typings/django/db/models/functions/mixins.pyi similarity index 100% rename from django-stubs/db/models/functions/mixins.pyi rename to typings/django/db/models/functions/mixins.pyi diff --git a/django-stubs/db/models/functions/text.pyi b/typings/django/db/models/functions/text.pyi similarity index 100% rename from django-stubs/db/models/functions/text.pyi rename to typings/django/db/models/functions/text.pyi diff --git a/django-stubs/db/models/functions/window.pyi b/typings/django/db/models/functions/window.pyi similarity index 100% rename from django-stubs/db/models/functions/window.pyi rename to typings/django/db/models/functions/window.pyi diff --git a/django-stubs/db/models/indexes.pyi b/typings/django/db/models/indexes.pyi similarity index 100% rename from django-stubs/db/models/indexes.pyi rename to typings/django/db/models/indexes.pyi diff --git a/django-stubs/db/models/lookups.pyi b/typings/django/db/models/lookups.pyi similarity index 100% rename from django-stubs/db/models/lookups.pyi rename to typings/django/db/models/lookups.pyi diff --git a/django-stubs/db/models/manager.pyi b/typings/django/db/models/manager.pyi similarity index 100% rename from django-stubs/db/models/manager.pyi rename to typings/django/db/models/manager.pyi diff --git a/django-stubs/db/models/options.pyi b/typings/django/db/models/options.pyi similarity index 100% rename from django-stubs/db/models/options.pyi rename to typings/django/db/models/options.pyi diff --git a/django-stubs/db/models/query.pyi b/typings/django/db/models/query.pyi similarity index 100% rename from django-stubs/db/models/query.pyi rename to typings/django/db/models/query.pyi diff --git a/django-stubs/db/models/query_utils.pyi b/typings/django/db/models/query_utils.pyi similarity index 100% rename from django-stubs/db/models/query_utils.pyi rename to typings/django/db/models/query_utils.pyi diff --git a/django-stubs/db/models/signals.pyi b/typings/django/db/models/signals.pyi similarity index 100% rename from django-stubs/db/models/signals.pyi rename to typings/django/db/models/signals.pyi diff --git a/django-stubs/db/models/sql/__init__.pyi b/typings/django/db/models/sql/__init__.pyi similarity index 100% rename from django-stubs/db/models/sql/__init__.pyi rename to typings/django/db/models/sql/__init__.pyi diff --git a/django-stubs/db/models/sql/compiler.pyi b/typings/django/db/models/sql/compiler.pyi similarity index 100% rename from django-stubs/db/models/sql/compiler.pyi rename to typings/django/db/models/sql/compiler.pyi diff --git a/django-stubs/db/models/sql/constants.pyi b/typings/django/db/models/sql/constants.pyi similarity index 100% rename from django-stubs/db/models/sql/constants.pyi rename to typings/django/db/models/sql/constants.pyi diff --git a/django-stubs/db/models/sql/datastructures.pyi b/typings/django/db/models/sql/datastructures.pyi similarity index 100% rename from django-stubs/db/models/sql/datastructures.pyi rename to typings/django/db/models/sql/datastructures.pyi diff --git a/django-stubs/db/models/sql/query.pyi b/typings/django/db/models/sql/query.pyi similarity index 100% rename from django-stubs/db/models/sql/query.pyi rename to typings/django/db/models/sql/query.pyi diff --git a/django-stubs/db/models/sql/subqueries.pyi b/typings/django/db/models/sql/subqueries.pyi similarity index 100% rename from django-stubs/db/models/sql/subqueries.pyi rename to typings/django/db/models/sql/subqueries.pyi diff --git a/django-stubs/db/models/sql/where.pyi b/typings/django/db/models/sql/where.pyi similarity index 100% rename from django-stubs/db/models/sql/where.pyi rename to typings/django/db/models/sql/where.pyi diff --git a/django-stubs/db/models/utils.pyi b/typings/django/db/models/utils.pyi similarity index 100% rename from django-stubs/db/models/utils.pyi rename to typings/django/db/models/utils.pyi diff --git a/django-stubs/db/transaction.pyi b/typings/django/db/transaction.pyi similarity index 100% rename from django-stubs/db/transaction.pyi rename to typings/django/db/transaction.pyi diff --git a/django-stubs/db/utils.pyi b/typings/django/db/utils.pyi similarity index 100% rename from django-stubs/db/utils.pyi rename to typings/django/db/utils.pyi diff --git a/django-stubs/dispatch/__init__.pyi b/typings/django/dispatch/__init__.pyi similarity index 100% rename from django-stubs/dispatch/__init__.pyi rename to typings/django/dispatch/__init__.pyi diff --git a/django-stubs/dispatch/dispatcher.pyi b/typings/django/dispatch/dispatcher.pyi similarity index 100% rename from django-stubs/dispatch/dispatcher.pyi rename to typings/django/dispatch/dispatcher.pyi diff --git a/django-stubs/forms/__init__.pyi b/typings/django/forms/__init__.pyi similarity index 100% rename from django-stubs/forms/__init__.pyi rename to typings/django/forms/__init__.pyi diff --git a/django-stubs/forms/boundfield.pyi b/typings/django/forms/boundfield.pyi similarity index 100% rename from django-stubs/forms/boundfield.pyi rename to typings/django/forms/boundfield.pyi diff --git a/django-stubs/forms/fields.pyi b/typings/django/forms/fields.pyi similarity index 100% rename from django-stubs/forms/fields.pyi rename to typings/django/forms/fields.pyi diff --git a/django-stubs/forms/forms.pyi b/typings/django/forms/forms.pyi similarity index 100% rename from django-stubs/forms/forms.pyi rename to typings/django/forms/forms.pyi diff --git a/django-stubs/forms/formsets.pyi b/typings/django/forms/formsets.pyi similarity index 100% rename from django-stubs/forms/formsets.pyi rename to typings/django/forms/formsets.pyi diff --git a/django-stubs/forms/models.pyi b/typings/django/forms/models.pyi similarity index 100% rename from django-stubs/forms/models.pyi rename to typings/django/forms/models.pyi diff --git a/django-stubs/forms/renderers.pyi b/typings/django/forms/renderers.pyi similarity index 100% rename from django-stubs/forms/renderers.pyi rename to typings/django/forms/renderers.pyi diff --git a/django-stubs/forms/utils.pyi b/typings/django/forms/utils.pyi similarity index 100% rename from django-stubs/forms/utils.pyi rename to typings/django/forms/utils.pyi diff --git a/django-stubs/forms/widgets.pyi b/typings/django/forms/widgets.pyi similarity index 100% rename from django-stubs/forms/widgets.pyi rename to typings/django/forms/widgets.pyi diff --git a/django-stubs/http/__init__.pyi b/typings/django/http/__init__.pyi similarity index 100% rename from django-stubs/http/__init__.pyi rename to typings/django/http/__init__.pyi diff --git a/django-stubs/http/cookie.pyi b/typings/django/http/cookie.pyi similarity index 100% rename from django-stubs/http/cookie.pyi rename to typings/django/http/cookie.pyi diff --git a/django-stubs/http/multipartparser.pyi b/typings/django/http/multipartparser.pyi similarity index 100% rename from django-stubs/http/multipartparser.pyi rename to typings/django/http/multipartparser.pyi diff --git a/django-stubs/http/request.pyi b/typings/django/http/request.pyi similarity index 100% rename from django-stubs/http/request.pyi rename to typings/django/http/request.pyi diff --git a/django-stubs/http/response.pyi b/typings/django/http/response.pyi similarity index 100% rename from django-stubs/http/response.pyi rename to typings/django/http/response.pyi diff --git a/django-stubs/middleware/__init__.pyi b/typings/django/middleware/__init__.pyi similarity index 100% rename from django-stubs/middleware/__init__.pyi rename to typings/django/middleware/__init__.pyi diff --git a/django-stubs/middleware/cache.pyi b/typings/django/middleware/cache.pyi similarity index 100% rename from django-stubs/middleware/cache.pyi rename to typings/django/middleware/cache.pyi diff --git a/django-stubs/middleware/clickjacking.pyi b/typings/django/middleware/clickjacking.pyi similarity index 100% rename from django-stubs/middleware/clickjacking.pyi rename to typings/django/middleware/clickjacking.pyi diff --git a/django-stubs/middleware/common.pyi b/typings/django/middleware/common.pyi similarity index 100% rename from django-stubs/middleware/common.pyi rename to typings/django/middleware/common.pyi diff --git a/django-stubs/middleware/csrf.pyi b/typings/django/middleware/csrf.pyi similarity index 100% rename from django-stubs/middleware/csrf.pyi rename to typings/django/middleware/csrf.pyi diff --git a/django-stubs/middleware/gzip.pyi b/typings/django/middleware/gzip.pyi similarity index 100% rename from django-stubs/middleware/gzip.pyi rename to typings/django/middleware/gzip.pyi diff --git a/django-stubs/middleware/http.pyi b/typings/django/middleware/http.pyi similarity index 100% rename from django-stubs/middleware/http.pyi rename to typings/django/middleware/http.pyi diff --git a/django-stubs/middleware/locale.pyi b/typings/django/middleware/locale.pyi similarity index 100% rename from django-stubs/middleware/locale.pyi rename to typings/django/middleware/locale.pyi diff --git a/django-stubs/middleware/security.pyi b/typings/django/middleware/security.pyi similarity index 100% rename from django-stubs/middleware/security.pyi rename to typings/django/middleware/security.pyi diff --git a/django-stubs/shortcuts.pyi b/typings/django/shortcuts.pyi similarity index 100% rename from django-stubs/shortcuts.pyi rename to typings/django/shortcuts.pyi diff --git a/django-stubs/template/__init__.pyi b/typings/django/template/__init__.pyi similarity index 100% rename from django-stubs/template/__init__.pyi rename to typings/django/template/__init__.pyi diff --git a/django-stubs/template/backends/__init__.pyi b/typings/django/template/backends/__init__.pyi similarity index 100% rename from django-stubs/template/backends/__init__.pyi rename to typings/django/template/backends/__init__.pyi diff --git a/django-stubs/template/backends/base.pyi b/typings/django/template/backends/base.pyi similarity index 100% rename from django-stubs/template/backends/base.pyi rename to typings/django/template/backends/base.pyi diff --git a/django-stubs/template/backends/django.pyi b/typings/django/template/backends/django.pyi similarity index 100% rename from django-stubs/template/backends/django.pyi rename to typings/django/template/backends/django.pyi diff --git a/django-stubs/template/backends/dummy.pyi b/typings/django/template/backends/dummy.pyi similarity index 100% rename from django-stubs/template/backends/dummy.pyi rename to typings/django/template/backends/dummy.pyi diff --git a/django-stubs/template/backends/jinja2.pyi b/typings/django/template/backends/jinja2.pyi similarity index 100% rename from django-stubs/template/backends/jinja2.pyi rename to typings/django/template/backends/jinja2.pyi diff --git a/django-stubs/template/backends/utils.pyi b/typings/django/template/backends/utils.pyi similarity index 100% rename from django-stubs/template/backends/utils.pyi rename to typings/django/template/backends/utils.pyi diff --git a/django-stubs/template/base.pyi b/typings/django/template/base.pyi similarity index 100% rename from django-stubs/template/base.pyi rename to typings/django/template/base.pyi diff --git a/django-stubs/template/context.pyi b/typings/django/template/context.pyi similarity index 100% rename from django-stubs/template/context.pyi rename to typings/django/template/context.pyi diff --git a/django-stubs/template/context_processors.pyi b/typings/django/template/context_processors.pyi similarity index 100% rename from django-stubs/template/context_processors.pyi rename to typings/django/template/context_processors.pyi diff --git a/django-stubs/template/defaultfilters.pyi b/typings/django/template/defaultfilters.pyi similarity index 100% rename from django-stubs/template/defaultfilters.pyi rename to typings/django/template/defaultfilters.pyi diff --git a/django-stubs/template/defaulttags.pyi b/typings/django/template/defaulttags.pyi similarity index 100% rename from django-stubs/template/defaulttags.pyi rename to typings/django/template/defaulttags.pyi diff --git a/django-stubs/template/engine.pyi b/typings/django/template/engine.pyi similarity index 100% rename from django-stubs/template/engine.pyi rename to typings/django/template/engine.pyi diff --git a/django-stubs/template/exceptions.pyi b/typings/django/template/exceptions.pyi similarity index 100% rename from django-stubs/template/exceptions.pyi rename to typings/django/template/exceptions.pyi diff --git a/django-stubs/template/library.pyi b/typings/django/template/library.pyi similarity index 100% rename from django-stubs/template/library.pyi rename to typings/django/template/library.pyi diff --git a/django-stubs/template/loader.pyi b/typings/django/template/loader.pyi similarity index 100% rename from django-stubs/template/loader.pyi rename to typings/django/template/loader.pyi diff --git a/django-stubs/template/loader_tags.pyi b/typings/django/template/loader_tags.pyi similarity index 100% rename from django-stubs/template/loader_tags.pyi rename to typings/django/template/loader_tags.pyi diff --git a/django-stubs/template/loaders/__init__.pyi b/typings/django/template/loaders/__init__.pyi similarity index 100% rename from django-stubs/template/loaders/__init__.pyi rename to typings/django/template/loaders/__init__.pyi diff --git a/django-stubs/template/loaders/app_directories.pyi b/typings/django/template/loaders/app_directories.pyi similarity index 100% rename from django-stubs/template/loaders/app_directories.pyi rename to typings/django/template/loaders/app_directories.pyi diff --git a/django-stubs/template/loaders/base.pyi b/typings/django/template/loaders/base.pyi similarity index 100% rename from django-stubs/template/loaders/base.pyi rename to typings/django/template/loaders/base.pyi diff --git a/django-stubs/template/loaders/cached.pyi b/typings/django/template/loaders/cached.pyi similarity index 100% rename from django-stubs/template/loaders/cached.pyi rename to typings/django/template/loaders/cached.pyi diff --git a/django-stubs/template/loaders/filesystem.pyi b/typings/django/template/loaders/filesystem.pyi similarity index 100% rename from django-stubs/template/loaders/filesystem.pyi rename to typings/django/template/loaders/filesystem.pyi diff --git a/django-stubs/template/loaders/locmem.pyi b/typings/django/template/loaders/locmem.pyi similarity index 100% rename from django-stubs/template/loaders/locmem.pyi rename to typings/django/template/loaders/locmem.pyi diff --git a/django-stubs/template/response.pyi b/typings/django/template/response.pyi similarity index 100% rename from django-stubs/template/response.pyi rename to typings/django/template/response.pyi diff --git a/django-stubs/template/smartif.pyi b/typings/django/template/smartif.pyi similarity index 100% rename from django-stubs/template/smartif.pyi rename to typings/django/template/smartif.pyi diff --git a/django-stubs/template/utils.pyi b/typings/django/template/utils.pyi similarity index 100% rename from django-stubs/template/utils.pyi rename to typings/django/template/utils.pyi diff --git a/django-stubs/templatetags/__init__.pyi b/typings/django/templatetags/__init__.pyi similarity index 100% rename from django-stubs/templatetags/__init__.pyi rename to typings/django/templatetags/__init__.pyi diff --git a/django-stubs/templatetags/cache.pyi b/typings/django/templatetags/cache.pyi similarity index 100% rename from django-stubs/templatetags/cache.pyi rename to typings/django/templatetags/cache.pyi diff --git a/django-stubs/templatetags/i18n.pyi b/typings/django/templatetags/i18n.pyi similarity index 100% rename from django-stubs/templatetags/i18n.pyi rename to typings/django/templatetags/i18n.pyi diff --git a/django-stubs/templatetags/l10n.pyi b/typings/django/templatetags/l10n.pyi similarity index 100% rename from django-stubs/templatetags/l10n.pyi rename to typings/django/templatetags/l10n.pyi diff --git a/django-stubs/templatetags/static.pyi b/typings/django/templatetags/static.pyi similarity index 100% rename from django-stubs/templatetags/static.pyi rename to typings/django/templatetags/static.pyi diff --git a/django-stubs/templatetags/tz.pyi b/typings/django/templatetags/tz.pyi similarity index 100% rename from django-stubs/templatetags/tz.pyi rename to typings/django/templatetags/tz.pyi diff --git a/django-stubs/test/__init__.pyi b/typings/django/test/__init__.pyi similarity index 100% rename from django-stubs/test/__init__.pyi rename to typings/django/test/__init__.pyi diff --git a/django-stubs/test/client.pyi b/typings/django/test/client.pyi similarity index 100% rename from django-stubs/test/client.pyi rename to typings/django/test/client.pyi diff --git a/django-stubs/test/html.pyi b/typings/django/test/html.pyi similarity index 100% rename from django-stubs/test/html.pyi rename to typings/django/test/html.pyi diff --git a/django-stubs/test/runner.pyi b/typings/django/test/runner.pyi similarity index 100% rename from django-stubs/test/runner.pyi rename to typings/django/test/runner.pyi diff --git a/django-stubs/test/selenium.pyi b/typings/django/test/selenium.pyi similarity index 100% rename from django-stubs/test/selenium.pyi rename to typings/django/test/selenium.pyi diff --git a/django-stubs/test/signals.pyi b/typings/django/test/signals.pyi similarity index 100% rename from django-stubs/test/signals.pyi rename to typings/django/test/signals.pyi diff --git a/django-stubs/test/testcases.pyi b/typings/django/test/testcases.pyi similarity index 100% rename from django-stubs/test/testcases.pyi rename to typings/django/test/testcases.pyi diff --git a/django-stubs/test/utils.pyi b/typings/django/test/utils.pyi similarity index 100% rename from django-stubs/test/utils.pyi rename to typings/django/test/utils.pyi diff --git a/django-stubs/urls/__init__.pyi b/typings/django/urls/__init__.pyi similarity index 100% rename from django-stubs/urls/__init__.pyi rename to typings/django/urls/__init__.pyi diff --git a/django-stubs/urls/base.pyi b/typings/django/urls/base.pyi similarity index 100% rename from django-stubs/urls/base.pyi rename to typings/django/urls/base.pyi diff --git a/django-stubs/urls/conf.pyi b/typings/django/urls/conf.pyi similarity index 100% rename from django-stubs/urls/conf.pyi rename to typings/django/urls/conf.pyi diff --git a/django-stubs/urls/converters.pyi b/typings/django/urls/converters.pyi similarity index 100% rename from django-stubs/urls/converters.pyi rename to typings/django/urls/converters.pyi diff --git a/django-stubs/urls/exceptions.pyi b/typings/django/urls/exceptions.pyi similarity index 100% rename from django-stubs/urls/exceptions.pyi rename to typings/django/urls/exceptions.pyi diff --git a/django-stubs/urls/resolvers.pyi b/typings/django/urls/resolvers.pyi similarity index 100% rename from django-stubs/urls/resolvers.pyi rename to typings/django/urls/resolvers.pyi diff --git a/django-stubs/urls/utils.pyi b/typings/django/urls/utils.pyi similarity index 100% rename from django-stubs/urls/utils.pyi rename to typings/django/urls/utils.pyi diff --git a/django-stubs/utils/__init__.pyi b/typings/django/utils/__init__.pyi similarity index 100% rename from django-stubs/utils/__init__.pyi rename to typings/django/utils/__init__.pyi diff --git a/django-stubs/utils/_os.pyi b/typings/django/utils/_os.pyi similarity index 100% rename from django-stubs/utils/_os.pyi rename to typings/django/utils/_os.pyi diff --git a/django-stubs/utils/archive.pyi b/typings/django/utils/archive.pyi similarity index 100% rename from django-stubs/utils/archive.pyi rename to typings/django/utils/archive.pyi diff --git a/django-stubs/utils/asyncio.pyi b/typings/django/utils/asyncio.pyi similarity index 100% rename from django-stubs/utils/asyncio.pyi rename to typings/django/utils/asyncio.pyi diff --git a/django-stubs/utils/autoreload.pyi b/typings/django/utils/autoreload.pyi similarity index 100% rename from django-stubs/utils/autoreload.pyi rename to typings/django/utils/autoreload.pyi diff --git a/django-stubs/utils/baseconv.pyi b/typings/django/utils/baseconv.pyi similarity index 100% rename from django-stubs/utils/baseconv.pyi rename to typings/django/utils/baseconv.pyi diff --git a/django-stubs/utils/cache.pyi b/typings/django/utils/cache.pyi similarity index 100% rename from django-stubs/utils/cache.pyi rename to typings/django/utils/cache.pyi diff --git a/django-stubs/utils/crypto.pyi b/typings/django/utils/crypto.pyi similarity index 100% rename from django-stubs/utils/crypto.pyi rename to typings/django/utils/crypto.pyi diff --git a/django-stubs/utils/datastructures.pyi b/typings/django/utils/datastructures.pyi similarity index 100% rename from django-stubs/utils/datastructures.pyi rename to typings/django/utils/datastructures.pyi diff --git a/django-stubs/utils/dateformat.pyi b/typings/django/utils/dateformat.pyi similarity index 100% rename from django-stubs/utils/dateformat.pyi rename to typings/django/utils/dateformat.pyi diff --git a/django-stubs/utils/dateparse.pyi b/typings/django/utils/dateparse.pyi similarity index 100% rename from django-stubs/utils/dateparse.pyi rename to typings/django/utils/dateparse.pyi diff --git a/django-stubs/utils/dates.pyi b/typings/django/utils/dates.pyi similarity index 100% rename from django-stubs/utils/dates.pyi rename to typings/django/utils/dates.pyi diff --git a/django-stubs/utils/datetime_safe.pyi b/typings/django/utils/datetime_safe.pyi similarity index 100% rename from django-stubs/utils/datetime_safe.pyi rename to typings/django/utils/datetime_safe.pyi diff --git a/django-stubs/utils/deconstruct.pyi b/typings/django/utils/deconstruct.pyi similarity index 100% rename from django-stubs/utils/deconstruct.pyi rename to typings/django/utils/deconstruct.pyi diff --git a/django-stubs/utils/decorators.pyi b/typings/django/utils/decorators.pyi similarity index 100% rename from django-stubs/utils/decorators.pyi rename to typings/django/utils/decorators.pyi diff --git a/django-stubs/utils/deprecation.pyi b/typings/django/utils/deprecation.pyi similarity index 100% rename from django-stubs/utils/deprecation.pyi rename to typings/django/utils/deprecation.pyi diff --git a/django-stubs/utils/duration.pyi b/typings/django/utils/duration.pyi similarity index 100% rename from django-stubs/utils/duration.pyi rename to typings/django/utils/duration.pyi diff --git a/django-stubs/utils/encoding.pyi b/typings/django/utils/encoding.pyi similarity index 100% rename from django-stubs/utils/encoding.pyi rename to typings/django/utils/encoding.pyi diff --git a/django-stubs/utils/feedgenerator.pyi b/typings/django/utils/feedgenerator.pyi similarity index 100% rename from django-stubs/utils/feedgenerator.pyi rename to typings/django/utils/feedgenerator.pyi diff --git a/django-stubs/utils/formats.pyi b/typings/django/utils/formats.pyi similarity index 100% rename from django-stubs/utils/formats.pyi rename to typings/django/utils/formats.pyi diff --git a/django-stubs/utils/functional.pyi b/typings/django/utils/functional.pyi similarity index 100% rename from django-stubs/utils/functional.pyi rename to typings/django/utils/functional.pyi diff --git a/django-stubs/utils/hashable.pyi b/typings/django/utils/hashable.pyi similarity index 100% rename from django-stubs/utils/hashable.pyi rename to typings/django/utils/hashable.pyi diff --git a/django-stubs/utils/html.pyi b/typings/django/utils/html.pyi similarity index 100% rename from django-stubs/utils/html.pyi rename to typings/django/utils/html.pyi diff --git a/django-stubs/utils/http.pyi b/typings/django/utils/http.pyi similarity index 100% rename from django-stubs/utils/http.pyi rename to typings/django/utils/http.pyi diff --git a/django-stubs/utils/inspect.pyi b/typings/django/utils/inspect.pyi similarity index 100% rename from django-stubs/utils/inspect.pyi rename to typings/django/utils/inspect.pyi diff --git a/django-stubs/utils/ipv6.pyi b/typings/django/utils/ipv6.pyi similarity index 100% rename from django-stubs/utils/ipv6.pyi rename to typings/django/utils/ipv6.pyi diff --git a/django-stubs/utils/itercompat.pyi b/typings/django/utils/itercompat.pyi similarity index 100% rename from django-stubs/utils/itercompat.pyi rename to typings/django/utils/itercompat.pyi diff --git a/django-stubs/utils/jslex.pyi b/typings/django/utils/jslex.pyi similarity index 100% rename from django-stubs/utils/jslex.pyi rename to typings/django/utils/jslex.pyi diff --git a/django-stubs/utils/log.pyi b/typings/django/utils/log.pyi similarity index 100% rename from django-stubs/utils/log.pyi rename to typings/django/utils/log.pyi diff --git a/django-stubs/utils/lorem_ipsum.pyi b/typings/django/utils/lorem_ipsum.pyi similarity index 100% rename from django-stubs/utils/lorem_ipsum.pyi rename to typings/django/utils/lorem_ipsum.pyi diff --git a/django-stubs/utils/module_loading.pyi b/typings/django/utils/module_loading.pyi similarity index 100% rename from django-stubs/utils/module_loading.pyi rename to typings/django/utils/module_loading.pyi diff --git a/django-stubs/utils/numberformat.pyi b/typings/django/utils/numberformat.pyi similarity index 100% rename from django-stubs/utils/numberformat.pyi rename to typings/django/utils/numberformat.pyi diff --git a/django-stubs/utils/regex_helper.pyi b/typings/django/utils/regex_helper.pyi similarity index 100% rename from django-stubs/utils/regex_helper.pyi rename to typings/django/utils/regex_helper.pyi diff --git a/django-stubs/utils/safestring.pyi b/typings/django/utils/safestring.pyi similarity index 100% rename from django-stubs/utils/safestring.pyi rename to typings/django/utils/safestring.pyi diff --git a/django-stubs/utils/six.pyi b/typings/django/utils/six.pyi similarity index 100% rename from django-stubs/utils/six.pyi rename to typings/django/utils/six.pyi diff --git a/django-stubs/utils/termcolors.pyi b/typings/django/utils/termcolors.pyi similarity index 100% rename from django-stubs/utils/termcolors.pyi rename to typings/django/utils/termcolors.pyi diff --git a/django-stubs/utils/text.pyi b/typings/django/utils/text.pyi similarity index 100% rename from django-stubs/utils/text.pyi rename to typings/django/utils/text.pyi diff --git a/django-stubs/utils/timesince.pyi b/typings/django/utils/timesince.pyi similarity index 100% rename from django-stubs/utils/timesince.pyi rename to typings/django/utils/timesince.pyi diff --git a/django-stubs/utils/timezone.pyi b/typings/django/utils/timezone.pyi similarity index 100% rename from django-stubs/utils/timezone.pyi rename to typings/django/utils/timezone.pyi diff --git a/django-stubs/utils/topological_sort.pyi b/typings/django/utils/topological_sort.pyi similarity index 100% rename from django-stubs/utils/topological_sort.pyi rename to typings/django/utils/topological_sort.pyi diff --git a/django-stubs/utils/translation/__init__.pyi b/typings/django/utils/translation/__init__.pyi similarity index 100% rename from django-stubs/utils/translation/__init__.pyi rename to typings/django/utils/translation/__init__.pyi diff --git a/django-stubs/utils/translation/reloader.pyi b/typings/django/utils/translation/reloader.pyi similarity index 100% rename from django-stubs/utils/translation/reloader.pyi rename to typings/django/utils/translation/reloader.pyi diff --git a/django-stubs/utils/translation/template.pyi b/typings/django/utils/translation/template.pyi similarity index 100% rename from django-stubs/utils/translation/template.pyi rename to typings/django/utils/translation/template.pyi diff --git a/django-stubs/utils/translation/trans_null.pyi b/typings/django/utils/translation/trans_null.pyi similarity index 100% rename from django-stubs/utils/translation/trans_null.pyi rename to typings/django/utils/translation/trans_null.pyi diff --git a/django-stubs/utils/translation/trans_real.pyi b/typings/django/utils/translation/trans_real.pyi similarity index 100% rename from django-stubs/utils/translation/trans_real.pyi rename to typings/django/utils/translation/trans_real.pyi diff --git a/django-stubs/utils/tree.pyi b/typings/django/utils/tree.pyi similarity index 100% rename from django-stubs/utils/tree.pyi rename to typings/django/utils/tree.pyi diff --git a/django-stubs/utils/version.pyi b/typings/django/utils/version.pyi similarity index 100% rename from django-stubs/utils/version.pyi rename to typings/django/utils/version.pyi diff --git a/django-stubs/utils/xmlutils.pyi b/typings/django/utils/xmlutils.pyi similarity index 100% rename from django-stubs/utils/xmlutils.pyi rename to typings/django/utils/xmlutils.pyi diff --git a/django-stubs/views/__init__.pyi b/typings/django/views/__init__.pyi similarity index 100% rename from django-stubs/views/__init__.pyi rename to typings/django/views/__init__.pyi diff --git a/django-stubs/views/csrf.pyi b/typings/django/views/csrf.pyi similarity index 100% rename from django-stubs/views/csrf.pyi rename to typings/django/views/csrf.pyi diff --git a/django-stubs/views/debug.pyi b/typings/django/views/debug.pyi similarity index 100% rename from django-stubs/views/debug.pyi rename to typings/django/views/debug.pyi diff --git a/django-stubs/views/decorators/__init__.pyi b/typings/django/views/decorators/__init__.pyi similarity index 100% rename from django-stubs/views/decorators/__init__.pyi rename to typings/django/views/decorators/__init__.pyi diff --git a/django-stubs/views/decorators/cache.pyi b/typings/django/views/decorators/cache.pyi similarity index 100% rename from django-stubs/views/decorators/cache.pyi rename to typings/django/views/decorators/cache.pyi diff --git a/django-stubs/views/decorators/clickjacking.pyi b/typings/django/views/decorators/clickjacking.pyi similarity index 100% rename from django-stubs/views/decorators/clickjacking.pyi rename to typings/django/views/decorators/clickjacking.pyi diff --git a/django-stubs/views/decorators/csrf.pyi b/typings/django/views/decorators/csrf.pyi similarity index 100% rename from django-stubs/views/decorators/csrf.pyi rename to typings/django/views/decorators/csrf.pyi diff --git a/django-stubs/views/decorators/debug.pyi b/typings/django/views/decorators/debug.pyi similarity index 100% rename from django-stubs/views/decorators/debug.pyi rename to typings/django/views/decorators/debug.pyi diff --git a/django-stubs/views/decorators/gzip.pyi b/typings/django/views/decorators/gzip.pyi similarity index 100% rename from django-stubs/views/decorators/gzip.pyi rename to typings/django/views/decorators/gzip.pyi diff --git a/django-stubs/views/decorators/http.pyi b/typings/django/views/decorators/http.pyi similarity index 100% rename from django-stubs/views/decorators/http.pyi rename to typings/django/views/decorators/http.pyi diff --git a/django-stubs/views/decorators/vary.pyi b/typings/django/views/decorators/vary.pyi similarity index 100% rename from django-stubs/views/decorators/vary.pyi rename to typings/django/views/decorators/vary.pyi diff --git a/django-stubs/views/defaults.pyi b/typings/django/views/defaults.pyi similarity index 100% rename from django-stubs/views/defaults.pyi rename to typings/django/views/defaults.pyi diff --git a/django-stubs/views/generic/__init__.pyi b/typings/django/views/generic/__init__.pyi similarity index 100% rename from django-stubs/views/generic/__init__.pyi rename to typings/django/views/generic/__init__.pyi diff --git a/django-stubs/views/generic/base.pyi b/typings/django/views/generic/base.pyi similarity index 100% rename from django-stubs/views/generic/base.pyi rename to typings/django/views/generic/base.pyi diff --git a/django-stubs/views/generic/dates.pyi b/typings/django/views/generic/dates.pyi similarity index 100% rename from django-stubs/views/generic/dates.pyi rename to typings/django/views/generic/dates.pyi diff --git a/django-stubs/views/generic/detail.pyi b/typings/django/views/generic/detail.pyi similarity index 100% rename from django-stubs/views/generic/detail.pyi rename to typings/django/views/generic/detail.pyi diff --git a/django-stubs/views/generic/edit.pyi b/typings/django/views/generic/edit.pyi similarity index 100% rename from django-stubs/views/generic/edit.pyi rename to typings/django/views/generic/edit.pyi diff --git a/django-stubs/views/generic/list.pyi b/typings/django/views/generic/list.pyi similarity index 100% rename from django-stubs/views/generic/list.pyi rename to typings/django/views/generic/list.pyi diff --git a/django-stubs/views/i18n.pyi b/typings/django/views/i18n.pyi similarity index 100% rename from django-stubs/views/i18n.pyi rename to typings/django/views/i18n.pyi diff --git a/django-stubs/views/static.pyi b/typings/django/views/static.pyi similarity index 100% rename from django-stubs/views/static.pyi rename to typings/django/views/static.pyi diff --git a/psycopg2-stubs/__init__.pyi b/typings/psycopg2/__init__.pyi similarity index 100% rename from psycopg2-stubs/__init__.pyi rename to typings/psycopg2/__init__.pyi diff --git a/psycopg2-stubs/_range.pyi b/typings/psycopg2/_range.pyi similarity index 100% rename from psycopg2-stubs/_range.pyi rename to typings/psycopg2/_range.pyi diff --git a/psycopg2-stubs/errors.pyi b/typings/psycopg2/errors.pyi similarity index 100% rename from psycopg2-stubs/errors.pyi rename to typings/psycopg2/errors.pyi diff --git a/psycopg2-stubs/extensions.pyi b/typings/psycopg2/extensions.pyi similarity index 100% rename from psycopg2-stubs/extensions.pyi rename to typings/psycopg2/extensions.pyi diff --git a/psycopg2-stubs/extras.pyi b/typings/psycopg2/extras.pyi similarity index 100% rename from psycopg2-stubs/extras.pyi rename to typings/psycopg2/extras.pyi diff --git a/psycopg2-stubs/tz.pyi b/typings/psycopg2/tz.pyi similarity index 100% rename from psycopg2-stubs/tz.pyi rename to typings/psycopg2/tz.pyi From 2e6944e7759be2f20bd3734c64ceb9946491cc86 Mon Sep 17 00:00:00 2001 From: Steve Dignam Date: Fri, 26 Feb 2021 09:28:44 -0500 Subject: [PATCH 25/88] release: 0.4.0 --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index b3a1430fe..d2646974b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "django-types" -version = "0.3.1" +version = "0.4.0" description = "Type stubs for Django" repository = "https://github.com/sbdchd/django-types" readme = "README.md" From d59e8905eb54bd7913db9e2ab2b8d41e61d74929 Mon Sep 17 00:00:00 2001 From: Steve Dignam Date: Fri, 26 Feb 2021 13:57:13 -0500 Subject: [PATCH 26/88] remove: python 3.7 requirement Poetry defaults to the system version, 3.7 in this case, which was preventing users of 3.6 from installing the package. --- poetry.lock | 216 ++++++++----------------------------------------- pyproject.toml | 5 +- s/lint | 4 - setup.py | 7 -- 4 files changed, 37 insertions(+), 195 deletions(-) delete mode 100644 setup.py diff --git a/poetry.lock b/poetry.lock index 81a66b9e6..bd7012ab0 100644 --- a/poetry.lock +++ b/poetry.lock @@ -6,15 +6,6 @@ optional = false python-versions = "*" version = "1.4.4" -[[package]] -category = "dev" -description = "Disable App Nap on macOS >= 10.9" -marker = "sys_platform == \"darwin\"" -name = "appnope" -optional = false -python-versions = "*" -version = "0.1.2" - [[package]] category = "dev" description = "ASGI specs, helper code, and adapters" @@ -40,14 +31,6 @@ optional = false python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" version = "20.3.0" -[[package]] -category = "dev" -description = "Specifications for callback functions passed in to an API" -name = "backcall" -optional = false -python-versions = "*" -version = "0.2.0" - [[package]] category = "dev" description = "The uncompromising code formatter." @@ -66,6 +49,10 @@ toml = ">=0.10.1" typed-ast = ">=1.4.0" typing-extensions = ">=3.7.4" +[package.dependencies.dataclasses] +python = "<3.7" +version = ">=0.6" + [[package]] category = "dev" description = "Composable command line interface toolkit" @@ -85,11 +72,12 @@ version = "0.4.4" [[package]] category = "dev" -description = "Decorators for Humans" -name = "decorator" +description = "A backport of the dataclasses module for Python 3.6" +marker = "python_version < \"3.7\"" +name = "dataclasses" optional = false -python-versions = ">=2.6, !=3.0.*, !=3.1.*" -version = "4.4.2" +python-versions = "*" +version = "0.6" [[package]] category = "dev" @@ -97,7 +85,7 @@ description = "A high-level Python Web framework that encourages rapid developme name = "django" optional = false python-versions = ">=3.6" -version = "3.1.3" +version = "3.1.7" [package.dependencies] asgiref = ">=3.2.10,<4" @@ -128,11 +116,15 @@ marker = "python_version < \"3.8\"" name = "importlib-metadata" optional = false python-versions = ">=3.6" -version = "3.1.0" +version = "3.7.0" [package.dependencies] zipp = ">=0.5" +[package.dependencies.typing-extensions] +python = "<3.8" +version = ">=3.6.4" + [[package]] category = "dev" description = "iniconfig: brain-dead simple config-ini parsing" @@ -141,53 +133,13 @@ optional = false python-versions = "*" version = "1.1.1" -[[package]] -category = "dev" -description = "IPython: Productive Interactive Computing" -name = "ipython" -optional = false -python-versions = ">=3.7" -version = "7.19.0" - -[package.dependencies] -appnope = "*" -backcall = "*" -colorama = "*" -decorator = "*" -jedi = ">=0.10" -pexpect = ">4.3" -pickleshare = "*" -prompt-toolkit = ">=2.0.0,<3.0.0 || >3.0.0,<3.0.1 || >3.0.1,<3.1.0" -pygments = "*" -setuptools = ">=18.5" -traitlets = ">=4.2" - -[[package]] -category = "dev" -description = "Vestigial utilities from IPython" -name = "ipython-genutils" -optional = false -python-versions = "*" -version = "0.2.0" - [[package]] category = "dev" description = "A Python utility / library to sort Python imports." name = "isort" optional = false python-versions = ">=3.6,<4.0" -version = "5.6.4" - -[[package]] -category = "dev" -description = "An autocompletion tool for Python that can be used for text editors." -name = "jedi" -optional = false -python-versions = ">=3.6" -version = "0.18.0" - -[package.dependencies] -parso = ">=0.8.0,<0.9.0" +version = "5.7.0" [[package]] category = "dev" @@ -224,19 +176,10 @@ description = "Core utilities for Python packages" name = "packaging" optional = false python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" -version = "20.4" +version = "20.9" [package.dependencies] pyparsing = ">=2.0.2" -six = "*" - -[[package]] -category = "dev" -description = "A Python Parser" -name = "parso" -optional = false -python-versions = ">=3.6" -version = "0.8.1" [[package]] category = "dev" @@ -246,26 +189,6 @@ optional = false python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*" version = "0.8.1" -[[package]] -category = "dev" -description = "Pexpect allows easy control of interactive console applications." -marker = "sys_platform != \"win32\"" -name = "pexpect" -optional = false -python-versions = "*" -version = "4.8.0" - -[package.dependencies] -ptyprocess = ">=0.5" - -[[package]] -category = "dev" -description = "Tiny 'shelve'-like database with concurrency support" -name = "pickleshare" -optional = false -python-versions = "*" -version = "0.7.5" - [[package]] category = "dev" description = "plugin and hook calling mechanisms for python" @@ -279,17 +202,6 @@ version = "0.13.1" python = "<3.8" version = ">=0.12" -[[package]] -category = "dev" -description = "Library for building powerful interactive command lines in Python" -name = "prompt-toolkit" -optional = false -python-versions = ">=3.6.1" -version = "3.0.10" - -[package.dependencies] -wcwidth = "*" - [[package]] category = "dev" description = "psycopg2 - Python-PostgreSQL Database Adapter" @@ -298,22 +210,13 @@ optional = false python-versions = ">=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*" version = "2.8.6" -[[package]] -category = "dev" -description = "Run a subprocess in a pseudo terminal" -marker = "sys_platform != \"win32\"" -name = "ptyprocess" -optional = false -python-versions = "*" -version = "0.7.0" - [[package]] category = "dev" description = "library with cross-python path, ini-parsing, io, code, log facilities" name = "py" optional = false python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" -version = "1.9.0" +version = "1.10.0" [[package]] category = "dev" @@ -331,14 +234,6 @@ optional = false python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" version = "2.2.0" -[[package]] -category = "dev" -description = "Pygments is a syntax highlighting package written in Python." -name = "pygments" -optional = false -python-versions = ">=3.5" -version = "2.7.4" - [[package]] category = "dev" description = "Python parsing module" @@ -352,16 +247,16 @@ category = "dev" description = "pytest: simple powerful testing with Python" name = "pytest" optional = false -python-versions = ">=3.5" -version = "6.1.2" +python-versions = ">=3.6" +version = "6.2.2" [package.dependencies] atomicwrites = ">=1.0" -attrs = ">=17.4.0" +attrs = ">=19.2.0" colorama = "*" iniconfig = "*" packaging = "*" -pluggy = ">=0.12,<1.0" +pluggy = ">=0.12,<1.0.0a1" py = ">=1.8.2" toml = "*" @@ -375,7 +270,7 @@ description = "World timezone definitions, modern and historical" name = "pytz" optional = false python-versions = "*" -version = "2020.4" +version = "2021.1" [[package]] category = "dev" @@ -385,14 +280,6 @@ optional = false python-versions = "*" version = "2020.11.13" -[[package]] -category = "dev" -description = "Python 2 and 3 compatibility utilities" -name = "six" -optional = false -python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*" -version = "1.15.0" - [[package]] category = "dev" description = "A non-validating SQL parser." @@ -409,24 +296,13 @@ optional = false python-versions = ">=2.6, !=3.0.*, !=3.1.*, !=3.2.*" version = "0.10.2" -[[package]] -category = "dev" -description = "Traitlets Python configuration system" -name = "traitlets" -optional = false -python-versions = ">=3.7" -version = "5.0.5" - -[package.dependencies] -ipython-genutils = "*" - [[package]] category = "dev" description = "a fork of Python 2 and 3 ast modules with type comment support" name = "typed-ast" optional = false python-versions = "*" -version = "1.4.1" +version = "1.4.2" [[package]] category = "dev" @@ -436,14 +312,6 @@ optional = false python-versions = "*" version = "3.7.4.3" -[[package]] -category = "dev" -description = "Measures the displayed width of unicode strings in a terminal" -name = "wcwidth" -optional = false -python-versions = "*" -version = "0.2.5" - [[package]] category = "dev" description = "A built-package format for Python" @@ -462,54 +330,40 @@ python-versions = ">=3.6" version = "3.4.0" [metadata] -content-hash = "224d1d4c83164b64970e2452293d49093f85bac1db146e7d1a96904adc3716ca" -python-versions = "^3.7" +content-hash = "d4c8eca4a94453f47d26912db391e4adbb6232083830159cdc4192034128925b" +python-versions = "^3.6" [metadata.hashes] appdirs = ["7d5d0167b2b1ba821647616af46a749d1c653740dd0d2415100fe26e27afdf41", "a841dacd6b99318a741b166adb07e19ee71a274450e68237b4650ca1055ab128"] -appnope = ["93aa393e9d6c54c5cd570ccadd8edad61ea0c4b9ea7a01409020c9aa019eb442", "dd83cd4b5b460958838f6eb3000c660b1f9caf2a5b1de4264e941512f603258a"] asgiref = ["5ee950735509d04eb673bd7f7120f8fa1c9e2df495394992c73234d526907e17", "7162a3cb30ab0609f1a4c95938fd73e8604f63bdba516a7f7d64b83ff09478f0"] atomicwrites = ["6d1784dea7c0c8d4a5172b6c620f40b6e4cbfdf96d783691f2e1302a7b88e197", "ae70396ad1a434f9c7046fd2dd196fc04b12f9e91ffb859164193be8b6168a7a"] attrs = ["31b2eced602aa8423c2aea9c76a724617ed67cf9513173fd3a4f03e3a929c7e6", "832aa3cde19744e49938b91fea06d69ecb9e649c93ba974535d08ad92164f700"] -backcall = ["5cbdbf27be5e7cfadb448baf0aa95508f91f2bbc6c6437cd9cd06e2a4c215e1e", "fbbce6a29f263178a1f7915c1940bde0ec2b2a967566fe1c65c1dfb7422bd255"] black = ["1c02557aa099101b9d21496f8a914e9ed2222ef70336404eeeac8edba836fbea"] click = ["d2b5255c7c6349bc1bd1e59e08cd12acbbd63ce649f2588755783aa94dfb6b1a", "dacca89f4bfadd5de3d7489b7c8a566eee0d3676333fbb50030263894c38c0dc"] colorama = ["5941b2b48a20143d2267e95b1c2a7603ce057ee39fd88e7329b0c292aa16869b", "9f47eda37229f68eee03b24b9748937c7dc3868f906e8ba69fbcbdd3bc5dc3e2"] -decorator = ["41fa54c2a0cc4ba648be4fd43cff00aedf5b9465c9bf18d64325bc225f08f760", "e3a62f0520172440ca0dcc823749319382e377f37f140a0b99ef45fecb84bfe7"] -django = ["14a4b7cd77297fba516fc0d92444cc2e2e388aa9de32d7a68d4a83d58f5a4927", "14b87775ffedab2ef6299b73343d1b4b41e5d4e2aa58c6581f114dbec01e3f8f"] +dataclasses = ["454a69d788c7fda44efd71e259be79577822f5e3f53f029a22d08004e951dc9f", "6988bd2b895eef432d562370bb707d540f32f7360ab13da45340101bc2307d84"] +django = ["32ce792ee9b6a0cbbec340123e229ac9f765dff8c2a4ae9247a14b2ba3a365a7", "baf099db36ad31f970775d0be5587cc58a6256a6771a44eb795b554d45f211b8"] flake8 = ["749dbbd6bfd0cf1318af27bf97a14e28e5ff548ef8e5b1566ccfb25a11e7c839", "aadae8761ec651813c24be05c6f7b4680857ef6afaae4651a4eccaef97ce6c3b"] -importlib-metadata = ["590690d61efdd716ff82c39ca9a9d4209252adfe288a4b5721181050acbd4175", "d9b8a46a0885337627a6430db287176970fff18ad421becec1d64cfc763c2099"] +importlib-metadata = ["24499ffde1b80be08284100393955842be4a59c7c16bbf2738aad0e464a8e0aa", "c6af5dbf1126cd959c4a8d8efd61d4d3c83bddb0459a17e554284a077574b614"] iniconfig = ["011e24c64b7f47f6ebd835bb12a743f2fbe9a26d4cecaa7f53bc4f35ee9da8b3", "bc3af051d7d14b2ee5ef9969666def0cd1a000e121eaea580d4a313df4b37f32"] -ipython = ["c987e8178ced651532b3b1ff9965925bfd445c279239697052561a9ab806d28f", "cbb2ef3d5961d44e6a963b9817d4ea4e1fa2eb589c371a470fed14d8d40cbd6a"] -ipython-genutils = ["72dd37233799e619666c9f639a9da83c34013a73e8bbc79a7a6348d93c61fab8", "eb2e116e75ecef9d4d228fdc66af54269afa26ab4463042e33785b887c628ba8"] -isort = ["dcab1d98b469a12a1a624ead220584391648790275560e1a43e54c5dceae65e7", "dcaeec1b5f0eca77faea2a35ab790b4f3680ff75590bfcb7145986905aab2f58"] -jedi = ["18456d83f65f400ab0c2d3319e48520420ef43b23a086fdc05dff34132f0fb93", "92550a404bad8afed881a137ec9a461fed49eca661414be45059329614ed0707"] +isort = ["c729845434366216d320e936b8ad6f9d681aab72dc7cbc2d51bedc3582f3ad1e", "fff4f0c04e1825522ce6949973e83110a6e907750cd92d128b0d14aaaadbffdc"] mccabe = ["ab8a6258860da4b6677da4bd2fe5dc2c659cff31b3ee4f7f5d64e79735b80d42", "dd8d182285a0fe56bace7f45b5e7d1a6ebcbf524e8f3bd87eb0f125271b8831f"] mypy = ["0a0d102247c16ce93c97066443d11e2d36e6cc2a32d8ccc1f705268970479324", "0d34d6b122597d48a36d6c59e35341f410d4abfa771d96d04ae2c468dd201abc", "2170492030f6faa537647d29945786d297e4862765f0b4ac5930ff62e300d802", "2842d4fbd1b12ab422346376aad03ff5d0805b706102e475e962370f874a5122", "2b21ba45ad9ef2e2eb88ce4aeadd0112d0f5026418324176fd494a6824b74975", "72060bf64f290fb629bd4a67c707a66fd88ca26e413a91384b18db3876e57ed7", "af4e9ff1834e565f1baa74ccf7ae2564ae38c8df2a85b057af1dbbc958eb6666", "bd03b3cf666bff8d710d633d1c56ab7facbdc204d567715cb3b9f85c6e94f669", "c614194e01c85bb2e551c421397e49afb2872c88b5830e3554f0519f9fb1c178", "cf4e7bf7f1214826cf7333627cb2547c0db7e3078723227820d0a2490f117a01", "da56dedcd7cd502ccd3c5dddc656cb36113dd793ad466e894574125945653cea", "e86bdace26c5fe9cf8cb735e7cedfe7850ad92b327ac5d797c656717d2ca66de", "e97e9c13d67fbe524be17e4d8025d51a7dca38f90de2e462243ab8ed8a9178d1", "eea260feb1830a627fb526d22fbb426b750d9f5a47b624e8d5e7e004359b219c"] mypy-extensions = ["090fedd75945a69ae91ce1303b5824f428daf5a028d2f6ab8a299250a846f15d", "2d82818f5bb3e369420cb3c4060a7970edba416647068eb4c5343488a6c604a8"] -packaging = ["4357f74f47b9c12db93624a82154e9b120fa8293699949152b22065d556079f8", "998416ba6962ae7fbd6596850b80e17859a5753ba17c32284f67bfff33784181"] -parso = ["15b00182f472319383252c18d5913b69269590616c947747bc50bf4ac768f410", "8519430ad07087d4c997fda3a7918f7cfa27cb58972a8c89c2a0295a1c940e9e"] +packaging = ["5b327ac1320dc863dca72f4514ecc086f31186744b84a230374cc1fd776feae5", "67714da7f7bc052e064859c05c595155bd1ee9f69f76557e21f051443c20947a"] pathspec = ["86379d6b86d75816baba717e64b1a3a3469deb93bb76d613c9ce79edc5cb68fd", "aa0cb481c4041bf52ffa7b0d8fa6cd3e88a2ca4879c533c9153882ee2556790d"] -pexpect = ["0b48a55dcb3c05f3329815901ea4fc1537514d6ba867a152b581d69ae3710937", "fc65a43959d153d0114afe13997d439c22823a27cefceb5ff35c2178c6784c0c"] -pickleshare = ["87683d47965c1da65cdacaf31c8441d12b8044cdec9aca500cd78fc2c683afca", "9649af414d74d4df115d5d718f82acb59c9d418196b7b4290ed47a12ce62df56"] pluggy = ["15b2acde666561e1298d71b523007ed7364de07029219b604cf808bfa1c765b0", "966c145cd83c96502c3c3868f50408687b38434af77734af1e9ca461a4081d2d"] -prompt-toolkit = ["ac329c69bd8564cb491940511957312c7b8959bb5b3cf3582b406068a51d5bb7", "b8b3d0bde65da350290c46a8f54f336b3cbf5464a4ac11239668d986852e79d5"] psycopg2 = ["00195b5f6832dbf2876b8bf77f12bdce648224c89c880719c745b90515233301", "068115e13c70dc5982dfc00c5d70437fe37c014c808acce119b5448361c03725", "26e7fd115a6db75267b325de0fba089b911a4a12ebd3d0b5e7acb7028bc46821", "56007a226b8e95aa980ada7abdea6b40b75ce62a433bd27cec7a8178d57f4051", "56fee7f818d032f802b8eed81ef0c1232b8b42390df189cab9cfa87573fe52c5", "6a3d9efb6f36f1fe6aa8dbb5af55e067db802502c55a9defa47c5a1dad41df84", "a49833abfdede8985ba3f3ec641f771cca215479f41523e99dace96d5b8cce2a", "ad2fe8a37be669082e61fb001c185ffb58867fdbb3e7a6b0b0d2ffe232353a3e", "b8cae8b2f022efa1f011cc753adb9cbadfa5a184431d09b273fb49b4167561ad", "d160744652e81c80627a909a0e808f3c6653a40af435744de037e3172cf277f5", "f22ea9b67aea4f4a1718300908a2fb62b3e4276cf00bd829a97ab5894af42ea3", "f974c96fca34ae9e4f49839ba6b78addf0346777b46c4da27a7bf54f48d3057d", "fb23f6c71107c37fd667cb4ea363ddeb936b348bbd6449278eb92c189699f543"] -ptyprocess = ["4b41f3967fce3af57cc7e94b888626c18bf37a083e3651ca8feeb66d492fef35", "5c5d0a3b48ceee0b48485e0c26037c0acd7d29765ca3fbb5cb3831d347423220"] -py = ["366389d1db726cd2fcfc79732e75410e5fe4d31db13692115529d34069a043c2", "9ca6883ce56b4e8da7e79ac18787889fa5206c79dcc67fb065376cd2fe03f342"] +py = ["21b81bda15b66ef5e1a777a21c4dcd9c20ad3efd0b3f817e7a809035269e1bd3", "3b80836aa6d1feeaa108e046da6423ab8f6ceda6468545ae8d02d9d58d18818a"] pycodestyle = ["2295e7b2f6b5bd100585ebcb1f616591b652db8a741695b3d8f5d28bdc934367", "c58a7d2815e0e8d7972bf1803331fb0152f867bd89adf8a01dfd55085434192e"] pyflakes = ["0d94e0e05a19e57a99444b6ddcf9a6eb2e5c68d3ca1e98e90707af8152c90a92", "35b2d75ee967ea93b55750aa9edbbf72813e06a66ba54438df2cfac9e3c27fc8"] -pygments = ["bc9591213a8f0e0ca1a5e68a479b4887fdc3e75d0774e5c71c31920c427de435", "df49d09b498e83c1a73128295860250b0b7edd4c723a32e9bc0d295c7c2ec337"] pyparsing = ["c203ec8783bf771a155b207279b9bccb8dea02d8f0c9e5f8ead507bc3246ecc1", "ef9d7589ef3c200abe66653d3f1ab1033c3c419ae9b9bdb1240a85b024efc88b"] -pytest = ["4288fed0d9153d9646bfcdf0c0428197dba1ecb27a33bb6e031d002fa88653fe", "c0a7e94a8cdbc5422a51ccdad8e6f1024795939cc89159a0ae7f0b316ad3823e"] -pytz = ["3e6b7dd2d1e0a59084bcee14a17af60c5c562cdc16d828e8eba2e683d3a7e268", "5c55e189b682d420be27c6995ba6edce0c0a77dd67bfbe2ae6607134d5851ffd"] +pytest = ["9d1edf9e7d0b84d72ea3dbcdfd22b35fb543a5e8f2a60092dd578936bf63d7f9", "b574b57423e818210672e07ca1fa90aaf194a4f63f3ab909a2c67ebb22913839"] +pytz = ["83a4a90894bf38e243cf052c8b58f381bfe9a7a483f6a9cab140bc7f702ac4da", "eb10ce3e7736052ed3623d49975ce333bcd712c7bb19a58b9e2089d4057d0798"] regex = ["02951b7dacb123d8ea6da44fe45ddd084aa6777d4b2454fa0da61d569c6fa538", "0d08e71e70c0237883d0bef12cad5145b84c3705e9c6a588b2a9c7080e5af2a4", "1862a9d9194fae76a7aaf0150d5f2a8ec1da89e8b55890b1786b8f88a0f619dc", "1ab79fcb02b930de09c76d024d279686ec5d532eb814fd0ed1e0051eb8bd2daa", "1fa7ee9c2a0e30405e21031d07d7ba8617bc590d391adfc2b7f1e8b99f46f444", "262c6825b309e6485ec2493ffc7e62a13cf13fb2a8b6d212f72bd53ad34118f1", "2a11a3e90bd9901d70a5b31d7dd85114755a581a5da3fc996abfefa48aee78af", "2c99e97d388cd0a8d30f7c514d67887d8021541b875baf09791a3baad48bb4f8", "3128e30d83f2e70b0bed9b2a34e92707d0877e460b402faca908c6667092ada9", "38c8fd190db64f513fe4e1baa59fed086ae71fa45083b6936b52d34df8f86a88", "3bddc701bdd1efa0d5264d2649588cbfda549b2899dc8d50417e47a82e1387ba", "4902e6aa086cbb224241adbc2f06235927d5cdacffb2425c73e6570e8d862364", "49cae022fa13f09be91b2c880e58e14b6da5d10639ed45ca69b85faf039f7a4e", "56e01daca75eae420bce184edd8bb341c8eebb19dd3bce7266332258f9fb9dd7", "5862975b45d451b6db51c2e654990c1820523a5b07100fc6903e9c86575202a0", "6a8ce43923c518c24a2579fda49f093f1397dad5d18346211e46f134fc624e31", "6c54ce4b5d61a7129bad5c5dc279e222afd00e721bf92f9ef09e4fae28755683", "6e4b08c6f8daca7d8f07c8d24e4331ae7953333dbd09c648ed6ebd24db5a10ee", "717881211f46de3ab130b58ec0908267961fadc06e44f974466d1887f865bd5b", "749078d1eb89484db5f34b4012092ad14b327944ee7f1c4f74d6279a6e4d1884", "7913bd25f4ab274ba37bc97ad0e21c31004224ccb02765ad984eef43e04acc6c", "7a25fcbeae08f96a754b45bdc050e1fb94b95cab046bf56b016c25e9ab127b3e", "83d6b356e116ca119db8e7c6fc2983289d87b27b3fac238cfe5dca529d884562", "8b882a78c320478b12ff024e81dc7d43c1462aa4a3341c754ee65d857a521f85", "8f6a2229e8ad946e36815f2a03386bb8353d4bde368fdf8ca5f0cb97264d3b5c", "9801c4c1d9ae6a70aeb2128e5b4b68c45d4f0af0d1535500884d644fa9b768c6", "a15f64ae3a027b64496a71ab1f722355e570c3fac5ba2801cafce846bf5af01d", "a3d748383762e56337c39ab35c6ed4deb88df5326f97a38946ddd19028ecce6b", "a63f1a07932c9686d2d416fb295ec2c01ab246e89b4d58e5fa468089cab44b70", "b2b1a5ddae3677d89b686e5c625fc5547c6e492bd755b520de5332773a8af06b", "b2f4007bff007c96a173e24dcda236e5e83bde4358a557f9ccf5e014439eae4b", "baf378ba6151f6e272824b86a774326f692bc2ef4cc5ce8d5bc76e38c813a55f", "bafb01b4688833e099d79e7efd23f99172f501a15c44f21ea2118681473fdba0", "bba349276b126947b014e50ab3316c027cac1495992f10e5682dc677b3dfa0c5", "c084582d4215593f2f1d28b65d2a2f3aceff8342aa85afd7be23a9cad74a0de5", "d1ebb090a426db66dd80df8ca85adc4abfcbad8a7c2e9a5ec7513ede522e0a8f", "d2d8ce12b7c12c87e41123997ebaf1a5767a5be3ec545f64675388970f415e2e", "e32f5f3d1b1c663af7f9c4c1e72e6ffe9a78c03a31e149259f531e0fed826512", "e3faaf10a0d1e8e23a9b51d1900b72e1635c2d5b0e1bea1c18022486a8e2e52d", "f7d29a6fc4760300f86ae329e3b6ca28ea9c20823df123a2ea8693e967b29917", "f8f295db00ef5f8bae530fc39af0b40486ca6068733fb860b42115052206466f"] -six = ["30639c035cdb23534cd4aa2dd52c3bf48f06e5f4a941509c8bafd8ce11080259", "8b74bedcbbbaca38ff6d7491d76f2b06b3592611af620f8426e82dddb04a5ced"] sqlparse = ["017cde379adbd6a1f15a61873f43e8274179378e95ef3fede90b5aa64d304ed0", "0f91fd2e829c44362cbcfab3e9ae12e22badaa8a29ad5ff599f9ec109f0454e8"] toml = ["806143ae5bfb6a3c6e736a764057db0e6a0e05e338b5630894a5f779cabb4f9b", "b3bda1d108d5dd99f4a20d24d9c348e91c4db7ab1b749200bded2f839ccbe68f"] -traitlets = ["178f4ce988f69189f7e523337a3e11d91c786ded9360174a3d9ca83e79bc5396", "69ff3f9d5351f31a7ad80443c2674b7099df13cc41fc5fa6e2f6d3b0330b0426"] -typed-ast = ["0666aa36131496aed8f7be0410ff974562ab7eeac11ef351def9ea6fa28f6355", "0c2c07682d61a629b68433afb159376e24e5b2fd4641d35424e462169c0a7919", "249862707802d40f7f29f6e1aad8d84b5aa9e44552d2cc17384b209f091276aa", "24995c843eb0ad11a4527b026b4dde3da70e1f2d8806c99b7b4a7cf491612652", "269151951236b0f9a6f04015a9004084a5ab0d5f19b57de779f908621e7d8b75", "4083861b0aa07990b619bd7ddc365eb7fa4b817e99cf5f8d9cf21a42780f6e01", "498b0f36cc7054c1fead3d7fc59d2150f4d5c6c56ba7fb150c013fbc683a8d2d", "4e3e5da80ccbebfff202a67bf900d081906c358ccc3d5e3c8aea42fdfdfd51c1", "6daac9731f172c2a22ade6ed0c00197ee7cc1221aa84cfdf9c31defeb059a907", "715ff2f2df46121071622063fc7543d9b1fd19ebfc4f5c8895af64a77a8c852c", "73d785a950fc82dd2a25897d525d003f6378d1cb23ab305578394694202a58c3", "8c8aaad94455178e3187ab22c8b01a3837f8ee50e09cf31f1ba129eb293ec30b", "8ce678dbaf790dbdb3eba24056d5364fb45944f33553dd5869b7580cdbb83614", "aaee9905aee35ba5905cfb3c62f3e83b3bec7b39413f0a7f19be4e547ea01ebb", "bcd3b13b56ea479b3650b82cabd6b5343a625b0ced5429e4ccad28a8973f301b", "c9e348e02e4d2b4a8b2eedb48210430658df6951fa484e59de33ff773fbd4b41", "d205b1b46085271b4e15f670058ce182bd1199e56b317bf2ec004b6a44f911f6", "d43943ef777f9a1c42bf4e552ba23ac77a6351de620aa9acf64ad54933ad4d34", "d5d33e9e7af3b34a40dc05f498939f0ebf187f07c385fd58d591c533ad8562fe", "fc0fea399acb12edbf8a628ba8d2312f583bdbdb3335635db062fa98cf71fca4", "fe460b922ec15dd205595c9b5b99e2f056fd98ae8f9f56b888e7a17dc2b757e7"] +typed-ast = ["07d49388d5bf7e863f7fa2f124b1b1d89d8aa0e2f7812faff0a5658c01c59aa1", "14bf1522cdee369e8f5581238edac09150c765ec1cb33615855889cf33dcb92d", "240296b27397e4e37874abb1df2a608a92df85cf3e2a04d0d4d61055c8305ba6", "36d829b31ab67d6fcb30e185ec996e1f72b892255a745d3a82138c97d21ed1cd", "37f48d46d733d57cc70fd5f30572d11ab8ed92da6e6b28e024e4a3edfb456e37", "4c790331247081ea7c632a76d5b2a265e6d325ecd3179d06e9cf8d46d90dd151", "5dcfc2e264bd8a1db8b11a892bd1647154ce03eeba94b461effe68790d8b8e07", "7147e2a76c75f0f64c4319886e7639e490fee87c9d25cb1d4faef1d8cf83a440", "7703620125e4fb79b64aa52427ec192822e9f45d37d4b6625ab37ef403e1df70", "8368f83e93c7156ccd40e49a783a6a6850ca25b556c0fa0240ed0f659d2fe496", "84aa6223d71012c68d577c83f4e7db50d11d6b1399a9c779046d75e24bed74ea", "85f95aa97a35bdb2f2f7d10ec5bbdac0aeb9dafdaf88e17492da0504de2e6400", "8db0e856712f79c45956da0c9a40ca4246abc3485ae0d7ecc86a20f5e4c09abc", "9044ef2df88d7f33692ae3f18d3be63dec69c4fb1b5a4a9ac950f9b4ba571606", "963c80b583b0661918718b095e02303d8078950b26cc00b5e5ea9ababe0de1fc", "987f15737aba2ab5f3928c617ccf1ce412e2e321c77ab16ca5a293e7bbffd581", "9ec45db0c766f196ae629e509f059ff05fc3148f9ffd28f3cfe75d4afb485412", "9fc0b3cb5d1720e7141d103cf4819aea239f7d136acf9ee4a69b047b7986175a", "a2c927c49f2029291fbabd673d51a2180038f8cd5a5b2f290f78c4516be48be2", "a38878a223bdd37c9709d07cd357bb79f4c760b29210e14ad0fb395294583787", "b4fcdcfa302538f70929eb7b392f536a237cbe2ed9cba88e3bf5027b39f5f77f", "c0c74e5579af4b977c8b932f40a5464764b2f86681327410aa028a22d2f54937", "c1c876fd795b36126f773db9cbb393f19808edd2637e00fd6caba0e25f2c7b64", "c9aadc4924d4b5799112837b226160428524a9a45f830e0d0f184b19e4090487", "cc7b98bf58167b7f2db91a4327da24fb93368838eb84a44c472283778fc2446b", "cf54cfa843f297991b7388c281cb3855d911137223c6b6d2dd82a47ae5125a41", "d003156bb6a59cda9050e983441b7fa2487f7800d76bdc065566b7d728b4581a", "d175297e9533d8d37437abc14e8a83cbc68af93cc9c1c59c2c292ec59a0697a3", "d746a437cdbca200622385305aedd9aef68e8a645e385cc483bdc5e488f07166", "e683e409e5c45d5c9082dc1daf13f6374300806240719f95dc783d1fc942af10"] typing-extensions = ["7cb407020f00f7bfc3cb3e7881628838e69d8f3fcab2f64742a5e76b2f841918", "99d4073b617d30288f569d3f13d2bd7548c3a7e4c8de87db09a9d29bb3a4a60c", "dafc7639cde7f1b6e1acc0f457842a83e722ccca8eef5270af2d74792619a89f"] -wcwidth = ["beb4802a9cebb9144e99086eff703a642a13d6a0052920003a230f3294bbe784", "c4d647b99872929fdb7bdcaa4fbe7f01413ed3d98077df798530e5b04f116c83"] wheel = ["497add53525d16c173c2c1c733b8f655510e909ea78cc0e29d374243544b77a2", "99a22d87add3f634ff917310a3d87e499f19e663413a52eb9232c447aa646c9f"] zipp = ["102c24ef8f171fd729d46599845e95c7ab894a4cf45f5de11a44cc7444fb1108", "ed5eee1974372595f9e416cc7bbeeb12335201d8081ca8a0743c954d4446e5cb"] diff --git a/pyproject.toml b/pyproject.toml index d2646974b..2347188c2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "django-types" -version = "0.4.0" +version = "0.4.1" description = "Type stubs for Django" repository = "https://github.com/sbdchd/django-types" readme = "README.md" @@ -14,7 +14,7 @@ packages = [ ] [tool.poetry.dependencies] -python = "^3.7" +python = "^3.6" [tool.poetry.dev-dependencies] black = {version = "20.8b1",allows-prereleases = true} @@ -25,7 +25,6 @@ isort = "^5.6" django = "^3.1" flake8 = "^3.8" psycopg2 = "^2.8" -ipython = "^7.19" [tool.black] line-length = 88 diff --git a/s/lint b/s/lint index a109e5765..c450ae709 100755 --- a/s/lint +++ b/s/lint @@ -2,10 +2,6 @@ set -ex -if [[ ! -f ./.venv/lib/python3.7/site-packages/django-stubs.egg-link ]]; then - ./.venv/bin/pip install -e . -fi - # format code if [[ $CI ]]; then diff --git a/setup.py b/setup.py deleted file mode 100644 index 08624a8d4..000000000 --- a/setup.py +++ /dev/null @@ -1,7 +0,0 @@ -from setuptools import setup - -# This allows for the pip install -e . to work so that mypy can check the types -# of the examples. Since the stubs aren't using valid python package names, -# mypy can't check the types normally. - -setup(name="django-stubs") From 8b49138f51d74f0d83ce0b80f396c2facd5ef7e1 Mon Sep 17 00:00:00 2001 From: Steve Dignam Date: Fri, 26 Feb 2021 14:04:38 -0500 Subject: [PATCH 27/88] update(docs): with more usage info --- README.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/README.md b/README.md index aa11bab94..25062d0aa 100644 --- a/README.md +++ b/README.md @@ -26,6 +26,8 @@ argument. You can either use [`django-stubs-ext`](https://pypi.org/project/djang from django.db.models.manager import BaseManager from django.db.models.query import QuerySet +# NOTE: there are probably other items you'll need to monkey patch depending on +# your version. for cls in (QuerySet, BaseManager): cls.__class_getitem__ = classmethod(lambda cls, *args, **kwargs: cls) # type: ignore [attr-defined] ``` @@ -71,6 +73,23 @@ class User(models.Model): team_id: int ``` +### `AutoField` + +By default Django will create an `AutoField` for you if one doesn't exist. + +For type checkers to know about the `id` field you'll need to declare the +field explicitly. + +```python +# before +class Post(models.Model): + ... + +# after +class Post(models.Model): + id = models.AutoField(primary_key=True) +``` + ### `HttpRequest`'s `user` property The `HttpRequest`'s `user` property has a type of `Union[AbstractBaseUser, AnonymousUser]`, From 8c0a26671a4ff5df419ccc1fd6199be594af39cc Mon Sep 17 00:00:00 2001 From: Steve Dignam Date: Fri, 26 Feb 2021 14:10:30 -0500 Subject: [PATCH 28/88] add(ci): circleci config --- .circleci/config.yml | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 .circleci/config.yml diff --git a/.circleci/config.yml b/.circleci/config.yml new file mode 100644 index 000000000..5756f014a --- /dev/null +++ b/.circleci/config.yml @@ -0,0 +1,39 @@ +version: 2 + +jobs: + lint: + docker: + - image: circleci/python:3.7-node + steps: + - checkout + - restore_cache: + keys: + - django-types-v1-{{ checksum "poetry.lock" }}-{{ checksum "yarn.lock" }} + - run: + name: install python dependencies + command: | + # Use our new PATH so we can call poetry from bash + echo 'export PATH="$PATH":"$HOME"/.local/bin' >> $BASH_ENV + source $BASH_ENV + sudo python -m pip uninstall poetry -y + python -m pip install --user poetry==0.12.12 + poetry config settings.virtualenvs.in-project true + poetry install + - run: + name: install node dependencies + command: | + yarn install --frozen-lockfile --non-interactive + - save_cache: + paths: + - ./.mypy_cache + - /root/.cache/ + key: django-types-v1-{{ checksum "poetry.lock" }}-{{ checksum "yarn.lock" }} + - run: + name: lint + command: ./s/lint + +workflows: + version: 2 + test: + jobs: + - lint From 517b5932254b082f8eb89780e6f434da5f7ad62e Mon Sep 17 00:00:00 2001 From: Steve Dignam Date: Fri, 26 Feb 2021 14:13:11 -0500 Subject: [PATCH 29/88] add(ci): pyright --- package.json | 5 +++++ pyrightconfig.json | 5 +++++ yarn.lock | 8 ++++++++ 3 files changed, 18 insertions(+) create mode 100644 package.json create mode 100644 pyrightconfig.json create mode 100644 yarn.lock diff --git a/package.json b/package.json new file mode 100644 index 000000000..faef8b0d6 --- /dev/null +++ b/package.json @@ -0,0 +1,5 @@ +{ + "devDependencies": { + "pyright": "^1.1.115" + } +} diff --git a/pyrightconfig.json b/pyrightconfig.json new file mode 100644 index 000000000..67f39f8ae --- /dev/null +++ b/pyrightconfig.json @@ -0,0 +1,5 @@ +{ + "typeCheckingMode": "strict", + "reportPrivateUsage": false, + "reportMissingModuleSource": false +} diff --git a/yarn.lock b/yarn.lock new file mode 100644 index 000000000..f91b8e3fa --- /dev/null +++ b/yarn.lock @@ -0,0 +1,8 @@ +# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. +# yarn lockfile v1 + + +pyright@^1.1.115: + version "1.1.115" + resolved "https://registry.yarnpkg.com/pyright/-/pyright-1.1.115.tgz#3568f64d85bc859052498276a35231e6930ecccc" + integrity sha512-MFi3Q7agfL1MRTkBTkqitfS1FIwPFZ8viB7f2w4GySBKOXQJSC66iRdXnWmLqkrUi3hSHefu/rt4ul1/8YyTeA== From 46de226e36ec7720acc422eb0b4a8514d0ad07c2 Mon Sep 17 00:00:00 2001 From: Steve Dignam Date: Fri, 26 Feb 2021 15:57:19 -0500 Subject: [PATCH 30/88] fix(ci): use setuptools for building (#3) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Poetry wouldn't install because a yaml file was in `django-stubs` https://github.com/python-poetry/poetry-core/blob/4bc9bde1d0ac201dcb5e20ac5b890dff3bd47b07/poetry/core/masonry/utils/package_include.py#L47 😞 --- .circleci/config.yml | 7 +- pyproject.toml | 2 +- typings/django/__init__.pyi | 7 +- .../backends/postgresql/test_import_all.yml | 585 ------------------ 4 files changed, 6 insertions(+), 595 deletions(-) delete mode 100644 typings/django/db/backends/postgresql/test_import_all.yml diff --git a/.circleci/config.yml b/.circleci/config.yml index 5756f014a..ab57b897a 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -8,7 +8,7 @@ jobs: - checkout - restore_cache: keys: - - django-types-v1-{{ checksum "poetry.lock" }}-{{ checksum "yarn.lock" }} + - django-types-v2-{{ checksum "poetry.lock" }}-{{ checksum "yarn.lock" }} - run: name: install python dependencies command: | @@ -16,8 +16,9 @@ jobs: echo 'export PATH="$PATH":"$HOME"/.local/bin' >> $BASH_ENV source $BASH_ENV sudo python -m pip uninstall poetry -y - python -m pip install --user poetry==0.12.12 + python -m pip install --user poetry==0.12.11 poetry config settings.virtualenvs.in-project true + poetry --version poetry install - run: name: install node dependencies @@ -27,7 +28,7 @@ jobs: paths: - ./.mypy_cache - /root/.cache/ - key: django-types-v1-{{ checksum "poetry.lock" }}-{{ checksum "yarn.lock" }} + key: django-types-v2-{{ checksum "poetry.lock" }}-{{ checksum "yarn.lock" }} - run: name: lint command: ./s/lint diff --git a/pyproject.toml b/pyproject.toml index 2347188c2..bb2d95667 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -34,5 +34,5 @@ include = '\.pyi?$' profile="black" [build-system] -requires = ["poetry>=0.12"] +requires = ["poetry>=0.12", "setuptools"] build-backend = "poetry.masonry.api" diff --git a/typings/django/__init__.pyi b/typings/django/__init__.pyi index c705a44c5..2e9627b60 100644 --- a/typings/django/__init__.pyi +++ b/typings/django/__init__.pyi @@ -1,4 +1,4 @@ -from typing import Any, NamedTuple +from typing import Any from .utils.version import get_version as get_version @@ -6,8 +6,3 @@ VERSION: Any __version__: str def setup(set_prefix: bool = ...) -> None: ... - -# Used by mypy_django_plugin when returning a QuerySet row that is a NamedTuple where the field names are unknown -class _NamedTupleAnyAttr(NamedTuple): - def __getattr__(self, item: str) -> Any: ... - def __setattr__(self, item: str, value: Any) -> None: ... diff --git a/typings/django/db/backends/postgresql/test_import_all.yml b/typings/django/db/backends/postgresql/test_import_all.yml deleted file mode 100644 index 4abe6ecc8..000000000 --- a/typings/django/db/backends/postgresql/test_import_all.yml +++ /dev/null @@ -1,585 +0,0 @@ -- case: import_all_modules - main: | - import django.apps - import django.apps.config - import django.apps.registry - import django.conf.global_settings - import django.conf.locale - import django.conf.urls - import django.conf.urls.i18n - import django.conf.urls.static - import django.contrib.admin.actions - import django.contrib.admin.apps - import django.contrib.admin.checks - import django.contrib.admin.decorators - import django.contrib.admin.filters - import django.contrib.admin.forms - import django.contrib.admin.helpers - import django.contrib.admin.models - import django.contrib.admin.options - import django.contrib.admin.sites - import django.contrib.admin.templatetags - import django.contrib.admin.templatetags.admin_list - import django.contrib.admin.templatetags.admin_modify - import django.contrib.admin.templatetags.admin_static - import django.contrib.admin.templatetags.admin_urls - import django.contrib.admin.templatetags.base - import django.contrib.admin.templatetags.log - import django.contrib.admin.tests - import django.contrib.admin.utils - import django.contrib.admin.views - import django.contrib.admin.views.autocomplete - import django.contrib.admin.views.decorators - import django.contrib.admin.views.main - import django.contrib.admin.widgets - import django.contrib.admindocs - import django.contrib.admindocs.middleware - import django.contrib.admindocs.urls - import django.contrib.admindocs.utils - import django.contrib.admindocs.views - import django.contrib.auth.admin - import django.contrib.auth.apps - import django.contrib.auth.backends - import django.contrib.auth.base_user - import django.contrib.auth.checks - import django.contrib.auth.context_processors - import django.contrib.auth.decorators - import django.contrib.auth.forms - import django.contrib.auth.handlers - import django.contrib.auth.handlers.modwsgi - import django.contrib.auth.hashers - import django.contrib.auth.management.commands - import django.contrib.auth.management.commands.changepassword - import django.contrib.auth.management.commands.createsuperuser - import django.contrib.auth.middleware - import django.contrib.auth.mixins - import django.contrib.auth.models - import django.contrib.auth.password_validation - import django.contrib.auth.signals - import django.contrib.auth.tokens - import django.contrib.auth.urls - import django.contrib.auth.validators - import django.contrib.auth.views - import django.contrib.contenttypes.admin - import django.contrib.contenttypes.apps - import django.contrib.contenttypes.checks - import django.contrib.contenttypes.fields - import django.contrib.contenttypes.forms - import django.contrib.contenttypes.management.commands - import django.contrib.contenttypes.management.commands.remove_stale_contenttypes - import django.contrib.contenttypes.models - import django.contrib.contenttypes.views - import django.contrib.flatpages.forms - import django.contrib.flatpages.middleware - import django.contrib.flatpages.models - import django.contrib.flatpages.sitemaps - import django.contrib.flatpages.templatetags - import django.contrib.flatpages.templatetags.flatpages - import django.contrib.flatpages.urls - import django.contrib.flatpages.views - import django.contrib.gis.geos.linestring - import django.contrib.gis.geos.base - import django.contrib.gis.geos.prepared - import django.contrib.gis.geos.libgeos - import django.contrib.gis.geos.error - import django.contrib.gis.geos.coordseq - import django.contrib.gis.geos - import django.contrib.gis.geos.collections - import django.contrib.gis.geos.geometry - import django.contrib.gis.geos.prototypes.prepared - import django.contrib.gis.geos.prototypes.coordseq - import django.contrib.gis.geos.prototypes - import django.contrib.gis.geos.prototypes.errcheck - import django.contrib.gis.geos.prototypes.misc - import django.contrib.gis.geos.prototypes.threadsafe - import django.contrib.gis.geos.prototypes.geom - import django.contrib.gis.geos.prototypes.topology - import django.contrib.gis.geos.prototypes.predicates - import django.contrib.gis.geos.prototypes.io - import django.contrib.gis.geos.factory - import django.contrib.gis.geos.point - import django.contrib.gis.geos.polygon - import django.contrib.gis.geos.mutable_list - import django.contrib.gis.geos.io - import django.contrib.gis.forms - import django.contrib.gis.forms.fields - import django.contrib.gis.forms.widgets - import django.contrib.gis.gdal.base - import django.contrib.gis.gdal.error - import django.contrib.gis.gdal.layer - import django.contrib.gis.gdal - import django.contrib.gis.gdal.geomtype - import django.contrib.gis.gdal.libgdal - import django.contrib.gis.gdal.datasource - import django.contrib.gis.gdal.feature - import django.contrib.gis.gdal.envelope - import django.contrib.gis.gdal.prototypes.ds - import django.contrib.gis.gdal.prototypes - import django.contrib.gis.gdal.prototypes.errcheck - import django.contrib.gis.gdal.prototypes.geom - import django.contrib.gis.gdal.prototypes.srs - import django.contrib.gis.gdal.prototypes.raster - import django.contrib.gis.gdal.prototypes.generation - import django.contrib.gis.gdal.driver - import django.contrib.gis.gdal.raster.base - import django.contrib.gis.gdal.raster - import django.contrib.gis.gdal.raster.source - import django.contrib.gis.gdal.raster.band - import django.contrib.gis.gdal.raster.const - import django.contrib.gis.gdal.field - import django.contrib.gis.gdal.srs - import django.contrib.gis.gdal.geometries - import django.contrib.gis - import django.contrib.gis.feeds - import django.contrib.gis.admin.options - import django.contrib.gis.admin - import django.contrib.gis.admin.widgets - import django.contrib.gis.shortcuts - import django.contrib.gis.utils.layermapping - import django.contrib.gis.utils - import django.contrib.gis.utils.ogrinfo - import django.contrib.gis.utils.srs - import django.contrib.gis.utils.ogrinspect - import django.contrib.gis.measure - import django.contrib.gis.geometry - import django.contrib.gis.serializers - import django.contrib.gis.serializers.geojson - import django.contrib.gis.apps - import django.contrib.gis.sitemaps.kml - import django.contrib.gis.sitemaps - import django.contrib.gis.sitemaps.views - import django.contrib.gis.db - import django.contrib.gis.db.backends - import django.contrib.gis.db.backends.oracle.operations - import django.contrib.gis.db.backends.oracle.base - import django.contrib.gis.db.backends.oracle.adapter - import django.contrib.gis.db.backends.oracle - import django.contrib.gis.db.backends.oracle.schema - import django.contrib.gis.db.backends.oracle.models - import django.contrib.gis.db.backends.oracle.features - import django.contrib.gis.db.backends.oracle.introspection - import django.contrib.gis.db.backends.utils - import django.contrib.gis.db.backends.postgis.operations - import django.contrib.gis.db.backends.postgis.base - import django.contrib.gis.db.backends.postgis.adapter - import django.contrib.gis.db.backends.postgis - import django.contrib.gis.db.backends.postgis.pgraster - import django.contrib.gis.db.backends.postgis.schema - import django.contrib.gis.db.backends.postgis.const - import django.contrib.gis.db.backends.postgis.models - import django.contrib.gis.db.backends.postgis.features - import django.contrib.gis.db.backends.postgis.introspection - import django.contrib.gis.db.backends.mysql.operations - import django.contrib.gis.db.backends.mysql.base - import django.contrib.gis.db.backends.mysql - import django.contrib.gis.db.backends.mysql.schema - import django.contrib.gis.db.backends.mysql.features - import django.contrib.gis.db.backends.mysql.introspection - import django.contrib.gis.db.backends.spatialite.operations - import django.contrib.gis.db.backends.spatialite.base - import django.contrib.gis.db.backends.spatialite.adapter - import django.contrib.gis.db.backends.spatialite - import django.contrib.gis.db.backends.spatialite.client - import django.contrib.gis.db.backends.spatialite.schema - import django.contrib.gis.db.backends.spatialite.models - import django.contrib.gis.db.backends.spatialite.features - import django.contrib.gis.db.backends.spatialite.introspection - import django.contrib.gis.db.backends.base.operations - import django.contrib.gis.db.backends.base.adapter - import django.contrib.gis.db.backends.base - import django.contrib.gis.db.backends.base.models - import django.contrib.gis.db.backends.base.features - import django.contrib.gis.db.models.proxy - import django.contrib.gis.db.models.aggregates - import django.contrib.gis.db.models - import django.contrib.gis.db.models.lookups - import django.contrib.gis.db.models.fields - import django.contrib.gis.db.models.functions - import django.contrib.gis.db.models.sql - import django.contrib.gis.db.models.sql.conversion - import django.contrib.gis.ptr - import django.contrib.gis.geoip2.resources - import django.contrib.gis.geoip2.base - import django.contrib.gis.geoip2 - import django.contrib.gis.views - import django.contrib.humanize.templatetags - import django.contrib.humanize.templatetags.humanize - import django.contrib.messages.api - import django.contrib.messages.constants - import django.contrib.messages.context_processors - import django.contrib.messages.middleware - import django.contrib.messages.storage - import django.contrib.messages.storage.base - import django.contrib.messages.storage.cookie - import django.contrib.messages.storage.fallback - import django.contrib.messages.storage.session - import django.contrib.messages.utils - import django.contrib.messages.views - import django.contrib.postgres.aggregates - import django.contrib.postgres.aggregates.general - import django.contrib.postgres.aggregates.mixins - import django.contrib.postgres.aggregates.statistics - import django.contrib.postgres.constraints - import django.contrib.postgres.fields - import django.contrib.postgres.fields.array - import django.contrib.postgres.fields.citext - import django.contrib.postgres.fields.hstore - import django.contrib.postgres.fields.jsonb - import django.contrib.postgres.fields.mixins - import django.contrib.postgres.fields.ranges - import django.contrib.postgres.functions - import django.contrib.postgres.indexes - import django.contrib.postgres.lookups - import django.contrib.postgres.operations - import django.contrib.postgres.search - import django.contrib.postgres.signals - import django.contrib.postgres.validators - import django.contrib.redirects - import django.contrib.redirects.middleware - import django.contrib.redirects.models - import django.contrib.sessions.backends - import django.contrib.sessions.backends.base - import django.contrib.sessions.backends.cache - import django.contrib.sessions.backends.cached_db - import django.contrib.sessions.backends.db - import django.contrib.sessions.backends.file - import django.contrib.sessions.backends.signed_cookies - import django.contrib.sessions.base_session - import django.contrib.sessions.exceptions - import django.contrib.sessions.management.commands - import django.contrib.sessions.management.commands.clearsessions - import django.contrib.sessions.middleware - import django.contrib.sessions.models - import django.contrib.sessions.serializers - import django.contrib.sitemaps.management.commands - import django.contrib.sitemaps.management.commands.ping_google - import django.contrib.sitemaps.views - import django.contrib.sites - import django.contrib.sites.apps - import django.contrib.sites.management - import django.contrib.sites.managers - import django.contrib.sites.middleware - import django.contrib.sites.models - import django.contrib.sites.requests - import django.contrib.sites.shortcuts - import django.contrib.staticfiles.apps - import django.contrib.staticfiles.checks - import django.contrib.staticfiles.finders - import django.contrib.staticfiles.handlers - import django.contrib.staticfiles.management.commands - import django.contrib.staticfiles.management.commands.collectstatic - import django.contrib.staticfiles.management.commands.findstatic - import django.contrib.staticfiles.management.commands.runserver - import django.contrib.staticfiles.storage - import django.contrib.staticfiles.templatetags - import django.contrib.staticfiles.templatetags.staticfiles - import django.contrib.staticfiles.testing - import django.contrib.staticfiles.urls - import django.contrib.staticfiles.utils - import django.contrib.staticfiles.views - import django.contrib.syndication - import django.contrib.syndication.views - import django.core.cache.backends - import django.core.cache.backends.base - import django.core.cache.backends.db - import django.core.cache.backends.dummy - import django.core.cache.backends.filebased - import django.core.cache.backends.locmem - import django.core.cache.backends.memcached - import django.core.cache.utils - import django.core.checks.caches - import django.core.checks.database - import django.core.checks.messages - import django.core.checks.model_checks - import django.core.checks.registry - import django.core.checks.security - import django.core.checks.security.base - import django.core.checks.security.csrf - import django.core.checks.security.sessions - import django.core.checks.templates - import django.core.checks.translation - import django.core.checks.urls - import django.core.exceptions - import django.core.files - import django.core.files.base - import django.core.files.images - import django.core.files.locks - import django.core.files.move - import django.core.files.storage - import django.core.files.temp - import django.core.files.uploadedfile - import django.core.files.uploadhandler - import django.core.files.utils - import django.core.handlers - import django.core.handlers.base - import django.core.handlers.exception - import django.core.handlers.wsgi - import django.core.mail.backends - import django.core.mail.backends.base - import django.core.mail.message - import django.core.mail.utils - import django.core.management.base - import django.core.management.color - import django.core.management.commands - import django.core.management.commands.dumpdata - import django.core.management.commands.loaddata - import django.core.management.commands.makemessages - import django.core.management.commands.runserver - import django.core.management.commands.testserver - import django.core.management.sql - import django.core.management.templates - import django.core.management.utils - import django.core.paginator - import django.core.serializers - import django.core.serializers.base - import django.core.serializers.json - import django.core.serializers.python - import django.core.servers - import django.core.servers.basehttp - import django.core.signals - import django.core.signing - import django.core.validators - import django.core.wsgi - import django.db.backends.base - import django.db.backends.base.base - import django.db.backends.base.client - import django.db.backends.base.creation - import django.db.backends.base.features - import django.db.backends.base.introspection - import django.db.backends.base.operations - import django.db.backends.base.schema - import django.db.backends.base.validation - import django.db.backends.oracle - import django.db.backends.oracle.base - import django.db.backends.oracle.client - import django.db.backends.oracle.creation - import django.db.backends.oracle.features - import django.db.backends.oracle.functions - import django.db.backends.oracle.introspection - import django.db.backends.oracle.operations - import django.db.backends.oracle.utils - import django.db.backends.oracle.schema - import django.db.backends.oracle.validation - import django.db.backends.ddl_references - import django.db.backends.dummy - import django.db.backends.dummy.base - import django.db.backends.mysql - import django.db.backends.mysql.base - import django.db.backends.mysql.client - import django.db.backends.mysql.compiler - import django.db.backends.mysql.creation - import django.db.backends.mysql.features - import django.db.backends.mysql.introspection - import django.db.backends.mysql.operations - import django.db.backends.mysql.schema - import django.db.backends.mysql.validation - import django.db.backends.postgresql - import django.db.backends.postgresql.base - import django.db.backends.postgresql.client - import django.db.backends.postgresql.creation - import django.db.backends.postgresql.operations - import django.db.backends.signals - import django.db.backends.sqlite3 - import django.db.backends.sqlite3.base - import django.db.backends.sqlite3.creation - import django.db.backends.sqlite3.client - import django.db.backends.sqlite3.features - import django.db.backends.sqlite3.introspection - import django.db.backends.sqlite3.operations - import django.db.backends.sqlite3.schema - import django.db.backends.utils - import django.db.migrations.autodetector - import django.db.migrations.exceptions - import django.db.migrations.executor - import django.db.migrations.graph - import django.db.migrations.loader - import django.db.migrations.migration - import django.db.migrations.operations - import django.db.migrations.operations.base - import django.db.migrations.operations.fields - import django.db.migrations.operations.models - import django.db.migrations.operations.special - import django.db.migrations.operations.utils - import django.db.migrations.optimizer - import django.db.migrations.questioner - import django.db.migrations.recorder - import django.db.migrations.serializer - import django.db.migrations.state - import django.db.migrations.topological_sort - import django.db.migrations.utils - import django.db.migrations.writer - import django.db.models.aggregates - import django.db.models.base - import django.db.models.constraints - import django.db.models.deletion - import django.db.models.expressions - import django.db.models.enums - import django.db.models.fields - import django.db.models.fields.files - import django.db.models.fields.mixins - import django.db.models.fields.proxy - import django.db.models.fields.related - import django.db.models.fields.related_descriptors - import django.db.models.fields.related_lookups - import django.db.models.fields.reverse_related - import django.db.models.functions - import django.db.models.functions.comparison - import django.db.models.functions.datetime - import django.db.models.functions.math - import django.db.models.functions.mixins - import django.db.models.functions.text - import django.db.models.functions.window - import django.db.models.indexes - import django.db.models.lookups - import django.db.models.manager - import django.db.models.options - import django.db.models.query - import django.db.models.query_utils - import django.db.models.signals - import django.db.models.sql - import django.db.models.sql.compiler - import django.db.models.sql.constants - import django.db.models.sql.datastructures - import django.db.models.sql.query - import django.db.models.sql.subqueries - import django.db.models.sql.where - import django.db.models.utils - import django.db.transaction - import django.db.utils - import django.dispatch - import django.dispatch.dispatcher - import django.forms - import django.forms.boundfield - import django.forms.fields - import django.forms.forms - import django.forms.formsets - import django.forms.models - import django.forms.renderers - import django.forms.utils - import django.forms.widgets - import django.http - import django.http.cookie - import django.http.multipartparser - import django.http.request - import django.http.response - import django.middleware - import django.middleware.cache - import django.middleware.clickjacking - import django.middleware.common - import django.middleware.csrf - import django.middleware.gzip - import django.middleware.http - import django.middleware.locale - import django.middleware.security - import django.shortcuts - import django.template.backends - import django.template.backends.base - import django.template.backends.django - import django.template.backends.dummy - import django.template.backends.jinja2 - import django.template.backends.utils - import django.template.base - import django.template.context - import django.template.context_processors - import django.template.defaultfilters - import django.template.defaulttags - import django.template.engine - import django.template.exceptions - import django.template.library - import django.template.loader - import django.template.loader_tags - import django.template.loaders - import django.template.loaders.app_directories - import django.template.loaders.base - import django.template.loaders.cached - import django.template.loaders.filesystem - import django.template.loaders.locmem - import django.template.response - import django.template.smartif - import django.template.utils - import django.templatetags - import django.templatetags.cache - import django.templatetags.i18n - import django.templatetags.l10n - import django.templatetags.static - import django.templatetags.tz - import django.test - import django.test.client - import django.test.html - import django.test.runner - import django.test.selenium - import django.test.signals - import django.test.testcases - import django.test.utils - import django.urls - import django.urls.base - import django.urls.conf - import django.urls.converters - import django.urls.exceptions - import django.urls.resolvers - import django.urls.utils - import django.utils._os - import django.utils.archive - import django.utils.autoreload - import django.utils.baseconv - import django.utils.cache - import django.utils.crypto - import django.utils.datastructures - import django.utils.dateformat - import django.utils.dateparse - import django.utils.dates - import django.utils.datetime_safe - import django.utils.deconstruct - import django.utils.decorators - import django.utils.deprecation - import django.utils.duration - import django.utils.encoding - import django.utils.feedgenerator - import django.utils.formats - import django.utils.functional - import django.utils.hashable - import django.utils.html - import django.utils.http - import django.utils.inspect - import django.utils.ipv6 - import django.utils.itercompat - import django.utils.jslex - import django.utils.log - import django.utils.lorem_ipsum - import django.utils.module_loading - import django.utils.numberformat - import django.utils.regex_helper - import django.utils.safestring - import django.utils.six - import django.utils.termcolors - import django.utils.text - import django.utils.timesince - import django.utils.timezone - import django.utils.topological_sort - import django.utils.translation - import django.utils.translation.reloader - import django.utils.translation.template - import django.utils.translation.trans_null - import django.utils.translation.trans_real - import django.utils.tree - import django.utils.version - import django.utils.xmlutils - import django.views.csrf - import django.views.debug - import django.views.decorators - import django.views.decorators.cache - import django.views.decorators.clickjacking - import django.views.decorators.csrf - import django.views.decorators.debug - import django.views.decorators.gzip - import django.views.decorators.http - import django.views.decorators.vary - import django.views.defaults - import django.views.generic - import django.views.generic.base - import django.views.generic.dates - import django.views.generic.detail - import django.views.generic.edit - import django.views.generic.list - import django.views.i18n - import django.views.static From ad5e6395bd266dbec6c944b1eebd9c41fffb381d Mon Sep 17 00:00:00 2001 From: Steve Dignam Date: Fri, 26 Feb 2021 22:33:02 -0500 Subject: [PATCH 31/88] add(ci): kodiak (#5) --- .kodiak.toml | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .kodiak.toml diff --git a/.kodiak.toml b/.kodiak.toml new file mode 100644 index 000000000..5f495a9ac --- /dev/null +++ b/.kodiak.toml @@ -0,0 +1,5 @@ +version = 1 + +[merge.message] +title = "pull_request_title" +body = "pull_request_body" From 209cdfcbdbbfe37d9fca59998116b672606b3756 Mon Sep 17 00:00:00 2001 From: Steve Dignam Date: Fri, 26 Feb 2021 22:34:42 -0500 Subject: [PATCH 32/88] fix: errors surfaced by pyright (#4) Fixed a number of errors caught by `pyright`, need the latest version to ship before we can enable in CI. see: https://github.com/microsoft/pyright/issues/1550 --- s/lint | 6 + tests/trout/models.py | 2 +- typings/django/conf/__init__.pyi | 4 - typings/django/contrib/admin/models.pyi | 1 - typings/django/contrib/auth/__init__.pyi | 1 - typings/django/contrib/auth/base_user.pyi | 1 - .../contenttypes/management/__init__.pyi | 2 +- typings/django/contrib/flatpages/models.pyi | 1 - .../django/contrib/gis/db/models/fields.pyi | 4 +- typings/django/contrib/gis/utils/__init__.pyi | 6 +- .../contrib/messages/storage/__init__.pyi | 2 - .../django/contrib/postgres/constraints.pyi | 2 +- .../django/contrib/postgres/fields/array.pyi | 2 +- .../django/contrib/postgres/fields/citext.pyi | 6 +- .../django/contrib/postgres/fields/hstore.pyi | 2 +- typings/django/contrib/postgres/search.pyi | 4 +- .../core/management/commands/startapp.pyi | 2 - typings/django/db/__init__.pyi | 2 +- .../django/db/backends/base/introspection.pyi | 20 ++- .../db/backends/mysql/introspection.pyi | 17 ++- typings/django/db/backends/utils.pyi | 1 - typings/django/db/models/base.pyi | 11 +- typings/django/db/models/constraints.pyi | 2 +- typings/django/db/models/expressions.pyi | 2 +- typings/django/db/models/fields/__init__.pyi | 138 ++++++++++-------- typings/django/db/models/fields/files.pyi | 2 +- typings/django/db/models/fields/related.pyi | 13 +- typings/django/db/models/query.pyi | 6 +- typings/django/db/models/query_utils.pyi | 14 +- typings/django/db/models/sql/query.pyi | 14 +- typings/django/forms/__init__.pyi | 1 + typings/django/forms/widgets.pyi | 2 +- typings/django/template/defaulttags.pyi | 7 +- typings/django/utils/log.pyi | 2 +- typings/django/utils/six.pyi | 8 +- 35 files changed, 175 insertions(+), 135 deletions(-) diff --git a/s/lint b/s/lint index c450ae709..1d27ecfc1 100755 --- a/s/lint +++ b/s/lint @@ -15,5 +15,11 @@ fi # type check code ./.venv/bin/mypy tests typings + +# TODO(sbdchd): re-enable once the latest pyright ships +if [[ -z $CI ]]; then + ./node_modules/.bin/pyright typings +fi + # lint ./.venv/bin/flake8 tests typings diff --git a/tests/trout/models.py b/tests/trout/models.py index 9c4d3af3d..727f86ed1 100644 --- a/tests/trout/models.py +++ b/tests/trout/models.py @@ -174,7 +174,7 @@ class Comment(models.Model): not_nullable_user_str = models.ForeignKey( # type: ignore [var-annotated] "User", on_delete=models.CASCADE, null=False ) - null_str_specified = models.ForeignKey["User"]( + null_str_specified = models.ForeignKey["Optional[User]"]( "User", on_delete=models.CASCADE, null=True ) diff --git a/typings/django/conf/__init__.pyi b/typings/django/conf/__init__.pyi index 0cf3c5c07..343504f9e 100644 --- a/typings/django/conf/__init__.pyi +++ b/typings/django/conf/__init__.pyi @@ -2,14 +2,10 @@ from typing import Any from django.utils.functional import LazyObject -# explicit dependency on standard settings to make it loaded -from . import global_settings - ENVIRONMENT_VARIABLE: str = ... DEFAULT_CONTENT_TYPE_DEPRECATED_MSG: str = ... FILE_CHARSET_DEPRECATED_MSG: str = ... -# required for plugin to be able to distinguish this specific instance of LazySettings from others class _DjangoConfLazyObject(LazyObject): def __getattr__(self, item: Any) -> Any: ... diff --git a/typings/django/contrib/admin/models.pyi b/typings/django/contrib/admin/models.pyi index fdd905047..4af0c7dc1 100644 --- a/typings/django/contrib/admin/models.pyi +++ b/typings/django/contrib/admin/models.pyi @@ -1,7 +1,6 @@ from typing import Any, Optional, Union from uuid import UUID -from django.contrib.contenttypes.models import ContentType from django.db import models from django.db.models.base import Model diff --git a/typings/django/contrib/auth/__init__.pyi b/typings/django/contrib/auth/__init__.pyi index 025724589..a2a85f9fb 100644 --- a/typings/django/contrib/auth/__init__.pyi +++ b/typings/django/contrib/auth/__init__.pyi @@ -3,7 +3,6 @@ from typing import Any, List, Optional, Type, Union from django.contrib.auth.backends import ModelBackend from django.contrib.auth.base_user import AbstractBaseUser from django.contrib.auth.models import AnonymousUser -from django.core.handlers.wsgi import WSGIRequest from django.db.models.base import Model from django.db.models.options import Options from django.http.request import HttpRequest diff --git a/typings/django/contrib/auth/base_user.pyi b/typings/django/contrib/auth/base_user.pyi index 4bef91ae5..3d87ab57d 100644 --- a/typings/django/contrib/auth/base_user.pyi +++ b/typings/django/contrib/auth/base_user.pyi @@ -3,7 +3,6 @@ from typing import Any, List, Optional, Tuple, TypeVar, Union, overload from django.db import models from django.db.models.base import Model -from django.db.models.expressions import Combinable from django.db.models.fields import BooleanField if sys.version_info < (3, 8): diff --git a/typings/django/contrib/contenttypes/management/__init__.pyi b/typings/django/contrib/contenttypes/management/__init__.pyi index 4163cce0c..8f64295ad 100644 --- a/typings/django/contrib/contenttypes/management/__init__.pyi +++ b/typings/django/contrib/contenttypes/management/__init__.pyi @@ -1,4 +1,4 @@ -from typing import Any, Dict, List, Optional, Tuple, Type +from typing import Any, Dict, List, Tuple, Type from django.apps.config import AppConfig from django.apps.registry import Apps diff --git a/typings/django/contrib/flatpages/models.pyi b/typings/django/contrib/flatpages/models.pyi index fbeb355b0..8ff90e16a 100644 --- a/typings/django/contrib/flatpages/models.pyi +++ b/typings/django/contrib/flatpages/models.pyi @@ -1,6 +1,5 @@ from typing import Any -from django.contrib.sites.models import Site from django.db import models class FlatPage(models.Model): diff --git a/typings/django/contrib/gis/db/models/fields.pyi b/typings/django/contrib/gis/db/models/fields.pyi index c686edaa1..d63521ea9 100644 --- a/typings/django/contrib/gis/db/models/fields.pyi +++ b/typings/django/contrib/gis/db/models/fields.pyi @@ -46,7 +46,7 @@ class BaseSpatialField(Field[_ST, _GT]): db_tablespace: Optional[str] = ..., validators: Iterable[_ValidatorCallable] = ..., error_messages: Optional[_ErrorMessagesToOverride] = ..., - ): ... + ) -> None: ... def deconstruct(self) -> Any: ... def db_type(self, connection: Any) -> Any: ... def spheroid(self, connection: Any) -> Any: ... @@ -97,7 +97,7 @@ class GeometryField(BaseSpatialField[Any, Any]): db_tablespace: Optional[str] = ..., validators: Iterable[_ValidatorCallable] = ..., error_messages: Optional[_ErrorMessagesToOverride] = ..., - ): ... + ) -> None: ... def deconstruct(self) -> Any: ... def formfield(self, **kwargs: Any) -> Any: ... def select_format(self, compiler: Any, sql: Any, params: Any) -> Any: ... diff --git a/typings/django/contrib/gis/utils/__init__.pyi b/typings/django/contrib/gis/utils/__init__.pyi index 6eadf153d..55499fd35 100644 --- a/typings/django/contrib/gis/utils/__init__.pyi +++ b/typings/django/contrib/gis/utils/__init__.pyi @@ -1,2 +1,4 @@ -from django.contrib.gis.utils.layermapping import LayerMapError, LayerMapping -from django.contrib.gis.utils.ogrinspect import mapping, ogrinspect +from django.contrib.gis.utils.layermapping import LayerMapError as LayerMapError +from django.contrib.gis.utils.layermapping import LayerMapping as LayerMapping +from django.contrib.gis.utils.ogrinspect import mapping as mapping +from django.contrib.gis.utils.ogrinspect import ogrinspect as ogrinspect diff --git a/typings/django/contrib/messages/storage/__init__.pyi b/typings/django/contrib/messages/storage/__init__.pyi index a98ba21b4..3616d6f70 100644 --- a/typings/django/contrib/messages/storage/__init__.pyi +++ b/typings/django/contrib/messages/storage/__init__.pyi @@ -1,5 +1,3 @@ -from typing import Any, Optional - from django.contrib.messages.storage.base import BaseStorage from django.http.request import HttpRequest diff --git a/typings/django/contrib/postgres/constraints.pyi b/typings/django/contrib/postgres/constraints.pyi index b2e960506..a15611fcf 100644 --- a/typings/django/contrib/postgres/constraints.pyi +++ b/typings/django/contrib/postgres/constraints.pyi @@ -15,4 +15,4 @@ class ExclusionConstraint(BaseConstraint): expressions: Sequence[Tuple[Union[str, Combinable], str]], condition: Optional[Q] = ..., index_type: Optional[str] = ..., - ): ... + ) -> None: ... diff --git a/typings/django/contrib/postgres/fields/array.pyi b/typings/django/contrib/postgres/fields/array.pyi index 46cfdbc47..3583e610d 100644 --- a/typings/django/contrib/postgres/fields/array.pyi +++ b/typings/django/contrib/postgres/fields/array.pyi @@ -21,7 +21,7 @@ from typing_extensions import Literal from .mixins import CheckFieldDefaultMixin -_T = TypeVar("_T") +_T = TypeVar("_T", bound=Optional[List[Any]]) class ArrayField( Generic[_T], diff --git a/typings/django/contrib/postgres/fields/citext.pyi b/typings/django/contrib/postgres/fields/citext.pyi index 49c3430f5..c7f50bfd7 100644 --- a/typings/django/contrib/postgres/fields/citext.pyi +++ b/typings/django/contrib/postgres/fields/citext.pyi @@ -20,7 +20,7 @@ _FieldChoices = Iterable[Union[_Choice, _ChoiceNamedGroup]] _ValidatorCallable = Callable[..., None] _ErrorMessagesToOverride = Dict[str, Any] -_C = TypeVar("_C") +_C = TypeVar("_C", bound="Optional[str]") class CIText: ... @@ -76,7 +76,7 @@ class CICharField(CIText, CharField[_C]): error_messages: Optional[_ErrorMessagesToOverride] = ..., ) -> None: ... def __get__(self: CICharField[_C], instance: Any, owner: Any) -> _C: ... # type: ignore [override] - def __set__(self, instance: Any, value: _C) -> None: ... # type: ignore [override] + def __set__(self: CICharField[_C], instance: Any, value: _C) -> None: ... # type: ignore [override] class CIEmailField(CIText, EmailField[_C]): @overload @@ -184,4 +184,4 @@ class CITextField(CIText, TextField[_C]): error_messages: Optional[_ErrorMessagesToOverride] = ..., ) -> None: ... def __get__(self: CITextField[_C], instance: Any, owner: Any) -> _C: ... # type: ignore [override] - def __set__(self, instance: Any, value: _C) -> None: ... # type: ignore [override] + def __set__(self: CITextField[_C], instance: Any, value: _C) -> None: ... # type: ignore [override] diff --git a/typings/django/contrib/postgres/fields/hstore.pyi b/typings/django/contrib/postgres/fields/hstore.pyi index f7d1700b9..b8667937c 100644 --- a/typings/django/contrib/postgres/fields/hstore.pyi +++ b/typings/django/contrib/postgres/fields/hstore.pyi @@ -22,7 +22,7 @@ _FieldChoices = Iterable[Union[_Choice, _ChoiceNamedGroup]] _ValidatorCallable = Callable[..., None] _ErrorMessagesToOverride = Dict[str, Any] -_T = TypeVar("_T") +_T = TypeVar("_T", bound="Optional[Dict[str, Optional[str]]]") class HStoreField(Generic[_T], CheckFieldDefaultMixin, Field[Any, Any]): @overload diff --git a/typings/django/contrib/postgres/search.pyi b/typings/django/contrib/postgres/search.pyi index 30c7ccd13..31ed57a77 100644 --- a/typings/django/contrib/postgres/search.pyi +++ b/typings/django/contrib/postgres/search.pyi @@ -31,7 +31,7 @@ class CombinedSearchVector(SearchVectorCombinable, CombinedExpression): rhs: Any, config: Optional[_Expression] = ..., output_field: Optional[_OutputField] = ..., - ): ... + ) -> None: ... _T = TypeVar("_T", bound="SearchQueryCombinable") @@ -53,7 +53,7 @@ class SearchQuery(SearchQueryCombinable, Value): # type: ignore config: Optional[_Expression] = ..., invert: bool = ..., search_type: str = ... - ): ... + ) -> None: ... def __invert__(self: _T) -> _T: ... class CombinedSearchQuery(SearchQueryCombinable, CombinedExpression): # type: ignore diff --git a/typings/django/core/management/commands/startapp.pyi b/typings/django/core/management/commands/startapp.pyi index 0bd549a50..23198734e 100644 --- a/typings/django/core/management/commands/startapp.pyi +++ b/typings/django/core/management/commands/startapp.pyi @@ -1,5 +1,3 @@ -from typing import Any - from django.core.management.templates import TemplateCommand as TemplateCommand class Command(TemplateCommand): diff --git a/typings/django/db/__init__.pyi b/typings/django/db/__init__.pyi index 681a5ff2f..7427ad91f 100644 --- a/typings/django/db/__init__.pyi +++ b/typings/django/db/__init__.pyi @@ -2,7 +2,7 @@ from typing import Any from django.db.backends.utils import CursorWrapper -from . import migrations +from . import migrations as migrations from .utils import DEFAULT_DB_ALIAS as DEFAULT_DB_ALIAS from .utils import DJANGO_VERSION_PICKLE_KEY as DJANGO_VERSION_PICKLE_KEY from .utils import ConnectionDoesNotExist as ConnectionDoesNotExist diff --git a/typings/django/db/backends/base/introspection.pyi b/typings/django/db/backends/base/introspection.pyi index 853521f17..b438c21c9 100644 --- a/typings/django/db/backends/base/introspection.pyi +++ b/typings/django/db/backends/base/introspection.pyi @@ -1,16 +1,22 @@ -from collections import namedtuple -from typing import Any, Dict, List, Optional, Set, Type +from typing import Any, Dict, List, NamedTuple, Optional, Set, Type from django.db.backends.base.base import BaseDatabaseWrapper from django.db.backends.utils import CursorWrapper from django.db.models.base import Model -TableInfo = namedtuple("TableInfo", ["name", "type"]) +class TableInfo(NamedTuple): + name: Any + type: Any -FieldInfo = namedtuple( - "FieldInfo", - "name type_code display_size internal_size precision scale null_ok default", -) +class FieldInfo(NamedTuple): + name: Any + type_code: Any + display_size: Any + internal_size: Any + precision: Any + scale: Any + null_ok: Any + default: Any class BaseDatabaseIntrospection: data_types_reverse: Any = ... diff --git a/typings/django/db/backends/mysql/introspection.pyi b/typings/django/db/backends/mysql/introspection.pyi index e2636b733..605e15a56 100644 --- a/typings/django/db/backends/mysql/introspection.pyi +++ b/typings/django/db/backends/mysql/introspection.pyi @@ -1,15 +1,20 @@ -from collections import namedtuple -from typing import Any +from typing import Any, NamedTuple from django.db.backends.base.introspection import ( BaseDatabaseIntrospection as BaseDatabaseIntrospection, ) FieldInfo: Any -InfoLine = namedtuple( - "InfoLine", - "col_name data_type max_len num_prec num_scale extra column_default is_unsigned", -) + +class InfoLine(NamedTuple): + col_name: Any + data_type: Any + max_len: Any + num_prec: Any + num_scale: Any + extra: Any + column_default: Any + is_unsigned: Any class DatabaseIntrospection(BaseDatabaseIntrospection): data_types_reverse: Any = ... diff --git a/typings/django/db/backends/utils.pyi b/typings/django/db/backends/utils.pyi index 6fa2fd6b2..4b8f23622 100644 --- a/typings/django/db/backends/utils.pyi +++ b/typings/django/db/backends/utils.pyi @@ -4,7 +4,6 @@ from decimal import Decimal from typing import ( IO, Any, - Dict, Iterable, Iterator, List, diff --git a/typings/django/db/models/base.pyi b/typings/django/db/models/base.pyi index 40b27b93d..a419c43be 100644 --- a/typings/django/db/models/base.pyi +++ b/typings/django/db/models/base.pyi @@ -43,12 +43,15 @@ class Model(metaclass=ModelBase): # objects: BaseManager[Any] pk: Any = ... _state: ModelState - def __init__(self: _Self, *args: Any, **kwargs: Any) -> None: ... + def __init__(self, *args: Any, **kwargs: Any) -> None: ... @classmethod def add_to_class(cls, name: str, value: Any) -> Any: ... @classmethod def from_db( - cls, db: Optional[str], field_names: Collection[str], values: Collection[Any] + cls: Type[_Self], + db: Optional[str], + field_names: Collection[str], + values: Collection[Any], ) -> _Self: ... def delete( self, using: Any = ..., keep_parents: bool = ... @@ -60,7 +63,7 @@ class Model(metaclass=ModelBase): def clean_fields(self, exclude: Optional[Collection[str]] = ...) -> None: ... def validate_unique(self, exclude: Optional[Collection[str]] = ...) -> None: ... def unique_error_message( - self, + self: _Self, model_class: Type[_Self], unique_check: Collection[Union[Callable[..., Any], str]], ) -> ValidationError: ... @@ -80,7 +83,7 @@ class Model(metaclass=ModelBase): update_fields: Optional[Iterable[str]] = ..., ) -> Any: ... def refresh_from_db( - self: _Self, using: Optional[str] = ..., fields: Optional[List[str]] = ... + self, using: Optional[str] = ..., fields: Optional[List[str]] = ... ) -> None: ... def get_deferred_fields(self) -> Set[str]: ... @classmethod diff --git a/typings/django/db/models/constraints.pyi b/typings/django/db/models/constraints.pyi index 07fee6016..41ca5a412 100644 --- a/typings/django/db/models/constraints.pyi +++ b/typings/django/db/models/constraints.pyi @@ -36,4 +36,4 @@ class UniqueConstraint(BaseConstraint): condition: Optional[Q] def __init__( self, *, fields: Sequence[str], name: str, condition: Optional[Q] = ... - ): ... + ) -> None: ... diff --git a/typings/django/db/models/expressions.pyi b/typings/django/db/models/expressions.pyi index ade1ece64..4cef8e0a3 100644 --- a/typings/django/db/models/expressions.pyi +++ b/typings/django/db/models/expressions.pyi @@ -240,7 +240,7 @@ class Case(Expression): class ExpressionWrapper(Expression): def __init__( self, expression: Union[Q, Combinable], output_field: _OutputField - ): ... + ) -> None: ... class Col(Expression): def __init__( diff --git a/typings/django/db/models/fields/__init__.pyi b/typings/django/db/models/fields/__init__.pyi index 6395a36b6..75846e336 100644 --- a/typings/django/db/models/fields/__init__.pyi +++ b/typings/django/db/models/fields/__init__.pyi @@ -16,7 +16,6 @@ from typing import ( Union, overload, ) -from uuid import UUID from django.core.checks import CheckMessage from django.core.exceptions import FieldDoesNotExist as FieldDoesNotExist @@ -96,7 +95,7 @@ class Field(RegisterLookupMixin, Generic[_ST, _GT]): db_tablespace: Optional[str] = ..., validators: Iterable[_ValidatorCallable] = ..., error_messages: Optional[_ErrorMessagesToOverride] = ..., - ): ... + ) -> None: ... def __set__(self, instance: Any, value: _ST) -> None: ... # class access @overload @@ -146,7 +145,9 @@ class Field(RegisterLookupMixin, Generic[_ST, _GT]): def value_from_object(self, obj: Model) -> _GT: ... def get_attname(self) -> str: ... -class IntegerField(Generic[_C], Field[Union[float, int, str, Combinable], int]): +_I = TypeVar("_I", bound=Optional[int]) + +class IntegerField(Generic[_I], Field[Union[float, int, str, Combinable], int]): @overload def __init__( self: IntegerField[int], @@ -197,15 +198,17 @@ class IntegerField(Generic[_C], Field[Union[float, int, str, Combinable], int]): validators: Iterable[_ValidatorCallable] = ..., error_messages: Optional[_ErrorMessagesToOverride] = ..., ) -> None: ... - def __get__(self, instance: Any, owner: Any) -> _C: ... # type: ignore [override] + def __get__(self: IntegerField[_I], instance: Any, owner: Any) -> _I: ... # type: ignore [override] def __set__( - self, instance: Any, value: Union[str, float, int, Combinable, _C] + self: IntegerField[_I], + instance: Any, + value: Union[str, float, int, Combinable, _I], ) -> None: ... class PositiveIntegerRelDbTypeMixin: def rel_db_type(self, connection: Any) -> Any: ... -class PositiveIntegerField(PositiveIntegerRelDbTypeMixin, IntegerField[_C]): +class PositiveIntegerField(PositiveIntegerRelDbTypeMixin, IntegerField[_I]): @overload def __init__( self: PositiveIntegerField[int], @@ -256,12 +259,14 @@ class PositiveIntegerField(PositiveIntegerRelDbTypeMixin, IntegerField[_C]): validators: Iterable[_ValidatorCallable] = ..., error_messages: Optional[_ErrorMessagesToOverride] = ..., ) -> None: ... - def __get__(self, instance: Any, owner: Any) -> _C: ... # type: ignore [override] + def __get__(self: PositiveIntegerField[_I], instance: Any, owner: Any) -> _I: ... # type: ignore [override] def __set__( - self, instance: Any, value: Union[str, float, int, Combinable, _C] + self: PositiveIntegerField[_I], + instance: Any, + value: Union[str, float, int, Combinable, _I], ) -> None: ... -class PositiveSmallIntegerField(PositiveIntegerRelDbTypeMixin, IntegerField[_C]): +class PositiveSmallIntegerField(PositiveIntegerRelDbTypeMixin, IntegerField[_I]): @overload def __init__( self: PositiveSmallIntegerField[int], @@ -312,12 +317,14 @@ class PositiveSmallIntegerField(PositiveIntegerRelDbTypeMixin, IntegerField[_C]) validators: Iterable[_ValidatorCallable] = ..., error_messages: Optional[_ErrorMessagesToOverride] = ..., ) -> None: ... - def __get__(self, instance: Any, owner: Any) -> _C: ... # type: ignore [override] + def __get__(self: PositiveSmallIntegerField[_I], instance: Any, owner: Any) -> _I: ... # type: ignore [override] def __set__( - self, instance: Any, value: Union[str, float, int, Combinable, _C] + self: PositiveSmallIntegerField[_I], + instance: Any, + value: Union[str, float, int, Combinable, _I], ) -> None: ... -class SmallIntegerField(IntegerField[_C]): +class SmallIntegerField(IntegerField[_I]): @overload def __init__( self: SmallIntegerField[int], @@ -368,12 +375,12 @@ class SmallIntegerField(IntegerField[_C]): validators: Iterable[_ValidatorCallable] = ..., error_messages: Optional[_ErrorMessagesToOverride] = ..., ) -> None: ... - def __get__(self, instance: Any, owner: Any) -> _C: ... # type: ignore [override] + def __get__(self, instance: Any, owner: Any) -> _I: ... # type: ignore [override] def __set__( - self, instance: Any, value: Union[str, float, int, Combinable, _C] + self, instance: Any, value: Union[str, float, int, Combinable, _I] ) -> None: ... -class BigIntegerField(IntegerField[_C]): +class BigIntegerField(IntegerField[_I]): @overload def __init__( self: BigIntegerField[int], @@ -424,12 +431,14 @@ class BigIntegerField(IntegerField[_C]): validators: Iterable[_ValidatorCallable] = ..., error_messages: Optional[_ErrorMessagesToOverride] = ..., ) -> None: ... - def __get__(self, instance: Any, owner: Any) -> _C: ... # type: ignore [override] + def __get__(self, instance: Any, owner: Any) -> _I: ... # type: ignore [override] def __set__( - self, instance: Any, value: Union[str, float, int, Combinable, _C] + self, instance: Any, value: Union[str, float, int, Combinable, _I] ) -> None: ... -class FloatField(Generic[_C], Field[Union[float, int, str, Combinable], float]): +_F = TypeVar("_F", bound=Optional[float]) + +class FloatField(Generic[_F], Field[Union[float, int, str, Combinable], float]): @overload def __init__( self: FloatField[float], @@ -480,13 +489,16 @@ class FloatField(Generic[_C], Field[Union[float, int, str, Combinable], float]): validators: Iterable[_ValidatorCallable] = ..., error_messages: Optional[_ErrorMessagesToOverride] = ..., ) -> None: ... - def __get__(self, instance: Any, owner: Any) -> _C: ... # type: ignore [override] + def __get__(self, instance: Any, owner: Any) -> _F: ... # type: ignore [override] def __set__( - self, instance: Any, value: Union[str, float, int, Combinable, _C] + self, instance: Any, value: Union[str, float, int, Combinable, _F] ) -> None: ... +_DEC = TypeVar("_DEC", bound=Optional[decimal.Decimal]) + class DecimalField( - Generic[_C], Field[Union[str, float, decimal.Decimal, Combinable], decimal.Decimal] + Generic[_DEC], + Field[Union[str, float, decimal.Decimal, Combinable], decimal.Decimal], ): # attributes max_digits: int = ... @@ -513,7 +525,7 @@ class DecimalField( db_tablespace: Optional[str] = ..., validators: Iterable[_ValidatorCallable] = ..., error_messages: Optional[_ErrorMessagesToOverride] = ..., - ): ... + ) -> None: ... @overload def __init__( self: DecimalField[Optional[decimal.Decimal]], @@ -536,15 +548,15 @@ class DecimalField( db_tablespace: Optional[str] = ..., validators: Iterable[_ValidatorCallable] = ..., error_messages: Optional[_ErrorMessagesToOverride] = ..., - ): ... - def __get__(self, instance: Any, owner: Any) -> _C: ... # type: ignore [override] + ) -> None: ... + def __get__(self, instance: Any, owner: Any) -> _DEC: ... # type: ignore [override] def __set__( # type: ignore [override] - self, instance: Any, value: Union[str, float, Combinable, _C] + self, instance: Any, value: Union[str, float, Combinable, _DEC] ) -> None: ... class AutoField(Field[Union[Combinable, int, str, None], int]): ... -_C = TypeVar("_C") +_C = TypeVar("_C", bound="Optional[str]") class CharField(Generic[_C], Field[str, str]): @overload @@ -597,8 +609,8 @@ class CharField(Generic[_C], Field[str, str]): validators: Iterable[_ValidatorCallable] = ..., error_messages: Optional[_ErrorMessagesToOverride] = ..., ) -> None: ... - def __get__(self, instance: Any, owner: Any) -> _C: ... # type: ignore [override] - def __set__(self, instance: Any, value: _C) -> None: ... # type: ignore [override] + def __get__(self: CharField[_C], instance: Any, owner: Any) -> _C: ... # type: ignore [override] + def __set__(self: CharField[_C], instance: Any, value: _C) -> None: ... # type: ignore [override] class SlugField(CharField[_C]): @overload @@ -626,7 +638,7 @@ class SlugField(CharField[_C]): db_tablespace: Optional[str] = ..., validators: Iterable[_ValidatorCallable] = ..., error_messages: Optional[_ErrorMessagesToOverride] = ..., - ): ... + ) -> None: ... @overload def __init__( self: SlugField[Optional[str]], @@ -652,7 +664,7 @@ class SlugField(CharField[_C]): db_tablespace: Optional[str] = ..., validators: Iterable[_ValidatorCallable] = ..., error_messages: Optional[_ErrorMessagesToOverride] = ..., - ): ... + ) -> None: ... def __get__(self: SlugField[_C], instance: Any, owner: Any) -> _C: ... # type: ignore [override] def __set__(self, instance: Any, value: _C) -> None: ... # type: ignore [override] @@ -820,7 +832,9 @@ class TextField(Generic[_C], Field[str, str]): def __get__(self: TextField[_C], instance: Any, owner: Any) -> _C: ... # type: ignore [override] def __set__(self, instance: Any, value: _C) -> None: ... # type: ignore [override] -class BooleanField(Generic[_C], Field[Union[bool, Combinable], bool]): +_B = TypeVar("_B", bound=Optional[bool]) + +class BooleanField(Generic[_B], Field[Union[bool, Combinable], bool]): @overload def __init__( self: BooleanField[bool], @@ -845,7 +859,7 @@ class BooleanField(Generic[_C], Field[Union[bool, Combinable], bool]): db_tablespace: Optional[str] = ..., validators: Iterable[_ValidatorCallable] = ..., error_messages: Optional[_ErrorMessagesToOverride] = ..., - ): ... + ) -> None: ... @overload def __init__( self: BooleanField[Optional[bool]], @@ -870,9 +884,9 @@ class BooleanField(Generic[_C], Field[Union[bool, Combinable], bool]): db_tablespace: Optional[str] = ..., validators: Iterable[_ValidatorCallable] = ..., error_messages: Optional[_ErrorMessagesToOverride] = ..., - ): ... - def __get__(self, instance: Any, owner: Any) -> _C: ... # type: ignore [override] - def __set__(self, instance: Any, value: _C) -> None: ... # type: ignore [override] + ) -> None: ... + def __get__(self, instance: Any, owner: Any) -> _B: ... # type: ignore [override] + def __set__(self, instance: Any, value: _B) -> None: ... # type: ignore [override] class IPAddressField(Generic[_C], Field[Union[str, Combinable], str]): @overload @@ -899,7 +913,7 @@ class IPAddressField(Generic[_C], Field[Union[str, Combinable], str]): db_tablespace: Optional[str] = ..., validators: Iterable[_ValidatorCallable] = ..., error_messages: Optional[_ErrorMessagesToOverride] = ..., - ): ... + ) -> None: ... @overload def __init__( self: IPAddressField[Optional[str]], @@ -924,7 +938,7 @@ class IPAddressField(Generic[_C], Field[Union[str, Combinable], str]): db_tablespace: Optional[str] = ..., validators: Iterable[_ValidatorCallable] = ..., error_messages: Optional[_ErrorMessagesToOverride] = ..., - ): ... + ) -> None: ... def __get__(self, instance: Any, owner: Any) -> _C: ... # type: ignore [override] def __set__(self, instance: Any, value: _C) -> None: ... # type: ignore [override] @@ -1009,10 +1023,12 @@ class DateField(DateTimeCheckMixin, Field[Union[str, date, Combinable], date]): db_tablespace: Optional[str] = ..., validators: Iterable[_ValidatorCallable] = ..., error_messages: Optional[_ErrorMessagesToOverride] = ..., - ): ... + ) -> None: ... + +_TM = TypeVar("_TM", bound=Optional[time]) class TimeField( - Generic[_C], + Generic[_TM], DateTimeCheckMixin, Field[Union[str, time, datetime, Combinable], time], ): @@ -1038,7 +1054,7 @@ class TimeField( db_tablespace: Optional[str] = ..., validators: Iterable[_ValidatorCallable] = ..., error_messages: Optional[_ErrorMessagesToOverride] = ..., - ): ... + ) -> None: ... @overload def __init__( self: TimeField[Optional[time]], @@ -1061,9 +1077,9 @@ class TimeField( db_tablespace: Optional[str] = ..., validators: Iterable[_ValidatorCallable] = ..., error_messages: Optional[_ErrorMessagesToOverride] = ..., - ): ... - def __get__(self, instance: Any, owner: Any) -> _C: ... # type: ignore [override] - def __set__(self, instance: Any, value: _C) -> None: ... # type: ignore [override] + ) -> None: ... + def __get__(self, instance: Any, owner: Any) -> _TM: ... # type: ignore [override] + def __set__(self, instance: Any, value: _TM) -> None: ... # type: ignore [override] _DT = TypeVar("_DT", bound=Optional[datetime]) @@ -1121,7 +1137,9 @@ class DateTimeField( def __get__(self, instance: Any, owner: Any) -> _DT: ... # type: ignore [override] def __set__(self, instance: Any, value: _DT) -> None: ... # type: ignore [override] -class UUIDField(Generic[_C], Field[Union[str, uuid.UUID], uuid.UUID]): +_U = TypeVar("_U", bound=Optional[uuid.UUID]) + +class UUIDField(Generic[_U], Field[Union[str, uuid.UUID], uuid.UUID]): @overload def __init__( self: UUIDField[uuid.UUID], @@ -1172,8 +1190,8 @@ class UUIDField(Generic[_C], Field[Union[str, uuid.UUID], uuid.UUID]): validators: Iterable[_ValidatorCallable] = ..., error_messages: Optional[_ErrorMessagesToOverride] = ..., ) -> None: ... - def __get__(self, instance: Any, owner: Any) -> _C: ... # type: ignore [override] - def __set__(self, instance: Any, value: Union[str, _C]) -> None: ... # type: ignore [override] + def __get__(self, instance: Any, owner: Any) -> _U: ... # type: ignore [override] + def __set__(self, instance: Any, value: Union[str, _U]) -> None: ... # type: ignore [override] class FilePathField(Generic[_C], Field[str, str]): path: Any = ... @@ -1207,7 +1225,7 @@ class FilePathField(Generic[_C], Field[str, str]): db_tablespace: Optional[str] = ..., validators: Iterable[_ValidatorCallable] = ..., error_messages: Optional[_ErrorMessagesToOverride] = ..., - ): ... + ) -> None: ... @overload def __init__( self: FilePathField[Optional[str]], @@ -1234,11 +1252,13 @@ class FilePathField(Generic[_C], Field[str, str]): db_tablespace: Optional[str] = ..., validators: Iterable[_ValidatorCallable] = ..., error_messages: Optional[_ErrorMessagesToOverride] = ..., - ): ... + ) -> None: ... def __get__(self, instance: Any, owner: Any) -> _C: ... # type: ignore [override] def __set__(self, instance: Any, value: _C) -> None: ... # type: ignore [override] -class BinaryField(Generic[_C], Field[Union[bytes, bytearray, memoryview], bytes]): +_BIN = TypeVar("_BIN", bound=Optional[bytes]) + +class BinaryField(Generic[_BIN], Field[Union[bytes, bytearray, memoryview], bytes]): @overload def __init__( self: BinaryField[bytes], @@ -1263,7 +1283,7 @@ class BinaryField(Generic[_C], Field[Union[bytes, bytearray, memoryview], bytes] db_tablespace: Optional[str] = ..., validators: Iterable[_ValidatorCallable] = ..., error_messages: Optional[_ErrorMessagesToOverride] = ..., - ): ... + ) -> None: ... @overload def __init__( self: BinaryField[Optional[bytes]], @@ -1288,11 +1308,13 @@ class BinaryField(Generic[_C], Field[Union[bytes, bytearray, memoryview], bytes] db_tablespace: Optional[str] = ..., validators: Iterable[_ValidatorCallable] = ..., error_messages: Optional[_ErrorMessagesToOverride] = ..., - ): ... - def __get__(self, instance: Any, owner: Any) -> _C: ... # type: ignore [override] - def __set__(self, instance: Any, value: _C) -> None: ... # type: ignore [override] + ) -> None: ... + def __get__(self, instance: Any, owner: Any) -> _BIN: ... # type: ignore [override] + def __set__(self, instance: Any, value: _BIN) -> None: ... # type: ignore [override] -class DurationField(Generic[_C], Field[timedelta, timedelta]): +_TD = TypeVar("_TD", bound=Optional[timedelta]) + +class DurationField(Generic[_TD], Field[timedelta, timedelta]): @overload def __init__( self: DurationField[timedelta], @@ -1317,7 +1339,7 @@ class DurationField(Generic[_C], Field[timedelta, timedelta]): db_tablespace: Optional[str] = ..., validators: Iterable[_ValidatorCallable] = ..., error_messages: Optional[_ErrorMessagesToOverride] = ..., - ): ... + ) -> None: ... @overload def __init__( self: DurationField[Optional[timedelta]], @@ -1342,8 +1364,8 @@ class DurationField(Generic[_C], Field[timedelta, timedelta]): db_tablespace: Optional[str] = ..., validators: Iterable[_ValidatorCallable] = ..., error_messages: Optional[_ErrorMessagesToOverride] = ..., - ): ... - def __get__(self, instance: Any, owner: Any) -> _C: ... # type: ignore [override] - def __set__(self, instance: Any, value: _C) -> None: ... # type: ignore [override] + ) -> None: ... + def __get__(self, instance: Any, owner: Any) -> _TD: ... # type: ignore [override] + def __set__(self, instance: Any, value: _TD) -> None: ... # type: ignore [override] class BigAutoField(AutoField): ... diff --git a/typings/django/db/models/fields/files.pyi b/typings/django/db/models/fields/files.pyi index 2cdc36397..68b77e72f 100644 --- a/typings/django/db/models/fields/files.pyi +++ b/typings/django/db/models/fields/files.pyi @@ -68,7 +68,7 @@ class FileField(Field[Any, Any]): db_tablespace: Optional[str] = ..., validators: Iterable[_ValidatorCallable] = ..., error_messages: Optional[_ErrorMessagesToOverride] = ..., - ): ... + ) -> None: ... # class access @overload # type: ignore def __get__(self, instance: None, owner: Any) -> FileDescriptor: ... diff --git a/typings/django/db/models/fields/related.pyi b/typings/django/db/models/fields/related.pyi index 940ab28d5..557939a5a 100644 --- a/typings/django/db/models/fields/related.pyi +++ b/typings/django/db/models/fields/related.pyi @@ -17,7 +17,6 @@ from uuid import UUID from django.db import models from django.db.models.base import Model -from django.db.models.expressions import Combinable from django.db.models.fields import Field from django.db.models.fields.mixins import FieldCacheMixin from django.db.models.fields.related_descriptors import ( @@ -112,7 +111,7 @@ class ForeignObject(RelatedField[_M, _M]): db_tablespace: Optional[str] = ..., validators: Iterable[_ValidatorCallable] = ..., error_messages: Optional[_ErrorMessagesToOverride] = ..., - ): ... + ) -> None: ... class ForeignKey(Generic[_M], ForeignObject[_M]): @overload @@ -147,7 +146,7 @@ class ForeignKey(Generic[_M], ForeignObject[_M]): db_tablespace: Optional[str] = ..., validators: Iterable[_ValidatorCallable] = ..., error_messages: Optional[_ErrorMessagesToOverride] = ..., - ): ... + ) -> None: ... @overload def __init__( self: ForeignKey[Optional[_M]], @@ -180,7 +179,7 @@ class ForeignKey(Generic[_M], ForeignObject[_M]): db_tablespace: Optional[str] = ..., validators: Iterable[_ValidatorCallable] = ..., error_messages: Optional[_ErrorMessagesToOverride] = ..., - ): ... + ) -> None: ... # class access @overload # type: ignore def __get__(self, instance: None, owner: Any) -> ForwardManyToOneDescriptor: ... @@ -228,7 +227,7 @@ class OneToOneField(Generic[_M], RelatedField[_M, _M]): db_tablespace: Optional[str] = ..., validators: Iterable[_ValidatorCallable] = ..., error_messages: Optional[_ErrorMessagesToOverride] = ..., - ): ... + ) -> None: ... @overload def __init__( self: OneToOneField[Optional[_M]], @@ -261,7 +260,7 @@ class OneToOneField(Generic[_M], RelatedField[_M, _M]): db_tablespace: Optional[str] = ..., validators: Iterable[_ValidatorCallable] = ..., error_messages: Optional[_ErrorMessagesToOverride] = ..., - ): ... + ) -> None: ... # class access @overload # type: ignore def __get__(self, instance: None, owner: Any) -> ForwardOneToOneDescriptor: ... @@ -284,7 +283,7 @@ class ManyToManyField(RelatedField[Sequence[Any], RelatedManager[Any]]): swappable: bool = ... def __init__( self, - to: Union[Type[_T], str], + to: Union[Type[Any], str], related_name: Optional[str] = ..., related_query_name: Optional[str] = ..., limit_choices_to: Optional[Union[Dict[str, Any], Callable[[], Any], Q]] = ..., diff --git a/typings/django/db/models/query.pyi b/typings/django/db/models/query.pyi index 937a2d017..3371d327f 100644 --- a/typings/django/db/models/query.pyi +++ b/typings/django/db/models/query.pyi @@ -108,7 +108,7 @@ class _BaseQuerySet(Generic[_T], Sized): def all(self: _QS) -> _QS: ... def filter(self: _QS, *args: Any, **kwargs: Any) -> _QS: ... def exclude(self: _QS, *args: Any, **kwargs: Any) -> _QS: ... - def complex_filter(self, filter_obj: Any) -> _QS: ... + def complex_filter(self: _QS, filter_obj: Any) -> _QS: ... def count(self) -> int: ... def union(self: _QS, *other_qs: Any, all: bool = ...) -> _QS: ... def intersection(self: _QS, *other_qs: Any) -> _QS: ... @@ -159,7 +159,7 @@ class BaseIterable(Sequence[_Row]): queryset: _BaseQuerySet[Any], chunked_fetch: bool = ..., chunk_size: int = ..., - ): ... + ) -> None: ... def __iter__(self) -> Iterator[_Row]: ... def __contains__(self, x: object) -> bool: ... def __len__(self) -> int: ... @@ -238,7 +238,7 @@ class Prefetch(object): def get_current_queryset(self, level: int) -> Optional[QuerySet[Any]]: ... def prefetch_related_objects( - model_instances: Iterable[_T], *related_lookups: Union[str, Prefetch] + model_instances: Iterable[models.Model], *related_lookups: Union[str, Prefetch] ) -> None: ... def get_prefetcher( instance: Model, through_attr: str, to_attr: str diff --git a/typings/django/db/models/query_utils.pyi b/typings/django/db/models/query_utils.pyi index 74dddbf82..788ebcbfe 100644 --- a/typings/django/db/models/query_utils.pyi +++ b/typings/django/db/models/query_utils.pyi @@ -1,4 +1,3 @@ -from collections import namedtuple from typing import ( Any, Collection, @@ -6,6 +5,7 @@ from typing import ( Iterator, List, Mapping, + NamedTuple, Optional, Sequence, Set, @@ -21,10 +21,14 @@ from django.db.models.sql.query import Query from django.db.models.sql.where import WhereNode from django.utils import tree -PathInfo = namedtuple( - "PathInfo", - "from_opts to_opts target_fields join_field m2m direct filtered_relation", -) +class PathInfo(NamedTuple): + from_opts: Any + to_opts: Any + target_fields: Any + join_field: Any + m2m: Any + direct: Any + filtered_relation: Any class InvalidQuery(Exception): ... diff --git a/typings/django/db/models/sql/query.pyi b/typings/django/db/models/sql/query.pyi index cfe5446a8..5f02df055 100644 --- a/typings/django/db/models/sql/query.pyi +++ b/typings/django/db/models/sql/query.pyi @@ -1,4 +1,4 @@ -from collections import OrderedDict, namedtuple +from collections import OrderedDict from typing import ( Any, Callable, @@ -8,6 +8,7 @@ from typing import ( Iterable, Iterator, List, + NamedTuple, Optional, Sequence, Set, @@ -24,10 +25,13 @@ from django.db.models.sql.compiler import SQLCompiler from django.db.models.sql.datastructures import BaseTable from django.db.models.sql.where import WhereNode -JoinInfo = namedtuple( - "JoinInfo", - ["final_field", "targets", "opts", "joins", "path", "transform_function"], -) +class JoinInfo(NamedTuple): + final_field: Any + targets: Any + opts: Any + joins: Any + path: Any + transform_function: Any class RawQuery: high_mark: Optional[int] diff --git a/typings/django/forms/__init__.pyi b/typings/django/forms/__init__.pyi index 463615f6c..29b9310a1 100644 --- a/typings/django/forms/__init__.pyi +++ b/typings/django/forms/__init__.pyi @@ -1,5 +1,6 @@ from django.core.exceptions import ValidationError as ValidationError +from . import utils as utils from .boundfield import BoundField as BoundField from .boundfield import BoundWidget as BoundWidget from .fields import BooleanField as BooleanField diff --git a/typings/django/forms/widgets.pyi b/typings/django/forms/widgets.pyi index 85e45b89b..b55844eff 100644 --- a/typings/django/forms/widgets.pyi +++ b/typings/django/forms/widgets.pyi @@ -117,7 +117,7 @@ class DateTimeBaseInput(TextInput): format: Optional[str] = ... def __init__( self, attrs: Optional[_OptAttrs] = ..., format: Optional[str] = ... - ): ... + ) -> None: ... class DateInput(DateTimeBaseInput): ... class DateTimeInput(DateTimeBaseInput): ... diff --git a/typings/django/template/defaulttags.pyi b/typings/django/template/defaulttags.pyi index 00c7ea1fa..2624cc774 100644 --- a/typings/django/template/defaulttags.pyi +++ b/typings/django/template/defaulttags.pyi @@ -1,6 +1,5 @@ -from collections import namedtuple from datetime import date -from typing import Any, Dict, List, Optional, Sequence, Tuple, Union +from typing import Any, Dict, List, NamedTuple, Optional, Sequence, Tuple, Union from django.template.base import FilterExpression, Parser, Token from django.template.context import Context @@ -101,7 +100,9 @@ class LoremNode(Node): method: str def __init__(self, count: FilterExpression, method: str, common: bool) -> None: ... -GroupedResult = namedtuple("GroupedResult", ["grouper", "list"]) +class GroupedResult(NamedTuple): + grouper: Any + list: Any class RegroupNode(Node): expression: FilterExpression diff --git a/typings/django/utils/log.pyi b/typings/django/utils/log.pyi index 509bd6688..0e4f9a906 100644 --- a/typings/django/utils/log.pyi +++ b/typings/django/utils/log.pyi @@ -1,4 +1,4 @@ -import logging.config +import logging from logging import LogRecord from typing import Any, Callable, Dict, Optional, Union diff --git a/typings/django/utils/six.pyi b/typings/django/utils/six.pyi index a6079cc5b..d7c3995d5 100644 --- a/typings/django/utils/six.pyi +++ b/typings/django/utils/six.pyi @@ -64,14 +64,14 @@ def get_function_closure( def get_function_code(fun: types.FunctionType) -> types.CodeType: ... def get_function_defaults(fun: types.FunctionType) -> Optional[Tuple[Any, ...]]: ... def get_function_globals(fun: types.FunctionType) -> Dict[str, Any]: ... -def iterkeys(d: Mapping[_K, _V]) -> typing.Iterator[_K]: ... -def itervalues(d: Mapping[_K, _V]) -> typing.Iterator[_V]: ... +def iterkeys(d: Mapping[_K, object]) -> typing.Iterator[_K]: ... +def itervalues(d: Mapping[object, _V]) -> typing.Iterator[_V]: ... def iteritems(d: Mapping[_K, _V]) -> typing.Iterator[Tuple[_K, _V]]: ... # def iterlists -def viewkeys(d: Mapping[_K, _V]) -> KeysView[_K]: ... -def viewvalues(d: Mapping[_K, _V]) -> ValuesView[_V]: ... +def viewkeys(d: Mapping[_K, object]) -> KeysView[_K]: ... +def viewvalues(d: Mapping[object, _V]) -> ValuesView[_V]: ... def viewitems(d: Mapping[_K, _V]) -> ItemsView[_K, _V]: ... def b(s: str) -> binary_type: ... def u(s: str) -> text_type: ... From 1c541ae61144c9c1db01971fea45407153d7925b Mon Sep 17 00:00:00 2001 From: Steve Dignam Date: Sat, 27 Feb 2021 11:43:01 -0500 Subject: [PATCH 33/88] add(docs): related projects (#6) --- README.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/README.md b/README.md index 25062d0aa..d9bf7a3c1 100644 --- a/README.md +++ b/README.md @@ -157,3 +157,10 @@ Then the following will type error: def activity(request: HttpRequest, team_id: str) -> HttpResponse: ... ``` + +## related + +- +- +- +- From 6e3a991e3c50513923fb76231d197c403dffaea3 Mon Sep 17 00:00:00 2001 From: Steve Dignam Date: Sat, 27 Feb 2021 17:21:28 -0500 Subject: [PATCH 34/88] release: 0.4.2 (#7) --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index bb2d95667..3ad663638 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "django-types" -version = "0.4.1" +version = "0.4.2" description = "Type stubs for Django" repository = "https://github.com/sbdchd/django-types" readme = "README.md" From 0e1ae913ade0252d51eace594e3608fe862758eb Mon Sep 17 00:00:00 2001 From: Steve Dignam Date: Sat, 27 Feb 2021 17:55:27 -0500 Subject: [PATCH 35/88] add(django): type more decorators (#8) Update various decorators type so they don't change the function types to `Any`. --- tests/trout/models.py | 74 ++++++++++++++++++++++- typings/django/contrib/auth/admin.pyi | 8 ++- typings/django/utils/decorators.pyi | 4 +- typings/django/views/decorators/cache.pyi | 4 +- typings/django/views/decorators/debug.pyi | 8 ++- typings/django/views/decorators/http.pyi | 2 +- 6 files changed, 87 insertions(+), 13 deletions(-) diff --git a/tests/trout/models.py b/tests/trout/models.py index 727f86ed1..254566181 100644 --- a/tests/trout/models.py +++ b/tests/trout/models.py @@ -3,7 +3,7 @@ from datetime import time, timedelta from decimal import Decimal from io import StringIO -from typing import Any, Dict, Iterable, List, NamedTuple, Optional, Tuple, Union +from typing import Any, Dict, List, Optional, Tuple, Union from uuid import UUID import psycopg2 @@ -19,7 +19,21 @@ from django.db.backends.utils import CursorWrapper from django.db.models.manager import RelatedManager from django.http.request import HttpRequest -from django.views.decorators.http import require_GET, require_POST +from django.http.response import HttpResponse +from django.middleware.cache import CacheMiddleware +from django.utils.decorators import ( + decorator_from_middleware, + decorator_from_middleware_with_args, +) +from django.views.decorators.cache import cache_control, cache_page, never_cache +from django.views.decorators.debug import sensitive_post_parameters, sensitive_variables +from django.views.decorators.gzip import gzip_page +from django.views.decorators.http import ( + condition, + last_modified, + require_GET, + require_POST, +) from psycopg2 import ProgrammingError from psycopg2.extensions import parse_dsn @@ -704,6 +718,62 @@ def get_data_view(request: HttpRequest, id: str) -> None: return None +@cache_page(3600) +def cached_page_view(request: HttpRequest) -> HttpResponse: + ... + + +@cache_control(private=True) +def cache_control_view(request: HttpRequest) -> HttpResponse: + ... + + +cache_page_2 = decorator_from_middleware_with_args(CacheMiddleware) + + +@cache_page_2(3600) +def cached_view_take_2(request: HttpRequest) -> HttpResponse: + ... + + +cache_page_3_no_args = decorator_from_middleware(CacheMiddleware) + + +@cache_page_3_no_args +def cached_view_take_3(request: HttpRequest) -> HttpResponse: + ... + + +@never_cache +@gzip_page +def compressed_view(request: HttpRequest, id: str) -> HttpResponse: + ... + + +def latest_entry(request: HttpRequest, blog_id: str) -> bool: + ... + + +@condition(last_modified_func=latest_entry) +def front_page(request: HttpRequest, blog_id: str) -> HttpResponse: + ... + + +@last_modified(latest_entry) +def front_page_2(request: HttpRequest, blog_id: str) -> HttpResponse: + ... + + +@sensitive_post_parameters("password") +def login_view(request: HttpRequest) -> HttpResponse: + ... + + +@sensitive_variables("password") +def signup_view(request: HttpRequest) -> HttpResponse: + ... + + def test_psycopg_top_level_exports() -> None: psycopg2.BINARY psycopg2.Binary diff --git a/typings/django/contrib/auth/admin.pyi b/typings/django/contrib/auth/admin.pyi index 9a02c62af..4cb08caeb 100644 --- a/typings/django/contrib/auth/admin.pyi +++ b/typings/django/contrib/auth/admin.pyi @@ -1,11 +1,13 @@ -from typing import Any +from typing import Any, Callable, TypeVar from django.contrib import admin from django.core.handlers.wsgi import WSGIRequest from django.http.response import HttpResponse -csrf_protect_m: Any -sensitive_post_parameters_m: Any +_F = TypeVar("_F", bound=Callable[..., Any]) + +def csrf_protect_m(func: _F) -> _F: ... +def sensitive_post_parameters_m(func: _F) -> _F: ... class GroupAdmin(admin.ModelAdmin[Any]): ... diff --git a/typings/django/utils/decorators.pyi b/typings/django/utils/decorators.pyi index a5d2f4d37..aa627c354 100644 --- a/typings/django/utils/decorators.pyi +++ b/typings/django/utils/decorators.pyi @@ -12,8 +12,8 @@ def method_decorator( ) -> Callable[[_T], _T]: ... def decorator_from_middleware_with_args( middleware_class: type, -) -> Callable[..., Any]: ... -def decorator_from_middleware(middleware_class: type) -> Callable[..., Any]: ... +) -> Callable[..., Callable[[_T], _T]]: ... +def decorator_from_middleware(middleware_class: type) -> Callable[[_T], _T]: ... def available_attrs(fn: Callable[..., Any]) -> Any: ... def make_middleware_decorator( middleware_class: Type[MiddlewareMixin], diff --git a/typings/django/views/decorators/cache.pyi b/typings/django/views/decorators/cache.pyi index 5cabe0b9b..f97b03e18 100644 --- a/typings/django/views/decorators/cache.pyi +++ b/typings/django/views/decorators/cache.pyi @@ -4,6 +4,6 @@ _F = TypeVar("_F", bound=Callable[..., Any]) def cache_page( timeout: float, *, cache: Optional[Any] = ..., key_prefix: Optional[Any] = ... -) -> Callable[..., Any]: ... -def cache_control(**kwargs: Any) -> Callable[..., Any]: ... +) -> Callable[[_F], _F]: ... +def cache_control(**kwargs: Any) -> Callable[[_F], _F]: ... def never_cache(view_func: _F) -> _F: ... diff --git a/typings/django/views/decorators/debug.pyi b/typings/django/views/decorators/debug.pyi index 47b2f6251..6b6848117 100644 --- a/typings/django/views/decorators/debug.pyi +++ b/typings/django/views/decorators/debug.pyi @@ -1,4 +1,6 @@ -from typing import Any, Callable +from typing import Any, Callable, TypeVar -def sensitive_variables(*variables: Any) -> Callable[..., Any]: ... -def sensitive_post_parameters(*parameters: Any) -> Callable[..., Any]: ... +_F = TypeVar("_F", bound=Callable[..., Any]) + +def sensitive_variables(*variables: str) -> Callable[[_F], _F]: ... +def sensitive_post_parameters(*parameters: str) -> Callable[[_F], _F]: ... diff --git a/typings/django/views/decorators/http.pyi b/typings/django/views/decorators/http.pyi index be2c065a1..2e4b2482f 100644 --- a/typings/django/views/decorators/http.pyi +++ b/typings/django/views/decorators/http.pyi @@ -10,6 +10,6 @@ def require_safe(func: _F) -> _F: ... def condition( etag_func: Optional[Callable[..., Any]] = ..., last_modified_func: Optional[Callable[..., Any]] = ..., -) -> Callable[..., Any]: ... +) -> Callable[[_F], _F]: ... def etag(etag_func: Callable[..., Any]) -> Callable[[_F], _F]: ... def last_modified(last_modified_func: Callable[..., Any]) -> Callable[[_F], _F]: ... From ab66036131c51ecd56581bb7543e3137d1f5daf3 Mon Sep 17 00:00:00 2001 From: Steve Dignam Date: Sat, 27 Feb 2021 18:07:19 -0500 Subject: [PATCH 36/88] release: 0.5.0 (#9) --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 3ad663638..c29a1e745 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "django-types" -version = "0.4.2" +version = "0.5.0" description = "Type stubs for Django" repository = "https://github.com/sbdchd/django-types" readme = "README.md" From 168f1086d00b303e8fadd6c8280878c4924d85a9 Mon Sep 17 00:00:00 2001 From: Steve Dignam Date: Sat, 27 Feb 2021 19:47:00 -0500 Subject: [PATCH 37/88] add(django): type csrf and vary decorators (#10) --- typings/django/views/decorators/csrf.pyi | 11 +++++------ typings/django/views/decorators/vary.pyi | 2 +- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/typings/django/views/decorators/csrf.pyi b/typings/django/views/decorators/csrf.pyi index 7e8a3474e..995234d79 100644 --- a/typings/django/views/decorators/csrf.pyi +++ b/typings/django/views/decorators/csrf.pyi @@ -2,11 +2,13 @@ from typing import Any, Callable, TypeVar from django.middleware.csrf import CsrfViewMiddleware -csrf_protect: Any +_F = TypeVar("_F", bound=Callable[..., Any]) + +def csrf_protect(__view: _F) -> _F: ... class _EnsureCsrfToken(CsrfViewMiddleware): ... -requires_csrf_token: Any +def requires_csrf_token(__view: _F) -> _F: ... class _EnsureCsrfCookie(CsrfViewMiddleware): get_response: None @@ -14,8 +16,5 @@ class _EnsureCsrfCookie(CsrfViewMiddleware): self, request: Any, callback: Any, callback_args: Any, callback_kwargs: Any ) -> Any: ... -ensure_csrf_cookie: Any - -_F = TypeVar("_F", bound=Callable[..., Any]) - +def ensure_csrf_cookie(__view: _F) -> _F: ... def csrf_exempt(view_func: _F) -> _F: ... diff --git a/typings/django/views/decorators/vary.pyi b/typings/django/views/decorators/vary.pyi index 622f22f75..681a484c7 100644 --- a/typings/django/views/decorators/vary.pyi +++ b/typings/django/views/decorators/vary.pyi @@ -2,5 +2,5 @@ from typing import Any, Callable, TypeVar _F = TypeVar("_F", bound=Callable[..., Any]) -def vary_on_headers(*headers: Any) -> Callable[..., Any]: ... +def vary_on_headers(*headers: str) -> Callable[[_F], _F]: ... def vary_on_cookie(func: _F) -> _F: ... From 2242c3255284e6d2a89c43dbdc0958063faff9a9 Mon Sep 17 00:00:00 2001 From: Steve Dignam Date: Mon, 1 Mar 2021 16:52:27 -0500 Subject: [PATCH 38/88] add pyright (#11) --- package.json | 2 +- s/lint | 6 +----- yarn.lock | 8 ++++---- 3 files changed, 6 insertions(+), 10 deletions(-) diff --git a/package.json b/package.json index faef8b0d6..c33872bc8 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { "devDependencies": { - "pyright": "^1.1.115" + "pyright": "^1.1.116" } } diff --git a/s/lint b/s/lint index 1d27ecfc1..e72bb1cd6 100755 --- a/s/lint +++ b/s/lint @@ -15,11 +15,7 @@ fi # type check code ./.venv/bin/mypy tests typings - -# TODO(sbdchd): re-enable once the latest pyright ships -if [[ -z $CI ]]; then - ./node_modules/.bin/pyright typings -fi +./node_modules/.bin/pyright typings # lint ./.venv/bin/flake8 tests typings diff --git a/yarn.lock b/yarn.lock index f91b8e3fa..e2ac0921d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2,7 +2,7 @@ # yarn lockfile v1 -pyright@^1.1.115: - version "1.1.115" - resolved "https://registry.yarnpkg.com/pyright/-/pyright-1.1.115.tgz#3568f64d85bc859052498276a35231e6930ecccc" - integrity sha512-MFi3Q7agfL1MRTkBTkqitfS1FIwPFZ8viB7f2w4GySBKOXQJSC66iRdXnWmLqkrUi3hSHefu/rt4ul1/8YyTeA== +pyright@^1.1.116: + version "1.1.116" + resolved "https://registry.yarnpkg.com/pyright/-/pyright-1.1.116.tgz#202abd42424d84ad3929347c99a2a45ac54364d6" + integrity sha512-SdsLo/bahs+ncCYIY7E4bL/B+ZuI/OdKJudNuUFAJciXEkkkp2ICzpzQSt0n4ZeYsPfqb5g48QoGo7x4a+LDcQ== From 17c4423c178d535c56b3021983b2fa895aa23f70 Mon Sep 17 00:00:00 2001 From: Steve Dignam Date: Sat, 20 Mar 2021 18:37:39 -0400 Subject: [PATCH 39/88] add: orm example & ignore system links from search (#13) --- .ignore | 2 ++ tests/trout/models.py | 6 +++++- 2 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 .ignore diff --git a/.ignore b/.ignore new file mode 100644 index 000000000..b07cd0f98 --- /dev/null +++ b/.ignore @@ -0,0 +1,2 @@ +django-stubs +psycopg2-stubs diff --git a/tests/trout/models.py b/tests/trout/models.py index 254566181..422722ca0 100644 --- a/tests/trout/models.py +++ b/tests/trout/models.py @@ -17,7 +17,7 @@ ) from django.db import connection, connections, models from django.db.backends.utils import CursorWrapper -from django.db.models.manager import RelatedManager +from django.db.models.manager import Manager, RelatedManager from django.http.request import HttpRequest from django.http.response import HttpResponse from django.middleware.cache import CacheMiddleware @@ -194,6 +194,8 @@ class Comment(models.Model): metadata = JSONField() + objects = Manager["Comment"]() + def process_non_nullable( x: Union[ @@ -231,6 +233,8 @@ def main() -> None: comment.auth_token = User() comment.save() + Comment.objects.filter(foo=True).filter(bar=False).first() + # Django way to duplicate an instance comment.id = None comment.save() From 3288b0b4e451170e5558ca55d3748190d5ab3d13 Mon Sep 17 00:00:00 2001 From: Kyle Bebak Date: Sun, 21 Mar 2021 21:33:25 -0600 Subject: [PATCH 40/88] Export JSONField from django.db.models (#15) Closes #14 --- tests/trout/models.py | 1 + typings/django/db/models/__init__.pyi | 1 + 2 files changed, 2 insertions(+) diff --git a/tests/trout/models.py b/tests/trout/models.py index 422722ca0..d1c0aed7c 100644 --- a/tests/trout/models.py +++ b/tests/trout/models.py @@ -193,6 +193,7 @@ class Comment(models.Model): ) metadata = JSONField() + other_metadata = models.JSONField() objects = Manager["Comment"]() diff --git a/typings/django/db/models/__init__.pyi b/typings/django/db/models/__init__.pyi index c2b95ce82..f154dd2c5 100644 --- a/typings/django/db/models/__init__.pyi +++ b/typings/django/db/models/__init__.pyi @@ -79,6 +79,7 @@ from .fields.files import FieldFile as FieldFile from .fields.files import FileDescriptor as FileDescriptor from .fields.files import FileField as FileField from .fields.files import ImageField as ImageField +from .fields.json import JSONField as JSONField from .fields.proxy import OrderWrt as OrderWrt from .fields.related import ForeignKey as ForeignKey from .fields.related import ForeignObject as ForeignObject From 98ba8bed44eae9449c05f980af1759f0cdf5ca98 Mon Sep 17 00:00:00 2001 From: Steve Dignam Date: Sun, 21 Mar 2021 23:39:08 -0400 Subject: [PATCH 41/88] release: 0.5.1 (#16) - add missing json model field export (#15) - type csrf and vary decorators (#10) --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index c29a1e745..7d68e809d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "django-types" -version = "0.5.0" +version = "0.5.1" description = "Type stubs for Django" repository = "https://github.com/sbdchd/django-types" readme = "README.md" From 774ca958c4bad116118d11d574406b24c2e9e548 Mon Sep 17 00:00:00 2001 From: Christopher Dignam Date: Fri, 2 Apr 2021 13:52:16 -0400 Subject: [PATCH 42/88] fix link to django-stubs-ext in readme (#17) --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index d9bf7a3c1..3d5aee221 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ pip install django-types If you're on a Django version < 3.1, you'll need to monkey patch Django's `QuerySet` and `Manager` classes so we can index into them with a generic -argument. You can either use [`django-stubs-ext`](https://pypi.org/project/django-stubs-ext/`) or do this yourself manually: +argument. You can either use [`django-stubs-ext`](https://pypi.org/project/django-stubs-ext/) or do this yourself manually: ```python # in settings.py From 3d097c8a27c7c576d885741b4ceaa4125bf25316 Mon Sep 17 00:00:00 2001 From: Christopher Dignam Date: Mon, 12 Apr 2021 09:14:18 -0400 Subject: [PATCH 43/88] update: run pyright against tests (#18) This change also fixes foreign key fields for pyright. Mypy previously supported foreign keys and still does. --- package.json | 2 +- pyrightconfig.json | 3 +- s/lint | 2 +- tests/bear/bear/settings.py | 4 +- tests/trout/models.py | 14 +++-- .../django/contrib/postgres/fields/array.pyi | 12 ++-- .../management/commands/compilemessages.pyi | 4 +- typings/django/db/models/fields/__init__.pyi | 6 +- typings/django/db/models/fields/related.pyi | 38 ++++++------- typings/django/utils/encoding.pyi | 55 ++----------------- typings/django/utils/safestring.pyi | 8 +-- yarn.lock | 8 +-- 12 files changed, 53 insertions(+), 103 deletions(-) diff --git a/package.json b/package.json index c33872bc8..f1bbaf23f 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { "devDependencies": { - "pyright": "^1.1.116" + "pyright": "^1.1.129" } } diff --git a/pyrightconfig.json b/pyrightconfig.json index 67f39f8ae..4aa459118 100644 --- a/pyrightconfig.json +++ b/pyrightconfig.json @@ -1,5 +1,6 @@ { "typeCheckingMode": "strict", "reportPrivateUsage": false, - "reportMissingModuleSource": false + "reportMissingModuleSource": false, + "reportUnnecessaryIsInstance": false } diff --git a/s/lint b/s/lint index e72bb1cd6..261c3f265 100755 --- a/s/lint +++ b/s/lint @@ -15,7 +15,7 @@ fi # type check code ./.venv/bin/mypy tests typings -./node_modules/.bin/pyright typings +./node_modules/.bin/pyright tests typings # lint ./.venv/bin/flake8 tests typings diff --git a/tests/bear/bear/settings.py b/tests/bear/bear/settings.py index 90a5f93bf..973fb49ad 100644 --- a/tests/bear/bear/settings.py +++ b/tests/bear/bear/settings.py @@ -11,7 +11,7 @@ """ from pathlib import Path -from typing import List +from typing import Any, Dict, List # Build paths inside the project like this: BASE_DIR / 'subdir'. BASE_DIR = Path(__file__).resolve().parent.parent @@ -52,7 +52,7 @@ ROOT_URLCONF = "bear.urls" -TEMPLATES = [ +TEMPLATES: List[Dict[str, Any]] = [ { "BACKEND": "django.template.backends.django.DjangoTemplates", "DIRS": [], diff --git a/tests/trout/models.py b/tests/trout/models.py index d1c0aed7c..fe997d00b 100644 --- a/tests/trout/models.py +++ b/tests/trout/models.py @@ -182,10 +182,12 @@ class Comment(models.Model): ) user_type = models.ForeignKey(User, on_delete=models.CASCADE) - user_str = models.ForeignKey("User", on_delete=models.CASCADE) # type: ignore [var-annotated] + user_str = models.ForeignKey[User]("User", on_delete=models.CASCADE) nullable_user_type = models.ForeignKey(User, on_delete=models.CASCADE, null=True) - nullable_user_str = models.ForeignKey("User", on_delete=models.CASCADE, null=True) - not_nullable_user_str = models.ForeignKey( # type: ignore [var-annotated] + nullable_user_str = models.ForeignKey[Optional[User]]( + "User", on_delete=models.CASCADE, null=True + ) + not_nullable_user_str = models.ForeignKey[User]( "User", on_delete=models.CASCADE, null=False ) null_str_specified = models.ForeignKey["Optional[User]"]( @@ -528,10 +530,10 @@ def main() -> None: if isinstance(comment.nullable_user_str, type(None)): print(comment.nullable_user_str) if comment.nullable_user_str is not None: - print(comment.nullable_user_str) # type: ignore [unreachable] + print(comment.nullable_user_str) if isinstance(comment.not_nullable_user_str, type(None)): - print(comment.not_nullable_user_str) + print(comment.not_nullable_user_str) # type: ignore [unreachable] if comment.not_nullable_user_str is not None: print(comment.not_nullable_user_str) @@ -821,7 +823,7 @@ def namedtuplefetchall(cursor: CursorWrapper) -> List[Tuple[Any, ...]]: def dictfetchall(cursor: CursorWrapper) -> List[Dict[str, Any]]: "Return all rows from a cursor as a dict" assert cursor.description is not None - columns = [] + columns: List[str] = [] for col in cursor.description: if col.name is not None: columns.append(col.name) diff --git a/typings/django/contrib/postgres/fields/array.pyi b/typings/django/contrib/postgres/fields/array.pyi index 3583e610d..472e90b67 100644 --- a/typings/django/contrib/postgres/fields/array.pyi +++ b/typings/django/contrib/postgres/fields/array.pyi @@ -36,8 +36,8 @@ class ArrayField( default_validators: Any = ... from_db_value: Any = ... @overload - def __init__( - self: ArrayField[List[Any]], + def __new__( # type: ignore [misc] + cls, base_field: Field[Any, Any], size: Optional[int] = ..., verbose_name: Optional[Union[str, bytes]] = ..., @@ -61,10 +61,10 @@ class ArrayField( db_tablespace: Optional[str] = ..., validators: Iterable[_ValidatorCallable] = ..., error_messages: Optional[_ErrorMessagesToOverride] = ..., - ) -> None: ... + ) -> ArrayField[List[Any]]: ... @overload - def __init__( - self: ArrayField[Optional[List[Any]]], + def __new__( + cls, base_field: Field[Any, Any], size: Optional[int] = ..., verbose_name: Optional[Union[str, bytes]] = ..., @@ -88,7 +88,7 @@ class ArrayField( db_tablespace: Optional[str] = ..., validators: Iterable[_ValidatorCallable] = ..., error_messages: Optional[_ErrorMessagesToOverride] = ..., - ) -> None: ... + ) -> ArrayField[Optional[List[Any]]]: ... def __get__(self: ArrayField[_T], instance: Any, owner: Any) -> _T: ... # type: ignore [override] def __set__(self: ArrayField[_T], instance: Any, value: _T) -> None: ... # type: ignore [override] @property diff --git a/typings/django/core/management/commands/compilemessages.pyi b/typings/django/core/management/commands/compilemessages.pyi index 11463bf44..273a292de 100644 --- a/typings/django/core/management/commands/compilemessages.pyi +++ b/typings/django/core/management/commands/compilemessages.pyi @@ -1,5 +1,5 @@ import os -from typing import List, Tuple, Union +from typing import Any, List, Tuple, Union from django.core.management.base import BaseCommand as BaseCommand from django.core.management.base import CommandError as CommandError @@ -7,7 +7,7 @@ from django.core.management.base import CommandParser as CommandParser from django.core.management.utils import find_command as find_command from django.core.management.utils import popen_wrapper as popen_wrapper -_PathType = Union[str, bytes, os.PathLike] +_PathType = Union[str, bytes, os.PathLike[Any]] def has_bom(fn: _PathType) -> bool: ... def is_writable(path: _PathType) -> bool: ... diff --git a/typings/django/db/models/fields/__init__.pyi b/typings/django/db/models/fields/__init__.pyi index 75846e336..e849ac731 100644 --- a/typings/django/db/models/fields/__init__.pyi +++ b/typings/django/db/models/fields/__init__.pyi @@ -72,8 +72,8 @@ class Field(RegisterLookupMixin, Generic[_ST, _GT]): column: str default: Any error_messages: _ErrorMessagesToOverride - def __init__( - self, + def __new__( + cls, verbose_name: Optional[Union[str, bytes]] = ..., name: Optional[str] = ..., primary_key: bool = ..., @@ -95,7 +95,7 @@ class Field(RegisterLookupMixin, Generic[_ST, _GT]): db_tablespace: Optional[str] = ..., validators: Iterable[_ValidatorCallable] = ..., error_messages: Optional[_ErrorMessagesToOverride] = ..., - ) -> None: ... + ) -> Field[_ST, _GT]: ... def __set__(self, instance: Any, value: _ST) -> None: ... # class access @overload diff --git a/typings/django/db/models/fields/related.pyi b/typings/django/db/models/fields/related.pyi index 557939a5a..ad3269d89 100644 --- a/typings/django/db/models/fields/related.pyi +++ b/typings/django/db/models/fields/related.pyi @@ -81,8 +81,8 @@ class RelatedField(FieldCacheMixin, Field[_ST, _GT]): _M = TypeVar("_M", bound=Optional[Model]) class ForeignObject(RelatedField[_M, _M]): - def __init__( - self, + def __new__( + cls, to: Union[Type[_M], str], on_delete: Callable[..., None], from_fields: Sequence[str], @@ -94,7 +94,7 @@ class ForeignObject(RelatedField[_M, _M]): parent_link: bool = ..., db_constraint: bool = ..., swappable: bool = ..., - verbose_name: Optional[str] = ..., + verbose_name: Optional[Union[str, bytes]] = ..., name: Optional[str] = ..., primary_key: bool = ..., unique: bool = ..., @@ -111,12 +111,12 @@ class ForeignObject(RelatedField[_M, _M]): db_tablespace: Optional[str] = ..., validators: Iterable[_ValidatorCallable] = ..., error_messages: Optional[_ErrorMessagesToOverride] = ..., - ) -> None: ... + ) -> ForeignObject[_M]: ... class ForeignKey(Generic[_M], ForeignObject[_M]): @overload - def __init__( - self: ForeignKey[_M], + def __new__( # type: ignore [misc] + cls, to: Union[Type[_M], str], on_delete: Callable[..., None], to_field: Optional[str] = ..., @@ -146,10 +146,10 @@ class ForeignKey(Generic[_M], ForeignObject[_M]): db_tablespace: Optional[str] = ..., validators: Iterable[_ValidatorCallable] = ..., error_messages: Optional[_ErrorMessagesToOverride] = ..., - ) -> None: ... + ) -> ForeignKey[_M]: ... @overload - def __init__( - self: ForeignKey[Optional[_M]], + def __new__( + cls, to: Union[Type[_M], str], on_delete: Callable[..., None], to_field: Optional[str] = ..., @@ -179,7 +179,7 @@ class ForeignKey(Generic[_M], ForeignObject[_M]): db_tablespace: Optional[str] = ..., validators: Iterable[_ValidatorCallable] = ..., error_messages: Optional[_ErrorMessagesToOverride] = ..., - ) -> None: ... + ) -> ForeignKey[Optional[_M]]: ... # class access @overload # type: ignore def __get__(self, instance: None, owner: Any) -> ForwardManyToOneDescriptor: ... @@ -196,8 +196,8 @@ class ForeignKey(Generic[_M], ForeignObject[_M]): class OneToOneField(Generic[_M], RelatedField[_M, _M]): @overload - def __init__( - self: OneToOneField[_M], + def __new__( # type: ignore [misc] + cls, to: Union[Type[_M], str], on_delete: Any, to_field: Optional[str] = ..., @@ -227,10 +227,10 @@ class OneToOneField(Generic[_M], RelatedField[_M, _M]): db_tablespace: Optional[str] = ..., validators: Iterable[_ValidatorCallable] = ..., error_messages: Optional[_ErrorMessagesToOverride] = ..., - ) -> None: ... + ) -> OneToOneField[_M]: ... @overload - def __init__( - self: OneToOneField[Optional[_M]], + def __new__( + cls, to: Union[Type[_M], str], on_delete: Any, to_field: Optional[str] = ..., @@ -260,7 +260,7 @@ class OneToOneField(Generic[_M], RelatedField[_M, _M]): db_tablespace: Optional[str] = ..., validators: Iterable[_ValidatorCallable] = ..., error_messages: Optional[_ErrorMessagesToOverride] = ..., - ) -> None: ... + ) -> OneToOneField[Optional[_M]]: ... # class access @overload # type: ignore def __get__(self, instance: None, owner: Any) -> ForwardOneToOneDescriptor: ... @@ -281,8 +281,8 @@ class ManyToManyField(RelatedField[Sequence[Any], RelatedManager[Any]]): description: Any = ... has_null_arg: Any = ... swappable: bool = ... - def __init__( - self, + def __new__( + cls, to: Union[Type[Any], str], related_name: Optional[str] = ..., related_query_name: Optional[str] = ..., @@ -314,7 +314,7 @@ class ManyToManyField(RelatedField[Sequence[Any], RelatedManager[Any]]): db_tablespace: Optional[str] = ..., validators: Iterable[_ValidatorCallable] = ..., error_messages: Optional[_ErrorMessagesToOverride] = ..., - ) -> None: ... + ) -> ManyToManyField: ... # class access @overload # type: ignore def __get__(self, instance: None, owner: Any) -> ManyToManyDescriptor: ... diff --git a/typings/django/utils/encoding.pyi b/typings/django/utils/encoding.pyi index dbff3fd3b..55a14b87c 100644 --- a/typings/django/utils/encoding.pyi +++ b/typings/django/utils/encoding.pyi @@ -1,68 +1,21 @@ -import datetime -from decimal import Decimal -from typing import Any, TypeVar, Union, overload +from typing import Any, Union, overload from django.utils.functional import Promise -from typing_extensions import Literal class DjangoUnicodeDecodeError(UnicodeDecodeError): obj: bytes = ... def __init__(self, obj: bytes, *args: Any) -> None: ... -_P = TypeVar("_P", bound=Promise) -_S = TypeVar("_S", bound=str) -_PT = TypeVar( - "_PT", None, int, float, Decimal, datetime.datetime, datetime.date, datetime.time -) -@overload -def smart_text( - s: _P, encoding: str = ..., strings_only: bool = ..., errors: str = ... -) -> _P: ... -@overload -def smart_text( - s: _PT, encoding: str = ..., strings_only: Literal[True] = ..., errors: str = ... -) -> _PT: ... -@overload -def smart_text( - s: _S, encoding: str = ..., strings_only: bool = ..., errors: str = ... -) -> _S: ... -@overload def smart_text( s: Any, encoding: str = ..., strings_only: bool = ..., errors: str = ... -) -> str: ... +) -> Any: ... def is_protected_type(obj: Any) -> bool: ... -@overload -def force_text( - s: _PT, encoding: str = ..., strings_only: Literal[True] = ..., errors: str = ... -) -> _PT: ... -@overload -def force_text( - s: _S, encoding: str = ..., strings_only: bool = ..., errors: str = ... -) -> _S: ... -@overload def force_text( s: Any, encoding: str = ..., strings_only: bool = ..., errors: str = ... -) -> str: ... -@overload -def smart_bytes( - s: _P, encoding: str = ..., strings_only: bool = ..., errors: str = ... -) -> _P: ... -@overload -def smart_bytes( - s: _PT, encoding: str = ..., strings_only: Literal[True] = ..., errors: str = ... -) -> _PT: ... -@overload -def smart_bytes( - s: Any, encoding: str = ..., strings_only: bool = ..., errors: str = ... -) -> bytes: ... -@overload -def force_bytes( - s: _PT, encoding: str = ..., strings_only: Literal[True] = ..., errors: str = ... -) -> _PT: ... -@overload +) -> Any: ... def force_bytes( s: Any, encoding: str = ..., strings_only: bool = ..., errors: str = ... -) -> bytes: ... +) -> Any: ... smart_str = smart_text force_str = force_text diff --git a/typings/django/utils/safestring.pyi b/typings/django/utils/safestring.pyi index 499489e87..44809642d 100644 --- a/typings/django/utils/safestring.pyi +++ b/typings/django/utils/safestring.pyi @@ -1,4 +1,4 @@ -from typing import Any, Callable, TypeVar, overload +from typing import Any, TypeVar, overload _SD = TypeVar("_SD", bound="SafeData") @@ -17,10 +17,4 @@ class SafeText(str, SafeData): SafeString = SafeText -_C = TypeVar("_C", bound=Callable[..., Any]) -@overload -def mark_safe(s: _SD) -> _SD: ... -@overload -def mark_safe(s: _C) -> _C: ... -@overload def mark_safe(s: Any) -> SafeText: ... diff --git a/yarn.lock b/yarn.lock index e2ac0921d..631d67039 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2,7 +2,7 @@ # yarn lockfile v1 -pyright@^1.1.116: - version "1.1.116" - resolved "https://registry.yarnpkg.com/pyright/-/pyright-1.1.116.tgz#202abd42424d84ad3929347c99a2a45ac54364d6" - integrity sha512-SdsLo/bahs+ncCYIY7E4bL/B+ZuI/OdKJudNuUFAJciXEkkkp2ICzpzQSt0n4ZeYsPfqb5g48QoGo7x4a+LDcQ== +pyright@^1.1.129: + version "1.1.129" + resolved "https://registry.yarnpkg.com/pyright/-/pyright-1.1.129.tgz#11fb60bc8bb48a934360c226101ace673aca0871" + integrity sha512-7GFRfANFT6xhEVlDWWk+81D2IJA57j8L9TbSVG61qPe79qb0O6yVzu9asCTJVopd7q6aRPVhXlfuXLMFKmKekQ== From 26834855d6b914862b770fa32f4b8f23d6824eeb Mon Sep 17 00:00:00 2001 From: Christopher Dignam Date: Tue, 13 Apr 2021 00:03:27 -0400 Subject: [PATCH 44/88] release 0.5.2 (#19) Also start changelog --- CHANGELOG.md | 86 ++++++++++++++++++++++++++++++++++++++++++++++++++ pyproject.toml | 2 +- 2 files changed, 87 insertions(+), 1 deletion(-) create mode 100644 CHANGELOG.md diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 000000000..755caf246 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,86 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## Unreleased + +## 0.5.2 - 2021-04-13 + +### Fixed + +- Fixed ForeignKey field to work with Pylance. + +## 0.5.1 - 2021-03-21 + +### Fixed + +- Fix export for JSONField. + +### Added + +- Added types for csrf and vary decorators. + +## 0.5.0 - 2021-02-27 + +### Added + +- Added types for some Django decorators. + +## 0.4.2 - 2021-02-27 + +### Changed + +- Removed Python3.7 version requirement in package. + +### Fixed + +- Fixed errors raised by Pyright. + +## 0.4.0 - 2021-02-26 + +### Added + +- Added missing generic type parameters. + +### Fixed + +- Fixed HttpHeaders to make get return Optional[str]. + +## 0.3.1 - 2021-01-19 + +### Fixed + +- Fixed cursor.execute parameter types for pyscopg2. + +## 0.3.0 - 2021-01-18 + +### Added + +- Added basic pyscopg2 type stubs. + +## 0.2.1 - 2020-12-11 + +### Fixed + +- Added missing null overload for TextField. + +## 0.2.0 - 2020-12-06 + +### Added + +- Added nullability support for most ORM fields. +- Added support for Postgres-specific ORM fields. + +## 0.1.0 - 2020-11-25 + +### Added + +- Added support for nullability of ForeignKey fields. + +### Removed + +- mypy plugin +- monkey patching package diff --git a/pyproject.toml b/pyproject.toml index 7d68e809d..1309852bc 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "django-types" -version = "0.5.1" +version = "0.5.2" description = "Type stubs for Django" repository = "https://github.com/sbdchd/django-types" readme = "README.md" From d6b2688d42abcd79f9b2f8a79e13ca1146e82459 Mon Sep 17 00:00:00 2001 From: Steve Dignam Date: Mon, 26 Apr 2021 22:50:49 -0400 Subject: [PATCH 45/88] add(psycopg2): types for extras module (#21) Stubs out the rest of the extras module. --- tests/trout/models.py | 4 + typings/psycopg2/__init__.pyi | 1 + typings/psycopg2/_psycopg.pyi | 5 + typings/psycopg2/extras.pyi | 305 ++++++++++++++++++++++++++++++++++ 4 files changed, 315 insertions(+) create mode 100644 typings/psycopg2/_psycopg.pyi diff --git a/tests/trout/models.py b/tests/trout/models.py index fe997d00b..20a6a64be 100644 --- a/tests/trout/models.py +++ b/tests/trout/models.py @@ -36,6 +36,7 @@ ) from psycopg2 import ProgrammingError from psycopg2.extensions import parse_dsn +from psycopg2.extras import execute_values class User(models.Model): @@ -562,6 +563,9 @@ def raw_database_queries() -> None: cursor.executemany("select 1;", []) + values: List[Tuple[str, int]] = [("foo", 123)] + execute_values(cursor, "SELECT 1", (values,)) + cursor.executemany( "INSERT INTO table (id, name) VALUES (%s, %s)", ((1, "a"), (2, "b"), (3, "c")), diff --git a/typings/psycopg2/__init__.pyi b/typings/psycopg2/__init__.pyi index 1456a5c18..1b6fa1855 100644 --- a/typings/psycopg2/__init__.pyi +++ b/typings/psycopg2/__init__.pyi @@ -1,5 +1,6 @@ from typing import Any, Optional +from psycopg2 import _psycopg as _psycopg from psycopg2 import errors as errors from psycopg2 import extensions as extensions from psycopg2 import tz as tz diff --git a/typings/psycopg2/_psycopg.pyi b/typings/psycopg2/_psycopg.pyi new file mode 100644 index 000000000..5592a16a1 --- /dev/null +++ b/typings/psycopg2/_psycopg.pyi @@ -0,0 +1,5 @@ +class ReplicationCursor: ... +class ReplicationConnection: ... + +REPLICATION_LOGICAL: object +REPLICATION_PHYSICAL: object diff --git a/typings/psycopg2/extras.pyi b/typings/psycopg2/extras.pyi index 972fd4564..37ee12d42 100644 --- a/typings/psycopg2/extras.pyi +++ b/typings/psycopg2/extras.pyi @@ -1,4 +1,309 @@ +from collections import OrderedDict +from typing import ( + Any, + Dict, + Iterator, + List, + Mapping, + NamedTuple, + Optional, + Pattern, + Sequence, + Tuple, + Union, + overload, +) + +from psycopg2._psycopg import ReplicationConnection as _replicationConnection +from psycopg2._psycopg import ReplicationCursor as _replicationCursor from psycopg2._range import DateRange as DateRange from psycopg2._range import DateTimeTZRange as DateTimeTZRange from psycopg2._range import NumericRange as NumericRange from psycopg2._range import Range as Range +from psycopg2.extensions import _SQLType +from psycopg2.extensions import connection as _connection +from psycopg2.extensions import cursor as _cursor +from typing_extensions import Literal, Protocol + +class DictCursorBase(_cursor): + _query_executed: bool + _prefetch: bool + row_factory: Any + def __init__( + self, *args: Any, row_factory: Optional[Any], **kwargs: Any + ) -> None: ... + def fetchone(self) -> Optional[Tuple[Any, ...]]: ... + def fetchmany(self, size: Optional[int] = ...) -> List[Tuple[Any, ...]]: ... + def fetchall(self) -> List[Tuple[Any, ...]]: ... + def __iter__(self) -> Iterator[Tuple[Any, ...]]: ... + +class DictConnection(_connection): + def cursor( + self, *args: Any, cursor_factory: Optional[DictCursorBase] = ..., **kwargs: Any + ) -> _cursor: ... + +class DictCursor(DictCursorBase): + index: OrderedDict[str, int] + _query_executed: bool + def __init__(self, *args: Any, **kwargs: Any) -> None: ... + def execute( + self, + query: str, + vars: Optional[Union[Sequence[_SQLType], Mapping[str, _SQLType]]] = ..., + ) -> None: ... + def callproc( + self, + procname: str, + parameters: Union[Sequence[_SQLType], Mapping[str, _SQLType]] = ..., + ) -> None: ... + +class DictRow(List[Any]): + _index: OrderedDict[str, int] + def __init__(self, cursor: DictCursor) -> None: ... + def __getitem__(self, x: Union[str, int, slice]) -> Any: ... + def __setitem__(self, x: Union[str, int, slice], v: Any) -> None: ... + def items(self) -> Iterator[Tuple[str, Any]]: ... + def keys(self) -> Iterator[str]: ... + def values(self) -> Iterator[Any]: ... + def get( + self, x: Union[str, int, slice], default: Optional[Any] = ... + ) -> Optional[Any]: ... + def copy(self) -> OrderedDict[str, Any]: ... # type: ignore [override] + def __contains__(self, x: str) -> bool: ... # type: ignore [override] + def __getstate__(self) -> Tuple[Any, OrderedDict[str, int]]: ... + def __setstate__(self, data: Tuple[Any, OrderedDict[str, int]]) -> None: ... + +class RealDictConnection(_connection): + def cursor( # type: ignore [override] + self, *args: Any, cursor_factory: RealDictCursor, **kwargs: Any + ) -> _cursor: ... + +class RealDictCursor(DictCursorBase): + column_mapping: List[Any] + _query_executed: bool + def __init__(self, *args: Any, **kwargs: Any) -> None: ... + def execute( + self, + query: str, + vars: Optional[Union[Sequence[_SQLType], Mapping[str, _SQLType]]] = ..., + ) -> None: ... + def callproc( + self, + procname: str, + vars: Optional[Union[Sequence[_SQLType], Mapping[str, _SQLType]]] = ..., + ) -> None: ... + +class RealDictRow(OrderedDict[Any, Any]): + def __init__(self, *args: Any, **kwargs: Any) -> None: ... + def __setitem__(self, key: Any, value: Any) -> None: ... + +class NamedTupleConnection(_connection): + def cursor(self, *args: Any, **kwargs: Any) -> _cursor: ... + +class NamedTupleCursor(_cursor): + Record: Optional[NamedTuple] = ... + MAX_CACHE: int = ... + def execute( + self, + query: str, + vars: Optional[Union[Sequence[_SQLType], Mapping[str, _SQLType]]] = ..., + ) -> None: ... + def executemany( + self, + query: str, + vars_list: Sequence[Union[Sequence[_SQLType], Mapping[str, _SQLType]]], + ) -> None: ... + def callproc( + self, + procname: str, + vars: Optional[Union[Sequence[_SQLType], Mapping[str, _SQLType]]] = ..., + ) -> None: ... + def fetchone(self) -> Optional[Tuple[Any, ...]]: ... + def fetchmany(self, size: int = ...) -> List[Tuple[Any, ...]]: ... + def fetchall(self) -> List[Tuple[Any, ...]]: ... + def __iter__(self) -> Iterator[Tuple[Any, ...]]: ... + +class LoggingConnection(_connection): + def initialize(self, logobj: Any) -> None: ... + def filter(self, msg: Any, curs: Any) -> Any: ... + def cursor(self, *args: Any, **kwargs: Any) -> _cursor: ... + +class LoggingCursor(_cursor): + def execute( + self, + query: str, + vars: Optional[Union[Sequence[_SQLType], Mapping[str, _SQLType]]] = ..., + ) -> None: ... + def callproc( + self, + procname: str, + vars: Optional[Union[Sequence[_SQLType], Mapping[str, _SQLType]]] = ..., + ) -> None: ... + +class MinTimeLoggingConnection(LoggingConnection): + def initialize(self, logobj: Any, mintime: int = ...) -> None: ... + def filter(self, msg: Any, curs: Any) -> Optional[str]: ... + def cursor(self, *args: Any, **kwargs: Any) -> _cursor: ... + +class MinTimeLoggingCursor(LoggingCursor): + timestamp: float + def execute( + self, + query: str, + vars: Optional[Union[Sequence[_SQLType], Mapping[str, _SQLType]]] = ..., + ) -> None: ... + def callproc( + self, + procname: str, + vars: Optional[Union[Sequence[_SQLType], Mapping[str, _SQLType]]] = ..., + ) -> None: ... + +class LogicalReplicationConnection(_replicationConnection): + def __init__(self, *args: Any, **kwargs: Any) -> None: ... + +class PhysicalReplicationConnection(_replicationConnection): + def __init__(self, *args: Any, **kwargs: Any) -> None: ... + +class StopReplication(Exception): + pass + +class ReplicationCursor(_replicationCursor): + def create_replication_slot( + self, + slot_name: Any, + slot_type: Optional[Any] = ..., + output_plugin: Optional[Any] = ..., + ) -> None: ... + def drop_replication_slot(self, slot_name: Any) -> None: ... + def start_replication( + self, + slot_name: Optional[Any] = ..., + slot_type: Optional[Any] = ..., + start_lsn: int = ..., + timeline: int = ..., + options: Optional[Mapping[Any, Any]] = ..., + decode: bool = ..., + ) -> None: ... + def fileno(self) -> Any: ... + +class UUID_adapter: + _uuid: Any + def __init__(self, uuid: Any) -> None: ... + def __conform__(self, proto: Any) -> Optional[UUID_adapter]: ... + def getquoted(self) -> str: ... + +def register_uuid( + oids: Optional[Any] = ..., conn_or_curs: Union[_cursor, _connection, None] = ... +) -> None: ... + +class Inet: + addr: Any + _conn: _connection + def __init__(self, addr: Any) -> None: ... + def prepare(self, conn: _connection) -> None: ... + def getquoted(self) -> bytes: ... + def __conform__(self, proto: Any) -> Optional[Inet]: ... + +def register_inet( + oid: Optional[int] = ..., conn_or_curs: Optional[Union[_connection, _cursor]] = ... +) -> Inet: ... +def wait_select(conn: _connection) -> None: ... + +class HstoreAdapter: + wrapped: Any + conn: _connection + def __init__(self, wrapped: Any) -> None: ... + def prepare(self, conn: _connection) -> None: ... + def _getquoted_9(self) -> bytes: ... + getquoted = _getquoted_9 + @classmethod + def parse( + cls, s: Optional[str], cur: _cursor, _bsdec: Pattern[str] = ... + ) -> Optional[Dict[str, str]]: ... + @classmethod + def parse_unicode( + cls, s: Optional[str], cur: _cursor + ) -> Optional[Dict[str, str]]: ... + @classmethod + def get_oids( + cls, conn_or_curs: Union[_connection, _cursor] + ) -> Tuple[Tuple[Any, ...], Tuple[Any, ...]]: ... + +def register_hstore( + conn_or_curs: Union[_connection, _cursor], + globally: bool = ..., + unicode: bool = ..., + oid: Optional[int] = ..., + array_oid: Optional[int] = ..., +) -> None: ... + +class CompositeCaster: + name: str + schema: Optional[Any] + oid: int + array_oid: Optional[int] + attrnames: List[Any] + attrtypes: List[Any] + typecaster: Any + array_typecaster: Optional[Any] + def __init__( + self, + name: str, + oid: int, + attrs: Any, + array_oid: Optional[int] = ..., + schema: Optional[Any] = ..., + ) -> None: ... + def parse(self, s: Optional[str], curs: Any) -> Any: ... + def make(self, values: Any) -> Any: ... + @classmethod + def tokenize(cls, s: str) -> List[Optional[str]]: ... + +def register_composite( + name: str, + conn_or_curs: Union[_connection, _cursor], + globally: bool = ..., + factory: Optional[CompositeCaster] = ..., +) -> CompositeCaster: ... + +class _CursorLike(Protocol): + @property + def connection(self) -> _connection: ... + def mogrify( + self, + operation: str, + parameters: Optional[Union[Sequence[_SQLType], Mapping[str, _SQLType]]] = ..., + ) -> bytes: ... + def execute( + self, + sql: str, + params: Optional[Union[Sequence[_SQLType], Mapping[str, _SQLType]]] = ..., + ) -> None: ... + def fetchall(self) -> List[Tuple[Any, ...]]: ... + +def execute_batch( + cur: _CursorLike, + sql: str, + argslist: Sequence[Union[Sequence[_SQLType], Mapping[str, _SQLType]]], + page_size: int = ..., +) -> None: ... +@overload +def execute_values( + cur: _CursorLike, + sql: str, + argslist: Sequence[Union[Sequence[_SQLType], Mapping[str, _SQLType]]], + *, + template: Optional[bytes] = ..., + page_size: int = ..., + fetch: Literal[True], +) -> List[Tuple[Any, ...]]: ... +@overload +def execute_values( + cur: _CursorLike, + sql: str, + argslist: Sequence[Union[Sequence[_SQLType], Mapping[str, _SQLType]]], + *, + template: Optional[bytes] = ..., + page_size: int = ..., + fetch: Literal[False] = ..., +) -> None: ... From a004614bf8552a7b5810d684941b10e17c039034 Mon Sep 17 00:00:00 2001 From: Steve Dignam Date: Mon, 26 Apr 2021 23:11:21 -0400 Subject: [PATCH 46/88] add(psycopg2): types for sql module (#22) Stub out the SQL module and use the examples for tests. --- tests/trout/models.py | 48 ++++++++++++++++++++++++++++- typings/psycopg2/__init__.pyi | 2 ++ typings/psycopg2/sql.pyi | 57 +++++++++++++++++++++++++++++++++++ 3 files changed, 106 insertions(+), 1 deletion(-) create mode 100644 typings/psycopg2/sql.pyi diff --git a/tests/trout/models.py b/tests/trout/models.py index 20a6a64be..6fb60b607 100644 --- a/tests/trout/models.py +++ b/tests/trout/models.py @@ -34,7 +34,7 @@ require_GET, require_POST, ) -from psycopg2 import ProgrammingError +from psycopg2 import ProgrammingError, sql from psycopg2.extensions import parse_dsn from psycopg2.extras import execute_values @@ -636,6 +636,52 @@ def get_data() -> Dict[str, Dict[str, str]]: def test_psycopg2() -> None: with connection.cursor() as cursor: + comp = sql.Composed([sql.SQL("insert into "), sql.Identifier("table")]) + print(comp.as_string(cursor)) + + query = sql.SQL("select {0} from {1}").format( + sql.SQL(", ").join([sql.Identifier("foo"), sql.Identifier("bar")]), + sql.Identifier("table"), + ) + print(query.as_string(cursor)) + + snip = sql.SQL(", ").join(sql.Identifier(n) for n in ["foo", "bar", "baz"]) + print(snip.as_string(cursor)) + + query = sql.SQL("select {} from {}").format( + sql.Identifier("table", "field"), sql.Identifier("schema", "table") + ) + print(query.as_string(cursor)) + + t1 = sql.Identifier("foo") + t2 = sql.Identifier("ba'r") + t3 = sql.Identifier('ba"z') + print(sql.SQL(", ").join([t1, t2, t3]).as_string(cursor)) + + s1 = sql.Literal("foo") + s2 = sql.Literal("ba'r") + s3 = sql.Literal(42) + print(sql.SQL(", ").join([s1, s2, s3]).as_string(cursor)) + + query = sql.SQL("select {} from {}").format( + sql.Identifier("table", "field"), sql.Identifier("schema", "table") + ) + print(query.as_string(cursor)) + + names = ["foo", "bar", "baz"] + + q1 = sql.SQL("insert into table ({}) values ({})").format( + sql.SQL(", ").join(map(sql.Identifier, names)), + sql.SQL(", ").join(sql.Placeholder() * len(names)), + ) + print(q1.as_string(cursor)) + + q2 = sql.SQL("insert into table ({}) values ({})").format( + sql.SQL(", ").join(map(sql.Identifier, names)), + sql.SQL(", ").join(map(sql.Placeholder, names)), + ) + print(q2.as_string(cursor)) + cur = cursor.cursor cur.execute("SELECT * FROM test;") for record in cur: diff --git a/typings/psycopg2/__init__.pyi b/typings/psycopg2/__init__.pyi index 1b6fa1855..60a21e53d 100644 --- a/typings/psycopg2/__init__.pyi +++ b/typings/psycopg2/__init__.pyi @@ -3,6 +3,8 @@ from typing import Any, Optional from psycopg2 import _psycopg as _psycopg from psycopg2 import errors as errors from psycopg2 import extensions as extensions +from psycopg2 import extras as extras +from psycopg2 import sql as sql from psycopg2 import tz as tz paramstyle: str diff --git a/typings/psycopg2/sql.pyi b/typings/psycopg2/sql.pyi new file mode 100644 index 000000000..f11069f12 --- /dev/null +++ b/typings/psycopg2/sql.pyi @@ -0,0 +1,57 @@ +import string +from typing import Any, Iterable, Iterator, List, Optional, Union + +from psycopg2 import extensions as ext +from psycopg2.extensions import connection +from psycopg2.extras import _CursorLike + +_formatter: string.Formatter + +_Context = Union[connection, _CursorLike] + +class Composable: + def __init__(self, wrapped: Any) -> None: ... + def as_string(self, context: _Context) -> str: ... + def __add__(self, other: Any) -> Composed: ... + def __mul__(self, n: int) -> Composed: ... + def __eq__(self, other: object) -> bool: ... + def __ne__(self, other: object) -> bool: ... + +class Composed(Composable): + def __init__(self, seq: Iterable[Composable]) -> None: ... + @property + def seq(self) -> List[Composable]: ... + def as_string(self, context: _Context) -> str: ... + def __iter__(self) -> Iterator[Composable]: ... + def __add__(self, other: object) -> Composed: ... + def join(self, joiner: Union[str, SQL]) -> Composed: ... + +class SQL(Composable): + def __init__(self, string: str) -> None: ... + @property + def string(self) -> str: ... + def as_string(self, context: _Context) -> str: ... + def format(self, *args: Any, **kwargs: Any) -> Composed: ... + def join(self, seq: Iterable[Composable]) -> Composed: ... + +class Identifier(Composable): + def __init__(self, *strings: str) -> None: ... + @property + def strings(self) -> List[str]: ... + @property + def string(self) -> str: ... + def as_string(self, context: _Context) -> str: ... + +class Literal(Composable): + @property + def wrapped(self) -> Any: ... + def as_string(self, context: _Context) -> str: ... + +class Placeholder(Composable): + def __init__(self, name: Optional[str] = ...) -> None: ... + @property + def name(self) -> Optional[str]: ... + def as_string(self, context: _Context) -> str: ... + +NULL: SQL +DEFAULT: SQL From 3d8a9a6d83e2a72b63712e7270713470eb2703ee Mon Sep 17 00:00:00 2001 From: Steve Dignam Date: Mon, 26 Apr 2021 23:20:32 -0400 Subject: [PATCH 47/88] release: 0.5.3 (#23) --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 1309852bc..a169acc8a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "django-types" -version = "0.5.2" +version = "0.5.3" description = "Type stubs for Django" repository = "https://github.com/sbdchd/django-types" readme = "README.md" From ac571df55fe758f02a4d5761e25ff55c2da00107 Mon Sep 17 00:00:00 2001 From: Steve Dignam Date: Mon, 26 Apr 2021 23:48:02 -0400 Subject: [PATCH 48/88] fix(pyscopg2): sql module Composable param type (#24) We can do better than Any for the wrapped param --- typings/psycopg2/sql.pyi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/typings/psycopg2/sql.pyi b/typings/psycopg2/sql.pyi index f11069f12..22b265324 100644 --- a/typings/psycopg2/sql.pyi +++ b/typings/psycopg2/sql.pyi @@ -2,7 +2,7 @@ import string from typing import Any, Iterable, Iterator, List, Optional, Union from psycopg2 import extensions as ext -from psycopg2.extensions import connection +from psycopg2.extensions import _SQLType, connection from psycopg2.extras import _CursorLike _formatter: string.Formatter @@ -10,7 +10,7 @@ _formatter: string.Formatter _Context = Union[connection, _CursorLike] class Composable: - def __init__(self, wrapped: Any) -> None: ... + def __init__(self, wrapped: _SQLType) -> None: ... def as_string(self, context: _Context) -> str: ... def __add__(self, other: Any) -> Composed: ... def __mul__(self, n: int) -> Composed: ... From cbeac4c6f2512a320c9e750e3a73101ea6637bf9 Mon Sep 17 00:00:00 2001 From: Steve Dignam Date: Fri, 7 May 2021 20:37:12 -0400 Subject: [PATCH 49/88] ref(django): test Client types (#26) Also fix http.cookie.SimpleCookie rel: https://github.com/sbdchd/djangorestframework-types/pull/6 fixes: https://github.com/sbdchd/django-types/issues/25 --- tests/trout/models.py | 8 ++ typings/django/http/cookie.pyi | 5 +- typings/django/http/response.pyi | 2 +- typings/django/test/client.pyi | 130 +++++++++++++++++++++---------- 4 files changed, 100 insertions(+), 45 deletions(-) diff --git a/tests/trout/models.py b/tests/trout/models.py index 6fb60b607..0027478dc 100644 --- a/tests/trout/models.py +++ b/tests/trout/models.py @@ -21,6 +21,7 @@ from django.http.request import HttpRequest from django.http.response import HttpResponse from django.middleware.cache import CacheMiddleware +from django.test.client import Client from django.utils.decorators import ( decorator_from_middleware, decorator_from_middleware_with_args, @@ -222,6 +223,13 @@ def process_non_nullable( def main() -> None: + client = Client() + + res = client.post( + "/api/users", data={"buzz": "bar"}, QUERY_STRING="?foo=1", HTTP_X_FOO_BAR="foo" + ) + print(res) + request = HttpRequest() header = request.headers.get("FOO") if header is not None and not isinstance(header, str): diff --git a/typings/django/http/cookie.pyi b/typings/django/http/cookie.pyi index e2dc91dd1..cca1caaa5 100644 --- a/typings/django/http/cookie.pyi +++ b/typings/django/http/cookie.pyi @@ -1,5 +1,4 @@ -from typing import Any, Dict - -SimpleCookie: Any +from http.cookies import SimpleCookie as SimpleCookie +from typing import Dict def parse_cookie(cookie: str) -> Dict[str, str]: ... diff --git a/typings/django/http/response.pyi b/typings/django/http/response.pyi index 73319e53d..8f4b1b49b 100644 --- a/typings/django/http/response.pyi +++ b/typings/django/http/response.pyi @@ -24,7 +24,7 @@ class BadHeaderError(ValueError): ... class HttpResponseBase(Iterable[Any]): status_code: int = ... - cookies: SimpleCookie = ... # type: ignore [no-any-unimported] + cookies: SimpleCookie[str] = ... reason_phrase: str = ... charset: str = ... closed: bool = ... diff --git a/typings/django/test/client.pyi b/typings/django/test/client.pyi index ea626edb6..b6b65f1c1 100644 --- a/typings/django/test/client.pyi +++ b/typings/django/test/client.pyi @@ -38,71 +38,98 @@ class ClientHandler(BaseHandler): def encode_multipart(boundary: str, data: Dict[str, Any]) -> bytes: ... def encode_file(boundary: str, key: str, file: Any) -> List[bytes]: ... +_RequestData = Optional[Any] + class RequestFactory: json_encoder: Type[JSONEncoder] defaults: Dict[str, str] - cookies: SimpleCookie # type: ignore [no-any-unimported] + cookies: SimpleCookie[str] errors: BytesIO def __init__( self, *, json_encoder: Type[JSONEncoder] = ..., **defaults: Any ) -> None: ... def request(self, **request: Any) -> WSGIRequest: ... def get( - self, path: str, data: Any = ..., secure: bool = ..., **extra: Any + self, + path: str, + data: _RequestData = ..., + secure: bool = ..., + *, + QUERY_STRING: str = ..., + **extra: str ) -> WSGIRequest: ... def post( self, path: str, - data: Any = ..., + data: _RequestData = ..., content_type: str = ..., secure: bool = ..., - **extra: Any + *, + QUERY_STRING: str = ..., + **extra: str ) -> WSGIRequest: ... def head( - self, path: str, data: Any = ..., secure: bool = ..., **extra: Any + self, + path: str, + data: _RequestData = ..., + secure: bool = ..., + *, + QUERY_STRING: str = ..., + **extra: str + ) -> WSGIRequest: ... + def trace( + self, path: str, secure: bool = ..., *, QUERY_STRING: str = ..., **extra: str ) -> WSGIRequest: ... - def trace(self, path: str, secure: bool = ..., **extra: Any) -> WSGIRequest: ... def options( self, path: str, - data: Union[Dict[str, str], str] = ..., + data: _RequestData = ..., content_type: str = ..., - follow: bool = ..., secure: bool = ..., - **extra: Any + *, + QUERY_STRING: str = ..., + **extra: str ) -> WSGIRequest: ... def put( self, path: str, - data: Any = ..., + data: _RequestData = ..., content_type: str = ..., secure: bool = ..., - **extra: Any + *, + QUERY_STRING: str = ..., + **extra: str ) -> WSGIRequest: ... def patch( self, path: str, - data: Any = ..., + data: _RequestData = ..., content_type: str = ..., secure: bool = ..., - **extra: Any + *, + QUERY_STRING: str = ..., + **extra: str ) -> WSGIRequest: ... def delete( self, path: str, - data: Any = ..., + data: _RequestData = ..., content_type: str = ..., secure: bool = ..., - **extra: Any + *, + QUERY_STRING: str = ..., + **extra: str ) -> WSGIRequest: ... def generic( self, method: str, path: str, - data: Any = ..., + data: _RequestData = ..., content_type: Optional[str] = ..., secure: bool = ..., - **extra: Any + *, + QUERY_STRING: str = ..., + **extra: str ) -> WSGIRequest: ... class Client(RequestFactory): @@ -118,70 +145,91 @@ class Client(RequestFactory): **defaults: Any ) -> None: ... # Silence type warnings, since this class overrides arguments and return types in an unsafe manner. - def request(self, **request: Any) -> HttpResponse: ... # type: ignore - def get( # type: ignore + def request(self, **request: Any) -> HttpResponse: ... # type: ignore [override] + def get( # type: ignore [override] self, path: str, - data: Any = ..., + data: _RequestData = ..., follow: bool = ..., secure: bool = ..., - **extra: Any + *, + QUERY_STRING: str = ..., + **extra: str ) -> HttpResponse: ... - def post( # type: ignore + def post( # type: ignore [override] self, path: str, - data: Any = ..., + data: _RequestData = ..., content_type: str = ..., follow: bool = ..., secure: bool = ..., - **extra: Any + *, + QUERY_STRING: str = ..., + **extra: str ) -> HttpResponse: ... - def head( # type: ignore + def head( # type: ignore [override] self, path: str, - data: Any = ..., + data: _RequestData = ..., follow: bool = ..., secure: bool = ..., - **extra: Any + *, + QUERY_STRING: str = ..., + **extra: str ) -> HttpResponse: ... - def trace( # type: ignore - self, path: str, follow: bool = ..., secure: bool = ..., **extra: Any + def trace( # type: ignore [override] + self, + path: str, + data: _RequestData = ..., + follow: bool = ..., + secure: bool = ..., + *, + QUERY_STRING: str = ..., + **extra: str ) -> HttpResponse: ... - def options( # type: ignore + def options( # type: ignore [override] self, path: str, - data: Union[Dict[str, str], str] = ..., + data: _RequestData = ..., content_type: str = ..., follow: bool = ..., secure: bool = ..., - **extra: Any + *, + QUERY_STRING: str = ..., + **extra: str ) -> HttpResponse: ... - def put( # type: ignore + def put( # type: ignore [override] self, path: str, - data: Any = ..., + data: _RequestData = ..., content_type: str = ..., follow: bool = ..., secure: bool = ..., - **extra: Any + *, + QUERY_STRING: str = ..., + **extra: str ) -> HttpResponse: ... - def patch( # type: ignore + def patch( # type: ignore [override] self, path: str, - data: Any = ..., + data: _RequestData = ..., content_type: str = ..., follow: bool = ..., secure: bool = ..., - **extra: Any + *, + QUERY_STRING: str = ..., + **extra: str ) -> HttpResponse: ... - def delete( # type: ignore + def delete( # type: ignore [override] self, path: str, - data: Any = ..., + data: _RequestData = ..., content_type: str = ..., follow: bool = ..., secure: bool = ..., - **extra: Any + *, + QUERY_STRING: str = ..., + **extra: str ) -> HttpResponse: ... def store_exc_info(self, **kwargs: Any) -> None: ... @property From db79759751d2020d57a88dd38c9278a9a24dad09 Mon Sep 17 00:00:00 2001 From: Steve Dignam Date: Wed, 9 Jun 2021 15:46:07 -0400 Subject: [PATCH 50/88] ref(django): stricter MultiValueDict getlist default arg (#28) We can do better than `Any` for the default arg --- typings/django/utils/datastructures.pyi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/typings/django/utils/datastructures.pyi b/typings/django/utils/datastructures.pyi index 2f5763be2..966f9c8ba 100644 --- a/typings/django/utils/datastructures.pyi +++ b/typings/django/utils/datastructures.pyi @@ -42,7 +42,7 @@ class MultiValueDict(MutableMapping[_K, _V]): def __init__( self, key_to_list_mapping: Iterable[Tuple[_K, List[_V]]] = ... ) -> None: ... - def getlist(self, key: _K, default: Any = ...) -> List[_V]: ... + def getlist(self, key: _K, default: Optional[List[_V]] = ...) -> List[_V]: ... def setlist(self, key: _K, list_: List[_V]) -> None: ... def setlistdefault( self, key: _K, default_list: Optional[List[_V]] = ... From 7def409d327baff447669ce96ccfc8e1dec35354 Mon Sep 17 00:00:00 2001 From: Steve Dignam Date: Mon, 12 Jul 2021 20:47:57 -0400 Subject: [PATCH 51/88] fix(django): overload issues with __new__ / __init__ combo (#30) We have a __new__ method defined on Field was causing typing issues with pyright. This might make creating custom fields harder, but that's the less common case. rel: https://github.com/sbdchd/django-types/issues/29 --- tests/trout/models.py | 29 ++++++++++ typings/django/contrib/postgres/search.pyi | 61 +++++++++++++++++++- typings/django/db/models/fields/__init__.pyi | 50 ++++++++-------- 3 files changed, 112 insertions(+), 28 deletions(-) diff --git a/tests/trout/models.py b/tests/trout/models.py index 0027478dc..0789d364b 100644 --- a/tests/trout/models.py +++ b/tests/trout/models.py @@ -15,6 +15,7 @@ HStoreField, JSONField, ) +from django.contrib.postgres.search import SearchVectorField from django.db import connection, connections, models from django.db.backends.utils import CursorWrapper from django.db.models.manager import Manager, RelatedManager @@ -886,3 +887,31 @@ def dictfetchall(cursor: CursorWrapper) -> List[Dict[str, Any]]: if col.name is not None: columns.append(col.name) return [dict(zip(columns, row)) for row in cursor.fetchall()] + + +class Foo(models.Model): + date_field = models.DateTimeField( + verbose_name="date field", + auto_now=True, + ) + decimal_field = models.DecimalField( + verbose_name="decimal field", + null=True, + default=None, + blank=True, + max_digits=2, + ) + + search_field = SearchVectorField(null=True, help_text="foo") + + +class HandField(models.Field[Any, Any]): + """ + from: https://docs.djangoproject.com/en/3.2/howto/custom-model-fields/#writing-a-field-subclass + """ + + description = "A hand of cards (bridge style)" + + def __init__(self, *args: Any, **kwargs: Any) -> None: + kwargs["max_length"] = 104 + super().__init__(*args, **kwargs) # type: ignore [call-arg] diff --git a/typings/django/contrib/postgres/search.pyi b/typings/django/contrib/postgres/search.pyi index 31ed57a77..455c997fa 100644 --- a/typings/django/contrib/postgres/search.pyi +++ b/typings/django/contrib/postgres/search.pyi @@ -1,4 +1,4 @@ -from typing import Any, Dict, Optional, TypeVar, Union +from typing import Any, Dict, Iterable, Optional, TypeVar, Union from django.db.models import Field from django.db.models.expressions import ( @@ -8,13 +8,68 @@ from django.db.models.expressions import ( Value, _OutputField, ) +from django.db.models.fields import ( + _ErrorMessagesToOverride, + _FieldChoices, + _ValidatorCallable, +) from django.db.models.lookups import Lookup _Expression = Union[str, Combinable, "SearchQueryCombinable"] class SearchVectorExact(Lookup[Any]): ... -class SearchVectorField(Field[Any, Any]): ... -class SearchQueryField(Field[Any, Any]): ... + +class SearchVectorField(Field[Any, Any]): + def __init__( + self, + verbose_name: Optional[Union[str, bytes]] = ..., + name: Optional[str] = ..., + primary_key: bool = ..., + max_length: Optional[int] = ..., + unique: bool = ..., + blank: bool = ..., + null: bool = ..., + db_index: bool = ..., + default: Any = ..., + editable: bool = ..., + auto_created: bool = ..., + serialize: bool = ..., + unique_for_date: Optional[str] = ..., + unique_for_month: Optional[str] = ..., + unique_for_year: Optional[str] = ..., + choices: Optional[_FieldChoices] = ..., + help_text: str = ..., + db_column: Optional[str] = ..., + db_tablespace: Optional[str] = ..., + validators: Iterable[_ValidatorCallable] = ..., + error_messages: Optional[_ErrorMessagesToOverride] = ..., + ) -> None: ... + +class SearchQueryField(Field[Any, Any]): + def __init__( + self, + verbose_name: Optional[Union[str, bytes]] = ..., + name: Optional[str] = ..., + primary_key: bool = ..., + max_length: Optional[int] = ..., + unique: bool = ..., + blank: bool = ..., + null: bool = ..., + db_index: bool = ..., + default: Any = ..., + editable: bool = ..., + auto_created: bool = ..., + serialize: bool = ..., + unique_for_date: Optional[str] = ..., + unique_for_month: Optional[str] = ..., + unique_for_year: Optional[str] = ..., + choices: Optional[_FieldChoices] = ..., + help_text: str = ..., + db_column: Optional[str] = ..., + db_tablespace: Optional[str] = ..., + validators: Iterable[_ValidatorCallable] = ..., + error_messages: Optional[_ErrorMessagesToOverride] = ..., + ) -> None: ... class SearchVectorCombinable: ADD: str = ... diff --git a/typings/django/db/models/fields/__init__.pyi b/typings/django/db/models/fields/__init__.pyi index e849ac731..3aed50123 100644 --- a/typings/django/db/models/fields/__init__.pyi +++ b/typings/django/db/models/fields/__init__.pyi @@ -72,30 +72,6 @@ class Field(RegisterLookupMixin, Generic[_ST, _GT]): column: str default: Any error_messages: _ErrorMessagesToOverride - def __new__( - cls, - verbose_name: Optional[Union[str, bytes]] = ..., - name: Optional[str] = ..., - primary_key: bool = ..., - max_length: Optional[int] = ..., - unique: bool = ..., - blank: bool = ..., - null: bool = ..., - db_index: bool = ..., - default: Any = ..., - editable: bool = ..., - auto_created: bool = ..., - serialize: bool = ..., - unique_for_date: Optional[str] = ..., - unique_for_month: Optional[str] = ..., - unique_for_year: Optional[str] = ..., - choices: Optional[_FieldChoices] = ..., - help_text: str = ..., - db_column: Optional[str] = ..., - db_tablespace: Optional[str] = ..., - validators: Iterable[_ValidatorCallable] = ..., - error_messages: Optional[_ErrorMessagesToOverride] = ..., - ) -> Field[_ST, _GT]: ... def __set__(self, instance: Any, value: _ST) -> None: ... # class access @overload @@ -554,7 +530,31 @@ class DecimalField( self, instance: Any, value: Union[str, float, Combinable, _DEC] ) -> None: ... -class AutoField(Field[Union[Combinable, int, str, None], int]): ... +class AutoField(Field[Union[Combinable, int, str, None], int]): + def __init__( + self, + verbose_name: Optional[Union[str, bytes]] = ..., + name: Optional[str] = ..., + primary_key: bool = ..., + max_length: Optional[int] = ..., + unique: bool = ..., + blank: bool = ..., + null: bool = ..., + db_index: bool = ..., + default: Any = ..., + editable: bool = ..., + auto_created: bool = ..., + serialize: bool = ..., + unique_for_date: Optional[str] = ..., + unique_for_month: Optional[str] = ..., + unique_for_year: Optional[str] = ..., + choices: Optional[_FieldChoices] = ..., + help_text: str = ..., + db_column: Optional[str] = ..., + db_tablespace: Optional[str] = ..., + validators: Iterable[_ValidatorCallable] = ..., + error_messages: Optional[_ErrorMessagesToOverride] = ..., + ) -> None: ... _C = TypeVar("_C", bound="Optional[str]") From 2dd0929e9a584736a38f88cfc031c0c699eebd92 Mon Sep 17 00:00:00 2001 From: Steve Dignam Date: Mon, 12 Jul 2021 20:50:21 -0400 Subject: [PATCH 52/88] release: 0.6.0 (#31) --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index a169acc8a..1a7306f5f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "django-types" -version = "0.5.3" +version = "0.6.0" description = "Type stubs for Django" repository = "https://github.com/sbdchd/django-types" readme = "README.md" From 55342b24829eafb127917850c4b7710c1d4ff543 Mon Sep 17 00:00:00 2001 From: Nikhil Benesch Date: Wed, 14 Jul 2021 17:01:40 -0400 Subject: [PATCH 53/88] Add PositiveBigIntegerField (#32) --- typings/django/db/models/__init__.pyi | 1 + typings/django/db/models/fields/__init__.pyi | 56 ++++++++++++++++++++ 2 files changed, 57 insertions(+) diff --git a/typings/django/db/models/__init__.pyi b/typings/django/db/models/__init__.pyi index f154dd2c5..dac446d02 100644 --- a/typings/django/db/models/__init__.pyi +++ b/typings/django/db/models/__init__.pyi @@ -69,6 +69,7 @@ from .fields import IntegerField as IntegerField from .fields import IPAddressField as IPAddressField from .fields import PositiveIntegerField as PositiveIntegerField from .fields import PositiveSmallIntegerField as PositiveSmallIntegerField +from .fields import PositiveBigIntegerField as PositiveBigIntegerField from .fields import SlugField as SlugField from .fields import SmallIntegerField as SmallIntegerField from .fields import TextField as TextField diff --git a/typings/django/db/models/fields/__init__.pyi b/typings/django/db/models/fields/__init__.pyi index 3aed50123..db9986c94 100644 --- a/typings/django/db/models/fields/__init__.pyi +++ b/typings/django/db/models/fields/__init__.pyi @@ -412,6 +412,62 @@ class BigIntegerField(IntegerField[_I]): self, instance: Any, value: Union[str, float, int, Combinable, _I] ) -> None: ... +class PositiveBigIntegerField(IntegerField[_I]): + @overload + def __init__( + self: PositiveBigIntegerField[int], + verbose_name: Optional[Union[str, bytes]] = ..., + name: Optional[str] = ..., + primary_key: bool = ..., + max_length: Optional[int] = ..., + unique: bool = ..., + blank: bool = ..., + null: Literal[False] = ..., + db_index: bool = ..., + default: Any = ..., + editable: bool = ..., + auto_created: bool = ..., + serialize: bool = ..., + unique_for_date: Optional[str] = ..., + unique_for_month: Optional[str] = ..., + unique_for_year: Optional[str] = ..., + choices: Optional[_FieldChoices] = ..., + help_text: str = ..., + db_column: Optional[str] = ..., + db_tablespace: Optional[str] = ..., + validators: Iterable[_ValidatorCallable] = ..., + error_messages: Optional[_ErrorMessagesToOverride] = ..., + ) -> None: ... + @overload + def __init__( + self: PositiveBigIntegerField[Optional[int]], + verbose_name: Optional[Union[str, bytes]] = ..., + name: Optional[str] = ..., + primary_key: bool = ..., + max_length: Optional[int] = ..., + unique: bool = ..., + blank: bool = ..., + null: Literal[True] = ..., + db_index: bool = ..., + default: Any = ..., + editable: bool = ..., + auto_created: bool = ..., + serialize: bool = ..., + unique_for_date: Optional[str] = ..., + unique_for_month: Optional[str] = ..., + unique_for_year: Optional[str] = ..., + choices: Optional[_FieldChoices] = ..., + help_text: str = ..., + db_column: Optional[str] = ..., + db_tablespace: Optional[str] = ..., + validators: Iterable[_ValidatorCallable] = ..., + error_messages: Optional[_ErrorMessagesToOverride] = ..., + ) -> None: ... + def __get__(self, instance: Any, owner: Any) -> _I: ... # type: ignore [override] + def __set__( + self, instance: Any, value: Union[str, float, int, Combinable, _I] + ) -> None: ... + _F = TypeVar("_F", bound=Optional[float]) class FloatField(Generic[_F], Field[Union[float, int, str, Combinable], float]): From 6dc816dccd743dc0219afb3cd6c5119cc52739c3 Mon Sep 17 00:00:00 2001 From: Steve Dignam Date: Wed, 14 Jul 2021 17:05:11 -0400 Subject: [PATCH 54/88] release: 0.6.1 (#33) --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 1a7306f5f..657f7652f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "django-types" -version = "0.6.0" +version = "0.6.1" description = "Type stubs for Django" repository = "https://github.com/sbdchd/django-types" readme = "README.md" From 4cdbeb783d9b3ddbafc677c74e4191e2bdc56cb4 Mon Sep 17 00:00:00 2001 From: Nikhil Benesch Date: Thu, 15 Jul 2021 22:47:29 -0400 Subject: [PATCH 55/88] Add stubs for new admin decorators (#37) --- typings/django/contrib/admin/decorators.pyi | 22 ++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/typings/django/contrib/admin/decorators.pyi b/typings/django/contrib/admin/decorators.pyi index b6ed1c22e..4ee2c3569 100644 --- a/typings/django/contrib/admin/decorators.pyi +++ b/typings/django/contrib/admin/decorators.pyi @@ -1,5 +1,25 @@ -from typing import Any, Callable, Optional, Type +from typing import Any, Callable, Optional, Sequence, Type, TypeVar, Union +from django.contrib.admin import ModelAdmin +from django.db.models import Combinable, QuerySet from django.db.models.base import Model +from django.db.models.expressions import BaseExpression +from django.http import HttpRequest, HttpResponse +_M = TypeVar("_M", bound=Model) + +def action( + function: Optional[Callable[[ModelAdmin[_M], HttpRequest, QuerySet[_M]], Optional[HttpResponse]]] = ..., + *, + permissions: Optional[Sequence[str]] = ..., + description: Optional[str] = ..., +) -> Callable[..., Any]: ... +def display( + function: Optional[Callable[[_M], Any]] = ..., + *, + boolean: Optional[bool] = ..., + ordering: Optional[Union[str, Combinable, BaseExpression]] = ..., + description: Optional[str] = ..., + empty_value: Optional[str] = ..., +) -> Callable[..., Any]: ... def register(*models: Type[Model], site: Optional[Any] = ...) -> Callable[..., Any]: ... From 7f8a86ae976db5d3ccb8e915c078d4d6a480d753 Mon Sep 17 00:00:00 2001 From: Nikhil Benesch Date: Thu, 15 Jul 2021 22:49:27 -0400 Subject: [PATCH 56/88] Add `objects` manager to django.contrib.auth.models.User (#36) --- typings/django/contrib/auth/models.pyi | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/typings/django/contrib/auth/models.pyi b/typings/django/contrib/auth/models.pyi index a62b06e10..5e057b355 100644 --- a/typings/django/contrib/auth/models.pyi +++ b/typings/django/contrib/auth/models.pyi @@ -8,7 +8,7 @@ from django.contrib.auth.validators import UnicodeUsernameValidator from django.contrib.contenttypes.models import ContentType from django.db import models from django.db.models.base import Model -from django.db.models.manager import EmptyManager +from django.db.models.manager import EmptyManager, Manager if sys.version_info < (3, 8): from typing_extensions import Literal @@ -103,7 +103,8 @@ class AbstractUser(AbstractBaseUser, PermissionsMixin): self, subject: str, message: str, from_email: str = ..., **kwargs: Any ) -> None: ... -class User(AbstractUser): ... +class User(AbstractUser): + objects: Manager[User] class AnonymousUser: id: Any = ... From afb4446d449ef6d822e2da31fbac4632719640c8 Mon Sep 17 00:00:00 2001 From: Nikhil Benesch Date: Thu, 15 Jul 2021 22:50:57 -0400 Subject: [PATCH 57/88] Add stub for django.contrib.postgres.operations.AddIndexConcurrently (#35) --- typings/django/contrib/postgres/operations.pyi | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/typings/django/contrib/postgres/operations.pyi b/typings/django/contrib/postgres/operations.pyi index 94fb10a87..8f1cdb00f 100644 --- a/typings/django/contrib/postgres/operations.pyi +++ b/typings/django/contrib/postgres/operations.pyi @@ -1,4 +1,8 @@ +from typing import Union + +from django.db.migrations import AddIndex from django.db.migrations.operations.base import Operation +from django.db.models.indexes import Index class CreateExtension(Operation): reversible: bool = ... @@ -25,3 +29,6 @@ class TrigramExtension(CreateExtension): class UnaccentExtension(CreateExtension): def __init__(self) -> None: ... + +class AddIndexConcurrently(AddIndex): + def __init__(self, model_name: str, index: Union[str, Index]) -> None: ... From 0f9dd47492c63023575e08700e5860f11b2b9f34 Mon Sep 17 00:00:00 2001 From: Steve Dignam Date: Thu, 15 Jul 2021 22:54:50 -0400 Subject: [PATCH 58/88] release: 0.6.1 (#39) --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 657f7652f..e2605fc51 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "django-types" -version = "0.6.1" +version = "0.6.2" description = "Type stubs for Django" repository = "https://github.com/sbdchd/django-types" readme = "README.md" From 4508e1f0c7a7f30cf30c2631b2881b5a023197ae Mon Sep 17 00:00:00 2001 From: Nikhil Benesch Date: Fri, 16 Jul 2021 09:03:14 -0400 Subject: [PATCH 59/88] Expose new admin decorators in django.contrib.admin (#40) I forgot this important step in #37. --- typings/django/contrib/admin/__init__.pyi | 2 ++ 1 file changed, 2 insertions(+) diff --git a/typings/django/contrib/admin/__init__.pyi b/typings/django/contrib/admin/__init__.pyi index 790f42447..84c1ccd45 100644 --- a/typings/django/contrib/admin/__init__.pyi +++ b/typings/django/contrib/admin/__init__.pyi @@ -1,4 +1,6 @@ from . import checks as checks +from .decorators import action as action +from .decorators import display as display from .decorators import register as register from .filters import AllValuesFieldListFilter as AllValuesFieldListFilter from .filters import BooleanFieldListFilter as BooleanFieldListFilter From c41eca0341da6baadb9fd6dd815c434e89bd3195 Mon Sep 17 00:00:00 2001 From: Nikhil Benesch Date: Fri, 16 Jul 2021 09:04:57 -0400 Subject: [PATCH 60/88] Add new exceptions from Django 3.2 (#41) --- typings/django/core/exceptions.pyi | 3 +++ 1 file changed, 3 insertions(+) diff --git a/typings/django/core/exceptions.pyi b/typings/django/core/exceptions.pyi index 20429bf3f..83f88dcd6 100644 --- a/typings/django/core/exceptions.pyi +++ b/typings/django/core/exceptions.pyi @@ -16,6 +16,8 @@ class DisallowedHost(SuspiciousOperation): ... class DisallowedRedirect(SuspiciousOperation): ... class TooManyFieldsSent(SuspiciousOperation): ... class RequestDataTooBig(SuspiciousOperation): ... +class RequestAborted(Exception): ... +class BadRequest(Exception): ... class PermissionDenied(Exception): ... class ViewDoesNotExist(Exception): ... class MiddlewareNotUsed(Exception): ... @@ -46,3 +48,4 @@ class ValidationError(Exception): def __iter__(self) -> Iterator[Union[Tuple[str, List[str]], str]]: ... class EmptyResultSet(Exception): ... +class SynchronousOnlyOperation(Exception): ... From ac276cc4469ffdafa359d791ec8a8dfc9a1e5eef Mon Sep 17 00:00:00 2001 From: Steve Dignam Date: Fri, 16 Jul 2021 09:14:37 -0400 Subject: [PATCH 61/88] fix(django): contrib.auth.models.User.objects, Manager -> UserManager (#42) UserManager has a couple more methods --- tests/trout/models.py | 4 ++++ typings/django/contrib/auth/models.pyi | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/tests/trout/models.py b/tests/trout/models.py index 0789d364b..4321cfaeb 100644 --- a/tests/trout/models.py +++ b/tests/trout/models.py @@ -7,6 +7,7 @@ from uuid import UUID import psycopg2 +from django.contrib.auth.models import User as AuthUser from django.contrib.postgres.fields import ( ArrayField, CICharField, @@ -915,3 +916,6 @@ class HandField(models.Field[Any, Any]): def __init__(self, *args: Any, **kwargs: Any) -> None: kwargs["max_length"] = 104 super().__init__(*args, **kwargs) # type: ignore [call-arg] + + +AuthUser.objects.create_superuser(username="foo", email=None, password=None) diff --git a/typings/django/contrib/auth/models.pyi b/typings/django/contrib/auth/models.pyi index 5e057b355..9a54951b2 100644 --- a/typings/django/contrib/auth/models.pyi +++ b/typings/django/contrib/auth/models.pyi @@ -8,7 +8,7 @@ from django.contrib.auth.validators import UnicodeUsernameValidator from django.contrib.contenttypes.models import ContentType from django.db import models from django.db.models.base import Model -from django.db.models.manager import EmptyManager, Manager +from django.db.models.manager import EmptyManager if sys.version_info < (3, 8): from typing_extensions import Literal @@ -104,7 +104,7 @@ class AbstractUser(AbstractBaseUser, PermissionsMixin): ) -> None: ... class User(AbstractUser): - objects: Manager[User] + objects: UserManager[User] class AnonymousUser: id: Any = ... From 310c7010d6cead692cc4cd6a707b0e6f11d8c1c7 Mon Sep 17 00:00:00 2001 From: Steve Dignam Date: Fri, 16 Jul 2021 09:22:16 -0400 Subject: [PATCH 62/88] release: 0.7.0 (#43) --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index e2605fc51..adfe9ef5b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "django-types" -version = "0.6.2" +version = "0.7.0" description = "Type stubs for Django" repository = "https://github.com/sbdchd/django-types" readme = "README.md" From 2a5a56c550dcfe4f50bd4f13e698aad9dcc4551d Mon Sep 17 00:00:00 2001 From: Thiago Bellini Ribeiro Date: Sun, 1 Aug 2021 11:19:19 -0300 Subject: [PATCH 63/88] Improve README.md (#45) * Do not recomment using django-stubs-ext anymore, it is confusing since it was created for django-stubs itself * Add `ForeignKey` to the list of classes that needs to be patched * Improve documentation for `ForeignKey` and `RelatedManager` typing --- README.md | 93 +++++++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 80 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index 3d5aee221..b48bffe37 100644 --- a/README.md +++ b/README.md @@ -17,18 +17,19 @@ Type stubs for [Django](https://www.djangoproject.com). pip install django-types ``` -If you're on a Django version < 3.1, you'll need to monkey patch Django's -`QuerySet` and `Manager` classes so we can index into them with a generic -argument. You can either use [`django-stubs-ext`](https://pypi.org/project/django-stubs-ext/) or do this yourself manually: +You'll need to monkey patch Django's `QuerySet`, `Manager` (note needed for Django 3.2+) and +`ForeignKey` classes so we can index into them with a generic argument. Add this to your +settings.py: ```python # in settings.py +from django.db.models import ForeignKey from django.db.models.manager import BaseManager from django.db.models.query import QuerySet # NOTE: there are probably other items you'll need to monkey patch depending on # your version. -for cls in (QuerySet, BaseManager): +for cls in [QuerySet, BaseManager, ForeignKey]: cls.__class_getitem__ = classmethod(lambda cls, *args, **kwargs: cls) # type: ignore [attr-defined] ``` @@ -41,38 +42,104 @@ have to explicitly type the property. ```python from django.db import connection, models -from django.db.models.manager import Manager + class User(models.Model): - title = models.CharField(max_length=255) + objects = models.Manager["User"]() - objects = Manager["User"]() reveal_type(User.objects.all().first()) # note: Revealed type is 'Optional[User]' ``` -### ForeignKey ids as properties in ORM models +### ForeignKey ids and related names as properties in ORM models When defining a Django ORM model with a foreign key, like so: ```python class User(models.Model): - team = models.ForeignKey("Team", null=True, on_delete=models.SET_NULL) + team = models.ForeignKey( + "Team", + null=True, + on_delete=models.SET_NULL, + ) + role = models.ForeignKey( + "Role", + null=True, + on_delete=models.SET_NULL, + related_name="users", + ) ``` -two properties are created, `team` as expected, and `team_id`. In order for -mypy to know about the id property we need to define it manually as follows: +two properties are created, `team` as expected, and `team_id`. Also, a related +manager called `user_set` is created on `Team` for the reverse access. + +In order to properly add typing to the foreing key itself and also for the created ids you can do +something like this: ```python from typing import TYPE_CHECKING +from someapp.models import Team +if TYPE_CHECKING: + # In this example Role cannot be imported due to circular import issues, + # but doing so inside TYPE_CHECKING will make sure that the typing bellow + # knows what "Role" means + from anotherapp.models import Role + + class User(models.Model): - team = models.ForeignKey("Team", null=True, on_delete=models.SET_NULL) + team_id: Optional[int] + team = models.ForeignKey( + Team, + null=True, + on_delete=models.SET_NULL, + ) + role_id: int + role = models.ForeignKey["Role"]( + "Role", + null=False, + on_delete=models.SET_NULL, + related_name="users", + ) + + +reveal_type(User().team) +# note: Revealed type is 'Optional[Team]' +reveal_type(User().role) +# note: Revealed type is 'Role' +``` + +This will make sure that `team_id` and `role_id` can be accessed. Also, `team` and `role` +will be typed to their right objects. + +To be able to access the related manager `Team` and `Role` you could do: + +```python +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + # This doesn't really on django exist so it always need to be imported this way + from django.db.models.manager import RelatedManager + from user.models import User + + +class Team(models.Model): if TYPE_CHECKING: - team_id: int + user_set = RelatedManager["User"]() + + +class Role(models.Model): + if TYPE_CHECKING: + users = RelatedManager["User"]() + +reveal_type(Team().user_set) +# note: Revealed type is 'RelatedManager[User]' +reveal_type(Role().users) +# note: Revealed type is 'RelatedManager[User]' ``` + ### `AutoField` By default Django will create an `AutoField` for you if one doesn't exist. From 0d119893125ff04a213db0bdf31976825de538e6 Mon Sep 17 00:00:00 2001 From: Steve Dignam Date: Tue, 10 Aug 2021 22:18:16 -0400 Subject: [PATCH 64/88] ref(django): cache types to be more strict (#47) We may need to loosen these, but as a default they should work pretty well. Previously we typed the global cache as `Any`, but `BaseCache` should work and has the various methods defined as well. https://github.com/sbdchd/django-types/issues/46 --- tests/trout/models.py | 4 +++ typings/django/core/cache/__init__.pyi | 2 +- typings/django/core/cache/backends/base.pyi | 28 ++++++++++----------- 3 files changed, 19 insertions(+), 15 deletions(-) diff --git a/tests/trout/models.py b/tests/trout/models.py index 4321cfaeb..8a8dd541a 100644 --- a/tests/trout/models.py +++ b/tests/trout/models.py @@ -17,6 +17,7 @@ JSONField, ) from django.contrib.postgres.search import SearchVectorField +from django.core.cache import cache from django.db import connection, connections, models from django.db.backends.utils import CursorWrapper from django.db.models.manager import Manager, RelatedManager @@ -232,6 +233,9 @@ def main() -> None: ) print(res) + cache.set("foo", "bar") + cache.set_many({}, timeout=10, version=10) + request = HttpRequest() header = request.headers.get("FOO") if header is not None and not isinstance(header, str): diff --git a/typings/django/core/cache/__init__.pyi b/typings/django/core/cache/__init__.pyi index 6401fbc6e..55b18b86e 100644 --- a/typings/django/core/cache/__init__.pyi +++ b/typings/django/core/cache/__init__.pyi @@ -20,5 +20,5 @@ class DefaultCacheProxy: def __delattr__(self, name: Any) -> Any: ... def __contains__(self, key: str) -> bool: ... -cache: Any +cache: BaseCache caches: CacheHandler diff --git a/typings/django/core/cache/backends/base.pyi b/typings/django/core/cache/backends/base.pyi index cd92bcd96..0a9f53452 100644 --- a/typings/django/core/cache/backends/base.pyi +++ b/typings/django/core/cache/backends/base.pyi @@ -5,10 +5,10 @@ from django.core.exceptions import ImproperlyConfigured class InvalidCacheBackendError(ImproperlyConfigured): ... class CacheKeyWarning(RuntimeWarning): ... -DEFAULT_TIMEOUT: Any +DEFAULT_TIMEOUT: int MEMCACHE_MAX_KEY_LENGTH: int -def default_key_func(key: Any, key_prefix: str, version: Any) -> str: ... +def default_key_func(key: str, key_prefix: str, version: Any) -> str: ... def get_key_func( key_func: Optional[Union[Callable[..., Any], str]] ) -> Callable[..., Any]: ... @@ -19,40 +19,40 @@ class BaseCache: version: int = ... key_func: Callable[..., Any] = ... def __init__(self, params: Dict[str, Any]) -> None: ... - def get_backend_timeout(self, timeout: Any = ...) -> Optional[float]: ... - def make_key(self, key: Any, version: Optional[Any] = ...) -> str: ... + def get_backend_timeout(self, timeout: int = ...) -> Optional[float]: ... + def make_key(self, key: str, version: Optional[int] = ...) -> str: ... def add( - self, key: Any, value: Any, timeout: Any = ..., version: Optional[Any] = ... + self, key: str, value: Any, timeout: int = ..., version: Optional[int] = ... ) -> bool: ... def get( - self, key: Any, default: Optional[Any] = ..., version: Optional[Any] = ... + self, key: str, default: Optional[Any] = ..., version: Optional[int] = ... ) -> Any: ... def set( - self, key: Any, value: Any, timeout: Any = ..., version: Optional[Any] = ... + self, key: str, value: Any, timeout: int = ..., version: Optional[int] = ... ) -> None: ... def touch( - self, key: Any, timeout: Any = ..., version: Optional[Any] = ... + self, key: str, timeout: int = ..., version: Optional[int] = ... ) -> bool: ... - def delete(self, key: Any, version: Optional[Any] = ...) -> None: ... + def delete(self, key: str, version: Optional[int] = ...) -> None: ... def get_many( self, keys: List[str], version: Optional[int] = ... ) -> Dict[str, Union[int, str]]: ... def get_or_set( self, - key: Any, + key: str, default: Optional[Any], - timeout: Any = ..., + timeout: int = ..., version: Optional[int] = ..., ) -> Optional[Any]: ... - def has_key(self, key: Any, version: Optional[Any] = ...) -> bool: ... + def has_key(self, key: str, version: Optional[int] = ...) -> bool: ... def incr(self, key: str, delta: int = ..., version: Optional[int] = ...) -> int: ... def decr(self, key: str, delta: int = ..., version: Optional[int] = ...) -> int: ... def __contains__(self, key: str) -> bool: ... def set_many( - self, data: Dict[str, Any], timeout: Any = ..., version: Optional[Any] = ... + self, data: Dict[str, Any], timeout: int = ..., version: Optional[int] = ... ) -> List[Any]: ... def delete_many( - self, keys: Iterable[Any], version: Optional[Any] = ... + self, keys: Iterable[str], version: Optional[int] = ... ) -> None: ... def clear(self) -> None: ... def validate_key(self, key: str) -> None: ... From 55219def6c4aaa0b6d0e14bb736cfc920b03e1d6 Mon Sep 17 00:00:00 2001 From: Steve Dignam Date: Tue, 10 Aug 2021 22:26:15 -0400 Subject: [PATCH 65/88] release: 0.8.0 (#48) --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index adfe9ef5b..dad28d04c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "django-types" -version = "0.7.0" +version = "0.8.0" description = "Type stubs for Django" repository = "https://github.com/sbdchd/django-types" readme = "README.md" From 53bc484cfa17120df736d8380d274c909ab12b44 Mon Sep 17 00:00:00 2001 From: Thiago Bellini Ribeiro Date: Mon, 30 Aug 2021 18:25:05 -0300 Subject: [PATCH 66/88] timeout can be None in cache functions (#49) --- typings/django/contrib/admin/decorators.pyi | 4 +++- typings/django/core/cache/backends/base.pyi | 23 +++++++++++++++------ typings/django/db/models/__init__.pyi | 2 +- 3 files changed, 21 insertions(+), 8 deletions(-) diff --git a/typings/django/contrib/admin/decorators.pyi b/typings/django/contrib/admin/decorators.pyi index 4ee2c3569..a55802e62 100644 --- a/typings/django/contrib/admin/decorators.pyi +++ b/typings/django/contrib/admin/decorators.pyi @@ -9,7 +9,9 @@ from django.http import HttpRequest, HttpResponse _M = TypeVar("_M", bound=Model) def action( - function: Optional[Callable[[ModelAdmin[_M], HttpRequest, QuerySet[_M]], Optional[HttpResponse]]] = ..., + function: Optional[ + Callable[[ModelAdmin[_M], HttpRequest, QuerySet[_M]], Optional[HttpResponse]] + ] = ..., *, permissions: Optional[Sequence[str]] = ..., description: Optional[str] = ..., diff --git a/typings/django/core/cache/backends/base.pyi b/typings/django/core/cache/backends/base.pyi index 0a9f53452..866bb0527 100644 --- a/typings/django/core/cache/backends/base.pyi +++ b/typings/django/core/cache/backends/base.pyi @@ -19,19 +19,27 @@ class BaseCache: version: int = ... key_func: Callable[..., Any] = ... def __init__(self, params: Dict[str, Any]) -> None: ... - def get_backend_timeout(self, timeout: int = ...) -> Optional[float]: ... + def get_backend_timeout(self, timeout: Optional[int] = ...) -> Optional[float]: ... def make_key(self, key: str, version: Optional[int] = ...) -> str: ... def add( - self, key: str, value: Any, timeout: int = ..., version: Optional[int] = ... + self, + key: str, + value: Any, + timeout: Optional[int] = ..., + version: Optional[int] = ..., ) -> bool: ... def get( self, key: str, default: Optional[Any] = ..., version: Optional[int] = ... ) -> Any: ... def set( - self, key: str, value: Any, timeout: int = ..., version: Optional[int] = ... + self, + key: str, + value: Any, + timeout: Optional[int] = ..., + version: Optional[int] = ..., ) -> None: ... def touch( - self, key: str, timeout: int = ..., version: Optional[int] = ... + self, key: str, timeout: Optional[int] = ..., version: Optional[int] = ... ) -> bool: ... def delete(self, key: str, version: Optional[int] = ...) -> None: ... def get_many( @@ -41,7 +49,7 @@ class BaseCache: self, key: str, default: Optional[Any], - timeout: int = ..., + timeout: Optional[int] = ..., version: Optional[int] = ..., ) -> Optional[Any]: ... def has_key(self, key: str, version: Optional[int] = ...) -> bool: ... @@ -49,7 +57,10 @@ class BaseCache: def decr(self, key: str, delta: int = ..., version: Optional[int] = ...) -> int: ... def __contains__(self, key: str) -> bool: ... def set_many( - self, data: Dict[str, Any], timeout: int = ..., version: Optional[int] = ... + self, + data: Dict[str, Any], + timeout: Optional[int] = ..., + version: Optional[int] = ..., ) -> List[Any]: ... def delete_many( self, keys: Iterable[str], version: Optional[int] = ... diff --git a/typings/django/db/models/__init__.pyi b/typings/django/db/models/__init__.pyi index dac446d02..de71b4038 100644 --- a/typings/django/db/models/__init__.pyi +++ b/typings/django/db/models/__init__.pyi @@ -67,9 +67,9 @@ from .fields import FloatField as FloatField from .fields import GenericIPAddressField as GenericIPAddressField from .fields import IntegerField as IntegerField from .fields import IPAddressField as IPAddressField +from .fields import PositiveBigIntegerField as PositiveBigIntegerField from .fields import PositiveIntegerField as PositiveIntegerField from .fields import PositiveSmallIntegerField as PositiveSmallIntegerField -from .fields import PositiveBigIntegerField as PositiveBigIntegerField from .fields import SlugField as SlugField from .fields import SmallIntegerField as SmallIntegerField from .fields import TextField as TextField From 7f8ed6ae7055a5496cd07e91217e536ddd290b75 Mon Sep 17 00:00:00 2001 From: Steve Dignam Date: Mon, 30 Aug 2021 18:17:35 -0400 Subject: [PATCH 67/88] release: 0.8.1 (#50) --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index dad28d04c..20edabce4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "django-types" -version = "0.8.0" +version = "0.8.1" description = "Type stubs for Django" repository = "https://github.com/sbdchd/django-types" readme = "README.md" From 7c4845529cf27ed8f41f0b91bbf16fc642af9e53 Mon Sep 17 00:00:00 2001 From: Thiago Bellini Ribeiro Date: Sat, 23 Oct 2021 16:16:45 -0300 Subject: [PATCH 68/88] Improve objects inside Model (#54) With this change we should be able to get `Foo.objects` to return `Manager[Foo]` without having to manually type it. --- README.md | 19 +------------------ tests/trout/models.py | 10 ++++++---- .../django/contrib/contenttypes/models.pyi | 3 ++- typings/django/db/models/base.pyi | 16 ++++++++++------ typings/django/db/models/options.pyi | 8 ++++---- 5 files changed, 23 insertions(+), 33 deletions(-) diff --git a/README.md b/README.md index b48bffe37..aba5023ad 100644 --- a/README.md +++ b/README.md @@ -35,23 +35,6 @@ for cls in [QuerySet, BaseManager, ForeignKey]: ## usage -### getting `objects` to work - -By default the base `Model` class doesn't have `objects` defined, so you'll -have to explicitly type the property. - -```python -from django.db import connection, models - - -class User(models.Model): - objects = models.Manager["User"]() - - -reveal_type(User.objects.all().first()) -# note: Revealed type is 'Optional[User]' -``` - ### ForeignKey ids and related names as properties in ORM models When defining a Django ORM model with a foreign key, like so: @@ -119,7 +102,7 @@ To be able to access the related manager `Team` and `Role` you could do: from typing import TYPE_CHECKING if TYPE_CHECKING: - # This doesn't really on django exist so it always need to be imported this way + # This doesn't really exists on django so it always need to be imported this way from django.db.models.manager import RelatedManager from user.models import User diff --git a/tests/trout/models.py b/tests/trout/models.py index 8a8dd541a..a8c31bdb5 100644 --- a/tests/trout/models.py +++ b/tests/trout/models.py @@ -20,7 +20,7 @@ from django.core.cache import cache from django.db import connection, connections, models from django.db.backends.utils import CursorWrapper -from django.db.models.manager import Manager, RelatedManager +from django.db.models.manager import RelatedManager from django.http.request import HttpRequest from django.http.response import HttpResponse from django.middleware.cache import CacheMiddleware @@ -202,8 +202,6 @@ class Comment(models.Model): metadata = JSONField() other_metadata = models.JSONField() - objects = Manager["Comment"]() - def process_non_nullable( x: Union[ @@ -251,7 +249,11 @@ def main() -> None: comment.auth_token = User() comment.save() - Comment.objects.filter(foo=True).filter(bar=False).first() + maybe_c = Comment.objects.filter(foo=True).filter(bar=False).first() + if maybe_c is not None: + process_non_nullable(maybe_c.integer) + for_sure_c = Comment.objects.get(pk=comment.pk) + process_non_nullable(for_sure_c.integer) # Django way to duplicate an instance comment.id = None diff --git a/typings/django/contrib/contenttypes/models.pyi b/typings/django/contrib/contenttypes/models.pyi index 6b594873b..34100eaad 100644 --- a/typings/django/contrib/contenttypes/models.pyi +++ b/typings/django/contrib/contenttypes/models.pyi @@ -2,9 +2,10 @@ from typing import Any, Dict, Optional, Tuple, Type, Union from django.db import models from django.db.models.base import Model +from django.db.models.manager import BaseManager from django.db.models.query import QuerySet -class ContentTypeManager(models.Manager["ContentType"]): +class ContentTypeManager(BaseManager["ContentType"]): def get_by_natural_key(self, app_label: str, model: str) -> ContentType: ... def get_for_model( self, model: Union[Type[Model], Model], for_concrete_model: bool = ... diff --git a/typings/django/db/models/base.pyi b/typings/django/db/models/base.pyi index a419c43be..abea726ed 100644 --- a/typings/django/db/models/base.pyi +++ b/typings/django/db/models/base.pyi @@ -21,6 +21,7 @@ from django.core.exceptions import ObjectDoesNotExist, ValidationError from django.db.models.manager import BaseManager from django.db.models.options import Options +_M = TypeVar("_M", bound=Any) _Self = TypeVar("_Self", bound="Model") class ModelStateFieldsCacheDescriptor: ... @@ -30,17 +31,20 @@ class ModelState: adding: bool = ... fields_cache: ModelStateFieldsCacheDescriptor = ... -class ModelBase(type): ... +class ModelBase(type): + # FIXME: It would be better to use _Self instead of _M here, + # but pyright says Type[_Self] cannot be assigned here... Maybe a bug in pyright? + @property + def objects(cls: Type[_M]) -> BaseManager[_M]: ... + @property + def _meta(cls: Type[_M]) -> Options[_M]: ... + @property + def _default_manager(cls: Type[_M]) -> BaseManager[_M]: ... class Model(metaclass=ModelBase): class DoesNotExist(ObjectDoesNotExist): ... class MultipleObjectsReturned(BaseMultipleObjectsReturned): ... class Meta: ... - _meta: Options[Any] - _default_manager: BaseManager[Model] - # NOTE(sbdchd): we don't include the objects property since we want - # to force subclasses to specify the property with an explicit type. - # objects: BaseManager[Any] pk: Any = ... _state: ModelState def __init__(self, *args: Any, **kwargs: Any) -> None: ... diff --git a/typings/django/db/models/options.pyi b/typings/django/db/models/options.pyi index af580f82a..2787f51c3 100644 --- a/typings/django/db/models/options.pyi +++ b/typings/django/db/models/options.pyi @@ -52,7 +52,7 @@ class Options(Generic[_M]): base_manager: Manager[Any] concrete_fields: ImmutableList[Any] constraints: List[BaseConstraint] - default_manager: Manager[Any] + default_manager: Manager[_M] fields: ImmutableList[Any] local_concrete_fields: ImmutableList[Any] related_objects: ImmutableList[Any] @@ -89,15 +89,15 @@ class Options(Generic[_M]): abstract: bool = ... managed: bool = ... proxy: bool = ... - proxy_for_model: Optional[Type[Model]] = ... - concrete_model: Optional[Type[Model]] = ... + proxy_for_model: Optional[Type[_M]] = ... + concrete_model: Optional[Type[_M]] = ... swappable: None = ... parents: Dict[Any, Any] = ... auto_created: bool = ... related_fkey_lookups: List[Any] = ... apps: Apps = ... default_related_name: Optional[str] = ... - model: Type[Model] = ... + model: Type[_M] = ... original_attrs: Dict[str, Any] = ... def __init__( self, meta: Optional[type], app_label: Optional[str] = ... From 0c4c80ca43793514dbe71e91ae7d0408a1040480 Mon Sep 17 00:00:00 2001 From: Steve Dignam Date: Sat, 23 Oct 2021 15:23:01 -0400 Subject: [PATCH 69/88] ref(ci): update poetry to non-ancient version (#56) Now that Kodiak is using the latest poetry using any of the other projects on the old version is a pain. So upgrade time! --- .circleci/config.yml | 5 +- poetry.lock | 546 +++++++++++++++++++++++++++++-------------- pyproject.toml | 20 +- 3 files changed, 388 insertions(+), 183 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index ab57b897a..af89b23db 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -15,9 +15,8 @@ jobs: # Use our new PATH so we can call poetry from bash echo 'export PATH="$PATH":"$HOME"/.local/bin' >> $BASH_ENV source $BASH_ENV - sudo python -m pip uninstall poetry -y - python -m pip install --user poetry==0.12.11 - poetry config settings.virtualenvs.in-project true + python -m pip install --user poetry==1.1.9 + poetry config virtualenvs.in-project true poetry --version poetry install - run: diff --git a/poetry.lock b/poetry.lock index bd7012ab0..91d4784ae 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1,47 +1,59 @@ [[package]] -category = "dev" -description = "A small Python module for determining appropriate platform-specific dirs, e.g. a \"user data dir\"." name = "appdirs" +version = "1.4.4" +description = "A small Python module for determining appropriate platform-specific dirs, e.g. a \"user data dir\"." +category = "dev" optional = false python-versions = "*" -version = "1.4.4" [[package]] -category = "dev" -description = "ASGI specs, helper code, and adapters" name = "asgiref" +version = "3.4.1" +description = "ASGI specs, helper code, and adapters" +category = "dev" optional = false -python-versions = ">=3.5" -version = "3.3.1" +python-versions = ">=3.6" + +[package.dependencies] +typing-extensions = {version = "*", markers = "python_version < \"3.8\""} + +[package.extras] +tests = ["pytest", "pytest-asyncio", "mypy (>=0.800)"] [[package]] -category = "dev" -description = "Atomic file writes." -marker = "sys_platform == \"win32\"" name = "atomicwrites" +version = "1.4.0" +description = "Atomic file writes." +category = "dev" optional = false python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" -version = "1.4.0" [[package]] -category = "dev" -description = "Classes Without Boilerplate" name = "attrs" +version = "21.2.0" +description = "Classes Without Boilerplate" +category = "dev" optional = false -python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" -version = "20.3.0" +python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*" + +[package.extras] +dev = ["coverage[toml] (>=5.0.2)", "hypothesis", "pympler", "pytest (>=4.3.0)", "six", "mypy", "pytest-mypy-plugins", "zope.interface", "furo", "sphinx", "sphinx-notfound-page", "pre-commit"] +docs = ["furo", "sphinx", "zope.interface", "sphinx-notfound-page"] +tests = ["coverage[toml] (>=5.0.2)", "hypothesis", "pympler", "pytest (>=4.3.0)", "six", "mypy", "pytest-mypy-plugins", "zope.interface"] +tests_no_zope = ["coverage[toml] (>=5.0.2)", "hypothesis", "pympler", "pytest (>=4.3.0)", "six", "mypy", "pytest-mypy-plugins"] [[package]] -category = "dev" -description = "The uncompromising code formatter." name = "black" +version = "20.8b1" +description = "The uncompromising code formatter." +category = "dev" optional = false python-versions = ">=3.6" -version = "20.8b1" [package.dependencies] appdirs = "*" click = ">=7.1.2" +dataclasses = {version = ">=0.6", markers = "python_version < \"3.7\""} mypy-extensions = ">=0.4.3" pathspec = ">=0.6,<1" regex = ">=2020.1.8" @@ -49,321 +61,515 @@ toml = ">=0.10.1" typed-ast = ">=1.4.0" typing-extensions = ">=3.7.4" -[package.dependencies.dataclasses] -python = "<3.7" -version = ">=0.6" +[package.extras] +colorama = ["colorama (>=0.4.3)"] +d = ["aiohttp (>=3.3.2)", "aiohttp-cors"] [[package]] -category = "dev" -description = "Composable command line interface toolkit" name = "click" +version = "8.0.3" +description = "Composable command line interface toolkit" +category = "dev" optional = false -python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*" -version = "7.1.2" +python-versions = ">=3.6" + +[package.dependencies] +colorama = {version = "*", markers = "platform_system == \"Windows\""} +importlib-metadata = {version = "*", markers = "python_version < \"3.8\""} [[package]] -category = "dev" -description = "Cross-platform colored terminal text." -marker = "sys_platform == \"win32\"" name = "colorama" +version = "0.4.4" +description = "Cross-platform colored terminal text." +category = "dev" optional = false python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*" -version = "0.4.4" [[package]] -category = "dev" -description = "A backport of the dataclasses module for Python 3.6" -marker = "python_version < \"3.7\"" name = "dataclasses" +version = "0.8" +description = "A backport of the dataclasses module for Python 3.6" +category = "dev" optional = false -python-versions = "*" -version = "0.6" +python-versions = ">=3.6, <3.7" [[package]] -category = "dev" -description = "A high-level Python Web framework that encourages rapid development and clean, pragmatic design." name = "django" +version = "3.1.7" +description = "A high-level Python Web framework that encourages rapid development and clean, pragmatic design." +category = "dev" optional = false python-versions = ">=3.6" -version = "3.1.7" [package.dependencies] asgiref = ">=3.2.10,<4" pytz = "*" sqlparse = ">=0.2.2" +[package.extras] +argon2 = ["argon2-cffi (>=16.1.0)"] +bcrypt = ["bcrypt"] + [[package]] -category = "dev" -description = "the modular source code checker: pep8 pyflakes and co" name = "flake8" +version = "3.8.4" +description = "the modular source code checker: pep8 pyflakes and co" +category = "dev" optional = false python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,>=2.7" -version = "3.8.4" [package.dependencies] +importlib-metadata = {version = "*", markers = "python_version < \"3.8\""} mccabe = ">=0.6.0,<0.7.0" pycodestyle = ">=2.6.0a1,<2.7.0" pyflakes = ">=2.2.0,<2.3.0" -[package.dependencies.importlib-metadata] -python = "<3.8" -version = "*" - [[package]] -category = "dev" -description = "Read metadata from Python packages" -marker = "python_version < \"3.8\"" name = "importlib-metadata" +version = "4.8.1" +description = "Read metadata from Python packages" +category = "dev" optional = false python-versions = ">=3.6" -version = "3.7.0" [package.dependencies] +typing-extensions = {version = ">=3.6.4", markers = "python_version < \"3.8\""} zipp = ">=0.5" -[package.dependencies.typing-extensions] -python = "<3.8" -version = ">=3.6.4" +[package.extras] +docs = ["sphinx", "jaraco.packaging (>=8.2)", "rst.linker (>=1.9)"] +perf = ["ipython"] +testing = ["pytest (>=4.6)", "pytest-checkdocs (>=2.4)", "pytest-flake8", "pytest-cov", "pytest-enabler (>=1.0.1)", "packaging", "pep517", "pyfakefs", "flufl.flake8", "pytest-perf (>=0.9.2)", "pytest-black (>=0.3.7)", "pytest-mypy", "importlib-resources (>=1.3)"] [[package]] -category = "dev" -description = "iniconfig: brain-dead simple config-ini parsing" name = "iniconfig" +version = "1.1.1" +description = "iniconfig: brain-dead simple config-ini parsing" +category = "dev" optional = false python-versions = "*" -version = "1.1.1" [[package]] -category = "dev" -description = "A Python utility / library to sort Python imports." name = "isort" +version = "5.7.0" +description = "A Python utility / library to sort Python imports." +category = "dev" optional = false python-versions = ">=3.6,<4.0" -version = "5.7.0" + +[package.extras] +pipfile_deprecated_finder = ["pipreqs", "requirementslib"] +requirements_deprecated_finder = ["pipreqs", "pip-api"] +colors = ["colorama (>=0.4.3,<0.5.0)"] [[package]] -category = "dev" -description = "McCabe checker, plugin for flake8" name = "mccabe" +version = "0.6.1" +description = "McCabe checker, plugin for flake8" +category = "dev" optional = false python-versions = "*" -version = "0.6.1" [[package]] -category = "dev" -description = "Optional static typing for Python" name = "mypy" +version = "0.790" +description = "Optional static typing for Python" +category = "dev" optional = false python-versions = ">=3.5" -version = "0.790" [package.dependencies] mypy-extensions = ">=0.4.3,<0.5.0" typed-ast = ">=1.4.0,<1.5.0" typing-extensions = ">=3.7.4" +[package.extras] +dmypy = ["psutil (>=4.0)"] + [[package]] -category = "dev" -description = "Experimental type system extensions for programs checked with the mypy typechecker." name = "mypy-extensions" +version = "0.4.3" +description = "Experimental type system extensions for programs checked with the mypy typechecker." +category = "dev" optional = false python-versions = "*" -version = "0.4.3" [[package]] -category = "dev" -description = "Core utilities for Python packages" name = "packaging" +version = "21.0" +description = "Core utilities for Python packages" +category = "dev" optional = false -python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" -version = "20.9" +python-versions = ">=3.6" [package.dependencies] pyparsing = ">=2.0.2" [[package]] -category = "dev" -description = "Utility library for gitignore style pattern matching of file paths." name = "pathspec" +version = "0.9.0" +description = "Utility library for gitignore style pattern matching of file paths." +category = "dev" optional = false -python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*" -version = "0.8.1" +python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,>=2.7" [[package]] -category = "dev" -description = "plugin and hook calling mechanisms for python" name = "pluggy" +version = "0.13.1" +description = "plugin and hook calling mechanisms for python" +category = "dev" optional = false python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" -version = "0.13.1" [package.dependencies] -[package.dependencies.importlib-metadata] -python = "<3.8" -version = ">=0.12" +importlib-metadata = {version = ">=0.12", markers = "python_version < \"3.8\""} + +[package.extras] +dev = ["pre-commit", "tox"] [[package]] -category = "dev" -description = "psycopg2 - Python-PostgreSQL Database Adapter" name = "psycopg2" +version = "2.8.6" +description = "psycopg2 - Python-PostgreSQL Database Adapter" +category = "dev" optional = false python-versions = ">=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*" -version = "2.8.6" [[package]] -category = "dev" -description = "library with cross-python path, ini-parsing, io, code, log facilities" name = "py" +version = "1.10.0" +description = "library with cross-python path, ini-parsing, io, code, log facilities" +category = "dev" optional = false python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" -version = "1.10.0" [[package]] -category = "dev" -description = "Python style guide checker" name = "pycodestyle" +version = "2.6.0" +description = "Python style guide checker" +category = "dev" optional = false python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" -version = "2.6.0" [[package]] -category = "dev" -description = "passive checker of Python programs" name = "pyflakes" +version = "2.2.0" +description = "passive checker of Python programs" +category = "dev" optional = false python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" -version = "2.2.0" [[package]] -category = "dev" -description = "Python parsing module" name = "pyparsing" +version = "3.0.0" +description = "Python parsing module" +category = "dev" optional = false -python-versions = ">=2.6, !=3.0.*, !=3.1.*, !=3.2.*" -version = "2.4.7" +python-versions = ">=3.6" + +[package.extras] +diagrams = ["jinja2", "railroad-diagrams"] [[package]] -category = "dev" -description = "pytest: simple powerful testing with Python" name = "pytest" +version = "6.2.2" +description = "pytest: simple powerful testing with Python" +category = "dev" optional = false python-versions = ">=3.6" -version = "6.2.2" [package.dependencies] -atomicwrites = ">=1.0" +atomicwrites = {version = ">=1.0", markers = "sys_platform == \"win32\""} attrs = ">=19.2.0" -colorama = "*" +colorama = {version = "*", markers = "sys_platform == \"win32\""} +importlib-metadata = {version = ">=0.12", markers = "python_version < \"3.8\""} iniconfig = "*" packaging = "*" pluggy = ">=0.12,<1.0.0a1" py = ">=1.8.2" toml = "*" -[package.dependencies.importlib-metadata] -python = "<3.8" -version = ">=0.12" +[package.extras] +testing = ["argcomplete", "hypothesis (>=3.56)", "mock", "nose", "requests", "xmlschema"] [[package]] -category = "dev" -description = "World timezone definitions, modern and historical" name = "pytz" +version = "2021.3" +description = "World timezone definitions, modern and historical" +category = "dev" optional = false python-versions = "*" -version = "2021.1" [[package]] -category = "dev" -description = "Alternative regular expression module, to replace re." name = "regex" +version = "2021.10.23" +description = "Alternative regular expression module, to replace re." +category = "dev" optional = false python-versions = "*" -version = "2020.11.13" [[package]] -category = "dev" -description = "A non-validating SQL parser." name = "sqlparse" +version = "0.4.2" +description = "A non-validating SQL parser." +category = "dev" optional = false python-versions = ">=3.5" -version = "0.4.1" [[package]] -category = "dev" -description = "Python Library for Tom's Obvious, Minimal Language" name = "toml" -optional = false -python-versions = ">=2.6, !=3.0.*, !=3.1.*, !=3.2.*" version = "0.10.2" - -[[package]] +description = "Python Library for Tom's Obvious, Minimal Language" category = "dev" -description = "a fork of Python 2 and 3 ast modules with type comment support" -name = "typed-ast" optional = false -python-versions = "*" -version = "1.4.2" +python-versions = ">=2.6, !=3.0.*, !=3.1.*, !=3.2.*" [[package]] +name = "typed-ast" +version = "1.4.3" +description = "a fork of Python 2 and 3 ast modules with type comment support" category = "dev" -description = "Backported and Experimental Type Hints for Python 3.5+" -name = "typing-extensions" optional = false python-versions = "*" -version = "3.7.4.3" [[package]] +name = "typing-extensions" +version = "3.10.0.2" +description = "Backported and Experimental Type Hints for Python 3.5+" category = "dev" -description = "A built-package format for Python" -name = "wheel" optional = false -python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,>=2.7" -version = "0.35.1" +python-versions = "*" [[package]] -category = "dev" -description = "Backport of pathlib-compatible object wrapper for zip files" -marker = "python_version < \"3.8\"" name = "zipp" +version = "3.6.0" +description = "Backport of pathlib-compatible object wrapper for zip files" +category = "dev" optional = false python-versions = ">=3.6" -version = "3.4.0" + +[package.extras] +docs = ["sphinx", "jaraco.packaging (>=8.2)", "rst.linker (>=1.9)"] +testing = ["pytest (>=4.6)", "pytest-checkdocs (>=2.4)", "pytest-flake8", "pytest-cov", "pytest-enabler (>=1.0.1)", "jaraco.itertools", "func-timeout", "pytest-black (>=0.3.7)", "pytest-mypy"] [metadata] -content-hash = "d4c8eca4a94453f47d26912db391e4adbb6232083830159cdc4192034128925b" +lock-version = "1.1" python-versions = "^3.6" - -[metadata.hashes] -appdirs = ["7d5d0167b2b1ba821647616af46a749d1c653740dd0d2415100fe26e27afdf41", "a841dacd6b99318a741b166adb07e19ee71a274450e68237b4650ca1055ab128"] -asgiref = ["5ee950735509d04eb673bd7f7120f8fa1c9e2df495394992c73234d526907e17", "7162a3cb30ab0609f1a4c95938fd73e8604f63bdba516a7f7d64b83ff09478f0"] -atomicwrites = ["6d1784dea7c0c8d4a5172b6c620f40b6e4cbfdf96d783691f2e1302a7b88e197", "ae70396ad1a434f9c7046fd2dd196fc04b12f9e91ffb859164193be8b6168a7a"] -attrs = ["31b2eced602aa8423c2aea9c76a724617ed67cf9513173fd3a4f03e3a929c7e6", "832aa3cde19744e49938b91fea06d69ecb9e649c93ba974535d08ad92164f700"] -black = ["1c02557aa099101b9d21496f8a914e9ed2222ef70336404eeeac8edba836fbea"] -click = ["d2b5255c7c6349bc1bd1e59e08cd12acbbd63ce649f2588755783aa94dfb6b1a", "dacca89f4bfadd5de3d7489b7c8a566eee0d3676333fbb50030263894c38c0dc"] -colorama = ["5941b2b48a20143d2267e95b1c2a7603ce057ee39fd88e7329b0c292aa16869b", "9f47eda37229f68eee03b24b9748937c7dc3868f906e8ba69fbcbdd3bc5dc3e2"] -dataclasses = ["454a69d788c7fda44efd71e259be79577822f5e3f53f029a22d08004e951dc9f", "6988bd2b895eef432d562370bb707d540f32f7360ab13da45340101bc2307d84"] -django = ["32ce792ee9b6a0cbbec340123e229ac9f765dff8c2a4ae9247a14b2ba3a365a7", "baf099db36ad31f970775d0be5587cc58a6256a6771a44eb795b554d45f211b8"] -flake8 = ["749dbbd6bfd0cf1318af27bf97a14e28e5ff548ef8e5b1566ccfb25a11e7c839", "aadae8761ec651813c24be05c6f7b4680857ef6afaae4651a4eccaef97ce6c3b"] -importlib-metadata = ["24499ffde1b80be08284100393955842be4a59c7c16bbf2738aad0e464a8e0aa", "c6af5dbf1126cd959c4a8d8efd61d4d3c83bddb0459a17e554284a077574b614"] -iniconfig = ["011e24c64b7f47f6ebd835bb12a743f2fbe9a26d4cecaa7f53bc4f35ee9da8b3", "bc3af051d7d14b2ee5ef9969666def0cd1a000e121eaea580d4a313df4b37f32"] -isort = ["c729845434366216d320e936b8ad6f9d681aab72dc7cbc2d51bedc3582f3ad1e", "fff4f0c04e1825522ce6949973e83110a6e907750cd92d128b0d14aaaadbffdc"] -mccabe = ["ab8a6258860da4b6677da4bd2fe5dc2c659cff31b3ee4f7f5d64e79735b80d42", "dd8d182285a0fe56bace7f45b5e7d1a6ebcbf524e8f3bd87eb0f125271b8831f"] -mypy = ["0a0d102247c16ce93c97066443d11e2d36e6cc2a32d8ccc1f705268970479324", "0d34d6b122597d48a36d6c59e35341f410d4abfa771d96d04ae2c468dd201abc", "2170492030f6faa537647d29945786d297e4862765f0b4ac5930ff62e300d802", "2842d4fbd1b12ab422346376aad03ff5d0805b706102e475e962370f874a5122", "2b21ba45ad9ef2e2eb88ce4aeadd0112d0f5026418324176fd494a6824b74975", "72060bf64f290fb629bd4a67c707a66fd88ca26e413a91384b18db3876e57ed7", "af4e9ff1834e565f1baa74ccf7ae2564ae38c8df2a85b057af1dbbc958eb6666", "bd03b3cf666bff8d710d633d1c56ab7facbdc204d567715cb3b9f85c6e94f669", "c614194e01c85bb2e551c421397e49afb2872c88b5830e3554f0519f9fb1c178", "cf4e7bf7f1214826cf7333627cb2547c0db7e3078723227820d0a2490f117a01", "da56dedcd7cd502ccd3c5dddc656cb36113dd793ad466e894574125945653cea", "e86bdace26c5fe9cf8cb735e7cedfe7850ad92b327ac5d797c656717d2ca66de", "e97e9c13d67fbe524be17e4d8025d51a7dca38f90de2e462243ab8ed8a9178d1", "eea260feb1830a627fb526d22fbb426b750d9f5a47b624e8d5e7e004359b219c"] -mypy-extensions = ["090fedd75945a69ae91ce1303b5824f428daf5a028d2f6ab8a299250a846f15d", "2d82818f5bb3e369420cb3c4060a7970edba416647068eb4c5343488a6c604a8"] -packaging = ["5b327ac1320dc863dca72f4514ecc086f31186744b84a230374cc1fd776feae5", "67714da7f7bc052e064859c05c595155bd1ee9f69f76557e21f051443c20947a"] -pathspec = ["86379d6b86d75816baba717e64b1a3a3469deb93bb76d613c9ce79edc5cb68fd", "aa0cb481c4041bf52ffa7b0d8fa6cd3e88a2ca4879c533c9153882ee2556790d"] -pluggy = ["15b2acde666561e1298d71b523007ed7364de07029219b604cf808bfa1c765b0", "966c145cd83c96502c3c3868f50408687b38434af77734af1e9ca461a4081d2d"] -psycopg2 = ["00195b5f6832dbf2876b8bf77f12bdce648224c89c880719c745b90515233301", "068115e13c70dc5982dfc00c5d70437fe37c014c808acce119b5448361c03725", "26e7fd115a6db75267b325de0fba089b911a4a12ebd3d0b5e7acb7028bc46821", "56007a226b8e95aa980ada7abdea6b40b75ce62a433bd27cec7a8178d57f4051", "56fee7f818d032f802b8eed81ef0c1232b8b42390df189cab9cfa87573fe52c5", "6a3d9efb6f36f1fe6aa8dbb5af55e067db802502c55a9defa47c5a1dad41df84", "a49833abfdede8985ba3f3ec641f771cca215479f41523e99dace96d5b8cce2a", "ad2fe8a37be669082e61fb001c185ffb58867fdbb3e7a6b0b0d2ffe232353a3e", "b8cae8b2f022efa1f011cc753adb9cbadfa5a184431d09b273fb49b4167561ad", "d160744652e81c80627a909a0e808f3c6653a40af435744de037e3172cf277f5", "f22ea9b67aea4f4a1718300908a2fb62b3e4276cf00bd829a97ab5894af42ea3", "f974c96fca34ae9e4f49839ba6b78addf0346777b46c4da27a7bf54f48d3057d", "fb23f6c71107c37fd667cb4ea363ddeb936b348bbd6449278eb92c189699f543"] -py = ["21b81bda15b66ef5e1a777a21c4dcd9c20ad3efd0b3f817e7a809035269e1bd3", "3b80836aa6d1feeaa108e046da6423ab8f6ceda6468545ae8d02d9d58d18818a"] -pycodestyle = ["2295e7b2f6b5bd100585ebcb1f616591b652db8a741695b3d8f5d28bdc934367", "c58a7d2815e0e8d7972bf1803331fb0152f867bd89adf8a01dfd55085434192e"] -pyflakes = ["0d94e0e05a19e57a99444b6ddcf9a6eb2e5c68d3ca1e98e90707af8152c90a92", "35b2d75ee967ea93b55750aa9edbbf72813e06a66ba54438df2cfac9e3c27fc8"] -pyparsing = ["c203ec8783bf771a155b207279b9bccb8dea02d8f0c9e5f8ead507bc3246ecc1", "ef9d7589ef3c200abe66653d3f1ab1033c3c419ae9b9bdb1240a85b024efc88b"] -pytest = ["9d1edf9e7d0b84d72ea3dbcdfd22b35fb543a5e8f2a60092dd578936bf63d7f9", "b574b57423e818210672e07ca1fa90aaf194a4f63f3ab909a2c67ebb22913839"] -pytz = ["83a4a90894bf38e243cf052c8b58f381bfe9a7a483f6a9cab140bc7f702ac4da", "eb10ce3e7736052ed3623d49975ce333bcd712c7bb19a58b9e2089d4057d0798"] -regex = ["02951b7dacb123d8ea6da44fe45ddd084aa6777d4b2454fa0da61d569c6fa538", "0d08e71e70c0237883d0bef12cad5145b84c3705e9c6a588b2a9c7080e5af2a4", "1862a9d9194fae76a7aaf0150d5f2a8ec1da89e8b55890b1786b8f88a0f619dc", "1ab79fcb02b930de09c76d024d279686ec5d532eb814fd0ed1e0051eb8bd2daa", "1fa7ee9c2a0e30405e21031d07d7ba8617bc590d391adfc2b7f1e8b99f46f444", "262c6825b309e6485ec2493ffc7e62a13cf13fb2a8b6d212f72bd53ad34118f1", "2a11a3e90bd9901d70a5b31d7dd85114755a581a5da3fc996abfefa48aee78af", "2c99e97d388cd0a8d30f7c514d67887d8021541b875baf09791a3baad48bb4f8", "3128e30d83f2e70b0bed9b2a34e92707d0877e460b402faca908c6667092ada9", "38c8fd190db64f513fe4e1baa59fed086ae71fa45083b6936b52d34df8f86a88", "3bddc701bdd1efa0d5264d2649588cbfda549b2899dc8d50417e47a82e1387ba", "4902e6aa086cbb224241adbc2f06235927d5cdacffb2425c73e6570e8d862364", "49cae022fa13f09be91b2c880e58e14b6da5d10639ed45ca69b85faf039f7a4e", "56e01daca75eae420bce184edd8bb341c8eebb19dd3bce7266332258f9fb9dd7", "5862975b45d451b6db51c2e654990c1820523a5b07100fc6903e9c86575202a0", "6a8ce43923c518c24a2579fda49f093f1397dad5d18346211e46f134fc624e31", "6c54ce4b5d61a7129bad5c5dc279e222afd00e721bf92f9ef09e4fae28755683", "6e4b08c6f8daca7d8f07c8d24e4331ae7953333dbd09c648ed6ebd24db5a10ee", "717881211f46de3ab130b58ec0908267961fadc06e44f974466d1887f865bd5b", "749078d1eb89484db5f34b4012092ad14b327944ee7f1c4f74d6279a6e4d1884", "7913bd25f4ab274ba37bc97ad0e21c31004224ccb02765ad984eef43e04acc6c", "7a25fcbeae08f96a754b45bdc050e1fb94b95cab046bf56b016c25e9ab127b3e", "83d6b356e116ca119db8e7c6fc2983289d87b27b3fac238cfe5dca529d884562", "8b882a78c320478b12ff024e81dc7d43c1462aa4a3341c754ee65d857a521f85", "8f6a2229e8ad946e36815f2a03386bb8353d4bde368fdf8ca5f0cb97264d3b5c", "9801c4c1d9ae6a70aeb2128e5b4b68c45d4f0af0d1535500884d644fa9b768c6", "a15f64ae3a027b64496a71ab1f722355e570c3fac5ba2801cafce846bf5af01d", "a3d748383762e56337c39ab35c6ed4deb88df5326f97a38946ddd19028ecce6b", "a63f1a07932c9686d2d416fb295ec2c01ab246e89b4d58e5fa468089cab44b70", "b2b1a5ddae3677d89b686e5c625fc5547c6e492bd755b520de5332773a8af06b", "b2f4007bff007c96a173e24dcda236e5e83bde4358a557f9ccf5e014439eae4b", "baf378ba6151f6e272824b86a774326f692bc2ef4cc5ce8d5bc76e38c813a55f", "bafb01b4688833e099d79e7efd23f99172f501a15c44f21ea2118681473fdba0", "bba349276b126947b014e50ab3316c027cac1495992f10e5682dc677b3dfa0c5", "c084582d4215593f2f1d28b65d2a2f3aceff8342aa85afd7be23a9cad74a0de5", "d1ebb090a426db66dd80df8ca85adc4abfcbad8a7c2e9a5ec7513ede522e0a8f", "d2d8ce12b7c12c87e41123997ebaf1a5767a5be3ec545f64675388970f415e2e", "e32f5f3d1b1c663af7f9c4c1e72e6ffe9a78c03a31e149259f531e0fed826512", "e3faaf10a0d1e8e23a9b51d1900b72e1635c2d5b0e1bea1c18022486a8e2e52d", "f7d29a6fc4760300f86ae329e3b6ca28ea9c20823df123a2ea8693e967b29917", "f8f295db00ef5f8bae530fc39af0b40486ca6068733fb860b42115052206466f"] -sqlparse = ["017cde379adbd6a1f15a61873f43e8274179378e95ef3fede90b5aa64d304ed0", "0f91fd2e829c44362cbcfab3e9ae12e22badaa8a29ad5ff599f9ec109f0454e8"] -toml = ["806143ae5bfb6a3c6e736a764057db0e6a0e05e338b5630894a5f779cabb4f9b", "b3bda1d108d5dd99f4a20d24d9c348e91c4db7ab1b749200bded2f839ccbe68f"] -typed-ast = ["07d49388d5bf7e863f7fa2f124b1b1d89d8aa0e2f7812faff0a5658c01c59aa1", "14bf1522cdee369e8f5581238edac09150c765ec1cb33615855889cf33dcb92d", "240296b27397e4e37874abb1df2a608a92df85cf3e2a04d0d4d61055c8305ba6", "36d829b31ab67d6fcb30e185ec996e1f72b892255a745d3a82138c97d21ed1cd", "37f48d46d733d57cc70fd5f30572d11ab8ed92da6e6b28e024e4a3edfb456e37", "4c790331247081ea7c632a76d5b2a265e6d325ecd3179d06e9cf8d46d90dd151", "5dcfc2e264bd8a1db8b11a892bd1647154ce03eeba94b461effe68790d8b8e07", "7147e2a76c75f0f64c4319886e7639e490fee87c9d25cb1d4faef1d8cf83a440", "7703620125e4fb79b64aa52427ec192822e9f45d37d4b6625ab37ef403e1df70", "8368f83e93c7156ccd40e49a783a6a6850ca25b556c0fa0240ed0f659d2fe496", "84aa6223d71012c68d577c83f4e7db50d11d6b1399a9c779046d75e24bed74ea", "85f95aa97a35bdb2f2f7d10ec5bbdac0aeb9dafdaf88e17492da0504de2e6400", "8db0e856712f79c45956da0c9a40ca4246abc3485ae0d7ecc86a20f5e4c09abc", "9044ef2df88d7f33692ae3f18d3be63dec69c4fb1b5a4a9ac950f9b4ba571606", "963c80b583b0661918718b095e02303d8078950b26cc00b5e5ea9ababe0de1fc", "987f15737aba2ab5f3928c617ccf1ce412e2e321c77ab16ca5a293e7bbffd581", "9ec45db0c766f196ae629e509f059ff05fc3148f9ffd28f3cfe75d4afb485412", "9fc0b3cb5d1720e7141d103cf4819aea239f7d136acf9ee4a69b047b7986175a", "a2c927c49f2029291fbabd673d51a2180038f8cd5a5b2f290f78c4516be48be2", "a38878a223bdd37c9709d07cd357bb79f4c760b29210e14ad0fb395294583787", "b4fcdcfa302538f70929eb7b392f536a237cbe2ed9cba88e3bf5027b39f5f77f", "c0c74e5579af4b977c8b932f40a5464764b2f86681327410aa028a22d2f54937", "c1c876fd795b36126f773db9cbb393f19808edd2637e00fd6caba0e25f2c7b64", "c9aadc4924d4b5799112837b226160428524a9a45f830e0d0f184b19e4090487", "cc7b98bf58167b7f2db91a4327da24fb93368838eb84a44c472283778fc2446b", "cf54cfa843f297991b7388c281cb3855d911137223c6b6d2dd82a47ae5125a41", "d003156bb6a59cda9050e983441b7fa2487f7800d76bdc065566b7d728b4581a", "d175297e9533d8d37437abc14e8a83cbc68af93cc9c1c59c2c292ec59a0697a3", "d746a437cdbca200622385305aedd9aef68e8a645e385cc483bdc5e488f07166", "e683e409e5c45d5c9082dc1daf13f6374300806240719f95dc783d1fc942af10"] -typing-extensions = ["7cb407020f00f7bfc3cb3e7881628838e69d8f3fcab2f64742a5e76b2f841918", "99d4073b617d30288f569d3f13d2bd7548c3a7e4c8de87db09a9d29bb3a4a60c", "dafc7639cde7f1b6e1acc0f457842a83e722ccca8eef5270af2d74792619a89f"] -wheel = ["497add53525d16c173c2c1c733b8f655510e909ea78cc0e29d374243544b77a2", "99a22d87add3f634ff917310a3d87e499f19e663413a52eb9232c447aa646c9f"] -zipp = ["102c24ef8f171fd729d46599845e95c7ab894a4cf45f5de11a44cc7444fb1108", "ed5eee1974372595f9e416cc7bbeeb12335201d8081ca8a0743c954d4446e5cb"] +content-hash = "4273e3275b5873c1875b5cbc19e90868bec7709a25bb92ca9398ff93b9e8b0b6" + +[metadata.files] +appdirs = [ + {file = "appdirs-1.4.4-py2.py3-none-any.whl", hash = "sha256:a841dacd6b99318a741b166adb07e19ee71a274450e68237b4650ca1055ab128"}, + {file = "appdirs-1.4.4.tar.gz", hash = "sha256:7d5d0167b2b1ba821647616af46a749d1c653740dd0d2415100fe26e27afdf41"}, +] +asgiref = [ + {file = "asgiref-3.4.1-py3-none-any.whl", hash = "sha256:ffc141aa908e6f175673e7b1b3b7af4fdb0ecb738fc5c8b88f69f055c2415214"}, + {file = "asgiref-3.4.1.tar.gz", hash = "sha256:4ef1ab46b484e3c706329cedeff284a5d40824200638503f5768edb6de7d58e9"}, +] +atomicwrites = [ + {file = "atomicwrites-1.4.0-py2.py3-none-any.whl", hash = "sha256:6d1784dea7c0c8d4a5172b6c620f40b6e4cbfdf96d783691f2e1302a7b88e197"}, + {file = "atomicwrites-1.4.0.tar.gz", hash = "sha256:ae70396ad1a434f9c7046fd2dd196fc04b12f9e91ffb859164193be8b6168a7a"}, +] +attrs = [ + {file = "attrs-21.2.0-py2.py3-none-any.whl", hash = "sha256:149e90d6d8ac20db7a955ad60cf0e6881a3f20d37096140088356da6c716b0b1"}, + {file = "attrs-21.2.0.tar.gz", hash = "sha256:ef6aaac3ca6cd92904cdd0d83f629a15f18053ec84e6432106f7a4d04ae4f5fb"}, +] +black = [ + {file = "black-20.8b1.tar.gz", hash = "sha256:1c02557aa099101b9d21496f8a914e9ed2222ef70336404eeeac8edba836fbea"}, +] +click = [ + {file = "click-8.0.3-py3-none-any.whl", hash = "sha256:353f466495adaeb40b6b5f592f9f91cb22372351c84caeb068132442a4518ef3"}, + {file = "click-8.0.3.tar.gz", hash = "sha256:410e932b050f5eed773c4cda94de75971c89cdb3155a72a0831139a79e5ecb5b"}, +] +colorama = [ + {file = "colorama-0.4.4-py2.py3-none-any.whl", hash = "sha256:9f47eda37229f68eee03b24b9748937c7dc3868f906e8ba69fbcbdd3bc5dc3e2"}, + {file = "colorama-0.4.4.tar.gz", hash = "sha256:5941b2b48a20143d2267e95b1c2a7603ce057ee39fd88e7329b0c292aa16869b"}, +] +dataclasses = [ + {file = "dataclasses-0.8-py3-none-any.whl", hash = "sha256:0201d89fa866f68c8ebd9d08ee6ff50c0b255f8ec63a71c16fda7af82bb887bf"}, + {file = "dataclasses-0.8.tar.gz", hash = "sha256:8479067f342acf957dc82ec415d355ab5edb7e7646b90dc6e2fd1d96ad084c97"}, +] +django = [ + {file = "Django-3.1.7-py3-none-any.whl", hash = "sha256:baf099db36ad31f970775d0be5587cc58a6256a6771a44eb795b554d45f211b8"}, + {file = "Django-3.1.7.tar.gz", hash = "sha256:32ce792ee9b6a0cbbec340123e229ac9f765dff8c2a4ae9247a14b2ba3a365a7"}, +] +flake8 = [ + {file = "flake8-3.8.4-py2.py3-none-any.whl", hash = "sha256:749dbbd6bfd0cf1318af27bf97a14e28e5ff548ef8e5b1566ccfb25a11e7c839"}, + {file = "flake8-3.8.4.tar.gz", hash = "sha256:aadae8761ec651813c24be05c6f7b4680857ef6afaae4651a4eccaef97ce6c3b"}, +] +importlib-metadata = [ + {file = "importlib_metadata-4.8.1-py3-none-any.whl", hash = "sha256:b618b6d2d5ffa2f16add5697cf57a46c76a56229b0ed1c438322e4e95645bd15"}, + {file = "importlib_metadata-4.8.1.tar.gz", hash = "sha256:f284b3e11256ad1e5d03ab86bb2ccd6f5339688ff17a4d797a0fe7df326f23b1"}, +] +iniconfig = [ + {file = "iniconfig-1.1.1-py2.py3-none-any.whl", hash = "sha256:011e24c64b7f47f6ebd835bb12a743f2fbe9a26d4cecaa7f53bc4f35ee9da8b3"}, + {file = "iniconfig-1.1.1.tar.gz", hash = "sha256:bc3af051d7d14b2ee5ef9969666def0cd1a000e121eaea580d4a313df4b37f32"}, +] +isort = [ + {file = "isort-5.7.0-py3-none-any.whl", hash = "sha256:fff4f0c04e1825522ce6949973e83110a6e907750cd92d128b0d14aaaadbffdc"}, + {file = "isort-5.7.0.tar.gz", hash = "sha256:c729845434366216d320e936b8ad6f9d681aab72dc7cbc2d51bedc3582f3ad1e"}, +] +mccabe = [ + {file = "mccabe-0.6.1-py2.py3-none-any.whl", hash = "sha256:ab8a6258860da4b6677da4bd2fe5dc2c659cff31b3ee4f7f5d64e79735b80d42"}, + {file = "mccabe-0.6.1.tar.gz", hash = "sha256:dd8d182285a0fe56bace7f45b5e7d1a6ebcbf524e8f3bd87eb0f125271b8831f"}, +] +mypy = [ + {file = "mypy-0.790-cp35-cp35m-macosx_10_6_x86_64.whl", hash = "sha256:bd03b3cf666bff8d710d633d1c56ab7facbdc204d567715cb3b9f85c6e94f669"}, + {file = "mypy-0.790-cp35-cp35m-manylinux1_x86_64.whl", hash = "sha256:2170492030f6faa537647d29945786d297e4862765f0b4ac5930ff62e300d802"}, + {file = "mypy-0.790-cp35-cp35m-win_amd64.whl", hash = "sha256:e86bdace26c5fe9cf8cb735e7cedfe7850ad92b327ac5d797c656717d2ca66de"}, + {file = "mypy-0.790-cp36-cp36m-macosx_10_9_x86_64.whl", hash = "sha256:e97e9c13d67fbe524be17e4d8025d51a7dca38f90de2e462243ab8ed8a9178d1"}, + {file = "mypy-0.790-cp36-cp36m-manylinux1_x86_64.whl", hash = "sha256:0d34d6b122597d48a36d6c59e35341f410d4abfa771d96d04ae2c468dd201abc"}, + {file = "mypy-0.790-cp36-cp36m-win_amd64.whl", hash = "sha256:72060bf64f290fb629bd4a67c707a66fd88ca26e413a91384b18db3876e57ed7"}, + {file = "mypy-0.790-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:eea260feb1830a627fb526d22fbb426b750d9f5a47b624e8d5e7e004359b219c"}, + {file = "mypy-0.790-cp37-cp37m-manylinux1_x86_64.whl", hash = "sha256:c614194e01c85bb2e551c421397e49afb2872c88b5830e3554f0519f9fb1c178"}, + {file = "mypy-0.790-cp37-cp37m-win_amd64.whl", hash = "sha256:0a0d102247c16ce93c97066443d11e2d36e6cc2a32d8ccc1f705268970479324"}, + {file = "mypy-0.790-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:cf4e7bf7f1214826cf7333627cb2547c0db7e3078723227820d0a2490f117a01"}, + {file = "mypy-0.790-cp38-cp38-manylinux1_x86_64.whl", hash = "sha256:af4e9ff1834e565f1baa74ccf7ae2564ae38c8df2a85b057af1dbbc958eb6666"}, + {file = "mypy-0.790-cp38-cp38-win_amd64.whl", hash = "sha256:da56dedcd7cd502ccd3c5dddc656cb36113dd793ad466e894574125945653cea"}, + {file = "mypy-0.790-py3-none-any.whl", hash = "sha256:2842d4fbd1b12ab422346376aad03ff5d0805b706102e475e962370f874a5122"}, + {file = "mypy-0.790.tar.gz", hash = "sha256:2b21ba45ad9ef2e2eb88ce4aeadd0112d0f5026418324176fd494a6824b74975"}, +] +mypy-extensions = [ + {file = "mypy_extensions-0.4.3-py2.py3-none-any.whl", hash = "sha256:090fedd75945a69ae91ce1303b5824f428daf5a028d2f6ab8a299250a846f15d"}, + {file = "mypy_extensions-0.4.3.tar.gz", hash = "sha256:2d82818f5bb3e369420cb3c4060a7970edba416647068eb4c5343488a6c604a8"}, +] +packaging = [ + {file = "packaging-21.0-py3-none-any.whl", hash = "sha256:c86254f9220d55e31cc94d69bade760f0847da8000def4dfe1c6b872fd14ff14"}, + {file = "packaging-21.0.tar.gz", hash = "sha256:7dc96269f53a4ccec5c0670940a4281106dd0bb343f47b7471f779df49c2fbe7"}, +] +pathspec = [ + {file = "pathspec-0.9.0-py2.py3-none-any.whl", hash = "sha256:7d15c4ddb0b5c802d161efc417ec1a2558ea2653c2e8ad9c19098201dc1c993a"}, + {file = "pathspec-0.9.0.tar.gz", hash = "sha256:e564499435a2673d586f6b2130bb5b95f04a3ba06f81b8f895b651a3c76aabb1"}, +] +pluggy = [ + {file = "pluggy-0.13.1-py2.py3-none-any.whl", hash = "sha256:966c145cd83c96502c3c3868f50408687b38434af77734af1e9ca461a4081d2d"}, + {file = "pluggy-0.13.1.tar.gz", hash = "sha256:15b2acde666561e1298d71b523007ed7364de07029219b604cf808bfa1c765b0"}, +] +psycopg2 = [ + {file = "psycopg2-2.8.6-cp27-cp27m-win32.whl", hash = "sha256:068115e13c70dc5982dfc00c5d70437fe37c014c808acce119b5448361c03725"}, + {file = "psycopg2-2.8.6-cp27-cp27m-win_amd64.whl", hash = "sha256:d160744652e81c80627a909a0e808f3c6653a40af435744de037e3172cf277f5"}, + {file = "psycopg2-2.8.6-cp34-cp34m-win32.whl", hash = "sha256:b8cae8b2f022efa1f011cc753adb9cbadfa5a184431d09b273fb49b4167561ad"}, + {file = "psycopg2-2.8.6-cp34-cp34m-win_amd64.whl", hash = "sha256:f22ea9b67aea4f4a1718300908a2fb62b3e4276cf00bd829a97ab5894af42ea3"}, + {file = "psycopg2-2.8.6-cp35-cp35m-win32.whl", hash = "sha256:26e7fd115a6db75267b325de0fba089b911a4a12ebd3d0b5e7acb7028bc46821"}, + {file = "psycopg2-2.8.6-cp35-cp35m-win_amd64.whl", hash = "sha256:00195b5f6832dbf2876b8bf77f12bdce648224c89c880719c745b90515233301"}, + {file = "psycopg2-2.8.6-cp36-cp36m-win32.whl", hash = "sha256:a49833abfdede8985ba3f3ec641f771cca215479f41523e99dace96d5b8cce2a"}, + {file = "psycopg2-2.8.6-cp36-cp36m-win_amd64.whl", hash = "sha256:f974c96fca34ae9e4f49839ba6b78addf0346777b46c4da27a7bf54f48d3057d"}, + {file = "psycopg2-2.8.6-cp37-cp37m-win32.whl", hash = "sha256:6a3d9efb6f36f1fe6aa8dbb5af55e067db802502c55a9defa47c5a1dad41df84"}, + {file = "psycopg2-2.8.6-cp37-cp37m-win_amd64.whl", hash = "sha256:56fee7f818d032f802b8eed81ef0c1232b8b42390df189cab9cfa87573fe52c5"}, + {file = "psycopg2-2.8.6-cp38-cp38-win32.whl", hash = "sha256:ad2fe8a37be669082e61fb001c185ffb58867fdbb3e7a6b0b0d2ffe232353a3e"}, + {file = "psycopg2-2.8.6-cp38-cp38-win_amd64.whl", hash = "sha256:56007a226b8e95aa980ada7abdea6b40b75ce62a433bd27cec7a8178d57f4051"}, + {file = "psycopg2-2.8.6-cp39-cp39-win32.whl", hash = "sha256:2c93d4d16933fea5bbacbe1aaf8fa8c1348740b2e50b3735d1b0bf8154cbf0f3"}, + {file = "psycopg2-2.8.6-cp39-cp39-win_amd64.whl", hash = "sha256:d5062ae50b222da28253059880a871dc87e099c25cb68acf613d9d227413d6f7"}, + {file = "psycopg2-2.8.6.tar.gz", hash = "sha256:fb23f6c71107c37fd667cb4ea363ddeb936b348bbd6449278eb92c189699f543"}, +] +py = [ + {file = "py-1.10.0-py2.py3-none-any.whl", hash = "sha256:3b80836aa6d1feeaa108e046da6423ab8f6ceda6468545ae8d02d9d58d18818a"}, + {file = "py-1.10.0.tar.gz", hash = "sha256:21b81bda15b66ef5e1a777a21c4dcd9c20ad3efd0b3f817e7a809035269e1bd3"}, +] +pycodestyle = [ + {file = "pycodestyle-2.6.0-py2.py3-none-any.whl", hash = "sha256:2295e7b2f6b5bd100585ebcb1f616591b652db8a741695b3d8f5d28bdc934367"}, + {file = "pycodestyle-2.6.0.tar.gz", hash = "sha256:c58a7d2815e0e8d7972bf1803331fb0152f867bd89adf8a01dfd55085434192e"}, +] +pyflakes = [ + {file = "pyflakes-2.2.0-py2.py3-none-any.whl", hash = "sha256:0d94e0e05a19e57a99444b6ddcf9a6eb2e5c68d3ca1e98e90707af8152c90a92"}, + {file = "pyflakes-2.2.0.tar.gz", hash = "sha256:35b2d75ee967ea93b55750aa9edbbf72813e06a66ba54438df2cfac9e3c27fc8"}, +] +pyparsing = [ + {file = "pyparsing-3.0.0-py3-none-any.whl", hash = "sha256:d487599e9fb0dc36bee6b5c183c6fc5bd372ce667736f3d430ab7d842a54a35a"}, + {file = "pyparsing-3.0.0.tar.gz", hash = "sha256:001cad8d467e7a9248ef9fd513f5c0d39afcbcb9a43684101853bd0ab962e479"}, +] +pytest = [ + {file = "pytest-6.2.2-py3-none-any.whl", hash = "sha256:b574b57423e818210672e07ca1fa90aaf194a4f63f3ab909a2c67ebb22913839"}, + {file = "pytest-6.2.2.tar.gz", hash = "sha256:9d1edf9e7d0b84d72ea3dbcdfd22b35fb543a5e8f2a60092dd578936bf63d7f9"}, +] +pytz = [ + {file = "pytz-2021.3-py2.py3-none-any.whl", hash = "sha256:3672058bc3453457b622aab7a1c3bfd5ab0bdae451512f6cf25f64ed37f5b87c"}, + {file = "pytz-2021.3.tar.gz", hash = "sha256:acad2d8b20a1af07d4e4c9d2e9285c5ed9104354062f275f3fcd88dcef4f1326"}, +] +regex = [ + {file = "regex-2021.10.23-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:45b65d6a275a478ac2cbd7fdbf7cc93c1982d613de4574b56fd6972ceadb8395"}, + {file = "regex-2021.10.23-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:74d071dbe4b53c602edd87a7476ab23015a991374ddb228d941929ad7c8c922e"}, + {file = "regex-2021.10.23-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_12_i686.manylinux2010_i686.whl", hash = "sha256:34d870f9f27f2161709054d73646fc9aca49480617a65533fc2b4611c518e455"}, + {file = "regex-2021.10.23-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:2fb698037c35109d3c2e30f2beb499e5ebae6e4bb8ff2e60c50b9a805a716f79"}, + {file = "regex-2021.10.23-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:cb46b542133999580ffb691baf67410306833ee1e4f58ed06b6a7aaf4e046952"}, + {file = "regex-2021.10.23-cp310-cp310-win32.whl", hash = "sha256:5e9c9e0ce92f27cef79e28e877c6b6988c48b16942258f3bc55d39b5f911df4f"}, + {file = "regex-2021.10.23-cp310-cp310-win_amd64.whl", hash = "sha256:ab7c5684ff3538b67df3f93d66bd3369b749087871ae3786e70ef39e601345b0"}, + {file = "regex-2021.10.23-cp36-cp36m-macosx_10_9_x86_64.whl", hash = "sha256:de557502c3bec8e634246588a94e82f1ee1b9dfcfdc453267c4fb652ff531570"}, + {file = "regex-2021.10.23-cp36-cp36m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:ee684f139c91e69fe09b8e83d18b4d63bf87d9440c1eb2eeb52ee851883b1b29"}, + {file = "regex-2021.10.23-cp36-cp36m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_12_i686.manylinux2010_i686.whl", hash = "sha256:5095a411c8479e715784a0c9236568ae72509450ee2226b649083730f3fadfc6"}, + {file = "regex-2021.10.23-cp36-cp36m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:7b568809dca44cb75c8ebb260844ea98252c8c88396f9d203f5094e50a70355f"}, + {file = "regex-2021.10.23-cp36-cp36m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:eb672217f7bd640411cfc69756ce721d00ae600814708d35c930930f18e8029f"}, + {file = "regex-2021.10.23-cp36-cp36m-win32.whl", hash = "sha256:a7a986c45d1099a5de766a15de7bee3840b1e0e1a344430926af08e5297cf666"}, + {file = "regex-2021.10.23-cp36-cp36m-win_amd64.whl", hash = "sha256:6d7722136c6ed75caf84e1788df36397efdc5dbadab95e59c2bba82d4d808a4c"}, + {file = "regex-2021.10.23-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:9f665677e46c5a4d288ece12fdedf4f4204a422bb28ff05f0e6b08b7447796d1"}, + {file = "regex-2021.10.23-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:450dc27483548214314640c89a0f275dbc557968ed088da40bde7ef8fb52829e"}, + {file = "regex-2021.10.23-cp37-cp37m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_12_i686.manylinux2010_i686.whl", hash = "sha256:129472cd06062fb13e7b4670a102951a3e655e9b91634432cfbdb7810af9d710"}, + {file = "regex-2021.10.23-cp37-cp37m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:a940ca7e7189d23da2bfbb38973832813eab6bd83f3bf89a977668c2f813deae"}, + {file = "regex-2021.10.23-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:530fc2bbb3dc1ebb17f70f7b234f90a1dd43b1b489ea38cea7be95fb21cdb5c7"}, + {file = "regex-2021.10.23-cp37-cp37m-win32.whl", hash = "sha256:ded0c4a3eee56b57fcb2315e40812b173cafe79d2f992d50015f4387445737fa"}, + {file = "regex-2021.10.23-cp37-cp37m-win_amd64.whl", hash = "sha256:391703a2abf8013d95bae39145d26b4e21531ab82e22f26cd3a181ee2644c234"}, + {file = "regex-2021.10.23-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:be04739a27be55631069b348dda0c81d8ea9822b5da10b8019b789e42d1fe452"}, + {file = "regex-2021.10.23-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:13ec99df95003f56edcd307db44f06fbeb708c4ccdcf940478067dd62353181e"}, + {file = "regex-2021.10.23-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_12_i686.manylinux2010_i686.whl", hash = "sha256:8d1cdcda6bd16268316d5db1038965acf948f2a6f43acc2e0b1641ceab443623"}, + {file = "regex-2021.10.23-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:0c186691a7995ef1db61205e00545bf161fb7b59cdb8c1201c89b333141c438a"}, + {file = "regex-2021.10.23-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:2b20f544cbbeffe171911f6ce90388ad36fe3fad26b7c7a35d4762817e9ea69c"}, + {file = "regex-2021.10.23-cp38-cp38-win32.whl", hash = "sha256:c0938ddd60cc04e8f1faf7a14a166ac939aac703745bfcd8e8f20322a7373019"}, + {file = "regex-2021.10.23-cp38-cp38-win_amd64.whl", hash = "sha256:56f0c81c44638dfd0e2367df1a331b4ddf2e771366c4b9c5d9a473de75e3e1c7"}, + {file = "regex-2021.10.23-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:80bb5d2e92b2258188e7dcae5b188c7bf868eafdf800ea6edd0fbfc029984a88"}, + {file = "regex-2021.10.23-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:e1dae12321b31059a1a72aaa0e6ba30156fe7e633355e445451e4021b8e122b6"}, + {file = "regex-2021.10.23-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_12_i686.manylinux2010_i686.whl", hash = "sha256:1f2b59c28afc53973d22e7bc18428721ee8ca6079becf1b36571c42627321c65"}, + {file = "regex-2021.10.23-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:d134757a37d8640f3c0abb41f5e68b7cf66c644f54ef1cb0573b7ea1c63e1509"}, + {file = "regex-2021.10.23-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:0dcc0e71118be8c69252c207630faf13ca5e1b8583d57012aae191e7d6d28b84"}, + {file = "regex-2021.10.23-cp39-cp39-win32.whl", hash = "sha256:a30513828180264294953cecd942202dfda64e85195ae36c265daf4052af0464"}, + {file = "regex-2021.10.23-cp39-cp39-win_amd64.whl", hash = "sha256:0f7552429dd39f70057ac5d0e897e5bfe211629652399a21671e53f2a9693a4e"}, + {file = "regex-2021.10.23.tar.gz", hash = "sha256:f3f9a91d3cc5e5b0ddf1043c0ae5fa4852f18a1c0050318baf5fc7930ecc1f9c"}, +] +sqlparse = [ + {file = "sqlparse-0.4.2-py3-none-any.whl", hash = "sha256:48719e356bb8b42991bdbb1e8b83223757b93789c00910a616a071910ca4a64d"}, + {file = "sqlparse-0.4.2.tar.gz", hash = "sha256:0c00730c74263a94e5a9919ade150dfc3b19c574389985446148402998287dae"}, +] +toml = [ + {file = "toml-0.10.2-py2.py3-none-any.whl", hash = "sha256:806143ae5bfb6a3c6e736a764057db0e6a0e05e338b5630894a5f779cabb4f9b"}, + {file = "toml-0.10.2.tar.gz", hash = "sha256:b3bda1d108d5dd99f4a20d24d9c348e91c4db7ab1b749200bded2f839ccbe68f"}, +] +typed-ast = [ + {file = "typed_ast-1.4.3-cp35-cp35m-manylinux1_i686.whl", hash = "sha256:2068531575a125b87a41802130fa7e29f26c09a2833fea68d9a40cf33902eba6"}, + {file = "typed_ast-1.4.3-cp35-cp35m-manylinux1_x86_64.whl", hash = "sha256:c907f561b1e83e93fad565bac5ba9c22d96a54e7ea0267c708bffe863cbe4075"}, + {file = "typed_ast-1.4.3-cp35-cp35m-manylinux2014_aarch64.whl", hash = "sha256:1b3ead4a96c9101bef08f9f7d1217c096f31667617b58de957f690c92378b528"}, + {file = "typed_ast-1.4.3-cp35-cp35m-win32.whl", hash = "sha256:dde816ca9dac1d9c01dd504ea5967821606f02e510438120091b84e852367428"}, + {file = "typed_ast-1.4.3-cp35-cp35m-win_amd64.whl", hash = "sha256:777a26c84bea6cd934422ac2e3b78863a37017618b6e5c08f92ef69853e765d3"}, + {file = "typed_ast-1.4.3-cp36-cp36m-macosx_10_9_x86_64.whl", hash = "sha256:f8afcf15cc511ada719a88e013cec87c11aff7b91f019295eb4530f96fe5ef2f"}, + {file = "typed_ast-1.4.3-cp36-cp36m-manylinux1_i686.whl", hash = "sha256:52b1eb8c83f178ab787f3a4283f68258525f8d70f778a2f6dd54d3b5e5fb4341"}, + {file = "typed_ast-1.4.3-cp36-cp36m-manylinux1_x86_64.whl", hash = "sha256:01ae5f73431d21eead5015997ab41afa53aa1fbe252f9da060be5dad2c730ace"}, + {file = "typed_ast-1.4.3-cp36-cp36m-manylinux2014_aarch64.whl", hash = "sha256:c190f0899e9f9f8b6b7863debfb739abcb21a5c054f911ca3596d12b8a4c4c7f"}, + {file = "typed_ast-1.4.3-cp36-cp36m-win32.whl", hash = "sha256:398e44cd480f4d2b7ee8d98385ca104e35c81525dd98c519acff1b79bdaac363"}, + {file = "typed_ast-1.4.3-cp36-cp36m-win_amd64.whl", hash = "sha256:bff6ad71c81b3bba8fa35f0f1921fb24ff4476235a6e94a26ada2e54370e6da7"}, + {file = "typed_ast-1.4.3-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:0fb71b8c643187d7492c1f8352f2c15b4c4af3f6338f21681d3681b3dc31a266"}, + {file = "typed_ast-1.4.3-cp37-cp37m-manylinux1_i686.whl", hash = "sha256:760ad187b1041a154f0e4d0f6aae3e40fdb51d6de16e5c99aedadd9246450e9e"}, + {file = "typed_ast-1.4.3-cp37-cp37m-manylinux1_x86_64.whl", hash = "sha256:5feca99c17af94057417d744607b82dd0a664fd5e4ca98061480fd8b14b18d04"}, + {file = "typed_ast-1.4.3-cp37-cp37m-manylinux2014_aarch64.whl", hash = "sha256:95431a26309a21874005845c21118c83991c63ea800dd44843e42a916aec5899"}, + {file = "typed_ast-1.4.3-cp37-cp37m-win32.whl", hash = "sha256:aee0c1256be6c07bd3e1263ff920c325b59849dc95392a05f258bb9b259cf39c"}, + {file = "typed_ast-1.4.3-cp37-cp37m-win_amd64.whl", hash = "sha256:9ad2c92ec681e02baf81fdfa056fe0d818645efa9af1f1cd5fd6f1bd2bdfd805"}, + {file = "typed_ast-1.4.3-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:b36b4f3920103a25e1d5d024d155c504080959582b928e91cb608a65c3a49e1a"}, + {file = "typed_ast-1.4.3-cp38-cp38-manylinux1_i686.whl", hash = "sha256:067a74454df670dcaa4e59349a2e5c81e567d8d65458d480a5b3dfecec08c5ff"}, + {file = "typed_ast-1.4.3-cp38-cp38-manylinux1_x86_64.whl", hash = "sha256:7538e495704e2ccda9b234b82423a4038f324f3a10c43bc088a1636180f11a41"}, + {file = "typed_ast-1.4.3-cp38-cp38-manylinux2014_aarch64.whl", hash = "sha256:af3d4a73793725138d6b334d9d247ce7e5f084d96284ed23f22ee626a7b88e39"}, + {file = "typed_ast-1.4.3-cp38-cp38-win32.whl", hash = "sha256:f2362f3cb0f3172c42938946dbc5b7843c2a28aec307c49100c8b38764eb6927"}, + {file = "typed_ast-1.4.3-cp38-cp38-win_amd64.whl", hash = "sha256:dd4a21253f42b8d2b48410cb31fe501d32f8b9fbeb1f55063ad102fe9c425e40"}, + {file = "typed_ast-1.4.3-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:f328adcfebed9f11301eaedfa48e15bdece9b519fb27e6a8c01aa52a17ec31b3"}, + {file = "typed_ast-1.4.3-cp39-cp39-manylinux1_i686.whl", hash = "sha256:2c726c276d09fc5c414693a2de063f521052d9ea7c240ce553316f70656c84d4"}, + {file = "typed_ast-1.4.3-cp39-cp39-manylinux1_x86_64.whl", hash = "sha256:cae53c389825d3b46fb37538441f75d6aecc4174f615d048321b716df2757fb0"}, + {file = "typed_ast-1.4.3-cp39-cp39-manylinux2014_aarch64.whl", hash = "sha256:b9574c6f03f685070d859e75c7f9eeca02d6933273b5e69572e5ff9d5e3931c3"}, + {file = "typed_ast-1.4.3-cp39-cp39-win32.whl", hash = "sha256:209596a4ec71d990d71d5e0d312ac935d86930e6eecff6ccc7007fe54d703808"}, + {file = "typed_ast-1.4.3-cp39-cp39-win_amd64.whl", hash = "sha256:9c6d1a54552b5330bc657b7ef0eae25d00ba7ffe85d9ea8ae6540d2197a3788c"}, + {file = "typed_ast-1.4.3.tar.gz", hash = "sha256:fb1bbeac803adea29cedd70781399c99138358c26d05fcbd23c13016b7f5ec65"}, +] +typing-extensions = [ + {file = "typing_extensions-3.10.0.2-py2-none-any.whl", hash = "sha256:d8226d10bc02a29bcc81df19a26e56a9647f8b0a6d4a83924139f4a8b01f17b7"}, + {file = "typing_extensions-3.10.0.2-py3-none-any.whl", hash = "sha256:f1d25edafde516b146ecd0613dabcc61409817af4766fbbcfb8d1ad4ec441a34"}, + {file = "typing_extensions-3.10.0.2.tar.gz", hash = "sha256:49f75d16ff11f1cd258e1b988ccff82a3ca5570217d7ad8c5f48205dd99a677e"}, +] +zipp = [ + {file = "zipp-3.6.0-py3-none-any.whl", hash = "sha256:9fe5ea21568a0a70e50f273397638d39b03353731e6cbbb3fd8502a33fec40bc"}, + {file = "zipp-3.6.0.tar.gz", hash = "sha256:71c644c5369f4a6e07636f0aa966270449561fcea2e3d6747b8d23efaa9d7832"}, +] diff --git a/pyproject.toml b/pyproject.toml index 20edabce4..72c47c5ce 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -17,14 +17,14 @@ packages = [ python = "^3.6" [tool.poetry.dev-dependencies] -black = {version = "20.8b1",allows-prereleases = true} -pytest = "^6.1" -wheel = "^0.35.1" -mypy = "^0.790.0" -isort = "^5.6" -django = "^3.1" -flake8 = "^3.8" -psycopg2 = "^2.8" +black = "20.8b1" +pytest = "6.2.2" +wheel = "0.35.1" +mypy = "0.790" +isort = "5.7.0" +Django = "3.1.7" +flake8 = "3.8.4" +psycopg2 = "2.8.6" [tool.black] line-length = 88 @@ -34,5 +34,5 @@ include = '\.pyi?$' profile="black" [build-system] -requires = ["poetry>=0.12", "setuptools"] -build-backend = "poetry.masonry.api" +requires = ["poetry-core>=1.0.0"] +build-backend = "poetry.core.masonry.api" From a2de4090d2f8a2f52fa1ca489c2c063b19c659e5 Mon Sep 17 00:00:00 2001 From: Thiago Bellini Ribeiro Date: Sun, 24 Oct 2021 11:54:37 -0300 Subject: [PATCH 70/88] Update pyright to the latest version (#57) --- package.json | 2 +- typings/django/contrib/gis/gdal/srs.pyi | 4 ++-- typings/django/core/files/uploadhandler.pyi | 6 +++--- typings/django/db/models/query.pyi | 2 +- typings/django/template/base.pyi | 8 ++++---- typings/django/test/runner.pyi | 2 +- typings/django/utils/six.pyi | 4 ++-- yarn.lock | 8 ++++---- 8 files changed, 18 insertions(+), 18 deletions(-) diff --git a/package.json b/package.json index f1bbaf23f..658858090 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { "devDependencies": { - "pyright": "^1.1.129" + "pyright": "^1.1.181" } } diff --git a/typings/django/contrib/gis/gdal/srs.pyi b/typings/django/contrib/gis/gdal/srs.pyi index 9de926a7d..83543c95f 100644 --- a/typings/django/contrib/gis/gdal/srs.pyi +++ b/typings/django/contrib/gis/gdal/srs.pyi @@ -4,8 +4,8 @@ from typing import Any, Optional from django.contrib.gis.gdal.base import GDALBase as GDALBase class AxisOrder(IntEnum): - TRADITIONAL: int = ... - AUTHORITY: int = ... + TRADITIONAL: int + AUTHORITY: int class SpatialReference(GDALBase): destructor: Any = ... diff --git a/typings/django/core/files/uploadhandler.pyi b/typings/django/core/files/uploadhandler.pyi index d5c230e95..cbdcbd1d3 100644 --- a/typings/django/core/files/uploadhandler.pyi +++ b/typings/django/core/files/uploadhandler.pyi @@ -48,7 +48,7 @@ class FileUploadHandler: class TemporaryFileUploadHandler(FileUploadHandler): def __init__(self, request: Optional[HttpRequest] = ...) -> None: ... - file = ... # type: TemporaryUploadedFile + file: TemporaryUploadedFile = ... def new_file( self, field_name: str, @@ -62,8 +62,8 @@ class TemporaryFileUploadHandler(FileUploadHandler): def file_complete(self, file_size: int) -> Optional[UploadedFile]: ... class MemoryFileUploadHandler(FileUploadHandler): - activated = ... # type: bool - file = ... # type: IO[bytes] + activated: bool = ... + file: IO[bytes] = ... def handle_raw_input( self, input_data: IO[bytes], diff --git a/typings/django/db/models/query.pyi b/typings/django/db/models/query.pyi index 3371d327f..f71ee8cda 100644 --- a/typings/django/db/models/query.pyi +++ b/typings/django/db/models/query.pyi @@ -27,7 +27,7 @@ from django.db.models.expressions import F as F from django.db.models.query_utils import Q as Q # noqa: F401 from django.db.models.sql.query import Query, RawQuery -_T = TypeVar("_T", bound=models.Model, covariant=True) +_T = TypeVar("_T", bound=models.Model) _QS = TypeVar("_QS", bound="_BaseQuerySet[Any]") class _BaseQuerySet(Generic[_T], Sized): diff --git a/typings/django/template/base.pyi b/typings/django/template/base.pyi index 1cdb8b217..d778aed4e 100644 --- a/typings/django/template/base.pyi +++ b/typings/django/template/base.pyi @@ -37,10 +37,10 @@ tag_re: Any logger: Any class TokenType(Enum): - TEXT: int = ... - VAR: int = ... - BLOCK: int = ... - COMMENT: int = ... + TEXT: int + VAR: int + BLOCK: int + COMMENT: int class VariableDoesNotExist(Exception): msg: str = ... diff --git a/typings/django/test/runner.pyi b/typings/django/test/runner.pyi index 3c763bd60..fe20152d6 100644 --- a/typings/django/test/runner.pyi +++ b/typings/django/test/runner.pyi @@ -23,7 +23,7 @@ class DebugSQLTextTestResult(TextTestResult): logger: logging.Logger = ... def __init__(self, stream: Any, descriptions: bool, verbosity: int) -> None: ... debug_sql_stream: StringIO = ... - handler: logging.StreamHandler = ... + handler: logging.FileHandler = ... def startTest(self, test: TestCase) -> None: ... def stopTest(self, test: TestCase) -> None: ... def addError(self, test: Any, err: Any) -> None: ... diff --git a/typings/django/utils/six.pyi b/typings/django/utils/six.pyi index d7c3995d5..6c654108a 100644 --- a/typings/django/utils/six.pyi +++ b/typings/django/utils/six.pyi @@ -34,7 +34,7 @@ _V = TypeVar("_V") # https://github.com/python/typeshed/issues/17 PY2 = False PY3 = True -PY34 = ... # type: bool +PY34: bool = ... string_types = (str,) integer_types = (int,) @@ -42,7 +42,7 @@ class_types = (type,) text_type = str binary_type = bytes -MAXSIZE = ... # type: int +MAXSIZE: int = ... # def add_move # def remove_move diff --git a/yarn.lock b/yarn.lock index 631d67039..a68295de9 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2,7 +2,7 @@ # yarn lockfile v1 -pyright@^1.1.129: - version "1.1.129" - resolved "https://registry.yarnpkg.com/pyright/-/pyright-1.1.129.tgz#11fb60bc8bb48a934360c226101ace673aca0871" - integrity sha512-7GFRfANFT6xhEVlDWWk+81D2IJA57j8L9TbSVG61qPe79qb0O6yVzu9asCTJVopd7q6aRPVhXlfuXLMFKmKekQ== +pyright@^1.1.181: + version "1.1.181" + resolved "https://registry.yarnpkg.com/pyright/-/pyright-1.1.181.tgz#a86eac21531c6542f9500ea96e39342b65d31acd" + integrity sha512-YuBEA9qwGYNeTBpUtlFKYlNmK8X3/hz/wTRkfR6Z2HDLBQSOpqmNAu/lWrzDnJopSvXwK2qNrW0zFjCE1I4dzg== From 4fae2a82f50aa477e906528073583ff1182c3a18 Mon Sep 17 00:00:00 2001 From: Steve Dignam Date: Sun, 31 Oct 2021 10:26:50 -0400 Subject: [PATCH 71/88] fix(poetry): build / publish setup (#60) Newer version of poetry handles system links differently breaking the build. related: https://github.com/sbdchd/celery-types/issues/40 --- django-stubs | 1 - {typings/django => django-stubs}/__init__.pyi | 0 {typings/django => django-stubs}/apps/__init__.pyi | 0 {typings/django => django-stubs}/apps/config.pyi | 0 {typings/django => django-stubs}/apps/registry.pyi | 0 {typings/django => django-stubs}/conf/__init__.pyi | 0 {typings/django => django-stubs}/conf/global_settings.pyi | 0 {typings/django => django-stubs}/conf/locale/__init__.pyi | 0 {typings/django => django-stubs}/conf/urls/__init__.pyi | 0 {typings/django => django-stubs}/conf/urls/i18n.pyi | 0 {typings/django => django-stubs}/conf/urls/static.pyi | 0 {typings/django => django-stubs}/contrib/__init__.pyi | 0 {typings/django => django-stubs}/contrib/admin/__init__.pyi | 0 {typings/django => django-stubs}/contrib/admin/actions.pyi | 0 {typings/django => django-stubs}/contrib/admin/apps.pyi | 0 {typings/django => django-stubs}/contrib/admin/checks.pyi | 0 .../django => django-stubs}/contrib/admin/decorators.pyi | 0 .../django => django-stubs}/contrib/admin/exceptions.pyi | 0 {typings/django => django-stubs}/contrib/admin/filters.pyi | 0 {typings/django => django-stubs}/contrib/admin/forms.pyi | 0 {typings/django => django-stubs}/contrib/admin/helpers.pyi | 0 .../contrib/admin/migrations/__init__.pyi | 0 {typings/django => django-stubs}/contrib/admin/models.pyi | 0 {typings/django => django-stubs}/contrib/admin/options.pyi | 0 {typings/django => django-stubs}/contrib/admin/sites.pyi | 0 .../contrib/admin/templatetags/__init__.pyi | 0 .../contrib/admin/templatetags/admin_list.pyi | 0 .../contrib/admin/templatetags/admin_modify.pyi | 0 .../contrib/admin/templatetags/admin_static.pyi | 0 .../contrib/admin/templatetags/admin_urls.pyi | 0 .../contrib/admin/templatetags/base.pyi | 0 .../contrib/admin/templatetags/log.pyi | 0 {typings/django => django-stubs}/contrib/admin/tests.pyi | 0 {typings/django => django-stubs}/contrib/admin/utils.pyi | 0 .../contrib/admin/views/__init__.pyi | 0 .../contrib/admin/views/autocomplete.pyi | 0 .../contrib/admin/views/decorators.pyi | 0 .../django => django-stubs}/contrib/admin/views/main.pyi | 0 {typings/django => django-stubs}/contrib/admin/widgets.pyi | 0 .../django => django-stubs}/contrib/admindocs/__init__.pyi | 0 {typings/django => django-stubs}/contrib/admindocs/apps.pyi | 0 .../contrib/admindocs/middleware.pyi | 0 {typings/django => django-stubs}/contrib/admindocs/urls.pyi | 0 .../django => django-stubs}/contrib/admindocs/utils.pyi | 0 .../django => django-stubs}/contrib/admindocs/views.pyi | 0 {typings/django => django-stubs}/contrib/auth/__init__.pyi | 0 {typings/django => django-stubs}/contrib/auth/admin.pyi | 0 {typings/django => django-stubs}/contrib/auth/apps.pyi | 0 {typings/django => django-stubs}/contrib/auth/backends.pyi | 0 {typings/django => django-stubs}/contrib/auth/base_user.pyi | 0 {typings/django => django-stubs}/contrib/auth/checks.pyi | 0 .../contrib/auth/context_processors.pyi | 0 .../django => django-stubs}/contrib/auth/decorators.pyi | 0 {typings/django => django-stubs}/contrib/auth/forms.pyi | 0 .../contrib/auth/handlers/__init__.pyi | 0 .../contrib/auth/handlers/modwsgi.pyi | 0 {typings/django => django-stubs}/contrib/auth/hashers.pyi | 0 .../contrib/auth/management/__init__.pyi | 0 .../contrib/auth/management/commands/__init__.pyi | 0 .../contrib/auth/management/commands/changepassword.pyi | 0 .../contrib/auth/management/commands/createsuperuser.pyi | 0 .../django => django-stubs}/contrib/auth/middleware.pyi | 0 .../contrib/auth/migrations/__init__.pyi | 0 {typings/django => django-stubs}/contrib/auth/mixins.pyi | 0 {typings/django => django-stubs}/contrib/auth/models.pyi | 0 .../contrib/auth/password_validation.pyi | 0 {typings/django => django-stubs}/contrib/auth/signals.pyi | 0 {typings/django => django-stubs}/contrib/auth/tokens.pyi | 0 {typings/django => django-stubs}/contrib/auth/urls.pyi | 0 .../django => django-stubs}/contrib/auth/validators.pyi | 0 {typings/django => django-stubs}/contrib/auth/views.pyi | 0 .../contrib/contenttypes/__init__.pyi | 0 .../django => django-stubs}/contrib/contenttypes/admin.pyi | 0 .../django => django-stubs}/contrib/contenttypes/apps.pyi | 0 .../django => django-stubs}/contrib/contenttypes/checks.pyi | 0 .../django => django-stubs}/contrib/contenttypes/fields.pyi | 0 .../django => django-stubs}/contrib/contenttypes/forms.pyi | 0 .../contrib/contenttypes/management/__init__.pyi | 0 .../contrib/contenttypes/management/commands/__init__.pyi | 0 .../management/commands/remove_stale_contenttypes.pyi | 0 .../contrib/contenttypes/migrations/__init__.pyi | 0 .../django => django-stubs}/contrib/contenttypes/models.pyi | 0 .../django => django-stubs}/contrib/contenttypes/views.pyi | 0 .../django => django-stubs}/contrib/flatpages/__init__.pyi | 0 .../django => django-stubs}/contrib/flatpages/admin.pyi | 0 {typings/django => django-stubs}/contrib/flatpages/apps.pyi | 0 .../django => django-stubs}/contrib/flatpages/forms.pyi | 0 .../contrib/flatpages/middleware.pyi | 0 .../contrib/flatpages/migrations/__init__.pyi | 0 .../django => django-stubs}/contrib/flatpages/models.pyi | 0 .../django => django-stubs}/contrib/flatpages/sitemaps.pyi | 0 .../contrib/flatpages/templatetags/__init__.pyi | 0 .../contrib/flatpages/templatetags/flatpages.pyi | 0 {typings/django => django-stubs}/contrib/flatpages/urls.pyi | 0 .../django => django-stubs}/contrib/flatpages/views.pyi | 0 {typings/django => django-stubs}/contrib/gis/__init__.pyi | 0 .../django => django-stubs}/contrib/gis/admin/__init__.pyi | 0 .../django => django-stubs}/contrib/gis/admin/options.pyi | 0 .../django => django-stubs}/contrib/gis/admin/widgets.pyi | 0 {typings/django => django-stubs}/contrib/gis/apps.pyi | 0 .../django => django-stubs}/contrib/gis/db/__init__.pyi | 0 .../contrib/gis/db/backends/__init__.pyi | 0 .../contrib/gis/db/backends/base/__init__.pyi | 0 .../contrib/gis/db/backends/base/adapter.pyi | 0 .../contrib/gis/db/backends/base/features.pyi | 0 .../contrib/gis/db/backends/base/models.pyi | 0 .../contrib/gis/db/backends/base/operations.pyi | 0 .../contrib/gis/db/backends/mysql/__init__.pyi | 0 .../contrib/gis/db/backends/mysql/base.pyi | 0 .../contrib/gis/db/backends/mysql/features.pyi | 0 .../contrib/gis/db/backends/mysql/introspection.pyi | 0 .../contrib/gis/db/backends/mysql/operations.pyi | 0 .../contrib/gis/db/backends/mysql/schema.pyi | 0 .../contrib/gis/db/backends/oracle/__init__.pyi | 0 .../contrib/gis/db/backends/oracle/adapter.pyi | 0 .../contrib/gis/db/backends/oracle/base.pyi | 0 .../contrib/gis/db/backends/oracle/features.pyi | 0 .../contrib/gis/db/backends/oracle/introspection.pyi | 0 .../contrib/gis/db/backends/oracle/models.pyi | 0 .../contrib/gis/db/backends/oracle/operations.pyi | 0 .../contrib/gis/db/backends/oracle/schema.pyi | 0 .../contrib/gis/db/backends/postgis/__init__.pyi | 0 .../contrib/gis/db/backends/postgis/adapter.pyi | 0 .../contrib/gis/db/backends/postgis/base.pyi | 0 .../contrib/gis/db/backends/postgis/const.pyi | 0 .../contrib/gis/db/backends/postgis/features.pyi | 0 .../contrib/gis/db/backends/postgis/introspection.pyi | 0 .../contrib/gis/db/backends/postgis/models.pyi | 0 .../contrib/gis/db/backends/postgis/operations.pyi | 0 .../contrib/gis/db/backends/postgis/pgraster.pyi | 0 .../contrib/gis/db/backends/postgis/schema.pyi | 0 .../contrib/gis/db/backends/spatialite/__init__.pyi | 0 .../contrib/gis/db/backends/spatialite/adapter.pyi | 0 .../contrib/gis/db/backends/spatialite/base.pyi | 0 .../contrib/gis/db/backends/spatialite/client.pyi | 0 .../contrib/gis/db/backends/spatialite/features.pyi | 0 .../contrib/gis/db/backends/spatialite/introspection.pyi | 0 .../contrib/gis/db/backends/spatialite/models.pyi | 0 .../contrib/gis/db/backends/spatialite/operations.pyi | 0 .../contrib/gis/db/backends/spatialite/schema.pyi | 0 .../contrib/gis/db/backends/utils.pyi | 0 .../contrib/gis/db/models/__init__.pyi | 0 .../contrib/gis/db/models/aggregates.pyi | 0 .../contrib/gis/db/models/fields.pyi | 0 .../contrib/gis/db/models/functions.pyi | 0 .../contrib/gis/db/models/lookups.pyi | 0 .../django => django-stubs}/contrib/gis/db/models/proxy.pyi | 0 .../contrib/gis/db/models/sql/__init__.pyi | 0 .../contrib/gis/db/models/sql/conversion.pyi | 0 {typings/django => django-stubs}/contrib/gis/feeds.pyi | 0 .../django => django-stubs}/contrib/gis/forms/__init__.pyi | 0 .../django => django-stubs}/contrib/gis/forms/fields.pyi | 0 .../django => django-stubs}/contrib/gis/forms/widgets.pyi | 0 .../django => django-stubs}/contrib/gis/gdal/__init__.pyi | 0 {typings/django => django-stubs}/contrib/gis/gdal/base.pyi | 0 .../django => django-stubs}/contrib/gis/gdal/datasource.pyi | 0 .../django => django-stubs}/contrib/gis/gdal/driver.pyi | 0 .../django => django-stubs}/contrib/gis/gdal/envelope.pyi | 0 {typings/django => django-stubs}/contrib/gis/gdal/error.pyi | 0 .../django => django-stubs}/contrib/gis/gdal/feature.pyi | 0 {typings/django => django-stubs}/contrib/gis/gdal/field.pyi | 0 .../django => django-stubs}/contrib/gis/gdal/geometries.pyi | 0 .../django => django-stubs}/contrib/gis/gdal/geomtype.pyi | 0 {typings/django => django-stubs}/contrib/gis/gdal/layer.pyi | 0 .../django => django-stubs}/contrib/gis/gdal/libgdal.pyi | 0 .../contrib/gis/gdal/prototypes/__init__.pyi | 0 .../contrib/gis/gdal/prototypes/ds.pyi | 0 .../contrib/gis/gdal/prototypes/errcheck.pyi | 0 .../contrib/gis/gdal/prototypes/generation.pyi | 0 .../contrib/gis/gdal/prototypes/geom.pyi | 0 .../contrib/gis/gdal/prototypes/raster.pyi | 0 .../contrib/gis/gdal/prototypes/srs.pyi | 0 .../contrib/gis/gdal/raster/__init__.pyi | 0 .../contrib/gis/gdal/raster/band.pyi | 0 .../contrib/gis/gdal/raster/base.pyi | 0 .../contrib/gis/gdal/raster/const.pyi | 0 .../contrib/gis/gdal/raster/source.pyi | 0 {typings/django => django-stubs}/contrib/gis/gdal/srs.pyi | 0 .../django => django-stubs}/contrib/gis/geoip2/__init__.pyi | 0 .../django => django-stubs}/contrib/gis/geoip2/base.pyi | 0 .../contrib/gis/geoip2/resources.pyi | 0 {typings/django => django-stubs}/contrib/gis/geometry.pyi | 0 .../django => django-stubs}/contrib/gis/geos/__init__.pyi | 0 {typings/django => django-stubs}/contrib/gis/geos/base.pyi | 0 .../contrib/gis/geos/collections.pyi | 0 .../django => django-stubs}/contrib/gis/geos/coordseq.pyi | 0 {typings/django => django-stubs}/contrib/gis/geos/error.pyi | 0 .../django => django-stubs}/contrib/gis/geos/factory.pyi | 0 .../django => django-stubs}/contrib/gis/geos/geometry.pyi | 0 {typings/django => django-stubs}/contrib/gis/geos/io.pyi | 0 .../django => django-stubs}/contrib/gis/geos/libgeos.pyi | 0 .../django => django-stubs}/contrib/gis/geos/linestring.pyi | 0 .../contrib/gis/geos/mutable_list.pyi | 0 {typings/django => django-stubs}/contrib/gis/geos/point.pyi | 0 .../django => django-stubs}/contrib/gis/geos/polygon.pyi | 0 .../django => django-stubs}/contrib/gis/geos/prepared.pyi | 0 .../contrib/gis/geos/prototypes/__init__.pyi | 0 .../contrib/gis/geos/prototypes/coordseq.pyi | 0 .../contrib/gis/geos/prototypes/errcheck.pyi | 0 .../contrib/gis/geos/prototypes/geom.pyi | 0 .../contrib/gis/geos/prototypes/io.pyi | 0 .../contrib/gis/geos/prototypes/misc.pyi | 0 .../contrib/gis/geos/prototypes/predicates.pyi | 0 .../contrib/gis/geos/prototypes/prepared.pyi | 0 .../contrib/gis/geos/prototypes/threadsafe.pyi | 0 .../contrib/gis/geos/prototypes/topology.pyi | 0 {typings/django => django-stubs}/contrib/gis/measure.pyi | 0 {typings/django => django-stubs}/contrib/gis/ptr.pyi | 0 .../contrib/gis/serializers/__init__.pyi | 0 .../contrib/gis/serializers/geojson.pyi | 0 {typings/django => django-stubs}/contrib/gis/shortcuts.pyi | 0 .../contrib/gis/sitemaps/__init__.pyi | 0 .../django => django-stubs}/contrib/gis/sitemaps/kml.pyi | 0 .../django => django-stubs}/contrib/gis/sitemaps/views.pyi | 0 .../django => django-stubs}/contrib/gis/utils/__init__.pyi | 0 .../contrib/gis/utils/layermapping.pyi | 0 .../django => django-stubs}/contrib/gis/utils/ogrinfo.pyi | 0 .../contrib/gis/utils/ogrinspect.pyi | 0 {typings/django => django-stubs}/contrib/gis/utils/srs.pyi | 0 {typings/django => django-stubs}/contrib/gis/views.pyi | 0 .../django => django-stubs}/contrib/humanize/__init__.pyi | 0 {typings/django => django-stubs}/contrib/humanize/apps.pyi | 0 .../contrib/humanize/templatetags/__init__.pyi | 0 .../contrib/humanize/templatetags/humanize.pyi | 0 .../django => django-stubs}/contrib/messages/__init__.pyi | 0 {typings/django => django-stubs}/contrib/messages/api.pyi | 0 {typings/django => django-stubs}/contrib/messages/apps.pyi | 0 .../django => django-stubs}/contrib/messages/constants.pyi | 0 .../contrib/messages/context_processors.pyi | 0 .../django => django-stubs}/contrib/messages/middleware.pyi | 0 .../contrib/messages/storage/__init__.pyi | 0 .../contrib/messages/storage/base.pyi | 0 .../contrib/messages/storage/cookie.pyi | 0 .../contrib/messages/storage/fallback.pyi | 0 .../contrib/messages/storage/session.pyi | 0 {typings/django => django-stubs}/contrib/messages/utils.pyi | 0 {typings/django => django-stubs}/contrib/messages/views.pyi | 0 .../django => django-stubs}/contrib/postgres/__init__.pyi | 0 .../contrib/postgres/aggregates/__init__.pyi | 0 .../contrib/postgres/aggregates/general.pyi | 0 .../contrib/postgres/aggregates/mixins.pyi | 0 .../contrib/postgres/aggregates/statistics.pyi | 0 {typings/django => django-stubs}/contrib/postgres/apps.pyi | 0 .../contrib/postgres/constraints.pyi | 0 .../contrib/postgres/fields/__init__.pyi | 0 .../contrib/postgres/fields/array.pyi | 0 .../contrib/postgres/fields/citext.pyi | 0 .../contrib/postgres/fields/hstore.pyi | 0 .../contrib/postgres/fields/jsonb.pyi | 0 .../contrib/postgres/fields/mixins.pyi | 0 .../contrib/postgres/fields/ranges.pyi | 0 .../contrib/postgres/fields/utils.pyi | 0 .../django => django-stubs}/contrib/postgres/functions.pyi | 0 .../django => django-stubs}/contrib/postgres/indexes.pyi | 0 .../django => django-stubs}/contrib/postgres/lookups.pyi | 0 .../django => django-stubs}/contrib/postgres/operations.pyi | 0 .../django => django-stubs}/contrib/postgres/search.pyi | 0 .../contrib/postgres/serializers.pyi | 0 .../django => django-stubs}/contrib/postgres/signals.pyi | 0 {typings/django => django-stubs}/contrib/postgres/utils.pyi | 0 .../django => django-stubs}/contrib/postgres/validators.pyi | 0 .../django => django-stubs}/contrib/redirects/__init__.pyi | 0 .../django => django-stubs}/contrib/redirects/admin.pyi | 0 {typings/django => django-stubs}/contrib/redirects/apps.pyi | 0 .../contrib/redirects/middleware.pyi | 0 .../contrib/redirects/migrations/__init__.pyi | 0 .../django => django-stubs}/contrib/redirects/models.pyi | 0 .../django => django-stubs}/contrib/sessions/__init__.pyi | 0 {typings/django => django-stubs}/contrib/sessions/apps.pyi | 0 .../contrib/sessions/backends/__init__.pyi | 0 .../contrib/sessions/backends/base.pyi | 0 .../contrib/sessions/backends/cache.pyi | 0 .../contrib/sessions/backends/cached_db.pyi | 0 .../contrib/sessions/backends/db.pyi | 0 .../contrib/sessions/backends/file.pyi | 0 .../contrib/sessions/backends/signed_cookies.pyi | 0 .../contrib/sessions/base_session.pyi | 0 .../django => django-stubs}/contrib/sessions/exceptions.pyi | 0 .../contrib/sessions/management/__init__.pyi | 0 .../contrib/sessions/management/commands/__init__.pyi | 0 .../contrib/sessions/management/commands/clearsessions.pyi | 0 .../django => django-stubs}/contrib/sessions/middleware.pyi | 0 .../contrib/sessions/migrations/__init__.pyi | 0 .../django => django-stubs}/contrib/sessions/models.pyi | 0 .../contrib/sessions/serializers.pyi | 0 .../django => django-stubs}/contrib/sitemaps/__init__.pyi | 0 {typings/django => django-stubs}/contrib/sitemaps/apps.pyi | 0 .../contrib/sitemaps/management/__init__.pyi | 0 .../contrib/sitemaps/management/commands/__init__.pyi | 0 .../contrib/sitemaps/management/commands/ping_google.pyi | 0 {typings/django => django-stubs}/contrib/sitemaps/views.pyi | 0 {typings/django => django-stubs}/contrib/sites/__init__.pyi | 0 {typings/django => django-stubs}/contrib/sites/admin.pyi | 0 {typings/django => django-stubs}/contrib/sites/apps.pyi | 0 .../django => django-stubs}/contrib/sites/management.pyi | 0 {typings/django => django-stubs}/contrib/sites/managers.pyi | 0 .../django => django-stubs}/contrib/sites/middleware.pyi | 0 .../contrib/sites/migrations/__init__.pyi | 0 {typings/django => django-stubs}/contrib/sites/models.pyi | 0 {typings/django => django-stubs}/contrib/sites/requests.pyi | 0 .../django => django-stubs}/contrib/sites/shortcuts.pyi | 0 .../contrib/staticfiles/__init__.pyi | 0 .../django => django-stubs}/contrib/staticfiles/apps.pyi | 0 .../django => django-stubs}/contrib/staticfiles/checks.pyi | 0 .../django => django-stubs}/contrib/staticfiles/finders.pyi | 0 .../contrib/staticfiles/handlers.pyi | 0 .../contrib/staticfiles/management/__init__.pyi | 0 .../contrib/staticfiles/management/commands/__init__.pyi | 0 .../staticfiles/management/commands/collectstatic.pyi | 0 .../contrib/staticfiles/management/commands/findstatic.pyi | 0 .../contrib/staticfiles/management/commands/runserver.pyi | 0 .../django => django-stubs}/contrib/staticfiles/storage.pyi | 0 .../contrib/staticfiles/templatetags/__init__.pyi | 0 .../contrib/staticfiles/templatetags/staticfiles.pyi | 0 .../django => django-stubs}/contrib/staticfiles/testing.pyi | 0 .../django => django-stubs}/contrib/staticfiles/urls.pyi | 0 .../django => django-stubs}/contrib/staticfiles/utils.pyi | 0 .../django => django-stubs}/contrib/staticfiles/views.pyi | 0 .../contrib/syndication/__init__.pyi | 0 .../django => django-stubs}/contrib/syndication/apps.pyi | 0 .../django => django-stubs}/contrib/syndication/views.pyi | 0 {typings/django => django-stubs}/core/__init__.pyi | 0 {typings/django => django-stubs}/core/asgi.pyi | 0 {typings/django => django-stubs}/core/cache/__init__.pyi | 0 .../core/cache/backends/__init__.pyi | 0 .../django => django-stubs}/core/cache/backends/base.pyi | 0 {typings/django => django-stubs}/core/cache/backends/db.pyi | 0 .../django => django-stubs}/core/cache/backends/dummy.pyi | 0 .../core/cache/backends/filebased.pyi | 0 .../django => django-stubs}/core/cache/backends/locmem.pyi | 0 .../core/cache/backends/memcached.pyi | 0 {typings/django => django-stubs}/core/cache/utils.pyi | 0 {typings/django => django-stubs}/core/checks/__init__.pyi | 0 .../django => django-stubs}/core/checks/async_checks.pyi | 0 {typings/django => django-stubs}/core/checks/caches.pyi | 0 .../core/checks/compatibility/__init__.pyi | 0 {typings/django => django-stubs}/core/checks/database.pyi | 0 {typings/django => django-stubs}/core/checks/messages.pyi | 0 .../django => django-stubs}/core/checks/model_checks.pyi | 0 {typings/django => django-stubs}/core/checks/registry.pyi | 0 .../core/checks/security/__init__.pyi | 0 .../django => django-stubs}/core/checks/security/base.pyi | 0 .../django => django-stubs}/core/checks/security/csrf.pyi | 0 .../core/checks/security/sessions.pyi | 0 {typings/django => django-stubs}/core/checks/templates.pyi | 0 .../django => django-stubs}/core/checks/translation.pyi | 0 {typings/django => django-stubs}/core/checks/urls.pyi | 0 {typings/django => django-stubs}/core/exceptions.pyi | 0 {typings/django => django-stubs}/core/files/__init__.pyi | 0 {typings/django => django-stubs}/core/files/base.pyi | 0 {typings/django => django-stubs}/core/files/images.pyi | 0 {typings/django => django-stubs}/core/files/locks.pyi | 0 {typings/django => django-stubs}/core/files/move.pyi | 0 {typings/django => django-stubs}/core/files/storage.pyi | 0 {typings/django => django-stubs}/core/files/temp.pyi | 0 .../django => django-stubs}/core/files/uploadedfile.pyi | 0 .../django => django-stubs}/core/files/uploadhandler.pyi | 0 {typings/django => django-stubs}/core/files/utils.pyi | 0 {typings/django => django-stubs}/core/handlers/__init__.pyi | 0 {typings/django => django-stubs}/core/handlers/asgi.pyi | 0 {typings/django => django-stubs}/core/handlers/base.pyi | 0 .../django => django-stubs}/core/handlers/exception.pyi | 0 {typings/django => django-stubs}/core/handlers/wsgi.pyi | 0 {typings/django => django-stubs}/core/mail/__init__.pyi | 0 .../django => django-stubs}/core/mail/backends/__init__.pyi | 0 .../django => django-stubs}/core/mail/backends/base.pyi | 0 .../django => django-stubs}/core/mail/backends/console.pyi | 0 .../django => django-stubs}/core/mail/backends/dummy.pyi | 0 .../core/mail/backends/filebased.pyi | 0 .../django => django-stubs}/core/mail/backends/locmem.pyi | 0 .../django => django-stubs}/core/mail/backends/smtp.pyi | 0 {typings/django => django-stubs}/core/mail/message.pyi | 0 {typings/django => django-stubs}/core/mail/utils.pyi | 0 .../django => django-stubs}/core/management/__init__.pyi | 0 {typings/django => django-stubs}/core/management/base.pyi | 0 {typings/django => django-stubs}/core/management/color.pyi | 0 .../core/management/commands/__init__.pyi | 0 .../core/management/commands/check.pyi | 0 .../core/management/commands/compilemessages.pyi | 0 .../core/management/commands/createcachetable.pyi | 0 .../core/management/commands/dbshell.pyi | 0 .../core/management/commands/diffsettings.pyi | 0 .../core/management/commands/dumpdata.pyi | 0 .../core/management/commands/flush.pyi | 0 .../core/management/commands/inspectdb.pyi | 0 .../core/management/commands/loaddata.pyi | 0 .../core/management/commands/makemessages.pyi | 0 .../core/management/commands/makemigrations.pyi | 0 .../core/management/commands/migrate.pyi | 0 .../core/management/commands/runserver.pyi | 0 .../core/management/commands/sendtestemail.pyi | 0 .../core/management/commands/shell.pyi | 0 .../core/management/commands/showmigrations.pyi | 0 .../core/management/commands/sqlflush.pyi | 0 .../core/management/commands/sqlmigrate.pyi | 0 .../core/management/commands/sqlsequencereset.pyi | 0 .../core/management/commands/squashmigrations.pyi | 0 .../core/management/commands/startapp.pyi | 0 .../core/management/commands/startproject.pyi | 0 .../core/management/commands/test.pyi | 0 .../core/management/commands/testserver.pyi | 0 {typings/django => django-stubs}/core/management/sql.pyi | 0 .../django => django-stubs}/core/management/templates.pyi | 0 {typings/django => django-stubs}/core/management/utils.pyi | 0 {typings/django => django-stubs}/core/paginator.pyi | 0 .../django => django-stubs}/core/serializers/__init__.pyi | 0 {typings/django => django-stubs}/core/serializers/base.pyi | 0 {typings/django => django-stubs}/core/serializers/json.pyi | 0 .../django => django-stubs}/core/serializers/python.pyi | 0 .../django => django-stubs}/core/serializers/pyyaml.pyi | 0 .../core/serializers/xml_serializer.pyi | 0 {typings/django => django-stubs}/core/servers/__init__.pyi | 0 {typings/django => django-stubs}/core/servers/basehttp.pyi | 0 {typings/django => django-stubs}/core/signals.pyi | 0 {typings/django => django-stubs}/core/signing.pyi | 0 {typings/django => django-stubs}/core/validators.pyi | 0 {typings/django => django-stubs}/core/wsgi.pyi | 0 {typings/django => django-stubs}/db/__init__.pyi | 0 {typings/django => django-stubs}/db/backends/__init__.pyi | 0 .../django => django-stubs}/db/backends/base/__init__.pyi | 0 {typings/django => django-stubs}/db/backends/base/base.pyi | 0 .../django => django-stubs}/db/backends/base/client.pyi | 0 .../django => django-stubs}/db/backends/base/creation.pyi | 0 .../django => django-stubs}/db/backends/base/features.pyi | 0 .../db/backends/base/introspection.pyi | 0 .../django => django-stubs}/db/backends/base/operations.pyi | 0 .../django => django-stubs}/db/backends/base/schema.pyi | 0 .../django => django-stubs}/db/backends/base/validation.pyi | 0 .../django => django-stubs}/db/backends/ddl_references.pyi | 0 .../django => django-stubs}/db/backends/dummy/__init__.pyi | 0 {typings/django => django-stubs}/db/backends/dummy/base.pyi | 0 .../django => django-stubs}/db/backends/dummy/features.pyi | 0 .../django => django-stubs}/db/backends/mysql/__init__.pyi | 0 {typings/django => django-stubs}/db/backends/mysql/base.pyi | 0 .../django => django-stubs}/db/backends/mysql/client.pyi | 0 .../django => django-stubs}/db/backends/mysql/compiler.pyi | 0 .../django => django-stubs}/db/backends/mysql/creation.pyi | 0 .../django => django-stubs}/db/backends/mysql/features.pyi | 0 .../db/backends/mysql/introspection.pyi | 0 .../db/backends/mysql/operations.pyi | 0 .../django => django-stubs}/db/backends/mysql/schema.pyi | 0 .../db/backends/mysql/validation.pyi | 0 .../django => django-stubs}/db/backends/oracle/__init__.pyi | 0 .../django => django-stubs}/db/backends/oracle/base.pyi | 0 .../django => django-stubs}/db/backends/oracle/client.pyi | 0 .../django => django-stubs}/db/backends/oracle/creation.pyi | 0 .../django => django-stubs}/db/backends/oracle/features.pyi | 0 .../db/backends/oracle/functions.pyi | 0 .../db/backends/oracle/introspection.pyi | 0 .../db/backends/oracle/operations.pyi | 0 .../django => django-stubs}/db/backends/oracle/schema.pyi | 0 .../django => django-stubs}/db/backends/oracle/utils.pyi | 0 .../db/backends/oracle/validation.pyi | 0 .../db/backends/postgresql/__init__.pyi | 0 .../django => django-stubs}/db/backends/postgresql/base.pyi | 0 .../db/backends/postgresql/client.pyi | 0 .../db/backends/postgresql/creation.pyi | 0 .../db/backends/postgresql/features.pyi | 0 .../db/backends/postgresql/introspection.pyi | 0 .../db/backends/postgresql/operations.pyi | 0 .../db/backends/postgresql/schema.pyi | 0 {typings/django => django-stubs}/db/backends/signals.pyi | 0 .../db/backends/sqlite3/__init__.pyi | 0 .../django => django-stubs}/db/backends/sqlite3/base.pyi | 0 .../django => django-stubs}/db/backends/sqlite3/client.pyi | 0 .../db/backends/sqlite3/creation.pyi | 0 .../db/backends/sqlite3/features.pyi | 0 .../db/backends/sqlite3/introspection.pyi | 0 .../db/backends/sqlite3/operations.pyi | 0 .../django => django-stubs}/db/backends/sqlite3/schema.pyi | 0 {typings/django => django-stubs}/db/backends/utils.pyi | 0 {typings/django => django-stubs}/db/migrations/__init__.pyi | 0 .../django => django-stubs}/db/migrations/autodetector.pyi | 0 .../django => django-stubs}/db/migrations/exceptions.pyi | 0 {typings/django => django-stubs}/db/migrations/executor.pyi | 0 {typings/django => django-stubs}/db/migrations/graph.pyi | 0 {typings/django => django-stubs}/db/migrations/loader.pyi | 0 .../django => django-stubs}/db/migrations/migration.pyi | 0 .../db/migrations/operations/__init__.pyi | 0 .../db/migrations/operations/base.pyi | 0 .../db/migrations/operations/fields.pyi | 0 .../db/migrations/operations/models.pyi | 0 .../db/migrations/operations/special.pyi | 0 .../db/migrations/operations/utils.pyi | 0 .../django => django-stubs}/db/migrations/optimizer.pyi | 0 .../django => django-stubs}/db/migrations/questioner.pyi | 0 {typings/django => django-stubs}/db/migrations/recorder.pyi | 0 .../django => django-stubs}/db/migrations/serializer.pyi | 0 {typings/django => django-stubs}/db/migrations/state.pyi | 0 .../db/migrations/topological_sort.pyi | 0 {typings/django => django-stubs}/db/migrations/utils.pyi | 0 {typings/django => django-stubs}/db/migrations/writer.pyi | 0 {typings/django => django-stubs}/db/models/__init__.pyi | 0 {typings/django => django-stubs}/db/models/aggregates.pyi | 0 {typings/django => django-stubs}/db/models/base.pyi | 0 {typings/django => django-stubs}/db/models/constants.pyi | 0 {typings/django => django-stubs}/db/models/constraints.pyi | 0 {typings/django => django-stubs}/db/models/deletion.pyi | 0 {typings/django => django-stubs}/db/models/enums.pyi | 0 {typings/django => django-stubs}/db/models/expressions.pyi | 0 .../django => django-stubs}/db/models/fields/__init__.pyi | 0 {typings/django => django-stubs}/db/models/fields/files.pyi | 0 {typings/django => django-stubs}/db/models/fields/json.pyi | 0 .../django => django-stubs}/db/models/fields/mixins.pyi | 0 {typings/django => django-stubs}/db/models/fields/proxy.pyi | 0 .../django => django-stubs}/db/models/fields/related.pyi | 0 .../db/models/fields/related_descriptors.pyi | 0 .../db/models/fields/related_lookups.pyi | 0 .../db/models/fields/reverse_related.pyi | 0 .../db/models/functions/__init__.pyi | 0 .../db/models/functions/comparison.pyi | 0 .../db/models/functions/datetime.pyi | 0 .../django => django-stubs}/db/models/functions/math.pyi | 0 .../django => django-stubs}/db/models/functions/mixins.pyi | 0 .../django => django-stubs}/db/models/functions/text.pyi | 0 .../django => django-stubs}/db/models/functions/window.pyi | 0 {typings/django => django-stubs}/db/models/indexes.pyi | 0 {typings/django => django-stubs}/db/models/lookups.pyi | 0 {typings/django => django-stubs}/db/models/manager.pyi | 0 {typings/django => django-stubs}/db/models/options.pyi | 0 {typings/django => django-stubs}/db/models/query.pyi | 0 {typings/django => django-stubs}/db/models/query_utils.pyi | 0 {typings/django => django-stubs}/db/models/signals.pyi | 0 {typings/django => django-stubs}/db/models/sql/__init__.pyi | 0 {typings/django => django-stubs}/db/models/sql/compiler.pyi | 0 .../django => django-stubs}/db/models/sql/constants.pyi | 0 .../db/models/sql/datastructures.pyi | 0 {typings/django => django-stubs}/db/models/sql/query.pyi | 0 .../django => django-stubs}/db/models/sql/subqueries.pyi | 0 {typings/django => django-stubs}/db/models/sql/where.pyi | 0 {typings/django => django-stubs}/db/models/utils.pyi | 0 {typings/django => django-stubs}/db/transaction.pyi | 0 {typings/django => django-stubs}/db/utils.pyi | 0 {typings/django => django-stubs}/dispatch/__init__.pyi | 0 {typings/django => django-stubs}/dispatch/dispatcher.pyi | 0 {typings/django => django-stubs}/forms/__init__.pyi | 0 {typings/django => django-stubs}/forms/boundfield.pyi | 0 {typings/django => django-stubs}/forms/fields.pyi | 0 {typings/django => django-stubs}/forms/forms.pyi | 0 {typings/django => django-stubs}/forms/formsets.pyi | 0 {typings/django => django-stubs}/forms/models.pyi | 0 {typings/django => django-stubs}/forms/renderers.pyi | 0 {typings/django => django-stubs}/forms/utils.pyi | 0 {typings/django => django-stubs}/forms/widgets.pyi | 0 {typings/django => django-stubs}/http/__init__.pyi | 0 {typings/django => django-stubs}/http/cookie.pyi | 0 {typings/django => django-stubs}/http/multipartparser.pyi | 0 {typings/django => django-stubs}/http/request.pyi | 0 {typings/django => django-stubs}/http/response.pyi | 0 {typings/django => django-stubs}/middleware/__init__.pyi | 0 {typings/django => django-stubs}/middleware/cache.pyi | 0 .../django => django-stubs}/middleware/clickjacking.pyi | 0 {typings/django => django-stubs}/middleware/common.pyi | 0 {typings/django => django-stubs}/middleware/csrf.pyi | 0 {typings/django => django-stubs}/middleware/gzip.pyi | 0 {typings/django => django-stubs}/middleware/http.pyi | 0 {typings/django => django-stubs}/middleware/locale.pyi | 0 {typings/django => django-stubs}/middleware/security.pyi | 0 {typings/django => django-stubs}/shortcuts.pyi | 0 {typings/django => django-stubs}/template/__init__.pyi | 0 .../django => django-stubs}/template/backends/__init__.pyi | 0 {typings/django => django-stubs}/template/backends/base.pyi | 0 .../django => django-stubs}/template/backends/django.pyi | 0 .../django => django-stubs}/template/backends/dummy.pyi | 0 .../django => django-stubs}/template/backends/jinja2.pyi | 0 .../django => django-stubs}/template/backends/utils.pyi | 0 {typings/django => django-stubs}/template/base.pyi | 0 {typings/django => django-stubs}/template/context.pyi | 0 .../django => django-stubs}/template/context_processors.pyi | 0 .../django => django-stubs}/template/defaultfilters.pyi | 0 {typings/django => django-stubs}/template/defaulttags.pyi | 0 {typings/django => django-stubs}/template/engine.pyi | 0 {typings/django => django-stubs}/template/exceptions.pyi | 0 {typings/django => django-stubs}/template/library.pyi | 0 {typings/django => django-stubs}/template/loader.pyi | 0 {typings/django => django-stubs}/template/loader_tags.pyi | 0 .../django => django-stubs}/template/loaders/__init__.pyi | 0 .../template/loaders/app_directories.pyi | 0 {typings/django => django-stubs}/template/loaders/base.pyi | 0 .../django => django-stubs}/template/loaders/cached.pyi | 0 .../django => django-stubs}/template/loaders/filesystem.pyi | 0 .../django => django-stubs}/template/loaders/locmem.pyi | 0 {typings/django => django-stubs}/template/response.pyi | 0 {typings/django => django-stubs}/template/smartif.pyi | 0 {typings/django => django-stubs}/template/utils.pyi | 0 {typings/django => django-stubs}/templatetags/__init__.pyi | 0 {typings/django => django-stubs}/templatetags/cache.pyi | 0 {typings/django => django-stubs}/templatetags/i18n.pyi | 0 {typings/django => django-stubs}/templatetags/l10n.pyi | 0 {typings/django => django-stubs}/templatetags/static.pyi | 0 {typings/django => django-stubs}/templatetags/tz.pyi | 0 {typings/django => django-stubs}/test/__init__.pyi | 0 {typings/django => django-stubs}/test/client.pyi | 0 {typings/django => django-stubs}/test/html.pyi | 0 {typings/django => django-stubs}/test/runner.pyi | 0 {typings/django => django-stubs}/test/selenium.pyi | 0 {typings/django => django-stubs}/test/signals.pyi | 0 {typings/django => django-stubs}/test/testcases.pyi | 0 {typings/django => django-stubs}/test/utils.pyi | 0 {typings/django => django-stubs}/urls/__init__.pyi | 0 {typings/django => django-stubs}/urls/base.pyi | 0 {typings/django => django-stubs}/urls/conf.pyi | 0 {typings/django => django-stubs}/urls/converters.pyi | 0 {typings/django => django-stubs}/urls/exceptions.pyi | 0 {typings/django => django-stubs}/urls/resolvers.pyi | 0 {typings/django => django-stubs}/urls/utils.pyi | 0 {typings/django => django-stubs}/utils/__init__.pyi | 0 {typings/django => django-stubs}/utils/_os.pyi | 0 {typings/django => django-stubs}/utils/archive.pyi | 0 {typings/django => django-stubs}/utils/asyncio.pyi | 0 {typings/django => django-stubs}/utils/autoreload.pyi | 0 {typings/django => django-stubs}/utils/baseconv.pyi | 0 {typings/django => django-stubs}/utils/cache.pyi | 0 {typings/django => django-stubs}/utils/crypto.pyi | 0 {typings/django => django-stubs}/utils/datastructures.pyi | 0 {typings/django => django-stubs}/utils/dateformat.pyi | 0 {typings/django => django-stubs}/utils/dateparse.pyi | 0 {typings/django => django-stubs}/utils/dates.pyi | 0 {typings/django => django-stubs}/utils/datetime_safe.pyi | 0 {typings/django => django-stubs}/utils/deconstruct.pyi | 0 {typings/django => django-stubs}/utils/decorators.pyi | 0 {typings/django => django-stubs}/utils/deprecation.pyi | 0 {typings/django => django-stubs}/utils/duration.pyi | 0 {typings/django => django-stubs}/utils/encoding.pyi | 0 {typings/django => django-stubs}/utils/feedgenerator.pyi | 0 {typings/django => django-stubs}/utils/formats.pyi | 0 {typings/django => django-stubs}/utils/functional.pyi | 0 {typings/django => django-stubs}/utils/hashable.pyi | 0 {typings/django => django-stubs}/utils/html.pyi | 0 {typings/django => django-stubs}/utils/http.pyi | 0 {typings/django => django-stubs}/utils/inspect.pyi | 0 {typings/django => django-stubs}/utils/ipv6.pyi | 0 {typings/django => django-stubs}/utils/itercompat.pyi | 0 {typings/django => django-stubs}/utils/jslex.pyi | 0 {typings/django => django-stubs}/utils/log.pyi | 0 {typings/django => django-stubs}/utils/lorem_ipsum.pyi | 0 {typings/django => django-stubs}/utils/module_loading.pyi | 0 {typings/django => django-stubs}/utils/numberformat.pyi | 0 {typings/django => django-stubs}/utils/regex_helper.pyi | 0 {typings/django => django-stubs}/utils/safestring.pyi | 0 {typings/django => django-stubs}/utils/six.pyi | 0 {typings/django => django-stubs}/utils/termcolors.pyi | 0 {typings/django => django-stubs}/utils/text.pyi | 0 {typings/django => django-stubs}/utils/timesince.pyi | 0 {typings/django => django-stubs}/utils/timezone.pyi | 0 {typings/django => django-stubs}/utils/topological_sort.pyi | 0 .../django => django-stubs}/utils/translation/__init__.pyi | 0 .../django => django-stubs}/utils/translation/reloader.pyi | 0 .../django => django-stubs}/utils/translation/template.pyi | 0 .../utils/translation/trans_null.pyi | 0 .../utils/translation/trans_real.pyi | 0 {typings/django => django-stubs}/utils/tree.pyi | 0 {typings/django => django-stubs}/utils/version.pyi | 0 {typings/django => django-stubs}/utils/xmlutils.pyi | 0 {typings/django => django-stubs}/views/__init__.pyi | 0 {typings/django => django-stubs}/views/csrf.pyi | 0 {typings/django => django-stubs}/views/debug.pyi | 0 .../django => django-stubs}/views/decorators/__init__.pyi | 0 {typings/django => django-stubs}/views/decorators/cache.pyi | 0 .../views/decorators/clickjacking.pyi | 0 {typings/django => django-stubs}/views/decorators/csrf.pyi | 0 {typings/django => django-stubs}/views/decorators/debug.pyi | 0 {typings/django => django-stubs}/views/decorators/gzip.pyi | 0 {typings/django => django-stubs}/views/decorators/http.pyi | 0 {typings/django => django-stubs}/views/decorators/vary.pyi | 0 {typings/django => django-stubs}/views/defaults.pyi | 0 {typings/django => django-stubs}/views/generic/__init__.pyi | 0 {typings/django => django-stubs}/views/generic/base.pyi | 0 {typings/django => django-stubs}/views/generic/dates.pyi | 0 {typings/django => django-stubs}/views/generic/detail.pyi | 0 {typings/django => django-stubs}/views/generic/edit.pyi | 0 {typings/django => django-stubs}/views/generic/list.pyi | 0 {typings/django => django-stubs}/views/i18n.pyi | 0 {typings/django => django-stubs}/views/static.pyi | 0 psycopg2-stubs | 1 - {typings/psycopg2 => psycopg2-stubs}/__init__.pyi | 0 {typings/psycopg2 => psycopg2-stubs}/_psycopg.pyi | 0 {typings/psycopg2 => psycopg2-stubs}/_range.pyi | 0 {typings/psycopg2 => psycopg2-stubs}/errors.pyi | 0 {typings/psycopg2 => psycopg2-stubs}/extensions.pyi | 0 {typings/psycopg2 => psycopg2-stubs}/extras.pyi | 0 {typings/psycopg2 => psycopg2-stubs}/sql.pyi | 0 {typings/psycopg2 => psycopg2-stubs}/tz.pyi | 0 s/build | 6 ++++++ typings/django | 1 + typings/psycopg2 | 1 + 686 files changed, 8 insertions(+), 2 deletions(-) delete mode 120000 django-stubs rename {typings/django => django-stubs}/__init__.pyi (100%) rename {typings/django => django-stubs}/apps/__init__.pyi (100%) rename {typings/django => django-stubs}/apps/config.pyi (100%) rename {typings/django => django-stubs}/apps/registry.pyi (100%) rename {typings/django => django-stubs}/conf/__init__.pyi (100%) rename {typings/django => django-stubs}/conf/global_settings.pyi (100%) rename {typings/django => django-stubs}/conf/locale/__init__.pyi (100%) rename {typings/django => django-stubs}/conf/urls/__init__.pyi (100%) rename {typings/django => django-stubs}/conf/urls/i18n.pyi (100%) rename {typings/django => django-stubs}/conf/urls/static.pyi (100%) rename {typings/django => django-stubs}/contrib/__init__.pyi (100%) rename {typings/django => django-stubs}/contrib/admin/__init__.pyi (100%) rename {typings/django => django-stubs}/contrib/admin/actions.pyi (100%) rename {typings/django => django-stubs}/contrib/admin/apps.pyi (100%) rename {typings/django => django-stubs}/contrib/admin/checks.pyi (100%) rename {typings/django => django-stubs}/contrib/admin/decorators.pyi (100%) rename {typings/django => django-stubs}/contrib/admin/exceptions.pyi (100%) rename {typings/django => django-stubs}/contrib/admin/filters.pyi (100%) rename {typings/django => django-stubs}/contrib/admin/forms.pyi (100%) rename {typings/django => django-stubs}/contrib/admin/helpers.pyi (100%) rename {typings/django => django-stubs}/contrib/admin/migrations/__init__.pyi (100%) rename {typings/django => django-stubs}/contrib/admin/models.pyi (100%) rename {typings/django => django-stubs}/contrib/admin/options.pyi (100%) rename {typings/django => django-stubs}/contrib/admin/sites.pyi (100%) rename {typings/django => django-stubs}/contrib/admin/templatetags/__init__.pyi (100%) rename {typings/django => django-stubs}/contrib/admin/templatetags/admin_list.pyi (100%) rename {typings/django => django-stubs}/contrib/admin/templatetags/admin_modify.pyi (100%) rename {typings/django => django-stubs}/contrib/admin/templatetags/admin_static.pyi (100%) rename {typings/django => django-stubs}/contrib/admin/templatetags/admin_urls.pyi (100%) rename {typings/django => django-stubs}/contrib/admin/templatetags/base.pyi (100%) rename {typings/django => django-stubs}/contrib/admin/templatetags/log.pyi (100%) rename {typings/django => django-stubs}/contrib/admin/tests.pyi (100%) rename {typings/django => django-stubs}/contrib/admin/utils.pyi (100%) rename {typings/django => django-stubs}/contrib/admin/views/__init__.pyi (100%) rename {typings/django => django-stubs}/contrib/admin/views/autocomplete.pyi (100%) rename {typings/django => django-stubs}/contrib/admin/views/decorators.pyi (100%) rename {typings/django => django-stubs}/contrib/admin/views/main.pyi (100%) rename {typings/django => django-stubs}/contrib/admin/widgets.pyi (100%) rename {typings/django => django-stubs}/contrib/admindocs/__init__.pyi (100%) rename {typings/django => django-stubs}/contrib/admindocs/apps.pyi (100%) rename {typings/django => django-stubs}/contrib/admindocs/middleware.pyi (100%) rename {typings/django => django-stubs}/contrib/admindocs/urls.pyi (100%) rename {typings/django => django-stubs}/contrib/admindocs/utils.pyi (100%) rename {typings/django => django-stubs}/contrib/admindocs/views.pyi (100%) rename {typings/django => django-stubs}/contrib/auth/__init__.pyi (100%) rename {typings/django => django-stubs}/contrib/auth/admin.pyi (100%) rename {typings/django => django-stubs}/contrib/auth/apps.pyi (100%) rename {typings/django => django-stubs}/contrib/auth/backends.pyi (100%) rename {typings/django => django-stubs}/contrib/auth/base_user.pyi (100%) rename {typings/django => django-stubs}/contrib/auth/checks.pyi (100%) rename {typings/django => django-stubs}/contrib/auth/context_processors.pyi (100%) rename {typings/django => django-stubs}/contrib/auth/decorators.pyi (100%) rename {typings/django => django-stubs}/contrib/auth/forms.pyi (100%) rename {typings/django => django-stubs}/contrib/auth/handlers/__init__.pyi (100%) rename {typings/django => django-stubs}/contrib/auth/handlers/modwsgi.pyi (100%) rename {typings/django => django-stubs}/contrib/auth/hashers.pyi (100%) rename {typings/django => django-stubs}/contrib/auth/management/__init__.pyi (100%) rename {typings/django => django-stubs}/contrib/auth/management/commands/__init__.pyi (100%) rename {typings/django => django-stubs}/contrib/auth/management/commands/changepassword.pyi (100%) rename {typings/django => django-stubs}/contrib/auth/management/commands/createsuperuser.pyi (100%) rename {typings/django => django-stubs}/contrib/auth/middleware.pyi (100%) rename {typings/django => django-stubs}/contrib/auth/migrations/__init__.pyi (100%) rename {typings/django => django-stubs}/contrib/auth/mixins.pyi (100%) rename {typings/django => django-stubs}/contrib/auth/models.pyi (100%) rename {typings/django => django-stubs}/contrib/auth/password_validation.pyi (100%) rename {typings/django => django-stubs}/contrib/auth/signals.pyi (100%) rename {typings/django => django-stubs}/contrib/auth/tokens.pyi (100%) rename {typings/django => django-stubs}/contrib/auth/urls.pyi (100%) rename {typings/django => django-stubs}/contrib/auth/validators.pyi (100%) rename {typings/django => django-stubs}/contrib/auth/views.pyi (100%) rename {typings/django => django-stubs}/contrib/contenttypes/__init__.pyi (100%) rename {typings/django => django-stubs}/contrib/contenttypes/admin.pyi (100%) rename {typings/django => django-stubs}/contrib/contenttypes/apps.pyi (100%) rename {typings/django => django-stubs}/contrib/contenttypes/checks.pyi (100%) rename {typings/django => django-stubs}/contrib/contenttypes/fields.pyi (100%) rename {typings/django => django-stubs}/contrib/contenttypes/forms.pyi (100%) rename {typings/django => django-stubs}/contrib/contenttypes/management/__init__.pyi (100%) rename {typings/django => django-stubs}/contrib/contenttypes/management/commands/__init__.pyi (100%) rename {typings/django => django-stubs}/contrib/contenttypes/management/commands/remove_stale_contenttypes.pyi (100%) rename {typings/django => django-stubs}/contrib/contenttypes/migrations/__init__.pyi (100%) rename {typings/django => django-stubs}/contrib/contenttypes/models.pyi (100%) rename {typings/django => django-stubs}/contrib/contenttypes/views.pyi (100%) rename {typings/django => django-stubs}/contrib/flatpages/__init__.pyi (100%) rename {typings/django => django-stubs}/contrib/flatpages/admin.pyi (100%) rename {typings/django => django-stubs}/contrib/flatpages/apps.pyi (100%) rename {typings/django => django-stubs}/contrib/flatpages/forms.pyi (100%) rename {typings/django => django-stubs}/contrib/flatpages/middleware.pyi (100%) rename {typings/django => django-stubs}/contrib/flatpages/migrations/__init__.pyi (100%) rename {typings/django => django-stubs}/contrib/flatpages/models.pyi (100%) rename {typings/django => django-stubs}/contrib/flatpages/sitemaps.pyi (100%) rename {typings/django => django-stubs}/contrib/flatpages/templatetags/__init__.pyi (100%) rename {typings/django => django-stubs}/contrib/flatpages/templatetags/flatpages.pyi (100%) rename {typings/django => django-stubs}/contrib/flatpages/urls.pyi (100%) rename {typings/django => django-stubs}/contrib/flatpages/views.pyi (100%) rename {typings/django => django-stubs}/contrib/gis/__init__.pyi (100%) rename {typings/django => django-stubs}/contrib/gis/admin/__init__.pyi (100%) rename {typings/django => django-stubs}/contrib/gis/admin/options.pyi (100%) rename {typings/django => django-stubs}/contrib/gis/admin/widgets.pyi (100%) rename {typings/django => django-stubs}/contrib/gis/apps.pyi (100%) rename {typings/django => django-stubs}/contrib/gis/db/__init__.pyi (100%) rename {typings/django => django-stubs}/contrib/gis/db/backends/__init__.pyi (100%) rename {typings/django => django-stubs}/contrib/gis/db/backends/base/__init__.pyi (100%) rename {typings/django => django-stubs}/contrib/gis/db/backends/base/adapter.pyi (100%) rename {typings/django => django-stubs}/contrib/gis/db/backends/base/features.pyi (100%) rename {typings/django => django-stubs}/contrib/gis/db/backends/base/models.pyi (100%) rename {typings/django => django-stubs}/contrib/gis/db/backends/base/operations.pyi (100%) rename {typings/django => django-stubs}/contrib/gis/db/backends/mysql/__init__.pyi (100%) rename {typings/django => django-stubs}/contrib/gis/db/backends/mysql/base.pyi (100%) rename {typings/django => django-stubs}/contrib/gis/db/backends/mysql/features.pyi (100%) rename {typings/django => django-stubs}/contrib/gis/db/backends/mysql/introspection.pyi (100%) rename {typings/django => django-stubs}/contrib/gis/db/backends/mysql/operations.pyi (100%) rename {typings/django => django-stubs}/contrib/gis/db/backends/mysql/schema.pyi (100%) rename {typings/django => django-stubs}/contrib/gis/db/backends/oracle/__init__.pyi (100%) rename {typings/django => django-stubs}/contrib/gis/db/backends/oracle/adapter.pyi (100%) rename {typings/django => django-stubs}/contrib/gis/db/backends/oracle/base.pyi (100%) rename {typings/django => django-stubs}/contrib/gis/db/backends/oracle/features.pyi (100%) rename {typings/django => django-stubs}/contrib/gis/db/backends/oracle/introspection.pyi (100%) rename {typings/django => django-stubs}/contrib/gis/db/backends/oracle/models.pyi (100%) rename {typings/django => django-stubs}/contrib/gis/db/backends/oracle/operations.pyi (100%) rename {typings/django => django-stubs}/contrib/gis/db/backends/oracle/schema.pyi (100%) rename {typings/django => django-stubs}/contrib/gis/db/backends/postgis/__init__.pyi (100%) rename {typings/django => django-stubs}/contrib/gis/db/backends/postgis/adapter.pyi (100%) rename {typings/django => django-stubs}/contrib/gis/db/backends/postgis/base.pyi (100%) rename {typings/django => django-stubs}/contrib/gis/db/backends/postgis/const.pyi (100%) rename {typings/django => django-stubs}/contrib/gis/db/backends/postgis/features.pyi (100%) rename {typings/django => django-stubs}/contrib/gis/db/backends/postgis/introspection.pyi (100%) rename {typings/django => django-stubs}/contrib/gis/db/backends/postgis/models.pyi (100%) rename {typings/django => django-stubs}/contrib/gis/db/backends/postgis/operations.pyi (100%) rename {typings/django => django-stubs}/contrib/gis/db/backends/postgis/pgraster.pyi (100%) rename {typings/django => django-stubs}/contrib/gis/db/backends/postgis/schema.pyi (100%) rename {typings/django => django-stubs}/contrib/gis/db/backends/spatialite/__init__.pyi (100%) rename {typings/django => django-stubs}/contrib/gis/db/backends/spatialite/adapter.pyi (100%) rename {typings/django => django-stubs}/contrib/gis/db/backends/spatialite/base.pyi (100%) rename {typings/django => django-stubs}/contrib/gis/db/backends/spatialite/client.pyi (100%) rename {typings/django => django-stubs}/contrib/gis/db/backends/spatialite/features.pyi (100%) rename {typings/django => django-stubs}/contrib/gis/db/backends/spatialite/introspection.pyi (100%) rename {typings/django => django-stubs}/contrib/gis/db/backends/spatialite/models.pyi (100%) rename {typings/django => django-stubs}/contrib/gis/db/backends/spatialite/operations.pyi (100%) rename {typings/django => django-stubs}/contrib/gis/db/backends/spatialite/schema.pyi (100%) rename {typings/django => django-stubs}/contrib/gis/db/backends/utils.pyi (100%) rename {typings/django => django-stubs}/contrib/gis/db/models/__init__.pyi (100%) rename {typings/django => django-stubs}/contrib/gis/db/models/aggregates.pyi (100%) rename {typings/django => django-stubs}/contrib/gis/db/models/fields.pyi (100%) rename {typings/django => django-stubs}/contrib/gis/db/models/functions.pyi (100%) rename {typings/django => django-stubs}/contrib/gis/db/models/lookups.pyi (100%) rename {typings/django => django-stubs}/contrib/gis/db/models/proxy.pyi (100%) rename {typings/django => django-stubs}/contrib/gis/db/models/sql/__init__.pyi (100%) rename {typings/django => django-stubs}/contrib/gis/db/models/sql/conversion.pyi (100%) rename {typings/django => django-stubs}/contrib/gis/feeds.pyi (100%) rename {typings/django => django-stubs}/contrib/gis/forms/__init__.pyi (100%) rename {typings/django => django-stubs}/contrib/gis/forms/fields.pyi (100%) rename {typings/django => django-stubs}/contrib/gis/forms/widgets.pyi (100%) rename {typings/django => django-stubs}/contrib/gis/gdal/__init__.pyi (100%) rename {typings/django => django-stubs}/contrib/gis/gdal/base.pyi (100%) rename {typings/django => django-stubs}/contrib/gis/gdal/datasource.pyi (100%) rename {typings/django => django-stubs}/contrib/gis/gdal/driver.pyi (100%) rename {typings/django => django-stubs}/contrib/gis/gdal/envelope.pyi (100%) rename {typings/django => django-stubs}/contrib/gis/gdal/error.pyi (100%) rename {typings/django => django-stubs}/contrib/gis/gdal/feature.pyi (100%) rename {typings/django => django-stubs}/contrib/gis/gdal/field.pyi (100%) rename {typings/django => django-stubs}/contrib/gis/gdal/geometries.pyi (100%) rename {typings/django => django-stubs}/contrib/gis/gdal/geomtype.pyi (100%) rename {typings/django => django-stubs}/contrib/gis/gdal/layer.pyi (100%) rename {typings/django => django-stubs}/contrib/gis/gdal/libgdal.pyi (100%) rename {typings/django => django-stubs}/contrib/gis/gdal/prototypes/__init__.pyi (100%) rename {typings/django => django-stubs}/contrib/gis/gdal/prototypes/ds.pyi (100%) rename {typings/django => django-stubs}/contrib/gis/gdal/prototypes/errcheck.pyi (100%) rename {typings/django => django-stubs}/contrib/gis/gdal/prototypes/generation.pyi (100%) rename {typings/django => django-stubs}/contrib/gis/gdal/prototypes/geom.pyi (100%) rename {typings/django => django-stubs}/contrib/gis/gdal/prototypes/raster.pyi (100%) rename {typings/django => django-stubs}/contrib/gis/gdal/prototypes/srs.pyi (100%) rename {typings/django => django-stubs}/contrib/gis/gdal/raster/__init__.pyi (100%) rename {typings/django => django-stubs}/contrib/gis/gdal/raster/band.pyi (100%) rename {typings/django => django-stubs}/contrib/gis/gdal/raster/base.pyi (100%) rename {typings/django => django-stubs}/contrib/gis/gdal/raster/const.pyi (100%) rename {typings/django => django-stubs}/contrib/gis/gdal/raster/source.pyi (100%) rename {typings/django => django-stubs}/contrib/gis/gdal/srs.pyi (100%) rename {typings/django => django-stubs}/contrib/gis/geoip2/__init__.pyi (100%) rename {typings/django => django-stubs}/contrib/gis/geoip2/base.pyi (100%) rename {typings/django => django-stubs}/contrib/gis/geoip2/resources.pyi (100%) rename {typings/django => django-stubs}/contrib/gis/geometry.pyi (100%) rename {typings/django => django-stubs}/contrib/gis/geos/__init__.pyi (100%) rename {typings/django => django-stubs}/contrib/gis/geos/base.pyi (100%) rename {typings/django => django-stubs}/contrib/gis/geos/collections.pyi (100%) rename {typings/django => django-stubs}/contrib/gis/geos/coordseq.pyi (100%) rename {typings/django => django-stubs}/contrib/gis/geos/error.pyi (100%) rename {typings/django => django-stubs}/contrib/gis/geos/factory.pyi (100%) rename {typings/django => django-stubs}/contrib/gis/geos/geometry.pyi (100%) rename {typings/django => django-stubs}/contrib/gis/geos/io.pyi (100%) rename {typings/django => django-stubs}/contrib/gis/geos/libgeos.pyi (100%) rename {typings/django => django-stubs}/contrib/gis/geos/linestring.pyi (100%) rename {typings/django => django-stubs}/contrib/gis/geos/mutable_list.pyi (100%) rename {typings/django => django-stubs}/contrib/gis/geos/point.pyi (100%) rename {typings/django => django-stubs}/contrib/gis/geos/polygon.pyi (100%) rename {typings/django => django-stubs}/contrib/gis/geos/prepared.pyi (100%) rename {typings/django => django-stubs}/contrib/gis/geos/prototypes/__init__.pyi (100%) rename {typings/django => django-stubs}/contrib/gis/geos/prototypes/coordseq.pyi (100%) rename {typings/django => django-stubs}/contrib/gis/geos/prototypes/errcheck.pyi (100%) rename {typings/django => django-stubs}/contrib/gis/geos/prototypes/geom.pyi (100%) rename {typings/django => django-stubs}/contrib/gis/geos/prototypes/io.pyi (100%) rename {typings/django => django-stubs}/contrib/gis/geos/prototypes/misc.pyi (100%) rename {typings/django => django-stubs}/contrib/gis/geos/prototypes/predicates.pyi (100%) rename {typings/django => django-stubs}/contrib/gis/geos/prototypes/prepared.pyi (100%) rename {typings/django => django-stubs}/contrib/gis/geos/prototypes/threadsafe.pyi (100%) rename {typings/django => django-stubs}/contrib/gis/geos/prototypes/topology.pyi (100%) rename {typings/django => django-stubs}/contrib/gis/measure.pyi (100%) rename {typings/django => django-stubs}/contrib/gis/ptr.pyi (100%) rename {typings/django => django-stubs}/contrib/gis/serializers/__init__.pyi (100%) rename {typings/django => django-stubs}/contrib/gis/serializers/geojson.pyi (100%) rename {typings/django => django-stubs}/contrib/gis/shortcuts.pyi (100%) rename {typings/django => django-stubs}/contrib/gis/sitemaps/__init__.pyi (100%) rename {typings/django => django-stubs}/contrib/gis/sitemaps/kml.pyi (100%) rename {typings/django => django-stubs}/contrib/gis/sitemaps/views.pyi (100%) rename {typings/django => django-stubs}/contrib/gis/utils/__init__.pyi (100%) rename {typings/django => django-stubs}/contrib/gis/utils/layermapping.pyi (100%) rename {typings/django => django-stubs}/contrib/gis/utils/ogrinfo.pyi (100%) rename {typings/django => django-stubs}/contrib/gis/utils/ogrinspect.pyi (100%) rename {typings/django => django-stubs}/contrib/gis/utils/srs.pyi (100%) rename {typings/django => django-stubs}/contrib/gis/views.pyi (100%) rename {typings/django => django-stubs}/contrib/humanize/__init__.pyi (100%) rename {typings/django => django-stubs}/contrib/humanize/apps.pyi (100%) rename {typings/django => django-stubs}/contrib/humanize/templatetags/__init__.pyi (100%) rename {typings/django => django-stubs}/contrib/humanize/templatetags/humanize.pyi (100%) rename {typings/django => django-stubs}/contrib/messages/__init__.pyi (100%) rename {typings/django => django-stubs}/contrib/messages/api.pyi (100%) rename {typings/django => django-stubs}/contrib/messages/apps.pyi (100%) rename {typings/django => django-stubs}/contrib/messages/constants.pyi (100%) rename {typings/django => django-stubs}/contrib/messages/context_processors.pyi (100%) rename {typings/django => django-stubs}/contrib/messages/middleware.pyi (100%) rename {typings/django => django-stubs}/contrib/messages/storage/__init__.pyi (100%) rename {typings/django => django-stubs}/contrib/messages/storage/base.pyi (100%) rename {typings/django => django-stubs}/contrib/messages/storage/cookie.pyi (100%) rename {typings/django => django-stubs}/contrib/messages/storage/fallback.pyi (100%) rename {typings/django => django-stubs}/contrib/messages/storage/session.pyi (100%) rename {typings/django => django-stubs}/contrib/messages/utils.pyi (100%) rename {typings/django => django-stubs}/contrib/messages/views.pyi (100%) rename {typings/django => django-stubs}/contrib/postgres/__init__.pyi (100%) rename {typings/django => django-stubs}/contrib/postgres/aggregates/__init__.pyi (100%) rename {typings/django => django-stubs}/contrib/postgres/aggregates/general.pyi (100%) rename {typings/django => django-stubs}/contrib/postgres/aggregates/mixins.pyi (100%) rename {typings/django => django-stubs}/contrib/postgres/aggregates/statistics.pyi (100%) rename {typings/django => django-stubs}/contrib/postgres/apps.pyi (100%) rename {typings/django => django-stubs}/contrib/postgres/constraints.pyi (100%) rename {typings/django => django-stubs}/contrib/postgres/fields/__init__.pyi (100%) rename {typings/django => django-stubs}/contrib/postgres/fields/array.pyi (100%) rename {typings/django => django-stubs}/contrib/postgres/fields/citext.pyi (100%) rename {typings/django => django-stubs}/contrib/postgres/fields/hstore.pyi (100%) rename {typings/django => django-stubs}/contrib/postgres/fields/jsonb.pyi (100%) rename {typings/django => django-stubs}/contrib/postgres/fields/mixins.pyi (100%) rename {typings/django => django-stubs}/contrib/postgres/fields/ranges.pyi (100%) rename {typings/django => django-stubs}/contrib/postgres/fields/utils.pyi (100%) rename {typings/django => django-stubs}/contrib/postgres/functions.pyi (100%) rename {typings/django => django-stubs}/contrib/postgres/indexes.pyi (100%) rename {typings/django => django-stubs}/contrib/postgres/lookups.pyi (100%) rename {typings/django => django-stubs}/contrib/postgres/operations.pyi (100%) rename {typings/django => django-stubs}/contrib/postgres/search.pyi (100%) rename {typings/django => django-stubs}/contrib/postgres/serializers.pyi (100%) rename {typings/django => django-stubs}/contrib/postgres/signals.pyi (100%) rename {typings/django => django-stubs}/contrib/postgres/utils.pyi (100%) rename {typings/django => django-stubs}/contrib/postgres/validators.pyi (100%) rename {typings/django => django-stubs}/contrib/redirects/__init__.pyi (100%) rename {typings/django => django-stubs}/contrib/redirects/admin.pyi (100%) rename {typings/django => django-stubs}/contrib/redirects/apps.pyi (100%) rename {typings/django => django-stubs}/contrib/redirects/middleware.pyi (100%) rename {typings/django => django-stubs}/contrib/redirects/migrations/__init__.pyi (100%) rename {typings/django => django-stubs}/contrib/redirects/models.pyi (100%) rename {typings/django => django-stubs}/contrib/sessions/__init__.pyi (100%) rename {typings/django => django-stubs}/contrib/sessions/apps.pyi (100%) rename {typings/django => django-stubs}/contrib/sessions/backends/__init__.pyi (100%) rename {typings/django => django-stubs}/contrib/sessions/backends/base.pyi (100%) rename {typings/django => django-stubs}/contrib/sessions/backends/cache.pyi (100%) rename {typings/django => django-stubs}/contrib/sessions/backends/cached_db.pyi (100%) rename {typings/django => django-stubs}/contrib/sessions/backends/db.pyi (100%) rename {typings/django => django-stubs}/contrib/sessions/backends/file.pyi (100%) rename {typings/django => django-stubs}/contrib/sessions/backends/signed_cookies.pyi (100%) rename {typings/django => django-stubs}/contrib/sessions/base_session.pyi (100%) rename {typings/django => django-stubs}/contrib/sessions/exceptions.pyi (100%) rename {typings/django => django-stubs}/contrib/sessions/management/__init__.pyi (100%) rename {typings/django => django-stubs}/contrib/sessions/management/commands/__init__.pyi (100%) rename {typings/django => django-stubs}/contrib/sessions/management/commands/clearsessions.pyi (100%) rename {typings/django => django-stubs}/contrib/sessions/middleware.pyi (100%) rename {typings/django => django-stubs}/contrib/sessions/migrations/__init__.pyi (100%) rename {typings/django => django-stubs}/contrib/sessions/models.pyi (100%) rename {typings/django => django-stubs}/contrib/sessions/serializers.pyi (100%) rename {typings/django => django-stubs}/contrib/sitemaps/__init__.pyi (100%) rename {typings/django => django-stubs}/contrib/sitemaps/apps.pyi (100%) rename {typings/django => django-stubs}/contrib/sitemaps/management/__init__.pyi (100%) rename {typings/django => django-stubs}/contrib/sitemaps/management/commands/__init__.pyi (100%) rename {typings/django => django-stubs}/contrib/sitemaps/management/commands/ping_google.pyi (100%) rename {typings/django => django-stubs}/contrib/sitemaps/views.pyi (100%) rename {typings/django => django-stubs}/contrib/sites/__init__.pyi (100%) rename {typings/django => django-stubs}/contrib/sites/admin.pyi (100%) rename {typings/django => django-stubs}/contrib/sites/apps.pyi (100%) rename {typings/django => django-stubs}/contrib/sites/management.pyi (100%) rename {typings/django => django-stubs}/contrib/sites/managers.pyi (100%) rename {typings/django => django-stubs}/contrib/sites/middleware.pyi (100%) rename {typings/django => django-stubs}/contrib/sites/migrations/__init__.pyi (100%) rename {typings/django => django-stubs}/contrib/sites/models.pyi (100%) rename {typings/django => django-stubs}/contrib/sites/requests.pyi (100%) rename {typings/django => django-stubs}/contrib/sites/shortcuts.pyi (100%) rename {typings/django => django-stubs}/contrib/staticfiles/__init__.pyi (100%) rename {typings/django => django-stubs}/contrib/staticfiles/apps.pyi (100%) rename {typings/django => django-stubs}/contrib/staticfiles/checks.pyi (100%) rename {typings/django => django-stubs}/contrib/staticfiles/finders.pyi (100%) rename {typings/django => django-stubs}/contrib/staticfiles/handlers.pyi (100%) rename {typings/django => django-stubs}/contrib/staticfiles/management/__init__.pyi (100%) rename {typings/django => django-stubs}/contrib/staticfiles/management/commands/__init__.pyi (100%) rename {typings/django => django-stubs}/contrib/staticfiles/management/commands/collectstatic.pyi (100%) rename {typings/django => django-stubs}/contrib/staticfiles/management/commands/findstatic.pyi (100%) rename {typings/django => django-stubs}/contrib/staticfiles/management/commands/runserver.pyi (100%) rename {typings/django => django-stubs}/contrib/staticfiles/storage.pyi (100%) rename {typings/django => django-stubs}/contrib/staticfiles/templatetags/__init__.pyi (100%) rename {typings/django => django-stubs}/contrib/staticfiles/templatetags/staticfiles.pyi (100%) rename {typings/django => django-stubs}/contrib/staticfiles/testing.pyi (100%) rename {typings/django => django-stubs}/contrib/staticfiles/urls.pyi (100%) rename {typings/django => django-stubs}/contrib/staticfiles/utils.pyi (100%) rename {typings/django => django-stubs}/contrib/staticfiles/views.pyi (100%) rename {typings/django => django-stubs}/contrib/syndication/__init__.pyi (100%) rename {typings/django => django-stubs}/contrib/syndication/apps.pyi (100%) rename {typings/django => django-stubs}/contrib/syndication/views.pyi (100%) rename {typings/django => django-stubs}/core/__init__.pyi (100%) rename {typings/django => django-stubs}/core/asgi.pyi (100%) rename {typings/django => django-stubs}/core/cache/__init__.pyi (100%) rename {typings/django => django-stubs}/core/cache/backends/__init__.pyi (100%) rename {typings/django => django-stubs}/core/cache/backends/base.pyi (100%) rename {typings/django => django-stubs}/core/cache/backends/db.pyi (100%) rename {typings/django => django-stubs}/core/cache/backends/dummy.pyi (100%) rename {typings/django => django-stubs}/core/cache/backends/filebased.pyi (100%) rename {typings/django => django-stubs}/core/cache/backends/locmem.pyi (100%) rename {typings/django => django-stubs}/core/cache/backends/memcached.pyi (100%) rename {typings/django => django-stubs}/core/cache/utils.pyi (100%) rename {typings/django => django-stubs}/core/checks/__init__.pyi (100%) rename {typings/django => django-stubs}/core/checks/async_checks.pyi (100%) rename {typings/django => django-stubs}/core/checks/caches.pyi (100%) rename {typings/django => django-stubs}/core/checks/compatibility/__init__.pyi (100%) rename {typings/django => django-stubs}/core/checks/database.pyi (100%) rename {typings/django => django-stubs}/core/checks/messages.pyi (100%) rename {typings/django => django-stubs}/core/checks/model_checks.pyi (100%) rename {typings/django => django-stubs}/core/checks/registry.pyi (100%) rename {typings/django => django-stubs}/core/checks/security/__init__.pyi (100%) rename {typings/django => django-stubs}/core/checks/security/base.pyi (100%) rename {typings/django => django-stubs}/core/checks/security/csrf.pyi (100%) rename {typings/django => django-stubs}/core/checks/security/sessions.pyi (100%) rename {typings/django => django-stubs}/core/checks/templates.pyi (100%) rename {typings/django => django-stubs}/core/checks/translation.pyi (100%) rename {typings/django => django-stubs}/core/checks/urls.pyi (100%) rename {typings/django => django-stubs}/core/exceptions.pyi (100%) rename {typings/django => django-stubs}/core/files/__init__.pyi (100%) rename {typings/django => django-stubs}/core/files/base.pyi (100%) rename {typings/django => django-stubs}/core/files/images.pyi (100%) rename {typings/django => django-stubs}/core/files/locks.pyi (100%) rename {typings/django => django-stubs}/core/files/move.pyi (100%) rename {typings/django => django-stubs}/core/files/storage.pyi (100%) rename {typings/django => django-stubs}/core/files/temp.pyi (100%) rename {typings/django => django-stubs}/core/files/uploadedfile.pyi (100%) rename {typings/django => django-stubs}/core/files/uploadhandler.pyi (100%) rename {typings/django => django-stubs}/core/files/utils.pyi (100%) rename {typings/django => django-stubs}/core/handlers/__init__.pyi (100%) rename {typings/django => django-stubs}/core/handlers/asgi.pyi (100%) rename {typings/django => django-stubs}/core/handlers/base.pyi (100%) rename {typings/django => django-stubs}/core/handlers/exception.pyi (100%) rename {typings/django => django-stubs}/core/handlers/wsgi.pyi (100%) rename {typings/django => django-stubs}/core/mail/__init__.pyi (100%) rename {typings/django => django-stubs}/core/mail/backends/__init__.pyi (100%) rename {typings/django => django-stubs}/core/mail/backends/base.pyi (100%) rename {typings/django => django-stubs}/core/mail/backends/console.pyi (100%) rename {typings/django => django-stubs}/core/mail/backends/dummy.pyi (100%) rename {typings/django => django-stubs}/core/mail/backends/filebased.pyi (100%) rename {typings/django => django-stubs}/core/mail/backends/locmem.pyi (100%) rename {typings/django => django-stubs}/core/mail/backends/smtp.pyi (100%) rename {typings/django => django-stubs}/core/mail/message.pyi (100%) rename {typings/django => django-stubs}/core/mail/utils.pyi (100%) rename {typings/django => django-stubs}/core/management/__init__.pyi (100%) rename {typings/django => django-stubs}/core/management/base.pyi (100%) rename {typings/django => django-stubs}/core/management/color.pyi (100%) rename {typings/django => django-stubs}/core/management/commands/__init__.pyi (100%) rename {typings/django => django-stubs}/core/management/commands/check.pyi (100%) rename {typings/django => django-stubs}/core/management/commands/compilemessages.pyi (100%) rename {typings/django => django-stubs}/core/management/commands/createcachetable.pyi (100%) rename {typings/django => django-stubs}/core/management/commands/dbshell.pyi (100%) rename {typings/django => django-stubs}/core/management/commands/diffsettings.pyi (100%) rename {typings/django => django-stubs}/core/management/commands/dumpdata.pyi (100%) rename {typings/django => django-stubs}/core/management/commands/flush.pyi (100%) rename {typings/django => django-stubs}/core/management/commands/inspectdb.pyi (100%) rename {typings/django => django-stubs}/core/management/commands/loaddata.pyi (100%) rename {typings/django => django-stubs}/core/management/commands/makemessages.pyi (100%) rename {typings/django => django-stubs}/core/management/commands/makemigrations.pyi (100%) rename {typings/django => django-stubs}/core/management/commands/migrate.pyi (100%) rename {typings/django => django-stubs}/core/management/commands/runserver.pyi (100%) rename {typings/django => django-stubs}/core/management/commands/sendtestemail.pyi (100%) rename {typings/django => django-stubs}/core/management/commands/shell.pyi (100%) rename {typings/django => django-stubs}/core/management/commands/showmigrations.pyi (100%) rename {typings/django => django-stubs}/core/management/commands/sqlflush.pyi (100%) rename {typings/django => django-stubs}/core/management/commands/sqlmigrate.pyi (100%) rename {typings/django => django-stubs}/core/management/commands/sqlsequencereset.pyi (100%) rename {typings/django => django-stubs}/core/management/commands/squashmigrations.pyi (100%) rename {typings/django => django-stubs}/core/management/commands/startapp.pyi (100%) rename {typings/django => django-stubs}/core/management/commands/startproject.pyi (100%) rename {typings/django => django-stubs}/core/management/commands/test.pyi (100%) rename {typings/django => django-stubs}/core/management/commands/testserver.pyi (100%) rename {typings/django => django-stubs}/core/management/sql.pyi (100%) rename {typings/django => django-stubs}/core/management/templates.pyi (100%) rename {typings/django => django-stubs}/core/management/utils.pyi (100%) rename {typings/django => django-stubs}/core/paginator.pyi (100%) rename {typings/django => django-stubs}/core/serializers/__init__.pyi (100%) rename {typings/django => django-stubs}/core/serializers/base.pyi (100%) rename {typings/django => django-stubs}/core/serializers/json.pyi (100%) rename {typings/django => django-stubs}/core/serializers/python.pyi (100%) rename {typings/django => django-stubs}/core/serializers/pyyaml.pyi (100%) rename {typings/django => django-stubs}/core/serializers/xml_serializer.pyi (100%) rename {typings/django => django-stubs}/core/servers/__init__.pyi (100%) rename {typings/django => django-stubs}/core/servers/basehttp.pyi (100%) rename {typings/django => django-stubs}/core/signals.pyi (100%) rename {typings/django => django-stubs}/core/signing.pyi (100%) rename {typings/django => django-stubs}/core/validators.pyi (100%) rename {typings/django => django-stubs}/core/wsgi.pyi (100%) rename {typings/django => django-stubs}/db/__init__.pyi (100%) rename {typings/django => django-stubs}/db/backends/__init__.pyi (100%) rename {typings/django => django-stubs}/db/backends/base/__init__.pyi (100%) rename {typings/django => django-stubs}/db/backends/base/base.pyi (100%) rename {typings/django => django-stubs}/db/backends/base/client.pyi (100%) rename {typings/django => django-stubs}/db/backends/base/creation.pyi (100%) rename {typings/django => django-stubs}/db/backends/base/features.pyi (100%) rename {typings/django => django-stubs}/db/backends/base/introspection.pyi (100%) rename {typings/django => django-stubs}/db/backends/base/operations.pyi (100%) rename {typings/django => django-stubs}/db/backends/base/schema.pyi (100%) rename {typings/django => django-stubs}/db/backends/base/validation.pyi (100%) rename {typings/django => django-stubs}/db/backends/ddl_references.pyi (100%) rename {typings/django => django-stubs}/db/backends/dummy/__init__.pyi (100%) rename {typings/django => django-stubs}/db/backends/dummy/base.pyi (100%) rename {typings/django => django-stubs}/db/backends/dummy/features.pyi (100%) rename {typings/django => django-stubs}/db/backends/mysql/__init__.pyi (100%) rename {typings/django => django-stubs}/db/backends/mysql/base.pyi (100%) rename {typings/django => django-stubs}/db/backends/mysql/client.pyi (100%) rename {typings/django => django-stubs}/db/backends/mysql/compiler.pyi (100%) rename {typings/django => django-stubs}/db/backends/mysql/creation.pyi (100%) rename {typings/django => django-stubs}/db/backends/mysql/features.pyi (100%) rename {typings/django => django-stubs}/db/backends/mysql/introspection.pyi (100%) rename {typings/django => django-stubs}/db/backends/mysql/operations.pyi (100%) rename {typings/django => django-stubs}/db/backends/mysql/schema.pyi (100%) rename {typings/django => django-stubs}/db/backends/mysql/validation.pyi (100%) rename {typings/django => django-stubs}/db/backends/oracle/__init__.pyi (100%) rename {typings/django => django-stubs}/db/backends/oracle/base.pyi (100%) rename {typings/django => django-stubs}/db/backends/oracle/client.pyi (100%) rename {typings/django => django-stubs}/db/backends/oracle/creation.pyi (100%) rename {typings/django => django-stubs}/db/backends/oracle/features.pyi (100%) rename {typings/django => django-stubs}/db/backends/oracle/functions.pyi (100%) rename {typings/django => django-stubs}/db/backends/oracle/introspection.pyi (100%) rename {typings/django => django-stubs}/db/backends/oracle/operations.pyi (100%) rename {typings/django => django-stubs}/db/backends/oracle/schema.pyi (100%) rename {typings/django => django-stubs}/db/backends/oracle/utils.pyi (100%) rename {typings/django => django-stubs}/db/backends/oracle/validation.pyi (100%) rename {typings/django => django-stubs}/db/backends/postgresql/__init__.pyi (100%) rename {typings/django => django-stubs}/db/backends/postgresql/base.pyi (100%) rename {typings/django => django-stubs}/db/backends/postgresql/client.pyi (100%) rename {typings/django => django-stubs}/db/backends/postgresql/creation.pyi (100%) rename {typings/django => django-stubs}/db/backends/postgresql/features.pyi (100%) rename {typings/django => django-stubs}/db/backends/postgresql/introspection.pyi (100%) rename {typings/django => django-stubs}/db/backends/postgresql/operations.pyi (100%) rename {typings/django => django-stubs}/db/backends/postgresql/schema.pyi (100%) rename {typings/django => django-stubs}/db/backends/signals.pyi (100%) rename {typings/django => django-stubs}/db/backends/sqlite3/__init__.pyi (100%) rename {typings/django => django-stubs}/db/backends/sqlite3/base.pyi (100%) rename {typings/django => django-stubs}/db/backends/sqlite3/client.pyi (100%) rename {typings/django => django-stubs}/db/backends/sqlite3/creation.pyi (100%) rename {typings/django => django-stubs}/db/backends/sqlite3/features.pyi (100%) rename {typings/django => django-stubs}/db/backends/sqlite3/introspection.pyi (100%) rename {typings/django => django-stubs}/db/backends/sqlite3/operations.pyi (100%) rename {typings/django => django-stubs}/db/backends/sqlite3/schema.pyi (100%) rename {typings/django => django-stubs}/db/backends/utils.pyi (100%) rename {typings/django => django-stubs}/db/migrations/__init__.pyi (100%) rename {typings/django => django-stubs}/db/migrations/autodetector.pyi (100%) rename {typings/django => django-stubs}/db/migrations/exceptions.pyi (100%) rename {typings/django => django-stubs}/db/migrations/executor.pyi (100%) rename {typings/django => django-stubs}/db/migrations/graph.pyi (100%) rename {typings/django => django-stubs}/db/migrations/loader.pyi (100%) rename {typings/django => django-stubs}/db/migrations/migration.pyi (100%) rename {typings/django => django-stubs}/db/migrations/operations/__init__.pyi (100%) rename {typings/django => django-stubs}/db/migrations/operations/base.pyi (100%) rename {typings/django => django-stubs}/db/migrations/operations/fields.pyi (100%) rename {typings/django => django-stubs}/db/migrations/operations/models.pyi (100%) rename {typings/django => django-stubs}/db/migrations/operations/special.pyi (100%) rename {typings/django => django-stubs}/db/migrations/operations/utils.pyi (100%) rename {typings/django => django-stubs}/db/migrations/optimizer.pyi (100%) rename {typings/django => django-stubs}/db/migrations/questioner.pyi (100%) rename {typings/django => django-stubs}/db/migrations/recorder.pyi (100%) rename {typings/django => django-stubs}/db/migrations/serializer.pyi (100%) rename {typings/django => django-stubs}/db/migrations/state.pyi (100%) rename {typings/django => django-stubs}/db/migrations/topological_sort.pyi (100%) rename {typings/django => django-stubs}/db/migrations/utils.pyi (100%) rename {typings/django => django-stubs}/db/migrations/writer.pyi (100%) rename {typings/django => django-stubs}/db/models/__init__.pyi (100%) rename {typings/django => django-stubs}/db/models/aggregates.pyi (100%) rename {typings/django => django-stubs}/db/models/base.pyi (100%) rename {typings/django => django-stubs}/db/models/constants.pyi (100%) rename {typings/django => django-stubs}/db/models/constraints.pyi (100%) rename {typings/django => django-stubs}/db/models/deletion.pyi (100%) rename {typings/django => django-stubs}/db/models/enums.pyi (100%) rename {typings/django => django-stubs}/db/models/expressions.pyi (100%) rename {typings/django => django-stubs}/db/models/fields/__init__.pyi (100%) rename {typings/django => django-stubs}/db/models/fields/files.pyi (100%) rename {typings/django => django-stubs}/db/models/fields/json.pyi (100%) rename {typings/django => django-stubs}/db/models/fields/mixins.pyi (100%) rename {typings/django => django-stubs}/db/models/fields/proxy.pyi (100%) rename {typings/django => django-stubs}/db/models/fields/related.pyi (100%) rename {typings/django => django-stubs}/db/models/fields/related_descriptors.pyi (100%) rename {typings/django => django-stubs}/db/models/fields/related_lookups.pyi (100%) rename {typings/django => django-stubs}/db/models/fields/reverse_related.pyi (100%) rename {typings/django => django-stubs}/db/models/functions/__init__.pyi (100%) rename {typings/django => django-stubs}/db/models/functions/comparison.pyi (100%) rename {typings/django => django-stubs}/db/models/functions/datetime.pyi (100%) rename {typings/django => django-stubs}/db/models/functions/math.pyi (100%) rename {typings/django => django-stubs}/db/models/functions/mixins.pyi (100%) rename {typings/django => django-stubs}/db/models/functions/text.pyi (100%) rename {typings/django => django-stubs}/db/models/functions/window.pyi (100%) rename {typings/django => django-stubs}/db/models/indexes.pyi (100%) rename {typings/django => django-stubs}/db/models/lookups.pyi (100%) rename {typings/django => django-stubs}/db/models/manager.pyi (100%) rename {typings/django => django-stubs}/db/models/options.pyi (100%) rename {typings/django => django-stubs}/db/models/query.pyi (100%) rename {typings/django => django-stubs}/db/models/query_utils.pyi (100%) rename {typings/django => django-stubs}/db/models/signals.pyi (100%) rename {typings/django => django-stubs}/db/models/sql/__init__.pyi (100%) rename {typings/django => django-stubs}/db/models/sql/compiler.pyi (100%) rename {typings/django => django-stubs}/db/models/sql/constants.pyi (100%) rename {typings/django => django-stubs}/db/models/sql/datastructures.pyi (100%) rename {typings/django => django-stubs}/db/models/sql/query.pyi (100%) rename {typings/django => django-stubs}/db/models/sql/subqueries.pyi (100%) rename {typings/django => django-stubs}/db/models/sql/where.pyi (100%) rename {typings/django => django-stubs}/db/models/utils.pyi (100%) rename {typings/django => django-stubs}/db/transaction.pyi (100%) rename {typings/django => django-stubs}/db/utils.pyi (100%) rename {typings/django => django-stubs}/dispatch/__init__.pyi (100%) rename {typings/django => django-stubs}/dispatch/dispatcher.pyi (100%) rename {typings/django => django-stubs}/forms/__init__.pyi (100%) rename {typings/django => django-stubs}/forms/boundfield.pyi (100%) rename {typings/django => django-stubs}/forms/fields.pyi (100%) rename {typings/django => django-stubs}/forms/forms.pyi (100%) rename {typings/django => django-stubs}/forms/formsets.pyi (100%) rename {typings/django => django-stubs}/forms/models.pyi (100%) rename {typings/django => django-stubs}/forms/renderers.pyi (100%) rename {typings/django => django-stubs}/forms/utils.pyi (100%) rename {typings/django => django-stubs}/forms/widgets.pyi (100%) rename {typings/django => django-stubs}/http/__init__.pyi (100%) rename {typings/django => django-stubs}/http/cookie.pyi (100%) rename {typings/django => django-stubs}/http/multipartparser.pyi (100%) rename {typings/django => django-stubs}/http/request.pyi (100%) rename {typings/django => django-stubs}/http/response.pyi (100%) rename {typings/django => django-stubs}/middleware/__init__.pyi (100%) rename {typings/django => django-stubs}/middleware/cache.pyi (100%) rename {typings/django => django-stubs}/middleware/clickjacking.pyi (100%) rename {typings/django => django-stubs}/middleware/common.pyi (100%) rename {typings/django => django-stubs}/middleware/csrf.pyi (100%) rename {typings/django => django-stubs}/middleware/gzip.pyi (100%) rename {typings/django => django-stubs}/middleware/http.pyi (100%) rename {typings/django => django-stubs}/middleware/locale.pyi (100%) rename {typings/django => django-stubs}/middleware/security.pyi (100%) rename {typings/django => django-stubs}/shortcuts.pyi (100%) rename {typings/django => django-stubs}/template/__init__.pyi (100%) rename {typings/django => django-stubs}/template/backends/__init__.pyi (100%) rename {typings/django => django-stubs}/template/backends/base.pyi (100%) rename {typings/django => django-stubs}/template/backends/django.pyi (100%) rename {typings/django => django-stubs}/template/backends/dummy.pyi (100%) rename {typings/django => django-stubs}/template/backends/jinja2.pyi (100%) rename {typings/django => django-stubs}/template/backends/utils.pyi (100%) rename {typings/django => django-stubs}/template/base.pyi (100%) rename {typings/django => django-stubs}/template/context.pyi (100%) rename {typings/django => django-stubs}/template/context_processors.pyi (100%) rename {typings/django => django-stubs}/template/defaultfilters.pyi (100%) rename {typings/django => django-stubs}/template/defaulttags.pyi (100%) rename {typings/django => django-stubs}/template/engine.pyi (100%) rename {typings/django => django-stubs}/template/exceptions.pyi (100%) rename {typings/django => django-stubs}/template/library.pyi (100%) rename {typings/django => django-stubs}/template/loader.pyi (100%) rename {typings/django => django-stubs}/template/loader_tags.pyi (100%) rename {typings/django => django-stubs}/template/loaders/__init__.pyi (100%) rename {typings/django => django-stubs}/template/loaders/app_directories.pyi (100%) rename {typings/django => django-stubs}/template/loaders/base.pyi (100%) rename {typings/django => django-stubs}/template/loaders/cached.pyi (100%) rename {typings/django => django-stubs}/template/loaders/filesystem.pyi (100%) rename {typings/django => django-stubs}/template/loaders/locmem.pyi (100%) rename {typings/django => django-stubs}/template/response.pyi (100%) rename {typings/django => django-stubs}/template/smartif.pyi (100%) rename {typings/django => django-stubs}/template/utils.pyi (100%) rename {typings/django => django-stubs}/templatetags/__init__.pyi (100%) rename {typings/django => django-stubs}/templatetags/cache.pyi (100%) rename {typings/django => django-stubs}/templatetags/i18n.pyi (100%) rename {typings/django => django-stubs}/templatetags/l10n.pyi (100%) rename {typings/django => django-stubs}/templatetags/static.pyi (100%) rename {typings/django => django-stubs}/templatetags/tz.pyi (100%) rename {typings/django => django-stubs}/test/__init__.pyi (100%) rename {typings/django => django-stubs}/test/client.pyi (100%) rename {typings/django => django-stubs}/test/html.pyi (100%) rename {typings/django => django-stubs}/test/runner.pyi (100%) rename {typings/django => django-stubs}/test/selenium.pyi (100%) rename {typings/django => django-stubs}/test/signals.pyi (100%) rename {typings/django => django-stubs}/test/testcases.pyi (100%) rename {typings/django => django-stubs}/test/utils.pyi (100%) rename {typings/django => django-stubs}/urls/__init__.pyi (100%) rename {typings/django => django-stubs}/urls/base.pyi (100%) rename {typings/django => django-stubs}/urls/conf.pyi (100%) rename {typings/django => django-stubs}/urls/converters.pyi (100%) rename {typings/django => django-stubs}/urls/exceptions.pyi (100%) rename {typings/django => django-stubs}/urls/resolvers.pyi (100%) rename {typings/django => django-stubs}/urls/utils.pyi (100%) rename {typings/django => django-stubs}/utils/__init__.pyi (100%) rename {typings/django => django-stubs}/utils/_os.pyi (100%) rename {typings/django => django-stubs}/utils/archive.pyi (100%) rename {typings/django => django-stubs}/utils/asyncio.pyi (100%) rename {typings/django => django-stubs}/utils/autoreload.pyi (100%) rename {typings/django => django-stubs}/utils/baseconv.pyi (100%) rename {typings/django => django-stubs}/utils/cache.pyi (100%) rename {typings/django => django-stubs}/utils/crypto.pyi (100%) rename {typings/django => django-stubs}/utils/datastructures.pyi (100%) rename {typings/django => django-stubs}/utils/dateformat.pyi (100%) rename {typings/django => django-stubs}/utils/dateparse.pyi (100%) rename {typings/django => django-stubs}/utils/dates.pyi (100%) rename {typings/django => django-stubs}/utils/datetime_safe.pyi (100%) rename {typings/django => django-stubs}/utils/deconstruct.pyi (100%) rename {typings/django => django-stubs}/utils/decorators.pyi (100%) rename {typings/django => django-stubs}/utils/deprecation.pyi (100%) rename {typings/django => django-stubs}/utils/duration.pyi (100%) rename {typings/django => django-stubs}/utils/encoding.pyi (100%) rename {typings/django => django-stubs}/utils/feedgenerator.pyi (100%) rename {typings/django => django-stubs}/utils/formats.pyi (100%) rename {typings/django => django-stubs}/utils/functional.pyi (100%) rename {typings/django => django-stubs}/utils/hashable.pyi (100%) rename {typings/django => django-stubs}/utils/html.pyi (100%) rename {typings/django => django-stubs}/utils/http.pyi (100%) rename {typings/django => django-stubs}/utils/inspect.pyi (100%) rename {typings/django => django-stubs}/utils/ipv6.pyi (100%) rename {typings/django => django-stubs}/utils/itercompat.pyi (100%) rename {typings/django => django-stubs}/utils/jslex.pyi (100%) rename {typings/django => django-stubs}/utils/log.pyi (100%) rename {typings/django => django-stubs}/utils/lorem_ipsum.pyi (100%) rename {typings/django => django-stubs}/utils/module_loading.pyi (100%) rename {typings/django => django-stubs}/utils/numberformat.pyi (100%) rename {typings/django => django-stubs}/utils/regex_helper.pyi (100%) rename {typings/django => django-stubs}/utils/safestring.pyi (100%) rename {typings/django => django-stubs}/utils/six.pyi (100%) rename {typings/django => django-stubs}/utils/termcolors.pyi (100%) rename {typings/django => django-stubs}/utils/text.pyi (100%) rename {typings/django => django-stubs}/utils/timesince.pyi (100%) rename {typings/django => django-stubs}/utils/timezone.pyi (100%) rename {typings/django => django-stubs}/utils/topological_sort.pyi (100%) rename {typings/django => django-stubs}/utils/translation/__init__.pyi (100%) rename {typings/django => django-stubs}/utils/translation/reloader.pyi (100%) rename {typings/django => django-stubs}/utils/translation/template.pyi (100%) rename {typings/django => django-stubs}/utils/translation/trans_null.pyi (100%) rename {typings/django => django-stubs}/utils/translation/trans_real.pyi (100%) rename {typings/django => django-stubs}/utils/tree.pyi (100%) rename {typings/django => django-stubs}/utils/version.pyi (100%) rename {typings/django => django-stubs}/utils/xmlutils.pyi (100%) rename {typings/django => django-stubs}/views/__init__.pyi (100%) rename {typings/django => django-stubs}/views/csrf.pyi (100%) rename {typings/django => django-stubs}/views/debug.pyi (100%) rename {typings/django => django-stubs}/views/decorators/__init__.pyi (100%) rename {typings/django => django-stubs}/views/decorators/cache.pyi (100%) rename {typings/django => django-stubs}/views/decorators/clickjacking.pyi (100%) rename {typings/django => django-stubs}/views/decorators/csrf.pyi (100%) rename {typings/django => django-stubs}/views/decorators/debug.pyi (100%) rename {typings/django => django-stubs}/views/decorators/gzip.pyi (100%) rename {typings/django => django-stubs}/views/decorators/http.pyi (100%) rename {typings/django => django-stubs}/views/decorators/vary.pyi (100%) rename {typings/django => django-stubs}/views/defaults.pyi (100%) rename {typings/django => django-stubs}/views/generic/__init__.pyi (100%) rename {typings/django => django-stubs}/views/generic/base.pyi (100%) rename {typings/django => django-stubs}/views/generic/dates.pyi (100%) rename {typings/django => django-stubs}/views/generic/detail.pyi (100%) rename {typings/django => django-stubs}/views/generic/edit.pyi (100%) rename {typings/django => django-stubs}/views/generic/list.pyi (100%) rename {typings/django => django-stubs}/views/i18n.pyi (100%) rename {typings/django => django-stubs}/views/static.pyi (100%) delete mode 120000 psycopg2-stubs rename {typings/psycopg2 => psycopg2-stubs}/__init__.pyi (100%) rename {typings/psycopg2 => psycopg2-stubs}/_psycopg.pyi (100%) rename {typings/psycopg2 => psycopg2-stubs}/_range.pyi (100%) rename {typings/psycopg2 => psycopg2-stubs}/errors.pyi (100%) rename {typings/psycopg2 => psycopg2-stubs}/extensions.pyi (100%) rename {typings/psycopg2 => psycopg2-stubs}/extras.pyi (100%) rename {typings/psycopg2 => psycopg2-stubs}/sql.pyi (100%) rename {typings/psycopg2 => psycopg2-stubs}/tz.pyi (100%) create mode 100755 s/build create mode 120000 typings/django create mode 120000 typings/psycopg2 diff --git a/django-stubs b/django-stubs deleted file mode 120000 index 71d175bbc..000000000 --- a/django-stubs +++ /dev/null @@ -1 +0,0 @@ -./typings/django \ No newline at end of file diff --git a/typings/django/__init__.pyi b/django-stubs/__init__.pyi similarity index 100% rename from typings/django/__init__.pyi rename to django-stubs/__init__.pyi diff --git a/typings/django/apps/__init__.pyi b/django-stubs/apps/__init__.pyi similarity index 100% rename from typings/django/apps/__init__.pyi rename to django-stubs/apps/__init__.pyi diff --git a/typings/django/apps/config.pyi b/django-stubs/apps/config.pyi similarity index 100% rename from typings/django/apps/config.pyi rename to django-stubs/apps/config.pyi diff --git a/typings/django/apps/registry.pyi b/django-stubs/apps/registry.pyi similarity index 100% rename from typings/django/apps/registry.pyi rename to django-stubs/apps/registry.pyi diff --git a/typings/django/conf/__init__.pyi b/django-stubs/conf/__init__.pyi similarity index 100% rename from typings/django/conf/__init__.pyi rename to django-stubs/conf/__init__.pyi diff --git a/typings/django/conf/global_settings.pyi b/django-stubs/conf/global_settings.pyi similarity index 100% rename from typings/django/conf/global_settings.pyi rename to django-stubs/conf/global_settings.pyi diff --git a/typings/django/conf/locale/__init__.pyi b/django-stubs/conf/locale/__init__.pyi similarity index 100% rename from typings/django/conf/locale/__init__.pyi rename to django-stubs/conf/locale/__init__.pyi diff --git a/typings/django/conf/urls/__init__.pyi b/django-stubs/conf/urls/__init__.pyi similarity index 100% rename from typings/django/conf/urls/__init__.pyi rename to django-stubs/conf/urls/__init__.pyi diff --git a/typings/django/conf/urls/i18n.pyi b/django-stubs/conf/urls/i18n.pyi similarity index 100% rename from typings/django/conf/urls/i18n.pyi rename to django-stubs/conf/urls/i18n.pyi diff --git a/typings/django/conf/urls/static.pyi b/django-stubs/conf/urls/static.pyi similarity index 100% rename from typings/django/conf/urls/static.pyi rename to django-stubs/conf/urls/static.pyi diff --git a/typings/django/contrib/__init__.pyi b/django-stubs/contrib/__init__.pyi similarity index 100% rename from typings/django/contrib/__init__.pyi rename to django-stubs/contrib/__init__.pyi diff --git a/typings/django/contrib/admin/__init__.pyi b/django-stubs/contrib/admin/__init__.pyi similarity index 100% rename from typings/django/contrib/admin/__init__.pyi rename to django-stubs/contrib/admin/__init__.pyi diff --git a/typings/django/contrib/admin/actions.pyi b/django-stubs/contrib/admin/actions.pyi similarity index 100% rename from typings/django/contrib/admin/actions.pyi rename to django-stubs/contrib/admin/actions.pyi diff --git a/typings/django/contrib/admin/apps.pyi b/django-stubs/contrib/admin/apps.pyi similarity index 100% rename from typings/django/contrib/admin/apps.pyi rename to django-stubs/contrib/admin/apps.pyi diff --git a/typings/django/contrib/admin/checks.pyi b/django-stubs/contrib/admin/checks.pyi similarity index 100% rename from typings/django/contrib/admin/checks.pyi rename to django-stubs/contrib/admin/checks.pyi diff --git a/typings/django/contrib/admin/decorators.pyi b/django-stubs/contrib/admin/decorators.pyi similarity index 100% rename from typings/django/contrib/admin/decorators.pyi rename to django-stubs/contrib/admin/decorators.pyi diff --git a/typings/django/contrib/admin/exceptions.pyi b/django-stubs/contrib/admin/exceptions.pyi similarity index 100% rename from typings/django/contrib/admin/exceptions.pyi rename to django-stubs/contrib/admin/exceptions.pyi diff --git a/typings/django/contrib/admin/filters.pyi b/django-stubs/contrib/admin/filters.pyi similarity index 100% rename from typings/django/contrib/admin/filters.pyi rename to django-stubs/contrib/admin/filters.pyi diff --git a/typings/django/contrib/admin/forms.pyi b/django-stubs/contrib/admin/forms.pyi similarity index 100% rename from typings/django/contrib/admin/forms.pyi rename to django-stubs/contrib/admin/forms.pyi diff --git a/typings/django/contrib/admin/helpers.pyi b/django-stubs/contrib/admin/helpers.pyi similarity index 100% rename from typings/django/contrib/admin/helpers.pyi rename to django-stubs/contrib/admin/helpers.pyi diff --git a/typings/django/contrib/admin/migrations/__init__.pyi b/django-stubs/contrib/admin/migrations/__init__.pyi similarity index 100% rename from typings/django/contrib/admin/migrations/__init__.pyi rename to django-stubs/contrib/admin/migrations/__init__.pyi diff --git a/typings/django/contrib/admin/models.pyi b/django-stubs/contrib/admin/models.pyi similarity index 100% rename from typings/django/contrib/admin/models.pyi rename to django-stubs/contrib/admin/models.pyi diff --git a/typings/django/contrib/admin/options.pyi b/django-stubs/contrib/admin/options.pyi similarity index 100% rename from typings/django/contrib/admin/options.pyi rename to django-stubs/contrib/admin/options.pyi diff --git a/typings/django/contrib/admin/sites.pyi b/django-stubs/contrib/admin/sites.pyi similarity index 100% rename from typings/django/contrib/admin/sites.pyi rename to django-stubs/contrib/admin/sites.pyi diff --git a/typings/django/contrib/admin/templatetags/__init__.pyi b/django-stubs/contrib/admin/templatetags/__init__.pyi similarity index 100% rename from typings/django/contrib/admin/templatetags/__init__.pyi rename to django-stubs/contrib/admin/templatetags/__init__.pyi diff --git a/typings/django/contrib/admin/templatetags/admin_list.pyi b/django-stubs/contrib/admin/templatetags/admin_list.pyi similarity index 100% rename from typings/django/contrib/admin/templatetags/admin_list.pyi rename to django-stubs/contrib/admin/templatetags/admin_list.pyi diff --git a/typings/django/contrib/admin/templatetags/admin_modify.pyi b/django-stubs/contrib/admin/templatetags/admin_modify.pyi similarity index 100% rename from typings/django/contrib/admin/templatetags/admin_modify.pyi rename to django-stubs/contrib/admin/templatetags/admin_modify.pyi diff --git a/typings/django/contrib/admin/templatetags/admin_static.pyi b/django-stubs/contrib/admin/templatetags/admin_static.pyi similarity index 100% rename from typings/django/contrib/admin/templatetags/admin_static.pyi rename to django-stubs/contrib/admin/templatetags/admin_static.pyi diff --git a/typings/django/contrib/admin/templatetags/admin_urls.pyi b/django-stubs/contrib/admin/templatetags/admin_urls.pyi similarity index 100% rename from typings/django/contrib/admin/templatetags/admin_urls.pyi rename to django-stubs/contrib/admin/templatetags/admin_urls.pyi diff --git a/typings/django/contrib/admin/templatetags/base.pyi b/django-stubs/contrib/admin/templatetags/base.pyi similarity index 100% rename from typings/django/contrib/admin/templatetags/base.pyi rename to django-stubs/contrib/admin/templatetags/base.pyi diff --git a/typings/django/contrib/admin/templatetags/log.pyi b/django-stubs/contrib/admin/templatetags/log.pyi similarity index 100% rename from typings/django/contrib/admin/templatetags/log.pyi rename to django-stubs/contrib/admin/templatetags/log.pyi diff --git a/typings/django/contrib/admin/tests.pyi b/django-stubs/contrib/admin/tests.pyi similarity index 100% rename from typings/django/contrib/admin/tests.pyi rename to django-stubs/contrib/admin/tests.pyi diff --git a/typings/django/contrib/admin/utils.pyi b/django-stubs/contrib/admin/utils.pyi similarity index 100% rename from typings/django/contrib/admin/utils.pyi rename to django-stubs/contrib/admin/utils.pyi diff --git a/typings/django/contrib/admin/views/__init__.pyi b/django-stubs/contrib/admin/views/__init__.pyi similarity index 100% rename from typings/django/contrib/admin/views/__init__.pyi rename to django-stubs/contrib/admin/views/__init__.pyi diff --git a/typings/django/contrib/admin/views/autocomplete.pyi b/django-stubs/contrib/admin/views/autocomplete.pyi similarity index 100% rename from typings/django/contrib/admin/views/autocomplete.pyi rename to django-stubs/contrib/admin/views/autocomplete.pyi diff --git a/typings/django/contrib/admin/views/decorators.pyi b/django-stubs/contrib/admin/views/decorators.pyi similarity index 100% rename from typings/django/contrib/admin/views/decorators.pyi rename to django-stubs/contrib/admin/views/decorators.pyi diff --git a/typings/django/contrib/admin/views/main.pyi b/django-stubs/contrib/admin/views/main.pyi similarity index 100% rename from typings/django/contrib/admin/views/main.pyi rename to django-stubs/contrib/admin/views/main.pyi diff --git a/typings/django/contrib/admin/widgets.pyi b/django-stubs/contrib/admin/widgets.pyi similarity index 100% rename from typings/django/contrib/admin/widgets.pyi rename to django-stubs/contrib/admin/widgets.pyi diff --git a/typings/django/contrib/admindocs/__init__.pyi b/django-stubs/contrib/admindocs/__init__.pyi similarity index 100% rename from typings/django/contrib/admindocs/__init__.pyi rename to django-stubs/contrib/admindocs/__init__.pyi diff --git a/typings/django/contrib/admindocs/apps.pyi b/django-stubs/contrib/admindocs/apps.pyi similarity index 100% rename from typings/django/contrib/admindocs/apps.pyi rename to django-stubs/contrib/admindocs/apps.pyi diff --git a/typings/django/contrib/admindocs/middleware.pyi b/django-stubs/contrib/admindocs/middleware.pyi similarity index 100% rename from typings/django/contrib/admindocs/middleware.pyi rename to django-stubs/contrib/admindocs/middleware.pyi diff --git a/typings/django/contrib/admindocs/urls.pyi b/django-stubs/contrib/admindocs/urls.pyi similarity index 100% rename from typings/django/contrib/admindocs/urls.pyi rename to django-stubs/contrib/admindocs/urls.pyi diff --git a/typings/django/contrib/admindocs/utils.pyi b/django-stubs/contrib/admindocs/utils.pyi similarity index 100% rename from typings/django/contrib/admindocs/utils.pyi rename to django-stubs/contrib/admindocs/utils.pyi diff --git a/typings/django/contrib/admindocs/views.pyi b/django-stubs/contrib/admindocs/views.pyi similarity index 100% rename from typings/django/contrib/admindocs/views.pyi rename to django-stubs/contrib/admindocs/views.pyi diff --git a/typings/django/contrib/auth/__init__.pyi b/django-stubs/contrib/auth/__init__.pyi similarity index 100% rename from typings/django/contrib/auth/__init__.pyi rename to django-stubs/contrib/auth/__init__.pyi diff --git a/typings/django/contrib/auth/admin.pyi b/django-stubs/contrib/auth/admin.pyi similarity index 100% rename from typings/django/contrib/auth/admin.pyi rename to django-stubs/contrib/auth/admin.pyi diff --git a/typings/django/contrib/auth/apps.pyi b/django-stubs/contrib/auth/apps.pyi similarity index 100% rename from typings/django/contrib/auth/apps.pyi rename to django-stubs/contrib/auth/apps.pyi diff --git a/typings/django/contrib/auth/backends.pyi b/django-stubs/contrib/auth/backends.pyi similarity index 100% rename from typings/django/contrib/auth/backends.pyi rename to django-stubs/contrib/auth/backends.pyi diff --git a/typings/django/contrib/auth/base_user.pyi b/django-stubs/contrib/auth/base_user.pyi similarity index 100% rename from typings/django/contrib/auth/base_user.pyi rename to django-stubs/contrib/auth/base_user.pyi diff --git a/typings/django/contrib/auth/checks.pyi b/django-stubs/contrib/auth/checks.pyi similarity index 100% rename from typings/django/contrib/auth/checks.pyi rename to django-stubs/contrib/auth/checks.pyi diff --git a/typings/django/contrib/auth/context_processors.pyi b/django-stubs/contrib/auth/context_processors.pyi similarity index 100% rename from typings/django/contrib/auth/context_processors.pyi rename to django-stubs/contrib/auth/context_processors.pyi diff --git a/typings/django/contrib/auth/decorators.pyi b/django-stubs/contrib/auth/decorators.pyi similarity index 100% rename from typings/django/contrib/auth/decorators.pyi rename to django-stubs/contrib/auth/decorators.pyi diff --git a/typings/django/contrib/auth/forms.pyi b/django-stubs/contrib/auth/forms.pyi similarity index 100% rename from typings/django/contrib/auth/forms.pyi rename to django-stubs/contrib/auth/forms.pyi diff --git a/typings/django/contrib/auth/handlers/__init__.pyi b/django-stubs/contrib/auth/handlers/__init__.pyi similarity index 100% rename from typings/django/contrib/auth/handlers/__init__.pyi rename to django-stubs/contrib/auth/handlers/__init__.pyi diff --git a/typings/django/contrib/auth/handlers/modwsgi.pyi b/django-stubs/contrib/auth/handlers/modwsgi.pyi similarity index 100% rename from typings/django/contrib/auth/handlers/modwsgi.pyi rename to django-stubs/contrib/auth/handlers/modwsgi.pyi diff --git a/typings/django/contrib/auth/hashers.pyi b/django-stubs/contrib/auth/hashers.pyi similarity index 100% rename from typings/django/contrib/auth/hashers.pyi rename to django-stubs/contrib/auth/hashers.pyi diff --git a/typings/django/contrib/auth/management/__init__.pyi b/django-stubs/contrib/auth/management/__init__.pyi similarity index 100% rename from typings/django/contrib/auth/management/__init__.pyi rename to django-stubs/contrib/auth/management/__init__.pyi diff --git a/typings/django/contrib/auth/management/commands/__init__.pyi b/django-stubs/contrib/auth/management/commands/__init__.pyi similarity index 100% rename from typings/django/contrib/auth/management/commands/__init__.pyi rename to django-stubs/contrib/auth/management/commands/__init__.pyi diff --git a/typings/django/contrib/auth/management/commands/changepassword.pyi b/django-stubs/contrib/auth/management/commands/changepassword.pyi similarity index 100% rename from typings/django/contrib/auth/management/commands/changepassword.pyi rename to django-stubs/contrib/auth/management/commands/changepassword.pyi diff --git a/typings/django/contrib/auth/management/commands/createsuperuser.pyi b/django-stubs/contrib/auth/management/commands/createsuperuser.pyi similarity index 100% rename from typings/django/contrib/auth/management/commands/createsuperuser.pyi rename to django-stubs/contrib/auth/management/commands/createsuperuser.pyi diff --git a/typings/django/contrib/auth/middleware.pyi b/django-stubs/contrib/auth/middleware.pyi similarity index 100% rename from typings/django/contrib/auth/middleware.pyi rename to django-stubs/contrib/auth/middleware.pyi diff --git a/typings/django/contrib/auth/migrations/__init__.pyi b/django-stubs/contrib/auth/migrations/__init__.pyi similarity index 100% rename from typings/django/contrib/auth/migrations/__init__.pyi rename to django-stubs/contrib/auth/migrations/__init__.pyi diff --git a/typings/django/contrib/auth/mixins.pyi b/django-stubs/contrib/auth/mixins.pyi similarity index 100% rename from typings/django/contrib/auth/mixins.pyi rename to django-stubs/contrib/auth/mixins.pyi diff --git a/typings/django/contrib/auth/models.pyi b/django-stubs/contrib/auth/models.pyi similarity index 100% rename from typings/django/contrib/auth/models.pyi rename to django-stubs/contrib/auth/models.pyi diff --git a/typings/django/contrib/auth/password_validation.pyi b/django-stubs/contrib/auth/password_validation.pyi similarity index 100% rename from typings/django/contrib/auth/password_validation.pyi rename to django-stubs/contrib/auth/password_validation.pyi diff --git a/typings/django/contrib/auth/signals.pyi b/django-stubs/contrib/auth/signals.pyi similarity index 100% rename from typings/django/contrib/auth/signals.pyi rename to django-stubs/contrib/auth/signals.pyi diff --git a/typings/django/contrib/auth/tokens.pyi b/django-stubs/contrib/auth/tokens.pyi similarity index 100% rename from typings/django/contrib/auth/tokens.pyi rename to django-stubs/contrib/auth/tokens.pyi diff --git a/typings/django/contrib/auth/urls.pyi b/django-stubs/contrib/auth/urls.pyi similarity index 100% rename from typings/django/contrib/auth/urls.pyi rename to django-stubs/contrib/auth/urls.pyi diff --git a/typings/django/contrib/auth/validators.pyi b/django-stubs/contrib/auth/validators.pyi similarity index 100% rename from typings/django/contrib/auth/validators.pyi rename to django-stubs/contrib/auth/validators.pyi diff --git a/typings/django/contrib/auth/views.pyi b/django-stubs/contrib/auth/views.pyi similarity index 100% rename from typings/django/contrib/auth/views.pyi rename to django-stubs/contrib/auth/views.pyi diff --git a/typings/django/contrib/contenttypes/__init__.pyi b/django-stubs/contrib/contenttypes/__init__.pyi similarity index 100% rename from typings/django/contrib/contenttypes/__init__.pyi rename to django-stubs/contrib/contenttypes/__init__.pyi diff --git a/typings/django/contrib/contenttypes/admin.pyi b/django-stubs/contrib/contenttypes/admin.pyi similarity index 100% rename from typings/django/contrib/contenttypes/admin.pyi rename to django-stubs/contrib/contenttypes/admin.pyi diff --git a/typings/django/contrib/contenttypes/apps.pyi b/django-stubs/contrib/contenttypes/apps.pyi similarity index 100% rename from typings/django/contrib/contenttypes/apps.pyi rename to django-stubs/contrib/contenttypes/apps.pyi diff --git a/typings/django/contrib/contenttypes/checks.pyi b/django-stubs/contrib/contenttypes/checks.pyi similarity index 100% rename from typings/django/contrib/contenttypes/checks.pyi rename to django-stubs/contrib/contenttypes/checks.pyi diff --git a/typings/django/contrib/contenttypes/fields.pyi b/django-stubs/contrib/contenttypes/fields.pyi similarity index 100% rename from typings/django/contrib/contenttypes/fields.pyi rename to django-stubs/contrib/contenttypes/fields.pyi diff --git a/typings/django/contrib/contenttypes/forms.pyi b/django-stubs/contrib/contenttypes/forms.pyi similarity index 100% rename from typings/django/contrib/contenttypes/forms.pyi rename to django-stubs/contrib/contenttypes/forms.pyi diff --git a/typings/django/contrib/contenttypes/management/__init__.pyi b/django-stubs/contrib/contenttypes/management/__init__.pyi similarity index 100% rename from typings/django/contrib/contenttypes/management/__init__.pyi rename to django-stubs/contrib/contenttypes/management/__init__.pyi diff --git a/typings/django/contrib/contenttypes/management/commands/__init__.pyi b/django-stubs/contrib/contenttypes/management/commands/__init__.pyi similarity index 100% rename from typings/django/contrib/contenttypes/management/commands/__init__.pyi rename to django-stubs/contrib/contenttypes/management/commands/__init__.pyi diff --git a/typings/django/contrib/contenttypes/management/commands/remove_stale_contenttypes.pyi b/django-stubs/contrib/contenttypes/management/commands/remove_stale_contenttypes.pyi similarity index 100% rename from typings/django/contrib/contenttypes/management/commands/remove_stale_contenttypes.pyi rename to django-stubs/contrib/contenttypes/management/commands/remove_stale_contenttypes.pyi diff --git a/typings/django/contrib/contenttypes/migrations/__init__.pyi b/django-stubs/contrib/contenttypes/migrations/__init__.pyi similarity index 100% rename from typings/django/contrib/contenttypes/migrations/__init__.pyi rename to django-stubs/contrib/contenttypes/migrations/__init__.pyi diff --git a/typings/django/contrib/contenttypes/models.pyi b/django-stubs/contrib/contenttypes/models.pyi similarity index 100% rename from typings/django/contrib/contenttypes/models.pyi rename to django-stubs/contrib/contenttypes/models.pyi diff --git a/typings/django/contrib/contenttypes/views.pyi b/django-stubs/contrib/contenttypes/views.pyi similarity index 100% rename from typings/django/contrib/contenttypes/views.pyi rename to django-stubs/contrib/contenttypes/views.pyi diff --git a/typings/django/contrib/flatpages/__init__.pyi b/django-stubs/contrib/flatpages/__init__.pyi similarity index 100% rename from typings/django/contrib/flatpages/__init__.pyi rename to django-stubs/contrib/flatpages/__init__.pyi diff --git a/typings/django/contrib/flatpages/admin.pyi b/django-stubs/contrib/flatpages/admin.pyi similarity index 100% rename from typings/django/contrib/flatpages/admin.pyi rename to django-stubs/contrib/flatpages/admin.pyi diff --git a/typings/django/contrib/flatpages/apps.pyi b/django-stubs/contrib/flatpages/apps.pyi similarity index 100% rename from typings/django/contrib/flatpages/apps.pyi rename to django-stubs/contrib/flatpages/apps.pyi diff --git a/typings/django/contrib/flatpages/forms.pyi b/django-stubs/contrib/flatpages/forms.pyi similarity index 100% rename from typings/django/contrib/flatpages/forms.pyi rename to django-stubs/contrib/flatpages/forms.pyi diff --git a/typings/django/contrib/flatpages/middleware.pyi b/django-stubs/contrib/flatpages/middleware.pyi similarity index 100% rename from typings/django/contrib/flatpages/middleware.pyi rename to django-stubs/contrib/flatpages/middleware.pyi diff --git a/typings/django/contrib/flatpages/migrations/__init__.pyi b/django-stubs/contrib/flatpages/migrations/__init__.pyi similarity index 100% rename from typings/django/contrib/flatpages/migrations/__init__.pyi rename to django-stubs/contrib/flatpages/migrations/__init__.pyi diff --git a/typings/django/contrib/flatpages/models.pyi b/django-stubs/contrib/flatpages/models.pyi similarity index 100% rename from typings/django/contrib/flatpages/models.pyi rename to django-stubs/contrib/flatpages/models.pyi diff --git a/typings/django/contrib/flatpages/sitemaps.pyi b/django-stubs/contrib/flatpages/sitemaps.pyi similarity index 100% rename from typings/django/contrib/flatpages/sitemaps.pyi rename to django-stubs/contrib/flatpages/sitemaps.pyi diff --git a/typings/django/contrib/flatpages/templatetags/__init__.pyi b/django-stubs/contrib/flatpages/templatetags/__init__.pyi similarity index 100% rename from typings/django/contrib/flatpages/templatetags/__init__.pyi rename to django-stubs/contrib/flatpages/templatetags/__init__.pyi diff --git a/typings/django/contrib/flatpages/templatetags/flatpages.pyi b/django-stubs/contrib/flatpages/templatetags/flatpages.pyi similarity index 100% rename from typings/django/contrib/flatpages/templatetags/flatpages.pyi rename to django-stubs/contrib/flatpages/templatetags/flatpages.pyi diff --git a/typings/django/contrib/flatpages/urls.pyi b/django-stubs/contrib/flatpages/urls.pyi similarity index 100% rename from typings/django/contrib/flatpages/urls.pyi rename to django-stubs/contrib/flatpages/urls.pyi diff --git a/typings/django/contrib/flatpages/views.pyi b/django-stubs/contrib/flatpages/views.pyi similarity index 100% rename from typings/django/contrib/flatpages/views.pyi rename to django-stubs/contrib/flatpages/views.pyi diff --git a/typings/django/contrib/gis/__init__.pyi b/django-stubs/contrib/gis/__init__.pyi similarity index 100% rename from typings/django/contrib/gis/__init__.pyi rename to django-stubs/contrib/gis/__init__.pyi diff --git a/typings/django/contrib/gis/admin/__init__.pyi b/django-stubs/contrib/gis/admin/__init__.pyi similarity index 100% rename from typings/django/contrib/gis/admin/__init__.pyi rename to django-stubs/contrib/gis/admin/__init__.pyi diff --git a/typings/django/contrib/gis/admin/options.pyi b/django-stubs/contrib/gis/admin/options.pyi similarity index 100% rename from typings/django/contrib/gis/admin/options.pyi rename to django-stubs/contrib/gis/admin/options.pyi diff --git a/typings/django/contrib/gis/admin/widgets.pyi b/django-stubs/contrib/gis/admin/widgets.pyi similarity index 100% rename from typings/django/contrib/gis/admin/widgets.pyi rename to django-stubs/contrib/gis/admin/widgets.pyi diff --git a/typings/django/contrib/gis/apps.pyi b/django-stubs/contrib/gis/apps.pyi similarity index 100% rename from typings/django/contrib/gis/apps.pyi rename to django-stubs/contrib/gis/apps.pyi diff --git a/typings/django/contrib/gis/db/__init__.pyi b/django-stubs/contrib/gis/db/__init__.pyi similarity index 100% rename from typings/django/contrib/gis/db/__init__.pyi rename to django-stubs/contrib/gis/db/__init__.pyi diff --git a/typings/django/contrib/gis/db/backends/__init__.pyi b/django-stubs/contrib/gis/db/backends/__init__.pyi similarity index 100% rename from typings/django/contrib/gis/db/backends/__init__.pyi rename to django-stubs/contrib/gis/db/backends/__init__.pyi diff --git a/typings/django/contrib/gis/db/backends/base/__init__.pyi b/django-stubs/contrib/gis/db/backends/base/__init__.pyi similarity index 100% rename from typings/django/contrib/gis/db/backends/base/__init__.pyi rename to django-stubs/contrib/gis/db/backends/base/__init__.pyi diff --git a/typings/django/contrib/gis/db/backends/base/adapter.pyi b/django-stubs/contrib/gis/db/backends/base/adapter.pyi similarity index 100% rename from typings/django/contrib/gis/db/backends/base/adapter.pyi rename to django-stubs/contrib/gis/db/backends/base/adapter.pyi diff --git a/typings/django/contrib/gis/db/backends/base/features.pyi b/django-stubs/contrib/gis/db/backends/base/features.pyi similarity index 100% rename from typings/django/contrib/gis/db/backends/base/features.pyi rename to django-stubs/contrib/gis/db/backends/base/features.pyi diff --git a/typings/django/contrib/gis/db/backends/base/models.pyi b/django-stubs/contrib/gis/db/backends/base/models.pyi similarity index 100% rename from typings/django/contrib/gis/db/backends/base/models.pyi rename to django-stubs/contrib/gis/db/backends/base/models.pyi diff --git a/typings/django/contrib/gis/db/backends/base/operations.pyi b/django-stubs/contrib/gis/db/backends/base/operations.pyi similarity index 100% rename from typings/django/contrib/gis/db/backends/base/operations.pyi rename to django-stubs/contrib/gis/db/backends/base/operations.pyi diff --git a/typings/django/contrib/gis/db/backends/mysql/__init__.pyi b/django-stubs/contrib/gis/db/backends/mysql/__init__.pyi similarity index 100% rename from typings/django/contrib/gis/db/backends/mysql/__init__.pyi rename to django-stubs/contrib/gis/db/backends/mysql/__init__.pyi diff --git a/typings/django/contrib/gis/db/backends/mysql/base.pyi b/django-stubs/contrib/gis/db/backends/mysql/base.pyi similarity index 100% rename from typings/django/contrib/gis/db/backends/mysql/base.pyi rename to django-stubs/contrib/gis/db/backends/mysql/base.pyi diff --git a/typings/django/contrib/gis/db/backends/mysql/features.pyi b/django-stubs/contrib/gis/db/backends/mysql/features.pyi similarity index 100% rename from typings/django/contrib/gis/db/backends/mysql/features.pyi rename to django-stubs/contrib/gis/db/backends/mysql/features.pyi diff --git a/typings/django/contrib/gis/db/backends/mysql/introspection.pyi b/django-stubs/contrib/gis/db/backends/mysql/introspection.pyi similarity index 100% rename from typings/django/contrib/gis/db/backends/mysql/introspection.pyi rename to django-stubs/contrib/gis/db/backends/mysql/introspection.pyi diff --git a/typings/django/contrib/gis/db/backends/mysql/operations.pyi b/django-stubs/contrib/gis/db/backends/mysql/operations.pyi similarity index 100% rename from typings/django/contrib/gis/db/backends/mysql/operations.pyi rename to django-stubs/contrib/gis/db/backends/mysql/operations.pyi diff --git a/typings/django/contrib/gis/db/backends/mysql/schema.pyi b/django-stubs/contrib/gis/db/backends/mysql/schema.pyi similarity index 100% rename from typings/django/contrib/gis/db/backends/mysql/schema.pyi rename to django-stubs/contrib/gis/db/backends/mysql/schema.pyi diff --git a/typings/django/contrib/gis/db/backends/oracle/__init__.pyi b/django-stubs/contrib/gis/db/backends/oracle/__init__.pyi similarity index 100% rename from typings/django/contrib/gis/db/backends/oracle/__init__.pyi rename to django-stubs/contrib/gis/db/backends/oracle/__init__.pyi diff --git a/typings/django/contrib/gis/db/backends/oracle/adapter.pyi b/django-stubs/contrib/gis/db/backends/oracle/adapter.pyi similarity index 100% rename from typings/django/contrib/gis/db/backends/oracle/adapter.pyi rename to django-stubs/contrib/gis/db/backends/oracle/adapter.pyi diff --git a/typings/django/contrib/gis/db/backends/oracle/base.pyi b/django-stubs/contrib/gis/db/backends/oracle/base.pyi similarity index 100% rename from typings/django/contrib/gis/db/backends/oracle/base.pyi rename to django-stubs/contrib/gis/db/backends/oracle/base.pyi diff --git a/typings/django/contrib/gis/db/backends/oracle/features.pyi b/django-stubs/contrib/gis/db/backends/oracle/features.pyi similarity index 100% rename from typings/django/contrib/gis/db/backends/oracle/features.pyi rename to django-stubs/contrib/gis/db/backends/oracle/features.pyi diff --git a/typings/django/contrib/gis/db/backends/oracle/introspection.pyi b/django-stubs/contrib/gis/db/backends/oracle/introspection.pyi similarity index 100% rename from typings/django/contrib/gis/db/backends/oracle/introspection.pyi rename to django-stubs/contrib/gis/db/backends/oracle/introspection.pyi diff --git a/typings/django/contrib/gis/db/backends/oracle/models.pyi b/django-stubs/contrib/gis/db/backends/oracle/models.pyi similarity index 100% rename from typings/django/contrib/gis/db/backends/oracle/models.pyi rename to django-stubs/contrib/gis/db/backends/oracle/models.pyi diff --git a/typings/django/contrib/gis/db/backends/oracle/operations.pyi b/django-stubs/contrib/gis/db/backends/oracle/operations.pyi similarity index 100% rename from typings/django/contrib/gis/db/backends/oracle/operations.pyi rename to django-stubs/contrib/gis/db/backends/oracle/operations.pyi diff --git a/typings/django/contrib/gis/db/backends/oracle/schema.pyi b/django-stubs/contrib/gis/db/backends/oracle/schema.pyi similarity index 100% rename from typings/django/contrib/gis/db/backends/oracle/schema.pyi rename to django-stubs/contrib/gis/db/backends/oracle/schema.pyi diff --git a/typings/django/contrib/gis/db/backends/postgis/__init__.pyi b/django-stubs/contrib/gis/db/backends/postgis/__init__.pyi similarity index 100% rename from typings/django/contrib/gis/db/backends/postgis/__init__.pyi rename to django-stubs/contrib/gis/db/backends/postgis/__init__.pyi diff --git a/typings/django/contrib/gis/db/backends/postgis/adapter.pyi b/django-stubs/contrib/gis/db/backends/postgis/adapter.pyi similarity index 100% rename from typings/django/contrib/gis/db/backends/postgis/adapter.pyi rename to django-stubs/contrib/gis/db/backends/postgis/adapter.pyi diff --git a/typings/django/contrib/gis/db/backends/postgis/base.pyi b/django-stubs/contrib/gis/db/backends/postgis/base.pyi similarity index 100% rename from typings/django/contrib/gis/db/backends/postgis/base.pyi rename to django-stubs/contrib/gis/db/backends/postgis/base.pyi diff --git a/typings/django/contrib/gis/db/backends/postgis/const.pyi b/django-stubs/contrib/gis/db/backends/postgis/const.pyi similarity index 100% rename from typings/django/contrib/gis/db/backends/postgis/const.pyi rename to django-stubs/contrib/gis/db/backends/postgis/const.pyi diff --git a/typings/django/contrib/gis/db/backends/postgis/features.pyi b/django-stubs/contrib/gis/db/backends/postgis/features.pyi similarity index 100% rename from typings/django/contrib/gis/db/backends/postgis/features.pyi rename to django-stubs/contrib/gis/db/backends/postgis/features.pyi diff --git a/typings/django/contrib/gis/db/backends/postgis/introspection.pyi b/django-stubs/contrib/gis/db/backends/postgis/introspection.pyi similarity index 100% rename from typings/django/contrib/gis/db/backends/postgis/introspection.pyi rename to django-stubs/contrib/gis/db/backends/postgis/introspection.pyi diff --git a/typings/django/contrib/gis/db/backends/postgis/models.pyi b/django-stubs/contrib/gis/db/backends/postgis/models.pyi similarity index 100% rename from typings/django/contrib/gis/db/backends/postgis/models.pyi rename to django-stubs/contrib/gis/db/backends/postgis/models.pyi diff --git a/typings/django/contrib/gis/db/backends/postgis/operations.pyi b/django-stubs/contrib/gis/db/backends/postgis/operations.pyi similarity index 100% rename from typings/django/contrib/gis/db/backends/postgis/operations.pyi rename to django-stubs/contrib/gis/db/backends/postgis/operations.pyi diff --git a/typings/django/contrib/gis/db/backends/postgis/pgraster.pyi b/django-stubs/contrib/gis/db/backends/postgis/pgraster.pyi similarity index 100% rename from typings/django/contrib/gis/db/backends/postgis/pgraster.pyi rename to django-stubs/contrib/gis/db/backends/postgis/pgraster.pyi diff --git a/typings/django/contrib/gis/db/backends/postgis/schema.pyi b/django-stubs/contrib/gis/db/backends/postgis/schema.pyi similarity index 100% rename from typings/django/contrib/gis/db/backends/postgis/schema.pyi rename to django-stubs/contrib/gis/db/backends/postgis/schema.pyi diff --git a/typings/django/contrib/gis/db/backends/spatialite/__init__.pyi b/django-stubs/contrib/gis/db/backends/spatialite/__init__.pyi similarity index 100% rename from typings/django/contrib/gis/db/backends/spatialite/__init__.pyi rename to django-stubs/contrib/gis/db/backends/spatialite/__init__.pyi diff --git a/typings/django/contrib/gis/db/backends/spatialite/adapter.pyi b/django-stubs/contrib/gis/db/backends/spatialite/adapter.pyi similarity index 100% rename from typings/django/contrib/gis/db/backends/spatialite/adapter.pyi rename to django-stubs/contrib/gis/db/backends/spatialite/adapter.pyi diff --git a/typings/django/contrib/gis/db/backends/spatialite/base.pyi b/django-stubs/contrib/gis/db/backends/spatialite/base.pyi similarity index 100% rename from typings/django/contrib/gis/db/backends/spatialite/base.pyi rename to django-stubs/contrib/gis/db/backends/spatialite/base.pyi diff --git a/typings/django/contrib/gis/db/backends/spatialite/client.pyi b/django-stubs/contrib/gis/db/backends/spatialite/client.pyi similarity index 100% rename from typings/django/contrib/gis/db/backends/spatialite/client.pyi rename to django-stubs/contrib/gis/db/backends/spatialite/client.pyi diff --git a/typings/django/contrib/gis/db/backends/spatialite/features.pyi b/django-stubs/contrib/gis/db/backends/spatialite/features.pyi similarity index 100% rename from typings/django/contrib/gis/db/backends/spatialite/features.pyi rename to django-stubs/contrib/gis/db/backends/spatialite/features.pyi diff --git a/typings/django/contrib/gis/db/backends/spatialite/introspection.pyi b/django-stubs/contrib/gis/db/backends/spatialite/introspection.pyi similarity index 100% rename from typings/django/contrib/gis/db/backends/spatialite/introspection.pyi rename to django-stubs/contrib/gis/db/backends/spatialite/introspection.pyi diff --git a/typings/django/contrib/gis/db/backends/spatialite/models.pyi b/django-stubs/contrib/gis/db/backends/spatialite/models.pyi similarity index 100% rename from typings/django/contrib/gis/db/backends/spatialite/models.pyi rename to django-stubs/contrib/gis/db/backends/spatialite/models.pyi diff --git a/typings/django/contrib/gis/db/backends/spatialite/operations.pyi b/django-stubs/contrib/gis/db/backends/spatialite/operations.pyi similarity index 100% rename from typings/django/contrib/gis/db/backends/spatialite/operations.pyi rename to django-stubs/contrib/gis/db/backends/spatialite/operations.pyi diff --git a/typings/django/contrib/gis/db/backends/spatialite/schema.pyi b/django-stubs/contrib/gis/db/backends/spatialite/schema.pyi similarity index 100% rename from typings/django/contrib/gis/db/backends/spatialite/schema.pyi rename to django-stubs/contrib/gis/db/backends/spatialite/schema.pyi diff --git a/typings/django/contrib/gis/db/backends/utils.pyi b/django-stubs/contrib/gis/db/backends/utils.pyi similarity index 100% rename from typings/django/contrib/gis/db/backends/utils.pyi rename to django-stubs/contrib/gis/db/backends/utils.pyi diff --git a/typings/django/contrib/gis/db/models/__init__.pyi b/django-stubs/contrib/gis/db/models/__init__.pyi similarity index 100% rename from typings/django/contrib/gis/db/models/__init__.pyi rename to django-stubs/contrib/gis/db/models/__init__.pyi diff --git a/typings/django/contrib/gis/db/models/aggregates.pyi b/django-stubs/contrib/gis/db/models/aggregates.pyi similarity index 100% rename from typings/django/contrib/gis/db/models/aggregates.pyi rename to django-stubs/contrib/gis/db/models/aggregates.pyi diff --git a/typings/django/contrib/gis/db/models/fields.pyi b/django-stubs/contrib/gis/db/models/fields.pyi similarity index 100% rename from typings/django/contrib/gis/db/models/fields.pyi rename to django-stubs/contrib/gis/db/models/fields.pyi diff --git a/typings/django/contrib/gis/db/models/functions.pyi b/django-stubs/contrib/gis/db/models/functions.pyi similarity index 100% rename from typings/django/contrib/gis/db/models/functions.pyi rename to django-stubs/contrib/gis/db/models/functions.pyi diff --git a/typings/django/contrib/gis/db/models/lookups.pyi b/django-stubs/contrib/gis/db/models/lookups.pyi similarity index 100% rename from typings/django/contrib/gis/db/models/lookups.pyi rename to django-stubs/contrib/gis/db/models/lookups.pyi diff --git a/typings/django/contrib/gis/db/models/proxy.pyi b/django-stubs/contrib/gis/db/models/proxy.pyi similarity index 100% rename from typings/django/contrib/gis/db/models/proxy.pyi rename to django-stubs/contrib/gis/db/models/proxy.pyi diff --git a/typings/django/contrib/gis/db/models/sql/__init__.pyi b/django-stubs/contrib/gis/db/models/sql/__init__.pyi similarity index 100% rename from typings/django/contrib/gis/db/models/sql/__init__.pyi rename to django-stubs/contrib/gis/db/models/sql/__init__.pyi diff --git a/typings/django/contrib/gis/db/models/sql/conversion.pyi b/django-stubs/contrib/gis/db/models/sql/conversion.pyi similarity index 100% rename from typings/django/contrib/gis/db/models/sql/conversion.pyi rename to django-stubs/contrib/gis/db/models/sql/conversion.pyi diff --git a/typings/django/contrib/gis/feeds.pyi b/django-stubs/contrib/gis/feeds.pyi similarity index 100% rename from typings/django/contrib/gis/feeds.pyi rename to django-stubs/contrib/gis/feeds.pyi diff --git a/typings/django/contrib/gis/forms/__init__.pyi b/django-stubs/contrib/gis/forms/__init__.pyi similarity index 100% rename from typings/django/contrib/gis/forms/__init__.pyi rename to django-stubs/contrib/gis/forms/__init__.pyi diff --git a/typings/django/contrib/gis/forms/fields.pyi b/django-stubs/contrib/gis/forms/fields.pyi similarity index 100% rename from typings/django/contrib/gis/forms/fields.pyi rename to django-stubs/contrib/gis/forms/fields.pyi diff --git a/typings/django/contrib/gis/forms/widgets.pyi b/django-stubs/contrib/gis/forms/widgets.pyi similarity index 100% rename from typings/django/contrib/gis/forms/widgets.pyi rename to django-stubs/contrib/gis/forms/widgets.pyi diff --git a/typings/django/contrib/gis/gdal/__init__.pyi b/django-stubs/contrib/gis/gdal/__init__.pyi similarity index 100% rename from typings/django/contrib/gis/gdal/__init__.pyi rename to django-stubs/contrib/gis/gdal/__init__.pyi diff --git a/typings/django/contrib/gis/gdal/base.pyi b/django-stubs/contrib/gis/gdal/base.pyi similarity index 100% rename from typings/django/contrib/gis/gdal/base.pyi rename to django-stubs/contrib/gis/gdal/base.pyi diff --git a/typings/django/contrib/gis/gdal/datasource.pyi b/django-stubs/contrib/gis/gdal/datasource.pyi similarity index 100% rename from typings/django/contrib/gis/gdal/datasource.pyi rename to django-stubs/contrib/gis/gdal/datasource.pyi diff --git a/typings/django/contrib/gis/gdal/driver.pyi b/django-stubs/contrib/gis/gdal/driver.pyi similarity index 100% rename from typings/django/contrib/gis/gdal/driver.pyi rename to django-stubs/contrib/gis/gdal/driver.pyi diff --git a/typings/django/contrib/gis/gdal/envelope.pyi b/django-stubs/contrib/gis/gdal/envelope.pyi similarity index 100% rename from typings/django/contrib/gis/gdal/envelope.pyi rename to django-stubs/contrib/gis/gdal/envelope.pyi diff --git a/typings/django/contrib/gis/gdal/error.pyi b/django-stubs/contrib/gis/gdal/error.pyi similarity index 100% rename from typings/django/contrib/gis/gdal/error.pyi rename to django-stubs/contrib/gis/gdal/error.pyi diff --git a/typings/django/contrib/gis/gdal/feature.pyi b/django-stubs/contrib/gis/gdal/feature.pyi similarity index 100% rename from typings/django/contrib/gis/gdal/feature.pyi rename to django-stubs/contrib/gis/gdal/feature.pyi diff --git a/typings/django/contrib/gis/gdal/field.pyi b/django-stubs/contrib/gis/gdal/field.pyi similarity index 100% rename from typings/django/contrib/gis/gdal/field.pyi rename to django-stubs/contrib/gis/gdal/field.pyi diff --git a/typings/django/contrib/gis/gdal/geometries.pyi b/django-stubs/contrib/gis/gdal/geometries.pyi similarity index 100% rename from typings/django/contrib/gis/gdal/geometries.pyi rename to django-stubs/contrib/gis/gdal/geometries.pyi diff --git a/typings/django/contrib/gis/gdal/geomtype.pyi b/django-stubs/contrib/gis/gdal/geomtype.pyi similarity index 100% rename from typings/django/contrib/gis/gdal/geomtype.pyi rename to django-stubs/contrib/gis/gdal/geomtype.pyi diff --git a/typings/django/contrib/gis/gdal/layer.pyi b/django-stubs/contrib/gis/gdal/layer.pyi similarity index 100% rename from typings/django/contrib/gis/gdal/layer.pyi rename to django-stubs/contrib/gis/gdal/layer.pyi diff --git a/typings/django/contrib/gis/gdal/libgdal.pyi b/django-stubs/contrib/gis/gdal/libgdal.pyi similarity index 100% rename from typings/django/contrib/gis/gdal/libgdal.pyi rename to django-stubs/contrib/gis/gdal/libgdal.pyi diff --git a/typings/django/contrib/gis/gdal/prototypes/__init__.pyi b/django-stubs/contrib/gis/gdal/prototypes/__init__.pyi similarity index 100% rename from typings/django/contrib/gis/gdal/prototypes/__init__.pyi rename to django-stubs/contrib/gis/gdal/prototypes/__init__.pyi diff --git a/typings/django/contrib/gis/gdal/prototypes/ds.pyi b/django-stubs/contrib/gis/gdal/prototypes/ds.pyi similarity index 100% rename from typings/django/contrib/gis/gdal/prototypes/ds.pyi rename to django-stubs/contrib/gis/gdal/prototypes/ds.pyi diff --git a/typings/django/contrib/gis/gdal/prototypes/errcheck.pyi b/django-stubs/contrib/gis/gdal/prototypes/errcheck.pyi similarity index 100% rename from typings/django/contrib/gis/gdal/prototypes/errcheck.pyi rename to django-stubs/contrib/gis/gdal/prototypes/errcheck.pyi diff --git a/typings/django/contrib/gis/gdal/prototypes/generation.pyi b/django-stubs/contrib/gis/gdal/prototypes/generation.pyi similarity index 100% rename from typings/django/contrib/gis/gdal/prototypes/generation.pyi rename to django-stubs/contrib/gis/gdal/prototypes/generation.pyi diff --git a/typings/django/contrib/gis/gdal/prototypes/geom.pyi b/django-stubs/contrib/gis/gdal/prototypes/geom.pyi similarity index 100% rename from typings/django/contrib/gis/gdal/prototypes/geom.pyi rename to django-stubs/contrib/gis/gdal/prototypes/geom.pyi diff --git a/typings/django/contrib/gis/gdal/prototypes/raster.pyi b/django-stubs/contrib/gis/gdal/prototypes/raster.pyi similarity index 100% rename from typings/django/contrib/gis/gdal/prototypes/raster.pyi rename to django-stubs/contrib/gis/gdal/prototypes/raster.pyi diff --git a/typings/django/contrib/gis/gdal/prototypes/srs.pyi b/django-stubs/contrib/gis/gdal/prototypes/srs.pyi similarity index 100% rename from typings/django/contrib/gis/gdal/prototypes/srs.pyi rename to django-stubs/contrib/gis/gdal/prototypes/srs.pyi diff --git a/typings/django/contrib/gis/gdal/raster/__init__.pyi b/django-stubs/contrib/gis/gdal/raster/__init__.pyi similarity index 100% rename from typings/django/contrib/gis/gdal/raster/__init__.pyi rename to django-stubs/contrib/gis/gdal/raster/__init__.pyi diff --git a/typings/django/contrib/gis/gdal/raster/band.pyi b/django-stubs/contrib/gis/gdal/raster/band.pyi similarity index 100% rename from typings/django/contrib/gis/gdal/raster/band.pyi rename to django-stubs/contrib/gis/gdal/raster/band.pyi diff --git a/typings/django/contrib/gis/gdal/raster/base.pyi b/django-stubs/contrib/gis/gdal/raster/base.pyi similarity index 100% rename from typings/django/contrib/gis/gdal/raster/base.pyi rename to django-stubs/contrib/gis/gdal/raster/base.pyi diff --git a/typings/django/contrib/gis/gdal/raster/const.pyi b/django-stubs/contrib/gis/gdal/raster/const.pyi similarity index 100% rename from typings/django/contrib/gis/gdal/raster/const.pyi rename to django-stubs/contrib/gis/gdal/raster/const.pyi diff --git a/typings/django/contrib/gis/gdal/raster/source.pyi b/django-stubs/contrib/gis/gdal/raster/source.pyi similarity index 100% rename from typings/django/contrib/gis/gdal/raster/source.pyi rename to django-stubs/contrib/gis/gdal/raster/source.pyi diff --git a/typings/django/contrib/gis/gdal/srs.pyi b/django-stubs/contrib/gis/gdal/srs.pyi similarity index 100% rename from typings/django/contrib/gis/gdal/srs.pyi rename to django-stubs/contrib/gis/gdal/srs.pyi diff --git a/typings/django/contrib/gis/geoip2/__init__.pyi b/django-stubs/contrib/gis/geoip2/__init__.pyi similarity index 100% rename from typings/django/contrib/gis/geoip2/__init__.pyi rename to django-stubs/contrib/gis/geoip2/__init__.pyi diff --git a/typings/django/contrib/gis/geoip2/base.pyi b/django-stubs/contrib/gis/geoip2/base.pyi similarity index 100% rename from typings/django/contrib/gis/geoip2/base.pyi rename to django-stubs/contrib/gis/geoip2/base.pyi diff --git a/typings/django/contrib/gis/geoip2/resources.pyi b/django-stubs/contrib/gis/geoip2/resources.pyi similarity index 100% rename from typings/django/contrib/gis/geoip2/resources.pyi rename to django-stubs/contrib/gis/geoip2/resources.pyi diff --git a/typings/django/contrib/gis/geometry.pyi b/django-stubs/contrib/gis/geometry.pyi similarity index 100% rename from typings/django/contrib/gis/geometry.pyi rename to django-stubs/contrib/gis/geometry.pyi diff --git a/typings/django/contrib/gis/geos/__init__.pyi b/django-stubs/contrib/gis/geos/__init__.pyi similarity index 100% rename from typings/django/contrib/gis/geos/__init__.pyi rename to django-stubs/contrib/gis/geos/__init__.pyi diff --git a/typings/django/contrib/gis/geos/base.pyi b/django-stubs/contrib/gis/geos/base.pyi similarity index 100% rename from typings/django/contrib/gis/geos/base.pyi rename to django-stubs/contrib/gis/geos/base.pyi diff --git a/typings/django/contrib/gis/geos/collections.pyi b/django-stubs/contrib/gis/geos/collections.pyi similarity index 100% rename from typings/django/contrib/gis/geos/collections.pyi rename to django-stubs/contrib/gis/geos/collections.pyi diff --git a/typings/django/contrib/gis/geos/coordseq.pyi b/django-stubs/contrib/gis/geos/coordseq.pyi similarity index 100% rename from typings/django/contrib/gis/geos/coordseq.pyi rename to django-stubs/contrib/gis/geos/coordseq.pyi diff --git a/typings/django/contrib/gis/geos/error.pyi b/django-stubs/contrib/gis/geos/error.pyi similarity index 100% rename from typings/django/contrib/gis/geos/error.pyi rename to django-stubs/contrib/gis/geos/error.pyi diff --git a/typings/django/contrib/gis/geos/factory.pyi b/django-stubs/contrib/gis/geos/factory.pyi similarity index 100% rename from typings/django/contrib/gis/geos/factory.pyi rename to django-stubs/contrib/gis/geos/factory.pyi diff --git a/typings/django/contrib/gis/geos/geometry.pyi b/django-stubs/contrib/gis/geos/geometry.pyi similarity index 100% rename from typings/django/contrib/gis/geos/geometry.pyi rename to django-stubs/contrib/gis/geos/geometry.pyi diff --git a/typings/django/contrib/gis/geos/io.pyi b/django-stubs/contrib/gis/geos/io.pyi similarity index 100% rename from typings/django/contrib/gis/geos/io.pyi rename to django-stubs/contrib/gis/geos/io.pyi diff --git a/typings/django/contrib/gis/geos/libgeos.pyi b/django-stubs/contrib/gis/geos/libgeos.pyi similarity index 100% rename from typings/django/contrib/gis/geos/libgeos.pyi rename to django-stubs/contrib/gis/geos/libgeos.pyi diff --git a/typings/django/contrib/gis/geos/linestring.pyi b/django-stubs/contrib/gis/geos/linestring.pyi similarity index 100% rename from typings/django/contrib/gis/geos/linestring.pyi rename to django-stubs/contrib/gis/geos/linestring.pyi diff --git a/typings/django/contrib/gis/geos/mutable_list.pyi b/django-stubs/contrib/gis/geos/mutable_list.pyi similarity index 100% rename from typings/django/contrib/gis/geos/mutable_list.pyi rename to django-stubs/contrib/gis/geos/mutable_list.pyi diff --git a/typings/django/contrib/gis/geos/point.pyi b/django-stubs/contrib/gis/geos/point.pyi similarity index 100% rename from typings/django/contrib/gis/geos/point.pyi rename to django-stubs/contrib/gis/geos/point.pyi diff --git a/typings/django/contrib/gis/geos/polygon.pyi b/django-stubs/contrib/gis/geos/polygon.pyi similarity index 100% rename from typings/django/contrib/gis/geos/polygon.pyi rename to django-stubs/contrib/gis/geos/polygon.pyi diff --git a/typings/django/contrib/gis/geos/prepared.pyi b/django-stubs/contrib/gis/geos/prepared.pyi similarity index 100% rename from typings/django/contrib/gis/geos/prepared.pyi rename to django-stubs/contrib/gis/geos/prepared.pyi diff --git a/typings/django/contrib/gis/geos/prototypes/__init__.pyi b/django-stubs/contrib/gis/geos/prototypes/__init__.pyi similarity index 100% rename from typings/django/contrib/gis/geos/prototypes/__init__.pyi rename to django-stubs/contrib/gis/geos/prototypes/__init__.pyi diff --git a/typings/django/contrib/gis/geos/prototypes/coordseq.pyi b/django-stubs/contrib/gis/geos/prototypes/coordseq.pyi similarity index 100% rename from typings/django/contrib/gis/geos/prototypes/coordseq.pyi rename to django-stubs/contrib/gis/geos/prototypes/coordseq.pyi diff --git a/typings/django/contrib/gis/geos/prototypes/errcheck.pyi b/django-stubs/contrib/gis/geos/prototypes/errcheck.pyi similarity index 100% rename from typings/django/contrib/gis/geos/prototypes/errcheck.pyi rename to django-stubs/contrib/gis/geos/prototypes/errcheck.pyi diff --git a/typings/django/contrib/gis/geos/prototypes/geom.pyi b/django-stubs/contrib/gis/geos/prototypes/geom.pyi similarity index 100% rename from typings/django/contrib/gis/geos/prototypes/geom.pyi rename to django-stubs/contrib/gis/geos/prototypes/geom.pyi diff --git a/typings/django/contrib/gis/geos/prototypes/io.pyi b/django-stubs/contrib/gis/geos/prototypes/io.pyi similarity index 100% rename from typings/django/contrib/gis/geos/prototypes/io.pyi rename to django-stubs/contrib/gis/geos/prototypes/io.pyi diff --git a/typings/django/contrib/gis/geos/prototypes/misc.pyi b/django-stubs/contrib/gis/geos/prototypes/misc.pyi similarity index 100% rename from typings/django/contrib/gis/geos/prototypes/misc.pyi rename to django-stubs/contrib/gis/geos/prototypes/misc.pyi diff --git a/typings/django/contrib/gis/geos/prototypes/predicates.pyi b/django-stubs/contrib/gis/geos/prototypes/predicates.pyi similarity index 100% rename from typings/django/contrib/gis/geos/prototypes/predicates.pyi rename to django-stubs/contrib/gis/geos/prototypes/predicates.pyi diff --git a/typings/django/contrib/gis/geos/prototypes/prepared.pyi b/django-stubs/contrib/gis/geos/prototypes/prepared.pyi similarity index 100% rename from typings/django/contrib/gis/geos/prototypes/prepared.pyi rename to django-stubs/contrib/gis/geos/prototypes/prepared.pyi diff --git a/typings/django/contrib/gis/geos/prototypes/threadsafe.pyi b/django-stubs/contrib/gis/geos/prototypes/threadsafe.pyi similarity index 100% rename from typings/django/contrib/gis/geos/prototypes/threadsafe.pyi rename to django-stubs/contrib/gis/geos/prototypes/threadsafe.pyi diff --git a/typings/django/contrib/gis/geos/prototypes/topology.pyi b/django-stubs/contrib/gis/geos/prototypes/topology.pyi similarity index 100% rename from typings/django/contrib/gis/geos/prototypes/topology.pyi rename to django-stubs/contrib/gis/geos/prototypes/topology.pyi diff --git a/typings/django/contrib/gis/measure.pyi b/django-stubs/contrib/gis/measure.pyi similarity index 100% rename from typings/django/contrib/gis/measure.pyi rename to django-stubs/contrib/gis/measure.pyi diff --git a/typings/django/contrib/gis/ptr.pyi b/django-stubs/contrib/gis/ptr.pyi similarity index 100% rename from typings/django/contrib/gis/ptr.pyi rename to django-stubs/contrib/gis/ptr.pyi diff --git a/typings/django/contrib/gis/serializers/__init__.pyi b/django-stubs/contrib/gis/serializers/__init__.pyi similarity index 100% rename from typings/django/contrib/gis/serializers/__init__.pyi rename to django-stubs/contrib/gis/serializers/__init__.pyi diff --git a/typings/django/contrib/gis/serializers/geojson.pyi b/django-stubs/contrib/gis/serializers/geojson.pyi similarity index 100% rename from typings/django/contrib/gis/serializers/geojson.pyi rename to django-stubs/contrib/gis/serializers/geojson.pyi diff --git a/typings/django/contrib/gis/shortcuts.pyi b/django-stubs/contrib/gis/shortcuts.pyi similarity index 100% rename from typings/django/contrib/gis/shortcuts.pyi rename to django-stubs/contrib/gis/shortcuts.pyi diff --git a/typings/django/contrib/gis/sitemaps/__init__.pyi b/django-stubs/contrib/gis/sitemaps/__init__.pyi similarity index 100% rename from typings/django/contrib/gis/sitemaps/__init__.pyi rename to django-stubs/contrib/gis/sitemaps/__init__.pyi diff --git a/typings/django/contrib/gis/sitemaps/kml.pyi b/django-stubs/contrib/gis/sitemaps/kml.pyi similarity index 100% rename from typings/django/contrib/gis/sitemaps/kml.pyi rename to django-stubs/contrib/gis/sitemaps/kml.pyi diff --git a/typings/django/contrib/gis/sitemaps/views.pyi b/django-stubs/contrib/gis/sitemaps/views.pyi similarity index 100% rename from typings/django/contrib/gis/sitemaps/views.pyi rename to django-stubs/contrib/gis/sitemaps/views.pyi diff --git a/typings/django/contrib/gis/utils/__init__.pyi b/django-stubs/contrib/gis/utils/__init__.pyi similarity index 100% rename from typings/django/contrib/gis/utils/__init__.pyi rename to django-stubs/contrib/gis/utils/__init__.pyi diff --git a/typings/django/contrib/gis/utils/layermapping.pyi b/django-stubs/contrib/gis/utils/layermapping.pyi similarity index 100% rename from typings/django/contrib/gis/utils/layermapping.pyi rename to django-stubs/contrib/gis/utils/layermapping.pyi diff --git a/typings/django/contrib/gis/utils/ogrinfo.pyi b/django-stubs/contrib/gis/utils/ogrinfo.pyi similarity index 100% rename from typings/django/contrib/gis/utils/ogrinfo.pyi rename to django-stubs/contrib/gis/utils/ogrinfo.pyi diff --git a/typings/django/contrib/gis/utils/ogrinspect.pyi b/django-stubs/contrib/gis/utils/ogrinspect.pyi similarity index 100% rename from typings/django/contrib/gis/utils/ogrinspect.pyi rename to django-stubs/contrib/gis/utils/ogrinspect.pyi diff --git a/typings/django/contrib/gis/utils/srs.pyi b/django-stubs/contrib/gis/utils/srs.pyi similarity index 100% rename from typings/django/contrib/gis/utils/srs.pyi rename to django-stubs/contrib/gis/utils/srs.pyi diff --git a/typings/django/contrib/gis/views.pyi b/django-stubs/contrib/gis/views.pyi similarity index 100% rename from typings/django/contrib/gis/views.pyi rename to django-stubs/contrib/gis/views.pyi diff --git a/typings/django/contrib/humanize/__init__.pyi b/django-stubs/contrib/humanize/__init__.pyi similarity index 100% rename from typings/django/contrib/humanize/__init__.pyi rename to django-stubs/contrib/humanize/__init__.pyi diff --git a/typings/django/contrib/humanize/apps.pyi b/django-stubs/contrib/humanize/apps.pyi similarity index 100% rename from typings/django/contrib/humanize/apps.pyi rename to django-stubs/contrib/humanize/apps.pyi diff --git a/typings/django/contrib/humanize/templatetags/__init__.pyi b/django-stubs/contrib/humanize/templatetags/__init__.pyi similarity index 100% rename from typings/django/contrib/humanize/templatetags/__init__.pyi rename to django-stubs/contrib/humanize/templatetags/__init__.pyi diff --git a/typings/django/contrib/humanize/templatetags/humanize.pyi b/django-stubs/contrib/humanize/templatetags/humanize.pyi similarity index 100% rename from typings/django/contrib/humanize/templatetags/humanize.pyi rename to django-stubs/contrib/humanize/templatetags/humanize.pyi diff --git a/typings/django/contrib/messages/__init__.pyi b/django-stubs/contrib/messages/__init__.pyi similarity index 100% rename from typings/django/contrib/messages/__init__.pyi rename to django-stubs/contrib/messages/__init__.pyi diff --git a/typings/django/contrib/messages/api.pyi b/django-stubs/contrib/messages/api.pyi similarity index 100% rename from typings/django/contrib/messages/api.pyi rename to django-stubs/contrib/messages/api.pyi diff --git a/typings/django/contrib/messages/apps.pyi b/django-stubs/contrib/messages/apps.pyi similarity index 100% rename from typings/django/contrib/messages/apps.pyi rename to django-stubs/contrib/messages/apps.pyi diff --git a/typings/django/contrib/messages/constants.pyi b/django-stubs/contrib/messages/constants.pyi similarity index 100% rename from typings/django/contrib/messages/constants.pyi rename to django-stubs/contrib/messages/constants.pyi diff --git a/typings/django/contrib/messages/context_processors.pyi b/django-stubs/contrib/messages/context_processors.pyi similarity index 100% rename from typings/django/contrib/messages/context_processors.pyi rename to django-stubs/contrib/messages/context_processors.pyi diff --git a/typings/django/contrib/messages/middleware.pyi b/django-stubs/contrib/messages/middleware.pyi similarity index 100% rename from typings/django/contrib/messages/middleware.pyi rename to django-stubs/contrib/messages/middleware.pyi diff --git a/typings/django/contrib/messages/storage/__init__.pyi b/django-stubs/contrib/messages/storage/__init__.pyi similarity index 100% rename from typings/django/contrib/messages/storage/__init__.pyi rename to django-stubs/contrib/messages/storage/__init__.pyi diff --git a/typings/django/contrib/messages/storage/base.pyi b/django-stubs/contrib/messages/storage/base.pyi similarity index 100% rename from typings/django/contrib/messages/storage/base.pyi rename to django-stubs/contrib/messages/storage/base.pyi diff --git a/typings/django/contrib/messages/storage/cookie.pyi b/django-stubs/contrib/messages/storage/cookie.pyi similarity index 100% rename from typings/django/contrib/messages/storage/cookie.pyi rename to django-stubs/contrib/messages/storage/cookie.pyi diff --git a/typings/django/contrib/messages/storage/fallback.pyi b/django-stubs/contrib/messages/storage/fallback.pyi similarity index 100% rename from typings/django/contrib/messages/storage/fallback.pyi rename to django-stubs/contrib/messages/storage/fallback.pyi diff --git a/typings/django/contrib/messages/storage/session.pyi b/django-stubs/contrib/messages/storage/session.pyi similarity index 100% rename from typings/django/contrib/messages/storage/session.pyi rename to django-stubs/contrib/messages/storage/session.pyi diff --git a/typings/django/contrib/messages/utils.pyi b/django-stubs/contrib/messages/utils.pyi similarity index 100% rename from typings/django/contrib/messages/utils.pyi rename to django-stubs/contrib/messages/utils.pyi diff --git a/typings/django/contrib/messages/views.pyi b/django-stubs/contrib/messages/views.pyi similarity index 100% rename from typings/django/contrib/messages/views.pyi rename to django-stubs/contrib/messages/views.pyi diff --git a/typings/django/contrib/postgres/__init__.pyi b/django-stubs/contrib/postgres/__init__.pyi similarity index 100% rename from typings/django/contrib/postgres/__init__.pyi rename to django-stubs/contrib/postgres/__init__.pyi diff --git a/typings/django/contrib/postgres/aggregates/__init__.pyi b/django-stubs/contrib/postgres/aggregates/__init__.pyi similarity index 100% rename from typings/django/contrib/postgres/aggregates/__init__.pyi rename to django-stubs/contrib/postgres/aggregates/__init__.pyi diff --git a/typings/django/contrib/postgres/aggregates/general.pyi b/django-stubs/contrib/postgres/aggregates/general.pyi similarity index 100% rename from typings/django/contrib/postgres/aggregates/general.pyi rename to django-stubs/contrib/postgres/aggregates/general.pyi diff --git a/typings/django/contrib/postgres/aggregates/mixins.pyi b/django-stubs/contrib/postgres/aggregates/mixins.pyi similarity index 100% rename from typings/django/contrib/postgres/aggregates/mixins.pyi rename to django-stubs/contrib/postgres/aggregates/mixins.pyi diff --git a/typings/django/contrib/postgres/aggregates/statistics.pyi b/django-stubs/contrib/postgres/aggregates/statistics.pyi similarity index 100% rename from typings/django/contrib/postgres/aggregates/statistics.pyi rename to django-stubs/contrib/postgres/aggregates/statistics.pyi diff --git a/typings/django/contrib/postgres/apps.pyi b/django-stubs/contrib/postgres/apps.pyi similarity index 100% rename from typings/django/contrib/postgres/apps.pyi rename to django-stubs/contrib/postgres/apps.pyi diff --git a/typings/django/contrib/postgres/constraints.pyi b/django-stubs/contrib/postgres/constraints.pyi similarity index 100% rename from typings/django/contrib/postgres/constraints.pyi rename to django-stubs/contrib/postgres/constraints.pyi diff --git a/typings/django/contrib/postgres/fields/__init__.pyi b/django-stubs/contrib/postgres/fields/__init__.pyi similarity index 100% rename from typings/django/contrib/postgres/fields/__init__.pyi rename to django-stubs/contrib/postgres/fields/__init__.pyi diff --git a/typings/django/contrib/postgres/fields/array.pyi b/django-stubs/contrib/postgres/fields/array.pyi similarity index 100% rename from typings/django/contrib/postgres/fields/array.pyi rename to django-stubs/contrib/postgres/fields/array.pyi diff --git a/typings/django/contrib/postgres/fields/citext.pyi b/django-stubs/contrib/postgres/fields/citext.pyi similarity index 100% rename from typings/django/contrib/postgres/fields/citext.pyi rename to django-stubs/contrib/postgres/fields/citext.pyi diff --git a/typings/django/contrib/postgres/fields/hstore.pyi b/django-stubs/contrib/postgres/fields/hstore.pyi similarity index 100% rename from typings/django/contrib/postgres/fields/hstore.pyi rename to django-stubs/contrib/postgres/fields/hstore.pyi diff --git a/typings/django/contrib/postgres/fields/jsonb.pyi b/django-stubs/contrib/postgres/fields/jsonb.pyi similarity index 100% rename from typings/django/contrib/postgres/fields/jsonb.pyi rename to django-stubs/contrib/postgres/fields/jsonb.pyi diff --git a/typings/django/contrib/postgres/fields/mixins.pyi b/django-stubs/contrib/postgres/fields/mixins.pyi similarity index 100% rename from typings/django/contrib/postgres/fields/mixins.pyi rename to django-stubs/contrib/postgres/fields/mixins.pyi diff --git a/typings/django/contrib/postgres/fields/ranges.pyi b/django-stubs/contrib/postgres/fields/ranges.pyi similarity index 100% rename from typings/django/contrib/postgres/fields/ranges.pyi rename to django-stubs/contrib/postgres/fields/ranges.pyi diff --git a/typings/django/contrib/postgres/fields/utils.pyi b/django-stubs/contrib/postgres/fields/utils.pyi similarity index 100% rename from typings/django/contrib/postgres/fields/utils.pyi rename to django-stubs/contrib/postgres/fields/utils.pyi diff --git a/typings/django/contrib/postgres/functions.pyi b/django-stubs/contrib/postgres/functions.pyi similarity index 100% rename from typings/django/contrib/postgres/functions.pyi rename to django-stubs/contrib/postgres/functions.pyi diff --git a/typings/django/contrib/postgres/indexes.pyi b/django-stubs/contrib/postgres/indexes.pyi similarity index 100% rename from typings/django/contrib/postgres/indexes.pyi rename to django-stubs/contrib/postgres/indexes.pyi diff --git a/typings/django/contrib/postgres/lookups.pyi b/django-stubs/contrib/postgres/lookups.pyi similarity index 100% rename from typings/django/contrib/postgres/lookups.pyi rename to django-stubs/contrib/postgres/lookups.pyi diff --git a/typings/django/contrib/postgres/operations.pyi b/django-stubs/contrib/postgres/operations.pyi similarity index 100% rename from typings/django/contrib/postgres/operations.pyi rename to django-stubs/contrib/postgres/operations.pyi diff --git a/typings/django/contrib/postgres/search.pyi b/django-stubs/contrib/postgres/search.pyi similarity index 100% rename from typings/django/contrib/postgres/search.pyi rename to django-stubs/contrib/postgres/search.pyi diff --git a/typings/django/contrib/postgres/serializers.pyi b/django-stubs/contrib/postgres/serializers.pyi similarity index 100% rename from typings/django/contrib/postgres/serializers.pyi rename to django-stubs/contrib/postgres/serializers.pyi diff --git a/typings/django/contrib/postgres/signals.pyi b/django-stubs/contrib/postgres/signals.pyi similarity index 100% rename from typings/django/contrib/postgres/signals.pyi rename to django-stubs/contrib/postgres/signals.pyi diff --git a/typings/django/contrib/postgres/utils.pyi b/django-stubs/contrib/postgres/utils.pyi similarity index 100% rename from typings/django/contrib/postgres/utils.pyi rename to django-stubs/contrib/postgres/utils.pyi diff --git a/typings/django/contrib/postgres/validators.pyi b/django-stubs/contrib/postgres/validators.pyi similarity index 100% rename from typings/django/contrib/postgres/validators.pyi rename to django-stubs/contrib/postgres/validators.pyi diff --git a/typings/django/contrib/redirects/__init__.pyi b/django-stubs/contrib/redirects/__init__.pyi similarity index 100% rename from typings/django/contrib/redirects/__init__.pyi rename to django-stubs/contrib/redirects/__init__.pyi diff --git a/typings/django/contrib/redirects/admin.pyi b/django-stubs/contrib/redirects/admin.pyi similarity index 100% rename from typings/django/contrib/redirects/admin.pyi rename to django-stubs/contrib/redirects/admin.pyi diff --git a/typings/django/contrib/redirects/apps.pyi b/django-stubs/contrib/redirects/apps.pyi similarity index 100% rename from typings/django/contrib/redirects/apps.pyi rename to django-stubs/contrib/redirects/apps.pyi diff --git a/typings/django/contrib/redirects/middleware.pyi b/django-stubs/contrib/redirects/middleware.pyi similarity index 100% rename from typings/django/contrib/redirects/middleware.pyi rename to django-stubs/contrib/redirects/middleware.pyi diff --git a/typings/django/contrib/redirects/migrations/__init__.pyi b/django-stubs/contrib/redirects/migrations/__init__.pyi similarity index 100% rename from typings/django/contrib/redirects/migrations/__init__.pyi rename to django-stubs/contrib/redirects/migrations/__init__.pyi diff --git a/typings/django/contrib/redirects/models.pyi b/django-stubs/contrib/redirects/models.pyi similarity index 100% rename from typings/django/contrib/redirects/models.pyi rename to django-stubs/contrib/redirects/models.pyi diff --git a/typings/django/contrib/sessions/__init__.pyi b/django-stubs/contrib/sessions/__init__.pyi similarity index 100% rename from typings/django/contrib/sessions/__init__.pyi rename to django-stubs/contrib/sessions/__init__.pyi diff --git a/typings/django/contrib/sessions/apps.pyi b/django-stubs/contrib/sessions/apps.pyi similarity index 100% rename from typings/django/contrib/sessions/apps.pyi rename to django-stubs/contrib/sessions/apps.pyi diff --git a/typings/django/contrib/sessions/backends/__init__.pyi b/django-stubs/contrib/sessions/backends/__init__.pyi similarity index 100% rename from typings/django/contrib/sessions/backends/__init__.pyi rename to django-stubs/contrib/sessions/backends/__init__.pyi diff --git a/typings/django/contrib/sessions/backends/base.pyi b/django-stubs/contrib/sessions/backends/base.pyi similarity index 100% rename from typings/django/contrib/sessions/backends/base.pyi rename to django-stubs/contrib/sessions/backends/base.pyi diff --git a/typings/django/contrib/sessions/backends/cache.pyi b/django-stubs/contrib/sessions/backends/cache.pyi similarity index 100% rename from typings/django/contrib/sessions/backends/cache.pyi rename to django-stubs/contrib/sessions/backends/cache.pyi diff --git a/typings/django/contrib/sessions/backends/cached_db.pyi b/django-stubs/contrib/sessions/backends/cached_db.pyi similarity index 100% rename from typings/django/contrib/sessions/backends/cached_db.pyi rename to django-stubs/contrib/sessions/backends/cached_db.pyi diff --git a/typings/django/contrib/sessions/backends/db.pyi b/django-stubs/contrib/sessions/backends/db.pyi similarity index 100% rename from typings/django/contrib/sessions/backends/db.pyi rename to django-stubs/contrib/sessions/backends/db.pyi diff --git a/typings/django/contrib/sessions/backends/file.pyi b/django-stubs/contrib/sessions/backends/file.pyi similarity index 100% rename from typings/django/contrib/sessions/backends/file.pyi rename to django-stubs/contrib/sessions/backends/file.pyi diff --git a/typings/django/contrib/sessions/backends/signed_cookies.pyi b/django-stubs/contrib/sessions/backends/signed_cookies.pyi similarity index 100% rename from typings/django/contrib/sessions/backends/signed_cookies.pyi rename to django-stubs/contrib/sessions/backends/signed_cookies.pyi diff --git a/typings/django/contrib/sessions/base_session.pyi b/django-stubs/contrib/sessions/base_session.pyi similarity index 100% rename from typings/django/contrib/sessions/base_session.pyi rename to django-stubs/contrib/sessions/base_session.pyi diff --git a/typings/django/contrib/sessions/exceptions.pyi b/django-stubs/contrib/sessions/exceptions.pyi similarity index 100% rename from typings/django/contrib/sessions/exceptions.pyi rename to django-stubs/contrib/sessions/exceptions.pyi diff --git a/typings/django/contrib/sessions/management/__init__.pyi b/django-stubs/contrib/sessions/management/__init__.pyi similarity index 100% rename from typings/django/contrib/sessions/management/__init__.pyi rename to django-stubs/contrib/sessions/management/__init__.pyi diff --git a/typings/django/contrib/sessions/management/commands/__init__.pyi b/django-stubs/contrib/sessions/management/commands/__init__.pyi similarity index 100% rename from typings/django/contrib/sessions/management/commands/__init__.pyi rename to django-stubs/contrib/sessions/management/commands/__init__.pyi diff --git a/typings/django/contrib/sessions/management/commands/clearsessions.pyi b/django-stubs/contrib/sessions/management/commands/clearsessions.pyi similarity index 100% rename from typings/django/contrib/sessions/management/commands/clearsessions.pyi rename to django-stubs/contrib/sessions/management/commands/clearsessions.pyi diff --git a/typings/django/contrib/sessions/middleware.pyi b/django-stubs/contrib/sessions/middleware.pyi similarity index 100% rename from typings/django/contrib/sessions/middleware.pyi rename to django-stubs/contrib/sessions/middleware.pyi diff --git a/typings/django/contrib/sessions/migrations/__init__.pyi b/django-stubs/contrib/sessions/migrations/__init__.pyi similarity index 100% rename from typings/django/contrib/sessions/migrations/__init__.pyi rename to django-stubs/contrib/sessions/migrations/__init__.pyi diff --git a/typings/django/contrib/sessions/models.pyi b/django-stubs/contrib/sessions/models.pyi similarity index 100% rename from typings/django/contrib/sessions/models.pyi rename to django-stubs/contrib/sessions/models.pyi diff --git a/typings/django/contrib/sessions/serializers.pyi b/django-stubs/contrib/sessions/serializers.pyi similarity index 100% rename from typings/django/contrib/sessions/serializers.pyi rename to django-stubs/contrib/sessions/serializers.pyi diff --git a/typings/django/contrib/sitemaps/__init__.pyi b/django-stubs/contrib/sitemaps/__init__.pyi similarity index 100% rename from typings/django/contrib/sitemaps/__init__.pyi rename to django-stubs/contrib/sitemaps/__init__.pyi diff --git a/typings/django/contrib/sitemaps/apps.pyi b/django-stubs/contrib/sitemaps/apps.pyi similarity index 100% rename from typings/django/contrib/sitemaps/apps.pyi rename to django-stubs/contrib/sitemaps/apps.pyi diff --git a/typings/django/contrib/sitemaps/management/__init__.pyi b/django-stubs/contrib/sitemaps/management/__init__.pyi similarity index 100% rename from typings/django/contrib/sitemaps/management/__init__.pyi rename to django-stubs/contrib/sitemaps/management/__init__.pyi diff --git a/typings/django/contrib/sitemaps/management/commands/__init__.pyi b/django-stubs/contrib/sitemaps/management/commands/__init__.pyi similarity index 100% rename from typings/django/contrib/sitemaps/management/commands/__init__.pyi rename to django-stubs/contrib/sitemaps/management/commands/__init__.pyi diff --git a/typings/django/contrib/sitemaps/management/commands/ping_google.pyi b/django-stubs/contrib/sitemaps/management/commands/ping_google.pyi similarity index 100% rename from typings/django/contrib/sitemaps/management/commands/ping_google.pyi rename to django-stubs/contrib/sitemaps/management/commands/ping_google.pyi diff --git a/typings/django/contrib/sitemaps/views.pyi b/django-stubs/contrib/sitemaps/views.pyi similarity index 100% rename from typings/django/contrib/sitemaps/views.pyi rename to django-stubs/contrib/sitemaps/views.pyi diff --git a/typings/django/contrib/sites/__init__.pyi b/django-stubs/contrib/sites/__init__.pyi similarity index 100% rename from typings/django/contrib/sites/__init__.pyi rename to django-stubs/contrib/sites/__init__.pyi diff --git a/typings/django/contrib/sites/admin.pyi b/django-stubs/contrib/sites/admin.pyi similarity index 100% rename from typings/django/contrib/sites/admin.pyi rename to django-stubs/contrib/sites/admin.pyi diff --git a/typings/django/contrib/sites/apps.pyi b/django-stubs/contrib/sites/apps.pyi similarity index 100% rename from typings/django/contrib/sites/apps.pyi rename to django-stubs/contrib/sites/apps.pyi diff --git a/typings/django/contrib/sites/management.pyi b/django-stubs/contrib/sites/management.pyi similarity index 100% rename from typings/django/contrib/sites/management.pyi rename to django-stubs/contrib/sites/management.pyi diff --git a/typings/django/contrib/sites/managers.pyi b/django-stubs/contrib/sites/managers.pyi similarity index 100% rename from typings/django/contrib/sites/managers.pyi rename to django-stubs/contrib/sites/managers.pyi diff --git a/typings/django/contrib/sites/middleware.pyi b/django-stubs/contrib/sites/middleware.pyi similarity index 100% rename from typings/django/contrib/sites/middleware.pyi rename to django-stubs/contrib/sites/middleware.pyi diff --git a/typings/django/contrib/sites/migrations/__init__.pyi b/django-stubs/contrib/sites/migrations/__init__.pyi similarity index 100% rename from typings/django/contrib/sites/migrations/__init__.pyi rename to django-stubs/contrib/sites/migrations/__init__.pyi diff --git a/typings/django/contrib/sites/models.pyi b/django-stubs/contrib/sites/models.pyi similarity index 100% rename from typings/django/contrib/sites/models.pyi rename to django-stubs/contrib/sites/models.pyi diff --git a/typings/django/contrib/sites/requests.pyi b/django-stubs/contrib/sites/requests.pyi similarity index 100% rename from typings/django/contrib/sites/requests.pyi rename to django-stubs/contrib/sites/requests.pyi diff --git a/typings/django/contrib/sites/shortcuts.pyi b/django-stubs/contrib/sites/shortcuts.pyi similarity index 100% rename from typings/django/contrib/sites/shortcuts.pyi rename to django-stubs/contrib/sites/shortcuts.pyi diff --git a/typings/django/contrib/staticfiles/__init__.pyi b/django-stubs/contrib/staticfiles/__init__.pyi similarity index 100% rename from typings/django/contrib/staticfiles/__init__.pyi rename to django-stubs/contrib/staticfiles/__init__.pyi diff --git a/typings/django/contrib/staticfiles/apps.pyi b/django-stubs/contrib/staticfiles/apps.pyi similarity index 100% rename from typings/django/contrib/staticfiles/apps.pyi rename to django-stubs/contrib/staticfiles/apps.pyi diff --git a/typings/django/contrib/staticfiles/checks.pyi b/django-stubs/contrib/staticfiles/checks.pyi similarity index 100% rename from typings/django/contrib/staticfiles/checks.pyi rename to django-stubs/contrib/staticfiles/checks.pyi diff --git a/typings/django/contrib/staticfiles/finders.pyi b/django-stubs/contrib/staticfiles/finders.pyi similarity index 100% rename from typings/django/contrib/staticfiles/finders.pyi rename to django-stubs/contrib/staticfiles/finders.pyi diff --git a/typings/django/contrib/staticfiles/handlers.pyi b/django-stubs/contrib/staticfiles/handlers.pyi similarity index 100% rename from typings/django/contrib/staticfiles/handlers.pyi rename to django-stubs/contrib/staticfiles/handlers.pyi diff --git a/typings/django/contrib/staticfiles/management/__init__.pyi b/django-stubs/contrib/staticfiles/management/__init__.pyi similarity index 100% rename from typings/django/contrib/staticfiles/management/__init__.pyi rename to django-stubs/contrib/staticfiles/management/__init__.pyi diff --git a/typings/django/contrib/staticfiles/management/commands/__init__.pyi b/django-stubs/contrib/staticfiles/management/commands/__init__.pyi similarity index 100% rename from typings/django/contrib/staticfiles/management/commands/__init__.pyi rename to django-stubs/contrib/staticfiles/management/commands/__init__.pyi diff --git a/typings/django/contrib/staticfiles/management/commands/collectstatic.pyi b/django-stubs/contrib/staticfiles/management/commands/collectstatic.pyi similarity index 100% rename from typings/django/contrib/staticfiles/management/commands/collectstatic.pyi rename to django-stubs/contrib/staticfiles/management/commands/collectstatic.pyi diff --git a/typings/django/contrib/staticfiles/management/commands/findstatic.pyi b/django-stubs/contrib/staticfiles/management/commands/findstatic.pyi similarity index 100% rename from typings/django/contrib/staticfiles/management/commands/findstatic.pyi rename to django-stubs/contrib/staticfiles/management/commands/findstatic.pyi diff --git a/typings/django/contrib/staticfiles/management/commands/runserver.pyi b/django-stubs/contrib/staticfiles/management/commands/runserver.pyi similarity index 100% rename from typings/django/contrib/staticfiles/management/commands/runserver.pyi rename to django-stubs/contrib/staticfiles/management/commands/runserver.pyi diff --git a/typings/django/contrib/staticfiles/storage.pyi b/django-stubs/contrib/staticfiles/storage.pyi similarity index 100% rename from typings/django/contrib/staticfiles/storage.pyi rename to django-stubs/contrib/staticfiles/storage.pyi diff --git a/typings/django/contrib/staticfiles/templatetags/__init__.pyi b/django-stubs/contrib/staticfiles/templatetags/__init__.pyi similarity index 100% rename from typings/django/contrib/staticfiles/templatetags/__init__.pyi rename to django-stubs/contrib/staticfiles/templatetags/__init__.pyi diff --git a/typings/django/contrib/staticfiles/templatetags/staticfiles.pyi b/django-stubs/contrib/staticfiles/templatetags/staticfiles.pyi similarity index 100% rename from typings/django/contrib/staticfiles/templatetags/staticfiles.pyi rename to django-stubs/contrib/staticfiles/templatetags/staticfiles.pyi diff --git a/typings/django/contrib/staticfiles/testing.pyi b/django-stubs/contrib/staticfiles/testing.pyi similarity index 100% rename from typings/django/contrib/staticfiles/testing.pyi rename to django-stubs/contrib/staticfiles/testing.pyi diff --git a/typings/django/contrib/staticfiles/urls.pyi b/django-stubs/contrib/staticfiles/urls.pyi similarity index 100% rename from typings/django/contrib/staticfiles/urls.pyi rename to django-stubs/contrib/staticfiles/urls.pyi diff --git a/typings/django/contrib/staticfiles/utils.pyi b/django-stubs/contrib/staticfiles/utils.pyi similarity index 100% rename from typings/django/contrib/staticfiles/utils.pyi rename to django-stubs/contrib/staticfiles/utils.pyi diff --git a/typings/django/contrib/staticfiles/views.pyi b/django-stubs/contrib/staticfiles/views.pyi similarity index 100% rename from typings/django/contrib/staticfiles/views.pyi rename to django-stubs/contrib/staticfiles/views.pyi diff --git a/typings/django/contrib/syndication/__init__.pyi b/django-stubs/contrib/syndication/__init__.pyi similarity index 100% rename from typings/django/contrib/syndication/__init__.pyi rename to django-stubs/contrib/syndication/__init__.pyi diff --git a/typings/django/contrib/syndication/apps.pyi b/django-stubs/contrib/syndication/apps.pyi similarity index 100% rename from typings/django/contrib/syndication/apps.pyi rename to django-stubs/contrib/syndication/apps.pyi diff --git a/typings/django/contrib/syndication/views.pyi b/django-stubs/contrib/syndication/views.pyi similarity index 100% rename from typings/django/contrib/syndication/views.pyi rename to django-stubs/contrib/syndication/views.pyi diff --git a/typings/django/core/__init__.pyi b/django-stubs/core/__init__.pyi similarity index 100% rename from typings/django/core/__init__.pyi rename to django-stubs/core/__init__.pyi diff --git a/typings/django/core/asgi.pyi b/django-stubs/core/asgi.pyi similarity index 100% rename from typings/django/core/asgi.pyi rename to django-stubs/core/asgi.pyi diff --git a/typings/django/core/cache/__init__.pyi b/django-stubs/core/cache/__init__.pyi similarity index 100% rename from typings/django/core/cache/__init__.pyi rename to django-stubs/core/cache/__init__.pyi diff --git a/typings/django/core/cache/backends/__init__.pyi b/django-stubs/core/cache/backends/__init__.pyi similarity index 100% rename from typings/django/core/cache/backends/__init__.pyi rename to django-stubs/core/cache/backends/__init__.pyi diff --git a/typings/django/core/cache/backends/base.pyi b/django-stubs/core/cache/backends/base.pyi similarity index 100% rename from typings/django/core/cache/backends/base.pyi rename to django-stubs/core/cache/backends/base.pyi diff --git a/typings/django/core/cache/backends/db.pyi b/django-stubs/core/cache/backends/db.pyi similarity index 100% rename from typings/django/core/cache/backends/db.pyi rename to django-stubs/core/cache/backends/db.pyi diff --git a/typings/django/core/cache/backends/dummy.pyi b/django-stubs/core/cache/backends/dummy.pyi similarity index 100% rename from typings/django/core/cache/backends/dummy.pyi rename to django-stubs/core/cache/backends/dummy.pyi diff --git a/typings/django/core/cache/backends/filebased.pyi b/django-stubs/core/cache/backends/filebased.pyi similarity index 100% rename from typings/django/core/cache/backends/filebased.pyi rename to django-stubs/core/cache/backends/filebased.pyi diff --git a/typings/django/core/cache/backends/locmem.pyi b/django-stubs/core/cache/backends/locmem.pyi similarity index 100% rename from typings/django/core/cache/backends/locmem.pyi rename to django-stubs/core/cache/backends/locmem.pyi diff --git a/typings/django/core/cache/backends/memcached.pyi b/django-stubs/core/cache/backends/memcached.pyi similarity index 100% rename from typings/django/core/cache/backends/memcached.pyi rename to django-stubs/core/cache/backends/memcached.pyi diff --git a/typings/django/core/cache/utils.pyi b/django-stubs/core/cache/utils.pyi similarity index 100% rename from typings/django/core/cache/utils.pyi rename to django-stubs/core/cache/utils.pyi diff --git a/typings/django/core/checks/__init__.pyi b/django-stubs/core/checks/__init__.pyi similarity index 100% rename from typings/django/core/checks/__init__.pyi rename to django-stubs/core/checks/__init__.pyi diff --git a/typings/django/core/checks/async_checks.pyi b/django-stubs/core/checks/async_checks.pyi similarity index 100% rename from typings/django/core/checks/async_checks.pyi rename to django-stubs/core/checks/async_checks.pyi diff --git a/typings/django/core/checks/caches.pyi b/django-stubs/core/checks/caches.pyi similarity index 100% rename from typings/django/core/checks/caches.pyi rename to django-stubs/core/checks/caches.pyi diff --git a/typings/django/core/checks/compatibility/__init__.pyi b/django-stubs/core/checks/compatibility/__init__.pyi similarity index 100% rename from typings/django/core/checks/compatibility/__init__.pyi rename to django-stubs/core/checks/compatibility/__init__.pyi diff --git a/typings/django/core/checks/database.pyi b/django-stubs/core/checks/database.pyi similarity index 100% rename from typings/django/core/checks/database.pyi rename to django-stubs/core/checks/database.pyi diff --git a/typings/django/core/checks/messages.pyi b/django-stubs/core/checks/messages.pyi similarity index 100% rename from typings/django/core/checks/messages.pyi rename to django-stubs/core/checks/messages.pyi diff --git a/typings/django/core/checks/model_checks.pyi b/django-stubs/core/checks/model_checks.pyi similarity index 100% rename from typings/django/core/checks/model_checks.pyi rename to django-stubs/core/checks/model_checks.pyi diff --git a/typings/django/core/checks/registry.pyi b/django-stubs/core/checks/registry.pyi similarity index 100% rename from typings/django/core/checks/registry.pyi rename to django-stubs/core/checks/registry.pyi diff --git a/typings/django/core/checks/security/__init__.pyi b/django-stubs/core/checks/security/__init__.pyi similarity index 100% rename from typings/django/core/checks/security/__init__.pyi rename to django-stubs/core/checks/security/__init__.pyi diff --git a/typings/django/core/checks/security/base.pyi b/django-stubs/core/checks/security/base.pyi similarity index 100% rename from typings/django/core/checks/security/base.pyi rename to django-stubs/core/checks/security/base.pyi diff --git a/typings/django/core/checks/security/csrf.pyi b/django-stubs/core/checks/security/csrf.pyi similarity index 100% rename from typings/django/core/checks/security/csrf.pyi rename to django-stubs/core/checks/security/csrf.pyi diff --git a/typings/django/core/checks/security/sessions.pyi b/django-stubs/core/checks/security/sessions.pyi similarity index 100% rename from typings/django/core/checks/security/sessions.pyi rename to django-stubs/core/checks/security/sessions.pyi diff --git a/typings/django/core/checks/templates.pyi b/django-stubs/core/checks/templates.pyi similarity index 100% rename from typings/django/core/checks/templates.pyi rename to django-stubs/core/checks/templates.pyi diff --git a/typings/django/core/checks/translation.pyi b/django-stubs/core/checks/translation.pyi similarity index 100% rename from typings/django/core/checks/translation.pyi rename to django-stubs/core/checks/translation.pyi diff --git a/typings/django/core/checks/urls.pyi b/django-stubs/core/checks/urls.pyi similarity index 100% rename from typings/django/core/checks/urls.pyi rename to django-stubs/core/checks/urls.pyi diff --git a/typings/django/core/exceptions.pyi b/django-stubs/core/exceptions.pyi similarity index 100% rename from typings/django/core/exceptions.pyi rename to django-stubs/core/exceptions.pyi diff --git a/typings/django/core/files/__init__.pyi b/django-stubs/core/files/__init__.pyi similarity index 100% rename from typings/django/core/files/__init__.pyi rename to django-stubs/core/files/__init__.pyi diff --git a/typings/django/core/files/base.pyi b/django-stubs/core/files/base.pyi similarity index 100% rename from typings/django/core/files/base.pyi rename to django-stubs/core/files/base.pyi diff --git a/typings/django/core/files/images.pyi b/django-stubs/core/files/images.pyi similarity index 100% rename from typings/django/core/files/images.pyi rename to django-stubs/core/files/images.pyi diff --git a/typings/django/core/files/locks.pyi b/django-stubs/core/files/locks.pyi similarity index 100% rename from typings/django/core/files/locks.pyi rename to django-stubs/core/files/locks.pyi diff --git a/typings/django/core/files/move.pyi b/django-stubs/core/files/move.pyi similarity index 100% rename from typings/django/core/files/move.pyi rename to django-stubs/core/files/move.pyi diff --git a/typings/django/core/files/storage.pyi b/django-stubs/core/files/storage.pyi similarity index 100% rename from typings/django/core/files/storage.pyi rename to django-stubs/core/files/storage.pyi diff --git a/typings/django/core/files/temp.pyi b/django-stubs/core/files/temp.pyi similarity index 100% rename from typings/django/core/files/temp.pyi rename to django-stubs/core/files/temp.pyi diff --git a/typings/django/core/files/uploadedfile.pyi b/django-stubs/core/files/uploadedfile.pyi similarity index 100% rename from typings/django/core/files/uploadedfile.pyi rename to django-stubs/core/files/uploadedfile.pyi diff --git a/typings/django/core/files/uploadhandler.pyi b/django-stubs/core/files/uploadhandler.pyi similarity index 100% rename from typings/django/core/files/uploadhandler.pyi rename to django-stubs/core/files/uploadhandler.pyi diff --git a/typings/django/core/files/utils.pyi b/django-stubs/core/files/utils.pyi similarity index 100% rename from typings/django/core/files/utils.pyi rename to django-stubs/core/files/utils.pyi diff --git a/typings/django/core/handlers/__init__.pyi b/django-stubs/core/handlers/__init__.pyi similarity index 100% rename from typings/django/core/handlers/__init__.pyi rename to django-stubs/core/handlers/__init__.pyi diff --git a/typings/django/core/handlers/asgi.pyi b/django-stubs/core/handlers/asgi.pyi similarity index 100% rename from typings/django/core/handlers/asgi.pyi rename to django-stubs/core/handlers/asgi.pyi diff --git a/typings/django/core/handlers/base.pyi b/django-stubs/core/handlers/base.pyi similarity index 100% rename from typings/django/core/handlers/base.pyi rename to django-stubs/core/handlers/base.pyi diff --git a/typings/django/core/handlers/exception.pyi b/django-stubs/core/handlers/exception.pyi similarity index 100% rename from typings/django/core/handlers/exception.pyi rename to django-stubs/core/handlers/exception.pyi diff --git a/typings/django/core/handlers/wsgi.pyi b/django-stubs/core/handlers/wsgi.pyi similarity index 100% rename from typings/django/core/handlers/wsgi.pyi rename to django-stubs/core/handlers/wsgi.pyi diff --git a/typings/django/core/mail/__init__.pyi b/django-stubs/core/mail/__init__.pyi similarity index 100% rename from typings/django/core/mail/__init__.pyi rename to django-stubs/core/mail/__init__.pyi diff --git a/typings/django/core/mail/backends/__init__.pyi b/django-stubs/core/mail/backends/__init__.pyi similarity index 100% rename from typings/django/core/mail/backends/__init__.pyi rename to django-stubs/core/mail/backends/__init__.pyi diff --git a/typings/django/core/mail/backends/base.pyi b/django-stubs/core/mail/backends/base.pyi similarity index 100% rename from typings/django/core/mail/backends/base.pyi rename to django-stubs/core/mail/backends/base.pyi diff --git a/typings/django/core/mail/backends/console.pyi b/django-stubs/core/mail/backends/console.pyi similarity index 100% rename from typings/django/core/mail/backends/console.pyi rename to django-stubs/core/mail/backends/console.pyi diff --git a/typings/django/core/mail/backends/dummy.pyi b/django-stubs/core/mail/backends/dummy.pyi similarity index 100% rename from typings/django/core/mail/backends/dummy.pyi rename to django-stubs/core/mail/backends/dummy.pyi diff --git a/typings/django/core/mail/backends/filebased.pyi b/django-stubs/core/mail/backends/filebased.pyi similarity index 100% rename from typings/django/core/mail/backends/filebased.pyi rename to django-stubs/core/mail/backends/filebased.pyi diff --git a/typings/django/core/mail/backends/locmem.pyi b/django-stubs/core/mail/backends/locmem.pyi similarity index 100% rename from typings/django/core/mail/backends/locmem.pyi rename to django-stubs/core/mail/backends/locmem.pyi diff --git a/typings/django/core/mail/backends/smtp.pyi b/django-stubs/core/mail/backends/smtp.pyi similarity index 100% rename from typings/django/core/mail/backends/smtp.pyi rename to django-stubs/core/mail/backends/smtp.pyi diff --git a/typings/django/core/mail/message.pyi b/django-stubs/core/mail/message.pyi similarity index 100% rename from typings/django/core/mail/message.pyi rename to django-stubs/core/mail/message.pyi diff --git a/typings/django/core/mail/utils.pyi b/django-stubs/core/mail/utils.pyi similarity index 100% rename from typings/django/core/mail/utils.pyi rename to django-stubs/core/mail/utils.pyi diff --git a/typings/django/core/management/__init__.pyi b/django-stubs/core/management/__init__.pyi similarity index 100% rename from typings/django/core/management/__init__.pyi rename to django-stubs/core/management/__init__.pyi diff --git a/typings/django/core/management/base.pyi b/django-stubs/core/management/base.pyi similarity index 100% rename from typings/django/core/management/base.pyi rename to django-stubs/core/management/base.pyi diff --git a/typings/django/core/management/color.pyi b/django-stubs/core/management/color.pyi similarity index 100% rename from typings/django/core/management/color.pyi rename to django-stubs/core/management/color.pyi diff --git a/typings/django/core/management/commands/__init__.pyi b/django-stubs/core/management/commands/__init__.pyi similarity index 100% rename from typings/django/core/management/commands/__init__.pyi rename to django-stubs/core/management/commands/__init__.pyi diff --git a/typings/django/core/management/commands/check.pyi b/django-stubs/core/management/commands/check.pyi similarity index 100% rename from typings/django/core/management/commands/check.pyi rename to django-stubs/core/management/commands/check.pyi diff --git a/typings/django/core/management/commands/compilemessages.pyi b/django-stubs/core/management/commands/compilemessages.pyi similarity index 100% rename from typings/django/core/management/commands/compilemessages.pyi rename to django-stubs/core/management/commands/compilemessages.pyi diff --git a/typings/django/core/management/commands/createcachetable.pyi b/django-stubs/core/management/commands/createcachetable.pyi similarity index 100% rename from typings/django/core/management/commands/createcachetable.pyi rename to django-stubs/core/management/commands/createcachetable.pyi diff --git a/typings/django/core/management/commands/dbshell.pyi b/django-stubs/core/management/commands/dbshell.pyi similarity index 100% rename from typings/django/core/management/commands/dbshell.pyi rename to django-stubs/core/management/commands/dbshell.pyi diff --git a/typings/django/core/management/commands/diffsettings.pyi b/django-stubs/core/management/commands/diffsettings.pyi similarity index 100% rename from typings/django/core/management/commands/diffsettings.pyi rename to django-stubs/core/management/commands/diffsettings.pyi diff --git a/typings/django/core/management/commands/dumpdata.pyi b/django-stubs/core/management/commands/dumpdata.pyi similarity index 100% rename from typings/django/core/management/commands/dumpdata.pyi rename to django-stubs/core/management/commands/dumpdata.pyi diff --git a/typings/django/core/management/commands/flush.pyi b/django-stubs/core/management/commands/flush.pyi similarity index 100% rename from typings/django/core/management/commands/flush.pyi rename to django-stubs/core/management/commands/flush.pyi diff --git a/typings/django/core/management/commands/inspectdb.pyi b/django-stubs/core/management/commands/inspectdb.pyi similarity index 100% rename from typings/django/core/management/commands/inspectdb.pyi rename to django-stubs/core/management/commands/inspectdb.pyi diff --git a/typings/django/core/management/commands/loaddata.pyi b/django-stubs/core/management/commands/loaddata.pyi similarity index 100% rename from typings/django/core/management/commands/loaddata.pyi rename to django-stubs/core/management/commands/loaddata.pyi diff --git a/typings/django/core/management/commands/makemessages.pyi b/django-stubs/core/management/commands/makemessages.pyi similarity index 100% rename from typings/django/core/management/commands/makemessages.pyi rename to django-stubs/core/management/commands/makemessages.pyi diff --git a/typings/django/core/management/commands/makemigrations.pyi b/django-stubs/core/management/commands/makemigrations.pyi similarity index 100% rename from typings/django/core/management/commands/makemigrations.pyi rename to django-stubs/core/management/commands/makemigrations.pyi diff --git a/typings/django/core/management/commands/migrate.pyi b/django-stubs/core/management/commands/migrate.pyi similarity index 100% rename from typings/django/core/management/commands/migrate.pyi rename to django-stubs/core/management/commands/migrate.pyi diff --git a/typings/django/core/management/commands/runserver.pyi b/django-stubs/core/management/commands/runserver.pyi similarity index 100% rename from typings/django/core/management/commands/runserver.pyi rename to django-stubs/core/management/commands/runserver.pyi diff --git a/typings/django/core/management/commands/sendtestemail.pyi b/django-stubs/core/management/commands/sendtestemail.pyi similarity index 100% rename from typings/django/core/management/commands/sendtestemail.pyi rename to django-stubs/core/management/commands/sendtestemail.pyi diff --git a/typings/django/core/management/commands/shell.pyi b/django-stubs/core/management/commands/shell.pyi similarity index 100% rename from typings/django/core/management/commands/shell.pyi rename to django-stubs/core/management/commands/shell.pyi diff --git a/typings/django/core/management/commands/showmigrations.pyi b/django-stubs/core/management/commands/showmigrations.pyi similarity index 100% rename from typings/django/core/management/commands/showmigrations.pyi rename to django-stubs/core/management/commands/showmigrations.pyi diff --git a/typings/django/core/management/commands/sqlflush.pyi b/django-stubs/core/management/commands/sqlflush.pyi similarity index 100% rename from typings/django/core/management/commands/sqlflush.pyi rename to django-stubs/core/management/commands/sqlflush.pyi diff --git a/typings/django/core/management/commands/sqlmigrate.pyi b/django-stubs/core/management/commands/sqlmigrate.pyi similarity index 100% rename from typings/django/core/management/commands/sqlmigrate.pyi rename to django-stubs/core/management/commands/sqlmigrate.pyi diff --git a/typings/django/core/management/commands/sqlsequencereset.pyi b/django-stubs/core/management/commands/sqlsequencereset.pyi similarity index 100% rename from typings/django/core/management/commands/sqlsequencereset.pyi rename to django-stubs/core/management/commands/sqlsequencereset.pyi diff --git a/typings/django/core/management/commands/squashmigrations.pyi b/django-stubs/core/management/commands/squashmigrations.pyi similarity index 100% rename from typings/django/core/management/commands/squashmigrations.pyi rename to django-stubs/core/management/commands/squashmigrations.pyi diff --git a/typings/django/core/management/commands/startapp.pyi b/django-stubs/core/management/commands/startapp.pyi similarity index 100% rename from typings/django/core/management/commands/startapp.pyi rename to django-stubs/core/management/commands/startapp.pyi diff --git a/typings/django/core/management/commands/startproject.pyi b/django-stubs/core/management/commands/startproject.pyi similarity index 100% rename from typings/django/core/management/commands/startproject.pyi rename to django-stubs/core/management/commands/startproject.pyi diff --git a/typings/django/core/management/commands/test.pyi b/django-stubs/core/management/commands/test.pyi similarity index 100% rename from typings/django/core/management/commands/test.pyi rename to django-stubs/core/management/commands/test.pyi diff --git a/typings/django/core/management/commands/testserver.pyi b/django-stubs/core/management/commands/testserver.pyi similarity index 100% rename from typings/django/core/management/commands/testserver.pyi rename to django-stubs/core/management/commands/testserver.pyi diff --git a/typings/django/core/management/sql.pyi b/django-stubs/core/management/sql.pyi similarity index 100% rename from typings/django/core/management/sql.pyi rename to django-stubs/core/management/sql.pyi diff --git a/typings/django/core/management/templates.pyi b/django-stubs/core/management/templates.pyi similarity index 100% rename from typings/django/core/management/templates.pyi rename to django-stubs/core/management/templates.pyi diff --git a/typings/django/core/management/utils.pyi b/django-stubs/core/management/utils.pyi similarity index 100% rename from typings/django/core/management/utils.pyi rename to django-stubs/core/management/utils.pyi diff --git a/typings/django/core/paginator.pyi b/django-stubs/core/paginator.pyi similarity index 100% rename from typings/django/core/paginator.pyi rename to django-stubs/core/paginator.pyi diff --git a/typings/django/core/serializers/__init__.pyi b/django-stubs/core/serializers/__init__.pyi similarity index 100% rename from typings/django/core/serializers/__init__.pyi rename to django-stubs/core/serializers/__init__.pyi diff --git a/typings/django/core/serializers/base.pyi b/django-stubs/core/serializers/base.pyi similarity index 100% rename from typings/django/core/serializers/base.pyi rename to django-stubs/core/serializers/base.pyi diff --git a/typings/django/core/serializers/json.pyi b/django-stubs/core/serializers/json.pyi similarity index 100% rename from typings/django/core/serializers/json.pyi rename to django-stubs/core/serializers/json.pyi diff --git a/typings/django/core/serializers/python.pyi b/django-stubs/core/serializers/python.pyi similarity index 100% rename from typings/django/core/serializers/python.pyi rename to django-stubs/core/serializers/python.pyi diff --git a/typings/django/core/serializers/pyyaml.pyi b/django-stubs/core/serializers/pyyaml.pyi similarity index 100% rename from typings/django/core/serializers/pyyaml.pyi rename to django-stubs/core/serializers/pyyaml.pyi diff --git a/typings/django/core/serializers/xml_serializer.pyi b/django-stubs/core/serializers/xml_serializer.pyi similarity index 100% rename from typings/django/core/serializers/xml_serializer.pyi rename to django-stubs/core/serializers/xml_serializer.pyi diff --git a/typings/django/core/servers/__init__.pyi b/django-stubs/core/servers/__init__.pyi similarity index 100% rename from typings/django/core/servers/__init__.pyi rename to django-stubs/core/servers/__init__.pyi diff --git a/typings/django/core/servers/basehttp.pyi b/django-stubs/core/servers/basehttp.pyi similarity index 100% rename from typings/django/core/servers/basehttp.pyi rename to django-stubs/core/servers/basehttp.pyi diff --git a/typings/django/core/signals.pyi b/django-stubs/core/signals.pyi similarity index 100% rename from typings/django/core/signals.pyi rename to django-stubs/core/signals.pyi diff --git a/typings/django/core/signing.pyi b/django-stubs/core/signing.pyi similarity index 100% rename from typings/django/core/signing.pyi rename to django-stubs/core/signing.pyi diff --git a/typings/django/core/validators.pyi b/django-stubs/core/validators.pyi similarity index 100% rename from typings/django/core/validators.pyi rename to django-stubs/core/validators.pyi diff --git a/typings/django/core/wsgi.pyi b/django-stubs/core/wsgi.pyi similarity index 100% rename from typings/django/core/wsgi.pyi rename to django-stubs/core/wsgi.pyi diff --git a/typings/django/db/__init__.pyi b/django-stubs/db/__init__.pyi similarity index 100% rename from typings/django/db/__init__.pyi rename to django-stubs/db/__init__.pyi diff --git a/typings/django/db/backends/__init__.pyi b/django-stubs/db/backends/__init__.pyi similarity index 100% rename from typings/django/db/backends/__init__.pyi rename to django-stubs/db/backends/__init__.pyi diff --git a/typings/django/db/backends/base/__init__.pyi b/django-stubs/db/backends/base/__init__.pyi similarity index 100% rename from typings/django/db/backends/base/__init__.pyi rename to django-stubs/db/backends/base/__init__.pyi diff --git a/typings/django/db/backends/base/base.pyi b/django-stubs/db/backends/base/base.pyi similarity index 100% rename from typings/django/db/backends/base/base.pyi rename to django-stubs/db/backends/base/base.pyi diff --git a/typings/django/db/backends/base/client.pyi b/django-stubs/db/backends/base/client.pyi similarity index 100% rename from typings/django/db/backends/base/client.pyi rename to django-stubs/db/backends/base/client.pyi diff --git a/typings/django/db/backends/base/creation.pyi b/django-stubs/db/backends/base/creation.pyi similarity index 100% rename from typings/django/db/backends/base/creation.pyi rename to django-stubs/db/backends/base/creation.pyi diff --git a/typings/django/db/backends/base/features.pyi b/django-stubs/db/backends/base/features.pyi similarity index 100% rename from typings/django/db/backends/base/features.pyi rename to django-stubs/db/backends/base/features.pyi diff --git a/typings/django/db/backends/base/introspection.pyi b/django-stubs/db/backends/base/introspection.pyi similarity index 100% rename from typings/django/db/backends/base/introspection.pyi rename to django-stubs/db/backends/base/introspection.pyi diff --git a/typings/django/db/backends/base/operations.pyi b/django-stubs/db/backends/base/operations.pyi similarity index 100% rename from typings/django/db/backends/base/operations.pyi rename to django-stubs/db/backends/base/operations.pyi diff --git a/typings/django/db/backends/base/schema.pyi b/django-stubs/db/backends/base/schema.pyi similarity index 100% rename from typings/django/db/backends/base/schema.pyi rename to django-stubs/db/backends/base/schema.pyi diff --git a/typings/django/db/backends/base/validation.pyi b/django-stubs/db/backends/base/validation.pyi similarity index 100% rename from typings/django/db/backends/base/validation.pyi rename to django-stubs/db/backends/base/validation.pyi diff --git a/typings/django/db/backends/ddl_references.pyi b/django-stubs/db/backends/ddl_references.pyi similarity index 100% rename from typings/django/db/backends/ddl_references.pyi rename to django-stubs/db/backends/ddl_references.pyi diff --git a/typings/django/db/backends/dummy/__init__.pyi b/django-stubs/db/backends/dummy/__init__.pyi similarity index 100% rename from typings/django/db/backends/dummy/__init__.pyi rename to django-stubs/db/backends/dummy/__init__.pyi diff --git a/typings/django/db/backends/dummy/base.pyi b/django-stubs/db/backends/dummy/base.pyi similarity index 100% rename from typings/django/db/backends/dummy/base.pyi rename to django-stubs/db/backends/dummy/base.pyi diff --git a/typings/django/db/backends/dummy/features.pyi b/django-stubs/db/backends/dummy/features.pyi similarity index 100% rename from typings/django/db/backends/dummy/features.pyi rename to django-stubs/db/backends/dummy/features.pyi diff --git a/typings/django/db/backends/mysql/__init__.pyi b/django-stubs/db/backends/mysql/__init__.pyi similarity index 100% rename from typings/django/db/backends/mysql/__init__.pyi rename to django-stubs/db/backends/mysql/__init__.pyi diff --git a/typings/django/db/backends/mysql/base.pyi b/django-stubs/db/backends/mysql/base.pyi similarity index 100% rename from typings/django/db/backends/mysql/base.pyi rename to django-stubs/db/backends/mysql/base.pyi diff --git a/typings/django/db/backends/mysql/client.pyi b/django-stubs/db/backends/mysql/client.pyi similarity index 100% rename from typings/django/db/backends/mysql/client.pyi rename to django-stubs/db/backends/mysql/client.pyi diff --git a/typings/django/db/backends/mysql/compiler.pyi b/django-stubs/db/backends/mysql/compiler.pyi similarity index 100% rename from typings/django/db/backends/mysql/compiler.pyi rename to django-stubs/db/backends/mysql/compiler.pyi diff --git a/typings/django/db/backends/mysql/creation.pyi b/django-stubs/db/backends/mysql/creation.pyi similarity index 100% rename from typings/django/db/backends/mysql/creation.pyi rename to django-stubs/db/backends/mysql/creation.pyi diff --git a/typings/django/db/backends/mysql/features.pyi b/django-stubs/db/backends/mysql/features.pyi similarity index 100% rename from typings/django/db/backends/mysql/features.pyi rename to django-stubs/db/backends/mysql/features.pyi diff --git a/typings/django/db/backends/mysql/introspection.pyi b/django-stubs/db/backends/mysql/introspection.pyi similarity index 100% rename from typings/django/db/backends/mysql/introspection.pyi rename to django-stubs/db/backends/mysql/introspection.pyi diff --git a/typings/django/db/backends/mysql/operations.pyi b/django-stubs/db/backends/mysql/operations.pyi similarity index 100% rename from typings/django/db/backends/mysql/operations.pyi rename to django-stubs/db/backends/mysql/operations.pyi diff --git a/typings/django/db/backends/mysql/schema.pyi b/django-stubs/db/backends/mysql/schema.pyi similarity index 100% rename from typings/django/db/backends/mysql/schema.pyi rename to django-stubs/db/backends/mysql/schema.pyi diff --git a/typings/django/db/backends/mysql/validation.pyi b/django-stubs/db/backends/mysql/validation.pyi similarity index 100% rename from typings/django/db/backends/mysql/validation.pyi rename to django-stubs/db/backends/mysql/validation.pyi diff --git a/typings/django/db/backends/oracle/__init__.pyi b/django-stubs/db/backends/oracle/__init__.pyi similarity index 100% rename from typings/django/db/backends/oracle/__init__.pyi rename to django-stubs/db/backends/oracle/__init__.pyi diff --git a/typings/django/db/backends/oracle/base.pyi b/django-stubs/db/backends/oracle/base.pyi similarity index 100% rename from typings/django/db/backends/oracle/base.pyi rename to django-stubs/db/backends/oracle/base.pyi diff --git a/typings/django/db/backends/oracle/client.pyi b/django-stubs/db/backends/oracle/client.pyi similarity index 100% rename from typings/django/db/backends/oracle/client.pyi rename to django-stubs/db/backends/oracle/client.pyi diff --git a/typings/django/db/backends/oracle/creation.pyi b/django-stubs/db/backends/oracle/creation.pyi similarity index 100% rename from typings/django/db/backends/oracle/creation.pyi rename to django-stubs/db/backends/oracle/creation.pyi diff --git a/typings/django/db/backends/oracle/features.pyi b/django-stubs/db/backends/oracle/features.pyi similarity index 100% rename from typings/django/db/backends/oracle/features.pyi rename to django-stubs/db/backends/oracle/features.pyi diff --git a/typings/django/db/backends/oracle/functions.pyi b/django-stubs/db/backends/oracle/functions.pyi similarity index 100% rename from typings/django/db/backends/oracle/functions.pyi rename to django-stubs/db/backends/oracle/functions.pyi diff --git a/typings/django/db/backends/oracle/introspection.pyi b/django-stubs/db/backends/oracle/introspection.pyi similarity index 100% rename from typings/django/db/backends/oracle/introspection.pyi rename to django-stubs/db/backends/oracle/introspection.pyi diff --git a/typings/django/db/backends/oracle/operations.pyi b/django-stubs/db/backends/oracle/operations.pyi similarity index 100% rename from typings/django/db/backends/oracle/operations.pyi rename to django-stubs/db/backends/oracle/operations.pyi diff --git a/typings/django/db/backends/oracle/schema.pyi b/django-stubs/db/backends/oracle/schema.pyi similarity index 100% rename from typings/django/db/backends/oracle/schema.pyi rename to django-stubs/db/backends/oracle/schema.pyi diff --git a/typings/django/db/backends/oracle/utils.pyi b/django-stubs/db/backends/oracle/utils.pyi similarity index 100% rename from typings/django/db/backends/oracle/utils.pyi rename to django-stubs/db/backends/oracle/utils.pyi diff --git a/typings/django/db/backends/oracle/validation.pyi b/django-stubs/db/backends/oracle/validation.pyi similarity index 100% rename from typings/django/db/backends/oracle/validation.pyi rename to django-stubs/db/backends/oracle/validation.pyi diff --git a/typings/django/db/backends/postgresql/__init__.pyi b/django-stubs/db/backends/postgresql/__init__.pyi similarity index 100% rename from typings/django/db/backends/postgresql/__init__.pyi rename to django-stubs/db/backends/postgresql/__init__.pyi diff --git a/typings/django/db/backends/postgresql/base.pyi b/django-stubs/db/backends/postgresql/base.pyi similarity index 100% rename from typings/django/db/backends/postgresql/base.pyi rename to django-stubs/db/backends/postgresql/base.pyi diff --git a/typings/django/db/backends/postgresql/client.pyi b/django-stubs/db/backends/postgresql/client.pyi similarity index 100% rename from typings/django/db/backends/postgresql/client.pyi rename to django-stubs/db/backends/postgresql/client.pyi diff --git a/typings/django/db/backends/postgresql/creation.pyi b/django-stubs/db/backends/postgresql/creation.pyi similarity index 100% rename from typings/django/db/backends/postgresql/creation.pyi rename to django-stubs/db/backends/postgresql/creation.pyi diff --git a/typings/django/db/backends/postgresql/features.pyi b/django-stubs/db/backends/postgresql/features.pyi similarity index 100% rename from typings/django/db/backends/postgresql/features.pyi rename to django-stubs/db/backends/postgresql/features.pyi diff --git a/typings/django/db/backends/postgresql/introspection.pyi b/django-stubs/db/backends/postgresql/introspection.pyi similarity index 100% rename from typings/django/db/backends/postgresql/introspection.pyi rename to django-stubs/db/backends/postgresql/introspection.pyi diff --git a/typings/django/db/backends/postgresql/operations.pyi b/django-stubs/db/backends/postgresql/operations.pyi similarity index 100% rename from typings/django/db/backends/postgresql/operations.pyi rename to django-stubs/db/backends/postgresql/operations.pyi diff --git a/typings/django/db/backends/postgresql/schema.pyi b/django-stubs/db/backends/postgresql/schema.pyi similarity index 100% rename from typings/django/db/backends/postgresql/schema.pyi rename to django-stubs/db/backends/postgresql/schema.pyi diff --git a/typings/django/db/backends/signals.pyi b/django-stubs/db/backends/signals.pyi similarity index 100% rename from typings/django/db/backends/signals.pyi rename to django-stubs/db/backends/signals.pyi diff --git a/typings/django/db/backends/sqlite3/__init__.pyi b/django-stubs/db/backends/sqlite3/__init__.pyi similarity index 100% rename from typings/django/db/backends/sqlite3/__init__.pyi rename to django-stubs/db/backends/sqlite3/__init__.pyi diff --git a/typings/django/db/backends/sqlite3/base.pyi b/django-stubs/db/backends/sqlite3/base.pyi similarity index 100% rename from typings/django/db/backends/sqlite3/base.pyi rename to django-stubs/db/backends/sqlite3/base.pyi diff --git a/typings/django/db/backends/sqlite3/client.pyi b/django-stubs/db/backends/sqlite3/client.pyi similarity index 100% rename from typings/django/db/backends/sqlite3/client.pyi rename to django-stubs/db/backends/sqlite3/client.pyi diff --git a/typings/django/db/backends/sqlite3/creation.pyi b/django-stubs/db/backends/sqlite3/creation.pyi similarity index 100% rename from typings/django/db/backends/sqlite3/creation.pyi rename to django-stubs/db/backends/sqlite3/creation.pyi diff --git a/typings/django/db/backends/sqlite3/features.pyi b/django-stubs/db/backends/sqlite3/features.pyi similarity index 100% rename from typings/django/db/backends/sqlite3/features.pyi rename to django-stubs/db/backends/sqlite3/features.pyi diff --git a/typings/django/db/backends/sqlite3/introspection.pyi b/django-stubs/db/backends/sqlite3/introspection.pyi similarity index 100% rename from typings/django/db/backends/sqlite3/introspection.pyi rename to django-stubs/db/backends/sqlite3/introspection.pyi diff --git a/typings/django/db/backends/sqlite3/operations.pyi b/django-stubs/db/backends/sqlite3/operations.pyi similarity index 100% rename from typings/django/db/backends/sqlite3/operations.pyi rename to django-stubs/db/backends/sqlite3/operations.pyi diff --git a/typings/django/db/backends/sqlite3/schema.pyi b/django-stubs/db/backends/sqlite3/schema.pyi similarity index 100% rename from typings/django/db/backends/sqlite3/schema.pyi rename to django-stubs/db/backends/sqlite3/schema.pyi diff --git a/typings/django/db/backends/utils.pyi b/django-stubs/db/backends/utils.pyi similarity index 100% rename from typings/django/db/backends/utils.pyi rename to django-stubs/db/backends/utils.pyi diff --git a/typings/django/db/migrations/__init__.pyi b/django-stubs/db/migrations/__init__.pyi similarity index 100% rename from typings/django/db/migrations/__init__.pyi rename to django-stubs/db/migrations/__init__.pyi diff --git a/typings/django/db/migrations/autodetector.pyi b/django-stubs/db/migrations/autodetector.pyi similarity index 100% rename from typings/django/db/migrations/autodetector.pyi rename to django-stubs/db/migrations/autodetector.pyi diff --git a/typings/django/db/migrations/exceptions.pyi b/django-stubs/db/migrations/exceptions.pyi similarity index 100% rename from typings/django/db/migrations/exceptions.pyi rename to django-stubs/db/migrations/exceptions.pyi diff --git a/typings/django/db/migrations/executor.pyi b/django-stubs/db/migrations/executor.pyi similarity index 100% rename from typings/django/db/migrations/executor.pyi rename to django-stubs/db/migrations/executor.pyi diff --git a/typings/django/db/migrations/graph.pyi b/django-stubs/db/migrations/graph.pyi similarity index 100% rename from typings/django/db/migrations/graph.pyi rename to django-stubs/db/migrations/graph.pyi diff --git a/typings/django/db/migrations/loader.pyi b/django-stubs/db/migrations/loader.pyi similarity index 100% rename from typings/django/db/migrations/loader.pyi rename to django-stubs/db/migrations/loader.pyi diff --git a/typings/django/db/migrations/migration.pyi b/django-stubs/db/migrations/migration.pyi similarity index 100% rename from typings/django/db/migrations/migration.pyi rename to django-stubs/db/migrations/migration.pyi diff --git a/typings/django/db/migrations/operations/__init__.pyi b/django-stubs/db/migrations/operations/__init__.pyi similarity index 100% rename from typings/django/db/migrations/operations/__init__.pyi rename to django-stubs/db/migrations/operations/__init__.pyi diff --git a/typings/django/db/migrations/operations/base.pyi b/django-stubs/db/migrations/operations/base.pyi similarity index 100% rename from typings/django/db/migrations/operations/base.pyi rename to django-stubs/db/migrations/operations/base.pyi diff --git a/typings/django/db/migrations/operations/fields.pyi b/django-stubs/db/migrations/operations/fields.pyi similarity index 100% rename from typings/django/db/migrations/operations/fields.pyi rename to django-stubs/db/migrations/operations/fields.pyi diff --git a/typings/django/db/migrations/operations/models.pyi b/django-stubs/db/migrations/operations/models.pyi similarity index 100% rename from typings/django/db/migrations/operations/models.pyi rename to django-stubs/db/migrations/operations/models.pyi diff --git a/typings/django/db/migrations/operations/special.pyi b/django-stubs/db/migrations/operations/special.pyi similarity index 100% rename from typings/django/db/migrations/operations/special.pyi rename to django-stubs/db/migrations/operations/special.pyi diff --git a/typings/django/db/migrations/operations/utils.pyi b/django-stubs/db/migrations/operations/utils.pyi similarity index 100% rename from typings/django/db/migrations/operations/utils.pyi rename to django-stubs/db/migrations/operations/utils.pyi diff --git a/typings/django/db/migrations/optimizer.pyi b/django-stubs/db/migrations/optimizer.pyi similarity index 100% rename from typings/django/db/migrations/optimizer.pyi rename to django-stubs/db/migrations/optimizer.pyi diff --git a/typings/django/db/migrations/questioner.pyi b/django-stubs/db/migrations/questioner.pyi similarity index 100% rename from typings/django/db/migrations/questioner.pyi rename to django-stubs/db/migrations/questioner.pyi diff --git a/typings/django/db/migrations/recorder.pyi b/django-stubs/db/migrations/recorder.pyi similarity index 100% rename from typings/django/db/migrations/recorder.pyi rename to django-stubs/db/migrations/recorder.pyi diff --git a/typings/django/db/migrations/serializer.pyi b/django-stubs/db/migrations/serializer.pyi similarity index 100% rename from typings/django/db/migrations/serializer.pyi rename to django-stubs/db/migrations/serializer.pyi diff --git a/typings/django/db/migrations/state.pyi b/django-stubs/db/migrations/state.pyi similarity index 100% rename from typings/django/db/migrations/state.pyi rename to django-stubs/db/migrations/state.pyi diff --git a/typings/django/db/migrations/topological_sort.pyi b/django-stubs/db/migrations/topological_sort.pyi similarity index 100% rename from typings/django/db/migrations/topological_sort.pyi rename to django-stubs/db/migrations/topological_sort.pyi diff --git a/typings/django/db/migrations/utils.pyi b/django-stubs/db/migrations/utils.pyi similarity index 100% rename from typings/django/db/migrations/utils.pyi rename to django-stubs/db/migrations/utils.pyi diff --git a/typings/django/db/migrations/writer.pyi b/django-stubs/db/migrations/writer.pyi similarity index 100% rename from typings/django/db/migrations/writer.pyi rename to django-stubs/db/migrations/writer.pyi diff --git a/typings/django/db/models/__init__.pyi b/django-stubs/db/models/__init__.pyi similarity index 100% rename from typings/django/db/models/__init__.pyi rename to django-stubs/db/models/__init__.pyi diff --git a/typings/django/db/models/aggregates.pyi b/django-stubs/db/models/aggregates.pyi similarity index 100% rename from typings/django/db/models/aggregates.pyi rename to django-stubs/db/models/aggregates.pyi diff --git a/typings/django/db/models/base.pyi b/django-stubs/db/models/base.pyi similarity index 100% rename from typings/django/db/models/base.pyi rename to django-stubs/db/models/base.pyi diff --git a/typings/django/db/models/constants.pyi b/django-stubs/db/models/constants.pyi similarity index 100% rename from typings/django/db/models/constants.pyi rename to django-stubs/db/models/constants.pyi diff --git a/typings/django/db/models/constraints.pyi b/django-stubs/db/models/constraints.pyi similarity index 100% rename from typings/django/db/models/constraints.pyi rename to django-stubs/db/models/constraints.pyi diff --git a/typings/django/db/models/deletion.pyi b/django-stubs/db/models/deletion.pyi similarity index 100% rename from typings/django/db/models/deletion.pyi rename to django-stubs/db/models/deletion.pyi diff --git a/typings/django/db/models/enums.pyi b/django-stubs/db/models/enums.pyi similarity index 100% rename from typings/django/db/models/enums.pyi rename to django-stubs/db/models/enums.pyi diff --git a/typings/django/db/models/expressions.pyi b/django-stubs/db/models/expressions.pyi similarity index 100% rename from typings/django/db/models/expressions.pyi rename to django-stubs/db/models/expressions.pyi diff --git a/typings/django/db/models/fields/__init__.pyi b/django-stubs/db/models/fields/__init__.pyi similarity index 100% rename from typings/django/db/models/fields/__init__.pyi rename to django-stubs/db/models/fields/__init__.pyi diff --git a/typings/django/db/models/fields/files.pyi b/django-stubs/db/models/fields/files.pyi similarity index 100% rename from typings/django/db/models/fields/files.pyi rename to django-stubs/db/models/fields/files.pyi diff --git a/typings/django/db/models/fields/json.pyi b/django-stubs/db/models/fields/json.pyi similarity index 100% rename from typings/django/db/models/fields/json.pyi rename to django-stubs/db/models/fields/json.pyi diff --git a/typings/django/db/models/fields/mixins.pyi b/django-stubs/db/models/fields/mixins.pyi similarity index 100% rename from typings/django/db/models/fields/mixins.pyi rename to django-stubs/db/models/fields/mixins.pyi diff --git a/typings/django/db/models/fields/proxy.pyi b/django-stubs/db/models/fields/proxy.pyi similarity index 100% rename from typings/django/db/models/fields/proxy.pyi rename to django-stubs/db/models/fields/proxy.pyi diff --git a/typings/django/db/models/fields/related.pyi b/django-stubs/db/models/fields/related.pyi similarity index 100% rename from typings/django/db/models/fields/related.pyi rename to django-stubs/db/models/fields/related.pyi diff --git a/typings/django/db/models/fields/related_descriptors.pyi b/django-stubs/db/models/fields/related_descriptors.pyi similarity index 100% rename from typings/django/db/models/fields/related_descriptors.pyi rename to django-stubs/db/models/fields/related_descriptors.pyi diff --git a/typings/django/db/models/fields/related_lookups.pyi b/django-stubs/db/models/fields/related_lookups.pyi similarity index 100% rename from typings/django/db/models/fields/related_lookups.pyi rename to django-stubs/db/models/fields/related_lookups.pyi diff --git a/typings/django/db/models/fields/reverse_related.pyi b/django-stubs/db/models/fields/reverse_related.pyi similarity index 100% rename from typings/django/db/models/fields/reverse_related.pyi rename to django-stubs/db/models/fields/reverse_related.pyi diff --git a/typings/django/db/models/functions/__init__.pyi b/django-stubs/db/models/functions/__init__.pyi similarity index 100% rename from typings/django/db/models/functions/__init__.pyi rename to django-stubs/db/models/functions/__init__.pyi diff --git a/typings/django/db/models/functions/comparison.pyi b/django-stubs/db/models/functions/comparison.pyi similarity index 100% rename from typings/django/db/models/functions/comparison.pyi rename to django-stubs/db/models/functions/comparison.pyi diff --git a/typings/django/db/models/functions/datetime.pyi b/django-stubs/db/models/functions/datetime.pyi similarity index 100% rename from typings/django/db/models/functions/datetime.pyi rename to django-stubs/db/models/functions/datetime.pyi diff --git a/typings/django/db/models/functions/math.pyi b/django-stubs/db/models/functions/math.pyi similarity index 100% rename from typings/django/db/models/functions/math.pyi rename to django-stubs/db/models/functions/math.pyi diff --git a/typings/django/db/models/functions/mixins.pyi b/django-stubs/db/models/functions/mixins.pyi similarity index 100% rename from typings/django/db/models/functions/mixins.pyi rename to django-stubs/db/models/functions/mixins.pyi diff --git a/typings/django/db/models/functions/text.pyi b/django-stubs/db/models/functions/text.pyi similarity index 100% rename from typings/django/db/models/functions/text.pyi rename to django-stubs/db/models/functions/text.pyi diff --git a/typings/django/db/models/functions/window.pyi b/django-stubs/db/models/functions/window.pyi similarity index 100% rename from typings/django/db/models/functions/window.pyi rename to django-stubs/db/models/functions/window.pyi diff --git a/typings/django/db/models/indexes.pyi b/django-stubs/db/models/indexes.pyi similarity index 100% rename from typings/django/db/models/indexes.pyi rename to django-stubs/db/models/indexes.pyi diff --git a/typings/django/db/models/lookups.pyi b/django-stubs/db/models/lookups.pyi similarity index 100% rename from typings/django/db/models/lookups.pyi rename to django-stubs/db/models/lookups.pyi diff --git a/typings/django/db/models/manager.pyi b/django-stubs/db/models/manager.pyi similarity index 100% rename from typings/django/db/models/manager.pyi rename to django-stubs/db/models/manager.pyi diff --git a/typings/django/db/models/options.pyi b/django-stubs/db/models/options.pyi similarity index 100% rename from typings/django/db/models/options.pyi rename to django-stubs/db/models/options.pyi diff --git a/typings/django/db/models/query.pyi b/django-stubs/db/models/query.pyi similarity index 100% rename from typings/django/db/models/query.pyi rename to django-stubs/db/models/query.pyi diff --git a/typings/django/db/models/query_utils.pyi b/django-stubs/db/models/query_utils.pyi similarity index 100% rename from typings/django/db/models/query_utils.pyi rename to django-stubs/db/models/query_utils.pyi diff --git a/typings/django/db/models/signals.pyi b/django-stubs/db/models/signals.pyi similarity index 100% rename from typings/django/db/models/signals.pyi rename to django-stubs/db/models/signals.pyi diff --git a/typings/django/db/models/sql/__init__.pyi b/django-stubs/db/models/sql/__init__.pyi similarity index 100% rename from typings/django/db/models/sql/__init__.pyi rename to django-stubs/db/models/sql/__init__.pyi diff --git a/typings/django/db/models/sql/compiler.pyi b/django-stubs/db/models/sql/compiler.pyi similarity index 100% rename from typings/django/db/models/sql/compiler.pyi rename to django-stubs/db/models/sql/compiler.pyi diff --git a/typings/django/db/models/sql/constants.pyi b/django-stubs/db/models/sql/constants.pyi similarity index 100% rename from typings/django/db/models/sql/constants.pyi rename to django-stubs/db/models/sql/constants.pyi diff --git a/typings/django/db/models/sql/datastructures.pyi b/django-stubs/db/models/sql/datastructures.pyi similarity index 100% rename from typings/django/db/models/sql/datastructures.pyi rename to django-stubs/db/models/sql/datastructures.pyi diff --git a/typings/django/db/models/sql/query.pyi b/django-stubs/db/models/sql/query.pyi similarity index 100% rename from typings/django/db/models/sql/query.pyi rename to django-stubs/db/models/sql/query.pyi diff --git a/typings/django/db/models/sql/subqueries.pyi b/django-stubs/db/models/sql/subqueries.pyi similarity index 100% rename from typings/django/db/models/sql/subqueries.pyi rename to django-stubs/db/models/sql/subqueries.pyi diff --git a/typings/django/db/models/sql/where.pyi b/django-stubs/db/models/sql/where.pyi similarity index 100% rename from typings/django/db/models/sql/where.pyi rename to django-stubs/db/models/sql/where.pyi diff --git a/typings/django/db/models/utils.pyi b/django-stubs/db/models/utils.pyi similarity index 100% rename from typings/django/db/models/utils.pyi rename to django-stubs/db/models/utils.pyi diff --git a/typings/django/db/transaction.pyi b/django-stubs/db/transaction.pyi similarity index 100% rename from typings/django/db/transaction.pyi rename to django-stubs/db/transaction.pyi diff --git a/typings/django/db/utils.pyi b/django-stubs/db/utils.pyi similarity index 100% rename from typings/django/db/utils.pyi rename to django-stubs/db/utils.pyi diff --git a/typings/django/dispatch/__init__.pyi b/django-stubs/dispatch/__init__.pyi similarity index 100% rename from typings/django/dispatch/__init__.pyi rename to django-stubs/dispatch/__init__.pyi diff --git a/typings/django/dispatch/dispatcher.pyi b/django-stubs/dispatch/dispatcher.pyi similarity index 100% rename from typings/django/dispatch/dispatcher.pyi rename to django-stubs/dispatch/dispatcher.pyi diff --git a/typings/django/forms/__init__.pyi b/django-stubs/forms/__init__.pyi similarity index 100% rename from typings/django/forms/__init__.pyi rename to django-stubs/forms/__init__.pyi diff --git a/typings/django/forms/boundfield.pyi b/django-stubs/forms/boundfield.pyi similarity index 100% rename from typings/django/forms/boundfield.pyi rename to django-stubs/forms/boundfield.pyi diff --git a/typings/django/forms/fields.pyi b/django-stubs/forms/fields.pyi similarity index 100% rename from typings/django/forms/fields.pyi rename to django-stubs/forms/fields.pyi diff --git a/typings/django/forms/forms.pyi b/django-stubs/forms/forms.pyi similarity index 100% rename from typings/django/forms/forms.pyi rename to django-stubs/forms/forms.pyi diff --git a/typings/django/forms/formsets.pyi b/django-stubs/forms/formsets.pyi similarity index 100% rename from typings/django/forms/formsets.pyi rename to django-stubs/forms/formsets.pyi diff --git a/typings/django/forms/models.pyi b/django-stubs/forms/models.pyi similarity index 100% rename from typings/django/forms/models.pyi rename to django-stubs/forms/models.pyi diff --git a/typings/django/forms/renderers.pyi b/django-stubs/forms/renderers.pyi similarity index 100% rename from typings/django/forms/renderers.pyi rename to django-stubs/forms/renderers.pyi diff --git a/typings/django/forms/utils.pyi b/django-stubs/forms/utils.pyi similarity index 100% rename from typings/django/forms/utils.pyi rename to django-stubs/forms/utils.pyi diff --git a/typings/django/forms/widgets.pyi b/django-stubs/forms/widgets.pyi similarity index 100% rename from typings/django/forms/widgets.pyi rename to django-stubs/forms/widgets.pyi diff --git a/typings/django/http/__init__.pyi b/django-stubs/http/__init__.pyi similarity index 100% rename from typings/django/http/__init__.pyi rename to django-stubs/http/__init__.pyi diff --git a/typings/django/http/cookie.pyi b/django-stubs/http/cookie.pyi similarity index 100% rename from typings/django/http/cookie.pyi rename to django-stubs/http/cookie.pyi diff --git a/typings/django/http/multipartparser.pyi b/django-stubs/http/multipartparser.pyi similarity index 100% rename from typings/django/http/multipartparser.pyi rename to django-stubs/http/multipartparser.pyi diff --git a/typings/django/http/request.pyi b/django-stubs/http/request.pyi similarity index 100% rename from typings/django/http/request.pyi rename to django-stubs/http/request.pyi diff --git a/typings/django/http/response.pyi b/django-stubs/http/response.pyi similarity index 100% rename from typings/django/http/response.pyi rename to django-stubs/http/response.pyi diff --git a/typings/django/middleware/__init__.pyi b/django-stubs/middleware/__init__.pyi similarity index 100% rename from typings/django/middleware/__init__.pyi rename to django-stubs/middleware/__init__.pyi diff --git a/typings/django/middleware/cache.pyi b/django-stubs/middleware/cache.pyi similarity index 100% rename from typings/django/middleware/cache.pyi rename to django-stubs/middleware/cache.pyi diff --git a/typings/django/middleware/clickjacking.pyi b/django-stubs/middleware/clickjacking.pyi similarity index 100% rename from typings/django/middleware/clickjacking.pyi rename to django-stubs/middleware/clickjacking.pyi diff --git a/typings/django/middleware/common.pyi b/django-stubs/middleware/common.pyi similarity index 100% rename from typings/django/middleware/common.pyi rename to django-stubs/middleware/common.pyi diff --git a/typings/django/middleware/csrf.pyi b/django-stubs/middleware/csrf.pyi similarity index 100% rename from typings/django/middleware/csrf.pyi rename to django-stubs/middleware/csrf.pyi diff --git a/typings/django/middleware/gzip.pyi b/django-stubs/middleware/gzip.pyi similarity index 100% rename from typings/django/middleware/gzip.pyi rename to django-stubs/middleware/gzip.pyi diff --git a/typings/django/middleware/http.pyi b/django-stubs/middleware/http.pyi similarity index 100% rename from typings/django/middleware/http.pyi rename to django-stubs/middleware/http.pyi diff --git a/typings/django/middleware/locale.pyi b/django-stubs/middleware/locale.pyi similarity index 100% rename from typings/django/middleware/locale.pyi rename to django-stubs/middleware/locale.pyi diff --git a/typings/django/middleware/security.pyi b/django-stubs/middleware/security.pyi similarity index 100% rename from typings/django/middleware/security.pyi rename to django-stubs/middleware/security.pyi diff --git a/typings/django/shortcuts.pyi b/django-stubs/shortcuts.pyi similarity index 100% rename from typings/django/shortcuts.pyi rename to django-stubs/shortcuts.pyi diff --git a/typings/django/template/__init__.pyi b/django-stubs/template/__init__.pyi similarity index 100% rename from typings/django/template/__init__.pyi rename to django-stubs/template/__init__.pyi diff --git a/typings/django/template/backends/__init__.pyi b/django-stubs/template/backends/__init__.pyi similarity index 100% rename from typings/django/template/backends/__init__.pyi rename to django-stubs/template/backends/__init__.pyi diff --git a/typings/django/template/backends/base.pyi b/django-stubs/template/backends/base.pyi similarity index 100% rename from typings/django/template/backends/base.pyi rename to django-stubs/template/backends/base.pyi diff --git a/typings/django/template/backends/django.pyi b/django-stubs/template/backends/django.pyi similarity index 100% rename from typings/django/template/backends/django.pyi rename to django-stubs/template/backends/django.pyi diff --git a/typings/django/template/backends/dummy.pyi b/django-stubs/template/backends/dummy.pyi similarity index 100% rename from typings/django/template/backends/dummy.pyi rename to django-stubs/template/backends/dummy.pyi diff --git a/typings/django/template/backends/jinja2.pyi b/django-stubs/template/backends/jinja2.pyi similarity index 100% rename from typings/django/template/backends/jinja2.pyi rename to django-stubs/template/backends/jinja2.pyi diff --git a/typings/django/template/backends/utils.pyi b/django-stubs/template/backends/utils.pyi similarity index 100% rename from typings/django/template/backends/utils.pyi rename to django-stubs/template/backends/utils.pyi diff --git a/typings/django/template/base.pyi b/django-stubs/template/base.pyi similarity index 100% rename from typings/django/template/base.pyi rename to django-stubs/template/base.pyi diff --git a/typings/django/template/context.pyi b/django-stubs/template/context.pyi similarity index 100% rename from typings/django/template/context.pyi rename to django-stubs/template/context.pyi diff --git a/typings/django/template/context_processors.pyi b/django-stubs/template/context_processors.pyi similarity index 100% rename from typings/django/template/context_processors.pyi rename to django-stubs/template/context_processors.pyi diff --git a/typings/django/template/defaultfilters.pyi b/django-stubs/template/defaultfilters.pyi similarity index 100% rename from typings/django/template/defaultfilters.pyi rename to django-stubs/template/defaultfilters.pyi diff --git a/typings/django/template/defaulttags.pyi b/django-stubs/template/defaulttags.pyi similarity index 100% rename from typings/django/template/defaulttags.pyi rename to django-stubs/template/defaulttags.pyi diff --git a/typings/django/template/engine.pyi b/django-stubs/template/engine.pyi similarity index 100% rename from typings/django/template/engine.pyi rename to django-stubs/template/engine.pyi diff --git a/typings/django/template/exceptions.pyi b/django-stubs/template/exceptions.pyi similarity index 100% rename from typings/django/template/exceptions.pyi rename to django-stubs/template/exceptions.pyi diff --git a/typings/django/template/library.pyi b/django-stubs/template/library.pyi similarity index 100% rename from typings/django/template/library.pyi rename to django-stubs/template/library.pyi diff --git a/typings/django/template/loader.pyi b/django-stubs/template/loader.pyi similarity index 100% rename from typings/django/template/loader.pyi rename to django-stubs/template/loader.pyi diff --git a/typings/django/template/loader_tags.pyi b/django-stubs/template/loader_tags.pyi similarity index 100% rename from typings/django/template/loader_tags.pyi rename to django-stubs/template/loader_tags.pyi diff --git a/typings/django/template/loaders/__init__.pyi b/django-stubs/template/loaders/__init__.pyi similarity index 100% rename from typings/django/template/loaders/__init__.pyi rename to django-stubs/template/loaders/__init__.pyi diff --git a/typings/django/template/loaders/app_directories.pyi b/django-stubs/template/loaders/app_directories.pyi similarity index 100% rename from typings/django/template/loaders/app_directories.pyi rename to django-stubs/template/loaders/app_directories.pyi diff --git a/typings/django/template/loaders/base.pyi b/django-stubs/template/loaders/base.pyi similarity index 100% rename from typings/django/template/loaders/base.pyi rename to django-stubs/template/loaders/base.pyi diff --git a/typings/django/template/loaders/cached.pyi b/django-stubs/template/loaders/cached.pyi similarity index 100% rename from typings/django/template/loaders/cached.pyi rename to django-stubs/template/loaders/cached.pyi diff --git a/typings/django/template/loaders/filesystem.pyi b/django-stubs/template/loaders/filesystem.pyi similarity index 100% rename from typings/django/template/loaders/filesystem.pyi rename to django-stubs/template/loaders/filesystem.pyi diff --git a/typings/django/template/loaders/locmem.pyi b/django-stubs/template/loaders/locmem.pyi similarity index 100% rename from typings/django/template/loaders/locmem.pyi rename to django-stubs/template/loaders/locmem.pyi diff --git a/typings/django/template/response.pyi b/django-stubs/template/response.pyi similarity index 100% rename from typings/django/template/response.pyi rename to django-stubs/template/response.pyi diff --git a/typings/django/template/smartif.pyi b/django-stubs/template/smartif.pyi similarity index 100% rename from typings/django/template/smartif.pyi rename to django-stubs/template/smartif.pyi diff --git a/typings/django/template/utils.pyi b/django-stubs/template/utils.pyi similarity index 100% rename from typings/django/template/utils.pyi rename to django-stubs/template/utils.pyi diff --git a/typings/django/templatetags/__init__.pyi b/django-stubs/templatetags/__init__.pyi similarity index 100% rename from typings/django/templatetags/__init__.pyi rename to django-stubs/templatetags/__init__.pyi diff --git a/typings/django/templatetags/cache.pyi b/django-stubs/templatetags/cache.pyi similarity index 100% rename from typings/django/templatetags/cache.pyi rename to django-stubs/templatetags/cache.pyi diff --git a/typings/django/templatetags/i18n.pyi b/django-stubs/templatetags/i18n.pyi similarity index 100% rename from typings/django/templatetags/i18n.pyi rename to django-stubs/templatetags/i18n.pyi diff --git a/typings/django/templatetags/l10n.pyi b/django-stubs/templatetags/l10n.pyi similarity index 100% rename from typings/django/templatetags/l10n.pyi rename to django-stubs/templatetags/l10n.pyi diff --git a/typings/django/templatetags/static.pyi b/django-stubs/templatetags/static.pyi similarity index 100% rename from typings/django/templatetags/static.pyi rename to django-stubs/templatetags/static.pyi diff --git a/typings/django/templatetags/tz.pyi b/django-stubs/templatetags/tz.pyi similarity index 100% rename from typings/django/templatetags/tz.pyi rename to django-stubs/templatetags/tz.pyi diff --git a/typings/django/test/__init__.pyi b/django-stubs/test/__init__.pyi similarity index 100% rename from typings/django/test/__init__.pyi rename to django-stubs/test/__init__.pyi diff --git a/typings/django/test/client.pyi b/django-stubs/test/client.pyi similarity index 100% rename from typings/django/test/client.pyi rename to django-stubs/test/client.pyi diff --git a/typings/django/test/html.pyi b/django-stubs/test/html.pyi similarity index 100% rename from typings/django/test/html.pyi rename to django-stubs/test/html.pyi diff --git a/typings/django/test/runner.pyi b/django-stubs/test/runner.pyi similarity index 100% rename from typings/django/test/runner.pyi rename to django-stubs/test/runner.pyi diff --git a/typings/django/test/selenium.pyi b/django-stubs/test/selenium.pyi similarity index 100% rename from typings/django/test/selenium.pyi rename to django-stubs/test/selenium.pyi diff --git a/typings/django/test/signals.pyi b/django-stubs/test/signals.pyi similarity index 100% rename from typings/django/test/signals.pyi rename to django-stubs/test/signals.pyi diff --git a/typings/django/test/testcases.pyi b/django-stubs/test/testcases.pyi similarity index 100% rename from typings/django/test/testcases.pyi rename to django-stubs/test/testcases.pyi diff --git a/typings/django/test/utils.pyi b/django-stubs/test/utils.pyi similarity index 100% rename from typings/django/test/utils.pyi rename to django-stubs/test/utils.pyi diff --git a/typings/django/urls/__init__.pyi b/django-stubs/urls/__init__.pyi similarity index 100% rename from typings/django/urls/__init__.pyi rename to django-stubs/urls/__init__.pyi diff --git a/typings/django/urls/base.pyi b/django-stubs/urls/base.pyi similarity index 100% rename from typings/django/urls/base.pyi rename to django-stubs/urls/base.pyi diff --git a/typings/django/urls/conf.pyi b/django-stubs/urls/conf.pyi similarity index 100% rename from typings/django/urls/conf.pyi rename to django-stubs/urls/conf.pyi diff --git a/typings/django/urls/converters.pyi b/django-stubs/urls/converters.pyi similarity index 100% rename from typings/django/urls/converters.pyi rename to django-stubs/urls/converters.pyi diff --git a/typings/django/urls/exceptions.pyi b/django-stubs/urls/exceptions.pyi similarity index 100% rename from typings/django/urls/exceptions.pyi rename to django-stubs/urls/exceptions.pyi diff --git a/typings/django/urls/resolvers.pyi b/django-stubs/urls/resolvers.pyi similarity index 100% rename from typings/django/urls/resolvers.pyi rename to django-stubs/urls/resolvers.pyi diff --git a/typings/django/urls/utils.pyi b/django-stubs/urls/utils.pyi similarity index 100% rename from typings/django/urls/utils.pyi rename to django-stubs/urls/utils.pyi diff --git a/typings/django/utils/__init__.pyi b/django-stubs/utils/__init__.pyi similarity index 100% rename from typings/django/utils/__init__.pyi rename to django-stubs/utils/__init__.pyi diff --git a/typings/django/utils/_os.pyi b/django-stubs/utils/_os.pyi similarity index 100% rename from typings/django/utils/_os.pyi rename to django-stubs/utils/_os.pyi diff --git a/typings/django/utils/archive.pyi b/django-stubs/utils/archive.pyi similarity index 100% rename from typings/django/utils/archive.pyi rename to django-stubs/utils/archive.pyi diff --git a/typings/django/utils/asyncio.pyi b/django-stubs/utils/asyncio.pyi similarity index 100% rename from typings/django/utils/asyncio.pyi rename to django-stubs/utils/asyncio.pyi diff --git a/typings/django/utils/autoreload.pyi b/django-stubs/utils/autoreload.pyi similarity index 100% rename from typings/django/utils/autoreload.pyi rename to django-stubs/utils/autoreload.pyi diff --git a/typings/django/utils/baseconv.pyi b/django-stubs/utils/baseconv.pyi similarity index 100% rename from typings/django/utils/baseconv.pyi rename to django-stubs/utils/baseconv.pyi diff --git a/typings/django/utils/cache.pyi b/django-stubs/utils/cache.pyi similarity index 100% rename from typings/django/utils/cache.pyi rename to django-stubs/utils/cache.pyi diff --git a/typings/django/utils/crypto.pyi b/django-stubs/utils/crypto.pyi similarity index 100% rename from typings/django/utils/crypto.pyi rename to django-stubs/utils/crypto.pyi diff --git a/typings/django/utils/datastructures.pyi b/django-stubs/utils/datastructures.pyi similarity index 100% rename from typings/django/utils/datastructures.pyi rename to django-stubs/utils/datastructures.pyi diff --git a/typings/django/utils/dateformat.pyi b/django-stubs/utils/dateformat.pyi similarity index 100% rename from typings/django/utils/dateformat.pyi rename to django-stubs/utils/dateformat.pyi diff --git a/typings/django/utils/dateparse.pyi b/django-stubs/utils/dateparse.pyi similarity index 100% rename from typings/django/utils/dateparse.pyi rename to django-stubs/utils/dateparse.pyi diff --git a/typings/django/utils/dates.pyi b/django-stubs/utils/dates.pyi similarity index 100% rename from typings/django/utils/dates.pyi rename to django-stubs/utils/dates.pyi diff --git a/typings/django/utils/datetime_safe.pyi b/django-stubs/utils/datetime_safe.pyi similarity index 100% rename from typings/django/utils/datetime_safe.pyi rename to django-stubs/utils/datetime_safe.pyi diff --git a/typings/django/utils/deconstruct.pyi b/django-stubs/utils/deconstruct.pyi similarity index 100% rename from typings/django/utils/deconstruct.pyi rename to django-stubs/utils/deconstruct.pyi diff --git a/typings/django/utils/decorators.pyi b/django-stubs/utils/decorators.pyi similarity index 100% rename from typings/django/utils/decorators.pyi rename to django-stubs/utils/decorators.pyi diff --git a/typings/django/utils/deprecation.pyi b/django-stubs/utils/deprecation.pyi similarity index 100% rename from typings/django/utils/deprecation.pyi rename to django-stubs/utils/deprecation.pyi diff --git a/typings/django/utils/duration.pyi b/django-stubs/utils/duration.pyi similarity index 100% rename from typings/django/utils/duration.pyi rename to django-stubs/utils/duration.pyi diff --git a/typings/django/utils/encoding.pyi b/django-stubs/utils/encoding.pyi similarity index 100% rename from typings/django/utils/encoding.pyi rename to django-stubs/utils/encoding.pyi diff --git a/typings/django/utils/feedgenerator.pyi b/django-stubs/utils/feedgenerator.pyi similarity index 100% rename from typings/django/utils/feedgenerator.pyi rename to django-stubs/utils/feedgenerator.pyi diff --git a/typings/django/utils/formats.pyi b/django-stubs/utils/formats.pyi similarity index 100% rename from typings/django/utils/formats.pyi rename to django-stubs/utils/formats.pyi diff --git a/typings/django/utils/functional.pyi b/django-stubs/utils/functional.pyi similarity index 100% rename from typings/django/utils/functional.pyi rename to django-stubs/utils/functional.pyi diff --git a/typings/django/utils/hashable.pyi b/django-stubs/utils/hashable.pyi similarity index 100% rename from typings/django/utils/hashable.pyi rename to django-stubs/utils/hashable.pyi diff --git a/typings/django/utils/html.pyi b/django-stubs/utils/html.pyi similarity index 100% rename from typings/django/utils/html.pyi rename to django-stubs/utils/html.pyi diff --git a/typings/django/utils/http.pyi b/django-stubs/utils/http.pyi similarity index 100% rename from typings/django/utils/http.pyi rename to django-stubs/utils/http.pyi diff --git a/typings/django/utils/inspect.pyi b/django-stubs/utils/inspect.pyi similarity index 100% rename from typings/django/utils/inspect.pyi rename to django-stubs/utils/inspect.pyi diff --git a/typings/django/utils/ipv6.pyi b/django-stubs/utils/ipv6.pyi similarity index 100% rename from typings/django/utils/ipv6.pyi rename to django-stubs/utils/ipv6.pyi diff --git a/typings/django/utils/itercompat.pyi b/django-stubs/utils/itercompat.pyi similarity index 100% rename from typings/django/utils/itercompat.pyi rename to django-stubs/utils/itercompat.pyi diff --git a/typings/django/utils/jslex.pyi b/django-stubs/utils/jslex.pyi similarity index 100% rename from typings/django/utils/jslex.pyi rename to django-stubs/utils/jslex.pyi diff --git a/typings/django/utils/log.pyi b/django-stubs/utils/log.pyi similarity index 100% rename from typings/django/utils/log.pyi rename to django-stubs/utils/log.pyi diff --git a/typings/django/utils/lorem_ipsum.pyi b/django-stubs/utils/lorem_ipsum.pyi similarity index 100% rename from typings/django/utils/lorem_ipsum.pyi rename to django-stubs/utils/lorem_ipsum.pyi diff --git a/typings/django/utils/module_loading.pyi b/django-stubs/utils/module_loading.pyi similarity index 100% rename from typings/django/utils/module_loading.pyi rename to django-stubs/utils/module_loading.pyi diff --git a/typings/django/utils/numberformat.pyi b/django-stubs/utils/numberformat.pyi similarity index 100% rename from typings/django/utils/numberformat.pyi rename to django-stubs/utils/numberformat.pyi diff --git a/typings/django/utils/regex_helper.pyi b/django-stubs/utils/regex_helper.pyi similarity index 100% rename from typings/django/utils/regex_helper.pyi rename to django-stubs/utils/regex_helper.pyi diff --git a/typings/django/utils/safestring.pyi b/django-stubs/utils/safestring.pyi similarity index 100% rename from typings/django/utils/safestring.pyi rename to django-stubs/utils/safestring.pyi diff --git a/typings/django/utils/six.pyi b/django-stubs/utils/six.pyi similarity index 100% rename from typings/django/utils/six.pyi rename to django-stubs/utils/six.pyi diff --git a/typings/django/utils/termcolors.pyi b/django-stubs/utils/termcolors.pyi similarity index 100% rename from typings/django/utils/termcolors.pyi rename to django-stubs/utils/termcolors.pyi diff --git a/typings/django/utils/text.pyi b/django-stubs/utils/text.pyi similarity index 100% rename from typings/django/utils/text.pyi rename to django-stubs/utils/text.pyi diff --git a/typings/django/utils/timesince.pyi b/django-stubs/utils/timesince.pyi similarity index 100% rename from typings/django/utils/timesince.pyi rename to django-stubs/utils/timesince.pyi diff --git a/typings/django/utils/timezone.pyi b/django-stubs/utils/timezone.pyi similarity index 100% rename from typings/django/utils/timezone.pyi rename to django-stubs/utils/timezone.pyi diff --git a/typings/django/utils/topological_sort.pyi b/django-stubs/utils/topological_sort.pyi similarity index 100% rename from typings/django/utils/topological_sort.pyi rename to django-stubs/utils/topological_sort.pyi diff --git a/typings/django/utils/translation/__init__.pyi b/django-stubs/utils/translation/__init__.pyi similarity index 100% rename from typings/django/utils/translation/__init__.pyi rename to django-stubs/utils/translation/__init__.pyi diff --git a/typings/django/utils/translation/reloader.pyi b/django-stubs/utils/translation/reloader.pyi similarity index 100% rename from typings/django/utils/translation/reloader.pyi rename to django-stubs/utils/translation/reloader.pyi diff --git a/typings/django/utils/translation/template.pyi b/django-stubs/utils/translation/template.pyi similarity index 100% rename from typings/django/utils/translation/template.pyi rename to django-stubs/utils/translation/template.pyi diff --git a/typings/django/utils/translation/trans_null.pyi b/django-stubs/utils/translation/trans_null.pyi similarity index 100% rename from typings/django/utils/translation/trans_null.pyi rename to django-stubs/utils/translation/trans_null.pyi diff --git a/typings/django/utils/translation/trans_real.pyi b/django-stubs/utils/translation/trans_real.pyi similarity index 100% rename from typings/django/utils/translation/trans_real.pyi rename to django-stubs/utils/translation/trans_real.pyi diff --git a/typings/django/utils/tree.pyi b/django-stubs/utils/tree.pyi similarity index 100% rename from typings/django/utils/tree.pyi rename to django-stubs/utils/tree.pyi diff --git a/typings/django/utils/version.pyi b/django-stubs/utils/version.pyi similarity index 100% rename from typings/django/utils/version.pyi rename to django-stubs/utils/version.pyi diff --git a/typings/django/utils/xmlutils.pyi b/django-stubs/utils/xmlutils.pyi similarity index 100% rename from typings/django/utils/xmlutils.pyi rename to django-stubs/utils/xmlutils.pyi diff --git a/typings/django/views/__init__.pyi b/django-stubs/views/__init__.pyi similarity index 100% rename from typings/django/views/__init__.pyi rename to django-stubs/views/__init__.pyi diff --git a/typings/django/views/csrf.pyi b/django-stubs/views/csrf.pyi similarity index 100% rename from typings/django/views/csrf.pyi rename to django-stubs/views/csrf.pyi diff --git a/typings/django/views/debug.pyi b/django-stubs/views/debug.pyi similarity index 100% rename from typings/django/views/debug.pyi rename to django-stubs/views/debug.pyi diff --git a/typings/django/views/decorators/__init__.pyi b/django-stubs/views/decorators/__init__.pyi similarity index 100% rename from typings/django/views/decorators/__init__.pyi rename to django-stubs/views/decorators/__init__.pyi diff --git a/typings/django/views/decorators/cache.pyi b/django-stubs/views/decorators/cache.pyi similarity index 100% rename from typings/django/views/decorators/cache.pyi rename to django-stubs/views/decorators/cache.pyi diff --git a/typings/django/views/decorators/clickjacking.pyi b/django-stubs/views/decorators/clickjacking.pyi similarity index 100% rename from typings/django/views/decorators/clickjacking.pyi rename to django-stubs/views/decorators/clickjacking.pyi diff --git a/typings/django/views/decorators/csrf.pyi b/django-stubs/views/decorators/csrf.pyi similarity index 100% rename from typings/django/views/decorators/csrf.pyi rename to django-stubs/views/decorators/csrf.pyi diff --git a/typings/django/views/decorators/debug.pyi b/django-stubs/views/decorators/debug.pyi similarity index 100% rename from typings/django/views/decorators/debug.pyi rename to django-stubs/views/decorators/debug.pyi diff --git a/typings/django/views/decorators/gzip.pyi b/django-stubs/views/decorators/gzip.pyi similarity index 100% rename from typings/django/views/decorators/gzip.pyi rename to django-stubs/views/decorators/gzip.pyi diff --git a/typings/django/views/decorators/http.pyi b/django-stubs/views/decorators/http.pyi similarity index 100% rename from typings/django/views/decorators/http.pyi rename to django-stubs/views/decorators/http.pyi diff --git a/typings/django/views/decorators/vary.pyi b/django-stubs/views/decorators/vary.pyi similarity index 100% rename from typings/django/views/decorators/vary.pyi rename to django-stubs/views/decorators/vary.pyi diff --git a/typings/django/views/defaults.pyi b/django-stubs/views/defaults.pyi similarity index 100% rename from typings/django/views/defaults.pyi rename to django-stubs/views/defaults.pyi diff --git a/typings/django/views/generic/__init__.pyi b/django-stubs/views/generic/__init__.pyi similarity index 100% rename from typings/django/views/generic/__init__.pyi rename to django-stubs/views/generic/__init__.pyi diff --git a/typings/django/views/generic/base.pyi b/django-stubs/views/generic/base.pyi similarity index 100% rename from typings/django/views/generic/base.pyi rename to django-stubs/views/generic/base.pyi diff --git a/typings/django/views/generic/dates.pyi b/django-stubs/views/generic/dates.pyi similarity index 100% rename from typings/django/views/generic/dates.pyi rename to django-stubs/views/generic/dates.pyi diff --git a/typings/django/views/generic/detail.pyi b/django-stubs/views/generic/detail.pyi similarity index 100% rename from typings/django/views/generic/detail.pyi rename to django-stubs/views/generic/detail.pyi diff --git a/typings/django/views/generic/edit.pyi b/django-stubs/views/generic/edit.pyi similarity index 100% rename from typings/django/views/generic/edit.pyi rename to django-stubs/views/generic/edit.pyi diff --git a/typings/django/views/generic/list.pyi b/django-stubs/views/generic/list.pyi similarity index 100% rename from typings/django/views/generic/list.pyi rename to django-stubs/views/generic/list.pyi diff --git a/typings/django/views/i18n.pyi b/django-stubs/views/i18n.pyi similarity index 100% rename from typings/django/views/i18n.pyi rename to django-stubs/views/i18n.pyi diff --git a/typings/django/views/static.pyi b/django-stubs/views/static.pyi similarity index 100% rename from typings/django/views/static.pyi rename to django-stubs/views/static.pyi diff --git a/psycopg2-stubs b/psycopg2-stubs deleted file mode 120000 index 71a112e06..000000000 --- a/psycopg2-stubs +++ /dev/null @@ -1 +0,0 @@ -./typings/psycopg2 \ No newline at end of file diff --git a/typings/psycopg2/__init__.pyi b/psycopg2-stubs/__init__.pyi similarity index 100% rename from typings/psycopg2/__init__.pyi rename to psycopg2-stubs/__init__.pyi diff --git a/typings/psycopg2/_psycopg.pyi b/psycopg2-stubs/_psycopg.pyi similarity index 100% rename from typings/psycopg2/_psycopg.pyi rename to psycopg2-stubs/_psycopg.pyi diff --git a/typings/psycopg2/_range.pyi b/psycopg2-stubs/_range.pyi similarity index 100% rename from typings/psycopg2/_range.pyi rename to psycopg2-stubs/_range.pyi diff --git a/typings/psycopg2/errors.pyi b/psycopg2-stubs/errors.pyi similarity index 100% rename from typings/psycopg2/errors.pyi rename to psycopg2-stubs/errors.pyi diff --git a/typings/psycopg2/extensions.pyi b/psycopg2-stubs/extensions.pyi similarity index 100% rename from typings/psycopg2/extensions.pyi rename to psycopg2-stubs/extensions.pyi diff --git a/typings/psycopg2/extras.pyi b/psycopg2-stubs/extras.pyi similarity index 100% rename from typings/psycopg2/extras.pyi rename to psycopg2-stubs/extras.pyi diff --git a/typings/psycopg2/sql.pyi b/psycopg2-stubs/sql.pyi similarity index 100% rename from typings/psycopg2/sql.pyi rename to psycopg2-stubs/sql.pyi diff --git a/typings/psycopg2/tz.pyi b/psycopg2-stubs/tz.pyi similarity index 100% rename from typings/psycopg2/tz.pyi rename to psycopg2-stubs/tz.pyi diff --git a/s/build b/s/build new file mode 100755 index 000000000..be93e0d94 --- /dev/null +++ b/s/build @@ -0,0 +1,6 @@ +#!/bin/bash +set -eux +# poetry errors if there are any non-.pyi files in the stubs D: +find . -name '.DS_Store' -type f -delete + +poetry build diff --git a/typings/django b/typings/django new file mode 120000 index 000000000..146219143 --- /dev/null +++ b/typings/django @@ -0,0 +1 @@ +../django-stubs \ No newline at end of file diff --git a/typings/psycopg2 b/typings/psycopg2 new file mode 120000 index 000000000..927638bd3 --- /dev/null +++ b/typings/psycopg2 @@ -0,0 +1 @@ +../psycopg2-stubs \ No newline at end of file From 3fdd406a208f4c8f2f803475c5af8641aa6f4ed3 Mon Sep 17 00:00:00 2001 From: Steve Dignam Date: Sun, 31 Oct 2021 12:01:03 -0400 Subject: [PATCH 72/88] release: 0.9.0 (#61) --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 72c47c5ce..16605bb96 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "django-types" -version = "0.8.1" +version = "0.9.0" description = "Type stubs for Django" repository = "https://github.com/sbdchd/django-types" readme = "README.md" From 5ce12dddfcf4df5dff1abe8b8fc00cd482713441 Mon Sep 17 00:00:00 2001 From: Thiago Bellini Ribeiro Date: Sun, 31 Oct 2021 18:42:38 -0300 Subject: [PATCH 73/88] Update deps (#62) --- .flake8 | 4 + .gitignore | 1 + .../contrib/admin/views/decorators.pyi | 1 + .../contrib/gis/db/models/__init__.pyi | 8 +- django-stubs/db/migrations/__init__.pyi | 4 +- .../db/migrations/topological_sort.pyi | 2 +- django-stubs/template/__init__.pyi | 9 +- django-stubs/test/runner.pyi | 7 +- django-stubs/utils/dateformat.pyi | 6 +- django-stubs/utils/encoding.pyi | 1 + django-stubs/utils/topological_sort.pyi | 2 +- django-stubs/utils/translation/__init__.pyi | 4 +- poetry.lock | 151 +++++++++++------- psycopg2-stubs/extras.pyi | 3 +- pyproject.toml | 9 +- 15 files changed, 130 insertions(+), 82 deletions(-) create mode 100644 .flake8 diff --git a/.flake8 b/.flake8 new file mode 100644 index 000000000..b7a951873 --- /dev/null +++ b/.flake8 @@ -0,0 +1,4 @@ +[flake8] +extend-ignore = Y015 +max-line-length = 88 +exclude = .eggs,.git,.hg,.mypy_cache,.tox,.venv,venv,__pycached__,_build,buck-out,build,dist,node_modules diff --git a/.gitignore b/.gitignore index 510e31bcb..858367a75 100644 --- a/.gitignore +++ b/.gitignore @@ -11,3 +11,4 @@ pip-wheel-metadata/ stubgen/ build/ dist/ +node_modules/ diff --git a/django-stubs/contrib/admin/views/decorators.pyi b/django-stubs/contrib/admin/views/decorators.pyi index a311da750..282223f0f 100644 --- a/django-stubs/contrib/admin/views/decorators.pyi +++ b/django-stubs/contrib/admin/views/decorators.pyi @@ -1,6 +1,7 @@ from typing import Any, Callable, Optional, TypeVar, overload _C = TypeVar("_C", bound=Callable[..., Any]) + @overload def staff_member_required( view_func: _C = ..., redirect_field_name: Optional[str] = ..., login_url: str = ... diff --git a/django-stubs/contrib/gis/db/models/__init__.pyi b/django-stubs/contrib/gis/db/models/__init__.pyi index 3c4937695..dc526e0f6 100644 --- a/django-stubs/contrib/gis/db/models/__init__.pyi +++ b/django-stubs/contrib/gis/db/models/__init__.pyi @@ -1,5 +1,7 @@ -# noqa: F401 -from django.contrib.gis.db.models.aggregates import * +# FIXME: It would be better for typing to add the exact imports it has +# here instead of "import *"... + +from django.contrib.gis.db.models.aggregates import * # noqa:F403 from django.contrib.gis.db.models.fields import ( GeometryCollectionField as GeometryCollectionField, ) @@ -13,4 +15,4 @@ from django.contrib.gis.db.models.fields import MultiPolygonField as MultiPolygo from django.contrib.gis.db.models.fields import PointField as PointField from django.contrib.gis.db.models.fields import PolygonField as PolygonField from django.contrib.gis.db.models.fields import RasterField as RasterField -from django.db.models import * +from django.db.models import * # noqa:F403 diff --git a/django-stubs/db/migrations/__init__.pyi b/django-stubs/db/migrations/__init__.pyi index 4a8e9a23e..3a3e3925e 100644 --- a/django-stubs/db/migrations/__init__.pyi +++ b/django-stubs/db/migrations/__init__.pyi @@ -4,4 +4,6 @@ from .migration import Migration as Migration from .migration import swappable_dependency as swappable_dependency -from .operations import * + +# FIXME: Add all operations here +from .operations import * # noqa:F403 diff --git a/django-stubs/db/migrations/topological_sort.pyi b/django-stubs/db/migrations/topological_sort.pyi index 2825611a5..b814a17d3 100644 --- a/django-stubs/db/migrations/topological_sort.pyi +++ b/django-stubs/db/migrations/topological_sort.pyi @@ -6,5 +6,5 @@ def topological_sort_as_sets( dependency_graph: Dict[Operation, Set[Operation]] ) -> Iterator[Set[Operation]]: ... def stable_topological_sort( - l: List[Operation], dependency_graph: Dict[Operation, Set[Operation]] + l: List[Operation], dependency_graph: Dict[Operation, Set[Operation]] # noqa:E741 ) -> List[Operation]: ... diff --git a/django-stubs/template/__init__.pyi b/django-stubs/template/__init__.pyi index 124c69967..128cc1004 100644 --- a/django-stubs/template/__init__.pyi +++ b/django-stubs/template/__init__.pyi @@ -1,8 +1,3 @@ -from .engine import Engine as Engine -from .utils import EngineHandler as EngineHandler - -engines: EngineHandler - from . import defaultfilters as defaultfilters # Template parts @@ -15,6 +10,10 @@ from .base import VariableDoesNotExist as VariableDoesNotExist from .context import Context as Context from .context import ContextPopException as ContextPopException from .context import RequestContext as RequestContext +from .engine import Engine as Engine from .exceptions import TemplateDoesNotExist as TemplateDoesNotExist from .exceptions import TemplateSyntaxError as TemplateSyntaxError from .library import Library as Library +from .utils import EngineHandler as EngineHandler + +engines: EngineHandler diff --git a/django-stubs/test/runner.pyi b/django-stubs/test/runner.pyi index fe20152d6..d41f71a6e 100644 --- a/django-stubs/test/runner.pyi +++ b/django-stubs/test/runner.pyi @@ -2,7 +2,8 @@ import logging from argparse import ArgumentParser from io import StringIO from typing import Any, Dict, List, Optional, Sequence, Set, Tuple, Type -from unittest import TestCase, TestSuite, TextTestResult +from unittest import TestCase as _TestCase +from unittest import TestSuite, TextTestResult from django.db.backends.base.base import BaseDatabaseWrapper from django.test.testcases import SimpleTestCase, TestCase @@ -24,8 +25,8 @@ class DebugSQLTextTestResult(TextTestResult): def __init__(self, stream: Any, descriptions: bool, verbosity: int) -> None: ... debug_sql_stream: StringIO = ... handler: logging.FileHandler = ... - def startTest(self, test: TestCase) -> None: ... - def stopTest(self, test: TestCase) -> None: ... + def startTest(self, test: _TestCase) -> None: ... + def stopTest(self, test: _TestCase) -> None: ... def addError(self, test: Any, err: Any) -> None: ... def addFailure(self, test: Any, err: Any) -> None: ... diff --git a/django-stubs/utils/dateformat.pyi b/django-stubs/utils/dateformat.pyi index 911156153..ef4e07968 100644 --- a/django-stubs/utils/dateformat.pyi +++ b/django-stubs/utils/dateformat.pyi @@ -23,7 +23,7 @@ class TimeFormat(Formatter): def h(self) -> str: ... def H(self) -> str: ... def i(self) -> str: ... - def O(self) -> str: ... + def O(self) -> str: ... # noqa:E741,E743 def P(self) -> str: ... def s(self) -> str: ... def T(self) -> str: ... @@ -40,9 +40,9 @@ class DateFormat(TimeFormat): def D(self) -> Any: ... def E(self) -> Any: ... def F(self) -> Any: ... - def I(self) -> str: ... + def I(self) -> str: ... # noqa:E741,E743 def j(self) -> int: ... - def l(self) -> Any: ... + def l(self) -> Any: ... # noqa:E741,E743 def L(self) -> bool: ... def m(self) -> str: ... def M(self) -> str: ... diff --git a/django-stubs/utils/encoding.pyi b/django-stubs/utils/encoding.pyi index 55a14b87c..1c99167df 100644 --- a/django-stubs/utils/encoding.pyi +++ b/django-stubs/utils/encoding.pyi @@ -19,6 +19,7 @@ def force_bytes( smart_str = smart_text force_str = force_text + @overload def iri_to_uri(iri: None) -> None: ... @overload diff --git a/django-stubs/utils/topological_sort.pyi b/django-stubs/utils/topological_sort.pyi index d0ace23b2..88db015e8 100644 --- a/django-stubs/utils/topological_sort.pyi +++ b/django-stubs/utils/topological_sort.pyi @@ -6,5 +6,5 @@ def topological_sort_as_sets( dependency_graph: Dict[Any, Any] ) -> Iterator[Set[Any]]: ... def stable_topological_sort( - l: Container[Any], dependency_graph: Dict[Any, Any] + l: Container[Any], dependency_graph: Dict[Any, Any] # noqa:E741 ) -> List[Any]: ... diff --git a/django-stubs/utils/translation/__init__.pyi b/django-stubs/utils/translation/__init__.pyi index 55cb21800..699951e55 100644 --- a/django-stubs/utils/translation/__init__.pyi +++ b/django-stubs/utils/translation/__init__.pyi @@ -4,6 +4,8 @@ from typing import Any, Callable, Optional, Union from django.core.handlers.wsgi import WSGIRequest +from . import trans_real as trans_real + LANGUAGE_SESSION_KEY: str class TranslatorCommentWarning(SyntaxWarning): ... @@ -72,5 +74,3 @@ def templatize(src: str, **kwargs: Any) -> str: ... def deactivate_all() -> None: ... def get_supported_language_variant(lang_code: str, strict: bool = ...) -> str: ... def get_language_info(lang_code: str) -> Any: ... - -from . import trans_real as trans_real diff --git a/poetry.lock b/poetry.lock index 91d4784ae..f06230877 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1,11 +1,3 @@ -[[package]] -name = "appdirs" -version = "1.4.4" -description = "A small Python module for determining appropriate platform-specific dirs, e.g. a \"user data dir\"." -category = "dev" -optional = false -python-versions = "*" - [[package]] name = "asgiref" version = "3.4.1" @@ -44,26 +36,32 @@ tests_no_zope = ["coverage[toml] (>=5.0.2)", "hypothesis", "pympler", "pytest (> [[package]] name = "black" -version = "20.8b1" +version = "21.9b0" description = "The uncompromising code formatter." category = "dev" optional = false -python-versions = ">=3.6" +python-versions = ">=3.6.2" [package.dependencies] -appdirs = "*" click = ">=7.1.2" dataclasses = {version = ">=0.6", markers = "python_version < \"3.7\""} mypy-extensions = ">=0.4.3" -pathspec = ">=0.6,<1" +pathspec = ">=0.9.0,<1" +platformdirs = ">=2" regex = ">=2020.1.8" -toml = ">=0.10.1" -typed-ast = ">=1.4.0" -typing-extensions = ">=3.7.4" +tomli = ">=0.2.6,<2.0.0" +typed-ast = {version = ">=1.4.2", markers = "python_version < \"3.8\""} +typing-extensions = [ + {version = ">=3.10.0.0", markers = "python_version < \"3.10\""}, + {version = "!=3.10.0.1", markers = "python_version >= \"3.10\""}, +] [package.extras] colorama = ["colorama (>=0.4.3)"] -d = ["aiohttp (>=3.3.2)", "aiohttp-cors"] +d = ["aiohttp (>=3.6.0)", "aiohttp-cors (>=0.4.0)"] +jupyter = ["ipython (>=7.8.0)", "tokenize-rt (>=3.2.0)"] +python2 = ["typed-ast (>=1.4.2)"] +uvloop = ["uvloop (>=0.15.2)"] [[package]] name = "click" @@ -112,21 +110,34 @@ bcrypt = ["bcrypt"] [[package]] name = "flake8" -version = "3.8.4" +version = "4.0.1" description = "the modular source code checker: pep8 pyflakes and co" category = "dev" optional = false -python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,>=2.7" +python-versions = ">=3.6" [package.dependencies] -importlib-metadata = {version = "*", markers = "python_version < \"3.8\""} +importlib-metadata = {version = "<4.3", markers = "python_version < \"3.8\""} mccabe = ">=0.6.0,<0.7.0" -pycodestyle = ">=2.6.0a1,<2.7.0" -pyflakes = ">=2.2.0,<2.3.0" +pycodestyle = ">=2.8.0,<2.9.0" +pyflakes = ">=2.4.0,<2.5.0" + +[[package]] +name = "flake8-pyi" +version = "20.10.0" +description = "A plugin for flake8 to enable linting .pyi files." +category = "dev" +optional = false +python-versions = ">=3.6" + +[package.dependencies] +attrs = "*" +flake8 = ">=3.2.1" +pyflakes = ">=2.1.1" [[package]] name = "importlib-metadata" -version = "4.8.1" +version = "4.2.0" description = "Read metadata from Python packages" category = "dev" optional = false @@ -138,8 +149,7 @@ zipp = ">=0.5" [package.extras] docs = ["sphinx", "jaraco.packaging (>=8.2)", "rst.linker (>=1.9)"] -perf = ["ipython"] -testing = ["pytest (>=4.6)", "pytest-checkdocs (>=2.4)", "pytest-flake8", "pytest-cov", "pytest-enabler (>=1.0.1)", "packaging", "pep517", "pyfakefs", "flufl.flake8", "pytest-perf (>=0.9.2)", "pytest-black (>=0.3.7)", "pytest-mypy", "importlib-resources (>=1.3)"] +testing = ["pytest (>=4.6)", "pytest-checkdocs (>=2.4)", "pytest-flake8", "pytest-cov", "pytest-enabler (>=1.0.1)", "packaging", "pep517", "pyfakefs", "flufl.flake8", "pytest-black (>=0.3.7)", "pytest-mypy", "importlib-resources (>=1.3)"] [[package]] name = "iniconfig" @@ -151,16 +161,17 @@ python-versions = "*" [[package]] name = "isort" -version = "5.7.0" +version = "5.9.3" description = "A Python utility / library to sort Python imports." category = "dev" optional = false -python-versions = ">=3.6,<4.0" +python-versions = ">=3.6.1,<4.0" [package.extras] pipfile_deprecated_finder = ["pipreqs", "requirementslib"] requirements_deprecated_finder = ["pipreqs", "pip-api"] colors = ["colorama (>=0.4.3,<0.5.0)"] +plugins = ["setuptools"] [[package]] name = "mccabe" @@ -196,14 +207,14 @@ python-versions = "*" [[package]] name = "packaging" -version = "21.0" +version = "21.2" description = "Core utilities for Python packages" category = "dev" optional = false python-versions = ">=3.6" [package.dependencies] -pyparsing = ">=2.0.2" +pyparsing = ">=2.0.2,<3" [[package]] name = "pathspec" @@ -213,6 +224,18 @@ category = "dev" optional = false python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,>=2.7" +[[package]] +name = "platformdirs" +version = "2.4.0" +description = "A small Python module for determining appropriate platform-specific dirs, e.g. a \"user data dir\"." +category = "dev" +optional = false +python-versions = ">=3.6" + +[package.extras] +docs = ["Sphinx (>=4)", "furo (>=2021.7.5b38)", "proselint (>=0.10.2)", "sphinx-autodoc-typehints (>=1.12)"] +test = ["appdirs (==1.4.4)", "pytest (>=6)", "pytest-cov (>=2.7)", "pytest-mock (>=3.6)"] + [[package]] name = "pluggy" version = "0.13.1" @@ -245,15 +268,15 @@ python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" [[package]] name = "pycodestyle" -version = "2.6.0" +version = "2.8.0" description = "Python style guide checker" category = "dev" optional = false -python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" +python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*" [[package]] name = "pyflakes" -version = "2.2.0" +version = "2.4.0" description = "passive checker of Python programs" category = "dev" optional = false @@ -261,14 +284,11 @@ python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" [[package]] name = "pyparsing" -version = "3.0.0" +version = "2.4.7" description = "Python parsing module" category = "dev" optional = false -python-versions = ">=3.6" - -[package.extras] -diagrams = ["jinja2", "railroad-diagrams"] +python-versions = ">=2.6, !=3.0.*, !=3.1.*, !=3.2.*" [[package]] name = "pytest" @@ -324,6 +344,14 @@ category = "dev" optional = false python-versions = ">=2.6, !=3.0.*, !=3.1.*, !=3.2.*" +[[package]] +name = "tomli" +version = "1.2.2" +description = "A lil' TOML parser" +category = "dev" +optional = false +python-versions = ">=3.6" + [[package]] name = "typed-ast" version = "1.4.3" @@ -354,14 +382,10 @@ testing = ["pytest (>=4.6)", "pytest-checkdocs (>=2.4)", "pytest-flake8", "pytes [metadata] lock-version = "1.1" -python-versions = "^3.6" -content-hash = "4273e3275b5873c1875b5cbc19e90868bec7709a25bb92ca9398ff93b9e8b0b6" +python-versions = "^3.6.2" +content-hash = "67d01da6ae257019998f17a15a3acc015665810f1b430ba7040f85a8728fe704" [metadata.files] -appdirs = [ - {file = "appdirs-1.4.4-py2.py3-none-any.whl", hash = "sha256:a841dacd6b99318a741b166adb07e19ee71a274450e68237b4650ca1055ab128"}, - {file = "appdirs-1.4.4.tar.gz", hash = "sha256:7d5d0167b2b1ba821647616af46a749d1c653740dd0d2415100fe26e27afdf41"}, -] asgiref = [ {file = "asgiref-3.4.1-py3-none-any.whl", hash = "sha256:ffc141aa908e6f175673e7b1b3b7af4fdb0ecb738fc5c8b88f69f055c2415214"}, {file = "asgiref-3.4.1.tar.gz", hash = "sha256:4ef1ab46b484e3c706329cedeff284a5d40824200638503f5768edb6de7d58e9"}, @@ -375,7 +399,8 @@ attrs = [ {file = "attrs-21.2.0.tar.gz", hash = "sha256:ef6aaac3ca6cd92904cdd0d83f629a15f18053ec84e6432106f7a4d04ae4f5fb"}, ] black = [ - {file = "black-20.8b1.tar.gz", hash = "sha256:1c02557aa099101b9d21496f8a914e9ed2222ef70336404eeeac8edba836fbea"}, + {file = "black-21.9b0-py3-none-any.whl", hash = "sha256:380f1b5da05e5a1429225676655dddb96f5ae8c75bdf91e53d798871b902a115"}, + {file = "black-21.9b0.tar.gz", hash = "sha256:7de4cfc7eb6b710de325712d40125689101d21d25283eed7e9998722cf10eb91"}, ] click = [ {file = "click-8.0.3-py3-none-any.whl", hash = "sha256:353f466495adaeb40b6b5f592f9f91cb22372351c84caeb068132442a4518ef3"}, @@ -394,20 +419,24 @@ django = [ {file = "Django-3.1.7.tar.gz", hash = "sha256:32ce792ee9b6a0cbbec340123e229ac9f765dff8c2a4ae9247a14b2ba3a365a7"}, ] flake8 = [ - {file = "flake8-3.8.4-py2.py3-none-any.whl", hash = "sha256:749dbbd6bfd0cf1318af27bf97a14e28e5ff548ef8e5b1566ccfb25a11e7c839"}, - {file = "flake8-3.8.4.tar.gz", hash = "sha256:aadae8761ec651813c24be05c6f7b4680857ef6afaae4651a4eccaef97ce6c3b"}, + {file = "flake8-4.0.1-py2.py3-none-any.whl", hash = "sha256:479b1304f72536a55948cb40a32dce8bb0ffe3501e26eaf292c7e60eb5e0428d"}, + {file = "flake8-4.0.1.tar.gz", hash = "sha256:806e034dda44114815e23c16ef92f95c91e4c71100ff52813adf7132a6ad870d"}, +] +flake8-pyi = [ + {file = "flake8-pyi-20.10.0.tar.gz", hash = "sha256:cee3b20a5123152c697870e7e800b60e3c95eb89e272a2b63d8cf55cafb0472c"}, + {file = "flake8_pyi-20.10.0-py2.py3-none-any.whl", hash = "sha256:ff5dfc40bffa878f6ce95bcfd9a6ad14c44b85cbe99c4864e729301bf54267f0"}, ] importlib-metadata = [ - {file = "importlib_metadata-4.8.1-py3-none-any.whl", hash = "sha256:b618b6d2d5ffa2f16add5697cf57a46c76a56229b0ed1c438322e4e95645bd15"}, - {file = "importlib_metadata-4.8.1.tar.gz", hash = "sha256:f284b3e11256ad1e5d03ab86bb2ccd6f5339688ff17a4d797a0fe7df326f23b1"}, + {file = "importlib_metadata-4.2.0-py3-none-any.whl", hash = "sha256:057e92c15bc8d9e8109738a48db0ccb31b4d9d5cfbee5a8670879a30be66304b"}, + {file = "importlib_metadata-4.2.0.tar.gz", hash = "sha256:b7e52a1f8dec14a75ea73e0891f3060099ca1d8e6a462a4dff11c3e119ea1b31"}, ] iniconfig = [ {file = "iniconfig-1.1.1-py2.py3-none-any.whl", hash = "sha256:011e24c64b7f47f6ebd835bb12a743f2fbe9a26d4cecaa7f53bc4f35ee9da8b3"}, {file = "iniconfig-1.1.1.tar.gz", hash = "sha256:bc3af051d7d14b2ee5ef9969666def0cd1a000e121eaea580d4a313df4b37f32"}, ] isort = [ - {file = "isort-5.7.0-py3-none-any.whl", hash = "sha256:fff4f0c04e1825522ce6949973e83110a6e907750cd92d128b0d14aaaadbffdc"}, - {file = "isort-5.7.0.tar.gz", hash = "sha256:c729845434366216d320e936b8ad6f9d681aab72dc7cbc2d51bedc3582f3ad1e"}, + {file = "isort-5.9.3-py3-none-any.whl", hash = "sha256:e17d6e2b81095c9db0a03a8025a957f334d6ea30b26f9ec70805411e5c7c81f2"}, + {file = "isort-5.9.3.tar.gz", hash = "sha256:9c2ea1e62d871267b78307fe511c0838ba0da28698c5732d54e2790bf3ba9899"}, ] mccabe = [ {file = "mccabe-0.6.1-py2.py3-none-any.whl", hash = "sha256:ab8a6258860da4b6677da4bd2fe5dc2c659cff31b3ee4f7f5d64e79735b80d42"}, @@ -434,13 +463,17 @@ mypy-extensions = [ {file = "mypy_extensions-0.4.3.tar.gz", hash = "sha256:2d82818f5bb3e369420cb3c4060a7970edba416647068eb4c5343488a6c604a8"}, ] packaging = [ - {file = "packaging-21.0-py3-none-any.whl", hash = "sha256:c86254f9220d55e31cc94d69bade760f0847da8000def4dfe1c6b872fd14ff14"}, - {file = "packaging-21.0.tar.gz", hash = "sha256:7dc96269f53a4ccec5c0670940a4281106dd0bb343f47b7471f779df49c2fbe7"}, + {file = "packaging-21.2-py3-none-any.whl", hash = "sha256:14317396d1e8cdb122989b916fa2c7e9ca8e2be9e8060a6eff75b6b7b4d8a7e0"}, + {file = "packaging-21.2.tar.gz", hash = "sha256:096d689d78ca690e4cd8a89568ba06d07ca097e3306a4381635073ca91479966"}, ] pathspec = [ {file = "pathspec-0.9.0-py2.py3-none-any.whl", hash = "sha256:7d15c4ddb0b5c802d161efc417ec1a2558ea2653c2e8ad9c19098201dc1c993a"}, {file = "pathspec-0.9.0.tar.gz", hash = "sha256:e564499435a2673d586f6b2130bb5b95f04a3ba06f81b8f895b651a3c76aabb1"}, ] +platformdirs = [ + {file = "platformdirs-2.4.0-py3-none-any.whl", hash = "sha256:8868bbe3c3c80d42f20156f22e7131d2fb321f5bc86a2a345375c6481a67021d"}, + {file = "platformdirs-2.4.0.tar.gz", hash = "sha256:367a5e80b3d04d2428ffa76d33f124cf11e8fff2acdaa9b43d545f5c7d661ef2"}, +] pluggy = [ {file = "pluggy-0.13.1-py2.py3-none-any.whl", hash = "sha256:966c145cd83c96502c3c3868f50408687b38434af77734af1e9ca461a4081d2d"}, {file = "pluggy-0.13.1.tar.gz", hash = "sha256:15b2acde666561e1298d71b523007ed7364de07029219b604cf808bfa1c765b0"}, @@ -467,16 +500,16 @@ py = [ {file = "py-1.10.0.tar.gz", hash = "sha256:21b81bda15b66ef5e1a777a21c4dcd9c20ad3efd0b3f817e7a809035269e1bd3"}, ] pycodestyle = [ - {file = "pycodestyle-2.6.0-py2.py3-none-any.whl", hash = "sha256:2295e7b2f6b5bd100585ebcb1f616591b652db8a741695b3d8f5d28bdc934367"}, - {file = "pycodestyle-2.6.0.tar.gz", hash = "sha256:c58a7d2815e0e8d7972bf1803331fb0152f867bd89adf8a01dfd55085434192e"}, + {file = "pycodestyle-2.8.0-py2.py3-none-any.whl", hash = "sha256:720f8b39dde8b293825e7ff02c475f3077124006db4f440dcbc9a20b76548a20"}, + {file = "pycodestyle-2.8.0.tar.gz", hash = "sha256:eddd5847ef438ea1c7870ca7eb78a9d47ce0cdb4851a5523949f2601d0cbbe7f"}, ] pyflakes = [ - {file = "pyflakes-2.2.0-py2.py3-none-any.whl", hash = "sha256:0d94e0e05a19e57a99444b6ddcf9a6eb2e5c68d3ca1e98e90707af8152c90a92"}, - {file = "pyflakes-2.2.0.tar.gz", hash = "sha256:35b2d75ee967ea93b55750aa9edbbf72813e06a66ba54438df2cfac9e3c27fc8"}, + {file = "pyflakes-2.4.0-py2.py3-none-any.whl", hash = "sha256:3bb3a3f256f4b7968c9c788781e4ff07dce46bdf12339dcda61053375426ee2e"}, + {file = "pyflakes-2.4.0.tar.gz", hash = "sha256:05a85c2872edf37a4ed30b0cce2f6093e1d0581f8c19d7393122da7e25b2b24c"}, ] pyparsing = [ - {file = "pyparsing-3.0.0-py3-none-any.whl", hash = "sha256:d487599e9fb0dc36bee6b5c183c6fc5bd372ce667736f3d430ab7d842a54a35a"}, - {file = "pyparsing-3.0.0.tar.gz", hash = "sha256:001cad8d467e7a9248ef9fd513f5c0d39afcbcb9a43684101853bd0ab962e479"}, + {file = "pyparsing-2.4.7-py2.py3-none-any.whl", hash = "sha256:ef9d7589ef3c200abe66653d3f1ab1033c3c419ae9b9bdb1240a85b024efc88b"}, + {file = "pyparsing-2.4.7.tar.gz", hash = "sha256:c203ec8783bf771a155b207279b9bccb8dea02d8f0c9e5f8ead507bc3246ecc1"}, ] pytest = [ {file = "pytest-6.2.2-py3-none-any.whl", hash = "sha256:b574b57423e818210672e07ca1fa90aaf194a4f63f3ab909a2c67ebb22913839"}, @@ -532,6 +565,10 @@ toml = [ {file = "toml-0.10.2-py2.py3-none-any.whl", hash = "sha256:806143ae5bfb6a3c6e736a764057db0e6a0e05e338b5630894a5f779cabb4f9b"}, {file = "toml-0.10.2.tar.gz", hash = "sha256:b3bda1d108d5dd99f4a20d24d9c348e91c4db7ab1b749200bded2f839ccbe68f"}, ] +tomli = [ + {file = "tomli-1.2.2-py3-none-any.whl", hash = "sha256:f04066f68f5554911363063a30b108d2b5a5b1a010aa8b6132af78489fe3aade"}, + {file = "tomli-1.2.2.tar.gz", hash = "sha256:c6ce0015eb38820eaf32b5db832dbc26deb3dd427bd5f6556cf0acac2c214fee"}, +] typed-ast = [ {file = "typed_ast-1.4.3-cp35-cp35m-manylinux1_i686.whl", hash = "sha256:2068531575a125b87a41802130fa7e29f26c09a2833fea68d9a40cf33902eba6"}, {file = "typed_ast-1.4.3-cp35-cp35m-manylinux1_x86_64.whl", hash = "sha256:c907f561b1e83e93fad565bac5ba9c22d96a54e7ea0267c708bffe863cbe4075"}, diff --git a/psycopg2-stubs/extras.pyi b/psycopg2-stubs/extras.pyi index 37ee12d42..c824277e5 100644 --- a/psycopg2-stubs/extras.pyi +++ b/psycopg2-stubs/extras.pyi @@ -164,8 +164,7 @@ class LogicalReplicationConnection(_replicationConnection): class PhysicalReplicationConnection(_replicationConnection): def __init__(self, *args: Any, **kwargs: Any) -> None: ... -class StopReplication(Exception): - pass +class StopReplication(Exception): ... class ReplicationCursor(_replicationCursor): def create_replication_slot( diff --git a/pyproject.toml b/pyproject.toml index 16605bb96..ee7b97114 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -14,17 +14,18 @@ packages = [ ] [tool.poetry.dependencies] -python = "^3.6" +python = "^3.6.2" [tool.poetry.dev-dependencies] -black = "20.8b1" +black = "21.9b0" pytest = "6.2.2" wheel = "0.35.1" mypy = "0.790" -isort = "5.7.0" +isort = "5.9.3" Django = "3.1.7" -flake8 = "3.8.4" +flake8 = "4.0.1" psycopg2 = "2.8.6" +flake8-pyi = "^20.10.0" [tool.black] line-length = 88 From 9316444215b9f1a6fb433a9504a1b199068bb66a Mon Sep 17 00:00:00 2001 From: Manan Thakkar Date: Sat, 6 Nov 2021 09:04:45 -0400 Subject: [PATCH 74/88] Update ProtectedError and RestrictedError stubs (#67) Django 3.1 updated these db deletion errors to show the set of all objects that protected/restricted the deletion, as opposed to just the model of one object. As such, these stubs need to be updated. This matches how these errors are typed in `typeddjango`. --- django-stubs/db/models/deletion.pyi | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/django-stubs/db/models/deletion.pyi b/django-stubs/db/models/deletion.pyi index 7460ec2a1..b81bd9ed8 100644 --- a/django-stubs/db/models/deletion.pyi +++ b/django-stubs/db/models/deletion.pyi @@ -1,4 +1,4 @@ -from typing import Any, Callable, Collection, Iterable, Optional, Type, Union +from typing import Any, Callable, Collection, Iterable, Optional, Set, Type, Union from django.db import IntegrityError from django.db.models.base import Model @@ -16,8 +16,13 @@ def get_candidate_relations_to_delete( opts: Options[Any], ) -> Iterable[Field[Any, Any]]: ... -class ProtectedError(IntegrityError): ... -class RestrictedError(IntegrityError): ... +class ProtectedError(IntegrityError): + protected_objects: Set[Model] + def __init__(self, msg: str, protected_objects: Set[Model]) -> None: ... + +class RestrictedError(IntegrityError): + restricted_objects: Set[Model] + def __init__(self, msg: str, restricted_objects: Set[Model]) -> None: ... class Collector: def __init__(self, using: str) -> None: ... From 38decfae18d9fc765762b3ac6c5db60e8baea2a0 Mon Sep 17 00:00:00 2001 From: Steve Dignam Date: Sat, 6 Nov 2021 09:06:48 -0400 Subject: [PATCH 75/88] release: 0.9.1 (#68) --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index ee7b97114..d3e26b05b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "django-types" -version = "0.9.0" +version = "0.9.1" description = "Type stubs for Django" repository = "https://github.com/sbdchd/django-types" readme = "README.md" From a040cb46b1ce8bdb224f1d53d8ce4ffafab1b556 Mon Sep 17 00:00:00 2001 From: Thiago Bellini Ribeiro Date: Sat, 6 Nov 2021 11:13:50 -0300 Subject: [PATCH 76/88] Improve typing on JSONField (#64) This was built on top of #62, so merging it should only keep this PR's change --- django-stubs/db/models/fields/json.pyi | 108 ++++++++++++++++++++----- tests/trout/models.py | 18 ++++- 2 files changed, 104 insertions(+), 22 deletions(-) diff --git a/django-stubs/db/models/fields/json.pyi b/django-stubs/db/models/fields/json.pyi index 982eae5d4..5b93779e2 100644 --- a/django-stubs/db/models/fields/json.pyi +++ b/django-stubs/db/models/fields/json.pyi @@ -1,34 +1,100 @@ -from typing import Any, Optional +import json +from typing import Any, Callable, Iterable, Optional, Tuple, TypeVar, Union, overload from django.db.models import lookups from django.db.models.lookups import PostgresOperatorLookup, Transform +from typing_extensions import Literal -from . import Field +from . import Field, _ErrorMessagesToOverride, _ValidatorCallable from .mixins import CheckFieldDefaultMixin -class JSONField(CheckFieldDefaultMixin, Field[Any, Any]): - empty_strings_allowed: bool = ... - description: Any = ... +_A = TypeVar("_A", bound=Optional[Any]) + +class JSONField(CheckFieldDefaultMixin, Field[_A, _A]): default_error_messages: Any = ... - encoder: Any = ... - decoder: Any = ... - def __init__( - self, - verbose_name: Optional[Any] = ..., - name: Optional[Any] = ..., - encoder: Optional[Any] = ..., - decoder: Optional[Any] = ..., - **kwargs: Any - ) -> None: ... - def check(self, **kwargs: Any) -> Any: ... - def deconstruct(self) -> Any: ... + encoder: json.JSONEncoder = ... + decoder: json.JSONEncoder = ... def from_db_value(self, value: Any, expression: Any, connection: Any) -> Any: ... - def get_internal_type(self) -> Any: ... - def get_prep_value(self, value: Any) -> Any: ... def get_transform(self, name: Any) -> Any: ... - def validate(self, value: Any, model_instance: Any) -> None: ... def value_to_string(self, obj: Any) -> Any: ... - def formfield(self, **kwargs: Any) -> Any: ... + @overload + def __init__( + self: JSONField[_A], + encoder: json.JSONEncoder = ..., + decoder: json.JSONDecoder = ..., + verbose_name: Optional[str] = ..., + name: Optional[str] = ..., + primary_key: bool = ..., + max_length: Optional[int] = ..., + unique: bool = ..., + blank: bool = ..., + null: Literal[False] = ..., + db_index: bool = ..., + default: Optional[Union[_A, Callable[[], _A]]] = ..., + editable: bool = ..., + auto_created: bool = ..., + serialize: bool = ..., + unique_for_date: Optional[str] = ..., + unique_for_month: Optional[str] = ..., + unique_for_year: Optional[str] = ..., + choices: Iterable[ + Union[Tuple[_A, str], Tuple[str, Iterable[Tuple[_A, str]]]] + ] = ..., + help_text: str = ..., + db_column: Optional[str] = ..., + db_tablespace: Optional[str] = ..., + validators: Iterable[_ValidatorCallable] = ..., + error_messages: Optional[_ErrorMessagesToOverride] = ..., + ) -> None: ... + @overload + def __init__( + self: JSONField[Optional[_A]], + encoder: json.JSONEncoder = ..., + decoder: json.JSONDecoder = ..., + verbose_name: Optional[str] = ..., + name: Optional[str] = ..., + primary_key: bool = ..., + max_length: Optional[int] = ..., + unique: bool = ..., + blank: bool = ..., + null: Literal[True] = ..., + db_index: bool = ..., + default: Optional[Union[_A, Callable[[], _A]]] = ..., + editable: bool = ..., + auto_created: bool = ..., + serialize: bool = ..., + unique_for_date: Optional[str] = ..., + unique_for_month: Optional[str] = ..., + unique_for_year: Optional[str] = ..., + choices: Iterable[ + Union[Tuple[_A, str], Tuple[str, Iterable[Tuple[_A, str]]]] + ] = ..., + help_text: str = ..., + db_column: Optional[str] = ..., + db_tablespace: Optional[str] = ..., + validators: Iterable[_ValidatorCallable] = ..., + error_messages: Optional[_ErrorMessagesToOverride] = ..., + ) -> None: ... + @overload + def __new__( + cls, + *args: Any, + null: Literal[False] = ..., + choices: Iterable[ + Union[Tuple[_A, str], Tuple[str, Iterable[Tuple[_A, str]]]] + ] = ..., + **kwargs: Any, + ) -> JSONField[_A]: ... + @overload + def __new__( + cls, + *args: Any, + null: Literal[True], + choices: Iterable[ + Union[Tuple[_A, str], Tuple[str, Iterable[Tuple[_A, str]]]] + ] = ..., + **kwargs: Any, + ) -> JSONField[Optional[_A]]: ... class DataContains(PostgresOperatorLookup): lookup_name: str = ... diff --git a/tests/trout/models.py b/tests/trout/models.py index a8c31bdb5..55ac9a1e4 100644 --- a/tests/trout/models.py +++ b/tests/trout/models.py @@ -200,7 +200,11 @@ class Comment(models.Model): ) metadata = JSONField() - other_metadata = models.JSONField() + # There's no way to specify our typing to JSONField if it defaults to any... + other_metadata = models.JSONField[Dict[str, List[int]]]() + other_metadata_nullable = models.JSONField[Optional[Dict[str, List[int]]]]( + null=True + ) def process_non_nullable( @@ -217,6 +221,7 @@ def process_non_nullable( timedelta, List[object], Dict[str, Optional[str]], + Dict[str, List[int]], ] ) -> None: ... @@ -561,6 +566,17 @@ def main() -> None: if comment.null_str_specified is not None: print(comment.null_str_specified) + process_non_nullable(comment.other_metadata) + if isinstance(comment.other_metadata_nullable, type(None)): + print() + # refinement doesn't work + # see: https://github.com/python/mypy/issues/9783 + # still, reveal_type(comment.array) says: + # Revealed type is 'builtins.dict*[builtins.str, builtins.list[builtins.int]]' + # Pyright says it is Dict[str, List[str]] and will also validate its input correctly + # if not isinstance(comment.other_metadata, dict): + # print() # type: ignore [unreachable] + def raw_database_queries() -> None: From 0dcf5c3c5d09347678054ac1c7b4d239e7ef5f9c Mon Sep 17 00:00:00 2001 From: Vehbi Sinan Tunalioglu Date: Wed, 10 Nov 2021 09:07:16 +0800 Subject: [PATCH 77/88] Allow DateField to be Optional (#69) I do not know if there was a particular reason for why it was not implemented before. But, I took the liberty to mimic what was done for similar fields on the upstream. Essentially, The `__init__` was overloaded to distinguish between `null=True` and `null=False` to signal the resulting type, `Optional[date]` or `date` respectively. --- django-stubs/db/models/fields/__init__.pyi | 35 ++++++++++++++++++++-- 1 file changed, 32 insertions(+), 3 deletions(-) diff --git a/django-stubs/db/models/fields/__init__.pyi b/django-stubs/db/models/fields/__init__.pyi index db9986c94..8a16788c4 100644 --- a/django-stubs/db/models/fields/__init__.pyi +++ b/django-stubs/db/models/fields/__init__.pyi @@ -1056,9 +1056,12 @@ class GenericIPAddressField( class DateTimeCheckMixin: ... -class DateField(DateTimeCheckMixin, Field[Union[str, date, Combinable], date]): +_D = TypeVar("_D", bound=Optional[date]) + +class DateField(Generic[_D], DateTimeCheckMixin, Field[Union[str, date, Combinable], date]): + @overload def __init__( - self, + self: DateField[date], verbose_name: Optional[Union[str, bytes]] = ..., name: Optional[str] = ..., auto_now: bool = ..., @@ -1067,7 +1070,31 @@ class DateField(DateTimeCheckMixin, Field[Union[str, date, Combinable], date]): max_length: Optional[int] = ..., unique: bool = ..., blank: bool = ..., - null: bool = ..., + null: Literal[False] = ..., + db_index: bool = ..., + default: Any = ..., + editable: bool = ..., + auto_created: bool = ..., + serialize: bool = ..., + choices: Optional[_FieldChoices] = ..., + help_text: str = ..., + db_column: Optional[str] = ..., + db_tablespace: Optional[str] = ..., + validators: Iterable[_ValidatorCallable] = ..., + error_messages: Optional[_ErrorMessagesToOverride] = ..., + ) -> None: ... + @overload + def __init__( + self: DateField[Optional[date]], + verbose_name: Optional[Union[str, bytes]] = ..., + name: Optional[str] = ..., + auto_now: bool = ..., + auto_now_add: bool = ..., + primary_key: bool = ..., + max_length: Optional[int] = ..., + unique: bool = ..., + blank: bool = ..., + null: Literal[True] = ..., db_index: bool = ..., default: Any = ..., editable: bool = ..., @@ -1080,6 +1107,8 @@ class DateField(DateTimeCheckMixin, Field[Union[str, date, Combinable], date]): validators: Iterable[_ValidatorCallable] = ..., error_messages: Optional[_ErrorMessagesToOverride] = ..., ) -> None: ... + def __get__(self, instance: Any, owner: Any) -> _D: ... # type: ignore [override] + def __set__(self, instance: Any, value: _D) -> None: ... # type: ignore [override] _TM = TypeVar("_TM", bound=Optional[time]) From 748e7edbf4ce8e02529ae0b4246b24478e5eacaf Mon Sep 17 00:00:00 2001 From: Steve Dignam Date: Tue, 9 Nov 2021 20:20:53 -0500 Subject: [PATCH 78/88] release: 0.10.0 (#70) --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index d3e26b05b..05042604f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "django-types" -version = "0.9.1" +version = "0.10.0" description = "Type stubs for Django" repository = "https://github.com/sbdchd/django-types" readme = "README.md" From 42ac645dc3d0a424231d2d961f0bc281c061cabf Mon Sep 17 00:00:00 2001 From: Ray Marceau Date: Thu, 11 Nov 2021 16:34:43 -0800 Subject: [PATCH 79/88] #71 add type hint for id field (#72) --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index aba5023ad..44494ecee 100644 --- a/README.md +++ b/README.md @@ -123,7 +123,7 @@ reveal_type(Role().users) ``` -### `AutoField` +### `id Field` By default Django will create an `AutoField` for you if one doesn't exist. @@ -138,6 +138,8 @@ class Post(models.Model): # after class Post(models.Model): id = models.AutoField(primary_key=True) + # OR + id: int ``` ### `HttpRequest`'s `user` property From 711a99fc5ca3ebd45dd8e197eff1706bc1627bd4 Mon Sep 17 00:00:00 2001 From: Thiago Bellini Ribeiro Date: Sun, 21 Nov 2021 15:14:15 -0300 Subject: [PATCH 80/88] Update pyright and mypy and fix all new issues they detected (#73) --- django-stubs/db/models/fields/__init__.pyi | 4 +- django-stubs/db/models/sql/query.pyi | 2 +- django-stubs/utils/translation/__init__.pyi | 2 +- package.json | 2 +- poetry.lock | 194 ++++++++++++-------- psycopg2-stubs/extras.pyi | 4 +- pyproject.toml | 4 +- yarn.lock | 8 +- 8 files changed, 137 insertions(+), 83 deletions(-) diff --git a/django-stubs/db/models/fields/__init__.pyi b/django-stubs/db/models/fields/__init__.pyi index 8a16788c4..3f1150fb5 100644 --- a/django-stubs/db/models/fields/__init__.pyi +++ b/django-stubs/db/models/fields/__init__.pyi @@ -1058,7 +1058,9 @@ class DateTimeCheckMixin: ... _D = TypeVar("_D", bound=Optional[date]) -class DateField(Generic[_D], DateTimeCheckMixin, Field[Union[str, date, Combinable], date]): +class DateField( + Generic[_D], DateTimeCheckMixin, Field[Union[str, date, Combinable], date] +): @overload def __init__( self: DateField[date], diff --git a/django-stubs/db/models/sql/query.pyi b/django-stubs/db/models/sql/query.pyi index 5f02df055..965f1e18f 100644 --- a/django-stubs/db/models/sql/query.pyi +++ b/django-stubs/db/models/sql/query.pyi @@ -36,7 +36,7 @@ class JoinInfo(NamedTuple): class RawQuery: high_mark: Optional[int] low_mark: Optional[int] - params: Union[Any] = ... + params: Any = ... sql: str = ... using: str = ... extra_select: Dict[Any, Any] = ... diff --git a/django-stubs/utils/translation/__init__.pyi b/django-stubs/utils/translation/__init__.pyi index 699951e55..61c7686e2 100644 --- a/django-stubs/utils/translation/__init__.pyi +++ b/django-stubs/utils/translation/__init__.pyi @@ -12,7 +12,7 @@ class TranslatorCommentWarning(SyntaxWarning): ... class Trans: activate: Callable[..., Any] - check_for_language: functools._lru_cache_wrapper[Any] + check_for_language: functools._lru_cache_wrapper[Any, Any] # type: ignore [type-arg] deactivate: Callable[..., Any] deactivate_all: Callable[..., Any] get_language: Callable[..., Any] diff --git a/package.json b/package.json index 658858090..e355e8333 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { "devDependencies": { - "pyright": "^1.1.181" + "pyright": "1.1.188" } } diff --git a/poetry.lock b/poetry.lock index f06230877..bba5692fb 100644 --- a/poetry.lock +++ b/poetry.lock @@ -183,7 +183,7 @@ python-versions = "*" [[package]] name = "mypy" -version = "0.790" +version = "0.910" description = "Optional static typing for Python" category = "dev" optional = false @@ -191,11 +191,13 @@ python-versions = ">=3.5" [package.dependencies] mypy-extensions = ">=0.4.3,<0.5.0" -typed-ast = ">=1.4.0,<1.5.0" +toml = "*" +typed-ast = {version = ">=1.4.0,<1.5.0", markers = "python_version < \"3.8\""} typing-extensions = ">=3.7.4" [package.extras] dmypy = ["psutil (>=4.0)"] +python2 = ["typed-ast (>=1.4.0,<1.5.0)"] [[package]] name = "mypy-extensions" @@ -207,14 +209,14 @@ python-versions = "*" [[package]] name = "packaging" -version = "21.2" +version = "21.3" description = "Core utilities for Python packages" category = "dev" optional = false python-versions = ">=3.6" [package.dependencies] -pyparsing = ">=2.0.2,<3" +pyparsing = ">=2.0.2,<3.0.5 || >3.0.5" [[package]] name = "pathspec" @@ -260,11 +262,11 @@ python-versions = ">=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*" [[package]] name = "py" -version = "1.10.0" +version = "1.11.0" description = "library with cross-python path, ini-parsing, io, code, log facilities" category = "dev" optional = false -python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" +python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*" [[package]] name = "pycodestyle" @@ -284,11 +286,14 @@ python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" [[package]] name = "pyparsing" -version = "2.4.7" +version = "3.0.6" description = "Python parsing module" category = "dev" optional = false -python-versions = ">=2.6, !=3.0.*, !=3.1.*, !=3.2.*" +python-versions = ">=3.6" + +[package.extras] +diagrams = ["jinja2", "railroad-diagrams"] [[package]] name = "pytest" @@ -322,7 +327,7 @@ python-versions = "*" [[package]] name = "regex" -version = "2021.10.23" +version = "2021.11.10" description = "Alternative regular expression module, to replace re." category = "dev" optional = false @@ -361,13 +366,29 @@ optional = false python-versions = "*" [[package]] -name = "typing-extensions" -version = "3.10.0.2" -description = "Backported and Experimental Type Hints for Python 3.5+" +name = "types-pytz" +version = "2021.3.0" +description = "Typing stubs for pytz" category = "dev" optional = false python-versions = "*" +[[package]] +name = "types-pyyaml" +version = "6.0.1" +description = "Typing stubs for PyYAML" +category = "dev" +optional = false +python-versions = "*" + +[[package]] +name = "typing-extensions" +version = "4.0.0" +description = "Backported and Experimental Type Hints for Python 3.6+" +category = "dev" +optional = false +python-versions = ">=3.6" + [[package]] name = "zipp" version = "3.6.0" @@ -383,7 +404,7 @@ testing = ["pytest (>=4.6)", "pytest-checkdocs (>=2.4)", "pytest-flake8", "pytes [metadata] lock-version = "1.1" python-versions = "^3.6.2" -content-hash = "67d01da6ae257019998f17a15a3acc015665810f1b430ba7040f85a8728fe704" +content-hash = "9653d18dce093db4334d474aa85eece65454714cb77eea9862e67fc6d3750371" [metadata.files] asgiref = [ @@ -443,28 +464,37 @@ mccabe = [ {file = "mccabe-0.6.1.tar.gz", hash = "sha256:dd8d182285a0fe56bace7f45b5e7d1a6ebcbf524e8f3bd87eb0f125271b8831f"}, ] mypy = [ - {file = "mypy-0.790-cp35-cp35m-macosx_10_6_x86_64.whl", hash = "sha256:bd03b3cf666bff8d710d633d1c56ab7facbdc204d567715cb3b9f85c6e94f669"}, - {file = "mypy-0.790-cp35-cp35m-manylinux1_x86_64.whl", hash = "sha256:2170492030f6faa537647d29945786d297e4862765f0b4ac5930ff62e300d802"}, - {file = "mypy-0.790-cp35-cp35m-win_amd64.whl", hash = "sha256:e86bdace26c5fe9cf8cb735e7cedfe7850ad92b327ac5d797c656717d2ca66de"}, - {file = "mypy-0.790-cp36-cp36m-macosx_10_9_x86_64.whl", hash = "sha256:e97e9c13d67fbe524be17e4d8025d51a7dca38f90de2e462243ab8ed8a9178d1"}, - {file = "mypy-0.790-cp36-cp36m-manylinux1_x86_64.whl", hash = "sha256:0d34d6b122597d48a36d6c59e35341f410d4abfa771d96d04ae2c468dd201abc"}, - {file = "mypy-0.790-cp36-cp36m-win_amd64.whl", hash = "sha256:72060bf64f290fb629bd4a67c707a66fd88ca26e413a91384b18db3876e57ed7"}, - {file = "mypy-0.790-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:eea260feb1830a627fb526d22fbb426b750d9f5a47b624e8d5e7e004359b219c"}, - {file = "mypy-0.790-cp37-cp37m-manylinux1_x86_64.whl", hash = "sha256:c614194e01c85bb2e551c421397e49afb2872c88b5830e3554f0519f9fb1c178"}, - {file = "mypy-0.790-cp37-cp37m-win_amd64.whl", hash = "sha256:0a0d102247c16ce93c97066443d11e2d36e6cc2a32d8ccc1f705268970479324"}, - {file = "mypy-0.790-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:cf4e7bf7f1214826cf7333627cb2547c0db7e3078723227820d0a2490f117a01"}, - {file = "mypy-0.790-cp38-cp38-manylinux1_x86_64.whl", hash = "sha256:af4e9ff1834e565f1baa74ccf7ae2564ae38c8df2a85b057af1dbbc958eb6666"}, - {file = "mypy-0.790-cp38-cp38-win_amd64.whl", hash = "sha256:da56dedcd7cd502ccd3c5dddc656cb36113dd793ad466e894574125945653cea"}, - {file = "mypy-0.790-py3-none-any.whl", hash = "sha256:2842d4fbd1b12ab422346376aad03ff5d0805b706102e475e962370f874a5122"}, - {file = "mypy-0.790.tar.gz", hash = "sha256:2b21ba45ad9ef2e2eb88ce4aeadd0112d0f5026418324176fd494a6824b74975"}, + {file = "mypy-0.910-cp35-cp35m-macosx_10_9_x86_64.whl", hash = "sha256:a155d80ea6cee511a3694b108c4494a39f42de11ee4e61e72bc424c490e46457"}, + {file = "mypy-0.910-cp35-cp35m-manylinux1_x86_64.whl", hash = "sha256:b94e4b785e304a04ea0828759172a15add27088520dc7e49ceade7834275bedb"}, + {file = "mypy-0.910-cp35-cp35m-manylinux2010_x86_64.whl", hash = "sha256:088cd9c7904b4ad80bec811053272986611b84221835e079be5bcad029e79dd9"}, + {file = "mypy-0.910-cp35-cp35m-win_amd64.whl", hash = "sha256:adaeee09bfde366d2c13fe6093a7df5df83c9a2ba98638c7d76b010694db760e"}, + {file = "mypy-0.910-cp36-cp36m-macosx_10_9_x86_64.whl", hash = "sha256:ecd2c3fe726758037234c93df7e98deb257fd15c24c9180dacf1ef829da5f921"}, + {file = "mypy-0.910-cp36-cp36m-manylinux1_x86_64.whl", hash = "sha256:d9dd839eb0dc1bbe866a288ba3c1afc33a202015d2ad83b31e875b5905a079b6"}, + {file = "mypy-0.910-cp36-cp36m-manylinux2010_x86_64.whl", hash = "sha256:3e382b29f8e0ccf19a2df2b29a167591245df90c0b5a2542249873b5c1d78212"}, + {file = "mypy-0.910-cp36-cp36m-win_amd64.whl", hash = "sha256:53fd2eb27a8ee2892614370896956af2ff61254c275aaee4c230ae771cadd885"}, + {file = "mypy-0.910-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:b6fb13123aeef4a3abbcfd7e71773ff3ff1526a7d3dc538f3929a49b42be03f0"}, + {file = "mypy-0.910-cp37-cp37m-manylinux1_x86_64.whl", hash = "sha256:e4dab234478e3bd3ce83bac4193b2ecd9cf94e720ddd95ce69840273bf44f6de"}, + {file = "mypy-0.910-cp37-cp37m-manylinux2010_x86_64.whl", hash = "sha256:7df1ead20c81371ccd6091fa3e2878559b5c4d4caadaf1a484cf88d93ca06703"}, + {file = "mypy-0.910-cp37-cp37m-win_amd64.whl", hash = "sha256:0aadfb2d3935988ec3815952e44058a3100499f5be5b28c34ac9d79f002a4a9a"}, + {file = "mypy-0.910-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:ec4e0cd079db280b6bdabdc807047ff3e199f334050db5cbb91ba3e959a67504"}, + {file = "mypy-0.910-cp38-cp38-manylinux1_x86_64.whl", hash = "sha256:119bed3832d961f3a880787bf621634ba042cb8dc850a7429f643508eeac97b9"}, + {file = "mypy-0.910-cp38-cp38-manylinux2010_x86_64.whl", hash = "sha256:866c41f28cee548475f146aa4d39a51cf3b6a84246969f3759cb3e9c742fc072"}, + {file = "mypy-0.910-cp38-cp38-win_amd64.whl", hash = "sha256:ceb6e0a6e27fb364fb3853389607cf7eb3a126ad335790fa1e14ed02fba50811"}, + {file = "mypy-0.910-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:1a85e280d4d217150ce8cb1a6dddffd14e753a4e0c3cf90baabb32cefa41b59e"}, + {file = "mypy-0.910-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:42c266ced41b65ed40a282c575705325fa7991af370036d3f134518336636f5b"}, + {file = "mypy-0.910-cp39-cp39-manylinux1_x86_64.whl", hash = "sha256:3c4b8ca36877fc75339253721f69603a9c7fdb5d4d5a95a1a1b899d8b86a4de2"}, + {file = "mypy-0.910-cp39-cp39-manylinux2010_x86_64.whl", hash = "sha256:c0df2d30ed496a08de5daed2a9ea807d07c21ae0ab23acf541ab88c24b26ab97"}, + {file = "mypy-0.910-cp39-cp39-win_amd64.whl", hash = "sha256:c6c2602dffb74867498f86e6129fd52a2770c48b7cd3ece77ada4fa38f94eba8"}, + {file = "mypy-0.910-py3-none-any.whl", hash = "sha256:ef565033fa5a958e62796867b1df10c40263ea9ded87164d67572834e57a174d"}, + {file = "mypy-0.910.tar.gz", hash = "sha256:704098302473cb31a218f1775a873b376b30b4c18229421e9e9dc8916fd16150"}, ] mypy-extensions = [ {file = "mypy_extensions-0.4.3-py2.py3-none-any.whl", hash = "sha256:090fedd75945a69ae91ce1303b5824f428daf5a028d2f6ab8a299250a846f15d"}, {file = "mypy_extensions-0.4.3.tar.gz", hash = "sha256:2d82818f5bb3e369420cb3c4060a7970edba416647068eb4c5343488a6c604a8"}, ] packaging = [ - {file = "packaging-21.2-py3-none-any.whl", hash = "sha256:14317396d1e8cdb122989b916fa2c7e9ca8e2be9e8060a6eff75b6b7b4d8a7e0"}, - {file = "packaging-21.2.tar.gz", hash = "sha256:096d689d78ca690e4cd8a89568ba06d07ca097e3306a4381635073ca91479966"}, + {file = "packaging-21.3-py3-none-any.whl", hash = "sha256:ef103e05f519cdc783ae24ea4e2e0f508a9c99b2d4969652eed6a2e1ea5bd522"}, + {file = "packaging-21.3.tar.gz", hash = "sha256:dd47c42927d89ab911e606518907cc2d3a1f38bbd026385970643f9c5b8ecfeb"}, ] pathspec = [ {file = "pathspec-0.9.0-py2.py3-none-any.whl", hash = "sha256:7d15c4ddb0b5c802d161efc417ec1a2558ea2653c2e8ad9c19098201dc1c993a"}, @@ -496,8 +526,8 @@ psycopg2 = [ {file = "psycopg2-2.8.6.tar.gz", hash = "sha256:fb23f6c71107c37fd667cb4ea363ddeb936b348bbd6449278eb92c189699f543"}, ] py = [ - {file = "py-1.10.0-py2.py3-none-any.whl", hash = "sha256:3b80836aa6d1feeaa108e046da6423ab8f6ceda6468545ae8d02d9d58d18818a"}, - {file = "py-1.10.0.tar.gz", hash = "sha256:21b81bda15b66ef5e1a777a21c4dcd9c20ad3efd0b3f817e7a809035269e1bd3"}, + {file = "py-1.11.0-py2.py3-none-any.whl", hash = "sha256:607c53218732647dff4acdfcd50cb62615cedf612e72d1724fb1a0cc6405b378"}, + {file = "py-1.11.0.tar.gz", hash = "sha256:51c75c4126074b472f746a24399ad32f6053d1b34b68d2fa41e558e6f4a98719"}, ] pycodestyle = [ {file = "pycodestyle-2.8.0-py2.py3-none-any.whl", hash = "sha256:720f8b39dde8b293825e7ff02c475f3077124006db4f440dcbc9a20b76548a20"}, @@ -508,8 +538,8 @@ pyflakes = [ {file = "pyflakes-2.4.0.tar.gz", hash = "sha256:05a85c2872edf37a4ed30b0cce2f6093e1d0581f8c19d7393122da7e25b2b24c"}, ] pyparsing = [ - {file = "pyparsing-2.4.7-py2.py3-none-any.whl", hash = "sha256:ef9d7589ef3c200abe66653d3f1ab1033c3c419ae9b9bdb1240a85b024efc88b"}, - {file = "pyparsing-2.4.7.tar.gz", hash = "sha256:c203ec8783bf771a155b207279b9bccb8dea02d8f0c9e5f8ead507bc3246ecc1"}, + {file = "pyparsing-3.0.6-py3-none-any.whl", hash = "sha256:04ff808a5b90911829c55c4e26f75fa5ca8a2f5f36aa3a51f68e27033341d3e4"}, + {file = "pyparsing-3.0.6.tar.gz", hash = "sha256:d9bdec0013ef1eb5a84ab39a3b3868911598afa494f5faa038647101504e2b81"}, ] pytest = [ {file = "pytest-6.2.2-py3-none-any.whl", hash = "sha256:b574b57423e818210672e07ca1fa90aaf194a4f63f3ab909a2c67ebb22913839"}, @@ -520,42 +550,55 @@ pytz = [ {file = "pytz-2021.3.tar.gz", hash = "sha256:acad2d8b20a1af07d4e4c9d2e9285c5ed9104354062f275f3fcd88dcef4f1326"}, ] regex = [ - {file = "regex-2021.10.23-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:45b65d6a275a478ac2cbd7fdbf7cc93c1982d613de4574b56fd6972ceadb8395"}, - {file = "regex-2021.10.23-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:74d071dbe4b53c602edd87a7476ab23015a991374ddb228d941929ad7c8c922e"}, - {file = "regex-2021.10.23-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_12_i686.manylinux2010_i686.whl", hash = "sha256:34d870f9f27f2161709054d73646fc9aca49480617a65533fc2b4611c518e455"}, - {file = "regex-2021.10.23-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:2fb698037c35109d3c2e30f2beb499e5ebae6e4bb8ff2e60c50b9a805a716f79"}, - {file = "regex-2021.10.23-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:cb46b542133999580ffb691baf67410306833ee1e4f58ed06b6a7aaf4e046952"}, - {file = "regex-2021.10.23-cp310-cp310-win32.whl", hash = "sha256:5e9c9e0ce92f27cef79e28e877c6b6988c48b16942258f3bc55d39b5f911df4f"}, - {file = "regex-2021.10.23-cp310-cp310-win_amd64.whl", hash = "sha256:ab7c5684ff3538b67df3f93d66bd3369b749087871ae3786e70ef39e601345b0"}, - {file = "regex-2021.10.23-cp36-cp36m-macosx_10_9_x86_64.whl", hash = "sha256:de557502c3bec8e634246588a94e82f1ee1b9dfcfdc453267c4fb652ff531570"}, - {file = "regex-2021.10.23-cp36-cp36m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:ee684f139c91e69fe09b8e83d18b4d63bf87d9440c1eb2eeb52ee851883b1b29"}, - {file = "regex-2021.10.23-cp36-cp36m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_12_i686.manylinux2010_i686.whl", hash = "sha256:5095a411c8479e715784a0c9236568ae72509450ee2226b649083730f3fadfc6"}, - {file = "regex-2021.10.23-cp36-cp36m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:7b568809dca44cb75c8ebb260844ea98252c8c88396f9d203f5094e50a70355f"}, - {file = "regex-2021.10.23-cp36-cp36m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:eb672217f7bd640411cfc69756ce721d00ae600814708d35c930930f18e8029f"}, - {file = "regex-2021.10.23-cp36-cp36m-win32.whl", hash = "sha256:a7a986c45d1099a5de766a15de7bee3840b1e0e1a344430926af08e5297cf666"}, - {file = "regex-2021.10.23-cp36-cp36m-win_amd64.whl", hash = "sha256:6d7722136c6ed75caf84e1788df36397efdc5dbadab95e59c2bba82d4d808a4c"}, - {file = "regex-2021.10.23-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:9f665677e46c5a4d288ece12fdedf4f4204a422bb28ff05f0e6b08b7447796d1"}, - {file = "regex-2021.10.23-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:450dc27483548214314640c89a0f275dbc557968ed088da40bde7ef8fb52829e"}, - {file = "regex-2021.10.23-cp37-cp37m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_12_i686.manylinux2010_i686.whl", hash = "sha256:129472cd06062fb13e7b4670a102951a3e655e9b91634432cfbdb7810af9d710"}, - {file = "regex-2021.10.23-cp37-cp37m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:a940ca7e7189d23da2bfbb38973832813eab6bd83f3bf89a977668c2f813deae"}, - {file = "regex-2021.10.23-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:530fc2bbb3dc1ebb17f70f7b234f90a1dd43b1b489ea38cea7be95fb21cdb5c7"}, - {file = "regex-2021.10.23-cp37-cp37m-win32.whl", hash = "sha256:ded0c4a3eee56b57fcb2315e40812b173cafe79d2f992d50015f4387445737fa"}, - {file = "regex-2021.10.23-cp37-cp37m-win_amd64.whl", hash = "sha256:391703a2abf8013d95bae39145d26b4e21531ab82e22f26cd3a181ee2644c234"}, - {file = "regex-2021.10.23-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:be04739a27be55631069b348dda0c81d8ea9822b5da10b8019b789e42d1fe452"}, - {file = "regex-2021.10.23-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:13ec99df95003f56edcd307db44f06fbeb708c4ccdcf940478067dd62353181e"}, - {file = "regex-2021.10.23-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_12_i686.manylinux2010_i686.whl", hash = "sha256:8d1cdcda6bd16268316d5db1038965acf948f2a6f43acc2e0b1641ceab443623"}, - {file = "regex-2021.10.23-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:0c186691a7995ef1db61205e00545bf161fb7b59cdb8c1201c89b333141c438a"}, - {file = "regex-2021.10.23-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:2b20f544cbbeffe171911f6ce90388ad36fe3fad26b7c7a35d4762817e9ea69c"}, - {file = "regex-2021.10.23-cp38-cp38-win32.whl", hash = "sha256:c0938ddd60cc04e8f1faf7a14a166ac939aac703745bfcd8e8f20322a7373019"}, - {file = "regex-2021.10.23-cp38-cp38-win_amd64.whl", hash = "sha256:56f0c81c44638dfd0e2367df1a331b4ddf2e771366c4b9c5d9a473de75e3e1c7"}, - {file = "regex-2021.10.23-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:80bb5d2e92b2258188e7dcae5b188c7bf868eafdf800ea6edd0fbfc029984a88"}, - {file = "regex-2021.10.23-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:e1dae12321b31059a1a72aaa0e6ba30156fe7e633355e445451e4021b8e122b6"}, - {file = "regex-2021.10.23-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_12_i686.manylinux2010_i686.whl", hash = "sha256:1f2b59c28afc53973d22e7bc18428721ee8ca6079becf1b36571c42627321c65"}, - {file = "regex-2021.10.23-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:d134757a37d8640f3c0abb41f5e68b7cf66c644f54ef1cb0573b7ea1c63e1509"}, - {file = "regex-2021.10.23-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:0dcc0e71118be8c69252c207630faf13ca5e1b8583d57012aae191e7d6d28b84"}, - {file = "regex-2021.10.23-cp39-cp39-win32.whl", hash = "sha256:a30513828180264294953cecd942202dfda64e85195ae36c265daf4052af0464"}, - {file = "regex-2021.10.23-cp39-cp39-win_amd64.whl", hash = "sha256:0f7552429dd39f70057ac5d0e897e5bfe211629652399a21671e53f2a9693a4e"}, - {file = "regex-2021.10.23.tar.gz", hash = "sha256:f3f9a91d3cc5e5b0ddf1043c0ae5fa4852f18a1c0050318baf5fc7930ecc1f9c"}, + {file = "regex-2021.11.10-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:9345b6f7ee578bad8e475129ed40123d265464c4cfead6c261fd60fc9de00bcf"}, + {file = "regex-2021.11.10-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:416c5f1a188c91e3eb41e9c8787288e707f7d2ebe66e0a6563af280d9b68478f"}, + {file = "regex-2021.11.10-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:e0538c43565ee6e703d3a7c3bdfe4037a5209250e8502c98f20fea6f5fdf2965"}, + {file = "regex-2021.11.10-cp310-cp310-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:7ee1227cf08b6716c85504aebc49ac827eb88fcc6e51564f010f11a406c0a667"}, + {file = "regex-2021.11.10-cp310-cp310-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:6650f16365f1924d6014d2ea770bde8555b4a39dc9576abb95e3cd1ff0263b36"}, + {file = "regex-2021.11.10-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:30ab804ea73972049b7a2a5c62d97687d69b5a60a67adca07eb73a0ddbc9e29f"}, + {file = "regex-2021.11.10-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:68a067c11463de2a37157930d8b153005085e42bcb7ad9ca562d77ba7d1404e0"}, + {file = "regex-2021.11.10-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:162abfd74e88001d20cb73ceaffbfe601469923e875caf9118333b1a4aaafdc4"}, + {file = "regex-2021.11.10-cp310-cp310-win32.whl", hash = "sha256:98ba568e8ae26beb726aeea2273053c717641933836568c2a0278a84987b2a1a"}, + {file = "regex-2021.11.10-cp310-cp310-win_amd64.whl", hash = "sha256:780b48456a0f0ba4d390e8b5f7c661fdd218934388cde1a974010a965e200e12"}, + {file = "regex-2021.11.10-cp36-cp36m-macosx_10_9_x86_64.whl", hash = "sha256:dba70f30fd81f8ce6d32ddeef37d91c8948e5d5a4c63242d16a2b2df8143aafc"}, + {file = "regex-2021.11.10-cp36-cp36m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:e1f54b9b4b6c53369f40028d2dd07a8c374583417ee6ec0ea304e710a20f80a0"}, + {file = "regex-2021.11.10-cp36-cp36m-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:fbb9dc00e39f3e6c0ef48edee202f9520dafb233e8b51b06b8428cfcb92abd30"}, + {file = "regex-2021.11.10-cp36-cp36m-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:666abff54e474d28ff42756d94544cdfd42e2ee97065857413b72e8a2d6a6345"}, + {file = "regex-2021.11.10-cp36-cp36m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:5537f71b6d646f7f5f340562ec4c77b6e1c915f8baae822ea0b7e46c1f09b733"}, + {file = "regex-2021.11.10-cp36-cp36m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:ed2e07c6a26ed4bea91b897ee2b0835c21716d9a469a96c3e878dc5f8c55bb23"}, + {file = "regex-2021.11.10-cp36-cp36m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:ca5f18a75e1256ce07494e245cdb146f5a9267d3c702ebf9b65c7f8bd843431e"}, + {file = "regex-2021.11.10-cp36-cp36m-win32.whl", hash = "sha256:93a5051fcf5fad72de73b96f07d30bc29665697fb8ecdfbc474f3452c78adcf4"}, + {file = "regex-2021.11.10-cp36-cp36m-win_amd64.whl", hash = "sha256:b483c9d00a565633c87abd0aaf27eb5016de23fed952e054ecc19ce32f6a9e7e"}, + {file = "regex-2021.11.10-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:fff55f3ce50a3ff63ec8e2a8d3dd924f1941b250b0aac3d3d42b687eeff07a8e"}, + {file = "regex-2021.11.10-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:e32d2a2b02ccbef10145df9135751abea1f9f076e67a4e261b05f24b94219e36"}, + {file = "regex-2021.11.10-cp37-cp37m-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:53db2c6be8a2710b359bfd3d3aa17ba38f8aa72a82309a12ae99d3c0c3dcd74d"}, + {file = "regex-2021.11.10-cp37-cp37m-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:2207ae4f64ad3af399e2d30dde66f0b36ae5c3129b52885f1bffc2f05ec505c8"}, + {file = "regex-2021.11.10-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:d5ca078bb666c4a9d1287a379fe617a6dccd18c3e8a7e6c7e1eb8974330c626a"}, + {file = "regex-2021.11.10-cp37-cp37m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:dd33eb9bdcfbabab3459c9ee651d94c842bc8a05fabc95edf4ee0c15a072495e"}, + {file = "regex-2021.11.10-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:05b7d6d7e64efe309972adab77fc2af8907bb93217ec60aa9fe12a0dad35874f"}, + {file = "regex-2021.11.10-cp37-cp37m-win32.whl", hash = "sha256:e71255ba42567d34a13c03968736c5d39bb4a97ce98188fafb27ce981115beec"}, + {file = "regex-2021.11.10-cp37-cp37m-win_amd64.whl", hash = "sha256:07856afef5ffcc052e7eccf3213317fbb94e4a5cd8177a2caa69c980657b3cb4"}, + {file = "regex-2021.11.10-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:ba05430e819e58544e840a68b03b28b6d328aff2e41579037e8bab7653b37d83"}, + {file = "regex-2021.11.10-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:7f301b11b9d214f83ddaf689181051e7f48905568b0c7017c04c06dfd065e244"}, + {file = "regex-2021.11.10-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:4aaa4e0705ef2b73dd8e36eeb4c868f80f8393f5f4d855e94025ce7ad8525f50"}, + {file = "regex-2021.11.10-cp38-cp38-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:788aef3549f1924d5c38263104dae7395bf020a42776d5ec5ea2b0d3d85d6646"}, + {file = "regex-2021.11.10-cp38-cp38-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:f8af619e3be812a2059b212064ea7a640aff0568d972cd1b9e920837469eb3cb"}, + {file = "regex-2021.11.10-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:85bfa6a5413be0ee6c5c4a663668a2cad2cbecdee367630d097d7823041bdeec"}, + {file = "regex-2021.11.10-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:f23222527b307970e383433daec128d769ff778d9b29343fb3496472dc20dabe"}, + {file = "regex-2021.11.10-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:da1a90c1ddb7531b1d5ff1e171b4ee61f6345119be7351104b67ff413843fe94"}, + {file = "regex-2021.11.10-cp38-cp38-win32.whl", hash = "sha256:0617383e2fe465732af4509e61648b77cbe3aee68b6ac8c0b6fe934db90be5cc"}, + {file = "regex-2021.11.10-cp38-cp38-win_amd64.whl", hash = "sha256:a3feefd5e95871872673b08636f96b61ebef62971eab044f5124fb4dea39919d"}, + {file = "regex-2021.11.10-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:f7f325be2804246a75a4f45c72d4ce80d2443ab815063cdf70ee8fb2ca59ee1b"}, + {file = "regex-2021.11.10-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:537ca6a3586931b16a85ac38c08cc48f10fc870a5b25e51794c74df843e9966d"}, + {file = "regex-2021.11.10-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:eef2afb0fd1747f33f1ee3e209bce1ed582d1896b240ccc5e2697e3275f037c7"}, + {file = "regex-2021.11.10-cp39-cp39-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:432bd15d40ed835a51617521d60d0125867f7b88acf653e4ed994a1f8e4995dc"}, + {file = "regex-2021.11.10-cp39-cp39-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:b43c2b8a330a490daaef5a47ab114935002b13b3f9dc5da56d5322ff218eeadb"}, + {file = "regex-2021.11.10-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:962b9a917dd7ceacbe5cd424556914cb0d636001e393b43dc886ba31d2a1e449"}, + {file = "regex-2021.11.10-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:fa8c626d6441e2d04b6ee703ef2d1e17608ad44c7cb75258c09dd42bacdfc64b"}, + {file = "regex-2021.11.10-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:3c5fb32cc6077abad3bbf0323067636d93307c9fa93e072771cf9a64d1c0f3ef"}, + {file = "regex-2021.11.10-cp39-cp39-win32.whl", hash = "sha256:3b5df18db1fccd66de15aa59c41e4f853b5df7550723d26aa6cb7f40e5d9da5a"}, + {file = "regex-2021.11.10-cp39-cp39-win_amd64.whl", hash = "sha256:83ee89483672b11f8952b158640d0c0ff02dc43d9cb1b70c1564b49abe92ce29"}, + {file = "regex-2021.11.10.tar.gz", hash = "sha256:f341ee2df0999bfdf7a95e448075effe0db212a59387de1a70690e4acb03d4c6"}, ] sqlparse = [ {file = "sqlparse-0.4.2-py3-none-any.whl", hash = "sha256:48719e356bb8b42991bdbb1e8b83223757b93789c00910a616a071910ca4a64d"}, @@ -601,10 +644,17 @@ typed-ast = [ {file = "typed_ast-1.4.3-cp39-cp39-win_amd64.whl", hash = "sha256:9c6d1a54552b5330bc657b7ef0eae25d00ba7ffe85d9ea8ae6540d2197a3788c"}, {file = "typed_ast-1.4.3.tar.gz", hash = "sha256:fb1bbeac803adea29cedd70781399c99138358c26d05fcbd23c13016b7f5ec65"}, ] +types-pytz = [ + {file = "types-pytz-2021.3.0.tar.gz", hash = "sha256:86a61967834dceeaaf98b6902ed8357efdd262bb8afcaf4bc8ccecf748592778"}, + {file = "types_pytz-2021.3.0-py3-none-any.whl", hash = "sha256:b5027e5de50a4c978cd60ca16849d934d44c44ebd7d29cf13ada009efaa9feef"}, +] +types-pyyaml = [ + {file = "types-PyYAML-6.0.1.tar.gz", hash = "sha256:2e27b0118ca4248a646101c5c318dc02e4ca2866d6bc42e84045dbb851555a76"}, + {file = "types_PyYAML-6.0.1-py3-none-any.whl", hash = "sha256:d5b318269652e809b5c30a5fe666c50159ab80bfd41cd6bafe655bf20b29fcba"}, +] typing-extensions = [ - {file = "typing_extensions-3.10.0.2-py2-none-any.whl", hash = "sha256:d8226d10bc02a29bcc81df19a26e56a9647f8b0a6d4a83924139f4a8b01f17b7"}, - {file = "typing_extensions-3.10.0.2-py3-none-any.whl", hash = "sha256:f1d25edafde516b146ecd0613dabcc61409817af4766fbbcfb8d1ad4ec441a34"}, - {file = "typing_extensions-3.10.0.2.tar.gz", hash = "sha256:49f75d16ff11f1cd258e1b988ccff82a3ca5570217d7ad8c5f48205dd99a677e"}, + {file = "typing_extensions-4.0.0-py3-none-any.whl", hash = "sha256:829704698b22e13ec9eaf959122315eabb370b0884400e9818334d8b677023d9"}, + {file = "typing_extensions-4.0.0.tar.gz", hash = "sha256:2cdf80e4e04866a9b3689a51869016d36db0814d84b8d8a568d22781d45d27ed"}, ] zipp = [ {file = "zipp-3.6.0-py3-none-any.whl", hash = "sha256:9fe5ea21568a0a70e50f273397638d39b03353731e6cbbb3fd8502a33fec40bc"}, diff --git a/psycopg2-stubs/extras.pyi b/psycopg2-stubs/extras.pyi index c824277e5..575418216 100644 --- a/psycopg2-stubs/extras.pyi +++ b/psycopg2-stubs/extras.pyi @@ -60,8 +60,8 @@ class DictCursor(DictCursorBase): class DictRow(List[Any]): _index: OrderedDict[str, int] def __init__(self, cursor: DictCursor) -> None: ... - def __getitem__(self, x: Union[str, int, slice]) -> Any: ... - def __setitem__(self, x: Union[str, int, slice], v: Any) -> None: ... + def __getitem__(self, x: Union[str, int, slice]) -> Any: ... # type: ignore [override] + def __setitem__(self, x: Union[str, int, slice], v: Any) -> None: ... # type: ignore [override] def items(self) -> Iterator[Tuple[str, Any]]: ... def keys(self) -> Iterator[str]: ... def values(self) -> Iterator[Any]: ... diff --git a/pyproject.toml b/pyproject.toml index 05042604f..d435acf32 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -20,12 +20,14 @@ python = "^3.6.2" black = "21.9b0" pytest = "6.2.2" wheel = "0.35.1" -mypy = "0.790" +mypy = "0.910" isort = "5.9.3" Django = "3.1.7" flake8 = "4.0.1" psycopg2 = "2.8.6" flake8-pyi = "^20.10.0" +types-PyYAML = "^6.0.1" +types-pytz = "^2021.3.0" [tool.black] line-length = 88 diff --git a/yarn.lock b/yarn.lock index a68295de9..4aefbcefb 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2,7 +2,7 @@ # yarn lockfile v1 -pyright@^1.1.181: - version "1.1.181" - resolved "https://registry.yarnpkg.com/pyright/-/pyright-1.1.181.tgz#a86eac21531c6542f9500ea96e39342b65d31acd" - integrity sha512-YuBEA9qwGYNeTBpUtlFKYlNmK8X3/hz/wTRkfR6Z2HDLBQSOpqmNAu/lWrzDnJopSvXwK2qNrW0zFjCE1I4dzg== +pyright@1.1.188: + version "1.1.188" + resolved "https://registry.yarnpkg.com/pyright/-/pyright-1.1.188.tgz#1b5c5787f626cfe9baa0cc4584a99125ed4a3281" + integrity sha512-9ypjVwXwVroIzo/atn3hvfOuyH/eBRQMr2ayIN/+rqKmx4haNxuCdV/WnYa5QIH6l4LFSMV+rTHLRISIFMv+1w== From 9725ceb850eb4712cefc8c84d9136a882278bfab Mon Sep 17 00:00:00 2001 From: Thiago Bellini Ribeiro Date: Sun, 21 Nov 2021 19:37:52 -0300 Subject: [PATCH 81/88] Improve related fields and many to many typing (#63) This was built on top of https://github.com/sbdchd/django-types/pull/73, so merging it should only keep this PR's change Fix https://github.com/sbdchd/django-types/issues/51 --- django-stubs/contrib/admin/options.pyi | 5 +- django-stubs/contrib/auth/models.pyi | 6 +- django-stubs/contrib/flatpages/models.pyi | 2 +- django-stubs/core/serializers/base.pyi | 2 +- django-stubs/db/models/deletion.pyi | 58 +++- django-stubs/db/models/fields/__init__.pyi | 2 +- django-stubs/db/models/fields/related.pyi | 325 +++++++++++++++------ django-stubs/db/models/manager.pyi | 62 +++- django-stubs/db/models/options.pyi | 4 +- django-stubs/db/models/query.pyi | 2 +- tests/trout/models.py | 33 ++- 11 files changed, 374 insertions(+), 127 deletions(-) diff --git a/django-stubs/contrib/admin/options.pyi b/django-stubs/contrib/admin/options.pyi index 1b89fb787..e439f2423 100644 --- a/django-stubs/contrib/admin/options.pyi +++ b/django-stubs/contrib/admin/options.pyi @@ -114,7 +114,10 @@ class BaseModelAdmin(Generic[_ModelT]): self, db_field: ForeignKey[Any], request: Optional[HttpRequest], **kwargs: Any ) -> Optional[ModelChoiceField]: ... def formfield_for_manytomany( - self, db_field: ManyToManyField, request: Optional[HttpRequest], **kwargs: Any + self, + db_field: ManyToManyField[Any, Any], + request: Optional[HttpRequest], + **kwargs: Any ) -> ModelMultipleChoiceField: ... def get_autocomplete_fields(self, request: HttpRequest) -> Tuple[Any, ...]: ... def get_view_on_site_url(self, obj: Optional[_ModelT] = ...) -> Optional[str]: ... diff --git a/django-stubs/contrib/auth/models.pyi b/django-stubs/contrib/auth/models.pyi index 9a54951b2..babfb17c3 100644 --- a/django-stubs/contrib/auth/models.pyi +++ b/django-stubs/contrib/auth/models.pyi @@ -42,7 +42,7 @@ class Group(models.Model): objects: GroupManager name = models.CharField(max_length=150) - permissions = models.ManyToManyField(Permission) + permissions = models.ManyToManyField[Permission, Any](Permission) def natural_key(self) -> Any: ... _T = TypeVar("_T", bound=Model) @@ -73,8 +73,8 @@ class UserManager(BaseUserManager[_T]): class PermissionsMixin(models.Model): is_superuser = models.BooleanField() - groups = models.ManyToManyField(Group) - user_permissions = models.ManyToManyField(Permission) + groups = models.ManyToManyField[Group, Any](Group) + user_permissions = models.ManyToManyField[Permission, Any](Permission) def get_user_permissions(self, obj: Optional[_AnyUser] = ...) -> Set[str]: ... def get_group_permissions(self, obj: Optional[_AnyUser] = ...) -> Set[str]: ... def get_all_permissions(self, obj: Optional[_AnyUser] = ...) -> Set[str]: ... diff --git a/django-stubs/contrib/flatpages/models.pyi b/django-stubs/contrib/flatpages/models.pyi index 8ff90e16a..a5bc79cb8 100644 --- a/django-stubs/contrib/flatpages/models.pyi +++ b/django-stubs/contrib/flatpages/models.pyi @@ -9,5 +9,5 @@ class FlatPage(models.Model): enable_comments: models.BooleanField[Any] = ... template_name: models.CharField[Any] = ... registration_required: models.BooleanField[Any] = ... - sites: models.ManyToManyField = ... + sites: models.ManyToManyField[Any, Any] = ... def get_absolute_url(self) -> str: ... diff --git a/django-stubs/core/serializers/base.pyi b/django-stubs/core/serializers/base.pyi index bae8db5d2..94ef209f8 100644 --- a/django-stubs/core/serializers/base.pyi +++ b/django-stubs/core/serializers/base.pyi @@ -97,7 +97,7 @@ def build_instance( Model: Type[Model], data: Dict[str, Optional[Union[date, int, str, UUID]]], db: str ) -> Model: ... def deserialize_m2m_values( - field: ManyToManyField, field_value: Any, using: str + field: ManyToManyField[Any, Any], field_value: Any, using: str ) -> List[Any]: ... def deserialize_fk_value( field: ForeignKey[Any], field_value: Any, using: str diff --git a/django-stubs/db/models/deletion.pyi b/django-stubs/db/models/deletion.pyi index b81bd9ed8..9a6d2e7e4 100644 --- a/django-stubs/db/models/deletion.pyi +++ b/django-stubs/db/models/deletion.pyi @@ -1,17 +1,59 @@ -from typing import Any, Callable, Collection, Iterable, Optional, Set, Type, Union +from typing import ( + Any, + Callable, + Collection, + Iterable, + Optional, + Sequence, + Set, + Type, + Union, +) from django.db import IntegrityError from django.db.models.base import Model from django.db.models.fields import Field from django.db.models.options import Options -def CASCADE(collector: Any, field: Any, sub_objs: Any, using: Any) -> Any: ... -def SET_NULL(collector: Any, field: Any, sub_objs: Any, using: Any) -> Any: ... -def SET_DEFAULT(collector: Any, field: Any, sub_objs: Any, using: Any) -> Any: ... -def DO_NOTHING(collector: Any, field: Any, sub_objs: Any, using: Any) -> Any: ... -def PROTECT(collector: Any, field: Any, sub_objs: Any, using: Any) -> Any: ... -def RESTRICT(collector: Any, field: Any, sub_objs: Any, using: Any) -> Any: ... -def SET(value: Any) -> Callable[..., Any]: ... +def CASCADE( + collector: "Collector", + field: Field[Any, Any], + sub_objs: Sequence[Model], + using: str, +) -> None: ... +def SET_NULL( + collector: "Collector", + field: Field[Any, Any], + sub_objs: Sequence[Model], + using: str, +) -> None: ... +def SET_DEFAULT( + collector: "Collector", + field: Field[Any, Any], + sub_objs: Sequence[Model], + using: str, +) -> None: ... +def DO_NOTHING( + collector: "Collector", + field: Field[Any, Any], + sub_objs: Sequence[Model], + using: str, +) -> None: ... +def PROTECT( + collector: "Collector", + field: Field[Any, Any], + sub_objs: Sequence[Model], + using: str, +) -> None: ... +def RESTRICT( + collector: "Collector", + field: Field[Any, Any], + sub_objs: Sequence[Model], + using: str, +) -> None: ... +def SET( + value: Union[Any, Callable[[], Any]] +) -> Callable[["Collector", Field[Any, Any], Sequence[Model], str], None]: ... def get_candidate_relations_to_delete( opts: Options[Any], ) -> Iterable[Field[Any, Any]]: ... diff --git a/django-stubs/db/models/fields/__init__.pyi b/django-stubs/db/models/fields/__init__.pyi index 3f1150fb5..f95cf76d3 100644 --- a/django-stubs/db/models/fields/__init__.pyi +++ b/django-stubs/db/models/fields/__init__.pyi @@ -53,7 +53,7 @@ class Field(RegisterLookupMixin, Generic[_ST, _GT]): primary_key: bool remote_field: Field[_ST, _GT] is_relation: bool - related_model: Optional[Type[Model]] + related_model: Optional[Any] = None one_to_many: Optional[bool] = ... one_to_one: Optional[bool] = ... many_to_many: Optional[bool] = ... diff --git a/django-stubs/db/models/fields/related.pyi b/django-stubs/db/models/fields/related.pyi index ad3269d89..e8f98a4b4 100644 --- a/django-stubs/db/models/fields/related.pyi +++ b/django-stubs/db/models/fields/related.pyi @@ -6,6 +6,7 @@ from typing import ( Iterable, List, Optional, + Protocol, Sequence, Tuple, Type, @@ -17,6 +18,7 @@ from uuid import UUID from django.db import models from django.db.models.base import Model +from django.db.models.deletion import Collector from django.db.models.fields import Field from django.db.models.fields.mixins import FieldCacheMixin from django.db.models.fields.related_descriptors import ( @@ -40,15 +42,25 @@ from django.db.models.fields.reverse_related import ( # noqa: F401 from django.db.models.fields.reverse_related import ManyToManyRel as ManyToManyRel from django.db.models.fields.reverse_related import ManyToOneRel as ManyToOneRel from django.db.models.fields.reverse_related import OneToOneRel as OneToOneRel -from django.db.models.manager import RelatedManager +from django.db.models.manager import ManyToManyRelatedManager from django.db.models.query_utils import PathInfo, Q from typing_extensions import Literal -_T = TypeVar("_T", bound=models.Model) +class _DeleteProtocol(Protocol): + def __call__( + self, + collector: Collector, + field: Field[Any, Any], + sub_objs: Sequence[Model], + using: str, + ) -> None: ... + _F = TypeVar("_F", bound=models.Field[Any, Any]) _Choice = Tuple[Any, str] _ChoiceNamedGroup = Tuple[str, Iterable[_Choice]] _FieldChoices = Iterable[Union[_Choice, _ChoiceNamedGroup]] +_ChoicesLimit = Union[Dict[str, Any], Q, Callable[[], Q]] +_OnDeleteOptions = Union[_DeleteProtocol, Callable[[Any], _DeleteProtocol]] _ValidatorCallable = Callable[..., None] _ErrorMessagesToOverride = Dict[str, Any] @@ -56,16 +68,16 @@ _ErrorMessagesToOverride = Dict[str, Any] RECURSIVE_RELATIONSHIP_CONSTANT: str = ... # __set__ value type -_ST = TypeVar("_ST") +_ST = TypeVar("_ST", covariant=True) # __get__ return type -_GT = TypeVar("_GT") +_GT = TypeVar("_GT", contravariant=True) class RelatedField(FieldCacheMixin, Field[_ST, _GT]): one_to_many: bool = ... one_to_one: bool = ... many_to_many: bool = ... many_to_one: bool = ... - related_model: Type[Model] + related_model: Type[_GT] = ... opts: Any = ... def get_forward_related_filter(self, obj: Model) -> Dict[str, Union[int, UUID]]: ... def get_reverse_related_filter(self, obj: Model) -> Q: ... @@ -77,29 +89,105 @@ class RelatedField(FieldCacheMixin, Field[_ST, _GT]): def related_query_name(self) -> str: ... @property def target_field(self) -> Field[Any, Any]: ... + @overload + def __init__( + self: RelatedField[_ST, _GT], + related_name: Optional[str] = ..., + related_query_name: Optional[str] = ..., + limit_choices_to: Optional[_ChoicesLimit] = ..., + verbose_name: Optional[str] = ..., + name: Optional[str] = ..., + primary_key: bool = ..., + max_length: Optional[int] = ..., + unique: bool = ..., + blank: bool = ..., + null: Literal[False] = ..., + db_index: bool = ..., + default: Optional[Union[_GT, Callable[[], _GT]]] = ..., + editable: bool = ..., + auto_created: bool = ..., + serialize: bool = ..., + unique_for_date: Optional[str] = ..., + unique_for_month: Optional[str] = ..., + unique_for_year: Optional[str] = ..., + choices: Optional[_FieldChoices] = ..., + help_text: str = ..., + db_column: Optional[str] = ..., + db_tablespace: Optional[str] = ..., + validators: Iterable[_ValidatorCallable] = ..., + error_messages: Optional[_ErrorMessagesToOverride] = ..., + ) -> None: ... + @overload + def __init__( + self: RelatedField[Optional[_ST], Optional[_GT]], + related_name: Optional[str] = ..., + related_query_name: Optional[str] = ..., + limit_choices_to: Optional[_ChoicesLimit] = ..., + verbose_name: Optional[str] = ..., + name: Optional[str] = ..., + primary_key: bool = ..., + max_length: Optional[int] = ..., + unique: bool = ..., + blank: bool = ..., + null: Literal[True] = ..., + db_index: bool = ..., + default: Optional[Union[_GT, Callable[[], _GT]]] = ..., + editable: bool = ..., + auto_created: bool = ..., + serialize: bool = ..., + unique_for_date: Optional[str] = ..., + unique_for_month: Optional[str] = ..., + unique_for_year: Optional[str] = ..., + choices: Optional[_FieldChoices] = ..., + help_text: str = ..., + db_column: Optional[str] = ..., + db_tablespace: Optional[str] = ..., + validators: Iterable[_ValidatorCallable] = ..., + error_messages: Optional[_ErrorMessagesToOverride] = ..., + ) -> None: ... + @overload + def __new__( + cls, + *args: Any, + null: Literal[False] = ..., + **kwargs: Any, + ) -> RelatedField[_ST, _GT]: ... + @overload + def __new__( + cls, + *args: Any, + null: Literal[True], + **kwargs: Any, + ) -> RelatedField[Optional[_ST], Optional[_GT]]: ... _M = TypeVar("_M", bound=Optional[Model]) class ForeignObject(RelatedField[_M, _M]): - def __new__( - cls, + one_to_many: bool = False + one_to_one: bool = False + many_to_many: bool = False + many_to_one: bool = True + related_model: Type[_M] = ... + @overload + def __init__( + self: ForeignObject[_M], to: Union[Type[_M], str], - on_delete: Callable[..., None], + on_delete: _OnDeleteOptions, from_fields: Sequence[str], to_fields: Sequence[str], rel: Optional[ForeignObjectRel] = ..., related_name: Optional[str] = ..., related_query_name: Optional[str] = ..., - limit_choices_to: Optional[Union[Dict[str, Any], Callable[[], Any]]] = ..., + limit_choices_to: Optional[_ChoicesLimit] = ..., parent_link: bool = ..., db_constraint: bool = ..., swappable: bool = ..., - verbose_name: Optional[Union[str, bytes]] = ..., + verbose_name: Optional[str] = ..., name: Optional[str] = ..., primary_key: bool = ..., unique: bool = ..., blank: bool = ..., - null: bool = ..., + null: Literal[False] = ..., db_index: bool = ..., default: Any = ..., editable: bool = ..., @@ -111,105 +199,110 @@ class ForeignObject(RelatedField[_M, _M]): db_tablespace: Optional[str] = ..., validators: Iterable[_ValidatorCallable] = ..., error_messages: Optional[_ErrorMessagesToOverride] = ..., - ) -> ForeignObject[_M]: ... - -class ForeignKey(Generic[_M], ForeignObject[_M]): + ) -> None: ... @overload - def __new__( # type: ignore [misc] - cls, + def __init__( + self: ForeignObject[Optional[_M]], to: Union[Type[_M], str], - on_delete: Callable[..., None], - to_field: Optional[str] = ..., + on_delete: _OnDeleteOptions, + from_fields: Sequence[str], + to_fields: Sequence[str], + rel: Optional[ForeignObjectRel] = ..., related_name: Optional[str] = ..., related_query_name: Optional[str] = ..., - limit_choices_to: Optional[Union[Dict[str, Any], Callable[[], Any], Q]] = ..., + limit_choices_to: Optional[_ChoicesLimit] = ..., parent_link: bool = ..., db_constraint: bool = ..., - verbose_name: Optional[Union[str, bytes]] = ..., + swappable: bool = ..., + verbose_name: Optional[str] = ..., name: Optional[str] = ..., primary_key: bool = ..., - max_length: Optional[int] = ..., unique: bool = ..., blank: bool = ..., - null: Literal[False] = ..., + null: Literal[True] = ..., 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] = ..., - ) -> ForeignKey[_M]: ... - @overload + ) -> None: ... def __new__( cls, to: Union[Type[_M], str], - on_delete: Callable[..., None], - to_field: Optional[str] = ..., + on_delete: _OnDeleteOptions, + from_fields: Sequence[str], + to_fields: Sequence[str], + rel: Optional[ForeignObjectRel] = ..., related_name: Optional[str] = ..., related_query_name: Optional[str] = ..., - limit_choices_to: Optional[Union[Dict[str, Any], Callable[[], Any], Q]] = ..., + limit_choices_to: Optional[_ChoicesLimit] = ..., parent_link: bool = ..., db_constraint: bool = ..., - verbose_name: Optional[Union[str, bytes]] = ..., + swappable: bool = ..., + verbose_name: Optional[str] = ..., name: Optional[str] = ..., primary_key: bool = ..., - max_length: Optional[int] = ..., unique: bool = ..., blank: bool = ..., - null: Literal[True] = ..., + 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] = ..., - ) -> ForeignKey[Optional[_M]]: ... - # class access - @overload # type: ignore - def __get__(self, instance: None, owner: Any) -> ForwardManyToOneDescriptor: ... - # Model instance access - @overload - def __get__(self: ForeignKey[_M], instance: Any, owner: Any) -> _M: ... - @overload - def __get__( - self: ForeignKey[Optional[_M]], instance: Any, owner: Any - ) -> Optional[_M]: ... - # non-Model instances - @overload - def __get__(self: _F, instance: Any, owner: Any) -> _F: ... + ) -> ForeignObject[_M]: ... -class OneToOneField(Generic[_M], RelatedField[_M, _M]): +class ForeignKey(Generic[_M], ForeignObject[_M]): + one_to_many: bool = False + one_to_one: bool = False + many_to_many: bool = False + many_to_one: bool = True + related_model: Type[_M] = ... + @overload + def __new__( + cls, + to: Union[Type[_M], str], + on_delete: _OnDeleteOptions, + *args: Any, + null: Literal[False] = ..., + **kwargs: Any, + ) -> ForeignKey[_M]: ... @overload - def __new__( # type: ignore [misc] + def __new__( cls, to: Union[Type[_M], str], - on_delete: Any, + on_delete: _OnDeleteOptions, + *args: Any, + null: Literal[True], + **kwargs: Any, + ) -> ForeignKey[Optional[_M]]: ... + @overload + def __init__( + self: ForeignKey[_M], + to: Union[Type[_M], str], + on_delete: _OnDeleteOptions, to_field: Optional[str] = ..., related_name: Optional[str] = ..., related_query_name: Optional[str] = ..., - limit_choices_to: Optional[Union[Dict[str, Any], Callable[[], Any], Q]] = ..., + limit_choices_to: Optional[_ChoicesLimit] = ..., parent_link: bool = ..., db_constraint: bool = ..., - verbose_name: Optional[Union[str, bytes]] = ..., + swappable: bool = ..., + verbose_name: Optional[str] = ..., name: Optional[str] = ..., primary_key: bool = ..., - max_length: Optional[int] = ..., unique: bool = ..., blank: bool = ..., null: Literal[False] = ..., @@ -218,31 +311,28 @@ class OneToOneField(Generic[_M], RelatedField[_M, _M]): 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] = ..., - ) -> OneToOneField[_M]: ... + ) -> None: ... @overload - def __new__( - cls, + def __init__( + self: ForeignKey[Optional[_M]], to: Union[Type[_M], str], - on_delete: Any, + on_delete: _OnDeleteOptions, to_field: Optional[str] = ..., related_name: Optional[str] = ..., related_query_name: Optional[str] = ..., - limit_choices_to: Optional[Union[Dict[str, Any], Callable[[], Any], Q]] = ..., + limit_choices_to: Optional[_ChoicesLimit] = ..., parent_link: bool = ..., db_constraint: bool = ..., - verbose_name: Optional[Union[str, bytes]] = ..., + swappable: bool = ..., + verbose_name: Optional[str] = ..., name: Optional[str] = ..., primary_key: bool = ..., - max_length: Optional[int] = ..., unique: bool = ..., blank: bool = ..., null: Literal[True] = ..., @@ -251,15 +341,50 @@ class OneToOneField(Generic[_M], RelatedField[_M, _M]): editable: bool = ..., auto_created: bool = ..., serialize: bool = ..., - unique_for_date: Optional[str] = ..., - unique_for_month: Optional[str] = ..., - unique_for_year: Optional[str] = ..., choices: Optional[_FieldChoices] = ..., help_text: str = ..., db_column: Optional[str] = ..., db_tablespace: Optional[str] = ..., validators: Iterable[_ValidatorCallable] = ..., error_messages: Optional[_ErrorMessagesToOverride] = ..., + ) -> None: ... + # class access + @overload # type: ignore + def __get__(self, instance: None, owner: Any) -> ForwardManyToOneDescriptor: ... + # Model instance access + @overload + def __get__(self: ForeignKey[_M], instance: Any, owner: Any) -> _M: ... + @overload + def __get__( + self: ForeignKey[Optional[_M]], instance: Any, owner: Any + ) -> Optional[_M]: ... + # non-Model instances + @overload + def __get__(self: _F, instance: Any, owner: Any) -> _F: ... + +class OneToOneField(ForeignKey[_M]): + one_to_many: bool = False + one_to_one: bool = True + many_to_many: bool = False + many_to_one: bool = False + related_model: Type[_M] = ... + @overload + def __new__( + cls, + to: Union[Type[_M], str], + on_delete: _OnDeleteOptions, + *args: Any, + null: Literal[False] = ..., + **kwargs: Any, + ) -> OneToOneField[_M]: ... + @overload + def __new__( + cls, + to: Union[Type[_M], str], + on_delete: _OnDeleteOptions, + *args: Any, + null: Literal[True], + **kwargs: Any, ) -> OneToOneField[Optional[_M]]: ... # class access @overload # type: ignore @@ -275,55 +400,75 @@ class OneToOneField(Generic[_M], RelatedField[_M, _M]): @overload def __get__(self: _F, instance: Any, owner: Any) -> _F: ... -class ManyToManyField(RelatedField[Sequence[Any], RelatedManager[Any]]): +_MM = TypeVar("_MM", bound=Model) +_MN = TypeVar("_MN", bound=Model) +class ManyToManyField( + Generic[_MM, _MN], RelatedField[Sequence[_MN], ManyToManyRelatedManager[_MM, _MN]] +): + + one_to_many: bool = False + one_to_one: bool = False + many_to_many: bool = False + many_to_one: bool = True rel_class: Any = ... description: Any = ... has_null_arg: Any = ... swappable: bool = ... + related_model: Type[_MM] = ... # type: ignore [assignment] + @overload + def __new__( + cls, + to: Type[_MM], + through: Type[_MN], + *args: Any, + **kwargs: Any, + ) -> ManyToManyField[_MM, _MN]: ... + @overload def __new__( cls, - to: Union[Type[Any], str], + to: Type[_MM], + through: Optional[str] = ..., + *args: Any, + **kwargs: Any, + ) -> ManyToManyField[_MM, Any]: ... + @overload + def __new__( + cls, + to: str, + through: Optional[str] = ..., + *args: Any, + **kwargs: Any, + ) -> ManyToManyField[Any, Any]: ... + def __init__( + self, + to: Union[Type[_MM], str], + through: Optional[Union[Type[_MN], str]] = ..., + to_field: Optional[str] = ..., related_name: Optional[str] = ..., related_query_name: Optional[str] = ..., - limit_choices_to: Optional[Union[Dict[str, Any], Callable[[], Any], Q]] = ..., + limit_choices_to: Optional[_ChoicesLimit] = ..., symmetrical: Optional[bool] = ..., - through: Optional[Union[str, Type[Model]]] = ..., through_fields: Optional[Tuple[str, str]] = ..., db_constraint: bool = ..., - db_table: Optional[str] = ..., swappable: bool = ..., - verbose_name: Optional[Union[str, bytes]] = ..., + verbose_name: Optional[str] = ..., 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] = ..., - ) -> ManyToManyField: ... - # class access - @overload # type: ignore - def __get__(self, instance: None, owner: Any) -> ManyToManyDescriptor: ... - # Model instance access - @overload - def __get__(self, instance: Model, owner: Any) -> RelatedManager[Any]: ... - # non-Model instances - @overload - def __get__(self: _F, instance: Any, owner: Any) -> _F: ... + ) -> None: ... def get_path_info(self, filtered_relation: None = ...) -> List[PathInfo]: ... def get_reverse_path_info( self, filtered_relation: None = ... diff --git a/django-stubs/db/models/manager.pyi b/django-stubs/db/models/manager.pyi index 0187d9a21..e722a161c 100644 --- a/django-stubs/db/models/manager.pyi +++ b/django-stubs/db/models/manager.pyi @@ -1,9 +1,22 @@ -from typing import Any, Dict, Iterable, List, Optional, Tuple, Type, TypeVar, Union +from typing import ( + Any, + Dict, + Generic, + Iterable, + List, + MutableMapping, + Optional, + Tuple, + Type, + TypeVar, + Union, +) from django.db.models.base import Model from django.db.models.query import QuerySet -_T = TypeVar("_T", bound=Model, covariant=True) +_T = TypeVar("_T", bound=Model) +_V = TypeVar("_V", bound=Model) _M = TypeVar("_M", bound="BaseManager[Any]") class BaseManager(QuerySet[_T]): @@ -35,17 +48,54 @@ class Manager(BaseManager[_T]): ... class RelatedManager(Manager[_T]): related_val: Tuple[int, ...] - def add(self, *objs: Union[_T, int], bulk: bool = ...) -> None: ... - def remove(self, *objs: Union[_T, int], bulk: bool = ...) -> None: ... + def add(self, *objs: Union[QuerySet[_T], _T], bulk: bool = ...) -> None: ... + def remove(self, *objs: Union[QuerySet[_T], _T], bulk: bool = ...) -> None: ... def set( self, - objs: Union[QuerySet[_T], Iterable[Union[_T, int]]], + objs: Union[QuerySet[_T], Iterable[_T]], *, bulk: bool = ..., - clear: bool = ... + clear: bool = ..., ) -> None: ... def clear(self) -> None: ... +class ManyToManyRelatedManager(Generic[_T, _V], Manager[_T]): + through: RelatedManager[_V] + def add( + self, + *objs: Union[QuerySet[_T], _T], + through_defaults: MutableMapping[str, Any] = ..., + ) -> None: ... + def remove(self, *objs: Union[QuerySet[_T], _T]) -> None: ... + def set( + self, + objs: Union[QuerySet[_T], Iterable[_T]], + *, + clear: bool = ..., + through_defaults: MutableMapping[str, Any] = ..., + ) -> None: ... + def clear(self) -> None: ... + def create( + self, + defaults: Optional[MutableMapping[str, Any]] = ..., + through_defaults: Optional[MutableMapping[str, Any]] = ..., + **kwargs: Any, + ) -> _T: ... + def get_or_create( + self, + defaults: Optional[MutableMapping[str, Any]] = ..., + *, + through_defaults: MutableMapping[str, Any] = ..., + **kwargs: Any, + ) -> Tuple[_T, bool]: ... + def update_or_create( + self, + defaults: Optional[MutableMapping[str, Any]] = ..., + *, + through_defaults: MutableMapping[str, Any] = ..., + **kwargs: Any, + ) -> Tuple[_T, bool]: ... + class ManagerDescriptor: manager: Manager[Any] = ... def __init__(self, manager: Manager[Any]) -> None: ... diff --git a/django-stubs/db/models/options.pyi b/django-stubs/db/models/options.pyi index 2787f51c3..eb7d68d72 100644 --- a/django-stubs/db/models/options.pyi +++ b/django-stubs/db/models/options.pyi @@ -60,7 +60,7 @@ class Options(Generic[_M]): REVERSE_PROPERTIES: Any = ... default_apps: Any = ... local_fields: List[Field[Any, Any]] = ... - local_many_to_many: List[ManyToManyField] = ... + local_many_to_many: List[ManyToManyField[Any, Any]] = ... private_fields: List[Any] = ... local_managers: List[Manager[Any]] = ... base_manager_name: Optional[str] = ... @@ -123,7 +123,7 @@ class Options(Generic[_M]): @property def swapped(self) -> Optional[str]: ... @property - def many_to_many(self) -> List[ManyToManyField]: ... + def many_to_many(self) -> List[ManyToManyField[Any, Any]]: ... @property def fields_map(self) -> Dict[str, Union[Field[Any, Any], ForeignObjectRel]]: ... @property diff --git a/django-stubs/db/models/query.pyi b/django-stubs/db/models/query.pyi index f71ee8cda..41f88851b 100644 --- a/django-stubs/db/models/query.pyi +++ b/django-stubs/db/models/query.pyi @@ -52,7 +52,7 @@ class _BaseQuerySet(Generic[_T], Sized): def iterator(self, chunk_size: int = ...) -> Iterator[_T]: ... def aggregate(self, *args: Any, **kwargs: Any) -> Dict[str, Any]: ... def get(self, *args: Any, **kwargs: Any) -> _T: ... - def create(self, *args: Any, **kwargs: Any) -> _T: ... + def create(self, **kwargs: Any) -> _T: ... def bulk_create( self, objs: Iterable[_T], diff --git a/tests/trout/models.py b/tests/trout/models.py index 55ac9a1e4..ef288620b 100644 --- a/tests/trout/models.py +++ b/tests/trout/models.py @@ -20,7 +20,6 @@ from django.core.cache import cache from django.db import connection, connections, models from django.db.backends.utils import CursorWrapper -from django.db.models.manager import RelatedManager from django.http.request import HttpRequest from django.http.response import HttpResponse from django.middleware.cache import CacheMiddleware @@ -73,9 +72,12 @@ class Comment(models.Model): ) post_many_to_many = models.ManyToManyField(Post, through=PostToComment) - post_many_to_many_nullable = models.ManyToManyField( - Post, through=PostToComment, null=True - ) + # NOTE: null has no meaning for ManyToMany and django just ignores it and warns about it + # post_many_to_many_nullable = models.ManyToManyField( + # Post, + # through=PostToComment, + # null=True, + # ) created_at = models.DateTimeField() created_at_nullable = models.DateTimeField(null=True) @@ -286,15 +288,20 @@ def main() -> None: if not comment.post_one_to_one and not isinstance(comment.post_one_to_one, Post): print() # type: ignore [unreachable] - # many to many is complicated so we don't check nullability like we do with other fields - if comment.post_many_to_many_nullable is not None: - print(comment.post_many_to_many_nullable) - if not isinstance(comment.post_many_to_many, RelatedManager): - print() # type: ignore [unreachable] - if not comment.post_many_to_many and not isinstance( - comment.post_many_to_many, RelatedManager - ): - print() # type: ignore [unreachable] + # if comment.post_many_to_many_nullable is not None: + # print(comment.post_many_to_many_nullable) + # refinement doesn't work + # see: https://github.com/python/mypy/issues/9783 + # if not isinstance(comment.post_many_to_many, ManyToManyRelatedManager): + # print() # type: ignore [unreachable] + # if not isinstance(comment.post_many_to_many.through, RelatedManager): + # print() # type: ignore [unreachable] + for obj in comment.post_many_to_many.all(): + if not isinstance(obj, Post): + print() # type: ignore [unreachable] + for obj2 in comment.post_many_to_many.through.all(): + if not isinstance(obj2, PostToComment): + print() # type: ignore [unreachable] process_non_nullable(comment.text) if isinstance(comment.text_nullable, type(None)): From 94966520d38694b0a2e59c4e6090e3bd0eb49fd3 Mon Sep 17 00:00:00 2001 From: Thiago Bellini Ribeiro Date: Sun, 5 Dec 2021 18:59:56 -0300 Subject: [PATCH 82/88] Fields typing improvements (#65) This was built on top of https://github.com/sbdchd/django-types/pull/63, so merging it should only keep this PR's change Note that even though the change looks big, it actually is pretty small, it is just that all fields need to define their own `__new__` (or `__init__` if their signature is different from the base field), and it is all the same, the difference is the classname and the generic field. I also added some documentation [here](https://github.com/sbdchd/django-types/pull/65/files#diff-876a5d116ef70c86039fbb8498623871324fa93fc1ae51c7c09ba2a0f7612e99R47) explaining the usage. Fix https://github.com/sbdchd/django-types/issues/34 --- .../contrib/postgres/fields/array.pyi | 72 +- django-stubs/db/models/fields/__init__.pyi | 2039 ++++++++--------- s/lint | 11 +- tests/pyright/__init__.py | 0 tests/pyright/base.py | 46 + tests/pyright/test_fields.py | 185 ++ tests/trout/models.py | 59 +- 7 files changed, 1321 insertions(+), 1091 deletions(-) create mode 100644 tests/pyright/__init__.py create mode 100644 tests/pyright/base.py create mode 100644 tests/pyright/test_fields.py diff --git a/django-stubs/contrib/postgres/fields/array.pyi b/django-stubs/contrib/postgres/fields/array.pyi index 472e90b67..c0f64734b 100644 --- a/django-stubs/contrib/postgres/fields/array.pyi +++ b/django-stubs/contrib/postgres/fields/array.pyi @@ -1,22 +1,18 @@ from typing import ( Any, + Callable, Generic, Iterable, List, Optional, - Sequence, + Tuple, TypeVar, Union, overload, ) from django.db.models.expressions import Combinable -from django.db.models.fields import ( - Field, - _ErrorMessagesToOverride, - _FieldChoices, - _ValidatorCallable, -) +from django.db.models.fields import Field, _ErrorMessagesToOverride, _ValidatorCallable from typing_extensions import Literal from .mixins import CheckFieldDefaultMixin @@ -26,7 +22,7 @@ _T = TypeVar("_T", bound=Optional[List[Any]]) class ArrayField( Generic[_T], CheckFieldDefaultMixin, - Field[Union[Sequence[Any], Combinable], List[Any]], + Field[Union[_T, Combinable], _T], ): empty_strings_allowed: bool = ... @@ -36,11 +32,11 @@ class ArrayField( default_validators: Any = ... from_db_value: Any = ... @overload - def __new__( # type: ignore [misc] - cls, + def __init__( + self: ArrayField[List[Any]], base_field: Field[Any, Any], size: Optional[int] = ..., - verbose_name: Optional[Union[str, bytes]] = ..., + verbose_name: Optional[str] = ..., name: Optional[str] = ..., primary_key: bool = ..., max_length: Optional[int] = ..., @@ -48,26 +44,28 @@ class ArrayField( blank: bool = ..., null: Literal[False] = ..., db_index: bool = ..., - default: Any = ..., + default: Union[_T, Callable[[], _T]] = ..., 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] = ..., + choices: Iterable[ + Union[Tuple[_T, str], Tuple[str, Iterable[Tuple[_T, str]]]] + ] = ..., help_text: str = ..., db_column: Optional[str] = ..., db_tablespace: Optional[str] = ..., validators: Iterable[_ValidatorCallable] = ..., error_messages: Optional[_ErrorMessagesToOverride] = ..., - ) -> ArrayField[List[Any]]: ... + ) -> None: ... @overload - def __new__( - cls, + def __init__( + self: ArrayField[Optional[List[Any]]], base_field: Field[Any, Any], size: Optional[int] = ..., - verbose_name: Optional[Union[str, bytes]] = ..., + verbose_name: Optional[str] = ..., name: Optional[str] = ..., primary_key: bool = ..., max_length: Optional[int] = ..., @@ -75,22 +73,54 @@ class ArrayField( blank: bool = ..., null: Literal[True] = ..., db_index: bool = ..., - default: Any = ..., + default: Optional[Union[_T, Callable[[], _T]]] = ..., 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] = ..., + choices: Iterable[ + Union[Tuple[_T, str], Tuple[str, Iterable[Tuple[_T, str]]]] + ] = ..., help_text: str = ..., db_column: Optional[str] = ..., db_tablespace: Optional[str] = ..., validators: Iterable[_ValidatorCallable] = ..., error_messages: Optional[_ErrorMessagesToOverride] = ..., + ) -> None: ... + @overload + def __new__( + cls, + *args: Any, + null: Literal[False] = ..., + choices: None = ..., + **kwargs: Any, + ) -> ArrayField[List[Any]]: ... + @overload + def __new__( + cls, + *args: Any, + null: Literal[True], + choices: None = ..., + **kwargs: Any, ) -> ArrayField[Optional[List[Any]]]: ... - def __get__(self: ArrayField[_T], instance: Any, owner: Any) -> _T: ... # type: ignore [override] - def __set__(self: ArrayField[_T], instance: Any, value: _T) -> None: ... # type: ignore [override] + @overload + def __new__( + cls, + *args: Any, + null: Literal[False] = ..., + choices: Iterable[Union[Tuple[_T, str], Tuple[str, Iterable[Tuple[_T, str]]]]], + **kwargs: Any, + ) -> ArrayField[_T]: ... + @overload + def __new__( + cls, + *args: Any, + null: Literal[True], + choices: Iterable[Union[Tuple[_T, str], Tuple[str, Iterable[Tuple[_T, str]]]]], + **kwargs: Any, + ) -> ArrayField[Optional[_T]]: ... @property def description(self) -> str: ... # type: ignore [override] def get_transform(self, name: Any) -> Any: ... diff --git a/django-stubs/db/models/fields/__init__.pyi b/django-stubs/db/models/fields/__init__.pyi index f95cf76d3..a36e41069 100644 --- a/django-stubs/db/models/fields/__init__.pyi +++ b/django-stubs/db/models/fields/__init__.pyi @@ -1,4 +1,5 @@ import decimal +import ipaddress import uuid from datetime import date, datetime, time, timedelta from typing import ( @@ -26,11 +27,9 @@ from django.forms import Field as FormField from django.forms import Widget from typing_extensions import Literal -class NOT_PROVIDED: ... - BLANK_CHOICE_DASH: List[Tuple[str, str]] = ... -_Choice = Tuple[Any, Any] +_Choice = Tuple[Any, str] _ChoiceNamedGroup = Tuple[str, Iterable[_Choice]] _FieldChoices = Iterable[Union[_Choice, _ChoiceNamedGroup]] @@ -39,9 +38,42 @@ _ErrorMessagesToOverride = Dict[str, Any] _T = TypeVar("_T", bound="Field[Any, Any]") # __set__ value type -_ST = TypeVar("_ST") +_ST = TypeVar("_ST", contravariant=True) # __get__ return type -_GT = TypeVar("_GT") +_GT = TypeVar("_GT", covariant=True) + +class NOT_PROVIDED: ... + +# NOTE: Some info regarding __init__ and __new__ for all Field subclasses: +# +# - __init__: Field.__init__ provides arguments validation and completion for pratically all +# available arguments for all fields. Subclasses should only define theirs if they expect +# different arguments (e.g. DecimalField expects max_digits and decimal_places) +# +# - __new__: All subclasses should define at least 2: +# +# - One for `null: Literal[False] = ...`, which should return its type with the generic +# _ST and _GT mapping to the proper type (e.g. IntegerField would return IntegerField[int]) +# +# - One for `null: Literal[True]`, which should return its type with the generic +# _ST and _GT mapping to the proper type being optional (e.g. IntegerField would +# return IntegerField[Optional[int]]) +# +# Also, the subclass can define 2 more to capture the fields on choices to make the typing +# respect the available choices for __get__ and __set__. They both should define choices as: +# `choices: Iterable[Union[Tuple[, str], Tuple[str, Iterable[Tuple[, str]]]]]`: +# +# - One with choices and `null: Literal[False] = ...`. This means that the previous one +# should set `choices: None = ...`. +# +# - One with choices and `null: Literal[True]`. This means that the previous one +# should set `choices: None = ...`. +# +# Also note that __new__ doesn't have to define all available args as it is __init__'s +# responsability of doing so. Instead it can only define the required arguments to define +# the generic typing together with `*args: Any` and `**kwargs: Any`. +# +# In doubt, look in this file for some examples. class Field(RegisterLookupMixin, Generic[_ST, _GT]): @@ -120,29 +152,27 @@ class Field(RegisterLookupMixin, Generic[_ST, _GT]): def cached_col(self) -> Col: ... def value_from_object(self, obj: Model) -> _GT: ... def get_attname(self) -> str: ... - -_I = TypeVar("_I", bound=Optional[int]) - -class IntegerField(Generic[_I], Field[Union[float, int, str, Combinable], int]): @overload def __init__( - self: IntegerField[int], - verbose_name: Optional[Union[str, bytes]] = ..., + self, + verbose_name: Optional[str] = ..., name: Optional[str] = ..., primary_key: bool = ..., max_length: Optional[int] = ..., unique: bool = ..., blank: bool = ..., - null: Literal[False] = ..., + null: Literal[True] = ..., db_index: bool = ..., - default: Any = ..., + default: Union[_GT, Callable[[], _GT]] = ..., 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] = ..., + choices: Iterable[ + Union[Tuple[_GT, str], Tuple[str, Iterable[Tuple[_GT, str]]]] + ] = ..., help_text: str = ..., db_column: Optional[str] = ..., db_tablespace: Optional[str] = ..., @@ -151,44 +181,287 @@ class IntegerField(Generic[_I], Field[Union[float, int, str, Combinable], int]): ) -> None: ... @overload def __init__( - self: IntegerField[Optional[int]], - verbose_name: Optional[Union[str, bytes]] = ..., + self, + verbose_name: Optional[str] = ..., name: Optional[str] = ..., primary_key: bool = ..., max_length: Optional[int] = ..., unique: bool = ..., blank: bool = ..., - null: Literal[True] = ..., + null: Literal[False] = ..., db_index: bool = ..., - default: Any = ..., + default: Optional[Union[_GT, Callable[[], _GT]]] = ..., 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] = ..., + choices: Iterable[ + Union[Tuple[_GT, str], Tuple[str, Iterable[Tuple[_GT, str]]]] + ] = ..., help_text: str = ..., db_column: Optional[str] = ..., db_tablespace: Optional[str] = ..., validators: Iterable[_ValidatorCallable] = ..., error_messages: Optional[_ErrorMessagesToOverride] = ..., ) -> None: ... - def __get__(self: IntegerField[_I], instance: Any, owner: Any) -> _I: ... # type: ignore [override] - def __set__( - self: IntegerField[_I], - instance: Any, - value: Union[str, float, int, Combinable, _I], - ) -> None: ... + +_I = TypeVar("_I", bound=Optional[int]) + +class IntegerField(Generic[_I], Field[Union[_I, Combinable], _I]): + @overload + def __new__( + cls, + *args: Any, + null: Literal[False] = ..., + choices: None = ..., + **kwargs: Any, + ) -> IntegerField[int]: ... + @overload + def __new__( + cls, + *args: Any, + null: Literal[True], + choices: None = ..., + **kwargs: Any, + ) -> IntegerField[Optional[int]]: ... + @overload + def __new__( + cls, + *args: Any, + null: Literal[False] = ..., + choices: Iterable[Union[Tuple[_I, str], Tuple[str, Iterable[Tuple[_I, str]]]]], + **kwargs: Any, + ) -> IntegerField[_I]: ... + @overload + def __new__( + cls, + *args: Any, + null: Literal[True], + choices: Iterable[Union[Tuple[_I, str], Tuple[str, Iterable[Tuple[_I, str]]]]], + **kwargs: Any, + ) -> IntegerField[Optional[_I]]: ... class PositiveIntegerRelDbTypeMixin: def rel_db_type(self, connection: Any) -> Any: ... class PositiveIntegerField(PositiveIntegerRelDbTypeMixin, IntegerField[_I]): + @overload + def __new__( + cls, + *args: Any, + null: Literal[False] = ..., + choices: None = ..., + **kwargs: Any, + ) -> PositiveIntegerField[int]: ... + @overload + def __new__( + cls, + *args: Any, + null: Literal[True], + choices: None = ..., + **kwargs: Any, + ) -> PositiveIntegerField[Optional[int]]: ... + @overload + def __new__( + cls, + *args: Any, + null: Literal[False] = ..., + choices: Iterable[Union[Tuple[_I, str], Tuple[str, Iterable[Tuple[_I, str]]]]], + **kwargs: Any, + ) -> PositiveIntegerField[_I]: ... + @overload + def __new__( + cls, + *args: Any, + null: Literal[True], + choices: Iterable[Union[Tuple[_I, str], Tuple[str, Iterable[Tuple[_I, str]]]]], + **kwargs: Any, + ) -> PositiveIntegerField[Optional[_I]]: ... + +class PositiveSmallIntegerField(PositiveIntegerRelDbTypeMixin, IntegerField[_I]): + @overload + def __new__( + cls, + *args: Any, + null: Literal[False] = ..., + choices: None = ..., + **kwargs: Any, + ) -> PositiveSmallIntegerField[int]: ... + @overload + def __new__( + cls, + *args: Any, + null: Literal[True], + choices: None = ..., + **kwargs: Any, + ) -> PositiveSmallIntegerField[Optional[int]]: ... + @overload + def __new__( + cls, + *args: Any, + null: Literal[False] = ..., + choices: Iterable[Union[Tuple[_I, str], Tuple[str, Iterable[Tuple[_I, str]]]]], + **kwargs: Any, + ) -> PositiveSmallIntegerField[_I]: ... + @overload + def __new__( + cls, + *args: Any, + null: Literal[True], + choices: Iterable[Union[Tuple[_I, str], Tuple[str, Iterable[Tuple[_I, str]]]]], + **kwargs: Any, + ) -> PositiveSmallIntegerField[Optional[_I]]: ... + +class SmallIntegerField(IntegerField[_I]): + @overload + def __new__( + cls, + *args: Any, + null: Literal[False] = ..., + choices: None = ..., + **kwargs: Any, + ) -> SmallIntegerField[int]: ... + @overload + def __new__( + cls, + *args: Any, + null: Literal[True], + choices: None = ..., + **kwargs: Any, + ) -> SmallIntegerField[Optional[int]]: ... + @overload + def __new__( + cls, + *args: Any, + null: Literal[False] = ..., + choices: Iterable[Union[Tuple[_I, str], Tuple[str, Iterable[Tuple[_I, str]]]]], + **kwargs: Any, + ) -> SmallIntegerField[_I]: ... + @overload + def __new__( + cls, + *args: Any, + null: Literal[True], + choices: Iterable[Union[Tuple[_I, str], Tuple[str, Iterable[Tuple[_I, str]]]]], + **kwargs: Any, + ) -> SmallIntegerField[Optional[_I]]: ... + +class BigIntegerField(IntegerField[_I]): + @overload + def __new__( + cls, + *args: Any, + null: Literal[False] = ..., + choices: None = ..., + **kwargs: Any, + ) -> BigIntegerField[int]: ... + @overload + def __new__( + cls, + *args: Any, + null: Literal[True], + choices: None = ..., + **kwargs: Any, + ) -> BigIntegerField[Optional[int]]: ... + @overload + def __new__( + cls, + *args: Any, + null: Literal[False] = ..., + choices: Iterable[Union[Tuple[_I, str], Tuple[str, Iterable[Tuple[_I, str]]]]], + **kwargs: Any, + ) -> BigIntegerField[_I]: ... + @overload + def __new__( + cls, + *args: Any, + null: Literal[True], + choices: Iterable[Union[Tuple[_I, str], Tuple[str, Iterable[Tuple[_I, str]]]]], + **kwargs: Any, + ) -> BigIntegerField[Optional[_I]]: ... + +class PositiveBigIntegerField(IntegerField[_I]): + @overload + def __new__( + cls, + *args: Any, + null: Literal[False] = ..., + choices: None = ..., + **kwargs: Any, + ) -> PositiveBigIntegerField[int]: ... + @overload + def __new__( + cls, + *args: Any, + null: Literal[True], + choices: None = ..., + **kwargs: Any, + ) -> PositiveBigIntegerField[Optional[int]]: ... + @overload + def __new__( + cls, + *args: Any, + null: Literal[False] = ..., + choices: Iterable[Union[Tuple[_I, str], Tuple[str, Iterable[Tuple[_I, str]]]]], + **kwargs: Any, + ) -> PositiveBigIntegerField[_I]: ... + @overload + def __new__( + cls, + *args: Any, + null: Literal[True], + choices: Iterable[Union[Tuple[_I, str], Tuple[str, Iterable[Tuple[_I, str]]]]], + **kwargs: Any, + ) -> PositiveBigIntegerField[Optional[_I]]: ... + +_F = TypeVar("_F", bound=Optional[float]) + +class FloatField(Generic[_F], Field[Union[_F, Combinable], _F]): + @overload + def __new__( + cls, + *args: Any, + null: Literal[False] = ..., + choices: None = ..., + **kwargs: Any, + ) -> FloatField[float]: ... + @overload + def __new__( + cls, + *args: Any, + null: Literal[True], + choices: None = ..., + **kwargs: Any, + ) -> FloatField[Optional[float]]: ... + @overload + def __new__( + cls, + *args: Any, + null: Literal[False] = ..., + choices: Iterable[Union[Tuple[_F, str], Tuple[str, Iterable[Tuple[_F, str]]]]], + **kwargs: Any, + ) -> FloatField[_F]: ... + @overload + def __new__( + cls, + *args: Any, + null: Literal[True], + choices: Iterable[Union[Tuple[_F, str], Tuple[str, Iterable[Tuple[_F, str]]]]], + **kwargs: Any, + ) -> FloatField[Optional[_F]]: ... + +_DEC = TypeVar("_DEC", bound=Optional[decimal.Decimal]) + +class DecimalField(Generic[_DEC], Field[Union[_DEC, Combinable], _DEC]): + # attributes + max_digits: int = ... + decimal_places: int = ... @overload def __init__( - self: PositiveIntegerField[int], - verbose_name: Optional[Union[str, bytes]] = ..., + self: DecimalField[decimal.Decimal], + verbose_name: Optional[str] = ..., name: Optional[str] = ..., primary_key: bool = ..., max_length: Optional[int] = ..., @@ -196,24 +469,31 @@ class PositiveIntegerField(PositiveIntegerRelDbTypeMixin, IntegerField[_I]): blank: bool = ..., null: Literal[False] = ..., db_index: bool = ..., - default: Any = ..., + default: Union[_DEC, Callable[[], _DEC]] = ..., 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] = ..., + choices: Iterable[ + Union[Tuple[_DEC, str], Tuple[str, Iterable[Tuple[_DEC, str]]]] + ] = ..., help_text: str = ..., db_column: Optional[str] = ..., db_tablespace: Optional[str] = ..., validators: Iterable[_ValidatorCallable] = ..., error_messages: Optional[_ErrorMessagesToOverride] = ..., + auto_now: bool = ..., + auto_now_add: bool = ..., + *, + max_digits: int, + decimal_places: int, ) -> None: ... @overload def __init__( - self: PositiveIntegerField[Optional[int]], - verbose_name: Optional[Union[str, bytes]] = ..., + self: DecimalField[Optional[decimal.Decimal]], + verbose_name: Optional[str] = ..., name: Optional[str] = ..., primary_key: bool = ..., max_length: Optional[int] = ..., @@ -221,32 +501,367 @@ class PositiveIntegerField(PositiveIntegerRelDbTypeMixin, IntegerField[_I]): blank: bool = ..., null: Literal[True] = ..., db_index: bool = ..., - default: Any = ..., + default: Optional[Union[_DEC, Callable[[], _DEC]]] = ..., 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] = ..., + choices: Iterable[ + Union[Tuple[_DEC, str], Tuple[str, Iterable[Tuple[_DEC, str]]]] + ] = ..., help_text: str = ..., db_column: Optional[str] = ..., db_tablespace: Optional[str] = ..., validators: Iterable[_ValidatorCallable] = ..., error_messages: Optional[_ErrorMessagesToOverride] = ..., + auto_now: bool = ..., + auto_now_add: bool = ..., + *, + max_digits: int, + decimal_places: int, ) -> None: ... - def __get__(self: PositiveIntegerField[_I], instance: Any, owner: Any) -> _I: ... # type: ignore [override] - def __set__( - self: PositiveIntegerField[_I], - instance: Any, - value: Union[str, float, int, Combinable, _I], - ) -> None: ... + @overload + def __new__( + cls, + *args: Any, + null: Literal[False] = ..., + choices: None = ..., + **kwargs: Any, + ) -> DecimalField[decimal.Decimal]: ... + @overload + def __new__( + cls, + *args: Any, + null: Literal[True], + choices: None = ..., + **kwargs: Any, + ) -> DecimalField[Optional[decimal.Decimal]]: ... + @overload + def __new__( + cls, + *args: Any, + null: Literal[False] = ..., + choices: Iterable[ + Union[Tuple[_DEC, str], Tuple[str, Iterable[Tuple[_DEC, str]]]] + ], + **kwargs: Any, + ) -> DecimalField[_DEC]: ... + @overload + def __new__( + cls, + *args: Any, + null: Literal[True], + choices: Iterable[ + Union[Tuple[_DEC, str], Tuple[str, Iterable[Tuple[_DEC, str]]]] + ], + **kwargs: Any, + ) -> DecimalField[Optional[_DEC]]: ... -class PositiveSmallIntegerField(PositiveIntegerRelDbTypeMixin, IntegerField[_I]): +class AutoFieldMeta(type): ... +class AutoFieldMixin: ... + +class AutoField(AutoFieldMixin, IntegerField[int], metaclass=AutoFieldMeta): + def __new__(cls, *args: Any, **kwargs: Any) -> AutoField: ... + +class BigAutoField(AutoFieldMixin, BigIntegerField[int]): + def __new__(cls, *args: Any, **kwargs: Any) -> BigAutoField: ... + +class SmallAutoField(AutoFieldMixin, SmallIntegerField[int]): + def __new__(cls, *args: Any, **kwargs: Any) -> SmallAutoField: ... + +_C = TypeVar("_C", bound=Optional[str]) + +class CharField(Generic[_C], Field[Union[_C, Combinable], _C]): + @overload + def __new__( + cls, + *args: Any, + null: Literal[False] = ..., + choices: None = ..., + **kwargs: Any, + ) -> CharField[str]: ... + @overload + def __new__( + cls, + *args: Any, + null: Literal[True], + choices: None = ..., + **kwargs: Any, + ) -> CharField[Optional[str]]: ... + @overload + def __new__( + cls, + *args: Any, + null: Literal[False] = ..., + choices: Iterable[Union[Tuple[_C, str], Tuple[str, Iterable[Tuple[_C, str]]]]], + **kwargs: Any, + ) -> CharField[_C]: ... + @overload + def __new__( + cls, + *args: Any, + null: Literal[True], + choices: Iterable[Union[Tuple[_C, str], Tuple[str, Iterable[Tuple[_C, str]]]]], + **kwargs: Any, + ) -> CharField[Optional[_C]]: ... + +class SlugField(CharField[_C]): + @overload + def __new__( + cls, + *args: Any, + null: Literal[False] = ..., + choices: None = ..., + **kwargs: Any, + ) -> SlugField[str]: ... + @overload + def __new__( + cls, + *args: Any, + null: Literal[True], + choices: None = ..., + **kwargs: Any, + ) -> SlugField[Optional[str]]: ... + @overload + def __new__( + cls, + *args: Any, + null: Literal[False] = ..., + choices: Iterable[Union[Tuple[_C, str], Tuple[str, Iterable[Tuple[_C, str]]]]], + **kwargs: Any, + ) -> SlugField[_C]: ... + @overload + def __new__( + cls, + *args: Any, + null: Literal[True], + choices: Iterable[Union[Tuple[_C, str], Tuple[str, Iterable[Tuple[_C, str]]]]], + **kwargs: Any, + ) -> SlugField[Optional[_C]]: ... + +class EmailField(CharField[_C]): + @overload + def __new__( + cls, + *args: Any, + null: Literal[False] = ..., + choices: None = ..., + **kwargs: Any, + ) -> EmailField[str]: ... + @overload + def __new__( + cls, + *args: Any, + null: Literal[True], + choices: None = ..., + **kwargs: Any, + ) -> EmailField[Optional[str]]: ... + @overload + def __new__( + cls, + *args: Any, + null: Literal[False] = ..., + choices: Iterable[Union[Tuple[_C, str], Tuple[str, Iterable[Tuple[_C, str]]]]], + **kwargs: Any, + ) -> EmailField[_C]: ... + @overload + def __new__( + cls, + *args: Any, + null: Literal[True], + choices: Iterable[Union[Tuple[_C, str], Tuple[str, Iterable[Tuple[_C, str]]]]], + **kwargs: Any, + ) -> EmailField[Optional[_C]]: ... + +class URLField(CharField[_C]): + @overload + def __new__( + cls, + *args: Any, + null: Literal[False] = ..., + choices: None = ..., + **kwargs: Any, + ) -> URLField[str]: ... + @overload + def __new__( + cls, + *args: Any, + null: Literal[True], + choices: None = ..., + **kwargs: Any, + ) -> URLField[Optional[str]]: ... + @overload + def __new__( + cls, + *args: Any, + null: Literal[False] = ..., + choices: Iterable[Union[Tuple[_C, str], Tuple[str, Iterable[Tuple[_C, str]]]]], + **kwargs: Any, + ) -> URLField[_C]: ... + @overload + def __new__( + cls, + *args: Any, + null: Literal[True], + choices: Iterable[Union[Tuple[_C, str], Tuple[str, Iterable[Tuple[_C, str]]]]], + **kwargs: Any, + ) -> URLField[Optional[_C]]: ... + +class TextField(CharField[_C]): + @overload + def __new__( + cls, + *args: Any, + null: Literal[False] = ..., + choices: None = ..., + **kwargs: Any, + ) -> TextField[str]: ... + @overload + def __new__( + cls, + *args: Any, + null: Literal[True], + choices: None = ..., + **kwargs: Any, + ) -> TextField[Optional[str]]: ... + @overload + def __new__( + cls, + *args: Any, + null: Literal[False] = ..., + choices: Iterable[Union[Tuple[_C, str], Tuple[str, Iterable[Tuple[_C, str]]]]], + **kwargs: Any, + ) -> TextField[_C]: ... + @overload + def __new__( + cls, + *args: Any, + null: Literal[True], + choices: Iterable[Union[Tuple[_C, str], Tuple[str, Iterable[Tuple[_C, str]]]]], + **kwargs: Any, + ) -> TextField[Optional[_C]]: ... + +_B = TypeVar("_B", bound=Optional[bool]) + +class BooleanField(Generic[_B], Field[Union[_B, Combinable], _B]): + @overload + def __new__( + cls, + *args: Any, + null: Literal[False] = ..., + choices: None = ..., + **kwargs: Any, + ) -> BooleanField[bool]: ... + @overload + def __new__( + cls, + *args: Any, + null: Literal[True], + choices: None = ..., + **kwargs: Any, + ) -> BooleanField[Optional[bool]]: ... + @overload + def __new__( + cls, + *args: Any, + null: Literal[False] = ..., + choices: Iterable[Union[Tuple[_C, str], Tuple[str, Iterable[Tuple[_C, str]]]]], + **kwargs: Any, + ) -> BooleanField[_B]: ... + @overload + def __new__( + cls, + *args: Any, + null: Literal[True], + choices: Iterable[Union[Tuple[_C, str], Tuple[str, Iterable[Tuple[_C, str]]]]], + **kwargs: Any, + ) -> BooleanField[Optional[_B]]: ... + +class IPAddressField(Generic[_C], Field[Union[_C, Combinable], _C]): + @overload + def __new__( + cls, + *args: Any, + null: Literal[False] = ..., + choices: None = ..., + **kwargs: Any, + ) -> IPAddressField[str]: ... + @overload + def __new__( + cls, + *args: Any, + null: Literal[True], + choices: None = ..., + **kwargs: Any, + ) -> IPAddressField[Optional[str]]: ... + @overload + def __new__( + cls, + *args: Any, + null: Literal[False] = ..., + choices: Iterable[Union[Tuple[_C, str], Tuple[str, Iterable[Tuple[_C, str]]]]], + **kwargs: Any, + ) -> IPAddressField[_C]: ... + @overload + def __new__( + cls, + *args: Any, + null: Literal[True], + choices: Iterable[Union[Tuple[_C, str], Tuple[str, Iterable[Tuple[_C, str]]]]], + **kwargs: Any, + ) -> IPAddressField[Optional[_C]]: ... + +class GenericIPAddressField( + Generic[_C], + Field[Union[_C, ipaddress.IPv4Address, ipaddress.IPv6Address, Combinable], _C], +): + @overload + def __new__( + cls, + *args: Any, + null: Literal[False] = ..., + choices: None = ..., + **kwargs: Any, + ) -> GenericIPAddressField[str]: ... + @overload + def __new__( + cls, + *args: Any, + null: Literal[True], + choices: None = ..., + **kwargs: Any, + ) -> GenericIPAddressField[Optional[str]]: ... + @overload + def __new__( + cls, + *args: Any, + null: Literal[False] = ..., + choices: Iterable[Union[Tuple[_C, str], Tuple[str, Iterable[Tuple[_C, str]]]]], + **kwargs: Any, + ) -> GenericIPAddressField[_C]: ... + @overload + def __new__( + cls, + *args: Any, + null: Literal[True], + choices: Iterable[Union[Tuple[_C, str], Tuple[str, Iterable[Tuple[_C, str]]]]], + **kwargs: Any, + ) -> GenericIPAddressField[Optional[_C]]: ... + +_DD = TypeVar("_DD", bound=Optional[date]) + +class DateTimeCheckMixin: ... + +class DateField(DateTimeCheckMixin, Field[Union[_DD, Combinable], _DD]): + # attributes + auto_now: bool = ... + auto_now_add: bool = ... @overload def __init__( - self: PositiveSmallIntegerField[int], - verbose_name: Optional[Union[str, bytes]] = ..., + self: DateField[date], + verbose_name: Optional[str] = ..., name: Optional[str] = ..., primary_key: bool = ..., max_length: Optional[int] = ..., @@ -254,24 +869,28 @@ class PositiveSmallIntegerField(PositiveIntegerRelDbTypeMixin, IntegerField[_I]) blank: bool = ..., null: Literal[False] = ..., db_index: bool = ..., - default: Any = ..., + default: Union[_DD, Callable[[], _DD]] = ..., 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] = ..., + choices: Iterable[ + Union[Tuple[_DD, str], Tuple[str, Iterable[Tuple[_DD, str]]]] + ] = ..., help_text: str = ..., db_column: Optional[str] = ..., db_tablespace: Optional[str] = ..., validators: Iterable[_ValidatorCallable] = ..., error_messages: Optional[_ErrorMessagesToOverride] = ..., + auto_now: bool = ..., + auto_now_add: bool = ..., ) -> None: ... @overload def __init__( - self: PositiveSmallIntegerField[Optional[int]], - verbose_name: Optional[Union[str, bytes]] = ..., + self: DateField[Optional[date]], + verbose_name: Optional[str] = ..., name: Optional[str] = ..., primary_key: bool = ..., max_length: Optional[int] = ..., @@ -279,32 +898,71 @@ class PositiveSmallIntegerField(PositiveIntegerRelDbTypeMixin, IntegerField[_I]) blank: bool = ..., null: Literal[True] = ..., db_index: bool = ..., - default: Any = ..., + default: Optional[Union[_DD, Callable[[], _DD]]] = ..., 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] = ..., + choices: Iterable[ + Union[Tuple[_DD, str], Tuple[str, Iterable[Tuple[_DD, str]]]] + ] = ..., help_text: str = ..., db_column: Optional[str] = ..., db_tablespace: Optional[str] = ..., validators: Iterable[_ValidatorCallable] = ..., error_messages: Optional[_ErrorMessagesToOverride] = ..., + auto_now: bool = ..., + auto_now_add: bool = ..., ) -> None: ... - def __get__(self: PositiveSmallIntegerField[_I], instance: Any, owner: Any) -> _I: ... # type: ignore [override] - def __set__( - self: PositiveSmallIntegerField[_I], - instance: Any, - value: Union[str, float, int, Combinable, _I], - ) -> None: ... + @overload + def __new__( + cls, + *args: Any, + null: Literal[False] = ..., + choices: None = ..., + **kwargs: Any, + ) -> DateField[date]: ... + @overload + def __new__( + cls, + *args: Any, + null: Literal[True], + choices: None = ..., + **kwargs: Any, + ) -> DateField[Optional[date]]: ... + @overload + def __new__( + cls, + *args: Any, + null: Literal[False] = ..., + choices: Iterable[ + Union[Tuple[_DD, str], Tuple[str, Iterable[Tuple[_DD, str]]]] + ], + **kwargs: Any, + ) -> DateField[_DD]: ... + @overload + def __new__( + cls, + *args: Any, + null: Literal[True], + choices: Iterable[ + Union[Tuple[_DD, str], Tuple[str, Iterable[Tuple[_DD, str]]]] + ], + **kwargs: Any, + ) -> DateField[Optional[_DD]]: ... -class SmallIntegerField(IntegerField[_I]): +_TM = TypeVar("_TM", bound=Optional[time]) + +class TimeField(Generic[_TM], DateTimeCheckMixin, Field[Union[_TM, Combinable], _TM]): + # attributes + auto_now: bool = ... + auto_now_add: bool = ... @overload def __init__( - self: SmallIntegerField[int], - verbose_name: Optional[Union[str, bytes]] = ..., + self: TimeField[time], + verbose_name: Optional[str] = ..., name: Optional[str] = ..., primary_key: bool = ..., max_length: Optional[int] = ..., @@ -312,24 +970,28 @@ class SmallIntegerField(IntegerField[_I]): blank: bool = ..., null: Literal[False] = ..., db_index: bool = ..., - default: Any = ..., + default: Union[_TM, Callable[[], _TM]] = ..., 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] = ..., + choices: Iterable[ + Union[Tuple[_TM, str], Tuple[str, Iterable[Tuple[_TM, str]]]] + ] = ..., help_text: str = ..., db_column: Optional[str] = ..., db_tablespace: Optional[str] = ..., validators: Iterable[_ValidatorCallable] = ..., error_messages: Optional[_ErrorMessagesToOverride] = ..., + auto_now: bool = ..., + auto_now_add: bool = ..., ) -> None: ... @overload def __init__( - self: SmallIntegerField[Optional[int]], - verbose_name: Optional[Union[str, bytes]] = ..., + self: TimeField[Optional[time]], + verbose_name: Optional[str] = ..., name: Optional[str] = ..., primary_key: bool = ..., max_length: Optional[int] = ..., @@ -337,30 +999,73 @@ class SmallIntegerField(IntegerField[_I]): blank: bool = ..., null: Literal[True] = ..., db_index: bool = ..., - default: Any = ..., + default: Optional[Union[_TM, Callable[[], _TM]]] = ..., 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] = ..., + choices: Iterable[ + Union[Tuple[_TM, str], Tuple[str, Iterable[Tuple[_TM, str]]]] + ] = ..., help_text: str = ..., db_column: Optional[str] = ..., db_tablespace: Optional[str] = ..., validators: Iterable[_ValidatorCallable] = ..., error_messages: Optional[_ErrorMessagesToOverride] = ..., + auto_now: bool = ..., + auto_now_add: bool = ..., ) -> None: ... - def __get__(self, instance: Any, owner: Any) -> _I: ... # type: ignore [override] - def __set__( - self, instance: Any, value: Union[str, float, int, Combinable, _I] - ) -> None: ... + @overload + def __new__( + cls, + *args: Any, + null: Literal[False] = ..., + choices: None = ..., + **kwargs: Any, + ) -> TimeField[time]: ... + @overload + def __new__( + cls, + *args: Any, + null: Literal[True], + choices: None = ..., + **kwargs: Any, + ) -> TimeField[Optional[time]]: ... + @overload + def __new__( + cls, + *args: Any, + null: Literal[False] = ..., + choices: Iterable[ + Union[Tuple[_TM, str], Tuple[str, Iterable[Tuple[_TM, str]]]] + ], + **kwargs: Any, + ) -> TimeField[_TM]: ... + @overload + def __new__( + cls, + *args: Any, + null: Literal[True], + choices: Iterable[ + Union[Tuple[_TM, str], Tuple[str, Iterable[Tuple[_TM, str]]]] + ], + **kwargs: Any, + ) -> TimeField[Optional[_TM]]: ... -class BigIntegerField(IntegerField[_I]): +_DT = TypeVar("_DT", bound=Optional[datetime]) + +class DateTimeField( + Generic[_DT], DateTimeCheckMixin, Field[Union[_DT, Combinable], _DT] +): + # attributes + auto_now: bool = ... + auto_now_add: bool = ... @overload def __init__( - self: BigIntegerField[int], - verbose_name: Optional[Union[str, bytes]] = ..., + self: DateTimeField[datetime], + verbose_name: Optional[str] = ..., name: Optional[str] = ..., primary_key: bool = ..., max_length: Optional[int] = ..., @@ -368,24 +1073,28 @@ class BigIntegerField(IntegerField[_I]): blank: bool = ..., null: Literal[False] = ..., db_index: bool = ..., - default: Any = ..., + default: Union[_DT, Callable[[], _DT]] = ..., 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] = ..., + choices: Iterable[ + Union[Tuple[_DT, str], Tuple[str, Iterable[Tuple[_DT, str]]]] + ] = ..., help_text: str = ..., db_column: Optional[str] = ..., db_tablespace: Optional[str] = ..., validators: Iterable[_ValidatorCallable] = ..., error_messages: Optional[_ErrorMessagesToOverride] = ..., + auto_now: bool = ..., + auto_now_add: bool = ..., ) -> None: ... @overload def __init__( - self: BigIntegerField[Optional[int]], - verbose_name: Optional[Union[str, bytes]] = ..., + self: DateTimeField[Optional[datetime]], + verbose_name: Optional[str] = ..., name: Optional[str] = ..., primary_key: bool = ..., max_length: Optional[int] = ..., @@ -393,30 +1102,107 @@ class BigIntegerField(IntegerField[_I]): blank: bool = ..., null: Literal[True] = ..., db_index: bool = ..., - default: Any = ..., + default: Optional[Union[_DT, Callable[[], _DT]]] = ..., 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] = ..., + choices: Iterable[ + Union[Tuple[_DT, str], Tuple[str, Iterable[Tuple[_DT, str]]]] + ] = ..., help_text: str = ..., db_column: Optional[str] = ..., db_tablespace: Optional[str] = ..., validators: Iterable[_ValidatorCallable] = ..., error_messages: Optional[_ErrorMessagesToOverride] = ..., + auto_now: bool = ..., + auto_now_add: bool = ..., ) -> None: ... - def __get__(self, instance: Any, owner: Any) -> _I: ... # type: ignore [override] - def __set__( - self, instance: Any, value: Union[str, float, int, Combinable, _I] - ) -> None: ... + @overload + def __new__( + cls, + *args: Any, + null: Literal[False] = ..., + choices: None = ..., + **kwargs: Any, + ) -> DateTimeField[datetime]: ... + @overload + def __new__( + cls, + *args: Any, + null: Literal[True], + choices: None = ..., + **kwargs: Any, + ) -> DateTimeField[Optional[datetime]]: ... + @overload + def __new__( + cls, + *args: Any, + null: Literal[False] = ..., + choices: Iterable[ + Union[Tuple[_DT, str], Tuple[str, Iterable[Tuple[_DT, str]]]] + ], + **kwargs: Any, + ) -> DateTimeField[_DT]: ... + @overload + def __new__( + cls, + *args: Any, + null: Literal[True], + choices: Iterable[ + Union[Tuple[_DT, str], Tuple[str, Iterable[Tuple[_DT, str]]]] + ], + **kwargs: Any, + ) -> DateTimeField[Optional[_DT]]: ... -class PositiveBigIntegerField(IntegerField[_I]): +_U = TypeVar("_U", bound=Optional[uuid.UUID]) + +class UUIDField(Generic[_U], Field[Union[str, _U], _U]): + @overload + def __new__( + cls, + *args: Any, + null: Literal[False] = ..., + choices: None = ..., + **kwargs: Any, + ) -> UUIDField[uuid.UUID]: ... + @overload + def __new__( + cls, + *args: Any, + null: Literal[True], + choices: None = ..., + **kwargs: Any, + ) -> UUIDField[Optional[uuid.UUID]]: ... + @overload + def __new__( + cls, + *args: Any, + null: Literal[False] = ..., + choices: Iterable[Union[Tuple[_U, str], Tuple[str, Iterable[Tuple[_U, str]]]]], + **kwargs: Any, + ) -> UUIDField[_U]: ... + @overload + def __new__( + cls, + *args: Any, + null: Literal[True], + choices: Iterable[Union[Tuple[_U, str], Tuple[str, Iterable[Tuple[_U, str]]]]], + **kwargs: Any, + ) -> UUIDField[Optional[_U]]: ... + +class FilePathField(Generic[_C], Field[_C, _C]): + path: Union[str, Callable[..., str]] = ... + match: Optional[str] = ... + recursive: bool = ... + allow_files: bool = ... + allow_folders: bool = ... @overload def __init__( - self: PositiveBigIntegerField[int], - verbose_name: Optional[Union[str, bytes]] = ..., + self: FilePathField[str], + verbose_name: Optional[str] = ..., name: Optional[str] = ..., primary_key: bool = ..., max_length: Optional[int] = ..., @@ -424,24 +1210,31 @@ class PositiveBigIntegerField(IntegerField[_I]): blank: bool = ..., null: Literal[False] = ..., db_index: bool = ..., - default: Any = ..., + default: Union[_C, Callable[[], _C]] = ..., 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] = ..., + choices: Iterable[ + Union[Tuple[_C, str], Tuple[str, Iterable[Tuple[_C, str]]]] + ] = ..., help_text: str = ..., db_column: Optional[str] = ..., db_tablespace: Optional[str] = ..., validators: Iterable[_ValidatorCallable] = ..., error_messages: Optional[_ErrorMessagesToOverride] = ..., + path: Union[str, Callable[..., str]] = ..., + match: Optional[str] = ..., + recursive: bool = ..., + allow_files: bool = ..., + allow_folders: bool = ..., ) -> None: ... @overload def __init__( - self: PositiveBigIntegerField[Optional[int]], - verbose_name: Optional[Union[str, bytes]] = ..., + self: FilePathField[Optional[str]], + verbose_name: Optional[str] = ..., name: Optional[str] = ..., primary_key: bool = ..., max_length: Optional[int] = ..., @@ -449,1010 +1242,136 @@ class PositiveBigIntegerField(IntegerField[_I]): blank: bool = ..., null: Literal[True] = ..., db_index: bool = ..., - default: Any = ..., + default: Optional[Union[_C, Callable[[], _C]]] = ..., 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] = ..., + choices: Iterable[ + Union[Tuple[_C, str], Tuple[str, Iterable[Tuple[_C, str]]]] + ] = ..., help_text: str = ..., db_column: Optional[str] = ..., db_tablespace: Optional[str] = ..., validators: Iterable[_ValidatorCallable] = ..., error_messages: Optional[_ErrorMessagesToOverride] = ..., + path: Union[str, Callable[..., str]] = ..., + match: Optional[str] = ..., + recursive: bool = ..., + allow_files: bool = ..., + allow_folders: bool = ..., ) -> None: ... - def __get__(self, instance: Any, owner: Any) -> _I: ... # type: ignore [override] - def __set__( - self, instance: Any, value: Union[str, float, int, Combinable, _I] - ) -> None: ... - -_F = TypeVar("_F", bound=Optional[float]) - -class FloatField(Generic[_F], Field[Union[float, int, str, Combinable], float]): @overload - def __init__( - self: FloatField[float], - verbose_name: Optional[Union[str, bytes]] = ..., - name: Optional[str] = ..., - primary_key: bool = ..., - max_length: Optional[int] = ..., - unique: bool = ..., - blank: bool = ..., - null: Literal[False] = ..., - db_index: bool = ..., - default: Any = ..., - editable: bool = ..., - auto_created: bool = ..., - serialize: bool = ..., - unique_for_date: Optional[str] = ..., - unique_for_month: Optional[str] = ..., - unique_for_year: Optional[str] = ..., - choices: Optional[_FieldChoices] = ..., - help_text: str = ..., - db_column: Optional[str] = ..., - db_tablespace: Optional[str] = ..., - validators: Iterable[_ValidatorCallable] = ..., - error_messages: Optional[_ErrorMessagesToOverride] = ..., - ) -> None: ... - @overload - def __init__( - self: FloatField[Optional[float]], - verbose_name: Optional[Union[str, bytes]] = ..., - name: Optional[str] = ..., - primary_key: bool = ..., - max_length: Optional[int] = ..., - unique: bool = ..., - blank: bool = ..., - null: Literal[True] = ..., - db_index: bool = ..., - default: Any = ..., - editable: bool = ..., - auto_created: bool = ..., - serialize: bool = ..., - unique_for_date: Optional[str] = ..., - unique_for_month: Optional[str] = ..., - unique_for_year: Optional[str] = ..., - choices: Optional[_FieldChoices] = ..., - help_text: str = ..., - db_column: Optional[str] = ..., - db_tablespace: Optional[str] = ..., - validators: Iterable[_ValidatorCallable] = ..., - error_messages: Optional[_ErrorMessagesToOverride] = ..., - ) -> None: ... - def __get__(self, instance: Any, owner: Any) -> _F: ... # type: ignore [override] - def __set__( - self, instance: Any, value: Union[str, float, int, Combinable, _F] - ) -> None: ... - -_DEC = TypeVar("_DEC", bound=Optional[decimal.Decimal]) - -class DecimalField( - Generic[_DEC], - Field[Union[str, float, decimal.Decimal, Combinable], decimal.Decimal], -): - # attributes - max_digits: int = ... - decimal_places: int = ... - @overload - def __init__( - self: DecimalField[decimal.Decimal], - verbose_name: Optional[Union[str, bytes]] = ..., - name: Optional[str] = ..., - max_digits: Optional[int] = ..., - decimal_places: Optional[int] = ..., - primary_key: bool = ..., - unique: bool = ..., - blank: bool = ..., - null: Literal[False] = ..., - db_index: bool = ..., - default: Any = ..., - editable: bool = ..., - auto_created: bool = ..., - serialize: bool = ..., - choices: Optional[_FieldChoices] = ..., - help_text: str = ..., - db_column: Optional[str] = ..., - db_tablespace: Optional[str] = ..., - validators: Iterable[_ValidatorCallable] = ..., - error_messages: Optional[_ErrorMessagesToOverride] = ..., - ) -> None: ... - @overload - def __init__( - self: DecimalField[Optional[decimal.Decimal]], - verbose_name: Optional[Union[str, bytes]] = ..., - name: Optional[str] = ..., - max_digits: Optional[int] = ..., - decimal_places: Optional[int] = ..., - primary_key: bool = ..., - unique: bool = ..., - blank: bool = ..., - null: Literal[True] = ..., - db_index: bool = ..., - default: Any = ..., - editable: bool = ..., - auto_created: bool = ..., - serialize: bool = ..., - choices: Optional[_FieldChoices] = ..., - help_text: str = ..., - db_column: Optional[str] = ..., - db_tablespace: Optional[str] = ..., - validators: Iterable[_ValidatorCallable] = ..., - error_messages: Optional[_ErrorMessagesToOverride] = ..., - ) -> None: ... - def __get__(self, instance: Any, owner: Any) -> _DEC: ... # type: ignore [override] - def __set__( # type: ignore [override] - self, instance: Any, value: Union[str, float, Combinable, _DEC] - ) -> None: ... - -class AutoField(Field[Union[Combinable, int, str, None], int]): - def __init__( - self, - verbose_name: Optional[Union[str, bytes]] = ..., - name: Optional[str] = ..., - primary_key: bool = ..., - max_length: Optional[int] = ..., - unique: bool = ..., - blank: bool = ..., - null: bool = ..., - db_index: bool = ..., - default: Any = ..., - editable: bool = ..., - auto_created: bool = ..., - serialize: bool = ..., - unique_for_date: Optional[str] = ..., - unique_for_month: Optional[str] = ..., - unique_for_year: Optional[str] = ..., - choices: Optional[_FieldChoices] = ..., - help_text: str = ..., - db_column: Optional[str] = ..., - db_tablespace: Optional[str] = ..., - validators: Iterable[_ValidatorCallable] = ..., - error_messages: Optional[_ErrorMessagesToOverride] = ..., - ) -> None: ... - -_C = TypeVar("_C", bound="Optional[str]") - -class CharField(Generic[_C], Field[str, str]): - @overload - def __init__( - self: CharField[str], - verbose_name: Optional[Union[str, bytes]] = ..., - name: Optional[str] = ..., - primary_key: bool = ..., - max_length: Optional[int] = ..., - unique: bool = ..., - blank: bool = ..., - null: Literal[False] = ..., - db_index: bool = ..., - default: Any = ..., - editable: bool = ..., - auto_created: bool = ..., - serialize: bool = ..., - unique_for_date: Optional[str] = ..., - unique_for_month: Optional[str] = ..., - unique_for_year: Optional[str] = ..., - choices: Optional[_FieldChoices] = ..., - help_text: str = ..., - db_column: Optional[str] = ..., - db_tablespace: Optional[str] = ..., - validators: Iterable[_ValidatorCallable] = ..., - error_messages: Optional[_ErrorMessagesToOverride] = ..., - ) -> None: ... - @overload - def __init__( - self: CharField[Optional[str]], - verbose_name: Optional[Union[str, bytes]] = ..., - name: Optional[str] = ..., - primary_key: bool = ..., - max_length: Optional[int] = ..., - unique: bool = ..., - blank: bool = ..., - null: Literal[True] = ..., - db_index: bool = ..., - default: Any = ..., - editable: bool = ..., - auto_created: bool = ..., - serialize: bool = ..., - unique_for_date: Optional[str] = ..., - unique_for_month: Optional[str] = ..., - unique_for_year: Optional[str] = ..., - choices: Optional[_FieldChoices] = ..., - help_text: str = ..., - db_column: Optional[str] = ..., - db_tablespace: Optional[str] = ..., - validators: Iterable[_ValidatorCallable] = ..., - error_messages: Optional[_ErrorMessagesToOverride] = ..., - ) -> None: ... - def __get__(self: CharField[_C], instance: Any, owner: Any) -> _C: ... # type: ignore [override] - def __set__(self: CharField[_C], instance: Any, value: _C) -> None: ... # type: ignore [override] - -class SlugField(CharField[_C]): - @overload - def __init__( - self: SlugField[str], - verbose_name: Optional[Union[str, bytes]] = ..., - name: Optional[str] = ..., - primary_key: bool = ..., - max_length: Optional[int] = ..., - allow_unicode: bool = ..., - unique: bool = ..., - blank: bool = ..., - null: Literal[False] = ..., - db_index: bool = ..., - default: Any = ..., - editable: bool = ..., - auto_created: bool = ..., - serialize: bool = ..., - unique_for_date: Optional[str] = ..., - unique_for_month: Optional[str] = ..., - unique_for_year: Optional[str] = ..., - choices: Optional[_FieldChoices] = ..., - help_text: str = ..., - db_column: Optional[str] = ..., - db_tablespace: Optional[str] = ..., - validators: Iterable[_ValidatorCallable] = ..., - error_messages: Optional[_ErrorMessagesToOverride] = ..., - ) -> None: ... - @overload - def __init__( - self: SlugField[Optional[str]], - verbose_name: Optional[Union[str, bytes]] = ..., - name: Optional[str] = ..., - primary_key: bool = ..., - max_length: Optional[int] = ..., - allow_unicode: bool = ..., - unique: bool = ..., - blank: bool = ..., - null: Literal[True] = ..., - db_index: bool = ..., - default: Any = ..., - editable: bool = ..., - auto_created: bool = ..., - serialize: bool = ..., - unique_for_date: Optional[str] = ..., - unique_for_month: Optional[str] = ..., - unique_for_year: Optional[str] = ..., - choices: Optional[_FieldChoices] = ..., - help_text: str = ..., - db_column: Optional[str] = ..., - db_tablespace: Optional[str] = ..., - validators: Iterable[_ValidatorCallable] = ..., - error_messages: Optional[_ErrorMessagesToOverride] = ..., - ) -> None: ... - def __get__(self: SlugField[_C], instance: Any, owner: Any) -> _C: ... # type: ignore [override] - def __set__(self, instance: Any, value: _C) -> None: ... # type: ignore [override] - -class EmailField(CharField[_C]): - @overload - def __init__( - self: EmailField[str], - verbose_name: Optional[Union[str, bytes]] = ..., - name: Optional[str] = ..., - primary_key: bool = ..., - max_length: Optional[int] = ..., - unique: bool = ..., - blank: bool = ..., - null: Literal[False] = ..., - db_index: bool = ..., - default: Any = ..., - editable: bool = ..., - auto_created: bool = ..., - serialize: bool = ..., - unique_for_date: Optional[str] = ..., - unique_for_month: Optional[str] = ..., - unique_for_year: Optional[str] = ..., - choices: Optional[_FieldChoices] = ..., - help_text: str = ..., - db_column: Optional[str] = ..., - db_tablespace: Optional[str] = ..., - validators: Iterable[_ValidatorCallable] = ..., - error_messages: Optional[_ErrorMessagesToOverride] = ..., - ) -> None: ... - @overload - def __init__( - self: EmailField[Optional[str]], - verbose_name: Optional[Union[str, bytes]] = ..., - name: Optional[str] = ..., - primary_key: bool = ..., - max_length: Optional[int] = ..., - unique: bool = ..., - blank: bool = ..., - null: Literal[True] = ..., - db_index: bool = ..., - default: Any = ..., - editable: bool = ..., - auto_created: bool = ..., - serialize: bool = ..., - unique_for_date: Optional[str] = ..., - unique_for_month: Optional[str] = ..., - unique_for_year: Optional[str] = ..., - choices: Optional[_FieldChoices] = ..., - help_text: str = ..., - db_column: Optional[str] = ..., - db_tablespace: Optional[str] = ..., - validators: Iterable[_ValidatorCallable] = ..., - error_messages: Optional[_ErrorMessagesToOverride] = ..., - ) -> None: ... - def __get__(self, instance: Any, owner: Any) -> _C: ... # type: ignore [override] - def __set__(self, instance: Any, value: _C) -> None: ... # type: ignore [override] - -class URLField(CharField[_C]): - @overload - def __init__( - self: URLField[str], - verbose_name: Optional[Union[str, bytes]] = ..., - name: Optional[str] = ..., - primary_key: bool = ..., - max_length: Optional[int] = ..., - unique: bool = ..., - blank: bool = ..., - null: Literal[False] = ..., - db_index: bool = ..., - default: Any = ..., - editable: bool = ..., - auto_created: bool = ..., - serialize: bool = ..., - unique_for_date: Optional[str] = ..., - unique_for_month: Optional[str] = ..., - unique_for_year: Optional[str] = ..., - choices: Optional[_FieldChoices] = ..., - help_text: str = ..., - db_column: Optional[str] = ..., - db_tablespace: Optional[str] = ..., - validators: Iterable[_ValidatorCallable] = ..., - error_messages: Optional[_ErrorMessagesToOverride] = ..., - ) -> None: ... - @overload - def __init__( - self: URLField[Optional[str]], - verbose_name: Optional[Union[str, bytes]] = ..., - name: Optional[str] = ..., - primary_key: bool = ..., - max_length: Optional[int] = ..., - unique: bool = ..., - blank: bool = ..., - null: Literal[True] = ..., - db_index: bool = ..., - default: Any = ..., - editable: bool = ..., - auto_created: bool = ..., - serialize: bool = ..., - unique_for_date: Optional[str] = ..., - unique_for_month: Optional[str] = ..., - unique_for_year: Optional[str] = ..., - choices: Optional[_FieldChoices] = ..., - help_text: str = ..., - db_column: Optional[str] = ..., - db_tablespace: Optional[str] = ..., - validators: Iterable[_ValidatorCallable] = ..., - error_messages: Optional[_ErrorMessagesToOverride] = ..., - ) -> None: ... - def __get__(self, instance: Any, owner: Any) -> _C: ... # type: ignore [override] - def __set__(self, instance: Any, value: _C) -> None: ... # type: ignore [override] - -class TextField(Generic[_C], Field[str, str]): - @overload - def __init__( - self: TextField[str], - *, - verbose_name: Optional[Union[str, bytes]] = ..., - name: Optional[str] = ..., - primary_key: bool = ..., - max_length: Optional[int] = ..., - unique: bool = ..., - blank: bool = ..., - null: Literal[False] = ..., - db_index: bool = ..., - default: Any = ..., - editable: bool = ..., - auto_created: bool = ..., - serialize: bool = ..., - unique_for_date: Optional[str] = ..., - unique_for_month: Optional[str] = ..., - unique_for_year: Optional[str] = ..., - choices: Optional[_FieldChoices] = ..., - help_text: str = ..., - db_column: Optional[str] = ..., - db_tablespace: Optional[str] = ..., - validators: Iterable[_ValidatorCallable] = ..., - error_messages: Optional[_ErrorMessagesToOverride] = ..., - ) -> None: ... - @overload - def __init__( - self: TextField[Optional[str]], - *, - verbose_name: Optional[Union[str, bytes]] = ..., - name: Optional[str] = ..., - primary_key: bool = ..., - max_length: Optional[int] = ..., - unique: bool = ..., - blank: bool = ..., - null: Literal[True] = ..., - db_index: bool = ..., - default: Any = ..., - editable: bool = ..., - auto_created: bool = ..., - serialize: bool = ..., - unique_for_date: Optional[str] = ..., - unique_for_month: Optional[str] = ..., - unique_for_year: Optional[str] = ..., - choices: Optional[_FieldChoices] = ..., - help_text: str = ..., - db_column: Optional[str] = ..., - db_tablespace: Optional[str] = ..., - validators: Iterable[_ValidatorCallable] = ..., - error_messages: Optional[_ErrorMessagesToOverride] = ..., - ) -> None: ... - def __get__(self: TextField[_C], instance: Any, owner: Any) -> _C: ... # type: ignore [override] - def __set__(self, instance: Any, value: _C) -> None: ... # type: ignore [override] - -_B = TypeVar("_B", bound=Optional[bool]) - -class BooleanField(Generic[_B], Field[Union[bool, Combinable], bool]): - @overload - def __init__( - self: BooleanField[bool], - verbose_name: Optional[Union[str, bytes]] = ..., - name: Optional[str] = ..., - primary_key: bool = ..., - max_length: Optional[int] = ..., - unique: bool = ..., - blank: bool = ..., - null: Literal[False] = ..., - db_index: bool = ..., - default: Any = ..., - editable: bool = ..., - auto_created: bool = ..., - serialize: bool = ..., - unique_for_date: Optional[str] = ..., - unique_for_month: Optional[str] = ..., - unique_for_year: Optional[str] = ..., - choices: Optional[_FieldChoices] = ..., - help_text: str = ..., - db_column: Optional[str] = ..., - db_tablespace: Optional[str] = ..., - validators: Iterable[_ValidatorCallable] = ..., - error_messages: Optional[_ErrorMessagesToOverride] = ..., - ) -> None: ... - @overload - def __init__( - self: BooleanField[Optional[bool]], - verbose_name: Optional[Union[str, bytes]] = ..., - name: Optional[str] = ..., - primary_key: bool = ..., - max_length: Optional[int] = ..., - unique: bool = ..., - blank: bool = ..., - null: Literal[True] = ..., - db_index: bool = ..., - default: Any = ..., - editable: bool = ..., - auto_created: bool = ..., - serialize: bool = ..., - unique_for_date: Optional[str] = ..., - unique_for_month: Optional[str] = ..., - unique_for_year: Optional[str] = ..., - choices: Optional[_FieldChoices] = ..., - help_text: str = ..., - db_column: Optional[str] = ..., - db_tablespace: Optional[str] = ..., - validators: Iterable[_ValidatorCallable] = ..., - error_messages: Optional[_ErrorMessagesToOverride] = ..., - ) -> None: ... - def __get__(self, instance: Any, owner: Any) -> _B: ... # type: ignore [override] - def __set__(self, instance: Any, value: _B) -> None: ... # type: ignore [override] - -class IPAddressField(Generic[_C], Field[Union[str, Combinable], str]): - @overload - def __init__( - self: IPAddressField[str], - verbose_name: Optional[Union[str, bytes]] = ..., - name: Optional[str] = ..., - primary_key: bool = ..., - max_length: Optional[int] = ..., - unique: bool = ..., - blank: bool = ..., - null: Literal[False] = ..., - db_index: bool = ..., - default: Any = ..., - editable: bool = ..., - auto_created: bool = ..., - serialize: bool = ..., - unique_for_date: Optional[str] = ..., - unique_for_month: Optional[str] = ..., - unique_for_year: Optional[str] = ..., - choices: Optional[_FieldChoices] = ..., - help_text: str = ..., - db_column: Optional[str] = ..., - db_tablespace: Optional[str] = ..., - validators: Iterable[_ValidatorCallable] = ..., - error_messages: Optional[_ErrorMessagesToOverride] = ..., - ) -> None: ... - @overload - def __init__( - self: IPAddressField[Optional[str]], - verbose_name: Optional[Union[str, bytes]] = ..., - name: Optional[str] = ..., - primary_key: bool = ..., - max_length: Optional[int] = ..., - unique: bool = ..., - blank: bool = ..., - null: Literal[True] = ..., - db_index: bool = ..., - default: Any = ..., - editable: bool = ..., - auto_created: bool = ..., - serialize: bool = ..., - unique_for_date: Optional[str] = ..., - unique_for_month: Optional[str] = ..., - unique_for_year: Optional[str] = ..., - choices: Optional[_FieldChoices] = ..., - help_text: str = ..., - db_column: Optional[str] = ..., - db_tablespace: Optional[str] = ..., - validators: Iterable[_ValidatorCallable] = ..., - error_messages: Optional[_ErrorMessagesToOverride] = ..., - ) -> None: ... - def __get__(self, instance: Any, owner: Any) -> _C: ... # type: ignore [override] - def __set__(self, instance: Any, value: _C) -> None: ... # type: ignore [override] - -class GenericIPAddressField( - Generic[_C], Field[Union[str, int, Callable[..., Any], Combinable], str] -): - - default_error_messages: Any = ... - unpack_ipv4: Any = ... - protocol: Any = ... - @overload - def __init__( - self: GenericIPAddressField[str], - verbose_name: Optional[Any] = ..., - name: Optional[Any] = ..., - protocol: str = ..., - unpack_ipv4: bool = ..., - primary_key: bool = ..., - unique: bool = ..., - blank: bool = ..., - null: Literal[False] = ..., - db_index: bool = ..., - default: Any = ..., - editable: bool = ..., - auto_created: bool = ..., - serialize: bool = ..., - choices: Optional[_FieldChoices] = ..., - help_text: str = ..., - db_column: Optional[str] = ..., - db_tablespace: Optional[str] = ..., - validators: Iterable[_ValidatorCallable] = ..., - error_messages: Optional[_ErrorMessagesToOverride] = ..., - ) -> None: ... - @overload - def __init__( - self: GenericIPAddressField[Optional[str]], - verbose_name: Optional[Any] = ..., - name: Optional[Any] = ..., - protocol: str = ..., - unpack_ipv4: bool = ..., - primary_key: bool = ..., - unique: bool = ..., - blank: bool = ..., - null: Literal[True] = ..., - db_index: bool = ..., - default: Any = ..., - editable: bool = ..., - auto_created: bool = ..., - serialize: bool = ..., - choices: Optional[_FieldChoices] = ..., - help_text: str = ..., - db_column: Optional[str] = ..., - db_tablespace: Optional[str] = ..., - validators: Iterable[_ValidatorCallable] = ..., - error_messages: Optional[_ErrorMessagesToOverride] = ..., - ) -> None: ... - def __get__(self, instance: Any, owner: Any) -> _C: ... # type: ignore [override] - def __set__(self, instance: Any, value: _C) -> None: ... # type: ignore [override] - -class DateTimeCheckMixin: ... - -_D = TypeVar("_D", bound=Optional[date]) - -class DateField( - Generic[_D], DateTimeCheckMixin, Field[Union[str, date, Combinable], date] -): - @overload - def __init__( - self: DateField[date], - verbose_name: Optional[Union[str, bytes]] = ..., - name: Optional[str] = ..., - auto_now: bool = ..., - auto_now_add: bool = ..., - primary_key: bool = ..., - max_length: Optional[int] = ..., - unique: bool = ..., - blank: bool = ..., - null: Literal[False] = ..., - db_index: bool = ..., - default: Any = ..., - editable: bool = ..., - auto_created: bool = ..., - serialize: bool = ..., - choices: Optional[_FieldChoices] = ..., - help_text: str = ..., - db_column: Optional[str] = ..., - db_tablespace: Optional[str] = ..., - validators: Iterable[_ValidatorCallable] = ..., - error_messages: Optional[_ErrorMessagesToOverride] = ..., - ) -> None: ... - @overload - def __init__( - self: DateField[Optional[date]], - verbose_name: Optional[Union[str, bytes]] = ..., - name: Optional[str] = ..., - auto_now: bool = ..., - auto_now_add: bool = ..., - primary_key: bool = ..., - max_length: Optional[int] = ..., - unique: bool = ..., - blank: bool = ..., - null: Literal[True] = ..., - db_index: bool = ..., - default: Any = ..., - editable: bool = ..., - auto_created: bool = ..., - serialize: bool = ..., - choices: Optional[_FieldChoices] = ..., - help_text: str = ..., - db_column: Optional[str] = ..., - db_tablespace: Optional[str] = ..., - validators: Iterable[_ValidatorCallable] = ..., - error_messages: Optional[_ErrorMessagesToOverride] = ..., - ) -> None: ... - def __get__(self, instance: Any, owner: Any) -> _D: ... # type: ignore [override] - def __set__(self, instance: Any, value: _D) -> None: ... # type: ignore [override] - -_TM = TypeVar("_TM", bound=Optional[time]) - -class TimeField( - Generic[_TM], - DateTimeCheckMixin, - Field[Union[str, time, datetime, Combinable], time], -): - @overload - def __init__( - self: TimeField[time], - verbose_name: Optional[Union[str, bytes]] = ..., - name: Optional[str] = ..., - auto_now: bool = ..., - auto_now_add: bool = ..., - primary_key: bool = ..., - unique: bool = ..., - blank: bool = ..., + def __new__( + cls, + *args: Any, null: Literal[False] = ..., - db_index: bool = ..., - default: Any = ..., - editable: bool = ..., - auto_created: bool = ..., - serialize: bool = ..., - choices: Optional[_FieldChoices] = ..., - help_text: str = ..., - db_column: Optional[str] = ..., - db_tablespace: Optional[str] = ..., - validators: Iterable[_ValidatorCallable] = ..., - error_messages: Optional[_ErrorMessagesToOverride] = ..., - ) -> None: ... + choices: None = ..., + **kwargs: Any, + ) -> FilePathField[str]: ... @overload - def __init__( - self: TimeField[Optional[time]], - verbose_name: Optional[Union[str, bytes]] = ..., - name: Optional[str] = ..., - auto_now: bool = ..., - auto_now_add: bool = ..., - primary_key: bool = ..., - unique: bool = ..., - blank: bool = ..., - null: Literal[True] = ..., - db_index: bool = ..., - default: Any = ..., - editable: bool = ..., - auto_created: bool = ..., - serialize: bool = ..., - choices: Optional[_FieldChoices] = ..., - help_text: str = ..., - db_column: Optional[str] = ..., - db_tablespace: Optional[str] = ..., - validators: Iterable[_ValidatorCallable] = ..., - error_messages: Optional[_ErrorMessagesToOverride] = ..., - ) -> None: ... - def __get__(self, instance: Any, owner: Any) -> _TM: ... # type: ignore [override] - def __set__(self, instance: Any, value: _TM) -> None: ... # type: ignore [override] - -_DT = TypeVar("_DT", bound=Optional[datetime]) - -class DateTimeField( - Generic[_DT], DateTimeCheckMixin, Field[Union[str, datetime], datetime] -): + def __new__( + cls, + *args: Any, + null: Literal[True], + choices: None = ..., + **kwargs: Any, + ) -> FilePathField[Optional[str]]: ... @overload - def __init__( - self: DateTimeField[datetime], - verbose_name: Optional[Union[str, bytes]] = ..., - name: Optional[str] = ..., - auto_now: bool = ..., - auto_now_add: bool = ..., - primary_key: bool = ..., - max_length: Optional[int] = ..., - unique: bool = ..., - blank: bool = ..., + def __new__( + cls, + *args: Any, null: Literal[False] = ..., - db_index: bool = ..., - default: Any = ..., - editable: bool = ..., - auto_created: bool = ..., - serialize: bool = ..., - choices: Optional[_FieldChoices] = ..., - help_text: str = ..., - db_column: Optional[str] = ..., - db_tablespace: Optional[str] = ..., - validators: Iterable[_ValidatorCallable] = ..., - error_messages: Optional[_ErrorMessagesToOverride] = ..., - ) -> None: ... + choices: Iterable[Union[Tuple[_C, str], Tuple[str, Iterable[Tuple[_C, str]]]]], + **kwargs: Any, + ) -> FilePathField[_C]: ... @overload - def __init__( - self: DateTimeField[Optional[datetime]], - verbose_name: Optional[Union[str, bytes]] = ..., - name: Optional[str] = ..., - auto_now: bool = ..., - auto_now_add: bool = ..., - primary_key: bool = ..., - max_length: Optional[int] = ..., - unique: bool = ..., - blank: bool = ..., - null: Literal[True] = ..., - db_index: bool = ..., - default: Any = ..., - editable: bool = ..., - auto_created: bool = ..., - serialize: bool = ..., - choices: Optional[_FieldChoices] = ..., - help_text: str = ..., - db_column: Optional[str] = ..., - db_tablespace: Optional[str] = ..., - validators: Iterable[_ValidatorCallable] = ..., - error_messages: Optional[_ErrorMessagesToOverride] = ..., - ) -> None: ... - def __get__(self, instance: Any, owner: Any) -> _DT: ... # type: ignore [override] - def __set__(self, instance: Any, value: _DT) -> None: ... # type: ignore [override] + def __new__( + cls, + *args: Any, + null: Literal[True], + choices: Iterable[Union[Tuple[_C, str], Tuple[str, Iterable[Tuple[_C, str]]]]], + **kwargs: Any, + ) -> FilePathField[Optional[_C]]: ... -_U = TypeVar("_U", bound=Optional[uuid.UUID]) +_BIN = TypeVar("_BIN", bound=Optional[bytes]) -class UUIDField(Generic[_U], Field[Union[str, uuid.UUID], uuid.UUID]): +class BinaryField(Generic[_BIN], Field[Union[_BIN, bytearray, memoryview], _BIN]): @overload - def __init__( - self: UUIDField[uuid.UUID], - verbose_name: Optional[Union[str, bytes]] = ..., - name: Optional[str] = ..., - primary_key: bool = ..., - max_length: Optional[int] = ..., - unique: bool = ..., - blank: bool = ..., + def __new__( + cls, + *args: Any, null: Literal[False] = ..., - db_index: bool = ..., - default: Any = ..., - editable: bool = ..., - auto_created: bool = ..., - serialize: bool = ..., - unique_for_date: Optional[str] = ..., - unique_for_month: Optional[str] = ..., - unique_for_year: Optional[str] = ..., - choices: Optional[_FieldChoices] = ..., - help_text: str = ..., - db_column: Optional[str] = ..., - db_tablespace: Optional[str] = ..., - validators: Iterable[_ValidatorCallable] = ..., - error_messages: Optional[_ErrorMessagesToOverride] = ..., - ) -> None: ... + choices: None = ..., + **kwargs: Any, + ) -> BinaryField[bytes]: ... @overload - def __init__( - self: UUIDField[Optional[uuid.UUID]], - verbose_name: Optional[Union[str, bytes]] = ..., - name: Optional[str] = ..., - primary_key: bool = ..., - max_length: Optional[int] = ..., - unique: bool = ..., - blank: bool = ..., - null: Literal[True] = ..., - db_index: bool = ..., - default: Any = ..., - editable: bool = ..., - auto_created: bool = ..., - serialize: bool = ..., - unique_for_date: Optional[str] = ..., - unique_for_month: Optional[str] = ..., - unique_for_year: Optional[str] = ..., - choices: Optional[_FieldChoices] = ..., - help_text: str = ..., - db_column: Optional[str] = ..., - db_tablespace: Optional[str] = ..., - validators: Iterable[_ValidatorCallable] = ..., - error_messages: Optional[_ErrorMessagesToOverride] = ..., - ) -> None: ... - def __get__(self, instance: Any, owner: Any) -> _U: ... # type: ignore [override] - def __set__(self, instance: Any, value: Union[str, _U]) -> None: ... # type: ignore [override] - -class FilePathField(Generic[_C], Field[str, str]): - path: Any = ... - match: Optional[str] = ... - recursive: bool = ... - allow_files: bool = ... - allow_folders: bool = ... + def __new__( + cls, + *args: Any, + null: Literal[True], + choices: None = ..., + **kwargs: Any, + ) -> BinaryField[Optional[bytes]]: ... @overload - def __init__( - self: FilePathField[str], - path: Union[str, Callable[..., str]] = ..., - match: Optional[str] = ..., - recursive: bool = ..., - allow_files: bool = ..., - allow_folders: bool = ..., - verbose_name: Optional[str] = ..., - name: Optional[str] = ..., - primary_key: bool = ..., - max_length: int = ..., - unique: bool = ..., - blank: bool = ..., + def __new__( + cls, + *args: Any, null: Literal[False] = ..., - db_index: bool = ..., - default: Any = ..., - editable: bool = ..., - auto_created: bool = ..., - serialize: bool = ..., - choices: Optional[_FieldChoices] = ..., - help_text: str = ..., - db_column: Optional[str] = ..., - db_tablespace: Optional[str] = ..., - validators: Iterable[_ValidatorCallable] = ..., - error_messages: Optional[_ErrorMessagesToOverride] = ..., - ) -> None: ... + choices: Iterable[ + Union[Tuple[_BIN, str], Tuple[str, Iterable[Tuple[_BIN, str]]]] + ], + **kwargs: Any, + ) -> BinaryField[_BIN]: ... @overload - def __init__( - self: FilePathField[Optional[str]], - path: Union[str, Callable[..., str]] = ..., - match: Optional[str] = ..., - recursive: bool = ..., - allow_files: bool = ..., - allow_folders: bool = ..., - verbose_name: Optional[str] = ..., - name: Optional[str] = ..., - primary_key: bool = ..., - max_length: int = ..., - unique: bool = ..., - blank: bool = ..., - null: Literal[True] = ..., - db_index: bool = ..., - default: Any = ..., - editable: bool = ..., - auto_created: bool = ..., - serialize: bool = ..., - choices: Optional[_FieldChoices] = ..., - help_text: str = ..., - db_column: Optional[str] = ..., - db_tablespace: Optional[str] = ..., - validators: Iterable[_ValidatorCallable] = ..., - error_messages: Optional[_ErrorMessagesToOverride] = ..., - ) -> None: ... - def __get__(self, instance: Any, owner: Any) -> _C: ... # type: ignore [override] - def __set__(self, instance: Any, value: _C) -> None: ... # type: ignore [override] + def __new__( + cls, + *args: Any, + null: Literal[True], + choices: Iterable[ + Union[Tuple[_BIN, str], Tuple[str, Iterable[Tuple[_BIN, str]]]] + ], + **kwargs: Any, + ) -> BinaryField[Optional[_BIN]]: ... -_BIN = TypeVar("_BIN", bound=Optional[bytes]) +_TD = TypeVar("_TD", bound=Optional[timedelta]) -class BinaryField(Generic[_BIN], Field[Union[bytes, bytearray, memoryview], bytes]): +class DurationField(Generic[_TD], Field[_TD, _TD]): @overload - def __init__( - self: BinaryField[bytes], - verbose_name: Optional[Union[str, bytes]] = ..., - name: Optional[str] = ..., - primary_key: bool = ..., - max_length: Optional[int] = ..., - unique: bool = ..., - blank: bool = ..., + def __new__( + cls, + *args: Any, null: Literal[False] = ..., - db_index: bool = ..., - default: Any = ..., - editable: bool = ..., - auto_created: bool = ..., - serialize: bool = ..., - unique_for_date: Optional[str] = ..., - unique_for_month: Optional[str] = ..., - unique_for_year: Optional[str] = ..., - choices: Optional[_FieldChoices] = ..., - help_text: str = ..., - db_column: Optional[str] = ..., - db_tablespace: Optional[str] = ..., - validators: Iterable[_ValidatorCallable] = ..., - error_messages: Optional[_ErrorMessagesToOverride] = ..., - ) -> None: ... + choices: None = ..., + **kwargs: Any, + ) -> DurationField[timedelta]: ... @overload - def __init__( - self: BinaryField[Optional[bytes]], - verbose_name: Optional[Union[str, bytes]] = ..., - name: Optional[str] = ..., - primary_key: bool = ..., - max_length: Optional[int] = ..., - unique: bool = ..., - blank: bool = ..., - null: Literal[True] = ..., - db_index: bool = ..., - default: Any = ..., - editable: bool = ..., - auto_created: bool = ..., - serialize: bool = ..., - unique_for_date: Optional[str] = ..., - unique_for_month: Optional[str] = ..., - unique_for_year: Optional[str] = ..., - choices: Optional[_FieldChoices] = ..., - help_text: str = ..., - db_column: Optional[str] = ..., - db_tablespace: Optional[str] = ..., - validators: Iterable[_ValidatorCallable] = ..., - error_messages: Optional[_ErrorMessagesToOverride] = ..., - ) -> None: ... - def __get__(self, instance: Any, owner: Any) -> _BIN: ... # type: ignore [override] - def __set__(self, instance: Any, value: _BIN) -> None: ... # type: ignore [override] - -_TD = TypeVar("_TD", bound=Optional[timedelta]) - -class DurationField(Generic[_TD], Field[timedelta, timedelta]): + def __new__( + cls, + *args: Any, + null: Literal[True], + choices: None = ..., + **kwargs: Any, + ) -> DurationField[Optional[timedelta]]: ... @overload - def __init__( - self: DurationField[timedelta], - verbose_name: Optional[Union[str, bytes]] = ..., - name: Optional[str] = ..., - primary_key: bool = ..., - max_length: Optional[int] = ..., - unique: bool = ..., - blank: bool = ..., + def __new__( + cls, + *args: Any, null: Literal[False] = ..., - db_index: bool = ..., - default: Any = ..., - editable: bool = ..., - auto_created: bool = ..., - serialize: bool = ..., - unique_for_date: Optional[str] = ..., - unique_for_month: Optional[str] = ..., - unique_for_year: Optional[str] = ..., - choices: Optional[_FieldChoices] = ..., - help_text: str = ..., - db_column: Optional[str] = ..., - db_tablespace: Optional[str] = ..., - validators: Iterable[_ValidatorCallable] = ..., - error_messages: Optional[_ErrorMessagesToOverride] = ..., - ) -> None: ... + choices: Iterable[ + Union[Tuple[_TD, str], Tuple[str, Iterable[Tuple[_TD, str]]]] + ], + **kwargs: Any, + ) -> DurationField[_TD]: ... @overload - def __init__( - self: DurationField[Optional[timedelta]], - verbose_name: Optional[Union[str, bytes]] = ..., - name: Optional[str] = ..., - primary_key: bool = ..., - max_length: Optional[int] = ..., - unique: bool = ..., - blank: bool = ..., - null: Literal[True] = ..., - db_index: bool = ..., - default: Any = ..., - editable: bool = ..., - auto_created: bool = ..., - serialize: bool = ..., - unique_for_date: Optional[str] = ..., - unique_for_month: Optional[str] = ..., - unique_for_year: Optional[str] = ..., - choices: Optional[_FieldChoices] = ..., - help_text: str = ..., - db_column: Optional[str] = ..., - db_tablespace: Optional[str] = ..., - validators: Iterable[_ValidatorCallable] = ..., - error_messages: Optional[_ErrorMessagesToOverride] = ..., - ) -> None: ... - def __get__(self, instance: Any, owner: Any) -> _TD: ... # type: ignore [override] - def __set__(self, instance: Any, value: _TD) -> None: ... # type: ignore [override] - -class BigAutoField(AutoField): ... + def __new__( + cls, + *args: Any, + null: Literal[True], + choices: Iterable[ + Union[Tuple[_TD, str], Tuple[str, Iterable[Tuple[_TD, str]]]] + ], + **kwargs: Any, + ) -> DurationField[Optional[_TD]]: ... diff --git a/s/lint b/s/lint index 261c3f265..abb9ed4c1 100755 --- a/s/lint +++ b/s/lint @@ -2,20 +2,21 @@ set -ex - # format code if [[ $CI ]]; then - ./.venv/bin/black --check tests typings - ./.venv/bin/isort --check-only tests typings + ./.venv/bin/black --check tests typings + ./.venv/bin/isort --check-only tests typings else - ./.venv/bin/black tests typings - ./.venv/bin/isort tests typings + ./.venv/bin/black tests typings + ./.venv/bin/isort tests typings fi # type check code ./.venv/bin/mypy tests typings +# pyright tests ./node_modules/.bin/pyright tests typings +./.venv/bin/pytest tests typings -p no:warnings -v # lint ./.venv/bin/flake8 tests typings diff --git a/tests/pyright/__init__.py b/tests/pyright/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/tests/pyright/base.py b/tests/pyright/base.py new file mode 100644 index 000000000..7378f90a5 --- /dev/null +++ b/tests/pyright/base.py @@ -0,0 +1,46 @@ +# Slighly based on https://github.com/strawberry-graphql/strawberry/blob/main/tests/pyright/utils.py + +import os +import subprocess +import tempfile +from dataclasses import dataclass +from typing import List, cast + +from typing_extensions import Literal + +_cwd = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) +_bin = os.path.join(_cwd, "node_modules", ".bin", "pyright") + + +@dataclass +class Result: + type: Literal["error", "info"] + message: str + line: int + column: int + + @classmethod + def from_output_line(cls, output_line: str) -> "Result": + # an output line looks like: filename.py:11:6 - type: Message + file_info, result = output_line.split("-", maxsplit=1) + + line, column = [int(value) for value in file_info.split(":")[1:]] + type_, message = [value.strip() for value in result.split(":", maxsplit=1)] + type_ = cast(Literal["error", "info"], type_) + + return cls(type=type_, message=message, line=line, column=column) + + +def run_pyright(code: str) -> List[Result]: + with tempfile.NamedTemporaryFile("w", suffix=".py") as f: + f.write(code) + f.flush() + result = subprocess.run([_bin, f.name], cwd=_cwd, stdout=subprocess.PIPE) + + output = result.stdout.decode("utf-8") + results: List[Result] = [] + for line in output.splitlines(): + if line.strip().startswith(f"{f.name}:"): + results.append(Result.from_output_line(line)) + + return results diff --git a/tests/pyright/test_fields.py b/tests/pyright/test_fields.py new file mode 100644 index 000000000..041726b93 --- /dev/null +++ b/tests/pyright/test_fields.py @@ -0,0 +1,185 @@ +from .base import Result, run_pyright + + +def test_integer_with_choices() -> None: + results = run_pyright( + """\ +from django.db import models + +class Foo(models.Model): + integer_with_choices = models.IntegerField( + choices=[ + (1, "First Option"), + (2, "Second Option"), + ], + ) + +f = Foo() +reveal_type(f.integer_with_choices) +f.integer_with_choices == 2 +f.integer_with_choices == 3 +f.integer_with_choices = None +f.integer_with_choices = 3 +f.integer_with_choices = 2 +""" + ) + assert results == [ + Result( + type="info", + message='Type of "f.integer_with_choices" is "Literal[1, 2]"', + line=12, + column=13, + ), + Result( + type="error", + message=( + "Condition will always evaluate to False since the types " + '"Literal[1, 2]" and "Literal[3]" have no overlap (reportUnnecessaryComparison)' + ), + line=14, + column=1, + ), + Result( + type="error", + message='Cannot assign member "integer_with_choices" for type "Foo" (reportGeneralTypeIssues)', + line=15, + column=3, + ), + Result( + type="error", + message='Cannot assign member "integer_with_choices" for type "Foo" (reportGeneralTypeIssues)', + line=16, + column=3, + ), + ] + + +def test_integer_with_choices_nullable() -> None: + results = run_pyright( + """\ +from django.db import models + +class Foo(models.Model): + integer_with_choices_nullable = models.IntegerField( + choices=[ + (1, "First Option"), + (2, "Second Option"), + ], + null=True, + ) + +f = Foo() +reveal_type(f.integer_with_choices_nullable) +f.integer_with_choices_nullable == 2 +f.integer_with_choices_nullable == 3 +f.integer_with_choices_nullable = None +f.integer_with_choices_nullable = 3 +f.integer_with_choices_nullable = 2 +""" + ) + assert results == [ + Result( + type="info", + message='Type of "f.integer_with_choices_nullable" is "Literal[1, 2] | None"', + line=13, + column=13, + ), + Result( + type="error", + message=( + 'Cannot assign member "integer_with_choices_nullable" for type ' + '"Foo" (reportGeneralTypeIssues)' + ), + line=17, + column=3, + ), + ] + + +def test_char_with_choices() -> None: + results = run_pyright( + """\ +from django.db import models + +class Foo(models.Model): + char_with_choices = models.CharField( + choices=[ + ("a", "A"), + ("b", "B"), + ], + ) + +f = Foo() +reveal_type(f.char_with_choices) +f.char_with_choices == "c" +f.char_with_choices == "a" +f.char_with_choices = None +f.char_with_choices = "c" +f.char_with_choices = "b" +""" + ) + assert results == [ + Result( + type="info", + message="Type of \"f.char_with_choices\" is \"Literal['a', 'b']\"", + line=12, + column=13, + ), + Result( + type="error", + message="Condition will always evaluate to False since the types \"Literal['a', 'b']\" and \"Literal['c']\" have no overlap (reportUnnecessaryComparison)", + line=13, + column=1, + ), + Result( + type="error", + message='Cannot assign member "char_with_choices" for type "Foo" (reportGeneralTypeIssues)', + line=15, + column=3, + ), + Result( + type="error", + message='Cannot assign member "char_with_choices" for type "Foo" (reportGeneralTypeIssues)', + line=16, + column=3, + ), + ] + + +def test_char_with_choices_nullable() -> None: + results = run_pyright( + """\ +from django.db import models + +class Foo(models.Model): + char_with_choices_nullable = models.CharField( + choices=[ + ("a", "A"), + ("b", "B"), + ], + null=True, + ) + +f = Foo() +reveal_type(f.char_with_choices_nullable) +f.char_with_choices_nullable == "c" +f.char_with_choices_nullable == "a" +f.char_with_choices_nullable = None +f.char_with_choices_nullable = "c" +f.char_with_choices_nullable = "b" +""" + ) + assert results == [ + Result( + type="info", + message="Type of \"f.char_with_choices_nullable\" is \"Literal['a', 'b'] | None\"", + line=13, + column=13, + ), + Result( + type="error", + message='Cannot assign member "char_with_choices_nullable" for type "Foo" (reportGeneralTypeIssues)', + line=17, + column=3, + ), + ] diff --git a/tests/trout/models.py b/tests/trout/models.py index ef288620b..7275541a9 100644 --- a/tests/trout/models.py +++ b/tests/trout/models.py @@ -87,6 +87,19 @@ class Comment(models.Model): char = models.CharField() char_nullable = models.CharField(null=True) + char_with_choices = models.CharField( + choices=[ + ("a", "A"), + ("b", "B"), + ], + ) + char_with_choices_nullable = models.CharField( + choices=[ + ("a", "A"), + ("b", "B"), + ], + null=True, + ) text = models.TextField() text_nullable = models.TextField(null=True) @@ -100,6 +113,19 @@ class Comment(models.Model): integer = models.IntegerField() integer_nullable = models.IntegerField(null=True) + integer_with_choices = models.IntegerField( + choices=[ + (1, "First Option"), + (2, "Second Option"), + ], + ) + integer_with_choices_nullable = models.IntegerField( + choices=[ + (1, "First Option"), + (2, "Second Option"), + ], + null=True, + ) float = models.FloatField() float_nullable = models.FloatField(null=True) @@ -113,8 +139,8 @@ class Comment(models.Model): email = models.EmailField() email_nullable = models.EmailField(null=True) - decimal = models.DecimalField() - decimal_nullable = models.DecimalField(null=True) + decimal = models.DecimalField(max_digits=20, decimal_places=2) + decimal_nullable = models.DecimalField(null=True, max_digits=20, decimal_places=2) bool = models.BooleanField() bool_nullable = models.BooleanField(null=True) @@ -263,7 +289,7 @@ def main() -> None: process_non_nullable(for_sure_c.integer) # Django way to duplicate an instance - comment.id = None + comment.pk = None comment.save() print(comment.id) @@ -323,6 +349,18 @@ def main() -> None: if not comment.integer and not isinstance(comment.integer, int): print() # type: ignore [unreachable] + process_non_nullable(comment.integer_with_choices) + if isinstance(comment.integer_with_choices_nullable, type(None)): + print(comment.integer_with_choices_nullable) + if comment.integer_with_choices_nullable is not None: + print(comment.integer_with_choices_nullable) + if not isinstance(comment.integer_with_choices, int): + print() # type: ignore [unreachable] + if not comment.integer_with_choices and not isinstance( + comment.integer_with_choices, int + ): + print() # type: ignore [unreachable] + process_non_nullable(comment.float) if isinstance(comment.float_nullable, type(None)): print(comment.float_nullable) @@ -515,6 +553,16 @@ def main() -> None: if not comment.ci_char and not isinstance(comment.ci_char, str): print() # type: ignore [unreachable] + process_non_nullable(comment.char_with_choices) + if isinstance(comment.char_with_choices_nullable, type(None)): + print(comment.char_with_choices_nullable) + if comment.char_with_choices_nullable is not None: + print(comment.char_with_choices_nullable) + if not isinstance(comment.char_with_choices, str): + print() # type: ignore [unreachable] + if not comment.char_with_choices and not isinstance(comment.char_with_choices, str): + print() # type: ignore [unreachable] + process_non_nullable(comment.ci_email) if isinstance(comment.ci_email_nullable, type(None)): print(comment.ci_email_nullable) @@ -929,7 +977,8 @@ class Foo(models.Model): null=True, default=None, blank=True, - max_digits=2, + max_digits=4, + decimal_places=2, ) search_field = SearchVectorField(null=True, help_text="foo") @@ -944,7 +993,7 @@ class HandField(models.Field[Any, Any]): def __init__(self, *args: Any, **kwargs: Any) -> None: kwargs["max_length"] = 104 - super().__init__(*args, **kwargs) # type: ignore [call-arg] + super().__init__(*args, **kwargs) AuthUser.objects.create_superuser(username="foo", email=None, password=None) From 5d5b23f4aa0afcab7ba431cd609c8102e73646fe Mon Sep 17 00:00:00 2001 From: Serhii Tereshchenko Date: Sat, 11 Dec 2021 04:21:53 +0200 Subject: [PATCH 83/88] Fix typo and Django version requirements in Readme (#78) https://github.com/django/django/pull/12405#issuecomment-596109039 QuerySet and BaseManager already have __class_getitem__, starting from Django 3.1 --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 44494ecee..042ab5d98 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ Type stubs for [Django](https://www.djangoproject.com). pip install django-types ``` -You'll need to monkey patch Django's `QuerySet`, `Manager` (note needed for Django 3.2+) and +You'll need to monkey patch Django's `QuerySet`, `Manager` (not needed for Django 3.1+) and `ForeignKey` classes so we can index into them with a generic argument. Add this to your settings.py: From 57982252de7b6a504da5bcc782bcabd8c7a20e11 Mon Sep 17 00:00:00 2001 From: Louis Pilfold Date: Sat, 11 Dec 2021 02:23:28 +0000 Subject: [PATCH 84/88] Correct JSON encoder decoder types (#77) Closes https://github.com/sbdchd/django-types/issues/75 Thanks! --- django-stubs/db/models/fields/json.pyi | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/django-stubs/db/models/fields/json.pyi b/django-stubs/db/models/fields/json.pyi index 5b93779e2..c130ec739 100644 --- a/django-stubs/db/models/fields/json.pyi +++ b/django-stubs/db/models/fields/json.pyi @@ -1,5 +1,5 @@ import json -from typing import Any, Callable, Iterable, Optional, Tuple, TypeVar, Union, overload +from typing import Any, Callable, Iterable, Optional, Tuple, Type, TypeVar, Union, overload from django.db.models import lookups from django.db.models.lookups import PostgresOperatorLookup, Transform @@ -12,16 +12,16 @@ _A = TypeVar("_A", bound=Optional[Any]) class JSONField(CheckFieldDefaultMixin, Field[_A, _A]): default_error_messages: Any = ... - encoder: json.JSONEncoder = ... - decoder: json.JSONEncoder = ... + encoder: Type[json.JSONEncoder] = ... + decoder: Type[json.JSONEncoder] = ... def from_db_value(self, value: Any, expression: Any, connection: Any) -> Any: ... def get_transform(self, name: Any) -> Any: ... def value_to_string(self, obj: Any) -> Any: ... @overload def __init__( self: JSONField[_A], - encoder: json.JSONEncoder = ..., - decoder: json.JSONDecoder = ..., + encoder: Type[json.JSONEncoder] = ..., + decoder: Type[json.JSONDecoder] = ..., verbose_name: Optional[str] = ..., name: Optional[str] = ..., primary_key: bool = ..., @@ -49,8 +49,8 @@ class JSONField(CheckFieldDefaultMixin, Field[_A, _A]): @overload def __init__( self: JSONField[Optional[_A]], - encoder: json.JSONEncoder = ..., - decoder: json.JSONDecoder = ..., + encoder: Type[json.JSONEncoder] = ..., + decoder: Type[json.JSONDecoder] = ..., verbose_name: Optional[str] = ..., name: Optional[str] = ..., primary_key: bool = ..., From 029e162f9104cc250fa217bae56a40e8ba583cc6 Mon Sep 17 00:00:00 2001 From: Thiago Bellini Ribeiro Date: Sun, 12 Dec 2021 13:19:06 -0300 Subject: [PATCH 85/88] Fix migration issues for fields with choices (#79) Just upgraded to 0.11.0 and notice some errors on my migrations. There's no need to set covariant/contravariant on _GT/_ST. The tests are just there to make sure that there are no errors anymore. If the code is reverted the test would fail --- django-stubs/db/models/fields/__init__.pyi | 4 +-- django-stubs/db/models/fields/json.pyi | 12 ++++++- django-stubs/db/models/fields/related.pyi | 4 +-- tests/pyright/test_migrations.py | 38 ++++++++++++++++++++++ 4 files changed, 53 insertions(+), 5 deletions(-) create mode 100644 tests/pyright/test_migrations.py diff --git a/django-stubs/db/models/fields/__init__.pyi b/django-stubs/db/models/fields/__init__.pyi index a36e41069..e5a711a98 100644 --- a/django-stubs/db/models/fields/__init__.pyi +++ b/django-stubs/db/models/fields/__init__.pyi @@ -38,9 +38,9 @@ _ErrorMessagesToOverride = Dict[str, Any] _T = TypeVar("_T", bound="Field[Any, Any]") # __set__ value type -_ST = TypeVar("_ST", contravariant=True) +_ST = TypeVar("_ST") # __get__ return type -_GT = TypeVar("_GT", covariant=True) +_GT = TypeVar("_GT") class NOT_PROVIDED: ... diff --git a/django-stubs/db/models/fields/json.pyi b/django-stubs/db/models/fields/json.pyi index c130ec739..141260dfd 100644 --- a/django-stubs/db/models/fields/json.pyi +++ b/django-stubs/db/models/fields/json.pyi @@ -1,5 +1,15 @@ import json -from typing import Any, Callable, Iterable, Optional, Tuple, Type, TypeVar, Union, overload +from typing import ( + Any, + Callable, + Iterable, + Optional, + Tuple, + Type, + TypeVar, + Union, + overload, +) from django.db.models import lookups from django.db.models.lookups import PostgresOperatorLookup, Transform diff --git a/django-stubs/db/models/fields/related.pyi b/django-stubs/db/models/fields/related.pyi index e8f98a4b4..fb842cbee 100644 --- a/django-stubs/db/models/fields/related.pyi +++ b/django-stubs/db/models/fields/related.pyi @@ -68,9 +68,9 @@ _ErrorMessagesToOverride = Dict[str, Any] RECURSIVE_RELATIONSHIP_CONSTANT: str = ... # __set__ value type -_ST = TypeVar("_ST", covariant=True) +_ST = TypeVar("_ST") # __get__ return type -_GT = TypeVar("_GT", contravariant=True) +_GT = TypeVar("_GT") class RelatedField(FieldCacheMixin, Field[_ST, _GT]): one_to_many: bool = ... diff --git a/tests/pyright/test_migrations.py b/tests/pyright/test_migrations.py new file mode 100644 index 000000000..b75bf67c9 --- /dev/null +++ b/tests/pyright/test_migrations.py @@ -0,0 +1,38 @@ +from .base import run_pyright + + +def test_integer_with_choices() -> None: + results = run_pyright( + """\ +from django.db import migrations, models + +migrations.AlterField( + model_name="test_model", + name="test_field", + field=models.CharField( + choices=[ + ("foo", "Foo"), + ("bar", "Bar"), + ], + default=None, + max_length=3, + null=True, + ), +) + +migrations.AddField( + model_name="test_model", + name="test_related_field", + field=models.ForeignKey( + blank=True, + default=None, + null=True, + on_delete=models.deletion.PROTECT, + related_name="test_fields", + to="some.other.Model", + ), +) +""" + ) + # NOTE: Those would fail when _ST/_GT were set to covariant/contravariant + assert results == [] From df532d0c34840650100f7ddfe5a9de9d909d9245 Mon Sep 17 00:00:00 2001 From: Vehbi Sinan Tunalioglu Date: Wed, 15 Dec 2021 12:36:50 +0800 Subject: [PATCH 86/88] Add db_table kwarg to ManyToManyField constructor (#80) I think that it was removed in one of the recent PRs for improving `ManyToManyField` typing. --- django-stubs/db/models/fields/related.pyi | 1 + 1 file changed, 1 insertion(+) diff --git a/django-stubs/db/models/fields/related.pyi b/django-stubs/db/models/fields/related.pyi index fb842cbee..991cadd2f 100644 --- a/django-stubs/db/models/fields/related.pyi +++ b/django-stubs/db/models/fields/related.pyi @@ -465,6 +465,7 @@ class ManyToManyField( choices: Optional[_FieldChoices] = ..., help_text: str = ..., db_column: Optional[str] = ..., + db_table: Optional[str] = ..., db_tablespace: Optional[str] = ..., validators: Iterable[_ValidatorCallable] = ..., error_messages: Optional[_ErrorMessagesToOverride] = ..., From f64702d9b7c14480f17c663b60843eb2e63f5042 Mon Sep 17 00:00:00 2001 From: Steve Dignam Date: Wed, 15 Dec 2021 09:38:51 -0500 Subject: [PATCH 87/88] release: 0.12.0 (#81) --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index d435acf32..a6cd7c0f9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "django-types" -version = "0.10.0" +version = "0.12.0" description = "Type stubs for Django" repository = "https://github.com/sbdchd/django-types" readme = "README.md" From ee9cbe76249b0b263bfcd6ba50fe4a33258fa730 Mon Sep 17 00:00:00 2001 From: Tony Rippy Date: Mon, 20 Dec 2021 10:50:43 -0500 Subject: [PATCH 88/88] Allow adding and removing field values (typically primary keys) in many-to-many relationships. From the docs for `add()`: https://docs.djangoproject.com/en/4.0/ref/models/relations/#django.db.models.fields.related.RelatedManager.add > For many-to-many relationships add() accepts either model instances or field values, normally primary keys, as the *objs argument. Likewise for `remove()`: https://docs.djangoproject.com/en/4.0/ref/models/relations/#django.db.models.fields.related.RelatedManager.remove > For many-to-many relationships remove() accepts either model instances or field values, normally primary keys, as the *objs argument. --- django-stubs/db/models/manager.pyi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/django-stubs/db/models/manager.pyi b/django-stubs/db/models/manager.pyi index e722a161c..1e388c638 100644 --- a/django-stubs/db/models/manager.pyi +++ b/django-stubs/db/models/manager.pyi @@ -63,10 +63,10 @@ class ManyToManyRelatedManager(Generic[_T, _V], Manager[_T]): through: RelatedManager[_V] def add( self, - *objs: Union[QuerySet[_T], _T], + *objs: Union[QuerySet[_T], _T, _V], through_defaults: MutableMapping[str, Any] = ..., ) -> None: ... - def remove(self, *objs: Union[QuerySet[_T], _T]) -> None: ... + def remove(self, *objs: Union[QuerySet[_T], _T, _V]) -> None: ... def set( self, objs: Union[QuerySet[_T], Iterable[_T]],