fixes for ci imports failures

This commit is contained in:
Maxim Kurnikov
2019-01-06 21:00:01 +03:00
parent 5ba0bbe0b7
commit 98e60d084f
84 changed files with 449 additions and 1383 deletions

View File

@@ -1,13 +1,12 @@
from typing import Any, Callable, Dict, List, Optional, Tuple, Type, Union from typing import Any, Callable, Dict, List, Optional, Tuple, Type
from django.contrib.admin.options import ModelAdmin from django.contrib.admin.options import ModelAdmin
from django.core.handlers.wsgi import WSGIRequest from django.core.handlers.wsgi import WSGIRequest
from django.db.models.base import Model from django.db.models.base import Model
from django.db.models.fields.mixins import FieldCacheMixin
from django.db.models.fields.related import RelatedField from django.db.models.fields.related import RelatedField
from django.db.models.query import QuerySet from django.db.models.query import QuerySet
from django.db.models.fields import BooleanField, DateField, Field from django.db.models.fields import Field
class ListFilter: class ListFilter:
title: Any = ... title: Any = ...
@@ -16,44 +15,36 @@ class ListFilter:
def __init__( def __init__(
self, request: WSGIRequest, params: Dict[str, str], model: Type[Model], model_admin: ModelAdmin self, request: WSGIRequest, params: Dict[str, str], model: Type[Model], model_admin: ModelAdmin
) -> None: ... ) -> None: ...
def has_output(self) -> None: ... def has_output(self) -> bool: ...
def choices(self, changelist: Any) -> None: ... def choices(self, changelist: Any) -> None: ...
def queryset(self, request: Any, queryset: Any) -> None: ... def queryset(self, request: Any, queryset: QuerySet) -> Optional[QuerySet]: ...
def expected_parameters(self) -> None: ... def expected_parameters(self) -> Optional[List[str]]: ...
class SimpleListFilter(ListFilter): class SimpleListFilter(ListFilter):
parameter_name: Any = ... parameter_name: Any = ...
lookup_choices: Any = ... lookup_choices: Any = ...
def __init__(
self, request: WSGIRequest, params: Dict[str, str], model: Type[Model], model_admin: ModelAdmin
) -> None: ...
def has_output(self) -> bool: ...
def value(self) -> Optional[str]: ... def value(self) -> Optional[str]: ...
def lookups(self, request: Any, model_admin: Any) -> None: ... def lookups(self, request: Any, model_admin: Any) -> None: ...
def expected_parameters(self): ...
def choices(self, changelist: Any) -> None: ...
class FieldListFilter(ListFilter): class FieldListFilter(ListFilter):
field: Any = ... field: Field = ...
field_path: Any = ... field_path: Any = ...
title: Any = ... title: Any = ...
def __init__( def __init__(
self, self,
field: Union[Field, reverse_related.ForeignObjectRel], field: Field,
request: WSGIRequest, request: WSGIRequest,
params: Dict[str, str], params: Dict[str, str],
model: Type[Model], model: Type[Model],
model_admin: ModelAdmin, model_admin: ModelAdmin,
field_path: str, field_path: str,
) -> None: ... ) -> None: ...
def has_output(self) -> bool: ...
def queryset(self, request: WSGIRequest, queryset: QuerySet) -> QuerySet: ...
@classmethod @classmethod
def register(cls, test: Callable, list_filter_class: Type[FieldListFilter], take_priority: bool = ...) -> None: ... def register(cls, test: Callable, list_filter_class: Type[FieldListFilter], take_priority: bool = ...) -> None: ...
@classmethod @classmethod
def create( def create(
cls, cls,
field: Union[Field, reverse_related.ForeignObjectRel], field: Field,
request: WSGIRequest, request: WSGIRequest,
params: Dict[str, str], params: Dict[str, str],
model: Type[Model], model: Type[Model],
@@ -62,8 +53,6 @@ class FieldListFilter(ListFilter):
) -> FieldListFilter: ... ) -> FieldListFilter: ...
class RelatedFieldListFilter(FieldListFilter): class RelatedFieldListFilter(FieldListFilter):
field: django.db.models.fields.related.ForeignKey
field_path: str
used_parameters: Dict[Any, Any] used_parameters: Dict[Any, Any]
lookup_kwarg: str = ... lookup_kwarg: str = ...
lookup_kwarg_isnull: str = ... lookup_kwarg_isnull: str = ...
@@ -73,61 +62,26 @@ class RelatedFieldListFilter(FieldListFilter):
lookup_title: Any = ... lookup_title: Any = ...
title: str = ... title: str = ...
empty_value_display: Any = ... empty_value_display: Any = ...
def __init__(
self,
field: FieldCacheMixin,
request: WSGIRequest,
params: Dict[str, str],
model: Type[Model],
model_admin: ModelAdmin,
field_path: str,
) -> None: ...
@property @property
def include_empty_choice(self) -> bool: ... def include_empty_choice(self) -> bool: ...
def has_output(self) -> bool: ...
def expected_parameters(self) -> List[str]: ...
def field_choices( def field_choices(
self, field: FieldCacheMixin, request: WSGIRequest, model_admin: ModelAdmin self, field: RelatedField, request: WSGIRequest, model_admin: ModelAdmin
) -> List[Tuple[Union[int, str], str]]: ... ) -> List[Tuple[str, str]]: ...
def choices(self, changelist: Any) -> None: ...
class BooleanFieldListFilter(FieldListFilter): class BooleanFieldListFilter(FieldListFilter):
lookup_kwarg: Any = ... lookup_kwarg: Any = ...
lookup_kwarg2: Any = ... lookup_kwarg2: Any = ...
lookup_val: Any = ... lookup_val: Any = ...
lookup_val2: Any = ... lookup_val2: Any = ...
def __init__(
self,
field: BooleanField,
request: WSGIRequest,
params: Dict[str, str],
model: Type[Model],
model_admin: ModelAdmin,
field_path: str,
) -> None: ...
def expected_parameters(self) -> List[str]: ...
def choices(self, changelist: Any) -> None: ... def choices(self, changelist: Any) -> None: ...
class ChoicesFieldListFilter(FieldListFilter): class ChoicesFieldListFilter(FieldListFilter):
field: django.db.models.fields.IntegerField
field_path: str
title: str title: str
used_parameters: Dict[Any, Any] used_parameters: Dict[Any, Any]
lookup_kwarg: str = ... lookup_kwarg: str = ...
lookup_kwarg_isnull: str = ... lookup_kwarg_isnull: str = ...
lookup_val: None = ... lookup_val: None = ...
lookup_val_isnull: None = ... lookup_val_isnull: None = ...
def __init__(
self,
field: Field,
request: WSGIRequest,
params: Dict[str, str],
model: Type[Model],
model_admin: ModelAdmin,
field_path: str,
) -> None: ...
def expected_parameters(self) -> List[str]: ...
def choices(self, changelist: Any) -> None: ...
class DateFieldListFilter(FieldListFilter): class DateFieldListFilter(FieldListFilter):
field_generic: Any = ... field_generic: Any = ...
@@ -136,50 +90,21 @@ class DateFieldListFilter(FieldListFilter):
lookup_kwarg_until: Any = ... lookup_kwarg_until: Any = ...
links: Any = ... links: Any = ...
lookup_kwarg_isnull: Any = ... lookup_kwarg_isnull: Any = ...
def __init__(
self,
field: DateField,
request: WSGIRequest,
params: Dict[str, str],
model: Type[Model],
model_admin: ModelAdmin,
field_path: str,
) -> None: ...
def expected_parameters(self) -> List[str]: ...
def choices(self, changelist: Any) -> None: ...
class AllValuesFieldListFilter(FieldListFilter): class AllValuesFieldListFilter(FieldListFilter):
field: django.db.models.fields.CharField
field_path: str
title: str title: str
used_parameters: Dict[Any, Any] used_parameters: Dict[Any, Any]
lookup_kwarg: str = ... lookup_kwarg: str = ...
lookup_kwarg_isnull: str = ... lookup_kwarg_isnull: str = ...
lookup_val: None = ... lookup_val: None = ...
lookup_val_isnull: None = ... lookup_val_isnull: None = ...
empty_value_display: django.utils.safestring.SafeText = ... empty_value_display: str = ...
lookup_choices: django.db.models.query.QuerySet = ... lookup_choices: QuerySet = ...
def __init__(
self,
field: Field,
request: WSGIRequest,
params: Dict[str, str],
model: Type[Model],
model_admin: ModelAdmin,
field_path: str,
) -> None: ...
def expected_parameters(self) -> List[str]: ...
def choices(self, changelist: Any) -> None: ...
class RelatedOnlyFieldListFilter(RelatedFieldListFilter): class RelatedOnlyFieldListFilter(RelatedFieldListFilter):
field: django.db.models.fields.related.ForeignKey
field_path: str
lookup_kwarg: str lookup_kwarg: str
lookup_kwarg_isnull: str lookup_kwarg_isnull: str
lookup_val: None lookup_val: None
lookup_val_isnull: None lookup_val_isnull: None
title: str title: str
used_parameters: Dict[Any, Any] used_parameters: Dict[Any, Any]
def field_choices(
self, field: RelatedField, request: WSGIRequest, model_admin: ModelAdmin
) -> List[Tuple[Union[int, str], str]]: ...

View File

@@ -1,19 +1,22 @@
from typing import Any, Callable, Dict, Iterator, List, Optional, Tuple, Union import collections
from typing import Any, Callable, Dict, Iterator, List, Optional, Tuple, Union, Type
from django import forms from django import forms
from django.contrib.auth.forms import AdminPasswordChangeForm from django.contrib.auth.forms import AdminPasswordChangeForm
from django.db.models.fields import AutoField from django.db.models.fields import AutoField
from django.forms.utils import ErrorDict from django.forms.utils import ErrorDict, ErrorList
from django.forms.widgets import Media, Widget from django.forms.widgets import Media, Widget
from django.utils.safestring import SafeText from django.utils.safestring import SafeText
from django.forms.boundfield import BoundField
ACTION_CHECKBOX_NAME: str ACTION_CHECKBOX_NAME: str
class ActionForm(forms.Form): class ActionForm(forms.Form):
auto_id: None auto_id: None
data: Dict[Any, Any] data: Dict[Any, Any]
empty_permitted: bool empty_permitted: bool
error_class: Type[django.forms.utils.ErrorList] error_class: Type[ErrorList]
fields: collections.OrderedDict fields: collections.OrderedDict
files: Dict[Any, Any] files: Dict[Any, Any]
initial: Dict[Any, Any] initial: Dict[Any, Any]
@@ -77,7 +80,7 @@ class Fieldline:
def errors(self) -> SafeText: ... def errors(self) -> SafeText: ...
class AdminField: class AdminField:
field: django.forms.boundfield.BoundField = ... field: BoundField = ...
is_first: bool = ... is_first: bool = ...
is_checkbox: bool = ... is_checkbox: bool = ...
is_readonly: bool = ... is_readonly: bool = ...

View File

@@ -1,3 +1,4 @@
import datetime
from typing import Any, Dict, List, Optional, Union from typing import Any, Dict, List, Optional, Union
from uuid import UUID from uuid import UUID

View File

@@ -11,16 +11,19 @@ from django.core.checks.messages import Error
from django.core.handlers.wsgi import WSGIRequest from django.core.handlers.wsgi import WSGIRequest
from django.core.paginator import Paginator from django.core.paginator import Paginator
from django.db.models.base import Model from django.db.models.base import Model
from django.forms.fields import TypedChoiceField
from django.db.models.fields import Field from django.db.models.fields import Field
from django.db.models.fields.related import ForeignKey, ManyToManyField, RelatedField from django.db.models.fields.related import ForeignKey, ManyToManyField, RelatedField
from django.db.models.query import QuerySet from django.db.models.query import QuerySet
from django.forms.fields import Field, TypedChoiceField
from django.forms.models import ModelChoiceField, ModelMultipleChoiceField from django.forms.models import ModelChoiceField, ModelMultipleChoiceField
from django.forms.widgets import Media from django.forms.widgets import Media
from django.http.response import HttpResponse, HttpResponseBase, HttpResponseRedirect, JsonResponse from django.http.response import HttpResponse, HttpResponseBase, HttpResponseRedirect, JsonResponse
from django.urls.resolvers import URLPattern from django.urls.resolvers import URLPattern
from django.utils.safestring import SafeText from django.utils.safestring import SafeText
from django.db.models.options import Options
IS_POPUP_VAR: str IS_POPUP_VAR: str
TO_FIELD_VAR: str TO_FIELD_VAR: str
HORIZONTAL: Any HORIZONTAL: Any
@@ -90,10 +93,7 @@ class BaseModelAdmin:
def has_module_permission(self, request: WSGIRequest) -> bool: ... def has_module_permission(self, request: WSGIRequest) -> bool: ...
class ModelAdmin(BaseModelAdmin): class ModelAdmin(BaseModelAdmin):
formfield_overrides: Dict[ formfield_overrides: Any
Type[Union[django.db.models.fields.DateTimeCheckMixin, Field]],
Dict[str, Type[Union[django.forms.fields.SplitDateTimeField, django.forms.widgets.Widget]]],
]
list_display: Any = ... list_display: Any = ...
list_display_links: Any = ... list_display_links: Any = ...
list_filter: Any = ... list_filter: Any = ...
@@ -123,8 +123,8 @@ class ModelAdmin(BaseModelAdmin):
actions_selection_counter: bool = ... actions_selection_counter: bool = ...
checks_class: Any = ... checks_class: Any = ...
model: Type[Model] = ... model: Type[Model] = ...
opts: django.db.models.options.Options = ... opts: Options = ...
admin_site: django.contrib.admin.sites.AdminSite = ... admin_site: AdminSite = ...
def __init__(self, model: Type[Model], admin_site: Optional[AdminSite]) -> None: ... def __init__(self, model: Type[Model], admin_site: Optional[AdminSite]) -> None: ...
def get_inline_instances(self, request: WSGIRequest, obj: Optional[Model] = ...) -> List[InlineModelAdmin]: ... def get_inline_instances(self, request: WSGIRequest, obj: Optional[Model] = ...) -> List[InlineModelAdmin]: ...
def get_urls(self) -> List[URLPattern]: ... def get_urls(self) -> List[URLPattern]: ...
@@ -263,7 +263,6 @@ class InlineModelAdmin(BaseModelAdmin):
fields: Any = ... fields: Any = ...
def get_formset(self, request: Any, obj: Optional[Any] = ..., **kwargs: Any): ... def get_formset(self, request: Any, obj: Optional[Any] = ..., **kwargs: Any): ...
def get_queryset(self, request: WSGIRequest) -> QuerySet: ... def get_queryset(self, request: WSGIRequest) -> QuerySet: ...
def has_add_permission(self, request: WSGIRequest, obj: Optional[Model]) -> bool: ...
def has_change_permission(self, request: WSGIRequest, obj: Optional[Model] = ...) -> bool: ... def has_change_permission(self, request: WSGIRequest, obj: Optional[Model] = ...) -> bool: ...
def has_delete_permission(self, request: WSGIRequest, obj: Optional[Model] = ...) -> bool: ... def has_delete_permission(self, request: WSGIRequest, obj: Optional[Model] = ...) -> bool: ...
def has_view_permission(self, request: WSGIRequest, obj: Optional[Model] = ...) -> bool: ... def has_view_permission(self, request: WSGIRequest, obj: Optional[Model] = ...) -> bool: ...

View File

@@ -8,7 +8,7 @@ from django.views.generic.list import BaseListView
class AutocompleteJsonView(BaseListView): class AutocompleteJsonView(BaseListView):
paginate_by: int = ... paginate_by: int = ...
model_admin: django.contrib.admin.options.ModelAdmin = ... model_admin: ModelAdmin = ...
term: Any = ... term: Any = ...
paginator_class: Any = ... paginator_class: Any = ...
object_list: Any = ... object_list: Any = ...

View File

@@ -8,6 +8,8 @@ from django.db.models.base import Model
from django.db.models.expressions import Combinable, CombinedExpression, OrderBy from django.db.models.expressions import Combinable, CombinedExpression, OrderBy
from django.db.models.query import QuerySet from django.db.models.query import QuerySet
from django.db.models.options import Options
ALL_VAR: str ALL_VAR: str
ORDER_VAR: str ORDER_VAR: str
ORDER_TYPE_VAR: str ORDER_TYPE_VAR: str
@@ -18,9 +20,9 @@ IGNORED_PARAMS: Any
class ChangeList: class ChangeList:
model: Type[Model] = ... model: Type[Model] = ...
opts: django.db.models.options.Options = ... opts: Options = ...
lookup_opts: django.db.models.options.Options = ... lookup_opts: Options = ...
root_queryset: django.db.models.query.QuerySet = ... root_queryset: QuerySet = ...
list_display: List[str] = ... list_display: List[str] = ...
list_display_links: List[str] = ... list_display_links: List[str] = ...
list_filter: Tuple = ... list_filter: Tuple = ...
@@ -29,7 +31,7 @@ class ChangeList:
list_select_related: bool = ... list_select_related: bool = ...
list_per_page: int = ... list_per_page: int = ...
list_max_show_all: int = ... list_max_show_all: int = ...
model_admin: django.contrib.admin.options.ModelAdmin = ... model_admin: ModelAdmin = ...
preserved_filters: str = ... preserved_filters: str = ...
sortable_by: Tuple[str] = ... sortable_by: Tuple[str] = ...
page_num: int = ... page_num: int = ...

View File

