fifth iteration

This commit is contained in:
Maxim Kurnikov
2018-08-14 12:01:01 +03:00
parent 8cc446150c
commit a13d4c352a
124 changed files with 1455 additions and 5681 deletions

View File

@@ -1,5 +1,7 @@
from typing import Any, Callable, Dict, Optional, Tuple, Type, Union
from collections import OrderedDict
from typing import Any, Callable, Dict, List, Optional, Tuple, Type, Union
from django.contrib.flatpages.sitemaps import FlatPageSitemap
from django.contrib.sitemaps import Sitemap
from django.urls import include as include
from django.urls.resolvers import URLPattern, URLResolver
@@ -12,13 +14,18 @@ handler500: Any
def url(
regex: str,
view: Optional[
Union[Callable, Tuple[None, None, None], Tuple[str, str, str]]
Union[
Callable,
Tuple[List[Union[URLPattern, URLResolver]], str, str],
Tuple[Union[List[URLPattern], List[URLResolver]], None, None],
]
],
kwargs: Optional[
Union[
Dict[str, Dict[str, Type[FlatPageSitemap]]],
Dict[str, Dict[str, Sitemap]],
Dict[str, Union[Dict[str, Type[Sitemap]], str]],
Dict[str, Union[int, str]],
Dict[str, OrderedDict],
Dict[str, str],
]
] = ...,
name: Optional[str] = ...,

View File

@@ -48,7 +48,7 @@ class FieldListFilter(ListFilter):
title: Any = ...
def __init__(
self,
field: Union[Field, ForeignObjectRel],
field: Union[Field, reverse_related.ForeignObjectRel],
request: WSGIRequest,
params: Dict[str, str],
model: Type[Model],
@@ -63,21 +63,13 @@ class FieldListFilter(ListFilter):
def register(
cls,
test: Callable,
list_filter_class: Type[
Union[
AllValuesFieldListFilter,
BooleanFieldListFilter,
ChoicesFieldListFilter,
DateFieldListFilter,
RelatedFieldListFilter,
]
],
list_filter_class: Type[FieldListFilter],
take_priority: bool = ...,
) -> None: ...
@classmethod
def create(
cls,
field: Union[Field, ForeignObjectRel],
field: Union[Field, reverse_related.ForeignObjectRel],
request: WSGIRequest,
params: Dict[str, str],
model: Type[Model],
@@ -115,7 +107,7 @@ class RelatedFieldListFilter(FieldListFilter):
field: FieldCacheMixin,
request: WSGIRequest,
model_admin: ModelAdmin,
) -> List[Tuple[str, str]]: ...
) -> List[Tuple[Union[int, str], str]]: ...
def choices(self, changelist: Any) -> None: ...
class BooleanFieldListFilter(FieldListFilter):
@@ -209,4 +201,4 @@ class RelatedOnlyFieldListFilter(RelatedFieldListFilter):
used_parameters: Dict[Any, Any]
def field_choices(
self, field: RelatedField, request: WSGIRequest, model_admin: ModelAdmin
) -> List[Tuple[str, str]]: ...
) -> List[Tuple[Union[int, str], str]]: ...

View File

@@ -135,12 +135,7 @@ class InlineAdminFormSet:
def __iter__(self) -> Iterator[InlineAdminForm]: ...
def fields(
self
) -> Iterator[
Union[
Dict[str, Union[Dict[str, bool], bool, str]],
Dict[str, Union[bool, Widget, str]],
]
]: ...
) -> Iterator[Dict[str, Union[Dict[str, bool], bool, Widget, str]]]: ...
def inline_formset_data(self) -> str: ...
@property
def forms(self): ...

View File

@@ -3,7 +3,7 @@ from typing import Any, Callable, Dict, List, Optional, Set, Tuple, Type, Union
from django.contrib.admin.filters import SimpleListFilter
from django.contrib.admin.models import LogEntry
from django.contrib.admin.sites import AdminSite, DefaultAdminSite
from django.contrib.admin.sites import AdminSite
from django.contrib.admin.views.main import ChangeList
from django.contrib.auth.forms import AdminPasswordChangeForm
from django.contrib.contenttypes.models import ContentType
@@ -87,20 +87,9 @@ class BaseModelAdmin:
def get_fieldsets(
self, request: WSGIRequest, obj: Optional[Model] = ...
) -> Union[
List[
Tuple[
None,
Union[
Dict[str, List[Any]],
Dict[str, List[Union[Callable, str]]],
Dict[str, List[str]],
Dict[str, Tuple[str, str]],
],
]
],
Tuple[Tuple[None, Dict[str, Tuple[Tuple[str, str]]]]],
List[Tuple[None, Dict[str, List[Union[Callable, str]]]]],
Tuple[
Tuple[str, Dict[str, Tuple[str]]], Tuple[str, Dict[str, Tuple[str]]]
Tuple[Optional[str], Dict[str, Tuple[Union[Tuple[str, str], str]]]]
],
]: ...
def get_ordering(self, request: WSGIRequest) -> Union[List[str], Tuple]: ...
@@ -130,7 +119,12 @@ class BaseModelAdmin:
class ModelAdmin(BaseModelAdmin):
formfield_overrides: Dict[
Type[Any],
Type[
Union[
django.db.models.fields.DateTimeCheckMixin,
django.db.models.fields.Field,
]
],
Dict[
str,
Type[
@@ -173,9 +167,7 @@ class ModelAdmin(BaseModelAdmin):
opts: django.db.models.options.Options = ...
admin_site: django.contrib.admin.sites.AdminSite = ...
def __init__(
self,
model: Type[Model],
admin_site: Optional[Union[AdminSite, DefaultAdminSite]],
self, model: Type[Model], admin_site: Optional[AdminSite]
) -> None: ...
def get_inline_instances(
self, request: WSGIRequest, obj: Optional[Model] = ...

View File

@@ -17,10 +17,7 @@ DOT: str
def paginator_number(cl: ChangeList, i: int) -> SafeText: ...
def pagination(
cl: ChangeList
) -> Union[
Dict[str, Union[List[Union[int, str]], ChangeList, int, str]],
Dict[str, Union[ChangeList, int, range, str]],
]: ...
) -> Dict[str, Union[List[Union[int, str]], ChangeList, int, range, str]]: ...
def pagination_tag(parser: Parser, token: Token) -> InclusionAdminNode: ...
def result_headers(
cl: ChangeList

View File

@@ -1,19 +1,20 @@
from datetime import date, datetime
from datetime import datetime
from typing import Any, Callable, Dict, List, Optional, Set, Tuple, Type, Union
from uuid import UUID
from django.contrib.admin.options import BaseModelAdmin
from django.contrib.admin.sites import AdminSite
from django.contrib.auth.forms import AdminPasswordChangeForm
from django.contrib.contenttypes.fields import GenericForeignKey
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
from django.db.models.fields.mixins import FieldCacheMixin
from django.db.models.fields.reverse_related import ManyToOneRel, OneToOneRel
from django.db.models.fields.reverse_related import (ForeignObjectRel,
ManyToOneRel, OneToOneRel)
from django.db.models.options import Options
from django.db.models.query import QuerySet
from django.utils.safestring import SafeText
class FieldIsAForeignKeyColumnName(Exception): ...
@@ -34,30 +35,9 @@ def flatten(
) -> List[Union[Callable, str]]: ...
def flatten_fieldsets(
fieldsets: Union[
List[
Tuple[
None,
Union[
Dict[str, List[Any]],
Dict[str, List[Union[Callable, str]]],
Dict[str, List[str]],
Dict[str, Tuple[str, str]],
],
]
],
List[Tuple[str, Dict[str, Tuple[str]]]],
List[Tuple[Optional[str], Dict[str, Tuple[str]]]],
Tuple[
Union[
Tuple[Dict[str, Tuple[str]], Dict[str, Tuple[str]]],
Tuple[
None,
Union[
Dict[str, Tuple[Tuple[str, str]]],
Dict[str, Tuple[str, str, List[str]]],
Dict[str, Tuple[str, str, Tuple[str, str]]],
],
],
]
Tuple[Optional[str], Dict[str, Tuple[Union[Tuple[str, str], str]]]]
],
]
) -> List[Union[Callable, str]]: ...
@@ -88,10 +68,7 @@ class NestedObjects(Collector):
) -> QuerySet: ...
def nested(
self, format_callback: Callable = ...
) -> Union[
List[Union[List[Union[List[int], int]], int]],
List[Union[List[Union[List[str], str]], str]],
]: ...
) -> Union[List[SafeText], List[int]]: ...
def can_fast_delete(self, *args: Any, **kwargs: Any) -> bool: ...
def model_format_dict(obj: Any): ...
@@ -100,27 +77,18 @@ def model_ngettext(
) -> str: ...
def lookup_field(
name: Union[Callable, str], obj: Model, model_admin: BaseModelAdmin = ...
) -> Union[
Tuple[None, Callable, Optional[Callable]],
Tuple[None, Union[date, Model, int, str], Union[date, Model, int, str]],
Tuple[Field, None, Any],
]: ...
) -> Tuple[Optional[Field], Callable, Callable]: ...
def label_for_field(
name: Union[Callable, str],
model: Type[Model],
model_admin: Optional[BaseModelAdmin] = ...,
return_attr: bool = ...,
) -> Union[
Tuple[
Optional[Union[Callable, GenericForeignKey]],
Optional[Union[Callable, GenericForeignKey]],
],
Tuple[str, Type[str]],
str,
]: ...
) -> 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: Union[Field, OneToOneRel], empty_value_display: str
value: Any,
field: Union[Field, reverse_related.OneToOneRel],
empty_value_display: str,
) -> str: ...
def display_for_value(
value: Any, empty_value_display: str, boolean: bool = ...
@@ -129,14 +97,14 @@ def display_for_value(
class NotRelationField(Exception): ...
def get_model_from_relation(
field: Union[Field, mixins.FieldCacheMixin]
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[Union[Field, mixins.FieldCacheMixin]]: ...
) -> List[Union[Field, FieldCacheMixin]]: ...
def construct_change_message(
form: AdminPasswordChangeForm, formsets: None, add: bool
) -> List[Dict[str, Dict[str, List[str]]]]: ...

View File

@@ -64,12 +64,10 @@ class ChangeList:
def get_filters_params(self, params: None = ...) -> Dict[str, str]: ...
def get_filters(
self, request: WSGIRequest
) -> Tuple[List[ListFilter], bool, bool, bool]: ...
) -> Tuple[List[ListFilter], bool, Dict[str, Union[bool, str]], bool]: ...
def get_query_string(
self,
new_params: Optional[
Union[Dict[str, None], Dict[str, Union[int, str]]]
] = ...,
new_params: Optional[Dict[str, None]] = ...,
remove: Optional[List[str]] = ...,
) -> str: ...
result_count: Any = ...

View File

@@ -1,10 +1,10 @@
from collections import OrderedDict
from datetime import datetime
from typing import Any, Callable, Dict, List, Optional, Tuple, Union
from typing import Any, Callable, Dict, List, Optional, Set, Tuple, Union
from uuid import UUID
from django import forms
from django.contrib.admin.sites import AdminSite, DefaultAdminSite
from django.contrib.admin.sites import AdminSite
from django.db.models.fields.reverse_related import ForeignObjectRel
from django.db.models.query_utils import Q
from django.forms.fields import Field
@@ -30,9 +30,9 @@ class FilteredSelectMultiple(forms.SelectMultiple):
name: str,
value: Union[List[Any], str],
attrs: Optional[Dict[str, str]],
) -> Union[
Dict[
str,
) -> Dict[
str,
Union[
Dict[
str,
Union[
@@ -48,9 +48,6 @@ class FilteredSelectMultiple(forms.SelectMultiple):
str,
],
],
],
Dict[
str,
Dict[str, Union[Dict[str, Union[int, str]], List[str], bool, str]],
],
]: ...
@@ -87,106 +84,30 @@ class AdminSplitDateTime(forms.SplitDateTimeWidget):
name: str,
value: Optional[Union[List[str], datetime]],
attrs: Optional[Dict[str, Union[bool, str]]],
) -> Union[
Dict[
str,
Union[
Dict[
str,
Optional[
Union[
Dict[str, Union[bool, str]],
List[
Dict[
str,
Optional[
Union[
Dict[str, Union[bool, str]],
bool,
str,
]
],
]
],
bool,
str,
]
],
],
) -> Dict[
str,
Union[
Dict[
str,
],
],
Dict[
str,
Union[
Dict[
str,
Optional[
Union[
Dict[str, str],
List[
Dict[
str,
Optional[Union[Dict[str, str], bool, str]],
]
],
bool,
str,
]
],
],
str,
],
],
Dict[
str,
Union[
Dict[
str,
Union[
Dict[Any, Any],
List[Dict[str, Union[Dict[str, str], bool, str]]],
bool,
str,
],
],
str,
],
],
Dict[
str,
Union[
Dict[
str,
Optional[
Union[
Dict[str, Union[bool, str]],
List[
Dict[
str,
Union[Dict[str, Union[bool, str]], bool, str],
Optional[
Union[
Dict[str, Union[bool, str]], bool, str
]
],
]
],
bool,
str,
],
]
],
str,
],
],
Dict[
str,
Union[
Dict[
str,
Union[
Dict[str, str],
List[Dict[str, Union[Dict[str, str], bool, str]]],
bool,
str,
],
],
str,
],
],
]: ...
@@ -203,7 +124,8 @@ def url_params_from_lookup_dict(
Dict[str, Callable],
Dict[str, List[str]],
Dict[str, Tuple[str, str]],
Dict[str, Union[int, str]],
Dict[str, bool],
Dict[str, str],
Q,
]
) -> Dict[str, str]: ...
@@ -217,7 +139,7 @@ class ForeignKeyRawIdWidget(forms.TextInput):
def __init__(
self,
rel: ForeignObjectRel,
admin_site: Union[AdminSite, DefaultAdminSite],
admin_site: AdminSite,
attrs: None = ...,
using: None = ...,
) -> None: ...
@@ -226,18 +148,12 @@ class ForeignKeyRawIdWidget(forms.TextInput):
name: str,
value: Optional[Union[List[int], int, str, UUID]],
attrs: Optional[Dict[str, Union[bool, str]]],
) -> Union[
Dict[
) -> Dict[
str,
Union[
Dict[str, Optional[Union[Dict[str, Union[bool, str]], bool, str]]],
str,
Union[
Dict[
str, Optional[Union[Dict[str, Union[bool, str]], bool, str]]
],
str,
],
],
Dict[str, Union[Dict[str, Union[Dict[Any, Any], bool, str]], str]],
Dict[str, Union[Dict[str, Union[Dict[str, str], bool, str]], str]],
]: ...
def base_url_parameters(self) -> Dict[str, str]: ...
def url_parameters(self) -> Dict[str, str]: ...
@@ -256,10 +172,7 @@ class ManyToManyRawIdWidget(ForeignKeyRawIdWidget):
name: str,
value: Optional[List[int]],
attrs: Optional[Dict[str, str]],
) -> Union[
Dict[str, Union[Dict[str, Union[Dict[Any, Any], bool, str]], str]],
Dict[str, Union[Dict[str, Union[Dict[str, str], bool, str]], str]],
]: ...
) -> Dict[str, Union[Dict[str, Union[Dict[str, str], bool, str]], str]]: ...
def url_parameters(self) -> Dict[Any, Any]: ...
def label_and_url_for_value(self, value: List[int]) -> Tuple[str, str]: ...
def value_from_datadict(
@@ -283,7 +196,7 @@ class RelatedFieldWidgetWrapper(forms.Widget):
self,
widget: ChoiceWidget,
rel: ForeignObjectRel,
admin_site: Union[AdminSite, DefaultAdminSite],
admin_site: AdminSite,
can_add_related: Optional[bool] = ...,
can_change_related: bool = ...,
can_delete_related: bool = ...,
@@ -362,7 +275,7 @@ class AutocompleteMixin:
def __init__(
self,
rel: ForeignObjectRel,
admin_site: Union[AdminSite, DefaultAdminSite],
admin_site: AdminSite,
attrs: Optional[Dict[str, str]] = ...,
choices: Tuple = ...,
using: None = ...,
@@ -378,7 +291,13 @@ class AutocompleteMixin:
name: str,
value: List[str],
attr: Dict[str, Union[bool, str]] = ...,
) -> List[Tuple[None, int, int]]: ...
) -> List[
Tuple[
None,
List[Dict[str, Union[Dict[str, bool], Set[str], int, str]]],
int,
]
]: ...
@property
def media(self) -> Media: ...

View File