@@ -52,7 +52,7 @@ class AdminTimeWidget(forms.TimeInput):
class AdminSplitDateTime(forms.SplitDateTimeWidget): class AdminSplitDateTime(forms.SplitDateTimeWidget):
attrs: Dict[Any, Any] attrs: Dict[Any, Any]
widgets: List[django.forms.widgets.DateTimeBaseInput] widgets: List[DateTimeBaseInput]
template_name: str = ... template_name: str = ...
def __init__(self, attrs: None = ...) -> None: ... def __init__(self, attrs: None = ...) -> None: ...
def get_context( def get_context(
@@ -93,7 +93,7 @@ class ForeignKeyRawIdWidget(forms.TextInput):
attrs: Dict[Any, Any] attrs: Dict[Any, Any]
template_name: str = ... template_name: str = ...
rel: django.db.models.fields.reverse_related.ManyToOneRel = ... rel: django.db.models.fields.reverse_related.ManyToOneRel = ...
admin_site: django.contrib.admin.sites.AdminSite = ... admin_site: AdminSite = ...
db: None = ... db: None = ...
def __init__(self, rel: ForeignObjectRel, admin_site: AdminSite, attrs: None = ..., using: None = ...) -> None: ... def __init__(self, rel: ForeignObjectRel, admin_site: AdminSite, attrs: None = ..., using: None = ...) -> None: ...
def get_context( def get_context(
@@ -104,7 +104,7 @@ class ForeignKeyRawIdWidget(forms.TextInput):
def label_and_url_for_value(self, value: Union[int, str, UUID]) -> Tuple[str, str]: ... def label_and_url_for_value(self, value: Union[int, str, UUID]) -> Tuple[str, str]: ...
class ManyToManyRawIdWidget(ForeignKeyRawIdWidget): class ManyToManyRawIdWidget(ForeignKeyRawIdWidget):
admin_site: django.contrib.admin.sites.AdminSite admin_site: AdminSite
attrs: Dict[Any, Any] attrs: Dict[Any, Any]
db: None db: None
rel: django.db.models.fields.reverse_related.ManyToManyRel rel: django.db.models.fields.reverse_related.ManyToManyRel
@@ -121,14 +121,14 @@ class RelatedFieldWidgetWrapper(forms.Widget):
template_name: str = ... template_name: str = ...
needs_multipart_form: bool = ... needs_multipart_form: bool = ...
attrs: Dict[Any, Any] = ... attrs: Dict[Any, Any] = ...
choices: django.forms.models.ModelChoiceIterator = ... choices: ModelChoiceIterator = ...
widget: django.contrib.admin.widgets.AutocompleteSelect = ... widget: django.contrib.admin.widgets.AutocompleteSelect = ...
rel: django.db.models.fields.reverse_related.ManyToOneRel = ... rel: django.db.models.fields.reverse_related.ManyToOneRel = ...
can_add_related: bool = ... can_add_related: bool = ...
can_change_related: bool = ... can_change_related: bool = ...
can_delete_related: bool = ... can_delete_related: bool = ...
can_view_related: bool = ... can_view_related: bool = ...
admin_site: django.contrib.admin.sites.AdminSite = ... admin_site: AdminSite = ...
def __init__( def __init__(
self, self,
widget: ChoiceWidget, widget: ChoiceWidget,

View File

@@ -26,13 +26,13 @@ class GroupAdmin(admin.ModelAdmin):
) -> ModelMultipleChoiceField: ... ) -> ModelMultipleChoiceField: ...
class UserAdmin(admin.ModelAdmin): class UserAdmin(admin.ModelAdmin):
admin_site: django.contrib.admin.sites.AdminSite admin_site: AdminSite
formfield_overrides: Dict[ formfield_overrides: Dict[
Type[Union[django.db.models.fields.DateTimeCheckMixin, Field]], Type[Union[django.db.models.fields.DateTimeCheckMixin, Field]],
Dict[str, Type[Union[django.forms.fields.SplitDateTimeField, django.forms.widgets.Widget]]], Dict[str, Type[Union[django.forms.fields.SplitDateTimeField, Widget]]],
] ]
model: Type[django.contrib.auth.models.User] model: Type[User]
opts: django.db.models.options.Options opts: Options
add_form_template: str = ... add_form_template: str = ...
change_user_password_template: Any = ... change_user_password_template: Any = ...
fieldsets: Any = ... fieldsets: Any = ...

View File

@@ -2,7 +2,6 @@ from typing import Any, Optional, Set, Union
from django.contrib.auth.base_user import AbstractBaseUser from django.contrib.auth.base_user import AbstractBaseUser
from django.contrib.auth.models import AnonymousUser, User from django.contrib.auth.models import AnonymousUser, User
from django.core.handlers.wsgi import WSGIRequest
UserModel: Any UserModel: Any
@@ -20,14 +19,11 @@ class ModelBackend:
def has_module_perms(self, user_obj: Union[AbstractBaseUser, AnonymousUser], app_label: str) -> bool: ... def has_module_perms(self, user_obj: Union[AbstractBaseUser, AnonymousUser], app_label: str) -> bool: ...
def get_user(self, user_id: int) -> AbstractBaseUser: ... def get_user(self, user_id: int) -> AbstractBaseUser: ...
class AllowAllUsersModelBackend(ModelBackend): class AllowAllUsersModelBackend(ModelBackend): ...
def user_can_authenticate(self, user: AbstractBaseUser) -> bool: ...
class RemoteUserBackend(ModelBackend): class RemoteUserBackend(ModelBackend):
create_unknown_user: bool = ... create_unknown_user: bool = ...
def authenticate(self, request: WSGIRequest, remote_user: Optional[str]) -> Optional[User]: ...
def clean_username(self, username: str) -> str: ... def clean_username(self, username: str) -> str: ...
def configure_user(self, user: User) -> User: ... def configure_user(self, user: User) -> User: ...
class AllowAllUsersRemoteUserBackend(RemoteUserBackend): class AllowAllUsersRemoteUserBackend(RemoteUserBackend): ...
def user_can_authenticate(self, user: User) -> bool: ...

View File

@@ -6,14 +6,14 @@ from django.utils.functional import SimpleLazyObject
class PermLookupDict: class PermLookupDict:
app_label: django.utils.safestring.SafeText app_label: django.utils.safestring.SafeText
user: django.utils.functional.SimpleLazyObject user: SimpleLazyObject
def __init__(self, user: SimpleLazyObject, app_label: str) -> None: ... def __init__(self, user: SimpleLazyObject, app_label: str) -> None: ...
def __getitem__(self, perm_name: str) -> bool: ... def __getitem__(self, perm_name: str) -> bool: ...
def __iter__(self) -> Any: ... def __iter__(self) -> Any: ...
def __bool__(self) -> bool: ... def __bool__(self) -> bool: ...
class PermWrapper: class PermWrapper:
user: django.utils.functional.SimpleLazyObject = ... user: SimpleLazyObject = ...
def __init__(self, user: Union[AnonymousUser, User]) -> None: ... def __init__(self, user: Union[AnonymousUser, User]) -> None: ...
def __getitem__(self, app_label: str) -> PermLookupDict: ... def __getitem__(self, app_label: str) -> PermLookupDict: ...
def __iter__(self) -> Any: ... def __iter__(self) -> Any: ...

View File

@@ -1,20 +1,23 @@
from typing import Any, Dict, Iterator, List, Optional, Union import collections
import datetime
from typing import Any, Dict, Iterator, List, Optional, Union, Type
from django import forms
from django.contrib.auth.base_user import AbstractBaseUser from django.contrib.auth.base_user import AbstractBaseUser
from django.contrib.auth.models import AbstractUser, User from django.contrib.auth.models import AbstractUser, User
from django.contrib.auth.tokens import PasswordResetTokenGenerator from django.contrib.auth.tokens import PasswordResetTokenGenerator
from django.core.exceptions import ValidationError from django.core.exceptions import ValidationError
from django.core.handlers.wsgi import WSGIRequest from django.core.handlers.wsgi import WSGIRequest
from django.forms.utils import ErrorList
from django.http.request import QueryDict
from django.utils.datastructures import MultiValueDict
from django import forms
UserModel: Any UserModel: Any
class ReadOnlyPasswordHashWidget(forms.Widget): class ReadOnlyPasswordHashWidget(forms.Widget):
attrs: Dict[Any, Any] attrs: Dict[Any, Any]
template_name: str = ... template_name: str = ...
def get_context(
self, name: str, value: Optional[str], attrs: Dict[str, str]
) -> Dict[str, Union[Dict[str, Optional[Union[Dict[str, str], bool, str]]], List[Dict[str, str]]]]: ...
class ReadOnlyPasswordHashField(forms.Field): class ReadOnlyPasswordHashField(forms.Field):
widget: Any = ... widget: Any = ...
@@ -29,11 +32,11 @@ class UserCreationForm(forms.ModelForm):
auto_id: str auto_id: str
data: Dict[str, str] data: Dict[str, str]
empty_permitted: bool empty_permitted: bool
error_class: Type[django.forms.utils.ErrorList] error_class: Type[ErrorList]
fields: collections.OrderedDict fields: collections.OrderedDict
files: Dict[Any, Any] files: Dict[Any, Any]
initial: Dict[Any, Any] initial: Dict[Any, Any]
instance: django.contrib.auth.models.User instance: User
is_bound: bool is_bound: bool
label_suffix: str label_suffix: str
error_messages: Any = ... error_messages: Any = ...
@@ -51,11 +54,11 @@ class UserChangeForm(forms.ModelForm):
auto_id: str auto_id: str
data: Dict[Any, Any] data: Dict[Any, Any]
empty_permitted: bool empty_permitted: bool
error_class: Type[django.forms.utils.ErrorList] error_class: Type[ErrorList]
fields: collections.OrderedDict fields: collections.OrderedDict
files: Dict[Any, Any] files: Dict[Any, Any]
initial: Dict[str, Optional[Union[List[Any], datetime.datetime, int, str]]] initial: Dict[str, Optional[Union[List[Any], datetime.datetime, int, str]]]
instance: django.contrib.auth.models.User instance: User
is_bound: bool is_bound: bool
label_suffix: str label_suffix: str
password: Any = ... password: Any = ...
@@ -68,22 +71,21 @@ class UserChangeForm(forms.ModelForm):
class AuthenticationForm(forms.Form): class AuthenticationForm(forms.Form):
auto_id: str auto_id: str
data: django.http.request.QueryDict data: QueryDict
empty_permitted: bool empty_permitted: bool
error_class: Type[django.forms.utils.ErrorList] error_class: Type[ErrorList]
fields: collections.OrderedDict fields: collections.OrderedDict
files: django.utils.datastructures.MultiValueDict files: MultiValueDict
initial: Dict[Any, Any] initial: Dict[Any, Any]
is_bound: bool is_bound: bool
label_suffix: str label_suffix: str
username: Any = ... username: Any = ...
password: Any = ... password: Any = ...
error_messages: Any = ... error_messages: Any = ...
request: django.core.handlers.wsgi.WSGIRequest = ... request: WSGIRequest = ...
user_cache: None = ... user_cache: None = ...
username_field: Any = ... username_field: Any = ...
def __init__(self, request: Any = ..., *args: Any, **kwargs: Any) -> None: ... def __init__(self, request: Any = ..., *args: Any, **kwargs: Any) -> None: ...
def clean(self) -> Dict[str, str]: ...
def confirm_login_allowed(self, user: AbstractBaseUser) -> None: ... def confirm_login_allowed(self, user: AbstractBaseUser) -> None: ...
def get_user(self) -> User: ... def get_user(self) -> User: ...
def get_invalid_login_error(self) -> ValidationError: ... def get_invalid_login_error(self) -> ValidationError: ...
@@ -92,7 +94,7 @@ class PasswordResetForm(forms.Form):
auto_id: str auto_id: str
data: Dict[Any, Any] data: Dict[Any, Any]
empty_permitted: bool empty_permitted: bool
error_class: Type[django.forms.utils.ErrorList] error_class: Type[ErrorList]
fields: collections.OrderedDict fields: collections.OrderedDict
files: Dict[Any, Any] files: Dict[Any, Any]
initial: Dict[Any, Any] initial: Dict[Any, Any]
@@ -126,7 +128,7 @@ class SetPasswordForm(forms.Form):
auto_id: str auto_id: str
data: Dict[Any, Any] data: Dict[Any, Any]
empty_permitted: bool empty_permitted: bool
error_class: Type[django.forms.utils.ErrorList] error_class: Type[ErrorList]
fields: collections.OrderedDict fields: collections.OrderedDict
files: Dict[Any, Any] files: Dict[Any, Any]
initial: Dict[Any, Any] initial: Dict[Any, Any]
@@ -135,7 +137,7 @@ class SetPasswordForm(forms.Form):
error_messages: Any = ... error_messages: Any = ...
new_password1: Any = ... new_password1: Any = ...
new_password2: Any = ... new_password2: Any = ...
user: django.contrib.auth.models.User = ... user: User = ...
def __init__(self, user: Optional[AbstractBaseUser], *args: Any, **kwargs: Any) -> None: ... def __init__(self, user: Optional[AbstractBaseUser], *args: Any, **kwargs: Any) -> None: ...
def clean_new_password2(self) -> str: ... def clean_new_password2(self) -> str: ...
def save(self, commit: bool = ...) -> AbstractBaseUser: ... def save(self, commit: bool = ...) -> AbstractBaseUser: ...
@@ -144,13 +146,13 @@ class PasswordChangeForm(SetPasswordForm):
auto_id: str auto_id: str
data: Dict[Any, Any] data: Dict[Any, Any]
empty_permitted: bool empty_permitted: bool
error_class: Type[django.forms.utils.ErrorList] error_class: Type[ErrorList]
fields: collections.OrderedDict fields: collections.OrderedDict
files: Dict[Any, Any] files: Dict[Any, Any]
initial: Dict[Any, Any] initial: Dict[Any, Any]
is_bound: bool is_bound: bool
label_suffix: str label_suffix: str
user: django.contrib.auth.models.User user: User
error_messages: Any = ... error_messages: Any = ...
old_password: Any = ... old_password: Any = ...
field_order: Any = ... field_order: Any = ...
@@ -160,7 +162,7 @@ class AdminPasswordChangeForm(forms.Form):
auto_id: str auto_id: str
data: Dict[Any, Any] data: Dict[Any, Any]
empty_permitted: bool empty_permitted: bool
error_class: Type[django.forms.utils.ErrorList] error_class: Type[ErrorList]
fields: collections.OrderedDict fields: collections.OrderedDict
files: Dict[Any, Any] files: Dict[Any, Any]
initial: Dict[Any, Any] initial: Dict[Any, Any]
@@ -170,7 +172,7 @@ class AdminPasswordChangeForm(forms.Form):
required_css_class: str = ... required_css_class: str = ...
password1: Any = ... password1: Any = ...
password2: Any = ... password2: Any = ...
user: django.contrib.auth.models.User = ... user: User = ...
def __init__(self, user: AbstractUser, *args: Any, **kwargs: Any) -> None: ... def __init__(self, user: AbstractUser, *args: Any, **kwargs: Any) -> None: ...
def clean_password2(self) -> str: ... def clean_password2(self) -> str: ...
def save(self, commit: bool = ...) -> AbstractUser: ... def save(self, commit: bool = ...) -> AbstractUser: ...

View File

@@ -102,8 +102,6 @@ class AnonymousUser:
is_staff: bool = ... is_staff: bool = ...
is_active: bool = ... is_active: bool = ...
is_superuser: bool = ... is_superuser: bool = ...
def __eq__(self, other: Union[AnonymousUser, User]) -> bool: ...
def __hash__(self) -> int: ...
def save(self) -> Any: ... def save(self) -> Any: ...
def delete(self) -> Any: ... def delete(self) -> Any: ...
def set_password(self, raw_password: str) -> Any: ... def set_password(self, raw_password: str) -> Any: ...

View File

@@ -0,0 +1,5 @@
from django.dispatch.dispatcher import Signal
user_logged_in: Signal
user_login_failed: Signal
user_logged_out: Signal

View File

@@ -3,9 +3,12 @@ from typing import Any, Callable, Dict, List, Optional, Tuple, Type, Union
from django.contrib.contenttypes.models import ContentType from django.contrib.contenttypes.models import ContentType
from django.core.checks.messages import Error from django.core.checks.messages import Error
from django.db.models.base import Model from django.db.models.base import Model
from django.db.models.fields.related import ForeignObject
from django.db.models.fields.related_descriptors import ReverseManyToOneDescriptor
from django.db.models.fields.reverse_related import ForeignObjectRel
from django.db.models.fields import Field, PositiveIntegerField from django.db.models.fields import Field, PositiveIntegerField
from django.db.models.fields.mixins import FieldCacheMixin from django.db.models.fields.mixins import FieldCacheMixin
from django.db.models.fields.related import ForeignObject, ForeignObjectRel, ReverseManyToOneDescriptor
from django.db.models.query import QuerySet from django.db.models.query import QuerySet
from django.db.models.query_utils import FilteredRelation, PathInfo from django.db.models.query_utils import FilteredRelation, PathInfo
from django.db.models.sql.where import WhereNode from django.db.models.sql.where import WhereNode
@@ -47,7 +50,7 @@ class GenericForeignKey(FieldCacheMixin):
def __set__(self, instance: Model, value: Optional[Model]) -> None: ... def __set__(self, instance: Model, value: Optional[Model]) -> None: ...
class GenericRel(ForeignObjectRel): class GenericRel(ForeignObjectRel):
field: django.contrib.contenttypes.fields.GenericRelation field: GenericRelation
limit_choices_to: Dict[Any, Any] limit_choices_to: Dict[Any, Any]
model: Type[Model] model: Type[Model]
multiple: bool multiple: bool
@@ -103,8 +106,8 @@ class GenericRelation(ForeignObject):
def bulk_related_objects(self, objs: List[Model], using: str = ...) -> QuerySet: ... def bulk_related_objects(self, objs: List[Model], using: str = ...) -> QuerySet: ...
class ReverseGenericManyToOneDescriptor(ReverseManyToOneDescriptor): class ReverseGenericManyToOneDescriptor(ReverseManyToOneDescriptor):
field: django.contrib.contenttypes.fields.GenericRelation field: GenericRelation
rel: django.contrib.contenttypes.fields.GenericRel rel: GenericRel
def related_manager_cls(self): ... def related_manager_cls(self): ...
def create_generic_related_manager(superclass: Any, rel: Any): ... def create_generic_related_manager(superclass: Any, rel: Any): ...

View File

@@ -7,7 +7,7 @@ class FlatpageForm(forms.ModelForm):
auto_id: str auto_id: str
data: Dict[str, Union[List[int], str]] data: Dict[str, Union[List[int], str]]
empty_permitted: bool empty_permitted: bool
error_class: Type[django.forms.utils.ErrorList] error_class: Type[ErrorList]
fields: collections.OrderedDict fields: collections.OrderedDict
files: Dict[Any, Any] files: Dict[Any, Any]
initial: Dict[str, Union[List[django.contrib.sites.models.Site], int, str]] initial: Dict[str, Union[List[django.contrib.sites.models.Site], int, str]]

View File

@@ -10,7 +10,6 @@ class Message:
message: str = ... message: str = ...
extra_tags: str = ... extra_tags: str = ...
def __init__(self, level: int, message: str, extra_tags: Optional[str] = ...) -> None: ... def __init__(self, level: int, message: str, extra_tags: Optional[str] = ...) -> None: ...
def __eq__(self, other: Union[Message, str]) -> bool: ...
@property @property
def tags(self) -> str: ... def tags(self) -> str: ...
@property @property

View File

@@ -42,7 +42,7 @@ class MessageDecoder(json.JSONDecoder):
class CookieStorage(BaseStorage): class CookieStorage(BaseStorage):
added_new: bool added_new: bool
request: django.core.handlers.wsgi.WSGIRequest request: WSGIRequest
used: bool used: bool
cookie_name: str = ... cookie_name: str = ...
max_cookie_size: int = ... max_cookie_size: int = ...

View File

@@ -4,7 +4,7 @@ from django.contrib.messages.storage.base import BaseStorage
class FallbackStorage(BaseStorage): class FallbackStorage(BaseStorage):
added_new: bool added_new: bool
request: django.core.handlers.wsgi.WSGIRequest request: WSGIRequest
used: bool used: bool
storage_classes: Any = ... storage_classes: Any = ...
storages: Any = ... storages: Any = ...

View File

@@ -5,7 +5,7 @@ from django.http.request import HttpRequest
class SessionStorage(BaseStorage): class SessionStorage(BaseStorage):
added_new: bool added_new: bool
request: django.core.handlers.wsgi.WSGIRequest request: WSGIRequest
used: bool used: bool
session_key: str = ... session_key: str = ...
def __init__(self, request: HttpRequest, *args: Any, **kwargs: Any) -> None: ... def __init__(self, request: HttpRequest, *args: Any, **kwargs: Any) -> None: ...

View File

@@ -0,0 +1,6 @@
from django.db.models.fields import CharField, EmailField, TextField
class CIText: ...
class CICharField(CIText, CharField): ...
class CIEmailField(CIText, EmailField): ...
class CITextField(CIText, TextField): ...

View File

@@ -27,7 +27,7 @@ class Sitemap:
class GenericSitemap(Sitemap): class GenericSitemap(Sitemap):
priority: None = ... priority: None = ...
changefreq: None = ... changefreq: None = ...
queryset: django.db.models.query.QuerySet = ... queryset: QuerySet = ...
date_field: None = ... date_field: None = ...
protocol: None = ... protocol: None = ...
def __init__( def __init__(

View File

@@ -15,7 +15,6 @@ class DefaultCacheProxy:
def __setattr__(self, name: str, value: Callable) -> None: ... def __setattr__(self, name: str, value: Callable) -> None: ...
def __delattr__(self, name: Any): ... def __delattr__(self, name: Any): ...
def __contains__(self, key: str) -> bool: ... def __contains__(self, key: str) -> bool: ...
def __eq__(self, other: Any): ...
cache: Any cache: Any
caches: CacheHandler caches: CacheHandler

View File

@@ -15,7 +15,6 @@ class CheckMessage:
def __init__( def __init__(
self, level: int, msg: str, hint: Optional[str] = ..., obj: Any = ..., id: Optional[str] = ... self, level: int, msg: str, hint: Optional[str] = ..., obj: Any = ..., id: Optional[str] = ...
) -> None: ... ) -> None: ...
def __eq__(self, other: Union[CheckMessage, str]) -> bool: ...
def is_serious(self, level: int = ...) -> bool: ... def is_serious(self, level: int = ...) -> bool: ...
def is_silenced(self) -> bool: ... def is_silenced(self) -> bool: ...

View File

@@ -1,7 +1,7 @@
from typing import Any, Dict, Iterator, List, Optional, Tuple, Type, Union from typing import Any, Dict, Iterator, List, Optional, Tuple, Type, Union
from django.db.models.base import Model from django.db.models.base import Model
from django.forms.utils import ErrorDict, ErrorList from django.forms.utils import ErrorDict
class FieldDoesNotExist(Exception): ... class FieldDoesNotExist(Exception): ...
class AppRegistryNotReady(Exception): ... class AppRegistryNotReady(Exception): ...

View File

@@ -1,10 +1,9 @@
from io import BufferedReader, BytesIO from io import BytesIO
from typing import Any, Union from typing import Any, Union
from django.core.files import File from django.core.files import File
class ImageFile(File): class ImageFile(File):
file: BufferedReader
mode: str mode: str
name: str name: str
@property @property
@@ -12,4 +11,4 @@ class ImageFile(File):
@property @property
def height(self) -> int: ... def height(self) -> int: ...
def get_image_dimensions(file_or_path: Union[BufferedReader, BytesIO, ImageFile, str], close: bool = ...) -> Any: ... def get_image_dimensions(file_or_path: Union[BytesIO, str], close: bool = ...) -> Any: ...

View File

@@ -13,15 +13,15 @@ class Storage:
def get_valid_name(self, name: str) -> str: ... def get_valid_name(self, name: str) -> str: ...
def get_available_name(self, name: str, max_length: Optional[int] = ...) -> str: ... def get_available_name(self, name: str, max_length: Optional[int] = ...) -> str: ...
def generate_filename(self, filename: str) -> str: ... def generate_filename(self, filename: str) -> str: ...
def path(self, name: str) -> Any: ... def path(self, name: str) -> str: ...
def delete(self, name: Any) -> None: ... def delete(self, name: str) -> None: ...
def exists(self, name: Any) -> None: ... def exists(self, name: str) -> bool: ...
def listdir(self, path: Any) -> None: ... def listdir(self, path: Any) -> Optional[Tuple[List[str], List[str]]]: ...
def size(self, name: Any) -> None: ... def size(self, name: str) -> int: ...
def url(self, name: Any) -> None: ... def url(self, name: Optional[str]) -> str: ...
def get_accessed_time(self, name: Any) -> None: ... def get_accessed_time(self, name: str) -> datetime: ...
def get_created_time(self, name: Any) -> None: ... def get_created_time(self, name: str) -> datetime: ...
def get_modified_time(self, name: Any) -> None: ... def get_modified_time(self, name: str) -> datetime: ...
class FileSystemStorage(Storage): class FileSystemStorage(Storage):
def __init__( def __init__(
@@ -36,15 +36,6 @@ class FileSystemStorage(Storage):
def base_url(self) -> str: ... def base_url(self) -> str: ...
def file_permissions_mode(self) -> Optional[int]: ... def file_permissions_mode(self) -> Optional[int]: ...
def directory_permissions_mode(self) -> Optional[int]: ... def directory_permissions_mode(self) -> Optional[int]: ...
def delete(self, name: str) -> None: ...
def exists(self, name: str) -> bool: ...
def listdir(self, path: str) -> Tuple[List[str], List[str]]: ...
def path(self, name: str) -> str: ...
def size(self, name: str) -> int: ...
def url(self, name: Optional[str]) -> str: ...
def get_accessed_time(self, name: str) -> datetime: ...
def get_created_time(self, name: str) -> datetime: ...
def get_modified_time(self, name: str) -> datetime: ...
class DefaultStorage(LazyObject): ... class DefaultStorage(LazyObject): ...

View File

@@ -3,14 +3,13 @@ from typing import Any, Callable, Dict, Optional, Union
from django.contrib.auth.models import AbstractUser from django.contrib.auth.models import AbstractUser
from django.contrib.sessions.backends.base import SessionBase from django.contrib.sessions.backends.base import SessionBase
from django.http.request import QueryDict
from django.http.response import HttpResponse from django.http.response import HttpResponse
from django.utils.datastructures import MultiValueDict
from django.core.handlers import base from django.core.handlers import base
from django.http import HttpRequest from django.http import HttpRequest
_Stream = Union[BytesIO, str] _Stream = Union[BytesIO, str]
_WSGIEnviron = Dict[str, Any]
class LimitedStream: class LimitedStream:
stream: _Stream = ... stream: _Stream = ...
@@ -22,31 +21,18 @@ class LimitedStream:
def readline(self, size: Optional[int] = ...) -> bytes: ... def readline(self, size: Optional[int] = ...) -> bytes: ...
class WSGIRequest(HttpRequest): class WSGIRequest(HttpRequest):
content_params: Dict[str, str] environ: _WSGIEnviron = ...
content_type: str
environ: Dict[str, Any] = ...
path_info: str = ...
path: str = ...
user: AbstractUser user: AbstractUser
session: SessionBase session: SessionBase
META: Dict[str, Any] = ...
method: str = ...
encoding: Any = ... encoding: Any = ...
resolver_match: None = ... def __init__(self, environ: _WSGIEnviron) -> None: ...
def __init__(self, environ: Dict[str, Any]) -> None: ...
def GET(self) -> QueryDict: ...
def COOKIES(self) -> Dict[str, str]: ...
@property
def FILES(self) -> MultiValueDict: ...
POST: Any = ...
class WSGIHandler(base.BaseHandler): class WSGIHandler(base.BaseHandler):
request_class: Any = ... request_class: Any = ...
def __init__(self, *args: Any, **kwargs: Any) -> None: ... def __init__(self, *args: Any, **kwargs: Any) -> None: ...
def __call__(self, environ: Dict[str, Any], start_response: Callable) -> HttpResponse: ... def __call__(self, environ: _WSGIEnviron, start_response: Callable) -> HttpResponse: ...
def get_path_info(environ: Dict[str, Any]) -> str: ... def get_path_info(environ: _WSGIEnviron) -> str: ...
def get_script_name(environ: Dict[str, Any]) -> str: ... def get_script_name(environ: _WSGIEnviron) -> str: ...
def get_bytes_from_wsgi(environ: Dict[str, Any], key: str, default: str) -> bytes: ... def get_bytes_from_wsgi(environ: _WSGIEnviron, key: str, default: str) -> bytes: ...
def get_str_from_wsgi(environ: Dict[str, Any], key: str, default: str) -> str: ... def get_str_from_wsgi(environ: _WSGIEnviron, key: str, default: str) -> str: ...

View File

@@ -23,7 +23,6 @@ class CommandParser(ArgumentParser):
missing_args_message: None = ... missing_args_message: None = ...
called_from_command_line: bool = ... called_from_command_line: bool = ...
def __init__(self, **kwargs: Any) -> None: ... def __init__(self, **kwargs: Any) -> None: ...
def parse_args(self, args: List[str] = ..., namespace: None = ...) -> Namespace: ...
def error(self, message: str) -> Any: ... def error(self, message: str) -> Any: ...
def handle_default_options(options: Namespace) -> None: ... def handle_default_options(options: Namespace) -> None: ...

View File

@@ -1,5 +1,4 @@
import collections.abc from typing import Dict, List, Optional, Union, Iterable, Sequence
from typing import Dict, List, Optional, Union
from django.db.models.base import Model from django.db.models.base import Model
from django.db.models.query import QuerySet from django.db.models.query import QuerySet
@@ -15,11 +14,7 @@ class Paginator:
orphans: int = ... orphans: int = ...
allow_empty_first_page: bool = ... allow_empty_first_page: bool = ...
def __init__( def __init__(
self, self, object_list: Iterable, per_page: Union[int, str], orphans: int = ..., allow_empty_first_page: bool = ...
object_list: Union[List[Dict[str, str]], List[Model], List[int], QuerySet, str],
per_page: Union[int, str],
orphans: int = ...,
allow_empty_first_page: bool = ...,
) -> None: ... ) -> None: ...
def validate_number(self, number: Optional[Union[float, str]]) -> int: ... def validate_number(self, number: Optional[Union[float, str]]) -> int: ...
def get_page(self, number: Optional[int]) -> Page: ... def get_page(self, number: Optional[int]) -> Page: ...
@@ -31,7 +26,7 @@ class Paginator:
QuerySetPaginator = Paginator QuerySetPaginator = Paginator
class Page(collections.abc.Sequence): class Page(Sequence):
object_list: QuerySet = ... object_list: QuerySet = ...
number: int = ... number: int = ...
paginator: Paginator = ... paginator: Paginator = ...
@@ -41,8 +36,8 @@ class Page(collections.abc.Sequence):
number: int, number: int,
paginator: Paginator, paginator: Paginator,
) -> None: ... ) -> None: ...
def __len__(self) -> int: ... def __getitem__(self, item): ...
def __getitem__(self, index: Union[int, str]) -> Union[Model, str]: ... def __len__(self): ...
def has_next(self) -> bool: ... def has_next(self) -> bool: ...
def has_previous(self) -> bool: ... def has_previous(self) -> bool: ...
def has_other_pages(self) -> bool: ... def has_other_pages(self) -> bool: ...

View File

@@ -2,8 +2,7 @@ from collections import OrderedDict
from typing import Any, Callable, Dict, Iterator, List, Optional, Tuple, Type, Union from typing import Any, Callable, Dict, Iterator, List, Optional, Tuple, Type, Union
from django.apps.config import AppConfig from django.apps.config import AppConfig
from django.core.serializers.base import Serializer from django.core.serializers.base import Serializer, Deserializer
from django.core.serializers.xml_serializer import Deserializer
from django.db.models.base import Model from django.db.models.base import Model
from django.db.models.query import QuerySet from django.db.models.query import QuerySet

View File

@@ -2,14 +2,14 @@ import json
from datetime import datetime from datetime import datetime
from decimal import Decimal from decimal import Decimal
from io import TextIOWrapper from io import TextIOWrapper
from typing import Any, Optional, Union, Dict, Type from typing import Any, Union, Dict
from uuid import UUID from uuid import UUID
from django.core.serializers.python import Serializer as PythonSerializer from django.core.serializers.python import Serializer as PythonSerializer
from django.db.models.base import Model from django.db.models.base import Model
class Serializer(PythonSerializer): class Serializer(PythonSerializer):
json_kwargs: Dict[str, Optional[Type[DjangoJSONEncoder]]] json_kwargs: Dict[str, Any]
options: Dict[str, None] options: Dict[str, None]
selected_fields: None selected_fields: None
stream: TextIOWrapper stream: TextIOWrapper
@@ -19,7 +19,6 @@ class Serializer(PythonSerializer):
def start_serialization(self) -> None: ... def start_serialization(self) -> None: ...
def end_serialization(self) -> None: ... def end_serialization(self) -> None: ...
def end_object(self, obj: Model) -> None: ... def end_object(self, obj: Model) -> None: ...
def getvalue(self) -> Optional[Union[bytes, str]]: ...
def Deserializer(stream_or_string: Any, **options: Any) -> None: ... def Deserializer(stream_or_string: Any, **options: Any) -> None: ...
@@ -27,7 +26,7 @@ class DjangoJSONEncoder(json.JSONEncoder):
allow_nan: bool allow_nan: bool
check_circular: bool check_circular: bool
ensure_ascii: bool ensure_ascii: bool
indent: None indent: int
skipkeys: bool skipkeys: bool
sort_keys: bool sort_keys: bool
def default(self, o: Union[datetime, Decimal, UUID]) -> str: ... def default(self, o: Union[datetime, Decimal, UUID]) -> str: ...

View File

@@ -1,6 +1,6 @@
from collections import OrderedDict from collections import OrderedDict
from io import TextIOWrapper from io import TextIOWrapper
from typing import Any, Dict, Iterator, List, Optional, Union from typing import Any, Dict, Iterator, List
from django.core.serializers.base import DeserializedObject from django.core.serializers.base import DeserializedObject
from django.db.models.base import Model from django.db.models.base import Model
@@ -25,16 +25,7 @@ class Serializer(base.Serializer):
def handle_field(self, obj: Model, field: Field) -> None: ... def handle_field(self, obj: Model, field: Field) -> None: ...
def handle_fk_field(self, obj: Model, field: ForeignKey) -> None: ... def handle_fk_field(self, obj: Model, field: ForeignKey) -> None: ...
def handle_m2m_field(self, obj: Model, field: ManyToManyField) -> None: ... def handle_m2m_field(self, obj: Model, field: ManyToManyField) -> None: ...
def getvalue(self) -> List[OrderedDict]: ...
def Deserializer( def Deserializer(
object_list: Union[ object_list: List[Dict[str, Any]], *, using: Any = ..., ignorenonexistent: bool = ..., **options: Any
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 = ...,
ignorenonexistent: bool = ...,
**options: Any
) -> Iterator[DeserializedObject]: ... ) -> Iterator[DeserializedObject]: ...

View File

@@ -15,17 +15,14 @@ class WSGIServer(simple_server.WSGIServer):
class ThreadedWSGIServer(socketserver.ThreadingMixIn, WSGIServer): ... class ThreadedWSGIServer(socketserver.ThreadingMixIn, WSGIServer): ...
class ServerHandler(simple_server.ServerHandler): class ServerHandler(simple_server.ServerHandler):
http_version: str = ...
def handle_error(self) -> None: ... def handle_error(self) -> None: ...
class WSGIRequestHandler(simple_server.WSGIRequestHandler): class WSGIRequestHandler(simple_server.WSGIRequestHandler):
client_address: str
close_connection: bool close_connection: bool
connection: WSGIRequest connection: WSGIRequest
request: WSGIRequest request: WSGIRequest
rfile: BytesIO rfile: BytesIO
server: None wfile: BytesIO
wfile: socketserver._SocketWriter
protocol_version: str = ... protocol_version: str = ...
def address_string(self) -> str: ... def address_string(self) -> str: ...
def log_message(self, format: str, *args: Any) -> None: ... def log_message(self, format: str, *args: Any) -> None: ...
@@ -33,5 +30,4 @@ class WSGIRequestHandler(simple_server.WSGIRequestHandler):
raw_requestline: bytes = ... raw_requestline: bytes = ...
requestline: str = ... requestline: str = ...
request_version: str = ... request_version: str = ...
command: None = ...
def handle(self) -> None: ... def handle(self) -> None: ...

View File

@@ -5,7 +5,6 @@ from typing import Any, Dict, List, Optional, Union, Pattern
from uuid import UUID from uuid import UUID
from django.core.files.base import File from django.core.files.base import File
from django.utils.functional import SimpleLazyObject
EMPTY_VALUES: Any EMPTY_VALUES: Any
@@ -27,7 +26,7 @@ class RegexValidator:
inverse_match: Optional[bool] = ..., inverse_match: Optional[bool] = ...,
flags: Optional[RegexFlag] = ..., flags: Optional[RegexFlag] = ...,
) -> None: ... ) -> None: ...
def __call__(self, value: Optional[Union[float, str]]) -> None: ... def __call__(self, value: Optional[str]) -> None: ...
class URLValidator(RegexValidator): class URLValidator(RegexValidator):
ul: str = ... ul: str = ...
@@ -39,7 +38,6 @@ class URLValidator(RegexValidator):
host_re: Any = ... host_re: Any = ...
schemes: Any = ... schemes: Any = ...
def __init__(self, schemes: Optional[List[str]] = ..., **kwargs: Any) -> None: ... def __init__(self, schemes: Optional[List[str]] = ..., **kwargs: Any) -> None: ...
def __call__(self, value: str) -> None: ...
integer_validator: Any integer_validator: Any
@@ -80,33 +78,29 @@ validate_comma_separated_integer_list: Any
class BaseValidator: class BaseValidator:
message: Any = ... message: Any = ...
code: str = ... code: str = ...
limit_value: bool = ... limit_value: Any = ...
def __init__(self, limit_value: Any, message: Optional[str] = ...) -> None: ... def __init__(self, limit_value: Any, message: Optional[str] = ...) -> None: ...
def __call__(self, value: Any) -> None: ... def __call__(self, value: Any) -> None: ...
def compare(self, a: bool, b: bool) -> bool: ... def compare(self, a: bool, b: bool) -> bool: ...
def clean(self, x: Any) -> Any: ... def clean(self, x: Any) -> Any: ...
class MaxValueValidator(BaseValidator): class MaxValueValidator(BaseValidator):
limit_value: Decimal
message: Any = ... message: Any = ...
code: str = ... code: str = ...
def compare(self, a: Union[datetime, Decimal, float], b: Union[datetime, Decimal, float]) -> bool: ... def compare(self, a: Union[datetime, Decimal, float], b: Union[datetime, Decimal, float]) -> bool: ...
class MinValueValidator(BaseValidator): class MinValueValidator(BaseValidator):
limit_value: int
message: Any = ... message: Any = ...
code: str = ... code: str = ...
def compare(self, a: Union[datetime, Decimal, float], b: Union[datetime, Decimal, float]) -> bool: ... def compare(self, a: Union[datetime, Decimal, float], b: Union[datetime, Decimal, float]) -> bool: ...
class MinLengthValidator(BaseValidator): class MinLengthValidator(BaseValidator):
limit_value: int
message: Any = ... message: Any = ...
code: str = ... code: str = ...
def compare(self, a: int, b: int) -> bool: ... def compare(self, a: int, b: int) -> bool: ...
def clean(self, x: str) -> int: ... def clean(self, x: str) -> int: ...
class MaxLengthValidator(BaseValidator): class MaxLengthValidator(BaseValidator):
limit_value: int
message: Any = ... message: Any = ...
code: str = ... code: str = ...
def compare(self, a: int, b: int) -> bool: ... def compare(self, a: int, b: int) -> bool: ...

View File

@@ -10,7 +10,6 @@ class Node:
children: Set[Any] = ... children: Set[Any] = ...
parents: Set[Any] = ... parents: Set[Any] = ...
def __init__(self, key: Tuple[str, str]) -> None: ... def __init__(self, key: Tuple[str, str]) -> None: ...
def __eq__(self, other: Tuple[str, str]) -> bool: ...
def __lt__(self, other: Union[Tuple[str, str], Node]) -> bool: ... def __lt__(self, other: Union[Tuple[str, str], Node]) -> bool: ...
def __hash__(self) -> int: ... def __hash__(self) -> int: ...
def __getitem__(self, item: int) -> str: ... def __getitem__(self, item: int) -> str: ...

View File

@@ -13,7 +13,6 @@ class Migration:
name: str = ... name: str = ...
app_label: str = ... app_label: str = ...
def __init__(self, name: str, app_label: str) -> None: ... def __init__(self, name: str, app_label: str) -> None: ...
def __eq__(self, other: object) -> bool: ...
def __hash__(self) -> int: ... def __hash__(self) -> int: ...
def mutate_state(self, project_state: ProjectState, preserve: bool = ...) -> ProjectState: ... def mutate_state(self, project_state: ProjectState, preserve: bool = ...) -> ProjectState: ...
def apply( def apply(

View File

@@ -8,6 +8,5 @@ class RegexObject:
pattern: str = ... pattern: str = ...
flags: int = ... flags: int = ...
def __init__(self, obj: SimpleLazyObject) -> None: ... def __init__(self, obj: SimpleLazyObject) -> None: ...
def __eq__(self, other: RegexObject) -> bool: ...
def get_migration_name_timestamp() -> str: ... def get_migration_name_timestamp() -> str: ...

View File

@@ -18,7 +18,6 @@ from .fields import (
TextField as TextField, TextField as TextField,
BooleanField as BooleanField, BooleanField as BooleanField,
NullBooleanField as NullBooleanField, NullBooleanField as NullBooleanField,
FileField as FileField,
DateField as DateField, DateField as DateField,
TimeField as TimeField, TimeField as TimeField,
DateTimeField as DateTimeField, DateTimeField as DateTimeField,
@@ -31,7 +30,12 @@ from .fields import (
DurationField as DurationField, DurationField as DurationField,
) )
from .fields.related import ForeignKey as ForeignKey, OneToOneField as OneToOneField, ManyToManyField as ManyToManyField from .fields.related import (
ForeignKey as ForeignKey,
OneToOneField as OneToOneField,
ManyToManyField as ManyToManyField,
ForeignObject as ForeignObject,
)
from .fields.files import ImageField as ImageField, FileField as FileField from .fields.files import ImageField as ImageField, FileField as FileField
from .deletion import ( from .deletion import (

View File

@@ -79,7 +79,6 @@ class BaseExpression:
def desc(self, **kwargs: Any) -> Expression: ... def desc(self, **kwargs: Any) -> Expression: ...
def reverse_ordering(self): ... def reverse_ordering(self): ...
def flatten(self) -> Iterator[Expression]: ... def flatten(self) -> Iterator[Expression]: ...
def __eq__(self, other: object) -> bool: ...
def __hash__(self) -> int: ... def __hash__(self) -> int: ...
class Expression(BaseExpression, Combinable): ... class Expression(BaseExpression, Combinable): ...

View File

@@ -1,10 +1,11 @@
from typing import Any, Callable, Dict, List, Optional, Tuple, Type, Union from typing import Any, Callable, List, Optional, Type, Union
from django.core.checks.messages import Error from django.core.checks.messages import Error
from django.core.files.base import File from django.core.files.base import File
from django.core.files.images import ImageFile from django.core.files.images import ImageFile
from django.core.files.storage import FileSystemStorage, Storage, DefaultStorage from django.core.files.storage import FileSystemStorage, Storage
from django.db.models.base import Model from django.db.models.base import Model
from django.db.models.fields import Field from django.db.models.fields import Field
from django.forms import fields as form_fields from django.forms import fields as form_fields
@@ -13,8 +14,6 @@ class FieldFile(File):
field: FileField = ... field: FileField = ...
storage: FileSystemStorage = ... storage: FileSystemStorage = ...
def __init__(self, instance: Model, field: FileField, name: Optional[str]) -> None: ... def __init__(self, instance: Model, field: FileField, name: Optional[str]) -> None: ...
def __eq__(self, other: Any) -> bool: ...
def __hash__(self): ...
file: Any = ... file: Any = ...
@property @property
def path(self) -> str: ... def path(self) -> str: ...
@@ -22,19 +21,16 @@ class FieldFile(File):
def url(self) -> str: ... def url(self) -> str: ...
@property @property
def size(self) -> int: ... def size(self) -> int: ...
def open(self, mode: str = ...) -> FieldFile: ...
name: Optional[str] = ...
def save(self, name: str, content: File, save: bool = ...) -> None: ... def save(self, name: str, content: File, save: bool = ...) -> None: ...
def delete(self, save: bool = ...) -> None: ... def delete(self, save: bool = ...) -> None: ...
@property @property
def closed(self) -> bool: ... def closed(self) -> bool: ...
def close(self) -> None: ...
class FileDescriptor: class FileDescriptor:
field: FileField = ... field: FileField = ...
def __init__(self, field: FileField) -> None: ... def __init__(self, field: FileField) -> None: ...
def __get__(self, instance: Optional[Model], cls: Type[Model] = ...) -> Union[FieldFile, FileDescriptor]: ... def __get__(self, instance: Optional[Model], cls: Type[Model] = ...) -> Union[FieldFile, FileDescriptor]: ...
def __set__(self, instance: Model, value: Optional[Union[File, str]]) -> None: ... def __set__(self, instance: Model, value: Optional[Any]) -> None: ...
class FileField(Field): class FileField(Field):
attr_class: Any = ... attr_class: Any = ...
@@ -66,9 +62,6 @@ class ImageFileDescriptor(FileDescriptor):
class ImageFieldFile(ImageFile, FieldFile): class ImageFieldFile(ImageFile, FieldFile):
field: ImageField field: ImageField
instance: Model
name: Optional[str]
storage: DefaultStorage
def delete(self, save: bool = ...) -> None: ... def delete(self, save: bool = ...) -> None: ...
class ImageField(FileField): class ImageField(FileField):

View File

@@ -5,7 +5,7 @@ from django.db.models.base import Model
NOT_PROVIDED: Any NOT_PROVIDED: Any
class FieldCacheMixin: class FieldCacheMixin:
def get_cache_name(self) -> None: ... def get_cache_name(self) -> str: ...
def get_cached_value(self, instance: Model, default: Any = ...) -> Optional[Model]: ... def get_cached_value(self, instance: Model, default: Any = ...) -> Optional[Model]: ...
def is_cached(self, instance: Model) -> bool: ... def is_cached(self, instance: Model) -> bool: ...
def set_cached_value(self, instance: Model, value: Optional[Model]) -> None: ... def set_cached_value(self, instance: Model, value: Optional[Model]) -> None: ...

View File

@@ -34,6 +34,8 @@ class RelatedField(FieldCacheMixin, Field):
@property @property
def target_field(self) -> Field: ... def target_field(self) -> Field: ...
class ForeignObject(RelatedField): ...
class ForeignKey(RelatedField, Generic[_T]): class ForeignKey(RelatedField, Generic[_T]):
def __init__(self, to: Union[Type[_T], str], on_delete: Any, related_name: str = ..., **kwargs): ... def __init__(self, to: Union[Type[_T], str], on_delete: Any, related_name: str = ..., **kwargs): ...
def __get__(self, instance, owner) -> _T: ... def __get__(self, instance, owner) -> _T: ...

View File

@@ -2,13 +2,13 @@ from typing import Any, Callable, List, Optional, Tuple, Type, Union, Generic, T
from django.core.exceptions import ObjectDoesNotExist from django.core.exceptions import ObjectDoesNotExist
from django.db.models.base import Model from django.db.models.base import Model
from django.db.models.expressions import F
from django.db.models.fields import Field
from django.db.models.fields.mixins import FieldCacheMixin from django.db.models.fields.mixins import FieldCacheMixin
from django.db.models.fields.related import RelatedField, OneToOneField from django.db.models.fields.related import RelatedField, OneToOneField
from django.db.models.fields.reverse_related import ManyToManyRel, OneToOneRel from django.db.models.fields.reverse_related import ManyToManyRel, OneToOneRel
from django.db.models.query import QuerySet from django.db.models.query import QuerySet
from django.db.models.fields import Field
_T = TypeVar("_T") _T = TypeVar("_T")
class ForwardManyToOneDescriptor: class ForwardManyToOneDescriptor:
@@ -24,14 +24,13 @@ class ForwardManyToOneDescriptor:
def __get__( def __get__(
self, instance: Optional[Model], cls: Type[Model] = ... self, instance: Optional[Model], cls: Type[Model] = ...
) -> Optional[Union[Model, ForwardManyToOneDescriptor]]: ... ) -> Optional[Union[Model, ForwardManyToOneDescriptor]]: ...
def __set__(self, instance: Model, value: Optional[Union[Model, F]]) -> None: ... def __set__(self, instance: Model, value: Optional[Model]) -> None: ...
def __reduce__(self) -> Tuple[Callable, Tuple[Type[Model], str]]: ... def __reduce__(self) -> Tuple[Callable, Tuple[Type[Model], str]]: ...
class ForwardOneToOneDescriptor(ForwardManyToOneDescriptor): class ForwardOneToOneDescriptor(ForwardManyToOneDescriptor):
RelatedObjectDoesNotExist: Type[ObjectDoesNotExist] RelatedObjectDoesNotExist: Type[ObjectDoesNotExist]
field: OneToOneField field: OneToOneField
def get_object(self, instance: Model) -> Model: ... def get_object(self, instance: Model) -> Model: ...
def __set__(self, instance: Model, value: Optional[Model]) -> None: ...
class ReverseOneToOneDescriptor: class ReverseOneToOneDescriptor:
RelatedObjectDoesNotExist: Type[ObjectDoesNotExist] RelatedObjectDoesNotExist: Type[ObjectDoesNotExist]

View File

@@ -22,15 +22,16 @@ class ForeignObjectRel(FieldCacheMixin):
editable: bool = ... editable: bool = ...
is_relation: bool = ... is_relation: bool = ...
null: bool = ... null: bool = ...
field: Field = ... field: RelatedField = ...
model: Union[Type[Model], str] = ... model: Union[Type[Model], str] = ...
related_name: Optional[str] = ... related_name: Optional[str] = ...
related_query_name: None = ... related_query_name: Optional[str] = ...
limit_choices_to: Dict[Any, Any] = ... limit_choices_to: Union[Callable, Dict[str, Any]] = ...
parent_link: bool = ... parent_link: bool = ...
on_delete: Callable = ... on_delete: Callable = ...
symmetrical: bool = ... symmetrical: bool = ...
multiple: bool = ... multiple: bool = ...
field_name: Optional[str] = ...
def __init__( def __init__(
self, self,
field: RelatedField, field: RelatedField,
@@ -41,17 +42,10 @@ class ForeignObjectRel(FieldCacheMixin):
parent_link: bool = ..., parent_link: bool = ...,
on_delete: Optional[Callable] = ..., on_delete: Optional[Callable] = ...,
) -> None: ... ) -> None: ...
def hidden(self) -> bool: ...
def name(self) -> str: ...
@property @property
def remote_field(self) -> RelatedField: ... def remote_field(self) -> RelatedField: ...
@property @property
def target_field(self) -> AutoField: ... def target_field(self) -> AutoField: ...
def related_model(self) -> Type[Model]: ...
def many_to_many(self) -> bool: ...
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[BuiltinLookup]: ... def get_lookup(self, lookup_name: str) -> Type[BuiltinLookup]: ...
def get_internal_type(self) -> str: ... def get_internal_type(self) -> str: ...
@property @property
@@ -64,14 +58,12 @@ class ForeignObjectRel(FieldCacheMixin):
def get_extra_restriction( def get_extra_restriction(
self, where_class: Type[WhereNode], alias: str, related_alias: str self, where_class: Type[WhereNode], alias: str, related_alias: str
) -> Optional[Union[StartsWith, WhereNode]]: ... ) -> Optional[Union[StartsWith, WhereNode]]: ...
field_name: None = ...
def set_field_name(self) -> None: ... def set_field_name(self) -> None: ...
def get_accessor_name(self, model: Optional[Type[Model]] = ...) -> Optional[str]: ... def get_accessor_name(self, model: Optional[Type[Model]] = ...) -> Optional[str]: ...
def get_path_info(self, filtered_relation: Optional[FilteredRelation] = ...) -> List[PathInfo]: ... def get_path_info(self, filtered_relation: Optional[FilteredRelation] = ...) -> List[PathInfo]: ...
def get_cache_name(self) -> str: ...
class ManyToOneRel(ForeignObjectRel): class ManyToOneRel(ForeignObjectRel):
field: ForeignKey field: RelatedField
hidden: bool hidden: bool
limit_choices_to: Any limit_choices_to: Any
many_to_many: bool many_to_many: bool
@@ -87,7 +79,6 @@ class ManyToOneRel(ForeignObjectRel):
related_name: Optional[str] related_name: Optional[str]
related_query_name: Optional[str] related_query_name: Optional[str]
symmetrical: bool symmetrical: bool
field_name: Optional[str] = ...
def __init__( def __init__(
self, self,
field: ForeignKey, field: ForeignKey,
@@ -103,7 +94,6 @@ class ManyToOneRel(ForeignObjectRel):
def set_field_name(self) -> None: ... def set_field_name(self) -> None: ...
class OneToOneRel(ManyToOneRel): class OneToOneRel(ManyToOneRel):
field: OneToOneField
field_name: Optional[str] field_name: Optional[str]
hidden: bool hidden: bool
limit_choices_to: Dict[str, str] limit_choices_to: Dict[str, str]
@@ -133,20 +123,11 @@ class OneToOneRel(ManyToOneRel):
) -> None: ... ) -> None: ...
class ManyToManyRel(ForeignObjectRel): class ManyToManyRel(ForeignObjectRel):
field: RelatedField
field_name: None field_name: None
hidden: bool
limit_choices_to: Union[Callable, Dict[str, str]]
model: Union[Type[Model], str]
multiple: bool multiple: bool
name: str name: str
on_delete: None
one_to_many: bool
one_to_one: bool
parent_link: bool parent_link: bool
related_model: Type[Model] related_model: Type[Model]
related_name: Optional[str]
related_query_name: Optional[str]
through: Optional[Union[Type[Model], str]] = ... through: Optional[Union[Type[Model], str]] = ...
through_fields: Optional[Tuple[str, str]] = ... through_fields: Optional[Tuple[str, str]] = ...
symmetrical: bool = ... symmetrical: bool = ...

View File

@@ -21,4 +21,3 @@ class Index:
def deconstruct(self) -> Tuple[str, Tuple, Dict[str, Union[List[str], str]]]: ... def deconstruct(self) -> Tuple[str, Tuple, Dict[str, Union[List[str], str]]]: ...
def clone(self) -> Index: ... def clone(self) -> Index: ...
def set_name_with_model(self, model: Type[Model]) -> None: ... def set_name_with_model(self, model: Type[Model]) -> None: ...
def __eq__(self, other: object) -> bool: ...

View File

@@ -1,22 +1,22 @@
import collections
from typing import Any, Callable, Dict, Iterator, List, Optional, Set, Tuple, Type, Union from typing import Any, Callable, Dict, Iterator, List, Optional, Set, Tuple, Type, Union
from django.apps.config import AppConfig from django.apps.config import AppConfig
from django.contrib.auth.base_user import AbstractBaseUser from django.apps.registry import Apps
from django.contrib.auth.models import AbstractUser, PermissionsMixin
from django.contrib.contenttypes.fields import GenericForeignKey from django.contrib.contenttypes.fields import GenericForeignKey
from django.contrib.postgres.fields.array import ArrayField from django.contrib.postgres.fields.array import ArrayField
from django.contrib.postgres.fields.citext import CIText from django.contrib.postgres.fields.citext import CIText
from django.contrib.sessions.base_session import AbstractBaseSession
from django.db.backends.sqlite3.base import DatabaseWrapper from django.db.backends.sqlite3.base import DatabaseWrapper
from django.db.models.base import Model from django.db.models.base import Model
from django.db.models.fields import Field
from django.db.models.fields.mixins import FieldCacheMixin from django.db.models.fields.mixins import FieldCacheMixin
from django.db.models.fields.related import OneToOneField from django.db.models.fields.related import OneToOneField, ManyToManyField
from django.db.models.fields.reverse_related import ForeignObjectRel from django.db.models.fields.reverse_related import ForeignObjectRel
from django.db.models.manager import Manager from django.db.models.manager import Manager
from django.db.models.query_utils import PathInfo from django.db.models.query_utils import PathInfo
from django.utils.datastructures import ImmutableList from django.utils.datastructures import ImmutableList
from django.db.models.fields import Field, mixins, AutoField
PROXY_PARENTS: Any PROXY_PARENTS: Any
EMPTY_RELATION_TREE: Any EMPTY_RELATION_TREE: Any
IMMUTABLE_WARNING: str IMMUTABLE_WARNING: str
@@ -30,21 +30,21 @@ def make_immutable_fields_list(
) -> ImmutableList: ... ) -> ImmutableList: ...
class Options: class Options:
base_manager: django.db.models.manager.Manager base_manager: Manager
concrete_fields: django.utils.datastructures.ImmutableList concrete_fields: ImmutableList
default_manager: django.db.models.manager.Manager default_manager: Manager
fields: django.utils.datastructures.ImmutableList fields: ImmutableList
local_concrete_fields: django.utils.datastructures.ImmutableList local_concrete_fields: ImmutableList
managers: django.utils.datastructures.ImmutableList managers: ImmutableList
managers_map: Dict[str, django.db.models.manager.Manager] managers_map: Dict[str, Manager]
related_objects: django.utils.datastructures.ImmutableList related_objects: ImmutableList
FORWARD_PROPERTIES: Any = ... FORWARD_PROPERTIES: Any = ...
REVERSE_PROPERTIES: Any = ... REVERSE_PROPERTIES: Any = ...
default_apps: Any = ... default_apps: Any = ...
local_fields: List[Field] = ... local_fields: List[Field] = ...
local_many_to_many: List[django.db.models.fields.related.ManyToManyField] = ... local_many_to_many: List[ManyToManyField] = ...
private_fields: List[Any] = ... private_fields: List[Any] = ...
local_managers: List[django.db.models.manager.Manager] = ... local_managers: List[Manager] = ...
base_manager_name: None = ... base_manager_name: None = ...
default_manager_name: None = ... default_manager_name: None = ...
model_name: Optional[str] = ... model_name: Optional[str] = ...
@@ -65,18 +65,9 @@ class Options:
db_tablespace: str = ... db_tablespace: str = ...
required_db_features: List[Any] = ... required_db_features: List[Any] = ...
required_db_vendor: None = ... required_db_vendor: None = ...
meta: Optional[ meta: Optional[type] = ...
Type[
Union[
django.contrib.auth.base_user.AbstractBaseUser.Meta,
django.contrib.auth.models.AbstractUser.Meta,
django.contrib.auth.models.PermissionsMixin.Meta,
django.contrib.sessions.base_session.AbstractBaseSession.Meta,
]
]
] = ...
pk: Optional[Field] = ... pk: Optional[Field] = ...
auto_field: Optional[django.db.models.fields.AutoField] = ... auto_field: Optional[AutoField] = ...
abstract: bool = ... abstract: bool = ...
managed: bool = ... managed: bool = ...
proxy: bool = ... proxy: bool = ...
@@ -88,13 +79,7 @@ class Options:
related_fkey_lookups: List[Any] = ... related_fkey_lookups: List[Any] = ...
apps: Apps = ... apps: Apps = ...
default_related_name: None = ... default_related_name: None = ...
def __init__( def __init__(self, meta: Optional[type], app_label: Optional[str] = ...) -> None: ...
self,
meta: Optional[
Type[Union[AbstractBaseUser.Meta, AbstractUser.Meta, PermissionsMixin.Meta, AbstractBaseSession.Meta]]
],
app_label: Optional[str] = ...,
) -> None: ...
@property @property
def label(self) -> str: ... def label(self) -> str: ...
@property @property
@@ -115,15 +100,7 @@ class Options:
def verbose_name_raw(self) -> Any: ... def verbose_name_raw(self) -> Any: ...
@property @property
def swapped(self) -> Optional[str]: ... def swapped(self) -> Optional[str]: ...
def managers(self) -> ImmutableList: ...
def managers_map(self) -> Dict[str, Manager]: ...
def base_manager(self) -> Manager: ...
def default_manager(self) -> Manager: ...
def fields(self) -> ImmutableList: ...
def concrete_fields(self) -> ImmutableList: ...
def local_concrete_fields(self) -> ImmutableList: ...
def many_to_many(self) -> ImmutableList: ... def many_to_many(self) -> ImmutableList: ...
def related_objects(self) -> ImmutableList: ...
def fields_map(self) -> Dict[str, ForeignObjectRel]: ... def fields_map(self) -> Dict[str, ForeignObjectRel]: ...
def get_field(self, field_name: Union[Callable, str]) -> Union[Field, mixins.FieldCacheMixin]: ... def get_field(self, field_name: Union[Callable, str]) -> Union[Field, mixins.FieldCacheMixin]: ...
def get_base_chain(self, model: Type[Model]) -> List[Type[Model]]: ... def get_base_chain(self, model: Type[Model]) -> List[Type[Model]]: ...

View File

@@ -34,7 +34,6 @@ class Join:
def as_sql(self, compiler: SQLCompiler, connection: Any) -> Tuple[str, List[Union[int, str]]]: ... def as_sql(self, compiler: SQLCompiler, connection: Any) -> Tuple[str, List[Union[int, str]]]: ...
def relabeled_clone(self, change_map: Union[Dict[str, str], OrderedDict]) -> Join: ... def relabeled_clone(self, change_map: Union[Dict[str, str], OrderedDict]) -> Join: ...
def equals(self, other: Union[BaseTable, Join], with_filtered_relation: bool) -> bool: ... def equals(self, other: Union[BaseTable, Join], with_filtered_relation: bool) -> bool: ...
def __eq__(self, other: Union[BaseTable, Join]) -> bool: ...
def demote(self) -> Join: ... def demote(self) -> Join: ...
def promote(self) -> Join: ... def promote(self) -> Join: ...

View File

@@ -0,0 +1,7 @@
from .forms import Form as Form, BaseForm as BaseForm
from .models import ModelForm as ModelForm
from .widgets import Widget as Widget, ChoiceWidget as ChoiceWidget
from .fields import Field as Field, CharField as CharField

View File

@@ -42,7 +42,6 @@ class BoundField:
def auto_id(self) -> str: ... def auto_id(self) -> str: ...
@property @property
def id_for_label(self) -> str: ... def id_for_label(self) -> str: ...
def initial(self) -> Any: ...
def build_widget_attrs( def build_widget_attrs(
self, attrs: Dict[str, str], widget: Optional[Widget] = ... self, attrs: Dict[str, str], widget: Optional[Widget] = ...
) -> Dict[str, Union[bool, str]]: ... ) -> Dict[str, Union[bool, str]]: ...

View File

@@ -1,22 +1,21 @@
from collections import OrderedDict import decimal
from datetime import date, datetime, time, timedelta from datetime import date, datetime, time, timedelta
from decimal import Decimal from decimal import Decimal
from typing import Any, Callable, Dict, List, Optional, Tuple, Union, Type from typing import Any, Callable, Dict, List, Optional, Tuple, Union, Type
from uuid import UUID from uuid import UUID
from django.core.files.base import File from django.core.files.base import File
from django.core.files.uploadedfile import SimpleUploadedFile
from django.core.validators import BaseValidator from django.core.validators import BaseValidator
from django.db.models.fields.files import FieldFile from django.db.models.fields.files import FieldFile
from django.forms.boundfield import BoundField from django.forms.boundfield import BoundField
from django.forms.forms import BaseForm from django.forms.forms import BaseForm
from django.forms.widgets import Input, Widget from django.forms.widgets import Widget
class Field: class Field:
initial: None initial: Any
label: None label: Optional[str]
required: bool required: bool
widget: Input = ... widget: Widget = ...
hidden_widget: Any = ... hidden_widget: Any = ...
default_validators: Any = ... default_validators: Any = ...
default_error_messages: Any = ... default_error_messages: Any = ...
@@ -24,7 +23,7 @@ class Field:
show_hidden_initial: bool = ... show_hidden_initial: bool = ...
help_text: str = ... help_text: str = ...
disabled: bool = ... disabled: bool = ...
label_suffix: None = ... label_suffix: Optional[Any] = ...
localize: bool = ... localize: bool = ...
error_messages: Any = ... error_messages: Any = ...
validators: List[BaseValidator] = ... validators: List[BaseValidator] = ...
@@ -44,28 +43,19 @@ class Field:
label_suffix: Optional[Any] = ... label_suffix: Optional[Any] = ...
) -> None: ... ) -> None: ...
def prepare_value(self, value: Any) -> Any: ... def prepare_value(self, value: Any) -> Any: ...
def to_python( def to_python(self, value: Optional[Any]) -> Optional[Any]: ...
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 validate(self, value: Any) -> None: ...
def run_validators(self, value: Any) -> None: ... def run_validators(self, value: Any) -> None: ...
def clean(self, value: Any) -> Any: ... def clean(self, value: Any) -> Any: ...
def bound_data(self, data: Any, initial: Any) -> Any: ... def bound_data(self, data: Any, initial: Any) -> Any: ...
def widget_attrs(self, widget: Widget) -> Dict[Any, Any]: ... def widget_attrs(self, widget: Widget) -> Any: ...
def has_changed(self, initial: Optional[Union[datetime, Decimal, float, str]], data: Optional[str]) -> bool: ... def has_changed(self, initial: Any, data: Optional[str]) -> bool: ...
def get_bound_field(self, form: BaseForm, field_name: str) -> BoundField: ... def get_bound_field(self, form: BaseForm, field_name: str) -> BoundField: ...
def __deepcopy__( def __deepcopy__(self, memo: Dict[Any, Any]) -> Field: ...
self, memo: Dict[int, Union[List[Tuple[Union[int, str], str]], List[Widget], OrderedDict, Field, Widget]]
) -> Field: ...
class CharField(Field): class CharField(Field):
disabled: bool disabled: bool
error_messages: Dict[str, str] error_messages: Dict[str, str]
help_text: str
initial: Optional[Union[Callable, str]]
label: Optional[str]
label_suffix: Optional[str]
localize: bool
required: bool required: bool
show_hidden_initial: bool show_hidden_initial: bool
max_length: Optional[Union[int, str]] = ... max_length: Optional[Union[int, str]] = ...
@@ -81,53 +71,32 @@ class CharField(Field):
empty_value: str = ..., empty_value: str = ...,
**kwargs: Any **kwargs: Any
) -> None: ... ) -> None: ...
def to_python(self, value: Optional[Union[List[int], Tuple, int, str]]) -> Optional[str]: ...
def widget_attrs(self, widget: Widget) -> Dict[str, str]: ...
class IntegerField(Field): class IntegerField(Field):
disabled: bool disabled: bool
error_messages: Dict[str, str] error_messages: Dict[str, str]
help_text: str max_value: Optional[Any]
initial: Optional[Union[Callable, int]] min_value: Optional[Any]
label: Optional[str]
label_suffix: None
localize: bool
max_value: Optional[int]
min_value: Optional[int]
required: bool required: bool
show_hidden_initial: bool show_hidden_initial: bool
default_error_messages: Any = ... default_error_messages: Any = ...
re_decimal: Any = ... re_decimal: Any = ...
def __init__(self, *, max_value: Optional[Any] = ..., min_value: Optional[Any] = ..., **kwargs: Any) -> None: ... def __init__(self, *, max_value: Optional[Any] = ..., min_value: Optional[Any] = ..., **kwargs: Any) -> None: ...
def to_python(self, value: Optional[Union[float, str]]) -> Optional[int]: ...
def widget_attrs(self, widget: Widget) -> Dict[str, Union[Decimal, float]]: ...
class FloatField(IntegerField): class FloatField(IntegerField):
disabled: bool disabled: bool
error_messages: Dict[str, str] error_messages: Dict[str, str]
help_text: str
initial: None
label: Optional[str]
label_suffix: None
localize: bool
max_value: Optional[float] max_value: Optional[float]
min_value: Optional[float] min_value: Optional[float]
required: bool required: bool
show_hidden_initial: bool show_hidden_initial: bool
default_error_messages: Any = ... default_error_messages: Any = ...
def to_python(self, value: Optional[Union[float, str]]) -> Optional[float]: ...
def validate(self, value: Optional[float]) -> None: ... def validate(self, value: Optional[float]) -> None: ...
def widget_attrs(self, widget: Input) -> Dict[str, Union[float, str]]: ...
class DecimalField(IntegerField): class DecimalField(IntegerField):
decimal_places: Optional[int] decimal_places: Optional[int]
disabled: bool disabled: bool
error_messages: Dict[str, str] error_messages: Dict[str, str]
help_text: str
initial: None
label: Optional[str]
label_suffix: None
localize: bool
max_digits: Optional[int] max_digits: Optional[int]
max_value: Optional[Union[decimal.Decimal, int]] max_value: Optional[Union[decimal.Decimal, int]]
min_value: Optional[Union[decimal.Decimal, int]] min_value: Optional[Union[decimal.Decimal, int]]
@@ -143,84 +112,52 @@ class DecimalField(IntegerField):
decimal_places: Optional[Any] = ..., decimal_places: Optional[Any] = ...,
**kwargs: Any **kwargs: Any
) -> None: ... ) -> None: ...
def to_python(self, value: Optional[Union[Decimal, float, str]]) -> Optional[Decimal]: ...
def validate(self, value: Optional[Decimal]) -> None: ... def validate(self, value: Optional[Decimal]) -> None: ...
def widget_attrs(self, widget: Widget) -> Dict[str, Union[Decimal, int, str]]: ...
class BaseTemporalField(Field): class BaseTemporalField(Field):
input_formats: Any = ... input_formats: Any = ...
def __init__(self, *, input_formats: Optional[Any] = ..., **kwargs: Any) -> None: ... def __init__(self, *, input_formats: Optional[Any] = ..., **kwargs: Any) -> None: ...
def to_python(self, value: str) -> datetime: ... def strptime(self, value: Any, format: Any) -> Any: ...
def strptime(self, value: Any, format: Any) -> None: ...
class DateField(BaseTemporalField): class DateField(BaseTemporalField):
disabled: bool disabled: bool
error_messages: Dict[str, str] error_messages: Dict[str, str]
help_text: str
initial: Optional[Union[Callable, datetime.date]]
label: Optional[str]
label_suffix: None
localize: bool
required: bool required: bool
show_hidden_initial: bool show_hidden_initial: bool
input_formats: Any = ... input_formats: Any = ...
default_error_messages: Any = ... default_error_messages: Any = ...
def to_python(self, value: Optional[Union[date, str]]) -> Optional[date]: ...
def strptime(self, value: str, format: str) -> date: ... def strptime(self, value: str, format: str) -> date: ...
class TimeField(BaseTemporalField): class TimeField(BaseTemporalField):
disabled: bool disabled: bool
error_messages: Dict[str, str] error_messages: Dict[str, str]
help_text: str
initial: Optional[Callable]
label: Optional[str]
label_suffix: None
localize: bool
required: bool required: bool
show_hidden_initial: bool show_hidden_initial: bool
input_formats: Any = ... input_formats: Any = ...
default_error_messages: Any = ... default_error_messages: Any = ...
def to_python(self, value: Optional[Union[time, str]]) -> Optional[time]: ...
def strptime(self, value: str, format: str) -> time: ... def strptime(self, value: str, format: str) -> time: ...
class DateTimeField(BaseTemporalField): class DateTimeField(BaseTemporalField):
disabled: bool disabled: bool
error_messages: Dict[str, str] error_messages: Dict[str, str]
help_text: str
initial: Optional[Union[Callable, datetime.datetime]]
label: Optional[str]
label_suffix: None
localize: bool
required: bool required: bool
show_hidden_initial: bool show_hidden_initial: bool
input_formats: Any = ... input_formats: Any = ...
default_error_messages: Any = ... default_error_messages: Any = ...
def prepare_value(self, value: Optional[datetime]) -> Optional[datetime]: ... def prepare_value(self, value: Optional[datetime]) -> Optional[datetime]: ...
def to_python(self, value: Optional[Union[date, str]]) -> Optional[datetime]: ...
def strptime(self, value: str, format: str) -> datetime: ... def strptime(self, value: str, format: str) -> datetime: ...
class DurationField(Field): class DurationField(Field):
disabled: bool disabled: bool
help_text: str
initial: Optional[datetime.timedelta]
label: None
label_suffix: None
localize: bool
required: bool required: bool
show_hidden_initial: bool show_hidden_initial: bool
default_error_messages: Any = ... default_error_messages: Any = ...
def prepare_value(self, value: Optional[Union[timedelta, str]]) -> Optional[str]: ... def prepare_value(self, value: Optional[Union[timedelta, str]]) -> Optional[str]: ...
def to_python(self, value: Union[int, str]) -> timedelta: ...
class RegexField(CharField): class RegexField(CharField):
disabled: bool disabled: bool
empty_value: str empty_value: str
error_messages: Dict[str, str] error_messages: Dict[str, str]
help_text: str
initial: None
label: None
label_suffix: None
localize: bool
max_length: Optional[int] max_length: Optional[int]
min_length: Optional[int] min_length: Optional[int]
required: bool required: bool
@@ -233,11 +170,6 @@ class EmailField(CharField):
disabled: bool disabled: bool
empty_value: Optional[str] empty_value: Optional[str]
error_messages: Dict[str, str] error_messages: Dict[str, str]
help_text: str
initial: None
label: Optional[str]
label_suffix: None
localize: bool
max_length: Optional[int] max_length: Optional[int]
min_length: Optional[int] min_length: Optional[int]
required: bool required: bool
@@ -248,49 +180,27 @@ class EmailField(CharField):
class FileField(Field): class FileField(Field):
disabled: bool disabled: bool
help_text: str
initial: Optional[Union[Callable, str]]
label: Optional[str]
label_suffix: None
localize: bool
required: bool required: bool
show_hidden_initial: bool show_hidden_initial: bool
default_error_messages: Any = ... default_error_messages: Any = ...
max_length: Optional[int] = ... max_length: Optional[int] = ...
allow_empty_file: bool = ... allow_empty_file: bool = ...
def __init__(self, *, max_length: Optional[Any] = ..., allow_empty_file: bool = ..., **kwargs: Any) -> None: ... def __init__(self, *, max_length: Optional[Any] = ..., allow_empty_file: bool = ..., **kwargs: Any) -> None: ...
def to_python(self, data: Optional[Union[SimpleUploadedFile, str]]) -> Optional[SimpleUploadedFile]: ...
def clean(self, data: Any, initial: Optional[Union[FieldFile, str]] = ...) -> Optional[Union[bool, File, str]]: ...
def bound_data(self, data: Any, initial: Optional[FieldFile]) -> Optional[Union[File, str]]: ... def bound_data(self, data: Any, initial: Optional[FieldFile]) -> Optional[Union[File, str]]: ...
def has_changed(
self, initial: Optional[Union[FieldFile, str]], data: Optional[Union[Dict[str, str], str]]
) -> bool: ...
class ImageField(FileField): class ImageField(FileField):
allow_empty_file: bool allow_empty_file: bool
disabled: bool disabled: bool
help_text: str
initial: None
label: Optional[str]
label_suffix: None
localize: bool
max_length: Optional[int] max_length: Optional[int]
required: bool required: bool
show_hidden_initial: bool show_hidden_initial: bool
default_validators: Any = ... default_validators: Any = ...
default_error_messages: Any = ... default_error_messages: Any = ...
def to_python(self, data: Optional[SimpleUploadedFile]) -> Optional[SimpleUploadedFile]: ...
def widget_attrs(self, widget: Widget) -> Dict[str, str]: ...
class URLField(CharField): class URLField(CharField):
disabled: bool disabled: bool
empty_value: Optional[str] empty_value: Optional[str]
error_messages: Dict[str, str] error_messages: Dict[str, str]
help_text: str
initial: None
label: Optional[str]
label_suffix: None
localize: bool
max_length: Optional[int] max_length: Optional[int]
min_length: Optional[int] min_length: Optional[int]
required: bool required: bool
@@ -299,32 +209,18 @@ class URLField(CharField):
default_error_messages: Any = ... default_error_messages: Any = ...
default_validators: Any = ... default_validators: Any = ...
def __init__(self, **kwargs: Any) -> None: ... def __init__(self, **kwargs: Any) -> None: ...
def to_python(self, value: Optional[Union[int, str]]) -> Optional[str]: ...
class BooleanField(Field): class BooleanField(Field):
disabled: bool disabled: bool
error_messages: Dict[str, str] error_messages: Dict[str, str]
help_text: str
initial: Optional[int]
label: Optional[str]
label_suffix: None
localize: bool
required: bool required: bool
show_hidden_initial: bool show_hidden_initial: bool
def to_python(self, value: Optional[Union[int, str]]) -> bool: ...
def validate(self, value: bool) -> None: ... def validate(self, value: bool) -> None: ...
def has_changed(self, initial: Optional[Union[bool, str]], data: Optional[Union[bool, str]]) -> bool: ...
class NullBooleanField(BooleanField): class NullBooleanField(BooleanField):
disabled: bool disabled: bool
help_text: str
initial: Optional[bool]
label: Optional[str]
label_suffix: None
localize: bool
required: bool required: bool
show_hidden_initial: bool show_hidden_initial: bool
def to_python(self, value: Optional[Union[bool, str]]) -> Optional[bool]: ...
def validate(self, value: Optional[bool]) -> None: ... def validate(self, value: Optional[bool]) -> None: ...
class CallableChoiceIterator: class CallableChoiceIterator:
@@ -335,117 +231,62 @@ class CallableChoiceIterator:
class ChoiceField(Field): class ChoiceField(Field):
disabled: bool disabled: bool
error_messages: Dict[str, str] error_messages: Dict[str, str]
help_text: str
initial: None
label: Optional[str]
label_suffix: None
localize: bool
required: bool required: bool
show_hidden_initial: bool show_hidden_initial: bool
default_error_messages: Any = ... default_error_messages: Any = ...
choices: Any = ... choices: Any = ...
def __init__(self, *, choices: Any = ..., **kwargs: Any) -> None: ... def __init__(self, *, choices: Any = ..., **kwargs: Any) -> None: ...
def __deepcopy__( def validate(self, value: Any) -> None: ...
self, memo: Dict[int, Union[List[Tuple[Union[int, str], str]], List[Widget], OrderedDict, Field, Widget]]
) -> ChoiceField: ...
def to_python(self, value: Optional[Union[int, str]]) -> str: ...
def validate(self, value: str) -> None: ...
def valid_value(self, value: str) -> bool: ... def valid_value(self, value: str) -> bool: ...
class TypedChoiceField(ChoiceField): class TypedChoiceField(ChoiceField):
disabled: bool disabled: bool
help_text: str
initial: Optional[Union[Callable, int]]
label: Optional[str]
label_suffix: None
localize: bool
required: bool required: bool
show_hidden_initial: bool show_hidden_initial: bool
coerce: Union[Callable, Type[Union[bool, float, str]]] = ... coerce: Union[Callable, Type[Union[bool, float, str]]] = ...
empty_value: Optional[str] = ... empty_value: Optional[str] = ...
def __init__(self, *, coerce: Any = ..., empty_value: str = ..., **kwargs: Any) -> None: ... def __init__(self, *, coerce: Any = ..., empty_value: str = ..., **kwargs: Any) -> None: ...
def clean(self, value: Optional[str]) -> Optional[Union[Decimal, float, str]]: ...
class MultipleChoiceField(ChoiceField): class MultipleChoiceField(ChoiceField):
disabled: bool disabled: bool
error_messages: Dict[str, str] error_messages: Dict[str, str]
help_text: str
initial: Optional[Callable]
label: None
label_suffix: None
localize: bool
required: bool required: bool
show_hidden_initial: bool show_hidden_initial: bool
hidden_widget: Any = ... hidden_widget: Any = ...
default_error_messages: Any = ... default_error_messages: Any = ...
def to_python(self, value: Optional[Union[List[Union[int, str]], Tuple, str]]) -> List[str]: ...
def validate(self, value: List[str]) -> None: ... def validate(self, value: List[str]) -> None: ...
def has_changed(
self, initial: Optional[Union[List[int], List[str], str]], data: Optional[Union[List[str], str]]
) -> bool: ...
class TypedMultipleChoiceField(MultipleChoiceField): class TypedMultipleChoiceField(MultipleChoiceField):
disabled: bool disabled: bool
help_text: str
initial: None
label: None
label_suffix: None
localize: bool
required: bool required: bool
show_hidden_initial: bool show_hidden_initial: bool
coerce: Union[Callable, Type[float]] = ... coerce: Union[Callable, Type[float]] = ...
empty_value: Optional[List[Any]] = ... empty_value: Optional[List[Any]] = ...
def __init__(self, *, coerce: Any = ..., **kwargs: Any) -> None: ... def __init__(self, *, coerce: Any = ..., **kwargs: Any) -> None: ...
def clean(self, value: List[str]) -> Optional[Union[List[bool], List[Decimal], List[float]]]: ...
def validate(self, value: List[str]) -> None: ... def validate(self, value: List[str]) -> None: ...
class ComboField(Field): class ComboField(Field):
disabled: bool disabled: bool
help_text: str
initial: None
label: None
label_suffix: None
localize: bool
required: bool required: bool
show_hidden_initial: bool show_hidden_initial: bool
fields: Any = ... fields: Any = ...
def __init__(self, fields: List[CharField], **kwargs: Any) -> None: ... def __init__(self, fields: List[CharField], **kwargs: Any) -> None: ...
def clean(self, value: Optional[str]) -> str: ...
class MultiValueField(Field): class MultiValueField(Field):
disabled: bool disabled: bool
help_text: str
initial: None
label: None
label_suffix: None
localize: bool
required: bool required: bool
show_hidden_initial: bool show_hidden_initial: bool
default_error_messages: Any = ... default_error_messages: Any = ...
require_all_fields: bool = ... require_all_fields: bool = ...
fields: Any = ... fields: Any = ...
def __init__(self, fields: Tuple[Field, Field], *, require_all_fields: bool = ..., **kwargs: Any) -> None: ... def __init__(self, fields: Tuple[Field, Field], *, require_all_fields: bool = ..., **kwargs: Any) -> None: ...
def __deepcopy__(
self, memo: Dict[int, Union[List[Tuple[str, str]], OrderedDict, Field, Widget]]
) -> MultiValueField: ...
def validate(self, value: Union[datetime, str]) -> None: ... def validate(self, value: Union[datetime, str]) -> None: ...
def clean( def compress(self, data_list: Any) -> Any: ...
self, value: Optional[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[str]]
) -> bool: ...
class FilePathField(ChoiceField): class FilePathField(ChoiceField):
allow_files: bool allow_files: bool
allow_folders: bool allow_folders: bool
disabled: bool disabled: bool
help_text: str
initial: None
label: Optional[str]
label_suffix: None
localize: bool
match: Optional[str] match: Optional[str]
path: str path: str
recursive: bool recursive: bool
@@ -466,11 +307,6 @@ class FilePathField(ChoiceField):
class SplitDateTimeField(MultiValueField): class SplitDateTimeField(MultiValueField):
disabled: bool disabled: bool
help_text: str
initial: Optional[Union[Callable, datetime.datetime]]
label: Optional[str]
label_suffix: None
localize: bool
require_all_fields: bool require_all_fields: bool
required: bool required: bool
show_hidden_initial: bool show_hidden_initial: bool
@@ -485,11 +321,6 @@ class GenericIPAddressField(CharField):
disabled: bool disabled: bool
empty_value: str empty_value: str
error_messages: Dict[str, str] error_messages: Dict[str, str]
help_text: str
initial: None
label: None
label_suffix: None
localize: bool
max_length: None max_length: None
min_length: None min_length: None
required: bool required: bool
@@ -498,16 +329,10 @@ class GenericIPAddressField(CharField):
unpack_ipv4: bool = ... unpack_ipv4: bool = ...
default_validators: List[Callable] = ... default_validators: List[Callable] = ...
def __init__(self, *, protocol: str = ..., unpack_ipv4: bool = ..., **kwargs: Any) -> None: ... def __init__(self, *, protocol: str = ..., unpack_ipv4: bool = ..., **kwargs: Any) -> None: ...
def to_python(self, value: Optional[str]) -> str: ...
class SlugField(CharField): class SlugField(CharField):
disabled: bool disabled: bool
empty_value: str empty_value: str
help_text: str
initial: None
label: Optional[str]
label_suffix: None
localize: bool
max_length: Optional[int] max_length: Optional[int]
min_length: None min_length: None
required: bool required: bool
@@ -519,11 +344,6 @@ class SlugField(CharField):
class UUIDField(CharField): class UUIDField(CharField):
disabled: bool disabled: bool
empty_value: str empty_value: str
help_text: str
initial: Optional[Callable]
label: Optional[str]
label_suffix: None
localize: bool
max_length: None max_length: None
min_length: None min_length: None
required: bool required: bool
@@ -531,4 +351,3 @@ class UUIDField(CharField):
strip: bool strip: bool
default_error_messages: Any = ... default_error_messages: Any = ...
def prepare_value(self, value: UUID) -> str: ... def prepare_value(self, value: UUID) -> str: ...
def to_python(self, value: str) -> Optional[UUID]: ...

View File

@@ -1,6 +1,5 @@
from collections import OrderedDict from collections import OrderedDict
from datetime import date, datetime from datetime import date, datetime
from decimal import Decimal
from typing import Any, Callable, Dict, Iterator, List, Optional, Tuple, Type, Union from typing import Any, Callable, Dict, Iterator, List, Optional, Tuple, Type, Union
from unittest.mock import MagicMock from unittest.mock import MagicMock
from uuid import UUID from uuid import UUID
@@ -14,27 +13,31 @@ from django.forms.fields import CharField, ChoiceField, Field
from django.forms.forms import BaseForm, DeclarativeFieldsMetaclass from django.forms.forms import BaseForm, DeclarativeFieldsMetaclass
from django.forms.formsets import BaseFormSet from django.forms.formsets import BaseFormSet
from django.forms.utils import ErrorList from django.forms.utils import ErrorList
from django.forms.widgets import Input, Widget from django.forms.widgets import Input, Widget, Select
from django.http.request import QueryDict from django.http.request import QueryDict
from django.utils.datastructures import MultiValueDict from django.utils.datastructures import MultiValueDict
ALL_FIELDS: str ALL_FIELDS: str
_Fields = Union[List[Union[Callable, str]], Tuple[str]]
_Labels = Dict[str, str]
_ErrorMessages = Dict[str, Dict[str, str]]
def model_to_dict( def model_to_dict(
instance: Model, instance: Model,
fields: Optional[Union[List[Union[Callable, str]], Tuple[str]]] = ..., fields: Optional[_Fields] = ...,
exclude: Optional[Union[List[Union[Callable, str]], Tuple[str]]] = ..., exclude: Optional[Union[List[Union[Callable, str]], Tuple[str]]] = ...,
) -> Dict[str, Optional[Union[bool, date, float]]]: ... ) -> Dict[str, Optional[Union[bool, date, float]]]: ...
def fields_for_model( def fields_for_model(
model: Type[Model], model: Type[Model],
fields: Optional[Union[List[Union[Callable, str]], Tuple]] = ..., fields: Optional[_Fields] = ...,
exclude: Optional[Union[List[Union[Callable, str]], Tuple]] = ..., exclude: Optional[Union[List[Union[Callable, str]], Tuple]] = ...,
widgets: Optional[Union[Dict[str, Type[Input]], Dict[str, Widget]]] = ..., widgets: Optional[Union[Dict[str, Type[Input]], Dict[str, Widget]]] = ...,
formfield_callback: Optional[Union[Callable, str]] = ..., formfield_callback: Optional[Union[Callable, str]] = ...,
localized_fields: Optional[Union[Tuple[str], str]] = ..., localized_fields: Optional[Union[Tuple[str], str]] = ...,
labels: Optional[Dict[str, str]] = ..., labels: Optional[_Labels] = ...,
help_texts: Optional[Dict[str, str]] = ..., help_texts: Optional[Dict[str, str]] = ...,
error_messages: Optional[Dict[str, Dict[str, str]]] = ..., error_messages: Optional[_ErrorMessages] = ...,
field_classes: Optional[Dict[str, Type[CharField]]] = ..., field_classes: Optional[Dict[str, Type[CharField]]] = ...,
*, *,
apply_limit_choices_to: bool = ... apply_limit_choices_to: bool = ...
@@ -42,13 +45,13 @@ def fields_for_model(
class ModelFormOptions: class ModelFormOptions:
model: Optional[Type[Model]] = ... model: Optional[Type[Model]] = ...
fields: Optional[Union[List[Union[Callable, str]], Tuple, str]] = ... fields: Optional[_Fields] = ...
exclude: Optional[Union[List[Union[Callable, str]], Tuple, str]] = ... exclude: Optional[Union[List[Union[Callable, str]], Tuple, str]] = ...
widgets: Optional[Dict[str, Union[Widget, Input]]] = ... widgets: Optional[Dict[str, Union[Widget, Input]]] = ...
localized_fields: Optional[Union[Tuple[str], str]] = ... localized_fields: Optional[Union[Tuple[str], str]] = ...
labels: Optional[Dict[str, str]] = ... labels: Optional[_Labels] = ...
help_texts: Optional[Dict[str, str]] = ... help_texts: Optional[Dict[str, str]] = ...
error_messages: Optional[Dict[str, Dict[str, str]]] = ... error_messages: Optional[_ErrorMessages] = ...
field_classes: Optional[Dict[str, Type[Field]]] = ... field_classes: Optional[Dict[str, Type[Field]]] = ...
def __init__(self, options: Optional[type] = ...) -> None: ... def __init__(self, options: Optional[type] = ...) -> None: ...
@@ -61,14 +64,7 @@ class BaseModelForm(BaseForm):
instance: Any = ... instance: Any = ...
def __init__( def __init__(
self, self,
data: Optional[ data: Optional[Union[Dict[str, Any], QueryDict]] = ...,
Union[
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[Union[Dict[str, SimpleUploadedFile], MultiValueDict]] = ..., files: Optional[Union[Dict[str, SimpleUploadedFile], MultiValueDict]] = ...,
auto_id: Union[bool, str] = ..., auto_id: Union[bool, str] = ...,
prefix: None = ..., prefix: None = ...,
@@ -207,10 +203,6 @@ def inlineformset_factory(
class InlineForeignKeyField(Field): class InlineForeignKeyField(Field):
disabled: bool disabled: bool
help_text: str help_text: str
initial: Optional[Union[Model, int, str]]
label: Optional[str]
label_suffix: None
localize: bool
required: bool required: bool
show_hidden_initial: bool show_hidden_initial: bool
widget: Any = ... widget: Any = ...
@@ -221,12 +213,10 @@ class InlineForeignKeyField(Field):
def __init__( def __init__(
self, parent_instance: Model, *args: Any, pk_field: bool = ..., to_field: Optional[Any] = ..., **kwargs: Any self, parent_instance: Model, *args: Any, pk_field: bool = ..., to_field: Optional[Any] = ..., **kwargs: Any
) -> None: ... ) -> None: ...
def clean(self, value: Optional[Union[int, str]]) -> Optional[Model]: ...
def has_changed(self, initial: Optional[Union[int, str]], data: Optional[Union[int, str]]) -> bool: ...
class ModelChoiceIterator: class ModelChoiceIterator:
field: django.forms.models.ModelChoiceField = ... field: ModelChoiceField = ...
queryset: Optional[django.db.models.query.QuerySet] = ... queryset: Optional[QuerySet] = ...
def __init__(self, field: ModelChoiceField) -> None: ... def __init__(self, field: ModelChoiceField) -> None: ...
def __iter__(self) -> Iterator[Tuple[Union[int, str], str]]: ... def __iter__(self) -> Iterator[Tuple[Union[int, str], str]]: ...
def __len__(self) -> int: ... def __len__(self) -> int: ...
@@ -237,14 +227,9 @@ class ModelChoiceField(ChoiceField):
disabled: bool disabled: bool
error_messages: Dict[str, str] error_messages: Dict[str, str]
help_text: str help_text: str
initial: Optional[Union[Callable, int, str, uuid.UUID]]
label: Optional[str]
label_suffix: None
localize: bool
required: bool required: bool
show_hidden_initial: bool show_hidden_initial: bool
validators: List[Any] validators: List[Any]
widget: django.forms.widgets.Select
default_error_messages: Any = ... default_error_messages: Any = ...
iterator: Any = ... iterator: Any = ...
empty_label: Optional[str] = ... empty_label: Optional[str] = ...
@@ -266,13 +251,8 @@ class ModelChoiceField(ChoiceField):
**kwargs: Any **kwargs: Any
) -> None: ... ) -> None: ...
def get_limit_choices_to(self) -> Optional[Union[Dict[str, datetime], Q, MagicMock]]: ... def get_limit_choices_to(self) -> Optional[Union[Dict[str, datetime], Q, MagicMock]]: ...
def __deepcopy__(
self, memo: Dict[int, Union[List[Union[Field, Widget]], OrderedDict, Field, Widget]]
) -> ModelChoiceField: ...
def label_from_instance(self, obj: Model) -> str: ... def label_from_instance(self, obj: Model) -> str: ...
choices: Any = ... choices: Any = ...
def prepare_value(self, value: Any) -> Any: ...
def to_python(self, value: Optional[Union[List[Dict[str, str]], List[List[str]], int, str]]) -> Optional[Model]: ...
def validate(self, value: Optional[Model]) -> None: ... def validate(self, value: Optional[Model]) -> None: ...
def has_changed(self, initial: Optional[Union[Model, int, str, UUID]], data: Optional[Union[int, str]]) -> bool: ... def has_changed(self, initial: Optional[Union[Model, int, str, UUID]], data: Optional[Union[int, str]]) -> bool: ...
@@ -280,21 +260,9 @@ class ModelMultipleChoiceField(ModelChoiceField):
disabled: bool disabled: bool
empty_label: None empty_label: None
help_text: str help_text: str
initial: Optional[Union[Callable, List[int]]]
label: Optional[str]
label_suffix: None
localize: bool
required: bool required: bool
show_hidden_initial: bool show_hidden_initial: bool
widget: Any = ... widget: Any = ...
hidden_widget: Any = ... hidden_widget: Any = ...
default_error_messages: Any = ... default_error_messages: Any = ...
def __init__(self, queryset: QuerySet, **kwargs: Any) -> None: ... def __init__(self, queryset: QuerySet, **kwargs: Any) -> None: ...
def to_python(self, value: Union[List[str], Tuple[int, ...]]) -> List[Model]: ...
def clean(
self, value: Optional[Union[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]], int, str]]: ...
def has_changed(
self, initial: Optional[Union[List[Model], QuerySet, str]], data: Optional[Union[List[int], List[str], str]]
) -> bool: ...

View File

@@ -1,8 +1,9 @@
from typing import Any, Dict, Union from typing import Any, Dict
import django.template.backends as template_backends
from django.template import Template
from django.template.backends.base import BaseEngine from django.template.backends.base import BaseEngine
from django.template.engine import Engine
from django.template import Template
ROOT: Any ROOT: Any
@@ -13,17 +14,13 @@ class BaseRenderer:
def render(self, template_name: str, context: Dict[str, Any], request: None = ...) -> str: ... def render(self, template_name: str, context: Dict[str, Any], request: None = ...) -> str: ...
class EngineMixin: class EngineMixin:
def get_template( def get_template(self, template_name: str) -> Any: ...
self, template_name: str
) -> Union[template_backends.django.Template, template_backends.jinja2.Template]: ...
def engine(self) -> BaseEngine: ... def engine(self) -> BaseEngine: ...
class DjangoTemplates(EngineMixin, BaseRenderer): class DjangoTemplates(EngineMixin, BaseRenderer):
engine: template_backends.django.DjangoTemplates
backend: Any = ... backend: Any = ...
class Jinja2(EngineMixin, BaseRenderer): class Jinja2(EngineMixin, BaseRenderer):
engine: template_backends.jinja2.Jinja2
backend: Any = ... backend: Any = ...
class TemplatesSetting(BaseRenderer): class TemplatesSetting(BaseRenderer):

View File

@@ -15,7 +15,7 @@ class ErrorDict(dict):
def as_ul(self) -> str: ... def as_ul(self) -> str: ...
def as_text(self) -> str: ... def as_text(self) -> str: ...
class ErrorList(UserList, list): class ErrorList(UserList):
data: List[Union[ValidationError, str]] data: List[Union[ValidationError, str]]
error_class: str = ... error_class: str = ...
def __init__(self, initlist: Optional[ErrorList] = ..., error_class: Optional[str] = ...) -> None: ... def __init__(self, initlist: Optional[ErrorList] = ..., error_class: Optional[str] = ...) -> None: ...
@@ -24,9 +24,6 @@ class ErrorList(UserList, list):
def as_json(self, escape_html: bool = ...) -> str: ... def as_json(self, escape_html: bool = ...) -> str: ...
def as_ul(self) -> str: ... def as_ul(self) -> str: ...
def as_text(self) -> str: ... def as_text(self) -> str: ...
def __contains__(self, item: str) -> bool: ...
def __eq__(self, other: Union[List[str], ErrorList]) -> bool: ...
def __getitem__(self, i: Union[int, str]) -> str: ...
def __reduce_ex__( def __reduce_ex__(
self, *args: Any, **kwargs: Any self, *args: Any, **kwargs: Any
) -> Tuple[Callable, Tuple[Type[ErrorList]], Dict[str, Union[List[ValidationError], str]], None, None]: ... ) -> Tuple[Callable, Tuple[Type[ErrorList]], Dict[str, Union[List[ValidationError], str]], None, None]: ...

View File

@@ -1,17 +1,14 @@
from collections import OrderedDict from datetime import time
from datetime import date, datetime, time
from decimal import Decimal from decimal import Decimal
from itertools import chain from itertools import chain
from typing import Any, Callable, Dict, Iterator, List, Optional, Set, Tuple, Type, Union from typing import Any, Callable, Dict, Iterator, List, Optional, Set, Tuple, Type, Union, Iterable
from django.contrib.admin.options import BaseModelAdmin from django.contrib.admin.options import BaseModelAdmin
from django.core.files.base import File from django.core.files.base import File
from django.core.files.uploadedfile import SimpleUploadedFile from django.core.files.uploadedfile import SimpleUploadedFile
from django.db.models.fields.files import FieldFile from django.db.models.fields.files import FieldFile
from django.forms.fields import Field
from django.forms.forms import BaseForm from django.forms.forms import BaseForm
from django.forms.renderers import EngineMixin from django.forms.renderers import EngineMixin
from django.http.request import QueryDict
from django.utils.datastructures import MultiValueDict from django.utils.datastructures import MultiValueDict
from django.utils.safestring import SafeText from django.utils.safestring import SafeText
@@ -20,19 +17,17 @@ class MediaOrderConflictWarning(RuntimeWarning): ...
class Media: class Media:
def __init__( def __init__(
self, self,
media: Optional[Type[Any]] = ..., media: Optional[type] = ...,
css: Optional[Union[Dict[str, List[str]], Dict[str, Tuple[str]]]] = ..., css: Optional[Dict[str, Iterable[str]]] = ...,
js: Optional[Union[List[str], Tuple[str]]] = ..., js: Optional[Iterable[str]] = ...,
) -> None: ... ) -> None: ...
def render(self) -> SafeText: ... def render(self) -> str: ...
def render_js(self) -> List[SafeText]: ... def render_js(self) -> List[str]: ...
def render_css(self) -> chain: ... def render_css(self) -> chain: ...
def absolute_path(self, path: str) -> str: ... def absolute_path(self, path: str) -> str: ...
def __getitem__(self, name: str) -> Media: ... def __getitem__(self, name: str) -> Media: ...
@staticmethod @staticmethod
def merge( def merge(list_1: Iterable[Any], list_2: Iterable[Any]) -> Iterable[Any]: ...
list_1: Union[List[int], List[str], Tuple[str]], list_2: Union[List[int], List[str], Tuple[str]]
) -> Union[List[int], List[str]]: ...
def __add__(self, other: Media) -> Media: ... def __add__(self, other: Media) -> Media: ...
class MediaDefiningClass(type): class MediaDefiningClass(type):
@@ -45,14 +40,13 @@ class Widget:
is_localized: bool = ... is_localized: bool = ...
is_required: bool = ... is_required: bool = ...
supports_microseconds: bool = ... supports_microseconds: bool = ...
attrs: Dict[Any, Any] = ... attrs: Dict[str, Any] = ...
def __init__(self, attrs: Optional[Union[Dict[str, None], Dict[str, bool], Dict[str, float]]] = ...) -> None: ... def __init__(self, attrs: Optional[Dict[str, Any]] = ...) -> None: ...
def __deepcopy__(self, memo: Dict[int, Union[Dict[Any, Any], List[Any]]]) -> Widget: ...
@property @property
def is_hidden(self) -> bool: ... def is_hidden(self) -> bool: ...
def subwidgets( def subwidgets(
self, name: str, value: None, attrs: Dict[str, bool] = ... self, name: str, value: Optional[List[str]], attrs: Dict[str, bool] = ...
) -> Iterator[Dict[str, Optional[Union[Dict[str, bool], bool, str]]]]: ... ) -> Iterator[Dict[str, Any]]: ...
def format_value(self, value: Any) -> Optional[str]: ... def format_value(self, value: Any) -> Optional[str]: ...
def get_context(self, name: str, value: Any, attrs: Optional[Dict[str, Union[bool, str]]]) -> Dict[str, Any]: ... def get_context(self, name: str, value: Any, attrs: Optional[Dict[str, Union[bool, str]]]) -> Dict[str, Any]: ...
def render( def render(
@@ -75,188 +69,59 @@ class Widget:
def use_required_attribute(self, initial: Any) -> bool: ... def use_required_attribute(self, initial: Any) -> bool: ...
class Input(Widget): class Input(Widget):
attrs: Dict[Any, Any]
input_type: str = ...
template_name: str = ...
def __init__(
self, attrs: Optional[Union[Dict[str, None], Dict[str, bool], Dict[str, float], Dict[str, str]]] = ...
) -> None: ...
def get_context(self, name: str, value: Any, attrs: Optional[Dict[str, Union[bool, str]]]) -> Dict[str, Any]: ...
class TextInput(Input):
attrs: Dict[str, Optional[bool]]
is_localized: bool
is_required: bool
input_type: str = ... input_type: str = ...
template_name: str = ... template_name: str = ...
class NumberInput(Input): class TextInput(Input): ...
attrs: Dict[str, Union[float, str]] class NumberInput(Input): ...
is_required: bool class EmailInput(Input): ...
input_type: str = ... class URLInput(Input): ...
template_name: str = ...
class EmailInput(Input):
attrs: Dict[str, Union[bool, str]]
is_required: bool
input_type: str = ...
template_name: str = ...
class URLInput(Input):
attrs: Dict[str, str]
is_required: bool
input_type: str = ...
template_name: str = ...
class PasswordInput(Input): class PasswordInput(Input):
attrs: Dict[str, Union[bool, str]]
is_required: bool
input_type: str = ...
template_name: str = ...
render_value: bool = ... render_value: bool = ...
def __init__(self, attrs: Optional[Dict[str, bool]] = ..., render_value: bool = ...) -> None: ...
def get_context(
self, name: str, value: Optional[str], attrs: Optional[Dict[str, Union[bool, str]]]
) -> Dict[str, Dict[str, Optional[Union[Dict[str, Union[bool, str]], bool, str]]]]: ...
class HiddenInput(Input): class HiddenInput(Input):
attrs: Dict[str, str] choices: Iterable[Tuple[str, str]]
choices: django.forms.models.ModelChoiceIterator
is_localized: bool
is_required: bool
input_type: str = ...
template_name: str = ...
class MultipleHiddenInput(HiddenInput): class MultipleHiddenInput(HiddenInput): ...
attrs: Dict[str, str]
choices: List[Tuple[str, str]]
input_type: str
is_required: bool
template_name: str = ...
def get_context(
self, name: str, value: Optional[Union[List[int], List[str]]], attrs: Optional[Dict[str, str]]
) -> Dict[str, Any]: ...
def value_from_datadict(
self,
data: Union[Dict[str, List[str]], Dict[str, Tuple[int, ...]], MultiValueDict],
files: Dict[Any, Any],
name: str,
) -> Union[List[str], Tuple[int, ...]]: ...
def format_value(self, value: Optional[Union[List[int], List[str]]]) -> Union[List[int], List[str]]: ...
class FileInput(Input): class FileInput(Input):
attrs: Dict[str, Union[bool, str]]
is_required: bool
input_type: str = ...
needs_multipart_form: bool = ... needs_multipart_form: bool = ...
template_name: str = ...
def format_value(self, value: Optional[str]) -> None: ...
def value_from_datadict(
self,
data: Union[Dict[str, None], Dict[str, bool], Dict[str, str], QueryDict],
files: Dict[str, Union[SimpleUploadedFile, str]],
name: str,
) -> Optional[Union[SimpleUploadedFile, str]]: ...
def value_omitted_from_data(
self, data: Dict[str, str], files: Dict[str, Union[SimpleUploadedFile, str]], name: str
) -> bool: ...
class ClearableFileInput(FileInput): class ClearableFileInput(FileInput):
attrs: Dict[str, str]
is_required: bool
clear_checkbox_label: Any = ... clear_checkbox_label: Any = ...
initial_text: Any = ... initial_text: Any = ...
input_text: Any = ... input_text: Any = ...
template_name: str = ...
def clear_checkbox_name(self, name: str) -> str: ... def clear_checkbox_name(self, name: str) -> str: ...
def clear_checkbox_id(self, name: str) -> str: ... def clear_checkbox_id(self, name: str) -> str: ...
def is_initial(self, value: Optional[Union[File, str]]) -> bool: ... def is_initial(self, value: Optional[Union[File, str]]) -> bool: ...
def format_value(self, value: Optional[Union[File, str]]) -> Optional[FieldFile]: ...
def get_context(self, name: Any, value: Any, attrs: Any): ...
def value_from_datadict(
self,
data: Union[Dict[str, None], Dict[str, bool], Dict[str, str], QueryDict],
files: Dict[str, Union[SimpleUploadedFile, str]],
name: str,
) -> Any: ...
def use_required_attribute(self, initial: Optional[Union[FieldFile, str]]) -> bool: ... def use_required_attribute(self, initial: Optional[Union[FieldFile, str]]) -> bool: ...
def value_omitted_from_data(
self, data: Dict[str, str], files: Dict[str, Union[SimpleUploadedFile, str]], name: str
) -> bool: ...
class Textarea(Widget): class Textarea(Widget):
attrs: Dict[str, Union[int, str]]
is_required: bool
template_name: str = ... template_name: str = ...
def __init__(self, attrs: Optional[Union[Dict[str, int], Dict[str, str]]] = ...) -> None: ...
class DateTimeBaseInput(TextInput): class DateTimeBaseInput(TextInput):
format_key: str = ... format_key: str = ...
supports_microseconds: bool = ... supports_microseconds: bool = ...
format: Any = ... format: Optional[str] = ...
def __init__(self, attrs: Optional[Dict[str, Union[int, str]]] = ..., format: Optional[str] = ...) -> None: ...
def format_value(self, value: Optional[Union[datetime, str]]) -> Optional[str]: ...
class DateInput(DateTimeBaseInput): class DateInput(DateTimeBaseInput): ...
attrs: Dict[str, str] class DateTimeInput(DateTimeBaseInput): ...
format: Optional[str] class TimeInput(DateTimeBaseInput): ...
input_type: str
is_localized: bool
is_required: bool
format_key: str = ...
template_name: str = ...
class DateTimeInput(DateTimeBaseInput):
attrs: Dict[Any, Any]
format: Optional[str]
input_type: str
is_localized: bool
is_required: bool
format_key: str = ...
template_name: str = ...
class TimeInput(DateTimeBaseInput):
attrs: Dict[str, str]
format: Optional[str]
input_type: str
is_localized: bool
is_required: bool
format_key: str = ...
template_name: str = ...
class CheckboxInput(Input): class CheckboxInput(Input):
attrs: Dict[str, str]
is_required: bool
input_type: str = ...
template_name: str = ...
check_test: Callable = ... check_test: Callable = ...
def __init__(self, attrs: Optional[Dict[str, str]] = ..., check_test: Optional[Callable] = ...) -> None: ... def __init__(self, attrs: Optional[Dict[str, str]] = ..., check_test: Optional[Callable] = ...) -> None: ...
def format_value(self, value: Optional[Union[int, str]]) -> Optional[str]: ...
def get_context(
self, name: str, value: Optional[Union[int, str]], attrs: Optional[Dict[str, Union[bool, str]]]
) -> Dict[str, Dict[str, Optional[Union[Dict[str, Union[bool, str]], bool, str]]]]: ...
def value_from_datadict(
self,
data: Union[Dict[str, Optional[Union[List[int], datetime, int, str]]], QueryDict],
files: Union[Dict[str, SimpleUploadedFile], MultiValueDict],
name: str,
) -> bool: ...
def value_omitted_from_data(
self,
data: Union[Dict[str, Optional[Union[List[int], datetime, int, str]]], QueryDict],
files: Union[Dict[Any, Any], MultiValueDict],
name: str,
) -> bool: ...
class ChoiceWidget(Widget): class ChoiceWidget(Widget):
allow_multiple_selected: bool = ... allow_multiple_selected: bool = ...
input_type: Any = ... input_type: Optional[str] = ...
template_name: Any = ... template_name: Optional[str] = ...
option_template_name: Any = ... option_template_name: Any = ...
add_id_index: bool = ... add_id_index: bool = ...
checked_attribute: Any = ... checked_attribute: Any = ...
option_inherits_attrs: bool = ... option_inherits_attrs: bool = ...
choices: Any = ... choices: List[List[Union[int, str]]] = ...
def __init__( def __init__(
self, self,
attrs: Optional[Dict[str, Union[bool, str]]] = ..., attrs: Optional[Dict[str, Union[bool, str]]] = ...,
@@ -264,8 +129,6 @@ class ChoiceWidget(Widget):
Iterator[Any], List[List[Union[int, str]]], List[Tuple[Union[time, int], int]], List[int], Tuple Iterator[Any], List[List[Union[int, str]]], List[Tuple[Union[time, int], int]], List[int], Tuple
] = ..., ] = ...,
) -> None: ... ) -> None: ...
def __deepcopy__(self, memo: Dict[int, List[Any]]) -> ChoiceWidget: ...
def subwidgets(self, name: str, value: Optional[List[str]], attrs: Dict[str, Union[bool, str]] = ...) -> None: ...
def options(self, name: str, value: List[str], attrs: Dict[str, Union[bool, str]] = ...) -> None: ... def options(self, name: str, value: List[str], attrs: Dict[str, Union[bool, str]] = ...) -> None: ...
def optgroups( def optgroups(
self, name: str, value: List[str], attrs: Optional[Dict[str, Union[bool, str]]] = ... self, name: str, value: List[str], attrs: Optional[Dict[str, Union[bool, str]]] = ...
@@ -280,90 +143,32 @@ class ChoiceWidget(Widget):
subindex: Optional[int] = ..., subindex: Optional[int] = ...,
attrs: Optional[Dict[str, Union[bool, str]]] = ..., attrs: Optional[Dict[str, Union[bool, str]]] = ...,
) -> Dict[str, Union[Dict[str, Union[bool, str]], Dict[str, bool], Set[str], time, int, str]]: ... ) -> Dict[str, Union[Dict[str, Union[bool, str]], Dict[str, bool], Set[str], time, int, str]]: ...
def get_context(
self,
name: str,
value: Optional[Union[List[int], List[str], Tuple[str, str], int, str]],
attrs: Optional[Dict[str, Union[bool, str]]],
) -> Dict[str, Any]: ...
def id_for_label(self, id_: str, index: str = ...) -> str: ... def id_for_label(self, id_: str, index: str = ...) -> str: ...
def value_from_datadict(
self, data: dict, files: Union[Dict[Any, Any], MultiValueDict], name: str
) -> Optional[Union[List[str], int, str]]: ...
def format_value(self, value: Optional[Union[List[int], List[str], Tuple[str, str], int, str]]) -> List[str]: ...
class Select(ChoiceWidget): class Select(ChoiceWidget):
attrs: Dict[str, Union[bool, str]]
choices: List[List[Union[int, str]]]
is_required: bool
input_type: str = ...
template_name: str = ...
option_template_name: str = ... option_template_name: str = ...
add_id_index: bool = ... add_id_index: bool = ...
checked_attribute: Any = ... checked_attribute: Any = ...
option_inherits_attrs: bool = ... option_inherits_attrs: bool = ...
def get_context(
self,
name: str,
value: Optional[Union[List[int], List[str], int, str]],
attrs: Optional[Dict[str, Union[bool, str]]],
) -> Dict[str, Any]: ...
def use_required_attribute(self, initial: Any) -> bool: ... def use_required_attribute(self, initial: Any) -> bool: ...
class NullBooleanSelect(Select): class NullBooleanSelect(Select): ...
attrs: Dict[Any, Any]
def __init__(self, attrs: None = ...) -> None: ...
def format_value(self, value: Optional[Union[bool, str]]) -> str: ...
def value_from_datadict(
self, data: Union[Dict[str, Union[bool, str]], QueryDict], files: MultiValueDict, name: str
) -> Optional[bool]: ...
class SelectMultiple(Select): class SelectMultiple(Select):
attrs: Dict[Any, Any]
choices: Union[
List[Tuple[str, Union[Tuple[Tuple[str, str], Tuple[str, str]], str]]], django.forms.models.ModelChoiceIterator
]
is_required: bool
allow_multiple_selected: bool = ... allow_multiple_selected: bool = ...
def value_from_datadict(
self,
data: Union[Dict[str, List[int]], Dict[str, Tuple[int, ...]], Dict[str, str], QueryDict],
files: Union[Dict[Any, Any], MultiValueDict],
name: str,
) -> Optional[Union[List[int], List[str], str]]: ...
def value_omitted_from_data(self, data: Dict[str, str], files: Dict[Any, Any], name: str) -> bool: ...
class RadioSelect(ChoiceWidget): class RadioSelect(ChoiceWidget):
attrs: Dict[str, str]
choices: Union[
List[Tuple[datetime.time, Union[Tuple[Tuple[str, str], Tuple[str, str]], str]]],
List[int],
django.forms.models.ModelChoiceIterator,
]
is_required: bool
input_type: str = ...
template_name: str = ...
option_template_name: str = ... option_template_name: str = ...
class CheckboxSelectMultiple(ChoiceWidget): class CheckboxSelectMultiple(ChoiceWidget):
attrs: Dict[str, str]
choices: Union[
List[Tuple[datetime.time, Union[Tuple[Tuple[str, str], Tuple[str, str]], str]]],
django.forms.models.ModelChoiceIterator,
]
is_required: bool
allow_multiple_selected: bool = ... allow_multiple_selected: bool = ...
input_type: str = ...
template_name: str = ...
option_template_name: str = ... option_template_name: str = ...
def use_required_attribute(self, initial: Optional[List[str]]) -> bool: ... def use_required_attribute(self, initial: Optional[List[str]]) -> bool: ...
def value_omitted_from_data(self, data: Dict[str, str], files: Dict[Any, Any], name: str) -> bool: ...
def id_for_label(self, id_: str, index: Optional[str] = ...) -> str: ... def id_for_label(self, id_: str, index: Optional[str] = ...) -> str: ...
class MultiWidget(Widget): class MultiWidget(Widget):
attrs: Dict[Any, Any]
template_name: str = ... template_name: str = ...
widgets: List[django.forms.widgets.Widget] = ... widgets: List[Widget] = ...
def __init__( def __init__(
self, self,
widgets: Union[List[Type[DateTimeBaseInput]], Tuple[Union[Type[TextInput], Input]]], widgets: Union[List[Type[DateTimeBaseInput]], Tuple[Union[Type[TextInput], Input]]],
@@ -371,36 +176,11 @@ class MultiWidget(Widget):
) -> None: ... ) -> None: ...
@property @property
def is_hidden(self) -> bool: ... def is_hidden(self) -> bool: ...
def get_context( def decompress(self, value: Any) -> Optional[Any]: ...
self,
name: str,
value: Optional[Union[List[datetime], datetime, str]],
attrs: Optional[Dict[str, Union[bool, str]]],
) -> Dict[str, Any]: ...
def id_for_label(self, id_: str) -> str: ...
def value_from_datadict(
self,
data: Union[Dict[str, Union[List[str], str]], QueryDict],
files: Union[Dict[Any, Any], MultiValueDict],
name: str,
) -> Union[List[None], List[str]]: ...
def value_omitted_from_data(
self, data: Union[Dict[str, str], QueryDict], files: Union[Dict[Any, Any], MultiValueDict], name: str
) -> bool: ...
def decompress(self, value: Any) -> None: ...
media: Any = ... media: Any = ...
def __deepcopy__(
self, memo: Dict[int, Union[List[Tuple[str, str]], List[Widget], OrderedDict, Field, Widget]]
) -> MultiWidget: ...
@property
def needs_multipart_form(self) -> bool: ...
class SplitDateTimeWidget(MultiWidget): class SplitDateTimeWidget(MultiWidget):
attrs: Dict[Any, Any]
is_required: bool
widgets: List[django.forms.widgets.DateTimeBaseInput]
supports_microseconds: bool = ... supports_microseconds: bool = ...
template_name: str = ...
def __init__( def __init__(
self, self,
attrs: Optional[Dict[str, str]] = ..., attrs: Optional[Dict[str, str]] = ...,
@@ -409,13 +189,8 @@ class SplitDateTimeWidget(MultiWidget):
date_attrs: Optional[Dict[str, str]] = ..., date_attrs: Optional[Dict[str, str]] = ...,
time_attrs: Optional[Dict[str, str]] = ..., time_attrs: Optional[Dict[str, str]] = ...,
) -> None: ... ) -> None: ...
def decompress(self, value: Optional[Union[datetime, str]]) -> Union[List[None], List[datetime]]: ...
class SplitHiddenDateTimeWidget(SplitDateTimeWidget): class SplitHiddenDateTimeWidget(SplitDateTimeWidget):
attrs: Dict[Any, Any]
is_required: bool
widgets: List[django.forms.widgets.DateTimeBaseInput]
template_name: str = ...
def __init__( def __init__(
self, self,
attrs: Optional[Dict[str, str]] = ..., attrs: Optional[Dict[str, str]] = ...,
@@ -434,7 +209,6 @@ class SelectDateWidget(Widget):
input_type: str = ... input_type: str = ...
select_widget: Any = ... select_widget: Any = ...
date_re: Any = ... date_re: Any = ...
attrs: Any = ...
years: Any = ... years: Any = ...
months: Any = ... months: Any = ...
year_none_value: Any = ... year_none_value: Any = ...
@@ -447,8 +221,3 @@ class SelectDateWidget(Widget):
months: None = ..., months: None = ...,
empty_label: Optional[Union[Tuple[str, str], str]] = ..., empty_label: Optional[Union[Tuple[str, str], str]] = ...,
) -> None: ... ) -> None: ...
def get_context(self, name: Any, value: Any, attrs: Any): ...
def format_value(self, value: Optional[Union[date, str]]) -> Dict[str, None]: ...
def id_for_label(self, id_: str) -> str: ...
def value_from_datadict(self, data: Dict[str, str], files: Dict[Any, Any], name: str) -> Optional[str]: ...
def value_omitted_from_data(self, data: Dict[str, str], files: Dict[Any, Any], name: str) -> bool: ...

View File

@@ -1,7 +1,7 @@
# Stubs for django.http.request (Python 3.5) # Stubs for django.http.request (Python 3.5)
# #
# NOTE: This dynamically typed stub was automatically generated by stubgen. # NOTE: This dynamically typed stub was automatically generated by stubgen.
from io import BytesIO
from typing import Any, BinaryIO, Dict, Iterable, Iterator, List, Optional, overload, Pattern, Tuple, Union from typing import Any, BinaryIO, Dict, Iterable, Iterator, List, Optional, overload, Pattern, Tuple, Union
from django.core.files import uploadhandler, uploadedfile from django.core.files import uploadhandler, uploadedfile
@@ -16,7 +16,7 @@ class RawPostDataException(Exception): ...
UploadHandlerList = Union[List[uploadhandler.FileUploadHandler], ImmutableList[uploadhandler.FileUploadHandler]] UploadHandlerList = Union[List[uploadhandler.FileUploadHandler], ImmutableList[uploadhandler.FileUploadHandler]]
class HttpRequest(BinaryIO): class HttpRequest(BytesIO):
GET = ... # type: QueryDict GET = ... # type: QueryDict
POST = ... # type: QueryDict POST = ... # type: QueryDict
COOKIES = ... # type: Dict[str, str] COOKIES = ... # type: Dict[str, str]

View File

@@ -3,14 +3,14 @@
import datetime import datetime
from io import BytesIO from io import BytesIO
from json import JSONEncoder from json import JSONEncoder
from typing import Any, Dict, Iterable, Iterator, List, Optional, overload, Tuple, Type, Union, Callable from typing import Any, Dict, Iterable, Iterator, List, Optional, overload, Tuple, Type, Union
import six
from django.core.handlers.wsgi import WSGIRequest from django.core.handlers.wsgi import WSGIRequest
from django.http.cookie import SimpleCookie from django.http.cookie import SimpleCookie
import six from django.test.client import Client
from django.template import Context, Template
from django.test import Client
from django.template import Context, Template
from django.urls import ResolverMatch from django.urls import ResolverMatch
class BadHeaderError(ValueError): ... class BadHeaderError(ValueError): ...
@@ -64,7 +64,6 @@ class HttpResponse(HttpResponseBase):
client: Client client: Client
closed: bool closed: bool
context: Optional[Context] context: Optional[Context]
cookies: cookies.SimpleCookie
csrf_cookie_set: bool csrf_cookie_set: bool
redirect_chain: List[Tuple[str, int]] redirect_chain: List[Tuple[str, int]]
request: Dict[str, Any] request: Dict[str, Any]
@@ -84,11 +83,9 @@ class HttpResponse(HttpResponseBase):
@content.setter @content.setter
def content(self, value: Any) -> None: ... def content(self, value: Any) -> None: ...
def __iter__(self) -> Iterator[bytes]: ... def __iter__(self) -> Iterator[bytes]: ...
def write(self, content: Union[bytes, str]) -> None: ...
def tell(self) -> int: ... def tell(self) -> int: ...
def getvalue(self) -> bytes: ... def getvalue(self) -> bytes: ...
def writable(self) -> bool: ... def writable(self) -> bool: ...
def writelines(self, lines: List[str]) -> None: ...
@property @property
def url(self) -> str: ... def url(self) -> str: ...
def json(self) -> Dict[str, Any]: ... def json(self) -> Dict[str, Any]: ...
@@ -110,7 +107,6 @@ class FileResponse(StreamingHttpResponse):
client: Client client: Client
closed: bool closed: bool
context: None context: None
cookies: cookies.SimpleCookie
file_to_stream: Optional[BytesIO] file_to_stream: Optional[BytesIO]
request: Dict[str, str] request: Dict[str, str]
resolver_match: ResolverMatch resolver_match: ResolverMatch

View File

@@ -1,10 +1,9 @@
from typing import Any, Dict, Iterator, Optional from typing import Any, Dict, Iterator, Optional, List
from django.http.request import HttpRequest from django.template.base import Template
from django.template.base import Origin, Template
from django.template.exceptions import TemplateDoesNotExist from django.template.exceptions import TemplateDoesNotExist
from django.utils.safestring import SafeText
from django.template.engine import Engine
from .base import BaseEngine from .base import BaseEngine
class DjangoTemplates(BaseEngine): class DjangoTemplates(BaseEngine):
@@ -12,20 +11,12 @@ class DjangoTemplates(BaseEngine):
dirs: List[str] dirs: List[str]
name: str name: str
app_dirname: str = ... app_dirname: str = ...
engine: django.template.engine.Engine = ... engine: Engine = ...
def __init__(self, params: Dict[str, Any]) -> None: ... def __init__(self, params: Dict[str, Any]) -> None: ...
def from_string(self, template_code: str) -> Template: ... def from_string(self, template_code: str) -> Template: ...
def get_template(self, template_name: str) -> Template: ... def get_template(self, template_name: str) -> Template: ...
def get_templatetag_libraries(self, custom_libraries: Dict[str, str]) -> Dict[str, str]: ... def get_templatetag_libraries(self, custom_libraries: Dict[str, str]) -> Dict[str, str]: ...
class Template:
template: Template = ...
backend: django.template.backends.django.DjangoTemplates = ...
def __init__(self, template: Template, backend: DjangoTemplates) -> None: ...
@property
def origin(self) -> Origin: ...
def render(self, context: Any = ..., request: Optional[HttpRequest] = ...) -> SafeText: ...
def copy_exception(exc: TemplateDoesNotExist, backend: Optional[DjangoTemplates] = ...) -> TemplateDoesNotExist: ... def copy_exception(exc: TemplateDoesNotExist, backend: Optional[DjangoTemplates] = ...) -> TemplateDoesNotExist: ...
def reraise(exc: TemplateDoesNotExist, backend: DjangoTemplates) -> Any: ... def reraise(exc: TemplateDoesNotExist, backend: DjangoTemplates) -> Any: ...
def get_installed_libraries() -> Dict[str, str]: ... def get_installed_libraries() -> Dict[str, str]: ...

View File

@@ -1,10 +1,9 @@
import string import string
from typing import Any, Dict, List, Optional, Union from typing import Any, Dict, List, Optional, Union, Tuple
from django.http.request import HttpRequest from django.http.request import HttpRequest
from .base import BaseEngine from .base import BaseEngine
from .utils import csrf_input_lazy, csrf_token_lazy
class TemplateStrings(BaseEngine): class TemplateStrings(BaseEngine):
app_dirs: bool app_dirs: bool

View File

@@ -1,11 +1,7 @@
from datetime import time from typing import Callable, Dict, List, Optional, Tuple, Any
from typing import Any, Callable, Dict, List, Optional, Tuple, Union
from jinja2.environment import Template from django.template.base import Template
from jinja2.exceptions import TemplateSyntaxError from django.template.exceptions import TemplateSyntaxError
from django.http.request import HttpRequest
from django.views.generic.base import TemplateView
from .base import BaseEngine from .base import BaseEngine
@@ -17,99 +13,13 @@ class Jinja2(BaseEngine):
template_dirs: Tuple[str] template_dirs: Tuple[str]
app_dirname: str = ... app_dirname: str = ...
context_processors: List[str] = ... context_processors: List[str] = ...
env: jinja2.environment.Environment = ... def __init__(self, params: Dict[str, Any]) -> None: ...
def __init__(self, params: Dict[str, Union[Dict[str, Union[List[str], bool]], List[str], bool, str]]) -> None: ...
def from_string(self, template_code: str) -> Template: ... def from_string(self, template_code: str) -> Template: ...
def get_template(self, template_name: str) -> Template: ... def get_template(self, template_name: str) -> Template: ...
def template_context_processors(self) -> List[Callable]: ...
class Template:
template: jinja2.environment.Template = ...
backend: django.template.backends.jinja2.Jinja2 = ...
origin: django.template.backends.jinja2.Origin = ...
def __init__(self, template: Template, backend: Jinja2) -> None: ...
def render(
self,
context: Optional[
Union[
Dict[str, Dict[str, Optional[Union[Dict[str, bool], bool, str]]]],
Dict[
str,
Dict[
str,
Optional[
Union[
Dict[str, str], List[Dict[str, Optional[Union[Dict[str, str], bool, str]]]], bool, str
]
],
],
],
Dict[
str,
Dict[
str,
Union[
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[str, str],
List[Tuple[None, List[Dict[str, Union[Dict[str, bool], bool, str]]], int]],
List[str],
bool,
str,
],
]
],
List[str],
bool,
str,
],
],
],
Dict[
str,
Dict[
str,
Union[
Dict[str, str],
List[
Tuple[
Optional[str],
List[Dict[str, Union[Dict[str, Union[bool, str]], time, int, str]]],
int,
]
],
List[str],
bool,
str,
],
],
],
Dict[str, TemplateView],
Dict[str, str],
]
] = ...,
request: Optional[HttpRequest] = ...,
) -> str: ...
class Origin: class Origin:
name: str = ... name: str = ...
template_name: Optional[str] = ... template_name: Optional[str] = ...
def __init__(self, name: str, template_name: Optional[str]) -> None: ... def __init__(self, name: str, template_name: Optional[str]) -> None: ...
def get_exception_info(exception: TemplateSyntaxError) -> Dict[str, Union[List[Tuple[int, str]], int, str]]: ... def get_exception_info(exception: TemplateSyntaxError) -> Dict[str, Any]: ...

View File

@@ -1,7 +1,6 @@
from enum import Enum from enum import Enum
from typing import Any, Callable, Dict, Iterator, List, Optional, Tuple, Type, Union from typing import Any, Callable, Dict, Iterator, List, Optional, Tuple, Type, Union
from django.template.backends.dummy import TemplateStrings
from django.template.context import Context from django.template.context import Context
from django.template.engine import Engine from django.template.engine import Engine
from django.template.library import Library from django.template.library import Library
@@ -38,23 +37,19 @@ class VariableDoesNotExist(Exception):
class Origin: class Origin:
name: str = ... name: str = ...
template_name: Optional[Union[bytes, str]] = ... template_name: Optional[Union[bytes, str]] = ...
loader: Optional[Union[django.template.backends.dummy.TemplateStrings, django.template.loaders.base.Loader]] = ... loader: Optional[Loader] = ...
def __init__( def __init__(
self, self, name: str, template_name: Optional[Union[bytes, str]] = ..., loader: Optional[Loader] = ...
name: str,
template_name: Optional[Union[bytes, str]] = ...,
loader: Optional[Union[TemplateStrings, Loader]] = ...,
) -> None: ... ) -> None: ...
def __eq__(self, other: Origin) -> bool: ...
@property @property
def loader_name(self) -> Optional[str]: ... def loader_name(self) -> Optional[str]: ...
class Template: class Template:
name: Optional[str] = ... name: Optional[str] = ...
origin: Origin = ... origin: Origin = ...
engine: django.template.engine.Engine = ... engine: Engine = ...
source: str = ... source: str = ...
nodelist: django.template.base.NodeList = ... nodelist: NodeList = ...
def __init__( def __init__(
self, self,
template_string: str, template_string: str,
@@ -136,8 +131,8 @@ class FilterExpression:
var: Union[Variable, SafeText] = ... var: Union[Variable, SafeText] = ...
def __init__(self, token: str, parser: Parser) -> None: ... def __init__(self, token: str, parser: Parser) -> None: ...
def resolve(self, context: Union[Dict[str, Dict[str, str]], Context], ignore_failures: bool = ...) -> Any: ... def resolve(self, context: Union[Dict[str, Dict[str, str]], Context], ignore_failures: bool = ...) -> Any: ...
@staticmethod
def args_check(name: str, func: Callable, provided: List[Tuple[bool, Union[Variable, SafeText]]]) -> bool: ... def args_check(name: str, func: Callable, provided: List[Tuple[bool, Union[Variable, SafeText]]]) -> bool: ...
args_check: Any = ...
class Variable: class Variable:
var: Union[Dict[Any, Any], str] = ... var: Union[Dict[Any, Any], str] = ...
@@ -151,8 +146,9 @@ class Variable:
class Node: class Node:
must_be_first: bool = ... must_be_first: bool = ...
child_nodelists: Any = ... child_nodelists: Any = ...
token: Any = ... origin: Origin
def render(self, context: Any) -> None: ... token: Token = ...
def render(self, context: Context) -> str: ...
def render_annotated(self, context: Context) -> Union[int, str]: ... def render_annotated(self, context: Context) -> Union[int, str]: ...
def __iter__(self) -> None: ... def __iter__(self) -> None: ...
def get_nodes_by_type(self, nodetype: Type[Node]) -> List[Node]: ... def get_nodes_by_type(self, nodetype: Type[Node]) -> List[Node]: ...
@@ -174,7 +170,7 @@ def render_value_in_context(value: Any, context: Context) -> str: ...
class VariableNode(Node): class VariableNode(Node):
origin: Origin origin: Origin
token: Token token: Token
filter_expression: django.template.base.FilterExpression = ... filter_expression: FilterExpression = ...
def __init__(self, filter_expression: FilterExpression) -> None: ... def __init__(self, filter_expression: FilterExpression) -> None: ...
def render(self, context: Context) -> str: ... def render(self, context: Context) -> str: ...

View File

@@ -1,21 +1,16 @@
from itertools import cycle
from typing import Any, Callable, Dict, Iterator, List, Optional, Type, Union from typing import Any, Callable, Dict, Iterator, List, Optional, Type, Union
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.http.request import HttpRequest
from django.template.base import Node, Origin, Template from django.template.base import Node, Origin, Template
from django.template.defaulttags import CycleNode, IfChangedNode from django.template.defaulttags import IfChangedNode
from django.template.library import InclusionNode from django.template.loader_tags import IncludeNode
from django.template.loader_tags import BlockContext
_ContextValues = Union[Dict[str, Any], "Context"]
class ContextPopException(Exception): ... class ContextPopException(Exception): ...
class ContextDict(dict): class ContextDict(dict):
context: django.template.context.BaseContext = ... context: BaseContext = ...
def __init__(self, context: BaseContext, *args: Any, **kwargs: Any) -> None: ... def __init__(self, context: BaseContext, *args: Any, **kwargs: Any) -> None: ...
def __enter__(self) -> ContextDict: ... def __enter__(self) -> ContextDict: ...
def __exit__(self, *args: Any, **kwargs: Any) -> None: ... def __exit__(self, *args: Any, **kwargs: Any) -> None: ...
@@ -31,23 +26,12 @@ class BaseContext:
def __getitem__(self, key: Union[int, str]) -> Any: ... def __getitem__(self, key: Union[int, str]) -> Any: ...
def __delitem__(self, key: Any) -> None: ... def __delitem__(self, key: Any) -> None: ...
def __contains__(self, key: str) -> bool: ... def __contains__(self, key: str) -> bool: ...
def get(self, key: str, otherwise: Optional[int] = ...) -> Optional[Union[Options, int, str]]: ... def get(self, key: str, otherwise: Optional[Any] = ...) -> Optional[Any]: ...
def setdefault( def setdefault(
self, key: Union[IfChangedNode, str], default: Optional[Union[List[Origin], int]] = ... self, key: Union[IfChangedNode, str], default: Optional[Union[List[Origin], int]] = ...
) -> Optional[Union[List[Origin], int]]: ... ) -> Optional[Union[List[Origin], int]]: ...
def new( def new(self, values: Optional[_ContextValues] = ...) -> Context: ...
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 flatten(self) -> Dict[str, Optional[Union[Dict[str, Union[Type[Any], str]], int, str]]]: ...
def __eq__(self, other: Context) -> bool: ...
class Context(BaseContext): class Context(BaseContext):
dicts: Any dicts: Any
@@ -55,36 +39,32 @@ class Context(BaseContext):
use_l10n: Optional[bool] = ... use_l10n: Optional[bool] = ...
use_tz: Optional[bool] = ... use_tz: Optional[bool] = ...
template_name: Optional[str] = ... template_name: Optional[str] = ...
render_context: django.template.context.RenderContext = ... render_context: RenderContext = ...
template: Optional[Template] = ... template: Optional[Template] = ...
def __init__( def __init__(
self, dict_: Any = ..., autoescape: bool = ..., use_l10n: Optional[bool] = ..., use_tz: None = ... self, dict_: Any = ..., autoescape: bool = ..., use_l10n: Optional[bool] = ..., use_tz: None = ...
) -> None: ... ) -> None: ...
def bind_template(self, template: Template) -> Iterator[None]: ... def bind_template(self, template: Template) -> Iterator[None]: ...
def __copy__(self) -> Context: ... def update(self, other_dict: Union[Dict[str, Any], Context]) -> ContextDict: ...
def update(self, other_dict: Union[Dict[str, Model], Dict[str, int], Dict[str, str], Context]) -> ContextDict: ...
class RenderContext(BaseContext): class RenderContext(BaseContext):
dicts: List[Dict[Union[django.template.loader_tags.IncludeNode, str], str]] dicts: List[Dict[Union[IncludeNode, str], str]]
template: Optional[Template] = ... template: Optional[Template] = ...
def __iter__(self) -> None: ... def __iter__(self) -> None: ...
def __contains__(self, key: Union[CycleNode, str]) -> bool: ...
def get(self, key: Union[InclusionNode, str], otherwise: None = ...) -> Optional[Union[Template, BlockContext]]: ...
def __getitem__(self, key: Union[Node, str]) -> Optional[Union[List[Origin], BlockContext, cycle]]: ...
def push_state(self, template: Template, isolated_context: bool = ...) -> Iterator[None]: ... def push_state(self, template: Template, isolated_context: bool = ...) -> Iterator[None]: ...
class RequestContext(Context): class RequestContext(Context):
autoescape: bool autoescape: bool
dicts: List[Dict[str, str]] dicts: List[Dict[str, str]]
render_context: django.template.context.RenderContext render_context: RenderContext
template_name: Optional[str] template_name: Optional[str]
use_l10n: None use_l10n: None
use_tz: None use_tz: None
request: django.http.request.HttpRequest = ... request: HttpRequest = ...
def __init__( def __init__(
self, self,
request: HttpRequest, request: HttpRequest,
dict_: Optional[Dict[str, Union[Dict[str, Union[Type[Any], str]], str]]] = ..., dict_: Optional[Dict[str, Any]] = ...,
processors: Optional[List[Callable]] = ..., processors: Optional[List[Callable]] = ...,
use_l10n: None = ..., use_l10n: None = ...,
use_tz: None = ..., use_tz: None = ...,
@@ -92,22 +72,6 @@ class RequestContext(Context):
) -> None: ... ) -> None: ...
template: Optional[Template] = ... template: Optional[Template] = ...
def bind_template(self, template: Template) -> Iterator[None]: ... def bind_template(self, template: Template) -> Iterator[None]: ...
def new( def new(self, values: Optional[_ContextValues] = ...) -> RequestContext: ...
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: Any, request: Optional[HttpRequest] = ..., **kwargs: Any) -> Context: ... def make_context(context: Any, request: Optional[HttpRequest] = ..., **kwargs: Any) -> Context: ...

View File

@@ -2,97 +2,52 @@ from collections import namedtuple
from datetime import date from datetime import date
from typing import Any, Dict, List, Optional, Tuple, Union from typing import Any, Dict, List, Optional, Tuple, Union
from django.template.base import FilterExpression, NodeList, Parser, Token from django.template.base import FilterExpression, Parser, Token
from django.template.context import Context, RequestContext from django.template.context import RequestContext, Context
from django.template.library import Library
from django.utils.safestring import SafeText from django.utils.safestring import SafeText
from .base import ( from .base import Node, NodeList
BLOCK_TAG_END,
BLOCK_TAG_START,
COMMENT_TAG_END,
COMMENT_TAG_START,
FILTER_SEPARATOR,
SINGLE_BRACE_END,
SINGLE_BRACE_START,
VARIABLE_ATTRIBUTE_SEPARATOR,
VARIABLE_TAG_END,
VARIABLE_TAG_START,
Context,
Node,
NodeList,
TemplateSyntaxError,
VariableDoesNotExist,
kwarg_re,
render_value_in_context,
token_kwargs,
)
from .defaultfilters import date
from .library import Library from .library import Library
from .smartif import IfParser, Literal from .smartif import IfParser, Literal
register: Any register: Any
class AutoEscapeControlNode(Node): class AutoEscapeControlNode(Node):
nodelist: django.template.base.NodeList nodelist: NodeList
origin: django.template.base.Origin
setting: bool setting: bool
token: django.template.base.Token
def __init__(self, setting: bool, nodelist: NodeList) -> None: ... def __init__(self, setting: bool, nodelist: NodeList) -> None: ...
def render(self, context: Context) -> SafeText: ...
class CommentNode(Node): class CommentNode(Node): ...
origin: django.template.base.Origin class CsrfTokenNode(Node): ...
token: django.template.base.Token
def render(self, context: Context) -> str: ...
class CsrfTokenNode(Node):
origin: django.template.base.Origin
token: django.template.base.Token
def render(self, context: RequestContext) -> SafeText: ...
class CycleNode(Node): class CycleNode(Node):
origin: django.template.base.Origin cyclevars: List[FilterExpression] = ...
token: django.template.base.Token
cyclevars: List[django.template.base.FilterExpression] = ...
variable_name: Optional[str] = ... variable_name: Optional[str] = ...
silent: bool = ... silent: bool = ...
def __init__( def __init__(
self, cyclevars: List[FilterExpression], variable_name: Optional[str] = ..., silent: bool = ... self, cyclevars: List[FilterExpression], variable_name: Optional[str] = ..., silent: bool = ...
) -> None: ... ) -> None: ...
def render(self, context: Context) -> str: ...
def reset(self, context: Context) -> None: ... def reset(self, context: Context) -> None: ...
class DebugNode(Node): class DebugNode(Node): ...
origin: django.template.base.Origin
token: django.template.base.Token
def render(self, context: Context) -> str: ...
class FilterNode(Node): class FilterNode(Node):
filter_expr: django.template.base.FilterExpression filter_expr: FilterExpression
nodelist: django.template.base.NodeList nodelist: NodeList
origin: django.template.base.Origin
token: django.template.base.Token
def __init__(self, filter_expr: FilterExpression, nodelist: NodeList) -> None: ... def __init__(self, filter_expr: FilterExpression, nodelist: NodeList) -> None: ...
def render(self, context: Context) -> Any: ...
class FirstOfNode(Node): class FirstOfNode(Node):
origin: django.template.base.Origin vars: List[FilterExpression] = ...
token: django.template.base.Token
vars: List[django.template.base.FilterExpression] = ...
asvar: Optional[str] = ... asvar: Optional[str] = ...
def __init__(self, variables: List[FilterExpression], asvar: Optional[str] = ...) -> None: ... def __init__(self, variables: List[FilterExpression], asvar: Optional[str] = ...) -> None: ...
def render(self, context: Context) -> str: ...
class ForNode(Node): class ForNode(Node):
loopvars: Union[List[str], str] loopvars: Union[List[str], str]
origin: django.template.base.Origin sequence: Union[FilterExpression, str]
sequence: Union[django.template.base.FilterExpression, str]
token: django.template.base.Token
child_nodelists: Any = ... child_nodelists: Any = ...
is_reversed: bool = ... is_reversed: bool = ...
nodelist_loop: Union[List[str], django.template.base.NodeList] = ... nodelist_loop: Union[List[str], NodeList] = ...
nodelist_empty: Union[List[str], django.template.base.NodeList] = ... nodelist_empty: Union[List[str], NodeList] = ...
def __init__( def __init__(
self, self,
loopvars: Union[List[str], str], loopvars: Union[List[str], str],
@@ -101,24 +56,18 @@ class ForNode(Node):
nodelist_loop: Union[List[str], NodeList], nodelist_loop: Union[List[str], NodeList],
nodelist_empty: Optional[Union[List[str], NodeList]] = ..., nodelist_empty: Optional[Union[List[str], NodeList]] = ...,
) -> None: ... ) -> None: ...
def render(self, context: Context) -> SafeText: ...
class IfChangedNode(Node): class IfChangedNode(Node):
nodelist_false: django.template.base.NodeList nodelist_false: NodeList
nodelist_true: django.template.base.NodeList nodelist_true: NodeList
origin: django.template.base.Origin
token: django.template.base.Token
child_nodelists: Any = ... child_nodelists: Any = ...
def __init__(self, nodelist_true: NodeList, nodelist_false: NodeList, *varlist: Any) -> None: ... def __init__(self, nodelist_true: NodeList, nodelist_false: NodeList, *varlist: Any) -> None: ...
def render(self, context: Context) -> str: ...
class IfEqualNode(Node): class IfEqualNode(Node):
nodelist_false: Union[List[Any], django.template.base.NodeList] nodelist_false: Union[List[Any], NodeList]
nodelist_true: Union[List[Any], django.template.base.NodeList] nodelist_true: Union[List[Any], NodeList]
origin: django.template.base.Origin var1: Union[FilterExpression, str]
token: django.template.base.Token var2: Union[FilterExpression, str]
var1: Union[django.template.base.FilterExpression, str]
var2: Union[django.template.base.FilterExpression, str]
child_nodelists: Any = ... child_nodelists: Any = ...
negate: bool = ... negate: bool = ...
def __init__( def __init__(
@@ -129,82 +78,53 @@ class IfEqualNode(Node):
nodelist_false: Union[List[Any], NodeList], nodelist_false: Union[List[Any], NodeList],
negate: bool, negate: bool,
) -> None: ... ) -> None: ...
def render(self, context: Context) -> SafeText: ...
class IfNode(Node): class IfNode(Node):
origin: django.template.base.Origin conditions_nodelists: List[Tuple[Optional[TemplateLiteral], NodeList]] = ...
token: django.template.base.Token
conditions_nodelists: List[
Tuple[Optional[django.template.defaulttags.TemplateLiteral], django.template.base.NodeList]
] = ...
def __init__(self, conditions_nodelists: List[Tuple[Optional[TemplateLiteral], NodeList]]) -> None: ... def __init__(self, conditions_nodelists: List[Tuple[Optional[TemplateLiteral], NodeList]]) -> None: ...
def __iter__(self) -> None: ... def __iter__(self) -> None: ...
@property @property
def nodelist(self) -> NodeList: ... def nodelist(self) -> NodeList: ...
def render(self, context: Context) -> str: ...
class LoremNode(Node): class LoremNode(Node):
common: bool common: bool
count: django.template.base.FilterExpression count: FilterExpression
method: str method: str
origin: django.template.base.Origin
token: django.template.base.Token
def __init__(self, count: FilterExpression, method: str, common: bool) -> None: ... def __init__(self, count: FilterExpression, method: str, common: bool) -> None: ...
def render(self, context: Context) -> str: ...
GroupedResult = namedtuple("GroupedResult", ["grouper", "list"]) GroupedResult = namedtuple("GroupedResult", ["grouper", "list"])
class RegroupNode(Node): class RegroupNode(Node):
expression: django.template.base.FilterExpression expression: FilterExpression
origin: django.template.base.Origin target: FilterExpression
target: django.template.base.FilterExpression
token: django.template.base.Token
var_name: str = ... var_name: str = ...
def __init__(self, target: FilterExpression, expression: FilterExpression, var_name: str) -> None: ... def __init__(self, target: FilterExpression, expression: FilterExpression, var_name: str) -> None: ...
def resolve_expression(self, obj: Dict[str, date], context: Context) -> Union[int, str]: ... def resolve_expression(self, obj: Dict[str, date], context: Context) -> Union[int, str]: ...
def render(self, context: Context) -> str: ...
class LoadNode(Node): class LoadNode(Node): ...
origin: django.template.base.Origin
token: django.template.base.Token
def render(self, context: Context) -> str: ...
class NowNode(Node): class NowNode(Node):
origin: django.template.base.Origin
token: django.template.base.Token
format_string: str = ... format_string: str = ...
asvar: Optional[str] = ... asvar: Optional[str] = ...
def __init__(self, format_string: str, asvar: Optional[str] = ...) -> None: ... def __init__(self, format_string: str, asvar: Optional[str] = ...) -> None: ...
def render(self, context: Context) -> str: ...
class ResetCycleNode(Node): class ResetCycleNode(Node):
origin: django.template.base.Origin node: CycleNode = ...
token: django.template.base.Token
node: django.template.defaulttags.CycleNode = ...
def __init__(self, node: CycleNode) -> None: ... def __init__(self, node: CycleNode) -> None: ...
def render(self, context: Context) -> str: ...
class SpacelessNode(Node): class SpacelessNode(Node):
origin: django.template.base.Origin nodelist: NodeList = ...
token: django.template.base.Token
nodelist: django.template.base.NodeList = ...
def __init__(self, nodelist: NodeList) -> None: ... def __init__(self, nodelist: NodeList) -> None: ...
def render(self, context: Context) -> str: ...
class TemplateTagNode(Node): class TemplateTagNode(Node):
origin: django.template.base.Origin
token: django.template.base.Token
mapping: Any = ... mapping: Any = ...
tagtype: str = ... tagtype: str = ...
def __init__(self, tagtype: str) -> None: ... def __init__(self, tagtype: str) -> None: ...
def render(self, context: Context) -> str: ...
class URLNode(Node): class URLNode(Node):
origin: django.template.base.Origin view_name: FilterExpression = ...
token: django.template.base.Token args: List[FilterExpression] = ...
view_name: django.template.base.FilterExpression = ... kwargs: Dict[str, FilterExpression] = ...
args: List[django.template.base.FilterExpression] = ...
kwargs: Dict[str, django.template.base.FilterExpression] = ...
asvar: Optional[str] = ... asvar: Optional[str] = ...
def __init__( def __init__(
self, self,
@@ -213,21 +133,15 @@ class URLNode(Node):
kwargs: Dict[str, FilterExpression], kwargs: Dict[str, FilterExpression],
asvar: Optional[str], asvar: Optional[str],
) -> None: ... ) -> None: ...
def render(self, context: Context) -> str: ...
class VerbatimNode(Node): class VerbatimNode(Node):
origin: django.template.base.Origin content: SafeText = ...
token: django.template.base.Token
content: django.utils.safestring.SafeText = ...
def __init__(self, content: SafeText) -> None: ... def __init__(self, content: SafeText) -> None: ...
def render(self, context: Context) -> SafeText: ...
class WidthRatioNode(Node): class WidthRatioNode(Node):
origin: django.template.base.Origin val_expr: FilterExpression = ...
token: django.template.base.Token max_expr: FilterExpression = ...
val_expr: django.template.base.FilterExpression = ... max_width: FilterExpression = ...
max_expr: django.template.base.FilterExpression = ...
max_width: django.template.base.FilterExpression = ...
asvar: Optional[str] = ... asvar: Optional[str] = ...
def __init__( def __init__(
self, self,
@@ -236,21 +150,13 @@ class WidthRatioNode(Node):
max_width: FilterExpression, max_width: FilterExpression,
asvar: Optional[str] = ..., asvar: Optional[str] = ...,
) -> None: ... ) -> None: ...
def render(self, context: Context) -> str: ...
class WithNode(Node): class WithNode(Node):
origin: django.template.base.Origin nodelist: NodeList = ...
token: django.template.base.Token extra_context: Dict[str, Union[FilterExpression, str]] = ...
nodelist: Union[List[Any], django.template.base.NodeList] = ...
extra_context: Dict[str, Union[django.template.base.FilterExpression, str]] = ...
def __init__( def __init__(
self, self, var: Optional[str], name: Optional[str], nodelist: NodeList, extra_context: Optional[Dict[str, Any]] = ...
var: Optional[str],
name: Optional[str],
nodelist: Union[List[Any], NodeList],
extra_context: Optional[Dict[str, FilterExpression]] = ...,
) -> None: ... ) -> None: ...
def render(self, context: Context) -> Any: ...
def autoescape(parser: Parser, token: Token) -> AutoEscapeControlNode: ... def autoescape(parser: Parser, token: Token) -> AutoEscapeControlNode: ...
def comment(parser: Parser, token: Token) -> CommentNode: ... def comment(parser: Parser, token: Token) -> CommentNode: ...
@@ -265,20 +171,17 @@ def ifequal(parser: Parser, token: Token) -> IfEqualNode: ...
def ifnotequal(parser: Parser, token: Token) -> IfEqualNode: ... def ifnotequal(parser: Parser, token: Token) -> IfEqualNode: ...
class TemplateLiteral(Literal): class TemplateLiteral(Literal):
value: django.template.base.FilterExpression = ...
text: str = ... text: str = ...
def __init__(self, value: FilterExpression, text: str) -> None: ... def __init__(self, value: FilterExpression, text: str) -> None: ...
def display(self) -> str: ... def display(self) -> str: ...
def eval(self, context: Context) -> Any: ...
class TemplateIfParser(IfParser): class TemplateIfParser(IfParser):
current_token: django.template.defaulttags.TemplateLiteral current_token: TemplateLiteral
pos: int pos: int
tokens: List[django.template.defaulttags.TemplateLiteral] tokens: List[TemplateLiteral]
error_class: Any = ... error_class: Any = ...
template_parser: django.template.base.Parser = ... template_parser: Parser = ...
def __init__(self, parser: Parser, *args: Any, **kwargs: Any) -> None: ... def __init__(self, parser: Parser, *args: Any, **kwargs: Any) -> None: ...
def create_var(self, value: str) -> TemplateLiteral: ...
def do_if(parser: Parser, token: Token) -> IfNode: ... def do_if(parser: Parser, token: Token) -> IfNode: ...
def ifchanged(parser: Parser, token: Token) -> IfChangedNode: ... def ifchanged(parser: Parser, token: Token) -> IfChangedNode: ...

View File

@@ -1,18 +1,15 @@
from typing import Any, Callable, Dict, List, Optional, Tuple, Union from typing import Any, Callable, Dict, List, Optional, Tuple, Union
from django.template.base import Origin, Template from django.template.base import Origin
from django.template.library import Library from django.template.library import Library
from django.template.loaders.base import Loader from django.template.loaders.base import Loader
from django.utils.safestring import SafeText from django.utils.safestring import SafeText
from .base import Context, Template from .base import Template
from .context import _builtin_context_processors
from .exceptions import TemplateDoesNotExist
from .library import import_library
class Engine: class Engine:
template_context_processors: Tuple[Callable] template_context_processors: Tuple[Callable]
template_loaders: List[django.template.loaders.base.Loader] template_loaders: List[Loader]
default_builtins: Any = ... default_builtins: Any = ...
dirs: List[str] = ... dirs: List[str] = ...
app_dirs: bool = ... app_dirs: bool = ...
@@ -23,9 +20,9 @@ class Engine:
string_if_invalid: str = ... string_if_invalid: str = ...
file_charset: str = ... file_charset: str = ...
libraries: Dict[str, str] = ... libraries: Dict[str, str] = ...
template_libraries: Dict[str, django.template.library.Library] = ... template_libraries: Dict[str, Library] = ...
builtins: List[str] = ... builtins: List[str] = ...
template_builtins: List[django.template.library.Library] = ... template_builtins: List[Library] = ...
def __init__( def __init__(
self, self,
dirs: Optional[List[str]] = ..., dirs: Optional[List[str]] = ...,
@@ -41,10 +38,8 @@ class Engine:
) -> None: ... ) -> None: ...
@staticmethod @staticmethod
def get_default() -> Engine: ... def get_default() -> Engine: ...
def template_context_processors(self) -> Tuple[Callable]: ...
def get_template_builtins(self, builtins: List[str]) -> List[Library]: ... def get_template_builtins(self, builtins: List[str]) -> List[Library]: ...
def get_template_libraries(self, libraries: Dict[str, str]) -> Dict[str, Library]: ... def get_template_libraries(self, libraries: Dict[str, str]) -> Dict[str, Library]: ...
def template_loaders(self) -> List[Loader]: ...
def get_template_loaders( def get_template_loaders(
self, template_loaders: Union[List[List[Union[Dict[str, str], str]]], List[Tuple[str, List[str]]], List[str]] self, template_loaders: Union[List[List[Union[Dict[str, str], str]]], List[Tuple[str, List[str]]], List[str]]
) -> List[Loader]: ... ) -> List[Loader]: ...

View File

@@ -1,12 +1,12 @@
from typing import Any, List, Optional, Tuple, Union from typing import List, Optional, Tuple, Union
from django.template.backends.base import BaseEngine from django.template.backends.base import BaseEngine
from django.template.base import Origin from django.template.base import Origin
class TemplateDoesNotExist(Exception): class TemplateDoesNotExist(Exception):
backend: Optional[django.template.backends.base.BaseEngine] = ... backend: Optional[BaseEngine] = ...
tried: List[Tuple[django.template.base.Origin, str]] = ... tried: List[Tuple[Origin, str]] = ...
chain: List[django.template.exceptions.TemplateDoesNotExist] = ... chain: List[TemplateDoesNotExist] = ...
def __init__( def __init__(
self, self,
msg: Union[Origin, str], msg: Union[Origin, str],

View File

@@ -1,11 +1,10 @@
from typing import Any, Callable, Dict, List, Optional, Tuple, Union from typing import Any, Callable, Dict, List, Optional, Tuple, Union
from django.template.base import FilterExpression, Parser, Template from django.template.base import FilterExpression, Parser, Origin, Token
from django.template.context import Context from django.template.context import Context
from django.utils.safestring import SafeText from django.utils.safestring import SafeText
from .base import Node, Template from .base import Node, Template
from .exceptions import TemplateSyntaxError as TemplateSyntaxError
class InvalidTemplateLibrary(Exception): ... class InvalidTemplateLibrary(Exception): ...
@@ -53,9 +52,9 @@ class SimpleNode(TagHelperNode):
args: List[FilterExpression] args: List[FilterExpression]
func: Callable func: Callable
kwargs: Dict[str, FilterExpression] kwargs: Dict[str, FilterExpression]
origin: django.template.base.Origin origin: Origin
takes_context: Optional[bool] takes_context: Optional[bool]
token: django.template.base.Token token: Token
target_var: Optional[str] = ... target_var: Optional[str] = ...
def __init__( def __init__(
self, self,
@@ -65,15 +64,14 @@ class SimpleNode(TagHelperNode):
kwargs: Dict[str, FilterExpression], kwargs: Dict[str, FilterExpression],
target_var: Optional[str], target_var: Optional[str],
) -> None: ... ) -> None: ...
def render(self, context: Context) -> str: ...
class InclusionNode(TagHelperNode): class InclusionNode(TagHelperNode):
args: List[FilterExpression] args: List[FilterExpression]
func: Callable func: Callable
kwargs: Dict[str, FilterExpression] kwargs: Dict[str, FilterExpression]
origin: django.template.base.Origin origin: Origin
takes_context: Optional[bool] takes_context: Optional[bool]
token: django.template.base.Token token: Token
filename: Union[Template, str] = ... filename: Union[Template, str] = ...
def __init__( def __init__(
self, self,
@@ -83,7 +81,6 @@ class InclusionNode(TagHelperNode):
kwargs: Dict[str, FilterExpression], kwargs: Dict[str, FilterExpression],
filename: Optional[Union[Template, str]], filename: Optional[Union[Template, str]],
) -> None: ... ) -> None: ...
def render(self, context: Context) -> SafeText: ...
def parse_bits( def parse_bits(
parser: Parser, parser: Parser,

View File

@@ -1,11 +1,11 @@
import collections
from typing import Any, Dict, List, Optional, Union from typing import Any, Dict, List, Optional, Union
from django.template.base import FilterExpression, Node, NodeList, Parser, Template, Token from django.template.base import FilterExpression, NodeList, Parser, Token, Origin
from django.template.context import Context from django.template.context import Context
from django.utils.safestring import SafeText from django.utils.safestring import SafeText
from .base import Node, Template, TemplateSyntaxError, TextNode, Variable, token_kwargs from .base import Node, Template
from .library import Library
register: Any register: Any
BLOCK_CONTEXT_KEY: str BLOCK_CONTEXT_KEY: str
@@ -19,25 +19,25 @@ class BlockContext:
def get_block(self, name: str) -> BlockNode: ... def get_block(self, name: str) -> BlockNode: ...
class BlockNode(Node): class BlockNode(Node):
context: django.template.context.Context context: Context
name: str name: str
nodelist: django.template.base.NodeList nodelist: NodeList
origin: django.template.base.Origin origin: Origin
parent: None parent: None
token: django.template.base.Token token: Token
def __init__(self, name: str, nodelist: NodeList, parent: None = ...) -> None: ... def __init__(self, name: str, nodelist: NodeList, parent: None = ...) -> None: ...
def render(self, context: Context) -> SafeText: ... def render(self, context: Context) -> SafeText: ...
def super(self) -> SafeText: ... def super(self) -> SafeText: ...
class ExtendsNode(Node): class ExtendsNode(Node):
origin: django.template.base.Origin origin: Origin
token: django.template.base.Token token: Token
must_be_first: bool = ... must_be_first: bool = ...
context_key: str = ... context_key: str = ...
nodelist: django.template.base.NodeList = ... nodelist: NodeList = ...
parent_name: Union[django.template.base.FilterExpression, django.template.base.Node] = ... parent_name: Union[FilterExpression, Node] = ...
template_dirs: Optional[List[Any]] = ... template_dirs: Optional[List[Any]] = ...
blocks: Dict[str, django.template.loader_tags.BlockNode] = ... blocks: Dict[str, BlockNode] = ...
def __init__( def __init__(
self, nodelist: NodeList, parent_name: Union[FilterExpression, Node], template_dirs: Optional[List[Any]] = ... self, nodelist: NodeList, parent_name: Union[FilterExpression, Node], template_dirs: Optional[List[Any]] = ...
) -> None: ... ) -> None: ...
@@ -46,11 +46,11 @@ class ExtendsNode(Node):
def render(self, context: Context) -> Any: ... def render(self, context: Context) -> Any: ...
class IncludeNode(Node): class IncludeNode(Node):
origin: django.template.base.Origin origin: Origin
token: django.template.base.Token token: Token
context_key: str = ... context_key: str = ...
template: django.template.base.FilterExpression = ... template: FilterExpression = ...
extra_context: Dict[str, django.template.base.FilterExpression] = ... extra_context: Dict[str, FilterExpression] = ...
isolated_context: bool = ... isolated_context: bool = ...
def __init__( def __init__(
self, self,

View File

@@ -6,7 +6,7 @@ from django.template.engine import Engine
from .base import Loader as BaseLoader from .base import Loader as BaseLoader
class Loader(BaseLoader): class Loader(BaseLoader):
engine: django.template.engine.Engine engine: Engine
template_cache: Dict[Any, Any] = ... template_cache: Dict[Any, Any] = ...
get_template_cache: Dict[str, django.template.exceptions.TemplateDoesNotExist] = ... get_template_cache: Dict[str, django.template.exceptions.TemplateDoesNotExist] = ...
loaders: List[django.template.loaders.base.Loader] = ... loaders: List[django.template.loaders.base.Loader] = ...

View File

@@ -6,7 +6,7 @@ from django.template.engine import Engine
from .base import Loader as BaseLoader from .base import Loader as BaseLoader
class Loader(BaseLoader): class Loader(BaseLoader):
engine: django.template.engine.Engine engine: Engine
dirs: Optional[List[str]] = ... dirs: Optional[List[str]] = ...
def __init__(self, engine: Engine, dirs: Optional[List[str]] = ...) -> None: ... def __init__(self, engine: Engine, dirs: Optional[List[str]] = ...) -> None: ...
def get_dirs(self) -> Union[List[bytes], List[str]]: ... def get_dirs(self) -> Union[List[bytes], List[str]]: ...

View File

@@ -1,16 +1,15 @@
from datetime import datetime import functools
from http.cookies import SimpleCookie from http.cookies import SimpleCookie
from typing import Any, Callable, Dict, List, Optional, Tuple, Union from typing import Any, Callable, Dict, List, Optional, Tuple, Union
from unittest.mock import MagicMock
from django.db.models.base import Model from django.core.handlers.wsgi import WSGIRequest
from django.http import HttpResponse
from django.http.request import HttpRequest from django.http.request import HttpRequest
from django.template.backends.django import Template from django.template.base import Template
from django.template.backends.jinja2 import Template from django.template.context import RequestContext
from django.views.generic.base import TemplateResponseMixin from django.test.client import Client
from django.utils.functional import SimpleLazyObject
from .loader import get_template as get_template, select_template as select_template from django.http import HttpResponse
class ContentNotRenderedError(Exception): ... class ContentNotRenderedError(Exception): ...
@@ -47,36 +46,26 @@ class SimpleTemplateResponse(HttpResponse):
def content(self, value: Any) -> None: ... def content(self, value: Any) -> None: ...
class TemplateResponse(SimpleTemplateResponse): class TemplateResponse(SimpleTemplateResponse):
client: django.test.client.Client client: Client
closed: bool closed: bool
context: django.template.context.RequestContext context: RequestContext
context_data: Optional[Dict[str, Any]] context_data: Optional[Dict[str, Any]]
cookies: SimpleCookie cookies: SimpleCookie
csrf_cookie_set: bool csrf_cookie_set: bool
json: functools.partial json: functools.partial
redirect_chain: List[Tuple[str, int]] redirect_chain: List[Tuple[str, int]]
request: Dict[str, Union[django.test.client.FakePayload, int, str]] request: Dict[str, Union[int, str]]
resolver_match: django.utils.functional.SimpleLazyObject
status_code: int status_code: int
template_name: Union[List[str], django.template.backends.django.Template, str] template_name: Union[List[str], Template, str]
templates: List[Template] templates: List[Template]
using: Optional[str] using: Optional[str]
wsgi_request: django.core.handlers.wsgi.WSGIRequest wsgi_request: WSGIRequest
rendering_attrs: Any = ... rendering_attrs: Any = ...
def __init__( def __init__(
self, self,
request: HttpRequest, request: HttpRequest,
template: Union[List[str], Template, str], template: Union[List[str], Template, str],
context: Optional[ context: Optional[Dict[str, Any]] = ...,
Union[
Dict[str, List[Dict[str, Optional[Union[datetime, Model, str]]]]],
Dict[str, List[str]],
Dict[str, Model],
Dict[str, TemplateResponseMixin],
Dict[str, str],
MagicMock,
]
] = ...,
content_type: Optional[str] = ..., content_type: Optional[str] = ...,
status: Optional[int] = ..., status: Optional[int] = ...,
charset: None = ..., charset: None = ...,

View File

@@ -2,6 +2,8 @@ from typing import Any, Dict, List, Optional, Union
from django.template.defaulttags import TemplateLiteral from django.template.defaulttags import TemplateLiteral
_Token = Union[List[int], int, str]
class TokenBase: class TokenBase:
id: Any = ... id: Any = ...
value: Any = ... value: Any = ...
@@ -19,11 +21,10 @@ OPERATORS: Any
class Literal(TokenBase): class Literal(TokenBase):
id: str = ... id: str = ...
lbp: int = ... lbp: int = ...
value: Optional[Union[List[int], int]] = ... value: Optional[_Token] = ...
def __init__(self, value: Optional[Union[List[int], int]]) -> None: ... def __init__(self, value: Optional[_Token]) -> None: ...
def display(self): ... def display(self): ...
def nud(self, parser: IfParser) -> Literal: ... def eval(self, context: Dict[Any, Any]) -> Optional[_Token]: ...
def eval(self, context: Dict[Any, Any]) -> Optional[Union[List[int], int]]: ...
class EndToken(TokenBase): class EndToken(TokenBase):
lbp: int = ... lbp: int = ...
@@ -34,14 +35,9 @@ class IfParser:
tokens: Any = ... tokens: Any = ...
pos: int = ... pos: int = ...
current_token: Any = ... current_token: Any = ...
def __init__( def __init__(self, tokens: List[Optional[_Token]]) -> None: ...
self, def translate_token(self, token: Optional[_Token]) -> Literal: ...
tokens: Union[
List[Optional[Union[List[int], str]]], List[Optional[Union[int, str]]], List[Union[List[int], int, str]]
],
) -> None: ...
def translate_token(self, token: Optional[Union[List[int], int, str]]) -> Literal: ...
def next_token(self) -> Literal: ... def next_token(self) -> Literal: ...
def parse(self) -> TemplateLiteral: ... def parse(self) -> TemplateLiteral: ...
def expression(self, rbp: int = ...) -> Literal: ... def expression(self, rbp: int = ...) -> Literal: ...
def create_var(self, value: Optional[Union[List[int], int]]) -> Literal: ... def create_var(self, value: Optional[_Token]) -> Literal: ...

View File

@@ -1,6 +1,5 @@
import collections import collections
from collections import OrderedDict from typing import Any, Dict, List, Tuple
from typing import Any, Dict, List, Tuple, Union
from django.core.exceptions import ImproperlyConfigured from django.core.exceptions import ImproperlyConfigured
from django.template.backends.base import BaseEngine from django.template.backends.base import BaseEngine
@@ -9,8 +8,7 @@ class InvalidTemplateEngineError(ImproperlyConfigured): ...
class EngineHandler: class EngineHandler:
templates: collections.OrderedDict templates: collections.OrderedDict
def __init__(self, templates: List[Dict[str, Union[Dict[str, bool], str]]] = ...) -> None: ... def __init__(self, templates: List[Dict[str, Any]] = ...) -> None: ...
def templates(self) -> OrderedDict: ...
def __getitem__(self, alias: str) -> BaseEngine: ... def __getitem__(self, alias: str) -> BaseEngine: ...
def __iter__(self) -> Any: ... def __iter__(self) -> Any: ...
def all(self) -> List[BaseEngine]: ... def all(self) -> List[BaseEngine]: ...

View File

@@ -8,13 +8,13 @@ from django.utils.safestring import SafeText
register: Any register: Any
class CacheNode(Node): class CacheNode(Node):
origin: django.template.base.Origin origin: Origin
token: django.template.base.Token token: Token
nodelist: django.template.base.NodeList = ... nodelist: NodeList = ...
expire_time_var: django.template.base.FilterExpression = ... expire_time_var: FilterExpression = ...
fragment_name: str = ... fragment_name: str = ...
vary_on: List[django.template.base.FilterExpression] = ... vary_on: List[FilterExpression] = ...
cache_name: Optional[django.template.base.FilterExpression] = ... cache_name: Optional[FilterExpression] = ...
def __init__( def __init__(
self, self,
nodelist: NodeList, nodelist: NodeList,

View File

@@ -8,50 +8,50 @@ from django.utils.safestring import SafeText
register: Any register: Any
class GetAvailableLanguagesNode(Node): class GetAvailableLanguagesNode(Node):
origin: django.template.base.Origin origin: Origin
token: django.template.base.Token token: Token
variable: str = ... variable: str = ...
def __init__(self, variable: str) -> None: ... def __init__(self, variable: str) -> None: ...
def render(self, context: Context) -> str: ... def render(self, context: Context) -> str: ...
class GetLanguageInfoNode(Node): class GetLanguageInfoNode(Node):
origin: django.template.base.Origin origin: Origin
token: django.template.base.Token token: Token
lang_code: django.template.base.FilterExpression = ... lang_code: FilterExpression = ...
variable: str = ... variable: str = ...
def __init__(self, lang_code: FilterExpression, variable: str) -> None: ... def __init__(self, lang_code: FilterExpression, variable: str) -> None: ...
def render(self, context: Context) -> str: ... def render(self, context: Context) -> str: ...
class GetLanguageInfoListNode(Node): class GetLanguageInfoListNode(Node):
origin: django.template.base.Origin origin: Origin
token: django.template.base.Token token: Token
languages: django.template.base.FilterExpression = ... languages: FilterExpression = ...
variable: str = ... variable: str = ...
def __init__(self, languages: FilterExpression, variable: str) -> None: ... def __init__(self, languages: FilterExpression, variable: str) -> None: ...
def get_language_info(self, language: Any): ... def get_language_info(self, language: Any): ...
def render(self, context: Context) -> str: ... def render(self, context: Context) -> str: ...
class GetCurrentLanguageNode(Node): class GetCurrentLanguageNode(Node):
origin: django.template.base.Origin origin: Origin
token: django.template.base.Token token: Token
variable: str = ... variable: str = ...
def __init__(self, variable: str) -> None: ... def __init__(self, variable: str) -> None: ...
def render(self, context: RequestContext) -> str: ... def render(self, context: RequestContext) -> str: ...
class GetCurrentLanguageBidiNode(Node): class GetCurrentLanguageBidiNode(Node):
origin: django.template.base.Origin origin: Origin
token: django.template.base.Token token: Token
variable: str = ... variable: str = ...
def __init__(self, variable: str) -> None: ... def __init__(self, variable: str) -> None: ...
def render(self, context: RequestContext) -> str: ... def render(self, context: RequestContext) -> str: ...
class TranslateNode(Node): class TranslateNode(Node):
origin: django.template.base.Origin origin: Origin
token: django.template.base.Token token: Token
noop: bool = ... noop: bool = ...
asvar: Optional[str] = ... asvar: Optional[str] = ...
message_context: Optional[django.template.base.FilterExpression] = ... message_context: Optional[FilterExpression] = ...
filter_expression: django.template.base.FilterExpression = ... filter_expression: FilterExpression = ...
def __init__( def __init__(
self, self,
filter_expression: FilterExpression, filter_expression: FilterExpression,
@@ -62,14 +62,14 @@ class TranslateNode(Node):
def render(self, context: Context) -> str: ... def render(self, context: Context) -> str: ...
class BlockTranslateNode(Node): class BlockTranslateNode(Node):
origin: django.template.base.Origin origin: Origin
token: django.template.base.Token token: Token
extra_context: Dict[str, django.template.base.FilterExpression] = ... extra_context: Dict[str, FilterExpression] = ...
singular: List[django.template.base.Token] = ... singular: List[Token] = ...
plural: List[django.template.base.Token] = ... plural: List[Token] = ...
countervar: Optional[str] = ... countervar: Optional[str] = ...
counter: Optional[django.template.base.FilterExpression] = ... counter: Optional[FilterExpression] = ...
message_context: Optional[django.template.base.FilterExpression] = ... message_context: Optional[FilterExpression] = ...
trimmed: bool = ... trimmed: bool = ...
asvar: Optional[str] = ... asvar: Optional[str] = ...
def __init__( def __init__(
@@ -87,10 +87,10 @@ class BlockTranslateNode(Node):
def render(self, context: Context, nested: bool = ...) -> str: ... def render(self, context: Context, nested: bool = ...) -> str: ...
class LanguageNode(Node): class LanguageNode(Node):
origin: django.template.base.Origin origin: Origin
token: django.template.base.Token token: Token
nodelist: django.template.base.NodeList = ... nodelist: NodeList = ...
language: django.template.base.FilterExpression = ... language: FilterExpression = ...
def __init__(self, nodelist: NodeList, language: FilterExpression) -> None: ... def __init__(self, nodelist: NodeList, language: FilterExpression) -> None: ...
def render(self, context: Context) -> SafeText: ... def render(self, context: Context) -> SafeText: ...

View File

@@ -12,9 +12,9 @@ def localize(value: Union[date, float]) -> str: ...
def unlocalize(value: Union[date, float]) -> str: ... def unlocalize(value: Union[date, float]) -> str: ...
class LocalizeNode(Node): class LocalizeNode(Node):
origin: django.template.base.Origin origin: Origin
token: django.template.base.Token token: Token
nodelist: Union[List[Any], django.template.base.NodeList] = ... nodelist: Union[List[Any], NodeList] = ...
use_l10n: bool = ... use_l10n: bool = ...
def __init__(self, nodelist: Union[List[Any], NodeList], use_l10n: bool) -> None: ... def __init__(self, nodelist: Union[List[Any], NodeList], use_l10n: bool) -> None: ...
def render(self, context: Context) -> SafeText: ... def render(self, context: Context) -> SafeText: ...

View File

@@ -7,8 +7,8 @@ from django.template.context import Context
register: Any register: Any
class PrefixNode(template.Node): class PrefixNode(template.Node):
origin: django.template.base.Origin origin: Origin
token: django.template.base.Token token: Token
varname: Optional[str] = ... varname: Optional[str] = ...
name: str = ... name: str = ...
def __init__(self, varname: Optional[str] = ..., name: str = ...) -> None: ... def __init__(self, varname: Optional[str] = ..., name: str = ...) -> None: ...
@@ -22,9 +22,9 @@ def get_static_prefix(parser: Parser, token: Token) -> PrefixNode: ...
def get_media_prefix(parser: Parser, token: Token) -> PrefixNode: ... def get_media_prefix(parser: Parser, token: Token) -> PrefixNode: ...
class StaticNode(template.Node): class StaticNode(template.Node):
origin: django.template.base.Origin origin: Origin
token: django.template.base.Token token: Token
path: django.template.base.FilterExpression = ... path: FilterExpression = ...
varname: Optional[str] = ... varname: Optional[str] = ...
def __init__(self, varname: Optional[str] = ..., path: FilterExpression = ...) -> None: ... def __init__(self, varname: Optional[str] = ..., path: FilterExpression = ...) -> None: ...
def url(self, context: Context) -> str: ... def url(self, context: Context) -> str: ...

View File

@@ -18,24 +18,24 @@ def do_timezone(
) -> Union[datetimeobject, str]: ... ) -> Union[datetimeobject, str]: ...
class LocalTimeNode(Node): class LocalTimeNode(Node):
origin: django.template.base.Origin origin: Origin
token: django.template.base.Token token: Token
nodelist: django.template.base.NodeList = ... nodelist: NodeList = ...
use_tz: bool = ... use_tz: bool = ...
def __init__(self, nodelist: NodeList, use_tz: bool) -> None: ... def __init__(self, nodelist: NodeList, use_tz: bool) -> None: ...
def render(self, context: Context) -> SafeText: ... def render(self, context: Context) -> SafeText: ...
class TimezoneNode(Node): class TimezoneNode(Node):
origin: django.template.base.Origin origin: Origin
token: django.template.base.Token token: Token
nodelist: django.template.base.NodeList = ... nodelist: NodeList = ...
tz: django.template.base.FilterExpression = ... tz: FilterExpression = ...
def __init__(self, nodelist: NodeList, tz: FilterExpression) -> None: ... def __init__(self, nodelist: NodeList, tz: FilterExpression) -> None: ...
def render(self, context: Context) -> SafeText: ... def render(self, context: Context) -> SafeText: ...
class GetCurrentTimezoneNode(Node): class GetCurrentTimezoneNode(Node):
origin: django.template.base.Origin origin: Origin
token: django.template.base.Token token: Token
variable: str = ... variable: str = ...
def __init__(self, variable: str) -> None: ... def __init__(self, variable: str) -> None: ...
def render(self, context: Context) -> str: ... def render(self, context: Context) -> str: ...

View File

@@ -6,3 +6,5 @@ from .testcases import (
) )
from .utils import override_settings as override_settings from .utils import override_settings as override_settings
from .client import Client as Client

View File

@@ -7,7 +7,7 @@ from django.core.handlers.base import BaseHandler
from django.core.handlers.wsgi import WSGIRequest from django.core.handlers.wsgi import WSGIRequest
from django.core.serializers.json import DjangoJSONEncoder from django.core.serializers.json import DjangoJSONEncoder
from django.http.cookie import SimpleCookie from django.http.cookie import SimpleCookie
from django.http.response import HttpResponse, HttpResponseBase from django.http.response import HttpResponseBase
class RedirectCycleError(Exception): class RedirectCycleError(Exception):
last_response: HttpResponseBase = ... last_response: HttpResponseBase = ...
@@ -79,31 +79,6 @@ class Client(RequestFactory):
def store_exc_info(self, **kwargs: Any) -> None: ... def store_exc_info(self, **kwargs: Any) -> None: ...
@property @property
def session(self) -> SessionBase: ... def session(self) -> SessionBase: ...
def request(self, **request: Any) -> Any: ...
def get(
self, path: str, data: Any = ..., follow: bool = ..., secure: bool = ..., **extra: Any
) -> HttpResponseBase: ...
def post(
self, path: str, data: Any = ..., content_type: str = ..., follow: bool = ..., secure: bool = ..., **extra: Any
) -> HttpResponseBase: ...
def head(
self, path: str, data: Any = ..., follow: bool = ..., secure: bool = ..., **extra: Any
) -> HttpResponse: ...
def options(
self, path: str, data: Any = ..., content_type: str = ..., follow: bool = ..., secure: bool = ..., **extra: Any
) -> HttpResponse: ...
def put(
self, path: str, data: Any = ..., content_type: str = ..., follow: bool = ..., secure: bool = ..., **extra: Any
) -> HttpResponse: ...
def patch(
self, path: str, data: Any = ..., content_type: str = ..., follow: bool = ..., secure: bool = ..., **extra: Any
) -> HttpResponse: ...
def delete(
self, path: str, data: Any = ..., content_type: str = ..., follow: bool = ..., secure: bool = ..., **extra: Any
) -> HttpResponse: ...
def trace(
self, path: str, data: Any = ..., follow: bool = ..., secure: bool = ..., **extra: Any
) -> HttpResponse: ...
def login(self, **credentials: Any) -> bool: ... def login(self, **credentials: Any) -> bool: ...
def force_login(self, user: User, backend: Optional[str] = ...) -> None: ... def force_login(self, user: User, backend: Optional[str] = ...) -> None: ...
cookies: SimpleCookie = ... cookies: SimpleCookie = ...

View File

@@ -1,38 +1,33 @@
import unittest import logging
from argparse import ArgumentParser from argparse import ArgumentParser
from io import StringIO
from typing import Any, Dict, List, Optional, Set, Tuple, Type, Union from typing import Any, Dict, List, Optional, Set, Tuple, Type, Union
from unittest.case import TestCase, _SubTest from unittest import TestCase, TextTestResult, TestSuite
from unittest.runner import TextTestResult, _WritelnDecorator
from unittest.suite import TestSuite
from django.db.backends.base.base import BaseDatabaseWrapper from django.db.backends.base.base import BaseDatabaseWrapper
from django.test.testcases import SimpleTestCase, TestCase from django.test.testcases import SimpleTestCase, TestCase
from django.utils.datastructures import OrderedSet from django.utils.datastructures import OrderedSet
class DebugSQLTextTestResult(unittest.TextTestResult): class DebugSQLTextTestResult(TextTestResult):
buffer: bool buffer: bool
descriptions: bool descriptions: bool
dots: bool dots: bool
errors: List[Tuple[unittest.case.TestCase, str, str]]
expectedFailures: List[Any] expectedFailures: List[Any]
failfast: bool failfast: bool
failures: List[Tuple[unittest.case.TestCase, str, str]]
shouldStop: bool shouldStop: bool
showAll: bool showAll: bool
skipped: List[Any] skipped: List[Any]
stream: unittest.runner._WritelnDecorator
tb_locals: bool tb_locals: bool
testsRun: int testsRun: int
unexpectedSuccesses: List[Any] unexpectedSuccesses: List[Any]
logger: logging.Logger = ... logger: logging.Logger = ...
def __init__(self, stream: _WritelnDecorator, descriptions: bool, verbosity: int) -> None: ... def __init__(self, stream: Any, descriptions: bool, verbosity: int) -> None: ...
debug_sql_stream: _io.StringIO = ... debug_sql_stream: StringIO = ...
handler: logging.StreamHandler = ... handler: logging.StreamHandler = ...
def startTest(self, test: TestCase) -> None: ... def startTest(self, test: TestCase) -> None: ...
def stopTest(self, test: TestCase) -> None: ... def stopTest(self, test: TestCase) -> None: ...
def addError(self, test: Any, err: Any) -> None: ... def addError(self, test: Any, err: Any) -> None: ...
def addFailure(self, test: Any, err: Any) -> None: ... def addFailure(self, test: Any, err: Any) -> None: ...
def addSubTest(self, test: TestCase, subtest: _SubTest, err: None) -> None: ...
def printErrorList(self, flavour: str, errors: List[Tuple[TestCase, str, str]]) -> None: ... def printErrorList(self, flavour: str, errors: List[Tuple[TestCase, str, str]]) -> None: ...
class RemoteTestResult: class RemoteTestResult:
@@ -67,7 +62,7 @@ class RemoteTestRunner:
def default_test_processes() -> int: ... def default_test_processes() -> int: ...
class ParallelTestSuite(unittest.TestSuite): class ParallelTestSuite(TestSuite):
init_worker: Any = ... init_worker: Any = ...
run_subsuite: Any = ... run_subsuite: Any = ...
runner_class: Any = ... runner_class: Any = ...

View File

@@ -1,9 +1,7 @@
import threading import threading
import unittest import unittest
from contextlib import _GeneratorContextManager
from datetime import date from datetime import date
from typing import Any, Callable, Dict, Iterator, List, Optional, Set, Tuple, Type, Union from typing import Any, Callable, Dict, Iterator, List, Optional, Set, Tuple, Type, Union
from unittest.runner import TextTestResult
from django.core.exceptions import ImproperlyConfigured from django.core.exceptions import ImproperlyConfigured
from django.core.handlers.wsgi import WSGIHandler from django.core.handlers.wsgi import WSGIHandler
@@ -62,9 +60,9 @@ class SimpleTestCase(unittest.TestCase):
def setUpClass(cls) -> None: ... def setUpClass(cls) -> None: ...
@classmethod @classmethod
def tearDownClass(cls) -> None: ... def tearDownClass(cls) -> None: ...
def __call__(self, result: TextTestResult = ...) -> None: ... def __call__(self, result: unittest.TestResult = ...) -> None: ...
def settings(self, **kwargs: Any) -> override_settings: ... def settings(self, **kwargs: Any) -> Any: ...
def modify_settings(self, **kwargs: Any) -> modify_settings: ... def modify_settings(self, **kwargs: Any) -> Any: ...
def assertRedirects( def assertRedirects(
self, self,
response: HttpResponse, response: HttpResponse,
@@ -120,10 +118,10 @@ class SimpleTestCase(unittest.TestCase):
) -> Optional[_AssertTemplateNotUsedContext]: ... ) -> Optional[_AssertTemplateNotUsedContext]: ...
def assertRaisesMessage( def assertRaisesMessage(
self, expected_exception: Type[Exception], expected_message: str, *args: Any, **kwargs: Any self, expected_exception: Type[Exception], expected_message: str, *args: Any, **kwargs: Any
) -> Optional[_GeneratorContextManager]: ... ) -> Any: ...
def assertWarnsMessage( def assertWarnsMessage(
self, expected_warning: Type[Exception], expected_message: str, *args: Any, **kwargs: Any self, expected_warning: Type[Exception], expected_message: str, *args: Any, **kwargs: Any
) -> _GeneratorContextManager: ... ) -> Any: ...
def assertFieldOutput( def assertFieldOutput(
self, self,
fieldclass: Type[EmailField], fieldclass: Type[EmailField],

View File

@@ -8,18 +8,18 @@ from django.core.checks.registry import CheckRegistry
from django.test.runner import DiscoverRunner from django.test.runner import DiscoverRunner
from django.test.testcases import SimpleTestCase from django.test.testcases import SimpleTestCase
from django.conf import LazySettings from django.conf import LazySettings, Settings
_TestClass = Type[SimpleTestCase]
_DecoratedTest = Union[Callable, _TestClass]
class Approximate: class Approximate:
val: Union[decimal.Decimal, float] = ... val: Union[decimal.Decimal, float] = ...
places: int = ... places: int = ...
def __init__(self, val: Union[Decimal, float], places: int = ...) -> None: ... def __init__(self, val: Union[Decimal, float], places: int = ...) -> None: ...
def __eq__(self, other: Union[Decimal, float]) -> bool: ...
class ContextList(list): class ContextList(list):
def __getitem__(self, key: Union[int, str]) -> Any: ...
def get(self, key: str, default: Optional[str] = ...) -> str: ... def get(self, key: str, default: Optional[str] = ...) -> str: ...
def __contains__(self, key: str) -> bool: ...
def keys(self) -> Set[str]: ... def keys(self) -> Set[str]: ...
class _TestState: ... class _TestState: ...
@@ -29,53 +29,38 @@ def teardown_test_environment() -> None: ...
def get_runner(settings: LazySettings, test_runner_class: Optional[str] = ...) -> Type[DiscoverRunner]: ... def get_runner(settings: LazySettings, test_runner_class: Optional[str] = ...) -> Type[DiscoverRunner]: ...
class TestContextDecorator: class TestContextDecorator:
attr_name: Any = ... attr_name: Optional[str] = ...
kwarg_name: Any = ... kwarg_name: Optional[str] = ...
def __init__(self, attr_name: Optional[str] = ..., kwarg_name: Optional[str] = ...) -> None: ... def __init__(self, attr_name: Optional[str] = ..., kwarg_name: Optional[str] = ...) -> None: ...
def enable(self) -> None: ... def enable(self) -> Any: ...
def disable(self) -> None: ... def disable(self) -> None: ...
def __enter__(self) -> Optional[Apps]: ... def __enter__(self) -> Optional[Apps]: ...
def __exit__(self, exc_type: None, exc_value: None, traceback: None) -> None: ... def __exit__(self, exc_type: None, exc_value: None, traceback: None) -> None: ...
def decorate_class(self, cls: Type[SimpleTestCase]) -> Type[SimpleTestCase]: ... def decorate_class(self, cls: _TestClass) -> _TestClass: ...
def decorate_callable(self, func: Callable) -> Callable: ... def decorate_callable(self, func: Callable) -> Callable: ...
def __call__( def __call__(self, decorated: _DecoratedTest) -> _DecoratedTest: ...
self, decorated: Union[Callable, Type[Union[SimpleTestCase, LoggingCaptureMixin]]]
) -> Union[Callable, Type[Union[SimpleTestCase, LoggingCaptureMixin]]]: ...
class override_settings(TestContextDecorator): class override_settings(TestContextDecorator):
attr_name: None
kwarg_name: None
options: Dict[str, Any] = ... options: Dict[str, Any] = ...
def __init__(self, **kwargs: Any) -> None: ... def __init__(self, **kwargs: Any) -> None: ...
wrapped: Settings = ... wrapped: Settings = ...
def enable(self) -> None: ... def save_options(self, test_func: _DecoratedTest) -> None: ...
def disable(self) -> None: ... def decorate_class(self, cls: type) -> type: ...
def save_options(self, test_func: Type[Union[SimpleTestCase, LoggingCaptureMixin]]) -> None: ...
def decorate_class(
self, cls: Type[Union[SimpleTestCase, LoggingCaptureMixin]]
) -> Type[Union[SimpleTestCase, LoggingCaptureMixin]]: ...
class modify_settings(override_settings): class modify_settings(override_settings):
attr_name: None
kwarg_name: None
wrapped: Settings wrapped: Settings
operations: List[Tuple[str, Dict[str, Union[List[str], str]]]] = ... operations: List[Tuple[str, Dict[str, Union[List[str], str]]]] = ...
def __init__(self, *args: Any, **kwargs: Any) -> None: ... def __init__(self, *args: Any, **kwargs: Any) -> None: ...
def save_options(self, test_func: Type[SimpleTestCase]) -> None: ... def save_options(self, test_func: _DecoratedTest) -> None: ...
options: Dict[str, List[Union[Tuple[str, str], str]]] = ... options: Dict[str, List[Union[Tuple[str, str], str]]] = ...
def enable(self) -> None: ...
class override_system_checks(TestContextDecorator): class override_system_checks(TestContextDecorator):
attr_name: None
kwarg_name: None
registry: CheckRegistry = ... registry: CheckRegistry = ...
new_checks: List[Callable] = ... new_checks: List[Callable] = ...
deployment_checks: Optional[List[Callable]] = ... deployment_checks: Optional[List[Callable]] = ...
def __init__(self, new_checks: List[Callable], deployment_checks: Optional[List[Callable]] = ...) -> None: ... def __init__(self, new_checks: List[Callable], deployment_checks: Optional[List[Callable]] = ...) -> None: ...
old_checks: Set[Callable] = ... old_checks: Set[Callable] = ...
old_deployment_checks: Set[Callable] = ... old_deployment_checks: Set[Callable] = ...
def enable(self) -> None: ...
def disable(self) -> None: ...
class CaptureQueriesContext: class CaptureQueriesContext:
connection: Any = ... connection: Any = ...
@@ -92,27 +77,19 @@ class CaptureQueriesContext:
def __exit__(self, exc_type: None, exc_value: None, traceback: None) -> None: ... def __exit__(self, exc_type: None, exc_value: None, traceback: None) -> None: ...
class ignore_warnings(TestContextDecorator): class ignore_warnings(TestContextDecorator):
attr_name: None
kwarg_name: None
ignore_kwargs: Dict[str, Any] = ... ignore_kwargs: Dict[str, Any] = ...
filter_func: Callable = ... filter_func: Callable = ...
def __init__(self, **kwargs: Any) -> None: ... def __init__(self, **kwargs: Any) -> None: ...
catch_warnings: warnings.catch_warnings = ... catch_warnings: warnings.catch_warnings = ...
def enable(self) -> None: ...
def disable(self) -> None: ...
requires_tz_support: Any requires_tz_support: Any
def isolate_lru_cache(lru_cache_object: Callable) -> Iterator[None]: ... def isolate_lru_cache(lru_cache_object: Callable) -> Iterator[None]: ...
class override_script_prefix(TestContextDecorator): class override_script_prefix(TestContextDecorator):
attr_name: None
kwarg_name: None
prefix: str = ... prefix: str = ...
def __init__(self, prefix: str) -> None: ... def __init__(self, prefix: str) -> None: ...
old_prefix: str = ... old_prefix: str = ...
def enable(self) -> None: ...
def disable(self) -> None: ...
class LoggingCaptureMixin: class LoggingCaptureMixin:
logger: Any = ... logger: Any = ...
@@ -122,10 +99,6 @@ class LoggingCaptureMixin:
def tearDown(self) -> None: ... def tearDown(self) -> None: ...
class isolate_apps(TestContextDecorator): class isolate_apps(TestContextDecorator):
attr_name: Optional[str]
kwarg_name: Optional[str]
installed_apps: Tuple[str] = ... installed_apps: Tuple[str] = ...
def __init__(self, *installed_apps: Any, **kwargs: Any) -> None: ... def __init__(self, *installed_apps: Any, **kwargs: Any) -> None: ...
old_apps: Apps = ... old_apps: Apps = ...
def enable(self) -> Apps: ...
def disable(self) -> None: ...

View File

@@ -99,7 +99,5 @@ class URLResolver:
@property @property
def app_dict(self) -> Dict[str, List[str]]: ... def app_dict(self) -> Dict[str, List[str]]: ...
def resolve(self, path: str) -> ResolverMatch: ... def resolve(self, path: str) -> ResolverMatch: ...
def urlconf_module(self) -> Optional[List[Tuple[str, Callable]]]: ...
def url_patterns(self) -> List[Tuple[str, Callable]]: ...
def resolve_error_handler(self, view_type: int) -> Tuple[Callable, Dict[str, Any]]: ... def resolve_error_handler(self, view_type: int) -> Tuple[Callable, Dict[str, Any]]: ...
def reverse(self, lookup_view: str, *args: Any, **kwargs: Any) -> str: ... def reverse(self, lookup_view: str, *args: Any, **kwargs: Any) -> str: ...

View File

@@ -34,7 +34,6 @@ class LazyObject:
__bool__: Any = ... __bool__: Any = ...
__dir__: Any = ... __dir__: Any = ...
__class__: Any = ... __class__: Any = ...
__eq__: Any = ...
__ne__: Any = ... __ne__: Any = ...
__hash__: Any = ... __hash__: Any = ...
__getitem__: Any = ... __getitem__: Any = ...

View File

@@ -18,7 +18,7 @@ class JavaScriptCatalog(View):
args: Tuple args: Tuple
head: Callable head: Callable
kwargs: Dict[Any, Any] kwargs: Dict[Any, Any]
request: django.core.handlers.wsgi.WSGIRequest request: WSGIRequest
domain: str = ... domain: str = ...
packages: List[str] = ... packages: List[str] = ...
translation: django.utils.translation.trans_real.DjangoTranslation = ... translation: django.utils.translation.trans_real.DjangoTranslation = ...