@@ -14,7 +14,12 @@ sensitive_post_parameters_m: Any
class GroupAdmin(admin.ModelAdmin):
admin_site: django.contrib.admin.sites.AdminSite
formfield_overrides: Dict[
Type[Any],
Type[
Union[
django.db.models.fields.DateTimeCheckMixin,
django.db.models.fields.Field,
]
],
Dict[
str,
Type[
@@ -40,7 +45,12 @@ class GroupAdmin(admin.ModelAdmin):
class UserAdmin(admin.ModelAdmin):
admin_site: django.contrib.admin.sites.AdminSite
formfield_overrides: Dict[
Type[Any],
Type[
Union[
django.db.models.fields.DateTimeCheckMixin,
django.db.models.fields.Field,
]
],
Dict[
str,
Type[

View File

@@ -22,7 +22,4 @@ class PermWrapper:
def auth(
request: HttpRequest
) -> Union[
Dict[str, Union[PermWrapper, AnonymousUser]],
Dict[str, Union[PermWrapper, User]],
]: ...
) -> Dict[str, Union[PermWrapper, AnonymousUser, User]]: ...

View File

@@ -14,20 +14,11 @@ class ReadOnlyPasswordHashWidget(forms.Widget):
template_name: str = ...
def get_context(
self, name: str, value: Optional[str], attrs: Dict[str, str]
) -> Union[
Dict[
str,
Union[
Dict[str, Optional[Union[Dict[Any, Any], bool, str]]],
List[Dict[str, str]],
],
],
Dict[
str,
Union[
Dict[str, Optional[Union[Dict[str, str], bool, str]]],
List[Dict[str, str]],
],
) -> Dict[
str,
Union[
Dict[str, Optional[Union[Dict[str, str], bool, str]]],
List[Dict[str, str]],
],
]: ...

View File

@@ -6,16 +6,12 @@ from django.contrib.auth.models import User
def get_default_password_validators() -> Union[
List[Union[CommonPasswordValidator, MinimumLengthValidator]],
List[Union[MinimumLengthValidator, UserAttributeSimilarityValidator]],
List[NumericPasswordValidator],
List[NumericPasswordValidator], List[UserAttributeSimilarityValidator]
]: ...
def get_password_validators(
validator_config: List[Dict[str, Union[Dict[str, int], str]]]
) -> Union[
List[Union[CommonPasswordValidator, MinimumLengthValidator]],
List[Union[MinimumLengthValidator, UserAttributeSimilarityValidator]],
List[NumericPasswordValidator],
List[NumericPasswordValidator], List[UserAttributeSimilarityValidator]
]: ...
def validate_password(
password: str,

View File

@@ -10,6 +10,7 @@ from django.core.handlers.wsgi import WSGIRequest
from django.http.request import HttpRequest
from django.http.response import HttpResponse, HttpResponseRedirect
from django.template.response import TemplateResponse
from django.utils.datastructures import MultiValueDict
from django.views.generic.base import TemplateView
from django.views.generic.edit import FormView
@@ -34,13 +35,14 @@ class LoginView(SuccessURLAllowedHostsMixin, FormView):
def get_form_class(self) -> Type[AuthenticationForm]: ...
def get_form_kwargs(
self
) -> Dict[str, Optional[Union[Dict[str, str], HttpRequest]]]: ...
) -> Dict[
str, Optional[Union[Dict[str, str], HttpRequest, MultiValueDict]]
]: ...
def form_valid(self, form: AuthenticationForm) -> HttpResponseRedirect: ...
def get_context_data(
self, **kwargs: Any
) -> Union[
Dict[str, Union[AuthenticationForm, LoginView, Site, str]],
Dict[str, Union[AuthenticationForm, LoginView, RequestSite, str]],
) -> Dict[
str, Union[AuthenticationForm, LoginView, Site, RequestSite, str]
]: ...
class LogoutView(SuccessURLAllowedHostsMixin, TemplateView):
@@ -105,7 +107,9 @@ class PasswordResetConfirmView(PasswordContextMixin, FormView):
def get_user(self, uidb64: str) -> Optional[AbstractBaseUser]: ...
def get_form_kwargs(
self
) -> Dict[str, Optional[Union[Dict[Any, Any], AbstractBaseUser]]]: ...
) -> Dict[
str, Optional[Union[Dict[Any, Any], AbstractBaseUser, MultiValueDict]]
]: ...
def form_valid(self, form: SetPasswordForm) -> HttpResponseRedirect: ...
def get_context_data(self, **kwargs: Any): ...
@@ -122,7 +126,7 @@ class PasswordChangeView(PasswordContextMixin, FormView):
def dispatch(self, *args: Any, **kwargs: Any) -> HttpResponse: ...
def get_form_kwargs(
self
) -> Dict[str, Optional[Union[Dict[Any, Any], User]]]: ...
) -> Dict[str, Optional[Union[Dict[Any, Any], User, MultiValueDict]]]: ...
def form_valid(self, form: PasswordChangeForm) -> HttpResponseRedirect: ...
class PasswordChangeDoneView(PasswordContextMixin, TemplateView):

View File

@@ -42,9 +42,7 @@ class GenericForeignKey(FieldCacheMixin):
) -> None: ...
def get_filter_kwargs_for_object(
self, obj: Model
) -> Union[
Dict[str, Optional[ContentType]], Dict[str, Union[ContentType, int]]
]: ...
) -> Dict[str, Optional[ContentType]]: ...
def get_forward_related_filter(self, obj: Model) -> Dict[str, int]: ...
def check(self, **kwargs: Any) -> List[Error]: ...
def get_cache_name(self) -> str: ...

View File

@@ -6,7 +6,4 @@ from django.http.request import HttpRequest
def messages(
request: HttpRequest
) -> Union[
Dict[str, Union[Dict[str, int], List[Any]]],
Dict[str, Union[Dict[str, int], BaseStorage]],
]: ...
) -> Dict[str, Union[Dict[str, int], List[Any], BaseStorage]]: ...

View File

@@ -32,25 +32,7 @@ class MessageDecoder(json.JSONDecoder):
List[Union[int, str]],
],
],
List[
Union[
Dict[
str,
Union[
List[
Union[
Dict[str, List[Union[int, str]]],
List[Union[int, str]],
]
],
List[Union[int, str]],
],
],
List[Union[int, str]],
]
],
List[Union[List[Union[int, str]], str]],
List[Union[int, str]],
str,
],
) -> Union[

View File

@@ -1,7 +1,6 @@
from typing import Any, Dict, List, Optional, Tuple, Union
from django.contrib.postgres import lookups
from django.contrib.postgres.fields.mixins import CheckFieldDefaultMixin
from django.db.models import Field, Transform
from django.db.models.fields import Field
from django.db.models.lookups import Exact, In
@@ -17,10 +16,7 @@ class ArrayField(CheckFieldDefaultMixin, Field):
default_validators: Any = ...
from_db_value: Any = ...
def __init__(
self,
base_field: Union[CheckFieldDefaultMixin, Field],
size: None = ...,
**kwargs: Any
self, base_field: Field, size: None = ..., **kwargs: Any
) -> None: ...
@property
def model(self): ...

View File

@@ -1,4 +1,4 @@
from datetime import datetime, timedelta
from datetime import datetime
from typing import Any, Dict, Optional, Union
from django.db.models.base import Model
@@ -29,21 +29,8 @@ class SessionBase:
def set_test_cookie(self) -> None: ...
def test_cookie_worked(self) -> bool: ...
def delete_test_cookie(self) -> None: ...
def encode(
self,
session_dict: Union[
Dict[str, Union[datetime, str]],
Dict[str, Union[int, str]],
Dict[str, Model],
],
) -> str: ...
def decode(
self, session_data: Union[bytes, str]
) -> Union[
Dict[str, Union[datetime, str]],
Dict[str, Union[int, str]],
Dict[str, Model],
]: ...
def encode(self, session_dict: Dict[str, Model]) -> str: ...
def decode(self, session_data: Union[bytes, str]) -> Dict[str, Model]: ...
def update(self, dict_: Dict[str, int]) -> None: ...
def has_key(self, key: Any): ...
def keys(self): ...
@@ -54,9 +41,7 @@ class SessionBase:
session_key: Any = ...
def get_expiry_age(self, **kwargs: Any) -> int: ...
def get_expiry_date(self, **kwargs: Any) -> datetime: ...
def set_expiry(
self, value: Optional[Union[datetime, timedelta, int]]
) -> None: ...
def set_expiry(self, value: Optional[Union[datetime, int]]) -> None: ...
def get_expire_at_browser_close(self) -> bool: ...
def flush(self) -> None: ...
def cycle_key(self) -> None: ...

View File

@@ -1,4 +1,3 @@
from datetime import datetime
from typing import Any, Dict, Optional, Type, Union
from django.contrib.sessions.backends.base import SessionBase
@@ -14,19 +13,12 @@ class SessionStore(SessionBase):
@classmethod
def get_model_class(cls) -> Type[Session]: ...
def model(self) -> Type[AbstractBaseSession]: ...
def load(
self
) -> Union[Dict[str, Model], Dict[str, int], Dict[str, str]]: ...
def load(self) -> Dict[str, Union[Model, int, str]]: ...
def exists(self, session_key: Optional[str]) -> bool: ...
modified: bool = ...
def create(self) -> None: ...
def create_model_instance(
self,
data: Union[
Dict[str, Union[datetime, str]],
Dict[str, Union[int, str]],
Dict[str, Model],
],
self, data: Dict[str, Model]
) -> AbstractBaseSession: ...
def save(self, must_create: bool = ...) -> None: ...
def delete(self, session_key: Optional[str] = ...) -> None: ...

View File

@@ -1,16 +1,11 @@
from datetime import datetime
from typing import Any, Dict, Optional, Union
from typing import Any, Dict, Optional
from django.core.signing import JSONSerializer as BaseJSONSerializer
from django.db.models.base import Model
class PickleSerializer:
def dumps(
self, obj: Union[Dict[str, Union[datetime, str]], Dict[str, Model]]
) -> bytes: ...
def loads(
self, data: bytes
) -> Union[Dict[str, Union[datetime, str]], Dict[str, Model]]: ...
def dumps(self, obj: Dict[str, Model]) -> bytes: ...
def loads(self, data: bytes) -> Dict[str, Model]: ...
JSONSerializer = BaseJSONSerializer

View File

@@ -35,10 +35,7 @@ class GenericSitemap(Sitemap):
protocol: None = ...
def __init__(
self,
info_dict: Union[
Dict[str, Union[datetime, QuerySet]],
Dict[str, Union[QuerySet, str]],
],
info_dict: Dict[str, Union[datetime, QuerySet, str]],
priority: Optional[float] = ...,
changefreq: Optional[str] = ...,
protocol: Optional[str] = ...,

View File

@@ -1,3 +1,4 @@
from collections import OrderedDict
from typing import Any, Callable, Dict, Optional, Type, Union
from django.contrib.sitemaps import GenericSitemap, Sitemap
@@ -8,14 +9,16 @@ from django.template.response import TemplateResponse
def x_robots_tag(func: Callable) -> Callable: ...
def index(
request: WSGIRequest,
sitemaps: Union[Dict[str, Type[Sitemap]], Dict[str, Sitemap]],
sitemaps: Dict[str, Union[Type[Sitemap], Sitemap]],
template_name: str = ...,
content_type: str = ...,
sitemap_url_name: str = ...,
) -> TemplateResponse: ...
def sitemap(
request: WSGIRequest,
sitemaps: Union[Dict[str, Type[Sitemap]], Dict[str, GenericSitemap]],
sitemaps: Union[
Dict[str, Type[Sitemap]], Dict[str, GenericSitemap], OrderedDict
],
section: Optional[str] = ...,
template_name: str = ...,
content_type: str = ...,

View File

@@ -1,6 +1,6 @@
from typing import Any, Dict, List, Optional, Union
from typing import Any, Dict, List, Optional
from django.core.files.storage import DefaultStorage, FileSystemStorage
from django.core.files.storage import FileSystemStorage
from django.core.management.base import BaseCommand, CommandParser
@@ -32,20 +32,11 @@ class Command(BaseCommand):
def is_local_storage(self) -> bool: ...
def clear_dir(self, path: str) -> None: ...
def delete_file(
self,
path: str,
prefixed_path: str,
source_storage: Union[DefaultStorage, FileSystemStorage],
self, path: str, prefixed_path: str, source_storage: FileSystemStorage
) -> bool: ...
def link_file(
self,
path: str,
prefixed_path: str,
source_storage: Union[DefaultStorage, FileSystemStorage],
self, path: str, prefixed_path: str, source_storage: FileSystemStorage
) -> None: ...
def copy_file(
self,
path: str,
prefixed_path: str,
source_storage: Union[DefaultStorage, FileSystemStorage],
self, path: str, prefixed_path: str, source_storage: FileSystemStorage
) -> None: ...

View File

@@ -1,14 +1,14 @@
from collections import OrderedDict
from typing import Any, Iterator, List, Optional, Tuple, Union
from django.core.files.storage import DefaultStorage, FileSystemStorage
from django.core.files.storage import FileSystemStorage
def matches_patterns(
path: str, patterns: Union[List[str], Tuple[str], OrderedDict] = ...
) -> bool: ...
def get_files(
storage: Union[DefaultStorage, FileSystemStorage],
storage: FileSystemStorage,
ignore_patterns: List[str] = ...,
location: str = ...,
) -> Iterator[str]: ...

View File

@@ -1,3 +1,4 @@
from collections import OrderedDict
from typing import Any, Callable, Dict, Optional, Union
from django.core.cache.backends.base import BaseCache as BaseCache
@@ -15,7 +16,7 @@ class CacheHandler:
class DefaultCacheProxy:
def __getattr__(
self, name: str
) -> Union[Callable, Dict[str, float], int]: ...
) -> 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: ...

View File

@@ -1,3 +1,4 @@
from collections import OrderedDict
from typing import Any, Callable, Dict, List, Optional, Union
from django.core.exceptions import ImproperlyConfigured
@@ -21,13 +22,7 @@ class BaseCache:
key_func: Callable = ...
def __init__(
self,
params: Union[
Dict[str, Callable],
Dict[str, Dict[str, int]],
Dict[str, None],
Dict[str, int],
Dict[str, str],
],
params: Dict[str, Optional[Union[Callable, Dict[str, int], int, str]]],
) -> None: ...
def get_backend_timeout(self, timeout: Any = ...) -> Optional[float]: ...
def make_key(
@@ -59,7 +54,7 @@ class BaseCache:
def delete(self, key: Any, version: Optional[Any] = ...) -> None: ...
def get_many(
self, keys: List[str], version: Optional[int] = ...
) -> Union[Dict[str, int], Dict[str, str]]: ...
) -> Dict[str, Union[int, str]]: ...
def get_or_set(
self,
key: str,
@@ -78,9 +73,7 @@ class BaseCache:
def set_many(
self,
data: Union[
Dict[str, Union[Dict[str, int], str]],
Dict[str, bytes],
Dict[str, int],
Dict[str, bytes], Dict[str, int], Dict[str, str], OrderedDict
],
timeout: Any = ...,
version: Optional[Union[int, str]] = ...,

View File

@@ -25,12 +25,7 @@ class BaseDatabaseCache(BaseCache):
def __init__(
self,
table: str,
params: Union[
Dict[str, Callable],
Dict[str, Dict[str, int]],
Dict[str, int],
Dict[str, str],
],
params: Dict[str, Union[Callable, Dict[str, int], int, str]],
) -> None: ...
class DatabaseCache(BaseDatabaseCache):

View File

@@ -12,12 +12,7 @@ class FileBasedCache(BaseCache):
def __init__(
self,
dir: str,
params: Union[
Dict[str, Callable],
Dict[str, Dict[str, int]],
Dict[str, int],
Dict[str, str],
],
params: Dict[str, Union[Callable, Dict[str, int], int, str]],
) -> None: ...
def add(
self,

View File

@@ -1,4 +1,3 @@
from datetime import datetime
from typing import Any, Callable, Dict, Optional, Union
from django.core.cache.backends.base import BaseCache
@@ -12,20 +11,12 @@ class LocMemCache(BaseCache):
def __init__(
self,
name: str,
params: Union[
Dict[str, Callable],
Dict[str, Dict[str, int]],
Dict[str, None],
Dict[str, int],
Dict[str, str],
],
params: Dict[str, Optional[Union[Callable, Dict[str, int], int, str]]],
) -> None: ...
def add(
self,
key: str,
value: Union[
Dict[str, Union[datetime, str]], Dict[str, int], bytes, int, str
],
value: Union[Dict[str, int], Dict[str, str], bytes, int, str],
timeout: Any = ...,
version: Optional[int] = ...,
) -> Any: ...

View File

@@ -1,6 +1,7 @@
from typing import Any, Dict, Iterator, List, Optional, Tuple, Type, Union
from django.db.models.base import Model
from django.forms.utils import ErrorDict, ErrorList
class FieldDoesNotExist(Exception): ...
@@ -35,9 +36,10 @@ class ValidationError(Exception):
self,
message: Union[
Dict[str, List[ValidationError]],
Dict[str, Union[List[str], str]],
Dict[str, ErrorList],
List[Union[ValidationError, str]],
ValidationError,
ErrorList,
str,
],
code: Optional[str] = ...,
@@ -53,8 +55,8 @@ class ValidationError(Exception):
@property
def messages(self) -> List[str]: ...
def update_error_dict(
self, error_dict: Dict[str, List[ValidationError]]
) -> Dict[str, List[ValidationError]]: ...
self, error_dict: Union[Dict[str, List[ValidationError]], ErrorDict]
) -> Union[Dict[str, List[ValidationError]], ErrorDict]: ...
def __iter__(self) -> Iterator[Union[Tuple[str, List[str]], str]]: ...
class EmptyResultSet(Exception): ...

View File

@@ -26,13 +26,7 @@ class Command(BaseCommand):
def get_meta(
self,
table_name: str,
constraints: Dict[
str,
Union[
Dict[str, Union[List[str], Tuple[str, str], bool]],
Dict[str, Union[List[str], bool, str]],
],
],
constraints: Dict[str, Dict[str, Union[List[str], bool]]],
column_to_field_name: Dict[str, str],
is_view: bool,
) -> List[str]: ...

View File

@@ -29,7 +29,7 @@ class Command(BaseCommand):
def load_label(self, fixture_label: str) -> None: ...
def find_fixtures(
self, fixture_label: str
) -> List[Tuple[str, str, str]]: ...
) -> List[Tuple[str, Optional[str], str]]: ...
def fixture_dirs(self) -> List[str]: ...
def parse_name(
self, fixture_name: str

View File

@@ -3,8 +3,8 @@ from typing import (Any, Callable, Dict, Iterator, List, Optional, Tuple, Type,
Union)
from django.apps.config import AppConfig
from django.core.serializers.python import Serializer
from django.core.serializers.xml_serializer import Deserializer, Serializer
from django.core.serializers.base import Serializer
from django.core.serializers.xml_serializer import Deserializer
from django.db.models.base import Model
from django.db.models.query import QuerySet
@@ -22,11 +22,7 @@ def register_serializer(
serializers: Optional[Dict[str, Any]] = ...,
) -> None: ...
def unregister_serializer(format: str) -> None: ...
def get_serializer(
format: str
) -> Union[
Type[Union[python.Serializer, xml_serializer.Serializer]], BadSerializer
]: ...
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]]: ...

View File

@@ -1,6 +1,5 @@
from collections import OrderedDict
from datetime import date, datetime, time, timedelta
from decimal import Decimal
from datetime import date
from io import BufferedReader, StringIO, TextIOWrapper
from typing import Any, Dict, Iterator, List, Optional, Tuple, Type, Union
from uuid import UUID
@@ -96,23 +95,12 @@ class DeserializedObject:
def build_instance(
Model: Type[Model],
data: Union[
Dict[str, Optional[Union[int, str]]],
Dict[str, Optional[datetime]],
Dict[str, Optional[timedelta]],
Dict[str, Optional[UUID]],
Dict[str, Union[date, int, str]],
Dict[str, Union[time, int]],
Dict[str, Union[Decimal, int, str]],
Dict[str, Union[float, str]],
Dict[str, Union[int, memoryview]],
Dict[str, Union[int, UUID]],
],
data: Dict[str, Optional[Union[date, int, str, UUID]]],
db: str,
) -> Model: ...
def deserialize_m2m_values(
field: ManyToManyField,
field_value: Union[List[List[str]], List[Union[int, str]]],
field_value: Union[List[List[str]], List[int]],
using: str,
) -> List[int]: ...
def deserialize_fk_value(

View File

@@ -1,5 +1,5 @@
import json
from datetime import date, time, timedelta
from datetime import datetime
from decimal import Decimal
from typing import Any, Optional, Union
from uuid import UUID
@@ -32,6 +32,4 @@ class DjangoJSONEncoder(json.JSONEncoder):
indent: None
skipkeys: bool
sort_keys: bool
def default(
self, o: Union[date, time, timedelta, Decimal, UUID]
) -> str: ...
def default(self, o: Union[datetime, Decimal, UUID]) -> str: ...

View File

@@ -1,5 +1,4 @@
from collections import OrderedDict
from datetime import date
from typing import Any, Dict, Iterator, List, Optional, Union
from django.core.serializers import base
@@ -29,77 +28,9 @@ class Serializer(base.Serializer):
def Deserializer(
object_list: Union[
List[Dict[str, Optional[Union[Dict[str, None], str]]]],
List[Dict[str, Optional[Union[Dict[str, Union[float, str]], str]]]],
List[
Dict[
str,
Union[Dict[str, Union[List[List[str]], int, str]], int, str],
]
],
List[
Dict[
str,
Union[
Dict[str, Union[List[Union[int, str]], int, str]], int, str
],
]
],
List[
Dict[
str,
Union[Dict[str, Union[List[int], date, int, str]], int, str],
]
],
List[
Union[
Dict[str, Optional[Union[Dict[str, Optional[str]], str]]],
Dict[
str,
Union[
Dict[str, Union[List[List[str]], List[str], str]],
int,
str,
],
],
]
],
List[
Union[
Dict[str, Union[Dict[Any, Any], date, str]],
Dict[str, Union[Dict[Any, Any], float, str]],
Dict[str, Union[Dict[str, List[int]], int, str]],
Dict[str, Union[Dict[str, None], int, str]],
Dict[str, Union[Dict[str, Union[int, str]], int, str]],
Dict[str, Union[Dict[str, date], int, str]],
Dict[str, Union[Dict[str, float], int, str]],
]
],
List[
Union[
Dict[str, Union[Dict[str, List[str]], int, str]],
Dict[str, Union[Dict[str, Optional[str]], int, str]],
]
],
List[
Union[
Dict[str, Union[Dict[str, Union[List[Any], str]], int, str]],
Dict[
str,
Union[
Dict[str, Union[List[List[str]], bool, str]], int, str
],
],
]
],
List[
Union[
Dict[str, Union[Dict[str, Union[List[Any], str]], int, str]],
Dict[
str, Union[Dict[str, Union[List[int], bool, str]], int, str]
],
]
],
List[Dict[str, Optional[Union[Dict[str, Optional[str]], str]]]],
List[Dict[str, Union[Dict[str, Union[List[int], int, str]], int, str]]],
List[OrderedDict],
],
*,
using: Any = ...,

View File

@@ -1,4 +1,4 @@
from typing import Any, Callable, Dict, Iterator, List, Optional, Union
from typing import Any, Callable, Dict, Iterator, List, Optional
from django.db.backends.sqlite3.base import (DatabaseWrapper,
SQLiteCursorWrapper)
@@ -48,9 +48,7 @@ class BaseDatabaseWrapper:
validation: Any = ...
def __init__(
self,
settings_dict: Dict[
str, Optional[Union[Dict[str, Optional[str]], int, str]]
],
settings_dict: Dict[str, Dict[str, str]],
alias: str = ...,
allow_thread_sharing: bool = ...,
) -> None: ...

View File

@@ -1,4 +1,4 @@
from datetime import date, datetime, time, timedelta
from datetime import date, datetime, timedelta
from decimal import Decimal
from typing import Any, List, Optional, Set, Tuple, Type, Union
@@ -27,10 +27,7 @@ class BaseDatabaseOperations:
explain_prefix: Any = ...
connection: django.db.DefaultConnectionProxy = ...
def __init__(
self,
connection: Union[
DefaultConnectionProxy, backends.base.base.BaseDatabaseWrapper
],
self, connection: Union[DefaultConnectionProxy, BaseDatabaseWrapper]
) -> None: ...
def autoinc_sql(self, table: str, column: str) -> None: ...
def bulk_batch_size(self, fields: Any, objs: Any): ...
@@ -111,12 +108,12 @@ class BaseDatabaseOperations:
prep_for_iexact_query: Any = ...
def validate_autopk_value(self, value: int) -> int: ...
def adapt_unknown_value(
self, value: Union[date, time, Decimal, int, str]
self, value: Union[datetime, Decimal, int, str]
) -> Union[int, str]: ...
def adapt_datefield_value(self, value: Optional[date]) -> Optional[str]: ...
def adapt_datetimefield_value(self, value: None) -> None: ...
def adapt_timefield_value(
self, value: Optional[Union[datetime, time]]
self, value: Optional[datetime]
) -> Optional[str]: ...
def adapt_decimalfield_value(
self,
@@ -145,18 +142,12 @@ class BaseDatabaseOperations:
def combine_duration_expression(
self, connector: Any, sub_expressions: Any
): ...
def binary_placeholder_sql(
self, value: Optional[Union[Case, memoryview]]
) -> str: ...
def binary_placeholder_sql(self, value: Optional[Case]) -> str: ...
def modify_insert_params(
self,
placeholder: str,
params: Union[
List[None], List[float], List[int], List[memoryview], List[str]
],
) -> Union[
List[None], List[float], List[int], List[memoryview], List[str]
]: ...
params: Union[List[None], List[bool], List[float], List[str]],
) -> Union[List[None], List[bool], List[float], List[str]]: ...
def integer_field_range(self, internal_type: Any): ...
def subtract_temporals(self, internal_type: Any, lhs: Any, rhs: Any): ...
def window_frame_start(self, start: Any): ...

View File

@@ -63,9 +63,7 @@ class BaseDatabaseSchemaEditor:
) -> Union[Tuple[None, None], Tuple[str, List[Any]]]: ...
def skip_default(self, field: Any): ...
def prepare_default(self, value: Any) -> None: ...
def effective_default(
self, field: Field
) -> Optional[Union[int, memoryview, str]]: ...
def effective_default(self, field: Field) -> 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: ...

View File

@@ -8,10 +8,11 @@ class DatabaseClient(BaseDatabaseClient):
@classmethod
def settings_to_cmd_args(
cls,
settings_dict: Union[
Dict[str, Optional[Union[Dict[Any, Any], str]]],
Dict[str, Union[Dict[str, Dict[str, str]], int, str]],
Dict[str, Union[Dict[str, Union[int, str]], int, str]],
settings_dict: Dict[
str,
Optional[
Union[Dict[Any, Any], Dict[str, Dict[str, str]], int, str]
],
],
) -> List[str]: ...
def runshell(self) -> None: ...

View File

@@ -76,12 +76,7 @@ class SQLiteCursorWrapper(Database.Cursor):
self,
query: str,
params: Optional[
Union[
List[Optional[Union[float, str]]],
List[Optional[Union[int, memoryview, str]]],
List[datetime],
Tuple,
]
Union[List[bool], List[datetime], List[float], Tuple]
] = ...,
) -> SQLiteCursorWrapper: ...
def executemany(

View File

@@ -39,10 +39,4 @@ class DatabaseIntrospection(BaseDatabaseIntrospection):
) -> Optional[str]: ...
def get_constraints(
self, cursor: CursorWrapper, table_name: str
) -> Dict[
str,
Union[
Dict[str, Union[List[str], Tuple[str, str], bool]],
Dict[str, Union[List[str], bool, str]],
],
]: ...
) -> Dict[str, Dict[str, Union[List[str], bool]]]: ...

View File

@@ -24,7 +24,9 @@ class DatabaseOperations(BaseDatabaseOperations):
fields: Union[List[Field], List[str], ImmutableList],
objs: Union[List[Model], range],
) -> int: ...
def check_expression_support(self, expression: BaseExpression) -> None: ...
def check_expression_support(
self, expression: Union[BaseExpression, SQLiteNumericMixin]
) -> None: ...
def date_extract_sql(self, lookup_type: str, field_name: str) -> str: ...
def date_interval_sql(self, timedelta: timedelta) -> str: ...
def format_for_duration_arithmetic(self, sql: str) -> str: ...
@@ -86,7 +88,7 @@ class DatabaseOperations(BaseDatabaseOperations):
connection: DatabaseWrapper,
) -> Optional[time]: ...
def get_decimalfield_converter(
self, expression: Union[Col, SQLiteNumericMixin]
self, expression: Expression
) -> Callable: ...
def convert_uuidfield_value(
self, value: Optional[str], expression: Col, connection: DatabaseWrapper

View File

@@ -18,9 +18,7 @@ class DatabaseSchemaEditor(BaseDatabaseSchemaEditor):
def __exit__(
self, exc_type: None, exc_value: None, traceback: None
) -> None: ...
def quote_value(
self, value: Optional[Union[int, memoryview, str]]
) -> str: ...
def quote_value(self, value: Optional[Union[int, str]]) -> str: ...
def alter_db_table(
self,
model: Type[Model],

View File

@@ -32,12 +32,7 @@ class CursorWrapper:
self,
sql: str,
params: Optional[
Union[
List[Optional[Union[float, str]]],
List[Optional[Union[int, memoryview, str]]],
List[datetime],
Tuple,
]
Union[List[bool], List[datetime], List[float], Tuple]
] = ...,
) -> Optional[SQLiteCursorWrapper]: ...
def executemany(

View File

@@ -31,31 +31,18 @@ class MigrationAutodetector:
def deep_deconstruct(self, obj: Any) -> Any: ...
def only_relation_agnostic_fields(
self, fields: List[Tuple[str, Field]]
) -> List[
Tuple[
str,
List[Any],
Union[
Dict[str, Callable],
Dict[str, Union[Callable, bool]],
Dict[str, Union[bool, str]],
Dict[str, Union[int, str]],
Dict[str, bool],
Dict[str, int],
],
]
]: ...
) -> List[Tuple[str, List[Any], Dict[str, Union[Callable, int, str]]]]: ...
def check_dependency(
self,
operation: Operation,
dependency: Tuple[str, str, Union[bool, str], Union[bool, str]],
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, Union[bool, str], Union[bool, str]]]
List[Tuple[str, str, Optional[str], Union[bool, str]]]
] = ...,
beginning: bool = ...,
) -> None: ...

View File

@@ -19,9 +19,7 @@ class MigrationExecutor:
def __init__(
self,
connection: Optional[
Union[
DefaultConnectionProxy, backends.base.base.BaseDatabaseWrapper
]
Union[DefaultConnectionProxy, BaseDatabaseWrapper]
],
progress_callback: Optional[Callable] = ...,
) -> None: ...
@@ -29,7 +27,7 @@ class MigrationExecutor:
self,
targets: Union[List[Tuple[str, Optional[str]]], Set[Tuple[str, str]]],
clean_start: bool = ...,
) -> List[Tuple[bool, bool]]: ...
) -> List[Tuple[Migration, bool]]: ...
def migrate(
self,
targets: Optional[List[Tuple[str, Optional[str]]]],

View File

@@ -21,15 +21,15 @@ class MigrationLoader:
def __init__(
self,
connection: Optional[
Union[
DefaultConnectionProxy, backends.base.base.BaseDatabaseWrapper
]
Union[DefaultConnectionProxy, BaseDatabaseWrapper]
],
load: bool = ...,
ignore_no_migrations: bool = ...,
) -> None: ...
@classmethod
def migrations_module(cls, app_label: str) -> Tuple[bool, bool]: ...
def migrations_module(
cls, app_label: str
) -> Tuple[Optional[str], bool]: ...
unmigrated_apps: Set[str] = ...
migrated_apps: Set[str] = ...
def load_disk(self) -> None: ...

View File

@@ -7,7 +7,9 @@ class Operation:
atomic: bool = ...
elidable: bool = ...
serialization_expand_args: Any = ...
def __new__(cls: Type[Any], *args: Any, **kwargs: Any) -> Operation: ...
def __new__(
cls: Type[Operation], *args: Any, **kwargs: Any
) -> Operation: ...
def deconstruct(self): ...
def state_forwards(self, app_label: Any, state: Any) -> None: ...
def database_forwards(

View File

@@ -1,10 +1,10 @@
from typing import Any, Dict, List, Optional, Set, Tuple, Type, Union
from django.contrib.auth.base_user import AbstractBaseUser
from django.contrib.postgres.fields.citext import CIText
from django.db.backends.sqlite3.schema import DatabaseSchemaEditor
from django.db.migrations.operations.base import Operation
from django.db.migrations.state import ProjectState
from django.db.models.base import Model
from django.db.models.fields import Field
from django.db.models.indexes import Index
from django.db.models.manager import Manager
@@ -39,12 +39,11 @@ class CreateModel(ModelOperation):
fields: List[Tuple[str, Union[CIText, Field]]],
options: Optional[
Union[
Dict[str, Union[List[Any], bool]],
Dict[str, Union[Set[Tuple[str, str]], Tuple[str], str]],
Dict[str, Union[bool, str]],
]
] = ...,
bases: Optional[Tuple[Union[Type[Model], str]]] = ...,
bases: Optional[Tuple[Type[AbstractBaseUser]]] = ...,
managers: Optional[List[Tuple[str, Manager]]] = ...,
) -> None: ...
def deconstruct(

View File

@@ -20,9 +20,7 @@ class MigrationRecorder:
def __init__(
self,
connection: Optional[
Union[
DefaultConnectionProxy, backends.base.base.BaseDatabaseWrapper
]
Union[DefaultConnectionProxy, BaseDatabaseWrapper]
],
) -> None: ...
@property

View File

@@ -27,24 +27,15 @@ class ModelState:
fields: List[Tuple[str, Union[CIText, Field]]],
options: Optional[
Union[
Dict[str, Optional[List[Index]]],
Dict[
str,
Union[
List[Tuple[str, str]],
Set[Tuple[str, str]],
Tuple[str],
str,
],
],
Dict[str, Union[List[Index], bool]],
Dict[str, Union[List[str], Set[Tuple[str, str]]]],
Dict[str, Union[List[str], Tuple, bool]],
Dict[str, Union[List[str], bool, str]],
Dict[str, Union[Set[Tuple[str, str]], bool]],
Dict[str, List[Index]],
Dict[str, List[str]],
Dict[str, Set[Tuple[str, str]]],
Dict[str, Tuple[str]],
Dict[str, bool],
Dict[str, str],
]
] = ...,
bases: Optional[Tuple[Union[Type[Model], str]]] = ...,
bases: Optional[Tuple[Type[Model]]] = ...,
managers: Optional[List[Tuple[str, Manager]]] = ...,
) -> None: ...
def clone(self) -> ModelState: ...

View File

@@ -40,9 +40,7 @@ class Aggregate(Func):
compiler: SQLCompiler,
connection: DatabaseWrapper,
**extra_context: Any
) -> Tuple[
str, Union[List[Union[int, str]], List[Decimal], List[float]]
]: ...
) -> Tuple[str, Union[List[Decimal], List[int]]]: ...
class Avg(Aggregate):
filter: None

View File

@@ -1,16 +1,11 @@
from datetime import date
from decimal import Decimal
from typing import Any, Callable, Dict, List, Optional, Set, Tuple, Type, Union
from typing import Any, Dict, List, Optional, Set, Tuple, Type, Union
from uuid import UUID
from django.contrib.auth.models import AbstractUser, PermissionsMixin
from django.contrib.contenttypes.fields import GenericForeignKey
from django.core.checks.messages import Warning
from django.core.exceptions import (MultipleObjectsReturned,
ObjectDoesNotExist, ValidationError)
from django.db.models.fields import CharField, Field
from django.core.exceptions import ValidationError
from django.db.models.fields.related import ForeignKey
from django.db.models.manager import Manager
class Deferred: ...
@@ -19,47 +14,17 @@ DEFERRED: Any
def subclass_exception(
name: str,
bases: Tuple[
Union[Type[MultipleObjectsReturned], Type[ObjectDoesNotExist]],
Type[Exception],
],
bases: Tuple[Type[Exception]],
module: str,
attached_to: Type[Model],
) -> Type[Union[MultipleObjectsReturned, ObjectDoesNotExist]]: ...
) -> Type[Exception]: ...
class ModelBase(type):
def __new__(
cls: Type[ModelBase],
name: str,
bases: Tuple[Type[Model]],
attrs: Union[
Dict[str, Any],
Dict[
str,
Union[
Callable,
Tuple[Tuple[int, str], Tuple[int, str]],
Field,
str,
],
],
Dict[str, Union[Callable, Type[Any], Field, Manager, str]],
Dict[str, Union[Callable, Type[PermissionsMixin.Meta], Field, str]],
Dict[str, Union[Callable, GenericForeignKey, Field, str]],
Dict[str, Union[Callable, Field, property, str]],
Dict[
str,
Union[
Tuple[
Tuple[str, Tuple[Tuple[str, str], Tuple[str, str]]],
Tuple[str, str],
],
CharField,
str,
],
],
Dict[str, Union[Type[AbstractUser.Meta], str]],
],
attrs: Dict[str, Any],
**kwargs: Any
) -> Type[Model]: ...
def add_to_class(cls, name: str, value: Any) -> None: ...
@@ -86,7 +51,6 @@ class Model:
List[Optional[UUID]],
List[Union[Decimal, int]],
List[Union[int, UUID]],
List[Union[str, UUID]],
Tuple[Union[int, str]],
],
) -> Model: ...

View File

@@ -1,19 +1,15 @@
from collections import OrderedDict
from datetime import date, datetime, time, timedelta
from decimal import Decimal
from datetime import datetime, timedelta
from typing import (Any, Callable, Dict, Iterator, List, Optional, Set, Tuple,
Type, Union)
from uuid import UUID
from django.db.backends.sqlite3.base import DatabaseWrapper
from django.db.models.aggregates import Aggregate, Count, Sum
from django.db.models.fields import (AutoField, BinaryField, BooleanField,
DateTimeField, DurationField, Field,
IntegerField, TimeField, UUIDField)
from django.db.models.fields.mixins import FieldCacheMixin
from django.db.models.aggregates import Aggregate, Count
from django.db.models.fields import Field
from django.db.models.fields.reverse_related import ForeignObjectRel
from django.db.models.functions.window import DenseRank
from django.db.models.lookups import Lookup, Transform
from django.db.models.lookups import (FieldGetDbPrepValueMixin, Lookup,
Transform)
from django.db.models.query import QuerySet
from django.db.models.query_utils import Q
from django.db.models.sql.compiler import SQLCompiler
@@ -28,10 +24,7 @@ class SQLiteNumericMixin:
compiler: SQLCompiler,
connection: DatabaseWrapper,
**extra_context: Any
) -> Tuple[
str,
Union[List[Union[int, str]], List[date], List[Decimal], List[float]],
]: ...
) -> Tuple[str, List[float]]: ...
class Combinable:
ADD: str = ...
@@ -45,7 +38,9 @@ class Combinable:
BITLEFTSHIFT: str = ...
BITRIGHTSHIFT: str = ...
def __neg__(self) -> CombinedExpression: ...
def __add__(self, other: Any) -> CombinedExpression: ...
def __add__(
self, other: Optional[Union[timedelta, Combinable, float, str]]
) -> CombinedExpression: ...
def __sub__(
self, other: Union[timedelta, Combinable, float]
) -> CombinedExpression: ...
@@ -62,7 +57,7 @@ class Combinable:
def __or__(self, other: Combinable) -> Any: ...
def bitor(self, other: int) -> CombinedExpression: ...
def __radd__(
self, other: Optional[Union[datetime, timedelta, float]]
self, other: Optional[Union[datetime, float]]
) -> CombinedExpression: ...
def __rsub__(self, other: float) -> CombinedExpression: ...
def __rmul__(self, other: float) -> CombinedExpression: ...
@@ -78,10 +73,7 @@ class BaseExpression:
window_compatible: bool = ...
output_field: Any = ...
def __init__(
self,
output_field: Optional[
Union[Field, reverse_related.ForeignObjectRel, str]
] = ...,
self, output_field: Optional[Union[Field, ForeignObjectRel, str]] = ...
) -> None: ...
def get_db_converters(
self, connection: DatabaseWrapper
@@ -101,13 +93,15 @@ class BaseExpression:
for_save: bool = ...,
) -> BaseExpression: ...
@property
def field(self) -> Union[Field, ForeignObjectRel]: ...
def field(self) -> Union[Field, reverse_related.ForeignObjectRel]: ...
def output_field(self) -> Field: ...
def convert_value(self) -> Callable: ...
def get_lookup(self, lookup: str) -> Optional[Type[Lookup]]: ...
def get_lookup(
self, lookup: str
) -> Optional[Type[Union[FieldGetDbPrepValueMixin, Lookup]]]: ...
def get_transform(self, name: str) -> Optional[Type[Transform]]: ...
def relabeled_clone(
self, change_map: Dict[Optional[str], str]
self, change_map: Union[Dict[Optional[str], str], OrderedDict]
) -> Expression: ...
def copy(self) -> BaseExpression: ...
def get_group_by_cols(self) -> List[Expression]: ...
@@ -138,9 +132,7 @@ class CombinedExpression(SQLiteNumericMixin, Expression):
def set_source_expressions(self, exprs: List[Combinable]) -> None: ...
def as_sql(
self, compiler: SQLCompiler, connection: DatabaseWrapper
) -> Tuple[
str, Union[List[datetime], List[float], List[int], List[str]]
]: ...
) -> Tuple[str, List[float]]: ...
def resolve_expression(
self,
query: Query = ...,
@@ -229,10 +221,7 @@ class Func(SQLiteNumericMixin, Expression):
template: Optional[str] = ...,
arg_joiner: Optional[str] = ...,
**extra_context: Any
) -> Tuple[
str,
Union[List[Union[int, str]], List[date], List[Decimal], List[float]],
]: ...
) -> Tuple[str, List[float]]: ...
def copy(self) -> Func: ...
class Value(Expression):
@@ -242,17 +231,7 @@ class Value(Expression):
) -> None: ...
def as_sql(
self, compiler: SQLCompiler, connection: DatabaseWrapper
) -> Tuple[
str,
Union[
List[date],
List[Decimal],
List[float],
List[int],
List[memoryview],
List[str],
],
]: ...
) -> Tuple[str, List[float]]: ...
def resolve_expression(
self,
query: Query = ...,
@@ -281,7 +260,7 @@ class RawSQL(Expression):
) -> None: ...
def as_sql(
self, compiler: SQLCompiler, connection: DatabaseWrapper
) -> Tuple[str, Union[List[int], List[str], Tuple]]: ...
) -> Tuple[str, List[str]]: ...
def get_group_by_cols(self) -> List[RawSQL]: ...
def __hash__(self): ...
@@ -308,7 +287,9 @@ class Col(Expression):
def as_sql(
self, compiler: SQLCompiler, connection: DatabaseWrapper
) -> Tuple[str, List[Any]]: ...
def relabeled_clone(self, relabels: Dict[str, str]) -> Col: ...
def relabeled_clone(
self, relabels: Union[Dict[str, str], OrderedDict]
) -> Col: ...
def get_group_by_cols(self) -> List[Col]: ...
def get_db_converters(
self, connection: DatabaseWrapper
@@ -316,7 +297,9 @@ class Col(Expression):
class Ref(Expression):
def __init__(self, refs: str, source: Expression) -> None: ...
def get_source_expressions(self) -> List[Expression]: ...
def get_source_expressions(
self
) -> Union[List[Expression], List[SQLiteNumericMixin]]: ...
def set_source_expressions(self, exprs: Any) -> None: ...
def resolve_expression(
self,
@@ -350,7 +333,7 @@ class ExpressionWrapper(Expression):
) -> Union[List[CombinedExpression], List[Node]]: ...
def as_sql(
self, compiler: SQLCompiler, connection: DatabaseWrapper
) -> Tuple[str, Union[List[int], List[str]]]: ...
) -> Tuple[str, List[Any]]: ...
class When(Expression):
template: str = ...
@@ -378,17 +361,7 @@ class When(Expression):
connection: DatabaseWrapper,
template: None = ...,
**extra_context: Any
) -> Tuple[
str,
Union[
List[Union[date, int]],
List[Union[date, str]],
List[Union[Decimal, int]],
List[Union[int, memoryview]],
List[Union[int, str]],
List[float],
],
]: ...
) -> Tuple[str, List[Union[int, str]]]: ...
def get_group_by_cols(self) -> List[Col]: ...
class Case(Expression):
@@ -422,17 +395,7 @@ class Case(Expression):
template: None = ...,
case_joiner: None = ...,
**extra_context: Any
) -> Tuple[
str,
Union[
List[Union[date, int]],
List[Union[date, str]],
List[Union[Decimal, int]],
List[Union[int, memoryview]],
List[Union[int, str]],
List[float],
],
]: ...
) -> Tuple[str, List[Union[int, str]]]: ...
class Subquery(Expression):
template: str = ...
@@ -512,10 +475,10 @@ class OrderBy(BaseExpression):
connection: DatabaseWrapper,
template: Optional[str] = ...,
**extra_context: Any
) -> Tuple[str, Union[List[Union[int, str]], Tuple]]: ...
) -> Tuple[str, List[Union[int, str]]]: ...
def as_sqlite(
self, compiler: SQLCompiler, connection: DatabaseWrapper
) -> Tuple[str, Union[List[Union[int, str]], Tuple]]: ...
) -> Tuple[str, List[Union[int, str]]]: ...
def as_mysql(self, compiler: Any, connection: Any): ...
def get_group_by_cols(self): ...
def reverse_ordering(self) -> OrderBy: ...

View File

@@ -3,7 +3,6 @@ from decimal import Context, Decimal
from typing import Any, Callable, Dict, List, Optional, Tuple, Type, Union
from uuid import UUID
from django.contrib.auth.validators import UnicodeUsernameValidator
from django.core.exceptions import FieldDoesNotExist as FieldDoesNotExist
from django.core.validators import DecimalValidator
from django.db.backends.sqlite3.base import DatabaseWrapper
@@ -79,30 +78,9 @@ class Field(RegisterLookupMixin):
choices: Optional[
Union[
List[List[Union[List[List[str]], str]]],
List[
Tuple[
Union[int, str],
Union[
Tuple[
Tuple[str, str],
Tuple[str, str],
Tuple[str, str],
],
Tuple[Tuple[str, str], Tuple[str, str]],
int,
str,
],
]
],
Tuple[
Union[
Tuple[int, Union[int, str]],
Tuple[
str,
Union[Tuple[Tuple[int, str], Tuple[int, str]], str],
],
]
],
List[Tuple[Optional[int], str]],
List[Tuple[Union[int, str], int]],
Tuple[Tuple[Union[int, str], Union[int, str]]],
]
] = ...,
help_text: str = ...,
@@ -116,7 +94,9 @@ class Field(RegisterLookupMixin):
def get_col(
self,
alias: str,
output_field: Optional[Union[Field, ForeignObjectRel]] = ...,
output_field: Optional[
Union[Field, reverse_related.ForeignObjectRel]
] = ...,
) -> Col: ...
def cached_col(self) -> Col: ...
def select_format(
@@ -124,81 +104,14 @@ class Field(RegisterLookupMixin):
) -> Tuple[str, List[Union[int, str]]]: ...
def deconstruct(
self
) -> Union[
Tuple[None, str, List[Any], Dict[str, Union[List[Callable], int, str]]],
Tuple[
str,
List[Any],
Union[
Dict[str, Optional[bool]],
Dict[str, Union[Callable, int, str]],
Dict[str, Union[List[Tuple[int, str]], int]],
Dict[
str,
Union[
List[
Tuple[
str,
Union[
Tuple[Tuple[str, str], Tuple[str, str]], str
],
]
],
int,
],
],
Dict[str, Union[List[Tuple[str, str]], int]],
Dict[str, Union[List[UnicodeUsernameValidator], int, str]],
Dict[str, float],
],
Union[
Dict[str, Optional[bool]],
Dict[str, Union[Callable, int, str]],
Dict[str, Union[List[Tuple[int, str]], int]],
Dict[
str,
Union[
List[
Tuple[
str,
Union[
Tuple[Tuple[str, str], Tuple[str, str]], str
],
]
],
int,
],
],
Dict[str, Union[List[Tuple[str, str]], int]],
Dict[str, Union[List[UnicodeUsernameValidator], int, str]],
Dict[str, float],
],
],
Tuple[
str,
List[Any],
Union[
Dict[str, Optional[bool]],
Dict[str, Union[List[Tuple[int, str]], str]],
],
Union[
Dict[str, List[Tuple[int, str]]],
Dict[str, Optional[bool]],
Dict[str, Union[List[Tuple[int, str]], str]],
],
],
) -> Tuple[
Optional[str], str, List[Any], Dict[str, List[Tuple[int, str]]]
]: ...
def clone(self) -> Field: ...
def __eq__(self, other: Field) -> bool: ...
def __lt__(self, other: Field) -> bool: ...
def __hash__(self) -> int: ...
def __deepcopy__(
self,
memodict: Union[
Dict[int, Any],
Dict[int, Union[Dict[str, Field], List[Field], Field]],
],
) -> Field: ...
def __deepcopy__(self, memodict: Dict[int, Dict[Any, Any]]) -> Field: ...
def __copy__(self) -> Field: ...
def __reduce__(self): ...
def get_pk_value_on_save(self, instance: Model) -> Optional[UUID]: ...
@@ -242,7 +155,7 @@ class Field(RegisterLookupMixin):
) -> Optional[Union[bytes, float, str]]: ...
def get_db_prep_save(
self, value: Any, connection: DatabaseWrapper
) -> Optional[Union[float, memoryview, str]]: ...
) -> Optional[Union[float, str]]: ...
def has_default(self) -> bool: ...
def get_default(self) -> Any: ...
def get_choices(
@@ -251,20 +164,8 @@ class Field(RegisterLookupMixin):
blank_choice: List[Tuple[str, str]] = ...,
limit_choices_to: Optional[Dict[str, QuerySet]] = ...,
) -> List[
Union[
Tuple[
Union[
Tuple[Tuple[str, str], Tuple[str, str], Tuple[str, str]],
Tuple[Tuple[str, str], Tuple[str, str]],
str,
],
Union[
Tuple[Tuple[str, str], Tuple[str, str], Tuple[str, str]],
Tuple[Tuple[str, str], Tuple[str, str]],
str,
],
],
Tuple[int, int],
Tuple[
Union[int, str], Union[Tuple[Tuple[str, str], Tuple[str, str]], str]
]
]: ...
def value_to_string(self, obj: Model) -> str: ...
@@ -274,7 +175,7 @@ class Field(RegisterLookupMixin):
) -> None: ...
def formfield(
self,
form_class: Optional[Type[Any]] = ...,
form_class: Optional[Type[Field]] = ...,
choices_form_class: Optional[Type[TypedMultipleChoiceField]] = ...,
**kwargs: Any
) -> Field: ...
@@ -288,15 +189,7 @@ class AutoField(Field):
def check(self, **kwargs: Any) -> List[Any]: ...
def deconstruct(
self
) -> Union[
Tuple[
str,
List[Any],
Dict[str, Union[bool, str]],
Dict[str, Union[bool, str]],
],
Tuple[str, str, List[Any], Dict[str, bool]],
]: ...
) -> Tuple[Optional[str], str, List[Any], Dict[str, Union[bool, str]]]: ...
def get_internal_type(self) -> str: ...
def to_python(self, value: Union[int, str]) -> int: ...
def rel_db_type(self, connection: DatabaseWrapper) -> str: ...
@@ -367,14 +260,8 @@ class DateField(DateTimeCheckMixin, Field):
) -> None: ...
def deconstruct(
self
) -> Union[
Tuple[
str,
List[Any],
Dict[str, Union[Callable, int, str]],
Dict[str, Union[Callable, int, str]],
],
Tuple[str, str, List[Any], Dict[str, int]],
) -> Tuple[
Optional[str], str, List[Any], Dict[str, Union[Callable, int, str]]
]: ...
def get_internal_type(self) -> str: ...
def to_python(
@@ -438,7 +325,7 @@ class DecimalField(Field):
def context(self) -> Context: ...
def deconstruct(
self
) -> Tuple[str, List[Any], Dict[str, int], Dict[str, int]]: ...
) -> Tuple[Optional[str], str, List[Any], Dict[str, int]]: ...
def get_internal_type(self) -> str: ...
def to_python(self, value: Optional[str]) -> Optional[Decimal]: ...
def get_db_prep_save(
@@ -466,7 +353,7 @@ class EmailField(CharField):
def __init__(self, *args: Any, **kwargs: Any) -> None: ...
def deconstruct(
self
) -> Tuple[str, List[Any], Dict[str, int], Dict[str, int]]: ...
) -> Tuple[Optional[str], str, List[Any], Dict[str, int]]: ...
def formfield(self, **kwargs: Any) -> EmailField: ...
class FilePathField(Field):
@@ -588,15 +475,7 @@ class SlugField(CharField):
) -> None: ...
def deconstruct(
self
) -> Union[
Tuple[
str,
List[Any],
Dict[str, int],
Union[Dict[Any, Any], Dict[str, int]],
],
Tuple[str, str, List[Any], Dict[str, int]],
]: ...
) -> Tuple[Optional[str], str, List[Any], Dict[str, int]]: ...
def get_internal_type(self) -> str: ...
def formfield(self, **kwargs: Any) -> SlugField: ...
@@ -629,20 +508,18 @@ class TimeField(DateTimeCheckMixin, Field):
) -> None: ...
def deconstruct(
self
) -> Tuple[str, List[Any], Dict[Any, Any], Dict[Any, Any]]: ...
) -> Tuple[Optional[str], str, List[Any], Dict[Any, Any]]: ...
def get_internal_type(self) -> str: ...
def to_python(
self, value: Optional[Union[datetime, time, str]]
self, value: Optional[Union[datetime, str]]
) -> Optional[time]: ...
def pre_save(
self, model_instance: Model, add: bool
) -> Optional[datetime]: ...
def get_prep_value(
self, value: Optional[Union[datetime, time]]
) -> Optional[time]: ...
def get_prep_value(self, value: Optional[datetime]) -> Optional[time]: ...
def get_db_prep_value(
self,
value: Optional[Union[datetime, time]],
value: Optional[datetime],
connection: DatabaseWrapper,
prepared: bool = ...,
) -> Optional[str]: ...
@@ -657,9 +534,7 @@ class URLField(CharField):
) -> None: ...
def deconstruct(
self
) -> Tuple[
str, List[Any], Dict[str, int], Union[Dict[Any, Any], Dict[str, int]]
]: ...
) -> Tuple[Optional[str], str, List[Any], Dict[str, int]]: ...
def formfield(self, **kwargs: Any) -> URLField: ...
class BinaryField(Field):
@@ -668,19 +543,11 @@ class BinaryField(Field):
def __init__(self, *args: Any, **kwargs: Any) -> None: ...
def deconstruct(
self
) -> Union[
Tuple[
str,
List[Any],
Dict[str, bool],
Union[Dict[Any, Any], Dict[str, bool]],
],
Tuple[str, str, List[Any], Dict[Any, Any]],
]: ...
) -> Tuple[Optional[str], str, List[Any], Dict[str, bool]]: ...
def get_internal_type(self) -> str: ...
def get_placeholder(
self,
value: Optional[memoryview],
value: None,
compiler: SQLInsertCompiler,
connection: DatabaseWrapper,
) -> str: ...
@@ -690,7 +557,7 @@ class BinaryField(Field):
value: Optional[bytes],
connection: DatabaseWrapper,
prepared: bool = ...,
) -> Optional[memoryview]: ...
) -> None: ...
def value_to_string(self, obj: Any): ...
def to_python(self, value: Any): ...
@@ -702,10 +569,7 @@ class UUIDField(Field):
def deconstruct(
self
) -> Tuple[
str,
List[Any],
Dict[str, Union[Callable, bool]],
Dict[str, Union[Callable, bool]],
Optional[str], str, List[Any], Dict[str, Union[Callable, bool]]
]: ...
def get_internal_type(self) -> str: ...
def get_db_prep_value(

View File

@@ -12,10 +12,7 @@ from django.forms.fields import FileField, ImageField
class FieldFile(File):
instance: django.db.models.base.Model = ...
field: django.db.models.fields.files.FileField = ...
storage: Union[
django.core.files.storage.DefaultStorage,
django.core.files.storage.FileSystemStorage,
] = ...
storage: django.core.files.storage.FileSystemStorage = ...
def __init__(
self, instance: Model, field: FileField, name: Optional[str]
) -> None: ...
@@ -63,18 +60,7 @@ class FileField(Field):
def check(self, **kwargs: Any) -> List[Error]: ...
def deconstruct(
self
) -> Tuple[
str,
List[Any],
Union[
Dict[str, Union[Callable, FileSystemStorage, int]],
Dict[str, Union[FileSystemStorage, int, str]],
],
Union[
Dict[str, Union[Callable, FileSystemStorage, int]],
Dict[str, Union[FileSystemStorage, int, str]],
],
]: ...
) -> Tuple[Optional[str], str, List[Any], Dict[str, Union[bool, str]]]: ...
def get_internal_type(self) -> str: ...
def get_prep_value(self, value: Union[FieldFile, str]) -> str: ...
def pre_save(self, model_instance: Model, add: bool) -> FieldFile: ...
@@ -116,10 +102,10 @@ class ImageField(FileField):
def deconstruct(
self
) -> Tuple[
Optional[str],
str,
List[Any],
Dict[str, Union[Callable, bool, FileSystemStorage, str]],
Dict[str, Union[Callable, bool, FileSystemStorage, str]],
]: ...
def contribute_to_class(
self, cls: Type[Model], name: str, **kwargs: Any

View File

@@ -3,13 +3,14 @@ from uuid import UUID
from django.core.checks.messages import Error, Warning
from django.db.backends.sqlite3.base import DatabaseWrapper
from django.db.migrations.writer import SettingsReference
from django.db.models.base import Model
from django.db.models.expressions import Col
from django.db.models.fields import Field
from django.db.models.fields.related_lookups import RelatedIsNull
from django.db.models.fields.reverse_related import (ForeignObjectRel,
ManyToManyRel,
ManyToOneRel, OneToOneRel)
from django.db.models.lookups import FieldGetDbPrepValueMixin
from django.db.models.query import QuerySet
from django.db.models.query_utils import PathInfo, Q
from django.db.models.sql.where import WhereNode
@@ -57,23 +58,10 @@ class RelatedField(FieldCacheMixin, Field):
) -> None: ...
def deconstruct(
self
) -> Tuple[
str,
List[Any],
Union[
Dict[str, Union[Callable, bool, str]],
Dict[str, Union[Dict[str, Union[int, str]], bool]],
Dict[str, Union[Dict[str, bool], bool, str]],
],
Union[
Dict[str, Union[Callable, bool, str]],
Dict[str, Union[Dict[str, Union[int, str]], bool]],
Dict[str, Union[Dict[str, bool], bool, str]],
],
]: ...
) -> Tuple[Optional[str], str, List[Any], Dict[str, str]]: ...
def get_forward_related_filter(
self, obj: Model
) -> Union[Dict[str, int], Dict[str, UUID]]: ...
) -> Dict[str, Union[int, UUID]]: ...
def get_reverse_related_filter(self, obj: Model) -> Q: ...
@property
def swappable_setting(self) -> Optional[str]: ...
@@ -119,18 +107,19 @@ class ForeignObject(RelatedField):
def check(self, **kwargs: Any) -> List[Any]: ...
def deconstruct(
self
) -> Union[
Tuple[None, str, List[Any], Dict[str, Any]],
Tuple[str, List[Any], Dict[str, Any], Dict[str, Any]],
Tuple[
) -> Tuple[
Optional[str],
str,
List[Any],
Dict[
str,
str,
List[Any],
Dict[
Union[
Callable,
Dict[str, Union[int, str]],
List[None],
List[str],
bool,
str,
Union[
Callable, Dict[str, Union[int, str]], List[str], bool, str
],
],
],
]: ...
@@ -145,14 +134,14 @@ class ForeignObject(RelatedField):
def foreign_related_fields(self) -> Tuple[Field]: ...
def get_local_related_value(
self, instance: Model
) -> Tuple[Optional[Union[int, str, UUID]]]: ...
) -> Tuple[Optional[int]]: ...
def get_foreign_related_value(
self, instance: Model
) -> Tuple[Optional[Union[int, str, UUID]]]: ...
) -> Tuple[Optional[int]]: ...
@staticmethod
def get_instance_value_for_fields(
instance: Model, fields: Tuple[Field]
) -> Tuple[Optional[Union[int, str, UUID]]]: ...
) -> Tuple[Optional[int]]: ...
def get_attname_column(self) -> Tuple[str, None]: ...
def get_joining_columns(
self, reverse_join: bool = ...
@@ -169,7 +158,9 @@ class ForeignObject(RelatedField):
) -> List[PathInfo]: ...
def get_reverse_path_info(self, filtered_relation: Optional[Any] = ...): ...
@classmethod
def get_lookups(cls) -> Dict[str, Type[Any]]: ...
def get_lookups(
cls
) -> Dict[str, Type[Union[RelatedIsNull, FieldGetDbPrepValueMixin]]]: ...
def contribute_to_class(
self,
cls: Type[Model],
@@ -208,33 +199,11 @@ class ForeignKey(ForeignObject):
def check(self, **kwargs: Any) -> List[Warning]: ...
def deconstruct(
self
) -> Union[
Tuple[
None,
str,
List[Any],
Dict[str, Union[Callable, Dict[str, Union[int, str]], str]],
],
Tuple[
str,
List[Any],
Union[
Dict[str, Union[Callable, Dict[str, Union[int, str]], str]],
Dict[str, Union[Callable, Dict[str, bool], str]],
Dict[str, Union[Callable, bool, str]],
],
Union[
Dict[str, Union[Callable, Dict[str, Union[int, str]], str]],
Dict[str, Union[Callable, Dict[str, bool], str]],
Dict[str, Union[Callable, bool, str]],
],
],
Tuple[
str,
str,
List[Any],
Dict[str, Union[Callable, bool, SettingsReference]],
],
) -> Tuple[
Optional[str],
str,
List[Any],
Dict[str, Union[Callable, Dict[str, Union[int, str]], str]],
]: ...
def to_python(self, value: Union[int, str]) -> int: ...
@property
@@ -277,7 +246,7 @@ class ForeignKey(ForeignObject):
def get_col(
self,
alias: str,
output_field: Optional[Union[Field, OneToOneRel]] = ...,
output_field: Optional[Union[Field, reverse_related.OneToOneRel]] = ...,
) -> Col: ...
class OneToOneField(ForeignKey):
@@ -299,10 +268,7 @@ class OneToOneField(ForeignKey):
def deconstruct(
self
) -> Tuple[
str,
List[Any],
Dict[str, Union[Callable, bool, str]],
Dict[str, Union[Callable, bool, str]],
Optional[str], str, List[Any], Dict[str, Union[Callable, bool, str]]
]: ...
def formfield(self, **kwargs: Any) -> None: ...
def save_form_data(
@@ -338,20 +304,7 @@ class ManyToManyField(RelatedField):
def check(self, **kwargs: Any) -> List[Any]: ...
def deconstruct(
self
) -> Union[
Tuple[None, str, List[Any], Dict[str, Union[bool, str]]],
Tuple[
str,
List[Any],
Union[Dict[str, Union[Callable, str]], Dict[str, Union[bool, str]]],
Union[
Dict[str, Union[Callable, str]],
Dict[str, Union[bool, str]],
Dict[str, str],
],
],
Tuple[str, str, List[Any], Dict[str, Union[Callable, str]]],
]: ...
) -> Tuple[Optional[str], str, List[Any], Dict[str, str]]: ...
def get_path_info(
self, filtered_relation: None = ...
) -> List[PathInfo]: ...

View File

@@ -4,11 +4,12 @@ from uuid import UUID
from django.db.backends.sqlite3.base import DatabaseWrapper
from django.db.models.base import Model
from django.db.models.expressions import Col, OuterRef
from django.db.models.expressions import Col
from django.db.models.fields import Field
from django.db.models.fields.related import ForeignObject
from django.db.models.lookups import (Exact, GreaterThan, GreaterThanOrEqual,
In, IsNull, LessThan, LessThanOrEqual)
from django.db.models.lookups import (BuiltinLookup, Exact, GreaterThan,
GreaterThanOrEqual, In, IsNull, LessThan,
LessThanOrEqual)
from django.db.models.sql.compiler import SQLCompiler
from django.db.models.sql.query import Query
@@ -28,13 +29,11 @@ class MultiColSource:
field: related.ForeignObject,
) -> None: ...
def relabeled_clone(self, relabels: OrderedDict) -> MultiColSource: ...
def get_lookup(
self, lookup: str
) -> Type[Union[RelatedExact, RelatedIn, RelatedIsNull]]: ...
def get_lookup(self, lookup: str) -> Type[BuiltinLookup]: ...
def get_normalized_value(
value: Any, lhs: Union[Col, MultiColSource]
) -> Tuple[Optional[Union[OuterRef, int, str, UUID]]]: ...
) -> Tuple[None]: ...
class RelatedIn(In):
bilateral_transforms: List[Any]
@@ -44,8 +43,8 @@ class RelatedIn(In):
django.db.models.fields.related_lookups.MultiColSource,
]
rhs: Union[
List[Union[django.db.models.base.Model, int]],
List[Union[int, str]],
List[django.db.models.base.Model],
List[int],
List[uuid.UUID],
Set[django.contrib.contenttypes.models.ContentType],
Set[int],
@@ -58,7 +57,7 @@ class RelatedIn(In):
) -> Union[List[Model], List[int], List[str], List[UUID], Query]: ...
def as_sql(
self, compiler: SQLCompiler, connection: DatabaseWrapper
) -> Tuple[str, Union[List[int], List[str]]]: ...
) -> Tuple[str, List[Any]]: ...
class RelatedLookupMixin:
rhs: Any = ...

View File

@@ -4,9 +4,7 @@ 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.fields.related_lookups import (RelatedExact, RelatedIn,
RelatedIsNull)
from django.db.models.lookups import StartsWith
from django.db.models.lookups import BuiltinLookup, StartsWith
from django.db.models.query_utils import FilteredRelation, PathInfo, Q
from django.db.models.sql.where import WhereNode
@@ -58,9 +56,7 @@ class ForeignObjectRel(FieldCacheMixin):
def many_to_one(self) -> bool: ...
def one_to_many(self) -> bool: ...
def one_to_one(self) -> bool: ...
def get_lookup(
self, lookup_name: str
) -> Type[Union[RelatedExact, RelatedIn, RelatedIsNull]]: ...
def get_lookup(self, lookup_name: str) -> Type[BuiltinLookup]: ...
def get_internal_type(self) -> str: ...
@property
def db_type(self) -> Callable: ...

View File

@@ -26,7 +26,7 @@ class Cast(Func):
compiler: SQLCompiler,
connection: DatabaseWrapper,
**extra_context: Any
) -> Tuple[str, Union[List[date], List[Decimal], List[str]]]: ...
) -> Tuple[str, Union[List[date], List[Decimal]]]: ...
def as_mysql(self, compiler: Any, connection: Any): ...
def as_postgresql(self, compiler: Any, connection: Any): ...

View File

@@ -1,10 +1,10 @@
from datetime import date, time
from datetime import datetime
from typing import Any, List, Optional, Set, Tuple, Union
from django.db.backends.sqlite3.base import DatabaseWrapper
from django.db.models import Func, Transform
from django.db.models.expressions import Col, Expression
from django.db.models.fields import DateTimeCheckMixin, IntegerField
from django.db.models.fields import Field
from django.db.models.sql.compiler import SQLCompiler
from django.db.models.sql.query import Query
@@ -138,7 +138,7 @@ class TruncBase(TimezoneMixin, Transform):
def __init__(
self,
expression: Union[Col, str],
output_field: Optional[Union[DateTimeCheckMixin, IntegerField]] = ...,
output_field: Optional[Field] = ...,
tzinfo: None = ...,
**extra: Any
) -> None: ...
@@ -155,16 +155,19 @@ class TruncBase(TimezoneMixin, Transform):
) -> TruncBase: ...
def convert_value(
self,
value: Union[date, time],
value: datetime,
expression: django.db.models.functions.TruncBase,
connection: DatabaseWrapper,
) -> Union[date, time]: ...
) -> datetime: ...
class Trunc(TruncBase):
contains_aggregate: bool
extra: Dict[Any, Any]
is_summary: bool
output_field: django.db.models.fields.Field
output_field: Union[
django.db.models.fields.DateTimeCheckMixin,
django.db.models.fields.IntegerField,
]
source_expressions: List[django.db.models.expressions.Combinable]
tzinfo: None
kind: str = ...
@@ -172,7 +175,7 @@ class Trunc(TruncBase):
self,
expression: str,
kind: str,
output_field: Optional[Union[DateTimeCheckMixin, IntegerField]] = ...,
output_field: Optional[Field] = ...,
tzinfo: None = ...,
**extra: Any
) -> None: ...

View File

@@ -144,7 +144,7 @@ class Ord(Transform):
compiler: SQLCompiler,
connection: DatabaseWrapper,
**extra_context: Any
) -> Tuple[str, Union[List[int], List[str]]]: ...
) -> Tuple[str, List[Any]]: ...
class Repeat(BytesToCharFieldConversionMixin, Func):
contains_aggregate: bool

View File

@@ -1,5 +1,5 @@
from datetime import date, datetime
from decimal import Decimal
from collections import OrderedDict
from datetime import datetime
from typing import Any, Dict, List, Optional, Tuple, Type, Union
from uuid import UUID
@@ -13,6 +13,7 @@ from django.db.models.query_utils import RegisterLookupMixin
from django.db.models.sql.compiler import SQLCompiler
from django.db.models.sql.query import Query
from django.utils.datastructures import OrderedSet
from django.utils.safestring import SafeText
class Lookup:
@@ -22,7 +23,9 @@ class Lookup:
rhs: Any = ...
bilateral_transforms: Any = ...
def __init__(
self, lhs: Union[Expression, TextField, MultiColSource], rhs: Any
self,
lhs: Union[Expression, TextField, related_lookups.MultiColSource],
rhs: Any,
) -> None: ...
def apply_bilateral_transforms(self, value: Expression) -> Transform: ...
def batch_process_rhs(
@@ -30,40 +33,26 @@ class Lookup:
compiler: SQLCompiler,
connection: DatabaseWrapper,
rhs: Optional[OrderedSet] = ...,
) -> Tuple[
List[str],
Union[List[Optional[int]], List[Union[Combinable, int]], List[str]],
]: ...
) -> Tuple[List[str], List[str]]: ...
def get_source_expressions(self) -> List[Expression]: ...
lhs: Any = ...
def set_source_expressions(self, new_exprs: List[Ref]) -> None: ...
def get_prep_lookup(self) -> Any: ...
def get_db_prep_lookup(
self, value: Union[int, str], connection: DatabaseWrapper
) -> Tuple[str, Union[List[int], List[str]]]: ...
) -> Tuple[str, List[SafeText]]: ...
def process_lhs(
self,
compiler: SQLCompiler,
connection: DatabaseWrapper,
lhs: Optional[Col] = ...,
) -> Tuple[str, Union[List[Union[int, str]], Tuple]]: ...
) -> Tuple[str, List[Union[int, str]]]: ...
def process_rhs(
self, compiler: SQLCompiler, connection: DatabaseWrapper
) -> Tuple[
str,
Union[
List[None],
List[Union[date, str]],
List[Union[int, str]],
List[Decimal],
List[float],
List[memoryview],
Tuple,
],
]: ...
) -> Tuple[str, Union[List[Union[int, str]], Tuple[int, int]]]: ...
def rhs_is_direct_value(self) -> bool: ...
def relabeled_clone(
self, relabels: Dict[Optional[str], str]
self, relabels: Union[Dict[Optional[str], str], OrderedDict]
) -> Union[BuiltinLookup, FieldGetDbPrepValueMixin]: ...
def get_group_by_cols(self) -> List[Expression]: ...
def as_sql(self, compiler: Any, connection: Any) -> None: ...
@@ -88,44 +77,24 @@ class BuiltinLookup(Lookup):
) -> Tuple[str, List[Union[int, str]]]: ...
def as_sql(
self, compiler: SQLCompiler, connection: DatabaseWrapper
) -> Tuple[
str,
Union[
List[Optional[int]],
List[Union[date, str]],
List[Union[Decimal, int]],
List[Union[int, str]],
List[float],
List[memoryview],
],
]: ...
) -> Tuple[str, List[float]]: ...
def get_rhs_op(self, connection: DatabaseWrapper, rhs: str) -> str: ...
class FieldGetDbPrepValueMixin:
get_db_prep_lookup_value_is_iterable: bool = ...
def get_db_prep_lookup(
self, value: Any, connection: DatabaseWrapper
) -> Tuple[
str,
Union[
List[Optional[int]],
List[Union[Combinable, int]],
List[Decimal],
List[float],
List[memoryview],
List[str],
],
]: ...
) -> Tuple[str, List[float]]: ...
class FieldGetDbPrepValueIterableMixin(FieldGetDbPrepValueMixin):
get_db_prep_lookup_value_is_iterable: bool = ...
def get_prep_lookup(
self
) -> Union[
List[Optional[int]],
List[Union[Combinable, int]],
List[datetime],
List[Model],
List[Combinable],
List[int],
List[str],
List[UUID],
Subquery,
@@ -133,14 +102,14 @@ class FieldGetDbPrepValueIterableMixin(FieldGetDbPrepValueMixin):
]: ...
def process_rhs(
self, compiler: SQLCompiler, connection: DatabaseWrapper
) -> Tuple[Tuple, Tuple]: ...
) -> Tuple[Union[Tuple[str, str], str], Tuple]: ...
def resolve_expression_parameter(
self,
compiler: SQLCompiler,
connection: DatabaseWrapper,
sql: str,
param: Optional[Union[Combinable, int, str]],
) -> Tuple[str, Union[List[None], List[int], List[str]]]: ...
) -> Tuple[str, List[None]]: ...
def batch_process_rhs(
self,
compiler: SQLCompiler,
@@ -157,17 +126,7 @@ class Exact(FieldGetDbPrepValueMixin, BuiltinLookup):
lookup_name: str = ...
def process_rhs(
self, compiler: SQLCompiler, connection: DatabaseWrapper
) -> Tuple[
str,
Union[
List[None],
List[Union[int, str]],
List[Decimal],
List[float],
List[memoryview],
Tuple,
],
]: ...
) -> Tuple[str, Union[List[str], Tuple[int, int]]]: ...
class IExact(BuiltinLookup):
bilateral_transforms: List[Any]
@@ -183,10 +142,7 @@ class IExact(BuiltinLookup):
class GreaterThan(FieldGetDbPrepValueMixin, BuiltinLookup):
bilateral_transforms: List[Any]
contains_aggregate: bool
lhs: Union[
django.db.models.expressions.Expression,
django.db.models.expressions.SQLiteNumericMixin,
]
lhs: django.db.models.expressions.Expression
rhs: Any
lookup_name: str = ...
@@ -194,24 +150,33 @@ class GreaterThanOrEqual(FieldGetDbPrepValueMixin, BuiltinLookup):
bilateral_transforms: List[Any]
contains_aggregate: bool
lhs: django.db.models.expressions.Expression
rhs: Any
rhs: Union[
datetime.datetime,
decimal.Decimal,
django.db.models.expressions.Combinable,
int,
str,
]
lookup_name: str = ...
class LessThan(FieldGetDbPrepValueMixin, BuiltinLookup):
bilateral_transforms: List[Any]
contains_aggregate: bool
lhs: django.db.models.expressions.Expression
rhs: Any
rhs: Union[
datetime.datetime,
decimal.Decimal,
django.db.models.expressions.CombinedExpression,
float,
str,
]
lookup_name: str = ...
class LessThanOrEqual(FieldGetDbPrepValueMixin, BuiltinLookup):
bilateral_transforms: List[Type[django.db.models.lookups.Transform]]
contains_aggregate: bool
contains_over_clause: bool
lhs: Union[
django.db.models.expressions.Expression,
django.db.models.expressions.SQLiteNumericMixin,
]
lhs: django.db.models.expressions.Expression
rhs: Union[
datetime.date,
decimal.Decimal,
@@ -241,7 +206,7 @@ class In(FieldGetDbPrepValueIterableMixin, BuiltinLookup):
def get_rhs_op(self, connection: DatabaseWrapper, rhs: str) -> str: ...
def as_sql(
self, compiler: SQLCompiler, connection: DatabaseWrapper
) -> Tuple[str, Union[List[Optional[int]], List[Union[int, str]]]]: ...
) -> Tuple[str, List[Union[int, str]]]: ...
def split_parameter_list_as_sql(self, compiler: Any, connection: Any): ...
class PatternLookup(BuiltinLookup):
@@ -250,7 +215,7 @@ class PatternLookup(BuiltinLookup):
def get_rhs_op(self, connection: DatabaseWrapper, rhs: str) -> str: ...
def process_rhs(
self, qn: SQLCompiler, connection: DatabaseWrapper
) -> Tuple[str, Union[List[int], List[str]]]: ...
) -> Tuple[str, List[Any]]: ...
class Contains(PatternLookup):
bilateral_transforms: List[Type[django.db.models.lookups.Transform]]
@@ -301,13 +266,11 @@ class Range(FieldGetDbPrepValueIterableMixin, BuiltinLookup):
contains_aggregate: bool
lhs: django.db.models.expressions.Expression
rhs: Union[
List[Union[django.db.models.expressions.Combinable, int]],
List[datetime.datetime],
Tuple[
Union[django.db.models.expressions.Combinable, int],
Union[django.db.models.expressions.CombinedExpression, int],
Union[django.db.models.expressions.F, int],
Union[datetime.datetime, int],
],
Tuple[datetime.datetime, datetime.datetime],
]
lookup_name: str = ...
def get_rhs_op(

View File

@@ -1,6 +1,5 @@
from typing import Any, Dict, List, Optional, Tuple, Type, Union
from typing import Any, Dict, List, Optional, Tuple, Type
from django.contrib.auth.models import Group, Permission
from django.contrib.sites.managers import CurrentSiteManager
from django.db.models.base import Model
from django.db.models.query import QuerySet
@@ -45,13 +44,6 @@ class ManagerDescriptor:
class EmptyManager(Manager):
creation_counter: int
name: None
model: Optional[
Type[
Union[
django.contrib.auth.models.Group,
django.contrib.auth.models.Permission,
]
]
] = ...
def __init__(self, model: Type[Union[Group, Permission]]) -> None: ...
model: Optional[Type[django.db.models.base.Model]] = ...
def __init__(self, model: Type[Model]) -> None: ...
def get_queryset(self) -> QuerySet: ...

View File

@@ -33,7 +33,7 @@ def make_immutable_fields_list(
data: Union[
Iterator[Any],
List[Union[ArrayField, CIText]],
List[Union[Field, mixins.FieldCacheMixin]],
List[Union[Field, FieldCacheMixin]],
],
) -> ImmutableList: ...
@@ -121,9 +121,8 @@ class Options:
@property
def installed(self): ...
model: Type[django.db.models.base.Model] = ...
original_attrs: Union[
Dict[str, Union[List[str], str]],
Dict[str, Union[django.apps.registry.Apps, str]],
original_attrs: Dict[
str, Union[List[str], django.apps.registry.Apps, str]
] = ...
def contribute_to_class(self, cls: Type[Model], name: str) -> None: ...
def add_manager(self, manager: Manager) -> None: ...
@@ -149,7 +148,7 @@ class Options:
def fields_map(self) -> Dict[str, ForeignObjectRel]: ...
def get_field(
self, field_name: Union[Callable, str]
) -> Union[Field, FieldCacheMixin]: ...
) -> Union[Field, mixins.FieldCacheMixin]: ...
def get_base_chain(self, model: Type[Model]) -> List[Type[Model]]: ...
def get_parent_list(self) -> List[Type[Model]]: ...
def get_ancestor_link(

View File

@@ -1,17 +1,17 @@
from datetime import date, datetime, time, timedelta
from collections import OrderedDict
from datetime import date, datetime
from decimal import Decimal
from itertools import chain
from typing import (Any, Callable, Dict, Iterator, List, Optional, Tuple, Type,
Union)
from typing import (Any, Callable, Dict, Iterator, List, Optional, Set, Tuple,
Type, Union)
from unittest.mock import MagicMock
from uuid import UUID
from django.contrib.auth.models import Permission, User
from django.contrib.contenttypes.fields import GenericForeignKey
from django.contrib.contenttypes.models import ContentType
from django.db.models.base import Model, ModelState
from django.db.models.expressions import Expression
from django.db.models.fields import Field
from django.db.models.fields.mixins import FieldCacheMixin
from django.db.models.fields.related import ForeignKey
from django.db.models.fields.related_descriptors import (ForwardManyToOneDescriptor,
ReverseOneToOneDescriptor)
@@ -42,16 +42,7 @@ class ValuesIterable(BaseIterable):
chunk_size: int
chunked_fetch: bool
queryset: django.db.models.query.QuerySet
def __iter__(
self
) -> Iterator[
Union[
Dict[str, Optional[Union[int, str]]],
Dict[str, Union[date, Decimal, float, str]],
Dict[str, Union[date, int, str]],
Dict[str, Union[Decimal, int]],
]
]: ...
def __iter__(self) -> Iterator[Dict[str, Optional[Union[int, str]]]]: ...
class ValuesListIterable(BaseIterable):
chunk_size: int
@@ -106,20 +97,13 @@ class QuerySet:
def iterator(self, chunk_size: int = ...) -> Iterator[Any]: ...
def aggregate(
self, *args: Any, **kwargs: Any
) -> Union[
Dict[str, Optional[int]],
Dict[str, Union[date, time]],
Dict[str, Union[Decimal, float]],
Dict[str, timedelta],
]: ...
) -> Dict[str, Optional[Union[datetime, float]]]: ...
def count(self) -> int: ...
def get(
self, *args: Any, **kwargs: Any
) -> Union[
Dict[str, Union[date, Decimal, float, str]],
Dict[str, Union[int, str]],
Tuple[Decimal],
Tuple[str, int, int],
Tuple[Union[Decimal, str]],
Model,
str,
]: ...
@@ -131,13 +115,7 @@ class QuerySet:
) -> List[Model]: ...
def get_or_create(
self,
defaults: Optional[
Union[
Dict[str, Union[Callable, str]],
Dict[str, Union[date, str]],
Dict[str, Model],
]
] = ...,
defaults: Optional[Union[Dict[str, date], Dict[str, Model]]] = ...,
**kwargs: Any
) -> Tuple[Model, bool]: ...
def update_or_create(
@@ -145,8 +123,9 @@ class QuerySet:
defaults: Optional[
Union[
Dict[str, Callable],
Dict[str, Union[date, str]],
Dict[str, date],
Dict[str, Model],
Dict[str, str],
]
] = ...,
**kwargs: Any
@@ -171,7 +150,16 @@ class QuerySet:
def raw(
self,
raw_query: str,
params: Any = ...,
params: Optional[
Union[
Dict[str, str],
List[datetime],
List[Decimal],
List[str],
Set[str],
Tuple[int],
]
] = ...,
translations: Optional[Dict[str, str]] = ...,
using: None = ...,
) -> RawQuerySet: ...
@@ -192,11 +180,7 @@ class QuerySet:
def complex_filter(
self,
filter_obj: Union[
Dict[str, Union[int, str]],
Dict[str, datetime],
Dict[str, QuerySet],
Q,
MagicMock,
Dict[str, datetime], Dict[str, QuerySet], Q, MagicMock
],
) -> QuerySet: ...
def union(self, *other_qs: Any, all: bool = ...) -> QuerySet: ...
@@ -212,7 +196,9 @@ class QuerySet:
def distinct(self, *field_names: Any) -> QuerySet: ...
def extra(
self,
select: Optional[Union[Dict[str, int], Dict[str, str]]] = ...,
select: Optional[
Union[Dict[str, int], Dict[str, str], OrderedDict]
] = ...,
where: Optional[List[str]] = ...,
params: Optional[Union[List[int], List[str]]] = ...,
tables: Optional[List[str]] = ...,
@@ -255,7 +241,16 @@ class RawQuerySet:
raw_query: str,
model: Optional[Type[Model]] = ...,
query: Optional[RawQuery] = ...,
params: Any = ...,
params: Optional[
Union[
Dict[str, str],
List[datetime],
List[Decimal],
List[str],
Set[str],
Tuple,
]
] = ...,
translations: Optional[Dict[str, str]] = ...,
using: Optional[str] = ...,
hints: Optional[Dict[Any, Any]] = ...,
@@ -303,11 +298,8 @@ def prefetch_related_objects(
) -> None: ...
def get_prefetcher(
instance: Model, through_attr: str, to_attr: str
) -> Union[
Tuple[None, bool, bool, bool],
Tuple[GenericForeignKey, GenericForeignKey, bool, bool],
Tuple[ForwardManyToOneDescriptor, ForwardManyToOneDescriptor, bool, bool],
Tuple[ReverseOneToOneDescriptor, ReverseOneToOneDescriptor, bool, bool],
) -> Tuple[
GenericForeignKey, Union[GenericForeignKey, property], bool, bool
]: ...
def prefetch_one_level(
instances: List[Model],
@@ -331,7 +323,64 @@ class RelatedPopulator:
remote_setter: Callable = ...
def __init__(
self,
klass_info: Dict[str, Any],
klass_info: Dict[
str,
Union[
Callable,
List[
Dict[
str,
Union[
Callable,
List[
Dict[
str,
Union[
Callable,
List[
Dict[
str,
Union[
Callable,
List[
Dict[
str,
Union[
Callable,
List[int],
Type[Model],
bool,
ForeignKey,
],
]
],
List[int],
Type[Model],
bool,
ForeignKey,
],
]
],
List[int],
Type[Model],
bool,
ForeignKey,
],
]
],
List[int],
Type[Model],
bool,
ForeignKey,
],
]
],
List[int],
Type[Model],
bool,
FieldCacheMixin,
],
],
select: List[Tuple[Expression, Tuple[str, List[int]], Optional[str]]],
db: str,
) -> None: ...
@@ -340,54 +389,118 @@ class RelatedPopulator:
row: Union[
List[Optional[Union[date, int, str]]],
List[Union[date, Decimal, float, str]],
List[Union[datetime, time, Decimal, int, str]],
Tuple[int, Optional[str], Optional[str]],
Tuple[int, Union[int, str], Union[float, int, str]],
Tuple[int, int, None, None, int, str, str, None, None, None],
Tuple[str, int, int, int, str, int],
Tuple[Union[int, str], str, int],
],
from_obj: Model,
) -> None: ...
def get_related_populators(
klass_info: Union[
Dict[str, Any],
Dict[str, Union[List[Dict[str, Any]], List[int], Type[Model]]],
Dict[
str,
Union[
List[
Dict[
str,
Union[
Callable, List[int], Type[User], bool, ForeignKey
klass_info: Dict[
str,
Union[
Callable,
List[
Dict[
str,
Union[
Callable,
List[
Dict[
str,
Union[
Callable,
List[
Dict[
str,
Union[
Callable,
List[
Dict[
str,
Union[
Callable,
List[
Dict[
str,
Union[
Callable,
List[
Dict[
str,
Union[
Callable,
List[
Dict[
str,
Union[
Callable,
List[
int
],
Type[
Model
],
bool,
ForeignKey,
],
]
],
List[
int
],
Type[
Model
],
bool,
ForeignKey,
],
]
],
List[
int
],
Type[
Model
],
bool,
ForeignKey,
],
]
],
List[int],
Type[Model],
bool,
ForeignKey,
],
]
],
List[int],
Type[Model],
bool,
ForeignKey,
],
]
],
List[int],
Type[Model],
bool,
ForeignKey,
],
]
],
]
],
List[int],
Type[Model],
],
],
Dict[
str,
Union[
List[
Dict[
str,
Union[
Callable,
List[int],
Type[ContentType],
bool,
ForeignKey,
],
]
],
List[int],
Type[Permission],
List[int],
Type[Model],
bool,
FieldCacheMixin,
],
]
],
List[int],
Type[Model],
bool,
FieldCacheMixin,
],
],
select: List[Tuple[Expression, Optional[str], Optional[str]]],
select: List[Tuple[Expression, Tuple[str, List[bool]], Optional[str]]],
db: str,
) -> List[RelatedPopulator]: ...

View File

@@ -3,11 +3,13 @@ from typing import Any, Dict, Iterator, List, Optional, Set, Tuple, Type, Union
from django.db.backends.sqlite3.base import DatabaseWrapper
from django.db.models.base import Model
from django.db.models.expressions import Expression, F
from django.db.models.expressions import Expression
from django.db.models.fields import Field
from django.db.models.fields.mixins import FieldCacheMixin
from django.db.models.functions.datetime import TimezoneMixin
from django.db.models.lookups import BuiltinLookup, Lookup, Transform
from django.db.models.lookups import (FieldGetDbPrepValueMixin,
IntegerFieldFloatRounding, Lookup,
Transform)
from django.db.models.options import Options
from django.db.models.sql.compiler import SQLCompiler
from django.db.models.sql.query import Query
@@ -22,8 +24,8 @@ PathInfo = namedtuple(
class InvalidQuery(Exception): ...
def subclasses(
cls: Type[Union[Field, Transform]]
) -> Iterator[Type[Union[Field, Transform]]]: ...
cls: Type[RegisterLookupMixin]
) -> Iterator[Type[RegisterLookupMixin]]: ...
class QueryWrapper:
contains_aggregate: bool = ...
@@ -36,7 +38,8 @@ class QueryWrapper:
class Q(tree.Node):
children: Union[
List[Dict[str, str]],
List[Union[Tuple[str, Any], django.db.models.query_utils.Q]],
List[Tuple[str, Any]],
List[django.db.models.query_utils.Q],
]
connector: str
negated: bool
@@ -56,11 +59,7 @@ class Q(tree.Node):
summarize: bool = ...,
for_save: bool = ...,
) -> WhereNode: ...
def deconstruct(
self
) -> Tuple[
str, Tuple, Union[Dict[str, Union[bool, F]], Dict[str, str]]
]: ...
def deconstruct(self) -> Tuple[str, Tuple, Dict[str, str]]: ...
class DeferredAttribute:
field_name: str = ...
@@ -71,16 +70,33 @@ class DeferredAttribute:
class RegisterLookupMixin:
@classmethod
def get_lookups(cls) -> Dict[str, Type[Union[Lookup, Transform]]]: ...
def get_lookup(self, lookup_name: str) -> Optional[Type[Lookup]]: ...
def get_lookups(
cls
) -> Dict[str, Type[Union[TimezoneMixin, Lookup, Transform]]]: ...
def get_lookup(
self, lookup_name: str
) -> Optional[Type[Union[FieldGetDbPrepValueMixin, Lookup]]]: ...
def get_transform(self, lookup_name: str) -> Optional[Type[Transform]]: ...
@staticmethod
def merge_dicts(
dicts: Union[
List[Dict[str, Type[Union[TimezoneMixin, BuiltinLookup]]]],
List[Dict[str, Type[Union[Lookup, Transform]]]],
dicts: List[
Dict[
str,
Type[
Union[
TimezoneMixin,
FieldGetDbPrepValueMixin,
IntegerFieldFloatRounding,
Lookup,
Transform,
]
],
]
]
) -> Dict[str, Type[Union[Lookup, Transform]]]: ...
) -> Dict[
str,
Type[Union[TimezoneMixin, FieldGetDbPrepValueMixin, Lookup, Transform]],
]: ...
@classmethod
def register_lookup(
cls,
@@ -113,9 +129,7 @@ def select_related_descend(
) -> bool: ...
def refs_expression(
lookup_parts: List[str], annotations: OrderedDict
) -> Tuple[
Union[List[str], Tuple, Expression], Union[List[Any], List[str], Tuple]
]: ...
) -> Union[Tuple[bool, Tuple], Tuple[Expression, List[str]]]: ...
def check_rel_lookup_compatibility(
model: Type[Model], target_opts: Options, field: FieldCacheMixin
) -> bool: ...

View File

@@ -1,16 +1,19 @@
from datetime import date, datetime, time, timedelta
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 uuid import UUID
from django.contrib.contenttypes.models import ContentType
from django.db.backends.sqlite3.base import DatabaseWrapper
from django.db.backends.utils import CursorWrapper
from django.db.models.base import Model
from django.db.models.expressions import (BaseExpression, Col, Expression,
OrderBy, SQLiteNumericMixin)
OrderBy, RawSQL, SQLiteNumericMixin)
from django.db.models.fields import DateTimeCheckMixin, Field
from django.db.models.fields.mixins import FieldCacheMixin
from django.db.models.fields.related import ForeignKey
from django.db.models.functions.text import Lower
from django.db.models.options import Options
from django.db.models.sql.query import Query, RawQuery
@@ -39,42 +42,23 @@ class SQLCompiler:
def pre_sql_setup(
self
) -> Tuple[
Union[
List[Tuple[OrderBy, Tuple[str, Tuple[str, str], bool]]],
List[Tuple[str, List[int]]],
List[Tuple[str, Union[List[float], List[str]]]],
],
Union[
List[Tuple[OrderBy, Tuple[str, List[Any], bool]]],
List[Tuple[str, List[int]]],
List[Tuple[str, Union[List[float], List[str]]]],
],
Union[
List[Any],
List[Tuple[str, List[int]]],
List[Tuple[str, Union[List[float], List[str]]]],
List[
Tuple[OrderBy, Tuple[str, Union[List[Any], Tuple[str, str]]], None]
],
List[Tuple[OrderBy, Tuple[str, List[Union[int, str]], bool]]],
List[Tuple[str, List[float]]],
]: ...
def get_group_by(
self,
select: Union[
List[Tuple[BaseExpression, Optional[str], Optional[str]]],
List[Tuple[SQLiteNumericMixin, Tuple[str, List[int]], str]],
],
order_by: List[
select: List[
Tuple[
OrderBy,
Union[
Tuple[str, List[Any], bool],
Tuple[str, List[Union[int, str]], bool],
Tuple[str, List[int], bool],
Tuple[str, List[str], bool],
Tuple[str, Tuple, bool],
Tuple[str, Tuple[str, str], bool],
],
Union[BaseExpression, SQLiteNumericMixin],
Tuple[str, List[float]],
Optional[str],
]
],
) -> List[Tuple[str, Union[List[float], List[int], List[str]]]]: ...
order_by: List[Tuple[OrderBy, Tuple[str, List[Union[int, str]], bool]]],
) -> List[Tuple[str, List[float]]]: ...
def collapse_group_by(
self,
expressions: List[Expression],
@@ -83,59 +67,54 @@ class SQLCompiler:
def get_select(
self
) -> Tuple[
Optional[Dict[str, int]],
Union[Dict[Any, Any], Dict[str, int]],
Union[Dict[Any, Any], Dict[str, int]],
]: ...
def get_order_by(
self
) -> List[
Tuple[
OrderBy,
Union[
Tuple[str, List[Any], bool],
Tuple[str, List[Union[int, str]], bool],
Tuple[str, List[int], bool],
Tuple[str, List[str], bool],
Tuple[str, Tuple, bool],
],
]
]: ...
def get_extra_select(
self,
order_by: List[
List[
Tuple[
OrderBy,
Union[Expression, SQLiteNumericMixin],
Tuple[str, List[Union[int, str]]],
Optional[str],
]
],
Optional[
Dict[
str,
Union[
Tuple[str, List[Any], bool],
Tuple[str, List[Union[int, str]], bool],
Tuple[str, List[int], bool],
Tuple[str, List[str], bool],
Tuple[str, Tuple, bool],
List[
Dict[
str,
Union[
Callable,
List[int],
Type[ContentType],
bool,
ForeignKey,
],
]
],
List[int],
Type[Model],
],
]
],
select: Union[
List[Tuple[Expression, Optional[str], Optional[str]]],
List[Tuple[SQLiteNumericMixin, Tuple[str, List[int]], str]],
Dict[str, int],
]: ...
def get_order_by(
self
) -> List[Tuple[OrderBy, Tuple[str, List[Any], bool]]]: ...
def get_extra_select(
self,
order_by: List[Tuple[OrderBy, Tuple[str, List[Any], bool]]],
select: List[
Tuple[
Union[Expression, SQLiteNumericMixin],
Tuple[str, List[float]],
Optional[str],
]
],
) -> List[Tuple[OrderBy, Tuple[str, List[Any]], None]]: ...
def quote_name_unless_alias(self, name: str) -> str: ...
def compile(
self, node: Any, select_format: Any = ...
) -> Tuple[
str,
Union[
List[Optional[int]],
List[Union[date, int]],
List[Union[date, str]],
List[Union[Decimal, int]],
List[Union[int, memoryview]],
List[Union[int, str]],
List[float],
Tuple,
],
]: ...
) -> 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]]]: ...
@@ -156,12 +135,7 @@ class SQLCompiler:
alias: Optional[str] = ...,
default_order: str = ...,
already_seen: Optional[
Union[
Set[
Tuple[None, Tuple[Tuple[str, str]], Tuple[Tuple[str, str]]]
],
Set[Tuple[Tuple[Tuple[str, str]], Tuple[Tuple[str, str]]]],
]
Set[Tuple[Optional[Tuple[Tuple[str, str]]], Tuple[Tuple[str, str]]]]
] = ...,
) -> List[Tuple[OrderBy, bool]]: ...
def get_from_clause(self) -> Tuple[List[str], List[Union[int, str]]]: ...
@@ -175,14 +149,70 @@ class SQLCompiler:
Union[Dict[str, Dict[str, Dict[str, Dict[Any, Any]]]], bool]
] = ...,
restricted: Optional[bool] = ...,
) -> List[Dict[str, Any]]: ...
) -> List[
Dict[
str,
Union[
Callable,
List[
Dict[
str,
Union[
Callable,
List[
Dict[
str,
Union[
Callable,
List[
Dict[
str,
Union[
Callable,
List[
Dict[
str,
Union[
Callable,
List[int],
Type[Model],
bool,
ForeignKey,
],
]
],
List[int],
Type[Model],
bool,
ForeignKey,
],
]
],
List[int],
Type[Model],
bool,
ForeignKey,
],
]
],
List[int],
Type[Model],
bool,
ForeignKey,
],
]
],
List[int],
Type[Model],
bool,
FieldCacheMixin,
],
]
]: ...
def get_select_for_update_of_arguments(self): ...
def deferred_to_columns(self) -> Dict[Type[Model], Set[str]]: ...
def get_converters(
self,
expressions: Union[
List[Optional[Expression]], List[SQLiteNumericMixin]
],
self, expressions: Union[List[RawSQL], List[SQLiteNumericMixin]]
) -> Dict[
int, Tuple[List[Callable], Union[Expression, SQLiteNumericMixin]]
]: ...
@@ -194,27 +224,15 @@ class SQLCompiler:
],
) -> Iterator[
Union[
List[Optional[Union[bool, datetime, str, UUID]]],
List[Optional[Union[bytes, date, int, str]]],
List[Optional[Union[bytes, time, int, str]]],
List[Optional[Union[bytes, timedelta, int, str]]],
List[Optional[Union[bytes, Decimal, int, str]]],
List[Optional[Union[bytes, float, str]]],
List[Optional[Union[bytes, int, str, UUID]]],
List[Optional[Union[date, time, int, str]]],
List[Optional[Union[bytes, datetime, int, str]]],
List[Optional[Union[date, Decimal, float, str]]],
List[Union[date, time, timedelta, int, str]],
List[Union[datetime, time, Decimal, int, str]],
List[Union[timedelta, Decimal, int, str]],
List[Union[float, str, UUID]],
List[Optional[Union[datetime, float, str, UUID]]],
]
]: ...
def results_iter(
self,
results: Optional[
Union[
Iterator[Any], List[List[Tuple[Union[date, float, int, str]]]]
]
Union[Iterator[Any], List[List[Tuple[Union[int, str]]]]]
] = ...,
tuple_expected: bool = ...,
chunked_fetch: bool = ...,
@@ -235,16 +253,11 @@ class SQLCompiler:
class SQLInsertCompiler(SQLCompiler):
return_id: bool = ...
def field_as_sql(
self,
field: Optional[Field],
val: Optional[Union[Lower, float, memoryview, str]],
) -> Tuple[
str,
Union[List[None], List[float], List[int], List[memoryview], List[str]],
]: ...
self, field: Optional[Field], val: Optional[Union[Lower, float, str]]
) -> Tuple[str, Union[List[int], List[str]]]: ...
def prepare_value(
self, field: Field, value: Any
) -> Optional[Union[Lower, float, memoryview, str]]: ...
) -> Optional[Union[Lower, float, str]]: ...
def pre_save_val(self, field: Field, obj: Model) -> Any: ...
def assemble_as_sql(
self,
@@ -252,64 +265,10 @@ class SQLInsertCompiler(SQLCompiler):
List[None], List[DateTimeCheckMixin], List[Field], ImmutableList
],
value_rows: Union[
List[
Union[
List[Optional[Union[Lower, int]]],
List[Optional[Union[int, memoryview, str]]],
]
],
List[
Union[
List[Optional[Union[float, memoryview, str]]],
List[Optional[Union[int, memoryview, str]]],
]
],
List[List[Optional[Union[Lower, int]]]], List[List[Union[int, str]]]
],
) -> Tuple[
Union[
List[List[Optional[Union[float, str]]]],
List[List[Optional[Union[int, str]]]],
List[List[Union[int, memoryview]]],
Tuple[Tuple[str]],
],
Union[
List[List[Optional[Union[float, str]]]],
List[List[Optional[Union[int, str]]]],
List[
Union[
List[Optional[Union[float, memoryview, str]]],
List[Optional[Union[int, memoryview, str]]],
]
],
],
]: ...
def as_sql(
self
) -> List[
Tuple[
str,
Union[
List[Any],
List[None],
List[Optional[Union[bool, str]]],
List[Optional[Union[float, str]]],
List[Optional[Union[int, memoryview, str]]],
List[Optional[Union[int, str]]],
List[Optional[bool]],
List[Optional[int]],
List[Optional[str]],
List[Union[bool, str]],
List[Union[float, str]],
List[Union[int, str]],
List[bool],
List[float],
List[int],
List[memoryview],
List[str],
Tuple,
],
]
]: ...
) -> Tuple[Tuple[Tuple[str]], List[List[Optional[Union[int, str]]]]]: ...
def as_sql(self) -> List[Tuple[str, Tuple[Union[float, str]]]]: ...
def execute_sql(self, return_id: Optional[bool] = ...) -> Any: ...
class SQLDeleteCompiler(SQLCompiler):
@@ -329,4 +288,4 @@ def cursor_iter(
sentinel: List[Any],
col_count: Optional[int],
itersize: int,
) -> Iterator[List[Tuple[Any]]]: ...
) -> Iterator[List[Tuple[Union[date, int]]]]: ...

View File

@@ -42,7 +42,9 @@ class Join:
def as_sql(
self, compiler: SQLCompiler, connection: DatabaseWrapper
) -> Tuple[str, List[Union[int, str]]]: ...
def relabeled_clone(self, change_map: Dict[str, str]) -> Join: ...
def relabeled_clone(
self, change_map: Union[Dict[str, str], OrderedDict]
) -> Join: ...
def equals(
self, other: Union[BaseTable, Join], with_filtered_relation: bool
) -> bool: ...

View File

@@ -1,5 +1,5 @@
from collections import OrderedDict, namedtuple
from datetime import date, time, timedelta
from datetime import datetime
from decimal import Decimal
from typing import (Any, Callable, Dict, Iterator, List, Optional, Set, Tuple,
Type, Union)
@@ -14,9 +14,10 @@ from django.db.models.fields.mixins import FieldCacheMixin
from django.db.models.fields.related_lookups import MultiColSource
from django.db.models.fields.reverse_related import (ForeignObjectRel,
ManyToOneRel)
from django.db.models.lookups import (FieldGetDbPrepValueMixin, Lookup,
Transform)
from django.db.models.lookups import (FieldGetDbPrepValueMixin,
IntegerLessThan, Lookup, Transform)
from django.db.models.options import Options
from django.db.models.query import QuerySet
from django.db.models.query_utils import FilteredRelation, PathInfo, Q
from django.db.models.sql.compiler import SQLCompiler
from django.db.models.sql.datastructures import BaseTable, Join
@@ -43,7 +44,21 @@ class RawQuery:
cursor: Optional[django.db.backends.utils.CursorWrapper] = ...
extra_select: Dict[Any, Any] = ...
annotation_select: Dict[Any, Any] = ...
def __init__(self, sql: str, using: str, params: Any = ...) -> None: ...
def __init__(
self,
sql: str,
using: str,
params: Optional[
Union[
Dict[str, str],
List[datetime],
List[Decimal],
List[str],
Set[str],
Tuple[int],
]
] = ...,
) -> None: ...
def chain(self, using: str) -> RawQuery: ...
def clone(self, using: str) -> RawQuery: ...
def get_columns(self) -> List[str]: ...
@@ -54,21 +69,15 @@ class RawQuery:
class Query:
base_table: str
related_ids: None
related_updates: Union[
Dict[
Type[django.db.models.base.Model],
List[Tuple[django.db.models.fields.CharField, None, str]],
],
Dict[
Type[django.db.models.base.Model],
List[Tuple[django.db.models.fields.IntegerField, None, int]],
],
related_updates: Dict[
Type[django.db.models.base.Model],
List[Tuple[django.db.models.fields.Field, None, Union[int, str]]],
]
values: List[
Tuple[
django.db.models.fields.Field,
Union[django.db.models.aggregates.Max, int, str],
Union[django.db.models.aggregates.Max, int, str],
Optional[Type[django.db.models.base.Model]],
django.db.models.aggregates.Max,
]
]
alias_prefix: str = ...
@@ -118,7 +127,7 @@ class Query:
extra_select_mask: Optional[Set[str]] = ...
extra_tables: Tuple = ...
extra_order_by: Union[List[str], Tuple] = ...
deferred_loading: Tuple[bool, bool] = ...
deferred_loading: Tuple[Union[Set[str], frozenset], bool] = ...
explain_query: bool = ...
explain_format: Optional[str] = ...
explain_options: Dict[str, int] = ...
@@ -153,22 +162,19 @@ class Query:
def get_meta(self) -> Options: ...
def clone(self) -> Query: ...
def chain(self, klass: Optional[Type[Query]] = ...) -> Query: ...
def relabeled_clone(self, change_map: Dict[Any, Any]) -> Query: ...
def relabeled_clone(
self, change_map: Union[Dict[Any, Any], OrderedDict]
) -> Query: ...
def rewrite_cols(
self,
annotation: Union[Expression, FieldGetDbPrepValueMixin, WhereNode],
col_cnt: int,
) -> Tuple[int, int]: ...
) -> Tuple[Union[Expression, IntegerLessThan], int]: ...
def get_aggregation(
self,
using: str,
added_aggregate_names: Union[Dict[str, SQLiteNumericMixin], List[str]],
) -> Union[
Dict[str, Optional[int]],
Dict[str, Union[date, time]],
Dict[str, Union[Decimal, float]],
Dict[str, timedelta],
]: ...
) -> Dict[str, Optional[Union[datetime, Decimal, float]]]: ...
def get_count(self, using: str) -> int: ...
def has_filters(self) -> WhereNode: ...
def has_results(self, using: str) -> bool: ...
@@ -190,7 +196,9 @@ 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: Dict[Any, Any]) -> 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: ...
@@ -222,8 +230,7 @@ class Query:
def solve_lookup_type(
self, lookup: str
) -> Union[
Tuple[List[str], List[str], bool],
Tuple[List[str], Tuple, Union[Expression, SQLiteNumericMixin]],
Tuple[List[str], List[str], bool], Tuple[List[str], Tuple, Expression]
]: ...
def check_query_object_type(
self,
@@ -232,26 +239,31 @@ class Query:
field: FieldCacheMixin,
) -> None: ...
def check_related_objects(
self, field: Union[Field, ForeignObjectRel], value: Any, opts: Options
self,
field: Union[Field, reverse_related.ForeignObjectRel],
value: Any,
opts: Options,
) -> None: ...
def build_lookup(
self,
lookups: List[str],
lhs: Union[Expression, TextField, related_lookups.MultiColSource],
lhs: Union[Expression, TextField, MultiColSource],
rhs: Any,
) -> Lookup: ...
def try_transform(self, lhs: Expression, name: str) -> Transform: ...
def build_filter(
self,
filter_expr: Union[Dict[str, str], Tuple[str, Any]],
filter_expr: Union[Dict[str, str], Tuple[str, Tuple[int, int]]],
branch_negated: bool = ...,
current_negated: bool = ...,
can_reuse: Optional[Set[str]] = ...,
allow_joins: bool = ...,
split_subq: bool = ...,
reuse_with_filtered_relation: bool = ...,
) -> Tuple[WhereNode, Union[List[Any], Set[str], Tuple]]: ...
def add_filter(self, filter_clause: Tuple[str, Any]) -> None: ...
) -> Tuple[WhereNode, List[Any]]: ...
def add_filter(
self, filter_clause: Tuple[str, Union[List[int], List[str]]]
) -> None: ...
def add_q(self, q_object: Q) -> None: ...
def build_filtered_relation_q(
self,
@@ -269,11 +281,11 @@ class Query:
opts: Options,
allow_many: bool = ...,
fail_on_missing: bool = ...,
) -> Union[
Tuple[
List[PathInfo], Tuple[Field], List[str], Union[List[Any], List[str]]
],
Tuple[List[PathInfo], Field, Tuple[Field], List[str]],
) -> Tuple[
List[PathInfo],
Union[Field, reverse_related.ForeignObjectRel],
Tuple[Field],
List[str],
]: ...
def setup_joins(
self,
@@ -296,7 +308,7 @@ class Query:
) -> Expression: ...
def split_exclude(
self,
filter_expr: Tuple[str, Any],
filter_expr: Tuple[str, Union[QuerySet, int]],
can_reuse: Set[str],
names_with_path: List[Tuple[str, List[PathInfo]]],
) -> Tuple[WhereNode, Tuple]: ...
@@ -325,7 +337,7 @@ class Query:
def add_select_related(self, fields: Tuple[str]) -> None: ...
def add_extra(
self,
select: Optional[Union[Dict[str, int], Dict[str, str]]],
select: Optional[Union[Dict[str, int], Dict[str, str], OrderedDict]],
select_params: Optional[Union[List[int], List[str], Tuple[int]]],
where: Optional[List[str]],
params: Optional[List[str]],
@@ -340,7 +352,7 @@ class Query:
self,
target: Dict[Type[Model], Set[str]],
model: Type[Model],
fields: Union[Set[Field], Set[ManyToOneRel]],
fields: Union[Set[Field], Set[reverse_related.ManyToOneRel]],
) -> None: ...
def set_annotation_mask(
self, names: Optional[Union[List[str], Set[str], Tuple]]
@@ -349,9 +361,9 @@ class Query:
def set_extra_mask(self, names: Union[List[str], Tuple]) -> None: ...
def set_values(self, fields: Union[List[str], Tuple]) -> None: ...
@property
def annotation_select(self) -> Dict[Any, Any]: ...
def annotation_select(self) -> Union[Dict[Any, Any], OrderedDict]: ...
@property
def extra_select(self) -> Dict[Any, Any]: ...
def extra_select(self) -> Union[Dict[Any, Any], OrderedDict]: ...
def trim_start(
self, names_with_path: List[Tuple[str, List[PathInfo]]]
) -> Tuple[str, bool]: ...

View File

@@ -1,9 +1,7 @@
from datetime import datetime
from typing import Any, Dict, List, Optional, Tuple, Type, Union
from uuid import UUID
from django.db.models.base import Model
from django.db.models.expressions import Combinable
from django.db.models.expressions import Case
from django.db.models.fields import DateTimeCheckMixin, Field
from django.db.models.query import QuerySet
from django.db.models.sql.query import Query
@@ -51,7 +49,10 @@ class DeleteQuery(Query):
values_select: Tuple
where_class: Type[django.db.models.sql.where.WhereNode]
compiler: str = ...
alias_map: Dict[str, django.db.models.sql.datastructures.BaseTable] = ...
alias_map: Union[
Dict[str, django.db.models.sql.datastructures.BaseTable],
collections.OrderedDict,
] = ...
where: django.db.models.sql.where.WhereNode = ...
def do_query(self, table: str, where: WhereNode, using: str) -> int: ...
def delete_batch(
@@ -87,15 +88,9 @@ class UpdateQuery(Query):
model: Type[django.db.models.base.Model]
order_by: Tuple
related_ids: Optional[List[int]]
related_updates: Union[
Dict[
Type[django.db.models.base.Model],
List[Tuple[django.db.models.fields.CharField, None, str]],
],
Dict[
Type[django.db.models.base.Model],
List[Tuple[django.db.models.fields.IntegerField, None, int]],
],
related_updates: Dict[
Type[django.db.models.base.Model],
List[Tuple[django.db.models.fields.Field, None, Union[int, str]]],
]
select: Tuple
select_for_update: bool
@@ -108,7 +103,13 @@ class UpdateQuery(Query):
subquery: bool
table_map: Dict[str, List[str]]
used_aliases: Set[str]
values: List[Tuple[django.db.models.fields.Field, Any, Any]]
values: List[
Tuple[
django.db.models.fields.Field,
Optional[Type[django.db.models.base.Model]],
Union[django.db.models.expressions.Case, uuid.UUID],
]
]
values_select: Tuple
where_class: Type[django.db.models.sql.where.WhereNode]
compiler: str = ...
@@ -116,24 +117,11 @@ class UpdateQuery(Query):
def clone(self) -> UpdateQuery: ...
where: django.db.models.sql.where.WhereNode = ...
def update_batch(
self,
pk_list: List[int],
values: Union[Dict[str, None], Dict[str, int]],
using: str,
) -> None: ...
def add_update_values(
self,
values: Union[
Dict[str, None],
Dict[str, Union[bool, str]],
Dict[str, Union[datetime, str]],
Dict[str, Union[Model, int]],
Dict[str, Combinable],
Dict[str, UUID],
],
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, Any, Any]]
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]

View File

@@ -1,5 +1,4 @@
from datetime import date
from decimal import Decimal
from collections import OrderedDict
from typing import Any, Dict, List, Optional, Tuple, Union
from django.db import DefaultConnectionProxy
@@ -28,83 +27,24 @@ class WhereNode(tree.Node):
self,
compiler: SQLCompiler,
connection: Union[DefaultConnectionProxy, DatabaseWrapper],
) -> Tuple[
str,
Union[
List[Optional[int]],
List[Union[date, str]],
List[Union[Decimal, int]],
List[Union[int, str]],
List[float],
List[memoryview],
],
]: ...
) -> Tuple[str, List[Union[int, str]]]: ...
def get_group_by_cols(self) -> List[Expression]: ...
def get_source_expressions(self) -> List[FieldGetDbPrepValueMixin]: ...
children: Union[
List[
Union[
django.db.models.lookups.BuiltinLookup,
django.db.models.sql.where.ExtraWhere,
]
],
List[
Union[
django.db.models.lookups.BuiltinLookup,
django.db.models.sql.where.WhereNode,
]
],
List[
Union[
django.db.models.lookups.FieldGetDbPrepValueMixin,
django.db.models.lookups.IsNull,
]
],
List[
Union[
django.db.models.lookups.FieldGetDbPrepValueMixin,
django.db.models.query_utils.QueryWrapper,
]
],
List[
Union[
django.db.models.lookups.FieldGetDbPrepValueMixin,
django.db.models.sql.where.NothingNode,
]
],
List[
Union[
django.db.models.lookups.FieldGetDbPrepValueMixin,
django.db.models.sql.where.WhereNode,
]
],
List[
Union[
django.db.models.lookups.Lookup,
django.db.models.sql.where.NothingNode,
]
],
List[
Union[
django.db.models.sql.where.NothingNode,
django.db.models.sql.where.WhereNode,
]
],
List[
Union[
django.db.models.sql.where.SubqueryConstraint,
django.db.models.sql.where.WhereNode,
]
],
List[django.db.models.fields.related_lookups.RelatedLookupMixin],
children: List[
Union[
django.db.models.lookups.BuiltinLookup,
django.db.models.sql.where.WhereNode,
]
] = ...
def set_source_expressions(
self, children: List[FieldGetDbPrepValueMixin]
) -> None: ...
def relabel_aliases(self, change_map: Dict[Optional[str], str]) -> None: ...
def relabel_aliases(
self, change_map: Union[Dict[Optional[str], str], OrderedDict]
) -> None: ...
def clone(self) -> WhereNode: ...
def relabeled_clone(
self, change_map: Dict[Optional[str], str]
self, change_map: Union[Dict[Optional[str], str], OrderedDict]
) -> WhereNode: ...
def contains_aggregate(self) -> bool: ...
def contains_over_clause(self) -> bool: ...

View File

@@ -33,22 +33,20 @@ def load_backend(backend_name: str) -> Any: ...
class ConnectionDoesNotExist(Exception): ...
class ConnectionHandler:
databases: Union[
Dict[
str, Dict[str, Optional[Union[Dict[str, Optional[bool]], int, str]]]
],
Dict[
str, Dict[str, Optional[Union[Dict[str, Optional[str]], int, str]]]
],
databases: Dict[
str, Dict[str, Optional[Union[Dict[str, Optional[bool]], int, str]]]
]
def __init__(
self, databases: Dict[str, Dict[str, Union[Dict[str, str], str]]] = ...
) -> None: ...
def databases(
self
) -> Union[
Dict[str, Dict[str, Union[Dict[str, bool], str]]],
Dict[str, Dict[str, Union[Dict[str, str], str]]],
) -> Dict[
str,
Union[
Dict[str, Union[Dict[str, bool], str]],
Dict[str, Union[Dict[str, str], str]],
],
]: ...
def ensure_defaults(self, alias: str) -> None: ...
def prepare_test_settings(self, alias: str) -> None: ...

View File

@@ -32,7 +32,7 @@ class Signal:
def has_listeners(self, sender: Any = ...) -> bool: ...
def send(
self, sender: Any, **named: Any
) -> Union[List[Tuple[None, None]], List[Tuple[str, str]]]: ...
) -> List[Tuple[Callable, Optional[str]]]: ...
def send_robust(
self, sender: SimpleTestCase, **named: Any
) -> List[Tuple[Callable, Union[ValueError, str]]]: ...

View File

@@ -9,7 +9,7 @@ from django.core.files.uploadedfile import SimpleUploadedFile
from django.db.models.fields.files import FieldFile
from django.forms.boundfield import BoundField
from django.forms.forms import BaseForm
from django.forms.widgets import Input, Select, Widget
from django.forms.widgets import Input, Widget
class Field:
@@ -44,37 +44,33 @@ class Field:
label_suffix: Optional[Any] = ...
) -> None: ...
def prepare_value(self, value: Any) -> Any: ...
def to_python(self, value: Any) -> Any: ...
def to_python(
self,
value: Optional[Union[List[None], List[str], datetime, float, str]],
) -> Optional[Union[List[None], List[str], datetime, float, str]]: ...
def validate(self, value: Any) -> None: ...
def run_validators(self, value: Any) -> None: ...
def clean(self, value: Any) -> Any: ...
def bound_data(self, data: Any, initial: Any) -> Any: ...
def widget_attrs(self, widget: Widget) -> Dict[Any, Any]: ...
def has_changed(self, initial: Any, data: Optional[str]) -> bool: ...
def has_changed(
self,
initial: Optional[Union[datetime, Decimal, float, str]],
data: Optional[str],
) -> bool: ...
def get_bound_field(
self, form: BaseForm, field_name: str
) -> BoundField: ...
def __deepcopy__(
self,
memo: Union[
Dict[
int,
Union[
List[Tuple[str, str]],
List[Union[List[Tuple[str, str]], Field, Widget]],
OrderedDict,
Field,
Widget,
],
],
Dict[
int,
Union[
List[Union[List[Any], ChoiceField, Select]],
OrderedDict,
ChoiceField,
Select,
],
memo: Dict[
int,
Union[
List[Tuple[Union[int, str], str]],
List[Widget],
OrderedDict,
Field,
Widget,
],
],
) -> Field: ...
@@ -142,7 +138,7 @@ class IntegerField(Field):
) -> Optional[int]: ...
def widget_attrs(
self, widget: Widget
) -> Union[Dict[str, Decimal], Dict[str, float], Dict[str, int]]: ...
) -> Dict[str, Union[Decimal, float]]: ...
class FloatField(IntegerField):
disabled: bool
@@ -163,9 +159,7 @@ class FloatField(IntegerField):
self, value: Optional[Union[float, str]]
) -> Optional[float]: ...
def validate(self, value: Optional[float]) -> None: ...
def widget_attrs(
self, widget: Input
) -> Union[Dict[str, Union[float, str]], Dict[str, Union[int, str]]]: ...
def widget_attrs(self, widget: Input) -> Dict[str, Union[float, str]]: ...
class DecimalField(IntegerField):
decimal_places: Optional[int]
@@ -204,14 +198,14 @@ class DecimalField(IntegerField):
def validate(self, value: Optional[Decimal]) -> None: ...
def widget_attrs(
self, widget: Widget
) -> Union[Dict[str, Union[Decimal, str]], Dict[str, Union[int, str]]]: ...
) -> Dict[str, Union[Decimal, int, str]]: ...
class BaseTemporalField(Field):
input_formats: Any = ...
def __init__(
self, *, input_formats: Optional[Any] = ..., **kwargs: Any
) -> None: ...
def to_python(self, value: str) -> Union[date, time]: ...
def to_python(self, value: str) -> datetime: ...
def strptime(self, value: Any, format: Any) -> None: ...
class DateField(BaseTemporalField):
@@ -479,8 +473,8 @@ class ChoiceField(Field):
memo: Dict[
int,
Union[
List[Tuple[str, str]],
List[Union[List[Tuple[str, str]], Field, Widget]],
List[Tuple[Union[int, str], str]],
List[Widget],
OrderedDict,
Field,
Widget,
@@ -500,7 +494,7 @@ class TypedChoiceField(ChoiceField):
localize: bool
required: bool
show_hidden_initial: bool
coerce: Union[Callable, Type[Union[float, int, str]]] = ...
coerce: Union[Callable, Type[Union[bool, float, str]]] = ...
empty_value: Optional[str] = ...
def __init__(
self, *, coerce: Any = ..., empty_value: str = ..., **kwargs: Any
@@ -542,12 +536,12 @@ class TypedMultipleChoiceField(MultipleChoiceField):
localize: bool
required: bool
show_hidden_initial: bool
coerce: Union[Callable, Type[Union[float, int]]] = ...
coerce: Union[Callable, Type[float]] = ...
empty_value: Optional[List[Any]] = ...
def __init__(self, *, coerce: Any = ..., **kwargs: Any) -> None: ...
def clean(
self, value: List[str]
) -> Optional[Union[List[Decimal], List[float], List[int]]]: ...
) -> Optional[Union[List[bool], List[Decimal], List[float]]]: ...
def validate(self, value: List[str]) -> None: ...
class ComboField(Field):
@@ -584,41 +578,22 @@ class MultiValueField(Field):
) -> None: ...
def __deepcopy__(
self,
memo: Union[
Dict[
int,
Union[
List[Tuple[str, str]],
List[Union[List[Tuple[str, str]], Widget]],
OrderedDict,
Field,
Widget,
],
],
Dict[
int,
Union[List[Union[Field, Widget]], OrderedDict, Field, Widget],
],
memo: Dict[
int, Union[List[Tuple[str, str]], OrderedDict, Field, Widget]
],
) -> MultiValueField: ...
def validate(self, value: Union[datetime, str]) -> None: ...
def clean(
self,
value: Optional[
Union[
List[None],
List[Union[List[str], str]],
List[Union[date, time]],
datetime,
str,
]
Union[List[None], List[datetime], List[str], datetime, str]
],
) -> Optional[Union[datetime, str]]: ...
def compress(self, data_list: Any) -> None: ...
def has_changed(
self,
initial: Optional[Union[List[None], List[str], datetime, str]],
data: Union[List[None], List[Union[List[str], str]]],
data: Union[List[None], List[str]],
) -> bool: ...
class FilePathField(ChoiceField):
@@ -669,10 +644,7 @@ class SplitDateTimeField(MultiValueField):
**kwargs: Any
) -> None: ...
def compress(
self,
data_list: Union[
List[Optional[date]], List[Optional[time]], List[Union[date, time]]
],
self, data_list: List[Optional[datetime]]
) -> Optional[datetime]: ...
class GenericIPAddressField(CharField):

View File

@@ -1,18 +1,16 @@
from collections import OrderedDict
from datetime import date, datetime, time
from decimal import Decimal
from datetime import date, datetime
from typing import Any, Dict, Iterator, List, Optional, Tuple, Type, Union
from django.core.exceptions import ValidationError
from django.core.files.uploadedfile import SimpleUploadedFile
from django.db.models.base import Model
from django.db.models.fields.files import FieldFile
from django.db.models.query import QuerySet
from django.forms.boundfield import BoundField
from django.forms.fields import Field
from django.forms.models import ModelForm
from django.forms.utils import ErrorDict, ErrorList
from django.forms.widgets import Media, MediaDefiningClass
from django.http.request import QueryDict
from django.utils.datastructures import MultiValueDict
from django.utils.safestring import SafeText
@@ -22,7 +20,7 @@ class DeclarativeFieldsMetaclass(MediaDefiningClass):
name: str,
bases: Tuple[Type[BaseForm]],
attrs: OrderedDict,
) -> Type[Union[Form, ModelForm]]: ...
) -> Type[BaseForm]: ...
@classmethod
def __prepare__(
metacls: Any, name: str, bases: Tuple[Type[BaseForm]], **kwds: Any
@@ -47,22 +45,18 @@ class BaseForm:
self,
data: Optional[
Union[
Dict[str, Optional[Union[List[int], datetime, int, str]]],
Dict[str, Union[List[int], int, str]],
Dict[str, Union[List[str], str]],
Dict[str, Union[datetime, Decimal, int, str]],
QueryDict,
]
] = ...,
files: Optional[Dict[str, SimpleUploadedFile]] = ...,
files: Optional[
Union[Dict[str, SimpleUploadedFile], MultiValueDict]
] = ...,
auto_id: Optional[Union[bool, str]] = ...,
prefix: Optional[str] = ...,
initial: Optional[
Union[
Dict[str, List[int]],
Dict[str, Optional[Union[List[Model], date, int, str]]],
Dict[str, Union[List[Model], Model, QuerySet]],
Dict[str, Union[List[str], str]],
Dict[str, Union[FieldFile, int, str]],
]
Union[Dict[str, List[int]], Dict[str, date], Dict[str, str]]
] = ...,
error_class: Type[ErrorList] = ...,
label_suffix: None = ...,
@@ -91,12 +85,8 @@ class BaseForm:
def full_clean(self) -> None: ...
def clean(
self
) -> Union[
Dict[str, Optional[Union[int, str]]],
Dict[str, Union[date, time, Decimal, float]],
Dict[str, Union[date, str]],
Dict[str, SimpleUploadedFile],
Dict[str, QuerySet],
) -> Dict[
str, Optional[Union[datetime, SimpleUploadedFile, QuerySet, str]]
]: ...
def has_changed(self) -> bool: ...
def changed_data(self) -> List[str]: ...

View File

@@ -6,7 +6,9 @@ from django.forms import Form
class ManagementForm(Form):
auto_id: Union[bool, str]
cleaned_data: Dict[str, Optional[int]]
data: Dict[str, Union[List[int], int, str]]
data: Union[
Dict[str, Union[List[int], int, str]], django.http.request.QueryDict
]
empty_permitted: bool
error_class: Type[django.forms.utils.ErrorList]
fields: collections.OrderedDict

View File

@@ -8,10 +8,8 @@ from uuid import UUID
from django.contrib.auth.forms import UserChangeForm, UserCreationForm
from django.contrib.flatpages.forms import FlatpageForm
from django.core.files.base import File
from django.core.files.uploadedfile import SimpleUploadedFile
from django.db.models.base import Model
from django.db.models.fields.files import FieldFile
from django.db.models.manager import Manager
from django.db.models.query import QuerySet
from django.db.models.query_utils import Q
@@ -19,7 +17,9 @@ from django.forms.fields import CharField, ChoiceField, Field
from django.forms.forms import BaseForm, DeclarativeFieldsMetaclass
from django.forms.formsets import BaseFormSet
from django.forms.utils import ErrorList
from django.forms.widgets import Widget
from django.forms.widgets import Input, Widget
from django.http.request import QueryDict
from django.utils.datastructures import MultiValueDict
ALL_FIELDS: str
@@ -27,17 +27,12 @@ def model_to_dict(
instance: Model,
fields: Optional[Union[List[Union[Callable, str]], Tuple[str]]] = ...,
exclude: Optional[Union[List[Union[Callable, str]], Tuple[str]]] = ...,
) -> Union[
Dict[str, Optional[Union[List[Model], date, int, str]]],
Dict[str, Optional[FieldFile]],
Dict[str, Union[FieldFile, int, str]],
Dict[str, float],
]: ...
) -> Dict[str, Optional[Union[bool, date, float]]]: ...
def fields_for_model(
model: Type[Model],
fields: Optional[Union[List[Union[Callable, str]], Tuple]] = ...,
exclude: Optional[Union[List[Union[Callable, str]], Tuple]] = ...,
widgets: Optional[Dict[str, Union[Type[Widget], Widget]]] = ...,
widgets: Optional[Union[Dict[str, Type[Input]], Dict[str, Widget]]] = ...,
formfield_callback: Optional[Union[Callable, str]] = ...,
localized_fields: Optional[Union[Tuple[str], str]] = ...,
labels: Optional[Dict[str, str]] = ...,
@@ -53,11 +48,9 @@ class ModelFormOptions:
fields: Optional[Union[List[Union[Callable, str]], Tuple, str]] = ...
exclude: Optional[Union[List[Union[Callable, str]], Tuple, str]] = ...
widgets: Optional[
Dict[
str,
Union[
Type[django.forms.widgets.Widget], django.forms.widgets.Widget
],
Union[
Dict[str, Type[django.forms.widgets.Input]],
Dict[str, django.forms.widgets.Widget],
]
] = ...
localized_fields: Optional[Union[Tuple[str], str]] = ...
@@ -97,19 +90,15 @@ class BaseModelForm(BaseForm):
Dict[str, Optional[Union[List[int], datetime, int, str]]],
Dict[str, Union[List[str], str]],
Dict[str, Union[datetime, Decimal, int, str]],
QueryDict,
]
] = ...,
files: Optional[Dict[str, SimpleUploadedFile]] = ...,
files: Optional[
Union[Dict[str, SimpleUploadedFile], MultiValueDict]
] = ...,
auto_id: Union[bool, str] = ...,
prefix: None = ...,
initial: Optional[
Union[
Dict[str, List[int]],
Dict[str, Union[List[Model], Model, QuerySet]],
Dict[str, Union[List[str], str]],
Dict[str, int],
]
] = ...,
initial: Optional[Union[Dict[str, List[int]], Dict[str, int]]] = ...,
error_class: Type[ErrorList] = ...,
label_suffix: None = ...,
empty_permitted: bool = ...,
@@ -117,15 +106,7 @@ class BaseModelForm(BaseForm):
use_required_attribute: None = ...,
renderer: Any = ...,
) -> None: ...
def clean(
self
) -> Union[
Dict[str, Optional[Union[bool, datetime, QuerySet, str]]],
Dict[str, Optional[Union[date, Model, QuerySet, str]]],
Dict[str, Optional[Union[Model, int, str]]],
Dict[str, Union[datetime, Decimal, int, str]],
Dict[str, Union[File, str]],
]: ...
def clean(self) -> Dict[str, Any]: ...
def validate_unique(self) -> None: ...
save_m2m: Any = ...
def save(self, commit: bool = ...) -> Model: ...
@@ -282,7 +263,7 @@ class ModelChoiceIterator:
field: django.forms.models.ModelChoiceField = ...
queryset: Optional[django.db.models.query.QuerySet] = ...
def __init__(self, field: ModelChoiceField) -> None: ...
def __iter__(self) -> Iterator[Tuple[str, str]]: ...
def __iter__(self) -> Iterator[Tuple[Union[int, str], str]]: ...
def __len__(self) -> int: ...
def __bool__(self) -> bool: ...
def choice(self, obj: Model) -> Tuple[int, str]: ...
@@ -321,9 +302,7 @@ class ModelChoiceField(ChoiceField):
) -> None: ...
def get_limit_choices_to(
self
) -> Optional[
Union[Dict[str, Union[int, str]], Dict[str, datetime], Q, MagicMock]
]: ...
) -> Optional[Union[Dict[str, datetime], Q, MagicMock]]: ...
def __deepcopy__(
self,
memo: Dict[
@@ -359,87 +338,19 @@ class ModelMultipleChoiceField(ModelChoiceField):
default_error_messages: Any = ...
def __init__(self, queryset: QuerySet, **kwargs: Any) -> None: ...
def to_python(
self,
value: Union[
List[str],
Tuple[
int,
int,
int,
int,
int,
int,
int,
int,
int,
int,
int,
int,
int,
int,
int,
int,
int,
int,
int,
int,
int,
int,
int,
int,
int,
int,
int,
int,
int,
int,
int,
int,
int,
int,
int,
int,
int,
int,
int,
int,
int,
int,
int,
int,
int,
int,
int,
int,
int,
int,
],
],
self, value: Union[List[str], Tuple[int, ...]]
) -> List[Model]: ...
def clean(
self,
value: Optional[
Union[
List[Dict[str, str]],
List[List[str]],
List[Union[int, str]],
List[Model],
Tuple,
str,
List[Dict[str, str]], List[List[str]], List[Model], Tuple, str
]
],
) -> QuerySet: ...
def prepare_value(
self, value: Any
) -> Optional[
Union[
List[Dict[str, str]],
List[List[str]],
List[Union[int, str]],
int,
str,
]
]: ...
) -> Optional[Union[List[Dict[str, str]], List[List[str]], int, str]]: ...
def has_changed(
self,
initial: Optional[Union[List[Model], QuerySet, str]],

View File

@@ -1,6 +1,5 @@
from datetime import time
from decimal import Decimal
from typing import Any, Dict, List, Optional, Set, Tuple, Union
from typing import Any, Dict, List, Optional, Tuple, Union
from django.template.backends.base import BaseEngine
from django.template.backends.django import Template
@@ -15,68 +14,18 @@ class BaseRenderer:
def render(
self,
template_name: str,
context: Union[
Dict[
str,
context: Dict[
str,
Union[
Dict[
str,
Optional[
Union[
Dict[str, Union[bool, float, str]],
Dict[str, bool],
List[
Union[
Dict[
str,
Optional[
Union[
Dict[str, Union[bool, str]],
List[
Dict[
str,
Optional[
Union[
Dict[
str,
Union[
bool,
str,
],
],
bool,
str,
]
],
]
],
bool,
str,
]
],
],
Dict[
str,
Union[
Dict[str, Union[bool, str]],
List[
Tuple[
None,
List[
Dict[
str,
Union[
Dict[Any, Any],
bool,
str,
],
]
],
int,
]
],
bool,
str,
],
],
Dict[
str,
Optional[Union[Dict[str, str], bool, str]],
]
],
bool,
@@ -84,153 +33,55 @@ class BaseRenderer:
]
],
],
],
Dict[
str,
Dict[
str,
Optional[
Union[
Dict[str, Union[Decimal, int, str]],
List[
Dict[
str,
Optional[Union[Dict[str, str], bool, str]],
]
],
int,
str,
]
],
],
],
Dict[
str,
Dict[
str,
Union[
Dict[Any, Any],
List[
Tuple[
List[
Dict[str, Union[Dict[Any, Any], bool, str]]
],
int,
int,
]
],
List[str],
bool,
str,
],
],
],
Dict[
str,
Dict[
str,
Union[
Dict[Any, Any],
List[
Union[
Dict[
str,
Union[
Dict[Any, Any],
List[
Dict[
str,
Union[
Dict[Any, Any], bool, str
],
]
],
bool,
str,
],
],
Dict[
str,
Union[
Dict[str, bool],
List[
Tuple[
None,
List[
Dict[
str,
Union[
Dict[str, bool],
bool,
str,
],
]
],
int,
]
],
List[str],
bool,
str,
],
],
]
],
bool,
str,
],
],
],
Dict[
str,
Dict[
str,
Union[
Dict[Any, Any],
List[
Union[
Tuple[
None,
List[
Dict[
str,
Union[Dict[Any, Any], bool, str],
]
],
int,
],
Tuple[
str,
List[
Dict[
str,
Union[Dict[str, bool], bool, str],
]
],
int,
],
]
],
List[str],
bool,
str,
],
],
],
Dict[
str,
Dict[
str,
Union[
Dict[str, Union[bool, str]],
List[
Dict[
str,
Union[
Dict[str, Union[bool, str]],
List[
Tuple[
None,
List[
Dict[
str,
Union[
Dict[str, bool],
bool,
str,
],
]
],
int,
]
],
List[str],
bool,
str,
],
]
],
List[str],
bool,
str,
],
],
Dict[
str,
Union[
Dict[str, Union[int, str]],
List[
Tuple[
None,
Optional[str],
List[
Dict[
str,
Union[
Dict[str, Union[bool, str]],
time,
int,
str,
],
@@ -240,178 +91,10 @@ class BaseRenderer:
]
],
List[str],
bool,
int,
str,
],
],
],
Dict[
str,
Dict[
str,
Union[
Dict[str, Union[bool, str]],
List[
Union[
Dict[
str,
Union[
Dict[str, Union[bool, str]],
List[
Dict[
str,
Union[
Dict[str, Union[bool, str]],
bool,
str,
],
]
],
bool,
str,
],
],
Dict[
str,
Union[
Dict[str, Union[bool, str]],
List[
Tuple[
None,
List[
Dict[
str,
Union[
Dict[str, bool],
bool,
str,
],
]
],
int,
]
],
List[str],
bool,
str,
],
],
]
],
bool,
str,
],
],
],
Dict[
str,
Dict[
str,
Union[
Dict[str, Union[bool, str]],
List[
Union[
Tuple[
None,
List[
Dict[
str,
Union[Dict[str, bool], bool, str],
]
],
int,
],
Tuple[
str,
List[
Dict[
str,
Union[Dict[Any, Any], bool, str],
]
],
int,
],
]
],
List[str],
bool,
str,
],
],
],
Dict[
str,
Dict[
str,
Union[
Dict[str, Union[int, str]],
List[
Tuple[
None,
List[
Dict[
str,
Union[Dict[Any, Any], time, int, str],
]
],
int,
]
],
List[str],
bool,
str,
],
],
],
Dict[
str,
Dict[
str,
Union[
Dict[str, Union[int, str]],
List[
Tuple[
None,
List[
Dict[
str,
Union[
Dict[str, bool], Set[str], int, str
],
]
],
int,
]
],
List[str],
bool,
str,
],
],
],
Dict[
str,
Dict[
str,
Union[
Dict[str, bool],
List[
Tuple[
List[
Dict[str, Union[Dict[str, bool], bool, str]]
],
int,
int,
]
],
List[str],
bool,
str,
],
],
],
Dict[
str,
Dict[
str,
Union[
@@ -423,316 +106,6 @@ class BaseRenderer:
],
],
],
Dict[
str,
Dict[
str,
Union[
Dict[str, str],
List[
Tuple[
None,
List[
Dict[str, Union[Dict[str, str], int, str]]
],
int,
]
],
bool,
str,
],
],
],
Dict[
str,
Dict[
str,
Union[
Dict[str, str],
List[
Union[
Tuple[
None,
List[
Dict[
str,
Union[Dict[str, str], bool, str],
]
],
int,
],
Tuple[
str,
List[
Dict[
str,
Union[
Dict[str, Union[bool, str]],
bool,
str,
],
]
],
int,
],
]
],
List[str],
bool,
str,
],
],
],
Dict[
str,
Union[
Dict[
str,
Optional[
Union[
Dict[Any, Any],
List[
Dict[
str,
Optional[
Union[Dict[Any, Any], bool, str]
],
]
],
bool,
str,
]
],
],
List[Dict[str, str]],
],
],
Dict[
str,
Union[
Dict[
str,
Optional[
Union[
Dict[str, Union[bool, str]],
List[
Dict[
str,
Optional[
Union[
Dict[str, Union[bool, str]],
bool,
str,
]
],
]
],
bool,
str,
]
],
],
str,
],
],
Dict[
str,
Union[
Dict[
str,
Optional[
Union[
Dict[str, str],
List[
Dict[
str,
Optional[
Union[Dict[str, str], bool, str]
],
]
],
bool,
str,
]
],
],
str,
],
],
Dict[
str,
Union[
Dict[str, Optional[Union[Dict[str, str], bool, str]]],
List[Dict[str, str]],
],
],
Dict[
str,
Union[
Dict[
str,
Union[
Dict[Any, Any],
List[
Dict[
str,
Union[
Dict[Any, Any],
List[
Tuple[
None,
List[
Dict[
str,
Union[
Dict[str, bool],
bool,
str,
],
]
],
int,
]
],
List[str],
bool,
str,
],
]
],
List[str],
bool,
str,
],
],
str,
],
],
Dict[
str,
Union[
Dict[
str,
Union[
Dict[Any, Any],
List[Dict[str, Union[Dict[str, str], bool, str]]],
bool,
str,
],
],
str,
],
],
Dict[
str,
Union[
Dict[
str,
Union[
Dict[str, Union[bool, str]],
List[
Dict[
str,
Union[
Dict[str, Union[bool, str]], bool, str
],
]
],
bool,
str,
],
],
str,
],
],
Dict[
str,
Union[
Dict[
str,
Union[
Dict[str, str],
List[Dict[str, Union[Dict[str, str], bool, str]]],
List[str],
bool,
str,
],
],
str,
],
],
Dict[
str,
Union[
Dict[
str,
Union[
Dict[str, str],
List[
Tuple[
None,
List[
Dict[
str,
Union[Dict[str, str], bool, str],
]
],
int,
]
],
bool,
str,
],
],
str,
],
],
Dict[
str,
Union[
Dict[
str,
Union[
Dict[str, str],
List[
Union[
Tuple[
List[
Dict[
str,
Union[
Dict[str, str], bool, str
],
]
],
int,
int,
],
Tuple[
str,
List[
Dict[
str,
Union[
Dict[str, Union[bool, str]],
bool,
str,
],
]
],
int,
],
]
],
List[str],
bool,
str,
],
],
List[Dict[str, str]],
],
],
Dict[str, Union[bool, str]],
],
request: None = ...,
) -> str: ...

View File

@@ -7,9 +7,7 @@ from django.utils.safestring import SafeText
def pretty_name(name: str) -> str: ...
def flatatt(
attrs: Union[Dict[str, None], Dict[str, Union[bool, str]]]
) -> SafeText: ...
def flatatt(attrs: Dict[str, Optional[str]]) -> SafeText: ...
class ErrorDict(dict):
def as_data(self) -> Dict[str, List[ValidationError]]: ...
@@ -25,7 +23,9 @@ class ErrorList(UserList, list):
error_class: str = ...
def __init__(
self,
initlist: Optional[Union[List[ValidationError], List[str]]] = ...,
initlist: Optional[
Union[List[ValidationError], List[str], ErrorList]
] = ...,
error_class: Optional[str] = ...,
) -> None: ...
def as_data(self) -> List[ValidationError]: ...
@@ -36,7 +36,7 @@ class ErrorList(UserList, list):
def as_ul(self) -> str: ...
def as_text(self) -> str: ...
def __contains__(self, item: str) -> bool: ...
def __eq__(self, other: List[str]) -> bool: ...
def __eq__(self, other: Union[List[str], ErrorList]) -> bool: ...
def __getitem__(self, i: Union[int, str]) -> str: ...
def __reduce_ex__(
self, *args: Any, **kwargs: Any

File diff suppressed because it is too large Load Diff

View File

@@ -61,18 +61,6 @@ class Parser:
self
) -> Iterator[
Tuple[
str,
Dict[
str,
Tuple[
str,
Union[
Dict[str, Union[bytes, str]],
Dict[str, bytes],
Dict[str, str],
],
],
],
LazyStream,
str, Dict[str, Tuple[str, Dict[str, Union[bytes, str]]]], LazyStream
]
]: ...

View File

@@ -16,8 +16,8 @@ class HttpRequest:
get_host: Callable
sensitive_post_parameters: str
session: django.contrib.sessions.backends.db.SessionStore
GET: Dict[str, str] = ...
POST: Dict[str, str] = ...
GET: Union[Dict[str, str], django.http.request.QueryDict] = ...
POST: Union[Dict[str, str], django.http.request.QueryDict] = ...
COOKIES: Dict[str, str] = ...
META: Dict[str, Union[int, str]] = ...
FILES: django.utils.datastructures.MultiValueDict = ...

View File

@@ -289,7 +289,6 @@ class JsonResponse(HttpResponse):
self,
data: Union[
Dict[str, Dict[str, str]],
Dict[str, Union[Dict[str, bool], List[Dict[str, str]]]],
Dict[str, int],
Dict[str, str],
List[int],

View File

@@ -9,10 +9,7 @@ class UpdateCacheMiddleware(MiddlewareMixin):
cache_timeout: float = ...
key_prefix: str = ...
cache_alias: str = ...
cache: Union[
django.core.cache.DefaultCacheProxy,
django.core.cache.backends.base.BaseCache,
] = ...
cache: django.core.cache.backends.base.BaseCache = ...
get_response: Optional[Callable] = ...
def __init__(self, get_response: Optional[Callable] = ...) -> None: ...
def process_response(
@@ -22,10 +19,7 @@ class UpdateCacheMiddleware(MiddlewareMixin):
class FetchFromCacheMiddleware(MiddlewareMixin):
key_prefix: str = ...
cache_alias: str = ...
cache: Union[
django.core.cache.DefaultCacheProxy,
django.core.cache.backends.base.BaseCache,
] = ...
cache: django.core.cache.backends.base.BaseCache = ...
get_response: Optional[Callable] = ...
def __init__(self, get_response: Optional[Callable] = ...) -> None: ...
def process_request(

View File

@@ -1,11 +1,7 @@
from typing import Any, Callable, Dict, Optional, Tuple, Type, Union
from typing import Any, Callable, Dict, Optional, Tuple
from django.contrib.sitemaps import Sitemap
from django.core.exceptions import PermissionDenied, SuspiciousOperation
from django.http.multipartparser import MultiPartParserError
from django.http.request import HttpRequest
from django.http.response import (Http404, HttpResponseBase,
HttpResponseForbidden)
from django.http.response import HttpResponseBase, HttpResponseForbidden
from django.utils.deprecation import MiddlewareMixin
logger: Any
@@ -31,17 +27,7 @@ class CsrfViewMiddleware(MiddlewareMixin):
request: HttpRequest,
callback: Callable,
callback_args: Tuple,
callback_kwargs: Union[
Dict[str, Dict[str, Sitemap]],
Dict[str, Dict[str, str]],
Dict[str, None],
Dict[str, Union[Dict[str, Type[Sitemap]], str]],
Dict[str, Union[int, str]],
Dict[str, PermissionDenied],
Dict[str, SuspiciousOperation],
Dict[str, MultiPartParserError],
Dict[str, Http404],
],
callback_kwargs: Dict[str, Any],
) -> Optional[HttpResponseForbidden]: ...
def process_response(
self, request: HttpRequest, response: HttpResponseBase

View File

@@ -4,7 +4,6 @@ from django.core.handlers.wsgi import WSGIRequest
from django.db.models.base import Model
from django.db.models.manager import Manager
from django.db.models.query import QuerySet
from django.forms.forms import Form
from django.http.response import HttpResponse, HttpResponseRedirect
@@ -18,14 +17,7 @@ def render_to_response(
def render(
request: WSGIRequest,
template_name: Union[List[str], str],
context: Optional[
Union[
Dict[str, Optional[str]],
Dict[str, Union[Manager, QuerySet]],
Dict[str, Union[Form, str]],
Dict[str, bool],
]
] = ...,
context: Optional[Dict[str, bool]] = ...,
content_type: Optional[str] = ...,
status: Optional[int] = ...,
using: Optional[str] = ...,

View File

@@ -1,24 +1,9 @@
from datetime import datetime, time
from decimal import Decimal
from typing import (Any, Callable, Dict, Iterator, List, Optional, Set, Tuple,
Union)
from unittest.mock import MagicMock
from typing import Any, Dict, Iterator, Optional
from django.contrib.auth.forms import AuthenticationForm
from django.contrib.auth.views import LoginView
from django.contrib.sites.requests import RequestSite
from django.core.paginator import Page, Paginator
from django.db.models.base import Model
from django.db.models.manager import Manager
from django.db.models.query import QuerySet
from django.forms.forms import BaseForm
from django.http.request import HttpRequest
from django.template.base import Origin, Template
from django.template.context import Context
from django.template.exceptions import TemplateDoesNotExist
from django.utils.safestring import SafeText
from django.views.generic.base import TemplateResponseMixin
from django.views.generic.list import ListView
from .base import BaseEngine
@@ -29,25 +14,7 @@ class DjangoTemplates(BaseEngine):
name: str
app_dirname: str = ...
engine: django.template.engine.Engine = ...
def __init__(
self,
params: Union[
Dict[str, Union[Dict[str, Dict[str, str]], List[Any], bool, str]],
Dict[
str,
Union[
Dict[str, List[Tuple[str, Dict[str, str]]]],
List[Any],
bool,
str,
],
],
Dict[str, Union[Dict[str, List[str]], List[str], bool, str]],
Dict[str, Union[Dict[str, Tuple[str]], List[str], bool, str]],
Dict[str, Union[Dict[str, bool], List[Any], bool, str]],
Dict[str, Union[Dict[str, str], List[Any], bool, str]],
],
) -> None: ...
def __init__(self, params: Dict[str, Any]) -> None: ...
def from_string(self, template_code: str) -> Template: ...
def get_template(self, template_name: str) -> Template: ...
def get_templatetag_libraries(
@@ -63,829 +30,7 @@ class Template:
@property
def origin(self) -> Origin: ...
def render(
self,
context: Optional[
Union[
Dict[str, Any],
Dict[
str,
Dict[
str,
Optional[
Union[Dict[str, Union[bool, float, str]], bool, str]
],
],
],
Dict[
str,
Dict[
str,
Optional[
Union[
Dict[str, Union[Decimal, int, str]],
List[
Union[
Dict[
str,
Optional[
Union[
Dict[str, Union[bool, str]],
List[
Dict[
str,
Optional[
Union[
Dict[
str,
Union[
bool,
str,
],
],
bool,
str,
]
],
]
],
bool,
str,
]
],
],
Dict[
str,
Union[
Dict[str, Union[bool, str]],
List[
Tuple[
None,
List[
Dict[
str,
Union[
Dict[
Any, Any
],
bool,
str,
],
]
],
int,
]
],
bool,
str,
],
],
]
],
bool,
str,
]
],
],
],
Dict[
str,
Dict[
str,
Union[
Dict[Any, Any],
List[
Tuple[
List[
Dict[
str,
Union[Dict[Any, Any], bool, str],
]
],
int,
int,
]
],
List[str],
bool,
str,
],
],
],
Dict[
str,
Dict[
str,
Union[
Dict[Any, Any],
List[
Union[
Dict[
str,
Union[
Dict[Any, Any],
List[
Dict[
str,
Union[
Dict[Any, Any],
bool,
str,
],
]
],
bool,
str,
],
],
Dict[
str,
Union[
Dict[str, bool],
List[
Tuple[
None,
List[
Dict[
str,
Union[
Dict[str, bool],
bool,
str,
],
]
],
int,
]
],
List[str],
bool,
str,
],
],
]
],
bool,
str,
],
],
],
Dict[
str,
Dict[
str,
Union[
Dict[Any, Any],
List[
Union[
Tuple[
None,
List[
Dict[
str,
Union[
Dict[Any, Any], bool, str
],
]
],
int,
],
Tuple[
str,
List[
Dict[
str,
Union[
Dict[str, bool], bool, str
],
]
],
int,
],
]
],
List[str],
bool,
str,
],
],
],
Dict[
str,
Dict[
str,
Union[
Dict[str, Union[bool, str]],
List[
Union[
Dict[
str,
Union[
Dict[str, Union[bool, str]],
List[
Dict[
str,
Union[
Dict[
str,
Union[bool, str],
],
bool,
str,
],
]
],
bool,
str,
],
],
Dict[
str,
Union[
Dict[str, Union[bool, str]],
List[
Tuple[
None,
List[
Dict[
str,
Union[
Dict[str, bool],
bool,
str,
],
]
],
int,
]
],
List[str],
bool,
str,
],
],
]
],
bool,
str,
],
],
],
Dict[
str,
Dict[
str,
Union[
Dict[str, Union[bool, str]],
List[
Union[
Tuple[
None,
List[
Dict[
str,
Union[
Dict[str, bool], bool, str
],
]
],
int,
],
Tuple[
str,
List[
Dict[
str,
Union[
Dict[Any, Any], bool, str
],
]
],
int,
],
]
],
List[str],
bool,
str,
],
],
],
Dict[
str,
Dict[
str,
Union[
Dict[str, Union[int, str]],
List[
Dict[
str,
Union[
Dict[str, Union[bool, str]], bool, str
],
]
],
int,
str,
],
],
],
Dict[
str,
Dict[
str,
Union[
Dict[str, Union[int, str]],
List[
Tuple[
None,
List[
Dict[
str,
Union[
Dict[Any, Any], time, int, str
],
]
],
int,
]
],
List[str],
bool,
str,
],
],
],
Dict[
str,
Dict[
str,
Union[
Dict[str, Union[int, str]],
List[
Tuple[
None,
List[
Dict[
str,
Union[
Dict[str, bool],
Set[str],
int,
str,
],
]
],
int,
]
],
List[str],
bool,
str,
],
],
],
Dict[
str,
Dict[
str,
Union[
Dict[str, bool],
List[
Tuple[
List[
Dict[
str,
Union[Dict[str, bool], bool, str],
]
],
int,
int,
]
],
List[str],
bool,
str,
],
],
],
Dict[
str,
Dict[
str,
Union[
Dict[str, str],
List[Dict[str, Union[Dict[str, str], bool, str]]],
List[int],
bool,
str,
],
],
],
Dict[
str,
Dict[
str,
Union[
Dict[str, str],
List[
Tuple[
None,
List[
Dict[
str, Union[Dict[str, str], int, str]
]
],
int,
]
],
bool,
str,
],
],
],
Dict[
str,
Dict[
str,
Union[
Dict[str, str],
List[
Union[
Tuple[
None,
List[
Dict[
str,
Union[
Dict[str, str], bool, str
],
]
],
int,
],
Tuple[
str,
List[
Dict[
str,
Union[
Dict[str, Union[bool, str]],
bool,
str,
],
]
],
int,
],
]
],
List[str],
bool,
str,
],
],
],
Dict[
str, Optional[Union[List[Dict[str, str]], bool, ListView]]
],
Dict[str, Optional[str]],
Dict[str, Union[Callable, int]],
Dict[
str,
Union[
Dict[
str,
Optional[
Union[
Dict[Any, Any],
List[
Dict[
str,
Optional[
Union[Dict[Any, Any], bool, str]
],
]
],
bool,
str,
]
],
],
List[Dict[str, Optional[Union[datetime, Model, str]]]],
],
],
Dict[
str,
Union[
Dict[
str,
Optional[
Union[
Dict[str, Union[bool, str]],
List[
Dict[
str,
Optional[
Union[
Dict[str, Union[bool, str]],
bool,
str,
]
],
]
],
bool,
str,
]
],
],
str,
],
],
Dict[
str,
Union[
Dict[
str,
Optional[
Union[
Dict[str, Union[bool, str]],
List[
Dict[
str,
Optional[
Union[Dict[str, str], bool, str]
],
]
],
int,
str,
]
],
],
TemplateResponseMixin,
],
],
Dict[
str,
Union[
Dict[
str,
Optional[
Union[
Dict[str, str],
List[
Dict[
str,
Optional[
Union[Dict[str, str], bool, str]
],
]
],
bool,
str,
]
],
],
str,
],
],
Dict[
str,
Union[
Dict[str, Optional[Union[Dict[str, str], bool, str]]],
List[Dict[str, str]],
],
],
Dict[
str,
Union[
Dict[
str,
Union[
Dict[Any, Any],
List[
Dict[
str,
Union[
Dict[Any, Any],
List[
Tuple[
None,
List[
Dict[
str,
Union[
Dict[str, bool],
bool,
str,
],
]
],
int,
]
],
List[str],
bool,
str,
],
]
],
List[str],
bool,
str,
],
],
str,
],
],
Dict[
str,
Union[
Dict[
str,
Union[
Dict[Any, Any],
List[
Dict[str, Union[Dict[str, str], bool, str]]
],
bool,
str,
],
],
str,
],
],
Dict[
str,
Union[
Dict[
str,
Union[
Dict[str, Union[bool, str]],
List[
Dict[
str,
Union[
Dict[str, Union[bool, str]],
bool,
str,
],
]
],
bool,
str,
],
],
str,
],
],
Dict[
str,
Union[
Dict[
str,
Union[
Dict[str, Union[bool, str]],
List[
Tuple[
None,
List[
Dict[
str,
Union[
Dict[str, Union[bool, str]],
int,
str,
],
]
],
int,
]
],
List[str],
bool,
str,
],
],
str,
],
],
Dict[
str,
Union[
Dict[
str,
Union[
Dict[str, str],
List[
Dict[str, Union[Dict[str, str], bool, str]]
],
List[str],
bool,
str,
],
],
str,
],
],
Dict[
str,
Union[
Dict[
str,
Union[
Dict[str, str],
List[
Tuple[
None,
List[
Dict[
str,
Union[
Dict[str, str], bool, str
],
]
],
int,
]
],
bool,
str,
],
],
str,
],
],
Dict[
str,
Union[
Dict[
str,
Union[
Dict[str, str],
List[
Union[
Tuple[
List[
Dict[
str,
Union[
Dict[str, str],
bool,
str,
],
]
],
int,
int,
],
Tuple[
str,
List[
Dict[
str,
Union[
Dict[
str,
Union[bool, str],
],
bool,
str,
],
]
],
int,
],
]
],
List[str],
bool,
str,
],
],
List[Dict[str, str]],
],
],
Dict[
str,
Union[
List[Dict[str, str]], bool, Page, Paginator, ListView
],
],
Dict[str, Union[List[str], str]],
Dict[str, Union[bool, str]],
Dict[
str, Union[AuthenticationForm, LoginView, RequestSite, str]
],
Dict[str, Union[Model, BaseForm, TemplateResponseMixin, str]],
Dict[str, Union[Manager, QuerySet]],
Dict[str, Template],
Context,
MagicMock,
]
] = ...,
request: Optional[HttpRequest] = ...,
self, context: Any = ..., request: Optional[HttpRequest] = ...
) -> SafeText: ...
def copy_exception(

View File

@@ -52,7 +52,7 @@ class Template:
Dict[
str,
Optional[
Union[Dict[Any, Any], bool, str]
Union[Dict[str, str], bool, str]
],
]
],
@@ -67,12 +67,36 @@ class Template:
Dict[
str,
Union[
Dict[Any, Any],
Dict[str, int],
List[
Tuple[
Optional[str],
List[
Dict[
str,
Union[Dict[str, bool], bool, str],
]
],
int,
]
],
List[str],
bool,
str,
],
],
],
Dict[
str,
Dict[
str,
Union[
Dict[str, str],
List[
Dict[
str,
Union[
Dict[Any, Any],
Dict[str, str],
List[
Tuple[
None,
@@ -101,215 +125,6 @@ class Template:
],
],
],
Dict[
str,
Dict[
str,
Union[
Dict[Any, Any],
List[
Tuple[
List[
Dict[
str,
Union[Dict[Any, Any], bool, str],
]
],
int,
int,
]
],
List[str],
bool,
str,
],
],
],
Dict[
str,
Dict[
str,
Union[
Dict[Any, Any],
List[
Union[
Dict[
str,
Union[
Dict[Any, Any],
List[
Dict[
str,
Union[
Dict[Any, Any],
bool,
str,
],
]
],
bool,
str,
],
],
Dict[
str,
Union[
Dict[str, bool],
List[
Tuple[
None,
List[
Dict[
str,
Union[
Dict[str, bool],
bool,
str,
],
]
],
int,
]
],
List[str],
bool,
str,
],
],
]
],
bool,
str,
],
],
],
Dict[
str,
Dict[
str,
Union[
Dict[Any, Any],
List[
Union[
Tuple[
None,
List[
Dict[
str,
Union[
Dict[str, bool], bool, str
],
]
],
int,
],
Tuple[
str,
List[
Dict[
str,
Union[
Dict[Any, Any], bool, str
],
]
],
int,
],
]
],
List[str],
bool,
str,
],
],
],
Dict[
str,
Dict[
str,
Union[
Dict[str, bool],
List[
Tuple[
List[
Dict[
str,
Union[Dict[str, bool], bool, str],
]
],
int,
int,
]
],
List[str],
bool,
str,
],
],
],
Dict[
str,
Dict[
str,
Union[
Dict[str, bool],
List[
Tuple[
None,
List[
Dict[
str,
Union[Dict[str, bool], int, str],
]
],
int,
]
],
List[str],
bool,
str,
],
],
],
Dict[
str,
Dict[
str,
Union[
Dict[str, int],
List[
Tuple[
None,
List[
Dict[
str,
Union[
Dict[Any, Any], time, int, str
],
]
],
int,
]
],
List[str],
bool,
str,
],
],
],
Dict[
str,
Dict[
str,
Union[
Dict[str, str],
List[Dict[str, Union[Dict[str, str], bool, str]]],
List[str],
bool,
str,
],
],
],
Dict[
str,
Dict[
@@ -318,13 +133,14 @@ class Template:
Dict[str, str],
List[
Tuple[
None,
Optional[str],
List[
Dict[
str,
Union[
Dict[str, Union[bool, str]],
bool,
time,
int,
str,
],
]
@@ -338,154 +154,6 @@ class Template:
],
],
],
Dict[
str,
Dict[
str,
Union[
Dict[str, str],
List[
Tuple[
None,
List[
Dict[
str,
Union[Dict[str, bool], int, str],
]
],
int,
]
],
List[str],
bool,
str,
],
],
],
Dict[
str,
Dict[
str,
Union[
Dict[str, str],
List[
Union[
Tuple[
List[
Dict[
str,
Union[
Dict[str, str], bool, str
],
]
],
int,
int,
],
Tuple[
str,
List[
Dict[
str,
Union[
Dict[str, Union[bool, str]],
bool,
str,
],
]
],
int,
],
]
],
List[str],
bool,
str,
],
],
],
Dict[
str,
Dict[
str,
Union[
Dict[str, str],
List[
Union[
Tuple[
None,
List[
Dict[
str,
Union[
Dict[Any, Any], bool, str
],
]
],
int,
],
Tuple[
str,
List[
Dict[
str,
Union[
Dict[str, bool], bool, str
],
]
],
int,
],
]
],
List[str],
bool,
str,
],
],
],
Dict[
str,
Dict[
str,
Union[
Dict[str, str],
List[
Union[
Tuple[
None,
List[
Dict[
str,
Union[
Dict[str, str], bool, str
],
]
],
int,
],
Tuple[
str,
List[
Dict[
str,
Union[
Dict[str, Union[bool, str]],
bool,
str,
],
]
],
int,
],
]
],
List[str],
bool,
str,
],
],
],
Dict[str, TemplateView],
Dict[str, str],
]

View File

@@ -35,11 +35,9 @@ class TokenType(Enum):
class VariableDoesNotExist(Exception):
msg: str = ...
params: Union[Tuple[Dict[str, str]], Tuple[str, Any]] = ...
params: Tuple[Union[Dict[str, str], str]] = ...
def __init__(
self,
msg: str,
params: Union[Tuple[Dict[str, str]], Tuple[str, Any]] = ...,
self, msg: str, params: Tuple[Union[Dict[str, str], str]] = ...
) -> None: ...
class Origin:
@@ -158,10 +156,14 @@ class FilterExpression:
filters: List[
Tuple[
Callable,
Union[
List[Any],
List[Tuple[bool, django.template.base.Variable]],
List[Tuple[bool, django.utils.safestring.SafeText]],
List[
Tuple[
bool,
Union[
django.template.base.Variable,
django.utils.safestring.SafeText,
],
]
],
]
] = ...
@@ -191,11 +193,7 @@ class Variable:
def resolve(
self,
context: Union[
Dict[str, Dict[str, Union[int, str]]],
Dict[str, Union[int, str]],
Context,
int,
str,
Dict[str, Dict[str, Union[int, str]]], Context, int, str
],
) -> Any: ...

View File

@@ -1,18 +1,22 @@
from itertools import cycle
from typing import Any, Dict, Iterator, List, Optional, Union
from typing import Any, Callable, Dict, Iterator, List, Optional, Type, Union
from django.contrib.admin.templatetags.base import InclusionAdminNode
from django.core.handlers.wsgi import WSGIRequest
from django.contrib.admin.templatetags.admin_list import ResultList
from django.contrib.admin.views.main import ChangeList
from django.db.models.base import Model
from django.db.models.options import Options
from django.forms.boundfield import BoundField
from django.http.request import HttpRequest
from django.template.base import Node, Origin, Template
from django.template.defaulttags import CycleNode
from django.template.defaulttags import CycleNode, IfChangedNode
from django.template.library import InclusionNode
from django.template.loader_tags import BlockContext
from django.utils.functional import SimpleLazyObject
class ContextPopException(Exception): ...
class ContextDict(dict):
context: Any = ...
context: django.template.context.BaseContext = ...
def __init__(
self, context: BaseContext, *args: Any, **kwargs: Any
) -> None: ...
@@ -25,26 +29,51 @@ class BaseContext:
def __iter__(self) -> None: ...
def push(self, *args: Any, **kwargs: Any) -> ContextDict: ...
def pop(self) -> ContextDict: ...
def __setitem__(self, key: Union[str, Node], value: Any) -> None: ...
def set_upward(self, key: Any, value: Any) -> None: ...
def __getitem__(self, key: str) -> Any: ...
def __setitem__(self, key: Union[Node, str], value: Any) -> None: ...
def set_upward(self, key: str, value: Union[int, str]) -> None: ...
def __getitem__(self, key: Union[int, str]) -> Any: ...
def __delitem__(self, key: Any) -> None: ...
def __contains__(self, key: str) -> bool: ...
def get(
self, key: str, otherwise: Optional[int] = ...
) -> Union[SimpleLazyObject, int]: ...
) -> Optional[Union[Options, int, str]]: ...
def setdefault(
self, key: str, default: List[Origin] = ...
) -> List[Origin]: ...
def new(self, values: Any = ...) -> RequestContext: ...
def flatten(self): ...
def __eq__(self, other: Any): ...
self,
key: Union[IfChangedNode, str],
default: Optional[Union[List[Origin], int]] = ...,
) -> Optional[Union[List[Origin], int]]: ...
def new(
self,
values: Optional[
Union[
Dict[
str,
Union[
List[Dict[str, Union[int, str]]],
List[ResultList],
List[BoundField],
ChangeList,
int,
],
],
Dict[str, Union[List[Dict[str, str]], ChangeList, int, str]],
Dict[str, Union[ChangeList, int, range, str]],
Context,
]
] = ...,
) -> Context: ...
def flatten(
self
) -> Dict[
str, Optional[Union[Dict[str, Union[Type[Any], str]], int, str]]
]: ...
def __eq__(self, other: Context) -> bool: ...
class Context(BaseContext):
dicts: List
dicts: Any
autoescape: bool = ...
use_l10n: Optional[bool] = ...
use_tz: None = ...
use_tz: Optional[bool] = ...
template_name: Optional[str] = ...
render_context: django.template.context.RenderContext = ...
template: Optional[django.template.base.Template] = ...
@@ -52,54 +81,36 @@ class Context(BaseContext):
self,
dict_: Any = ...,
autoescape: bool = ...,
use_l10n: None = ...,
use_l10n: Optional[bool] = ...,
use_tz: None = ...,
) -> None: ...
def bind_template(self, template: Template) -> Iterator[None]: ...
def __copy__(self) -> Context: ...
def update(self, other_dict: Dict[str, Any]) -> ContextDict: ...
def update(
self,
other_dict: Union[
Dict[str, Model], Dict[str, int], Dict[str, str], Context
],
) -> ContextDict: ...
class RenderContext(BaseContext):
dicts: Union[
List[
Dict[
Union[str, django.template.loader_tags.IncludeNode],
Union[bool, None, Dict[str, django.template.base.Template]],
]
],
List[
Union[
Dict[
Union[str, django.template.loader_tags.IncludeNode],
Union[bool, None, Dict[Any, Any]],
],
django.template.context.ContextDict,
]
],
List[
Union[
Dict[str, Union[bool, None]],
Dict[str, str],
django.template.context.ContextDict,
]
],
]
dicts: List[Dict[Union[django.template.loader_tags.IncludeNode, str], str]]
template: Optional[django.template.base.Template] = ...
def __iter__(self) -> None: ...
def __contains__(self, key: Union[str, CycleNode]) -> bool: ...
def __contains__(self, key: Union[CycleNode, str]) -> bool: ...
def get(
self, key: Union[str, InclusionAdminNode], otherwise: None = ...
) -> Optional[Union[BlockContext, Template]]: ...
self, key: Union[InclusionNode, str], otherwise: None = ...
) -> Optional[Union[Template, BlockContext]]: ...
def __getitem__(
self, key: Union[str, CycleNode]
) -> Union[List[Origin], BlockContext, cycle]: ...
self, key: Union[Node, str]
) -> Optional[Union[List[Origin], BlockContext, cycle]]: ...
def push_state(
self, template: Template, isolated_context: bool = ...
) -> Iterator[None]: ...
class RequestContext(Context):
autoescape: bool
dicts: List
dicts: List[Dict[str, str]]
render_context: django.template.context.RenderContext
template_name: Optional[str]
use_l10n: None
@@ -107,17 +118,39 @@ class RequestContext(Context):
request: django.http.request.HttpRequest = ...
def __init__(
self,
request: WSGIRequest,
dict_: None = ...,
processors: None = ...,
request: HttpRequest,
dict_: Optional[
Dict[str, Union[Dict[str, Union[Type[Any], str]], str]]
] = ...,
processors: Optional[List[Callable]] = ...,
use_l10n: None = ...,
use_tz: None = ...,
autoescape: bool = ...,
) -> None: ...
template: Optional[django.template.base.Template] = ...
def bind_template(self, template: Template) -> Iterator[None]: ...
def new(self, values: Any = ...) -> RequestContext: ...
def new(
self,
values: Optional[
Union[
Dict[str, Union[Dict[str, str], List[Dict[str, str]], bool]],
Dict[str, Union[List[Any], ChangeList, int, str]],
Dict[
str,
Union[
List[Dict[str, Optional[Union[int, str]]]],
List[ResultList],
List[BoundField],
ChangeList,
int,
],
],
Dict[str, Union[ChangeList, int, range, str]],
Context,
]
] = ...,
) -> RequestContext: ...
def make_context(
context: Dict[str, Any], request: Optional[WSGIRequest] = ..., **kwargs: Any
context: Any, request: Optional[HttpRequest] = ..., **kwargs: Any
) -> Context: ...

View File

@@ -1,8 +1,7 @@
from datetime import date, time, timedelta
from datetime import date, datetime, timedelta
from decimal import Decimal
from typing import Any, Callable, Dict, Iterator, List, Optional, Tuple, Union
from django.db.models.query import QuerySet
from django.utils.safestring import SafeText
from .base import Variable, VariableDoesNotExist
@@ -52,7 +51,7 @@ def dictsort(
value: Union[
Dict[str, int],
List[Dict[str, Dict[str, Union[int, str]]]],
List[Dict[str, Union[int, str]]],
List[Dict[str, str]],
List[Tuple[str, str]],
List[int],
int,
@@ -61,7 +60,7 @@ def dictsort(
arg: Union[int, str],
) -> Union[
List[Dict[str, Dict[str, Union[int, str]]]],
List[Dict[str, Union[int, str]]],
List[Dict[str, str]],
List[Tuple[str, str]],
str,
]: ...
@@ -79,21 +78,17 @@ def dictsortreversed(
def first(value: Union[List[int], List[str], str]) -> Union[int, str]: ...
def join(value: Any, arg: str, autoescape: bool = ...) -> Any: ...
def last(value: List[str]) -> str: ...
def length(
value: Optional[
Union[
List[Optional[Union[Dict[Any, Any], int, str]]], QuerySet, int, str
]
]
) -> int: ...
def length_is(value: Any, arg: Union[SafeText, int]) -> Union[bool, str]: ...
def length(value: Any) -> int: ...
def length_is(
value: Optional[Union[List[Callable], Tuple[str, str], int, str]],
arg: Union[SafeText, int],
) -> Union[bool, str]: ...
def random(value: List[str]) -> str: ...
def slice_filter(value: Any, arg: str) -> Any: ...
def unordered_list(
value: Union[
Iterator[Any],
List[Union[List[Union[List[Union[List[str], str]], str]], str]],
List[Union[List[Union[List[str], str]], str]],
],
autoescape: bool = ...,
) -> SafeText: ...
@@ -103,10 +98,10 @@ def add(
) -> Union[List[int], Tuple[int, int, int, int], date, int, str]: ...
def get_digit(value: Union[int, str], arg: int) -> Union[int, str]: ...
def date(
value: Optional[Union[date, time, str]], arg: Optional[str] = ...
value: Optional[Union[datetime, str]], arg: Optional[str] = ...
) -> str: ...
def time(
value: Optional[Union[date, time, str]], arg: Optional[str] = ...
value: Optional[Union[datetime, str]], arg: Optional[str] = ...
) -> str: ...
def timesince_filter(
value: Optional[date], arg: Optional[date] = ...

View File

@@ -84,15 +84,15 @@ class ForNode(Node):
token: django.template.base.Token
child_nodelists: Any = ...
is_reversed: bool = ...
nodelist_loop: List[str] = ...
nodelist_empty: List[str] = ...
nodelist_loop: Union[List[str], django.template.base.NodeList] = ...
nodelist_empty: Union[List[str], django.template.base.NodeList] = ...
def __init__(
self,
loopvars: Union[List[str], str],
sequence: Union[FilterExpression, str],
is_reversed: bool,
nodelist_loop: List[str],
nodelist_empty: Optional[List[str]] = ...,
nodelist_loop: Union[List[str], NodeList],
nodelist_empty: Optional[Union[List[str], NodeList]] = ...,
) -> None: ...
def render(self, context: Context) -> SafeText: ...
@@ -108,8 +108,8 @@ class IfChangedNode(Node):
def render(self, context: Context) -> str: ...
class IfEqualNode(Node):
nodelist_false: List[Any]
nodelist_true: List[Any]
nodelist_false: Union[List[Any], django.template.base.NodeList]
nodelist_true: Union[List[Any], django.template.base.NodeList]
origin: django.template.base.Origin
token: django.template.base.Token
var1: Union[django.template.base.FilterExpression, str]
@@ -120,8 +120,8 @@ class IfEqualNode(Node):
self,
var1: Union[FilterExpression, str],
var2: Union[FilterExpression, str],
nodelist_true: List[Any],
nodelist_false: List[Any],
nodelist_true: Union[List[Any], NodeList],
nodelist_false: Union[List[Any], NodeList],
negate: bool,
) -> None: ...
def render(self, context: Context) -> SafeText: ...
@@ -130,10 +130,14 @@ class IfNode(Node):
origin: django.template.base.Origin
token: django.template.base.Token
conditions_nodelists: List[
Tuple[django.template.base.NodeList, django.template.base.NodeList]
Tuple[
Optional[django.template.defaulttags.TemplateLiteral],
django.template.base.NodeList,
]
] = ...
def __init__(
self, conditions_nodelists: List[Tuple[NodeList, NodeList]]
self,
conditions_nodelists: List[Tuple[Optional[TemplateLiteral], NodeList]],
) -> None: ...
def __iter__(self) -> None: ...
@property
@@ -166,13 +170,7 @@ class RegroupNode(Node):
var_name: str,
) -> None: ...
def resolve_expression(
self,
obj: Union[
Dict[str, Union[List[str], str]],
Dict[str, Union[int, str]],
Dict[str, date],
],
context: Context,
self, obj: Dict[str, date], context: Context
) -> Union[int, str]: ...
def render(self, context: Context) -> str: ...
@@ -255,15 +253,15 @@ class WidthRatioNode(Node):
class WithNode(Node):
origin: django.template.base.Origin
token: django.template.base.Token
nodelist: List[Any] = ...
extra_context: Union[
Dict[str, django.template.base.FilterExpression], Dict[str, str]
nodelist: Union[List[Any], django.template.base.NodeList] = ...
extra_context: Dict[
str, Union[django.template.base.FilterExpression, str]
] = ...
def __init__(
self,
var: Optional[str],
name: Optional[str],
nodelist: List[Any],
nodelist: Union[List[Any], NodeList],
extra_context: Optional[Dict[str, FilterExpression]] = ...,
) -> None: ...
def render(self, context: Context) -> Any: ...

View File

@@ -1,4 +1,3 @@
from datetime import date, time, timedelta
from typing import Any, Callable, Dict, List, Optional, Tuple, Union
from django.template.base import Origin, Template
@@ -23,19 +22,8 @@ class Engine:
debug: bool = ...
loaders: Union[
List[List[Union[Dict[str, str], str]]],
List[
Union[
Tuple[
str,
Union[
Dict[str, str],
List[Tuple[str, Dict[str, str]]],
List[str],
],
],
str,
]
],
List[Tuple[str, List[str]]],
List[str],
] = ...
string_if_invalid: str = ...
file_charset: str = ...
@@ -52,19 +40,8 @@ class Engine:
loaders: Optional[
Union[
List[List[Union[Dict[str, str], str]]],
List[
Union[
Tuple[
str,
Union[
Dict[str, str],
List[Tuple[str, Dict[str, str]]],
List[str],
],
],
str,
]
],
List[Tuple[str, List[str]]],
List[str],
]
] = ...,
string_if_invalid: str = ...,
@@ -85,32 +62,14 @@ class Engine:
self,
template_loaders: Union[
List[List[Union[Dict[str, str], str]]],
List[
Union[
Tuple[
str,
Union[
Dict[str, str],
List[Tuple[str, Dict[str, str]]],
List[str],
],
],
str,
]
],
List[Tuple[str, List[str]]],
List[str],
],
) -> List[Loader]: ...
def find_template_loader(
self,
loader: Union[
List[Union[Dict[str, str], str]],
Tuple[
str,
Union[
Dict[str, str], List[Tuple[str, Dict[str, str]]], List[str]
],
],
str,
List[Union[Dict[str, str], str]], Tuple[str, List[str]], str
],
) -> Loader: ...
def find_template(
@@ -119,62 +78,6 @@ class Engine:
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[
Union[
Dict[str, Callable],
Dict[str, Dict[Union[int, str], str]],
Dict[str, Dict[str, Callable]],
Dict[str, Dict[str, Dict[str, str]]],
Dict[str, Dict[str, List[Tuple[str, int]]]],
Dict[str, Dict[str, Tuple[str, str, str, str]]],
Dict[str, List[Dict[str, Union[List[int], int]]]],
Dict[str, List[Dict[str, Union[int, str]]]],
Dict[str, List[List[Tuple[int, str]]]],
Dict[str, List[Union[List[SafeText], str]]],
Dict[str, List[Template]],
Dict[str, Optional[int]],
Dict[str, Optional[str]],
Dict[
str, Tuple[Dict[str, str], Dict[str, str], Dict[str, str]]
],
Dict[
str,
Tuple[
Tuple[str, Union[int, str]], Tuple[str, Union[int, str]]
],
],
Dict[str, Tuple[int, int]],
Dict[str, Tuple[str, str]],
Dict[str, Union[Dict[str, int], List[Union[List[str], str]]]],
Dict[str, Union[Dict[str, int], str]],
Dict[
str,
Union[
List[
Optional[
Union[
Dict[str, Union[List[str], str]], int, str
]
]
],
str,
],
],
Dict[
str,
Union[
List[Optional[Union[Dict[str, date], int, str]]], int
],
],
Dict[str, Union[date, timedelta]],
Dict[str, Union[int, str]],
Dict[str, time],
Dict[str, Template],
Dict[str, float],
Dict[str, range],
]
] = ...,
self, template_name: str, context: Any = ...
) -> SafeText: ...
def select_template(self, template_name_list: List[str]) -> Template: ...

View File

@@ -55,10 +55,7 @@ class TagHelperNode(Node):
) -> None: ...
def get_resolved_arguments(
self, context: Context
) -> Tuple[
Union[Dict[str, Union[SafeText, int]], List[Union[Context, int]]],
Union[Dict[Any, Any], Dict[str, Union[SafeText, int]], Dict[str, int]],
]: ...
) -> Tuple[List[int], Dict[str, Union[SafeText, int]]]: ...
class SimpleNode(TagHelperNode):
args: List[django.template.base.FilterExpression]
@@ -102,7 +99,7 @@ def parse_bits(
params: List[str],
varargs: Optional[str],
varkw: Optional[str],
defaults: Optional[Union[Tuple[bool, None], Tuple[str]]],
defaults: Optional[Tuple[Union[bool, str]]],
kwonly: List[str],
kwonly_defaults: Optional[Dict[str, int]],
takes_context: Optional[bool],

View File

@@ -1,10 +1,6 @@
from typing import Any, Dict, List, Optional, Union
from django.contrib.auth.base_user import AbstractBaseUser
from django.core.handlers.wsgi import WSGIRequest
from django.db.models.manager import Manager
from django.db.models.query import QuerySet
from django.forms.forms import Form
from django.template.backends.django import Template
from django.template.backends.dummy import Template
from django.template.backends.jinja2 import Template
@@ -20,15 +16,7 @@ def select_template(
) -> Union[Template, Template, Template]: ...
def render_to_string(
template_name: Union[List[str], str],
context: Optional[
Union[
Dict[str, Optional[str]],
Dict[str, Union[AbstractBaseUser, str]],
Dict[str, Union[Manager, QuerySet]],
Dict[str, Union[Form, str]],
Dict[str, bool],
]
] = ...,
context: Optional[Union[Dict[str, bool], Dict[str, str]]] = ...,
request: Optional[WSGIRequest] = ...,
using: Optional[str] = ...,
) -> str: ...

View File

@@ -9,21 +9,8 @@ from .base import Loader as BaseLoader
class Loader(BaseLoader):
engine: django.template.engine.Engine
template_cache: Dict[Any, Any] = ...
get_template_cache: Union[
Dict[
str,
Union[
Type[django.template.exceptions.TemplateDoesNotExist],
django.template.base.Template,
],
],
Dict[
str,
Union[
django.template.base.Template,
django.template.exceptions.TemplateDoesNotExist,
],
],
get_template_cache: Dict[
str, django.template.exceptions.TemplateDoesNotExist
] = ...
loaders: List[django.template.loaders.base.Loader] = ...
def __init__(

View File

@@ -1,20 +1,14 @@
from datetime import datetime
from http.cookies import SimpleCookie
from typing import Any, Callable, Dict, List, Optional, Tuple, Union
from unittest.mock import MagicMock
from django.contrib.auth.forms import AuthenticationForm
from django.contrib.auth.views import LoginView
from django.contrib.sites.requests import RequestSite
from django.core.paginator import Page, Paginator
from django.db.models.base import Model
from django.forms.forms import BaseForm
from django.http import HttpResponse
from django.http.request import HttpRequest
from django.template.backends.django import Template
from django.template.backends.jinja2 import Template
from django.views.generic.base import TemplateResponseMixin
from django.views.generic.detail import DetailView
from django.views.generic.list import ListView
from .loader import get_template, select_template
@@ -29,42 +23,20 @@ class SimpleTemplateResponse(HttpResponse):
template_name: Union[
List[str], django.template.backends.django.Template, str
] = ...
context_data: Optional[
Union[Dict[str, Union[Callable, int]], Dict[str, str]]
] = ...
context_data: Optional[Dict[str, str]] = ...
using: Optional[str] = ...
def __init__(
self,
template: Union[List[str], Template, str],
context: Optional[
Union[
Dict[str, Any],
Dict[str, List[Dict[str, Any]]],
Dict[
str,
Optional[
Union[
List[
Dict[str, Optional[Union[datetime, Model, str]]]
],
bool,
ListView,
]
],
str, List[Dict[str, Optional[Union[datetime, Model, str]]]]
],
Dict[str, Union[Callable, int]],
Dict[str, Union[Dict[str, str], DetailView]],
Dict[
str,
Union[
List[Dict[str, str]], bool, Page, Paginator, ListView
],
],
Dict[str, Union[List[str], str]],
Dict[
str, Union[AuthenticationForm, LoginView, RequestSite, str]
],
Dict[str, Union[Model, BaseForm, TemplateResponseMixin, str]],
Dict[str, List[str]],
Dict[str, Model],
Dict[str, TemplateResponseMixin],
Dict[str, str],
MagicMock,
]
] = ...,
@@ -80,59 +52,23 @@ class SimpleTemplateResponse(HttpResponse):
self,
context: Optional[
Union[
Dict[str, Any],
Dict[str, List[Dict[str, Any]]],
Dict[
str,
Optional[
Union[
List[
Dict[str, Optional[Union[datetime, Model, str]]]
],
bool,
ListView,
]
],
str, List[Dict[str, Optional[Union[datetime, Model, str]]]]
],
Dict[str, Union[Callable, int]],
Dict[str, Union[Dict[str, str], DetailView]],
Dict[
str,
Union[
List[Dict[str, str]], bool, Page, Paginator, ListView
],
],
Dict[str, Union[List[str], str]],
Dict[
str, Union[AuthenticationForm, LoginView, RequestSite, str]
],
Dict[str, Union[Model, BaseForm, TemplateResponseMixin, str]],
Dict[str, List[str]],
Dict[str, Model],
Dict[str, TemplateResponseMixin],
Dict[str, str],
MagicMock,
]
],
) -> Optional[
Union[
Dict[str, Any],
Dict[str, List[Dict[str, Any]]],
Dict[
str,
Optional[
Union[
List[Dict[str, Optional[Union[datetime, Model, str]]]],
bool,
ListView,
]
],
],
Dict[str, Union[Callable, int]],
Dict[str, Union[Dict[str, str], DetailView]],
Dict[
str,
Union[List[Dict[str, str]], bool, Page, Paginator, ListView],
],
Dict[str, Union[List[str], str]],
Dict[str, Union[AuthenticationForm, LoginView, RequestSite, str]],
Dict[str, Union[Model, BaseForm, TemplateResponseMixin, str]],
Dict[str, List[Dict[str, Optional[Union[datetime, Model, str]]]]],
Dict[str, List[str]],
Dict[str, Model],
Dict[str, TemplateResponseMixin],
Dict[str, str],
MagicMock,
]
]: ...
@@ -155,63 +91,25 @@ class TemplateResponse(SimpleTemplateResponse):
context: django.template.context.RequestContext
context_data: Optional[
Union[
Dict[str, Any],
Dict[str, List[Dict[str, Any]]],
Dict[
str,
Optional[
Union[
List[
Dict[
List[
Dict[
str,
Optional[
Union[
datetime.datetime,
django.db.models.base.Model,
str,
Optional[
Union[
datetime.datetime,
django.db.models.base.Model,
str,
]
],
]
],
bool,
django.views.generic.list.ListView,
]
],
],
Dict[str, Union[Callable, int]],
Dict[
str,
Union[Dict[str, str], django.views.generic.detail.DetailView],
],
Dict[
str,
Union[
List[Dict[str, str]],
bool,
django.core.paginator.Page,
django.core.paginator.Paginator,
django.views.generic.list.ListView,
],
],
Dict[str, Union[List[str], str]],
Dict[
str,
Union[
django.contrib.auth.forms.AuthenticationForm,
django.contrib.auth.views.LoginView,
django.contrib.sites.requests.RequestSite,
str,
],
],
Dict[
str,
Union[
django.db.models.base.Model,
django.forms.forms.BaseForm,
django.views.generic.base.TemplateResponseMixin,
str,
],
],
Dict[str, List[str]],
Dict[str, django.db.models.base.Model],
Dict[str, django.views.generic.base.TemplateResponseMixin],
Dict[str, str],
unittest.mock.MagicMock,
]
]
@@ -235,33 +133,13 @@ class TemplateResponse(SimpleTemplateResponse):
template: Union[List[str], Template, str],
context: Optional[
Union[
Dict[str, Any],
Dict[str, List[Dict[str, Any]]],
Dict[
str,
Optional[
Union[
List[
Dict[str, Optional[Union[datetime, Model, str]]]
],
bool,
ListView,
]
],
str, List[Dict[str, Optional[Union[datetime, Model, str]]]]
],
Dict[str, Union[Callable, int]],
Dict[str, Union[Dict[str, str], DetailView]],
Dict[
str,
Union[
List[Dict[str, str]], bool, Page, Paginator, ListView
],
],
Dict[str, Union[List[str], str]],
Dict[
str, Union[AuthenticationForm, LoginView, RequestSite, str]
],
Dict[str, Union[Model, BaseForm, TemplateResponseMixin, str]],
Dict[str, List[str]],
Dict[str, Model],
Dict[str, TemplateResponseMixin],
Dict[str, str],
MagicMock,
]
] = ...,

View File

@@ -2,7 +2,7 @@ from datetime import date
from typing import Any, List, Optional, Union
from django.template import Node
from django.template.base import Parser, Token
from django.template.base import NodeList, Parser, Token
from django.template.context import Context
from django.utils.safestring import SafeText
@@ -14,9 +14,11 @@ def unlocalize(value: Union[date, float]) -> str: ...
class LocalizeNode(Node):
origin: django.template.base.Origin
token: django.template.base.Token
nodelist: List[Any] = ...
nodelist: Union[List[Any], django.template.base.NodeList] = ...
use_l10n: bool = ...
def __init__(self, nodelist: List[Any], use_l10n: bool) -> None: ...
def __init__(
self, nodelist: Union[List[Any], NodeList], use_l10n: bool
) -> None: ...
def render(self, context: Context) -> SafeText: ...
def localize_tag(parser: Parser, token: Token) -> LocalizeNode: ...

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