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.core.handlers.wsgi import WSGIRequest
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.query import QuerySet
from django.db.models.fields import BooleanField, DateField, Field
from django.db.models.fields import Field
class ListFilter:
title: Any = ...
@@ -16,44 +15,36 @@ class ListFilter:
def __init__(
self, request: WSGIRequest, params: Dict[str, str], model: Type[Model], model_admin: ModelAdmin
) -> None: ...
def has_output(self) -> None: ...
def has_output(self) -> bool: ...
def choices(self, changelist: Any) -> None: ...
def queryset(self, request: Any, queryset: Any) -> None: ...
def expected_parameters(self) -> None: ...
def queryset(self, request: Any, queryset: QuerySet) -> Optional[QuerySet]: ...
def expected_parameters(self) -> Optional[List[str]]: ...
class SimpleListFilter(ListFilter):
parameter_name: 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 lookups(self, request: Any, model_admin: Any) -> None: ...
def expected_parameters(self): ...
def choices(self, changelist: Any) -> None: ...
class FieldListFilter(ListFilter):
field: Any = ...
field: Field = ...
field_path: Any = ...
title: Any = ...
def __init__(
self,
field: Union[Field, reverse_related.ForeignObjectRel],
field: Field,
request: WSGIRequest,
params: Dict[str, str],
model: Type[Model],
model_admin: ModelAdmin,
field_path: str,
) -> None: ...
def has_output(self) -> bool: ...
def queryset(self, request: WSGIRequest, queryset: QuerySet) -> QuerySet: ...
@classmethod
def register(cls, test: Callable, list_filter_class: Type[FieldListFilter], take_priority: bool = ...) -> None: ...
@classmethod
def create(
cls,
field: Union[Field, reverse_related.ForeignObjectRel],
field: Field,
request: WSGIRequest,
params: Dict[str, str],
model: Type[Model],
@@ -62,8 +53,6 @@ class FieldListFilter(ListFilter):
) -> FieldListFilter: ...
class RelatedFieldListFilter(FieldListFilter):
field: django.db.models.fields.related.ForeignKey
field_path: str
used_parameters: Dict[Any, Any]
lookup_kwarg: str = ...
lookup_kwarg_isnull: str = ...
@@ -73,61 +62,26 @@ class RelatedFieldListFilter(FieldListFilter):
lookup_title: Any = ...
title: str = ...
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
def include_empty_choice(self) -> bool: ...
def has_output(self) -> bool: ...
def expected_parameters(self) -> List[str]: ...
def field_choices(
self, field: FieldCacheMixin, request: WSGIRequest, model_admin: ModelAdmin
) -> List[Tuple[Union[int, str], str]]: ...
def choices(self, changelist: Any) -> None: ...
self, field: RelatedField, request: WSGIRequest, model_admin: ModelAdmin
) -> List[Tuple[str, str]]: ...
class BooleanFieldListFilter(FieldListFilter):
lookup_kwarg: Any = ...
lookup_kwarg2: Any = ...
lookup_val: 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: ...
class ChoicesFieldListFilter(FieldListFilter):
field: django.db.models.fields.IntegerField
field_path: str
title: str
used_parameters: Dict[Any, Any]
lookup_kwarg: str = ...
lookup_kwarg_isnull: str = ...
lookup_val: 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):
field_generic: Any = ...
@@ -136,50 +90,21 @@ class DateFieldListFilter(FieldListFilter):
lookup_kwarg_until: Any = ...
links: 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):
field: django.db.models.fields.CharField
field_path: str
title: str
used_parameters: Dict[Any, Any]
lookup_kwarg: str = ...
lookup_kwarg_isnull: str = ...
lookup_val: None = ...
lookup_val_isnull: None = ...
empty_value_display: django.utils.safestring.SafeText = ...
lookup_choices: django.db.models.query.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: ...
empty_value_display: str = ...
lookup_choices: QuerySet = ...
class RelatedOnlyFieldListFilter(RelatedFieldListFilter):
field: django.db.models.fields.related.ForeignKey
field_path: str
lookup_kwarg: str
lookup_kwarg_isnull: str
lookup_val: None
lookup_val_isnull: None
title: str
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.contrib.auth.forms import AdminPasswordChangeForm
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.utils.safestring import SafeText
from django.forms.boundfield import BoundField
ACTION_CHECKBOX_NAME: str
class ActionForm(forms.Form):
auto_id: None
data: Dict[Any, Any]
empty_permitted: bool
error_class: Type[django.forms.utils.ErrorList]
error_class: Type[ErrorList]
fields: collections.OrderedDict
files: Dict[Any, Any]
initial: Dict[Any, Any]
@@ -77,7 +80,7 @@ class Fieldline:
def errors(self) -> SafeText: ...
class AdminField:
field: django.forms.boundfield.BoundField = ...
field: BoundField = ...
is_first: bool = ...
is_checkbox: bool = ...
is_readonly: bool = ...

View File

@@ -1,3 +1,4 @@
import datetime
from typing import Any, Dict, List, Optional, Union
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.paginator import Paginator
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.related import ForeignKey, ManyToManyField, RelatedField
from django.db.models.query import QuerySet
from django.forms.fields import Field, TypedChoiceField
from django.forms.models import ModelChoiceField, ModelMultipleChoiceField
from django.forms.widgets import Media
from django.http.response import HttpResponse, HttpResponseBase, HttpResponseRedirect, JsonResponse
from django.urls.resolvers import URLPattern
from django.utils.safestring import SafeText
from django.db.models.options import Options
IS_POPUP_VAR: str
TO_FIELD_VAR: str
HORIZONTAL: Any
@@ -90,10 +93,7 @@ class BaseModelAdmin:
def has_module_permission(self, request: WSGIRequest) -> bool: ...
class ModelAdmin(BaseModelAdmin):
formfield_overrides: Dict[
Type[Union[django.db.models.fields.DateTimeCheckMixin, Field]],
Dict[str, Type[Union[django.forms.fields.SplitDateTimeField, django.forms.widgets.Widget]]],
]
formfield_overrides: Any
list_display: Any = ...
list_display_links: Any = ...
list_filter: Any = ...
@@ -123,8 +123,8 @@ class ModelAdmin(BaseModelAdmin):
actions_selection_counter: bool = ...
checks_class: Any = ...
model: Type[Model] = ...
opts: django.db.models.options.Options = ...
admin_site: django.contrib.admin.sites.AdminSite = ...
opts: Options = ...
admin_site: AdminSite = ...
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_urls(self) -> List[URLPattern]: ...
@@ -263,7 +263,6 @@ class InlineModelAdmin(BaseModelAdmin):
fields: Any = ...
def get_formset(self, request: Any, obj: Optional[Any] = ..., **kwargs: Any): ...
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_delete_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):
paginate_by: int = ...
model_admin: django.contrib.admin.options.ModelAdmin = ...
model_admin: ModelAdmin = ...
term: Any = ...
paginator_class: 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.query import QuerySet
from django.db.models.options import Options
ALL_VAR: str
ORDER_VAR: str
ORDER_TYPE_VAR: str
@@ -18,9 +20,9 @@ IGNORED_PARAMS: Any
class ChangeList:
model: Type[Model] = ...
opts: django.db.models.options.Options = ...
lookup_opts: django.db.models.options.Options = ...
root_queryset: django.db.models.query.QuerySet = ...
opts: Options = ...
lookup_opts: Options = ...
root_queryset: QuerySet = ...
list_display: List[str] = ...
list_display_links: List[str] = ...
list_filter: Tuple = ...
@@ -29,7 +31,7 @@ class ChangeList:
list_select_related: bool = ...
list_per_page: int = ...
list_max_show_all: int = ...
model_admin: django.contrib.admin.options.ModelAdmin = ...
model_admin: ModelAdmin = ...
preserved_filters: str = ...
sortable_by: Tuple[str] = ...
page_num: int = ...

View File

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

View File

@@ -26,13 +26,13 @@ class GroupAdmin(admin.ModelAdmin):
) -> ModelMultipleChoiceField: ...
class UserAdmin(admin.ModelAdmin):
admin_site: django.contrib.admin.sites.AdminSite
admin_site: AdminSite
formfield_overrides: Dict[
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]
opts: django.db.models.options.Options
model: Type[User]
opts: Options
add_form_template: str = ...
change_user_password_template: 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.models import AnonymousUser, User
from django.core.handlers.wsgi import WSGIRequest
UserModel: Any
@@ -20,14 +19,11 @@ class ModelBackend:
def has_module_perms(self, user_obj: Union[AbstractBaseUser, AnonymousUser], app_label: str) -> bool: ...
def get_user(self, user_id: int) -> AbstractBaseUser: ...
class AllowAllUsersModelBackend(ModelBackend):
def user_can_authenticate(self, user: AbstractBaseUser) -> bool: ...
class AllowAllUsersModelBackend(ModelBackend): ...
class RemoteUserBackend(ModelBackend):
create_unknown_user: bool = ...
def authenticate(self, request: WSGIRequest, remote_user: Optional[str]) -> Optional[User]: ...
def clean_username(self, username: str) -> str: ...
def configure_user(self, user: User) -> User: ...
class AllowAllUsersRemoteUserBackend(RemoteUserBackend):
def user_can_authenticate(self, user: User) -> bool: ...
class AllowAllUsersRemoteUserBackend(RemoteUserBackend): ...

View File

@@ -6,14 +6,14 @@ from django.utils.functional import SimpleLazyObject
class PermLookupDict:
app_label: django.utils.safestring.SafeText
user: django.utils.functional.SimpleLazyObject
user: SimpleLazyObject
def __init__(self, user: SimpleLazyObject, app_label: str) -> None: ...
def __getitem__(self, perm_name: str) -> bool: ...
def __iter__(self) -> Any: ...
def __bool__(self) -> bool: ...
class PermWrapper:
user: django.utils.functional.SimpleLazyObject = ...
user: SimpleLazyObject = ...
def __init__(self, user: Union[AnonymousUser, User]) -> None: ...
def __getitem__(self, app_label: str) -> PermLookupDict: ...
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.models import AbstractUser, User
from django.contrib.auth.tokens import PasswordResetTokenGenerator
from django.core.exceptions import ValidationError
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
class ReadOnlyPasswordHashWidget(forms.Widget):
attrs: Dict[Any, Any]
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):
widget: Any = ...
@@ -29,11 +32,11 @@ class UserCreationForm(forms.ModelForm):
auto_id: str
data: Dict[str, str]
empty_permitted: bool
error_class: Type[django.forms.utils.ErrorList]
error_class: Type[ErrorList]
fields: collections.OrderedDict
files: Dict[Any, Any]
initial: Dict[Any, Any]
instance: django.contrib.auth.models.User
instance: User
is_bound: bool
label_suffix: str
error_messages: Any = ...
@@ -51,11 +54,11 @@ class UserChangeForm(forms.ModelForm):
auto_id: str
data: Dict[Any, Any]
empty_permitted: bool
error_class: Type[django.forms.utils.ErrorList]
error_class: Type[ErrorList]
fields: collections.OrderedDict
files: Dict[Any, Any]
initial: Dict[str, Optional[Union[List[Any], datetime.datetime, int, str]]]
instance: django.contrib.auth.models.User
instance: User
is_bound: bool
label_suffix: str
password: Any = ...
@@ -68,22 +71,21 @@ class UserChangeForm(forms.ModelForm):
class AuthenticationForm(forms.Form):
auto_id: str
data: django.http.request.QueryDict
data: QueryDict
empty_permitted: bool
error_class: Type[django.forms.utils.ErrorList]
error_class: Type[ErrorList]
fields: collections.OrderedDict
files: django.utils.datastructures.MultiValueDict
files: MultiValueDict
initial: Dict[Any, Any]
is_bound: bool
label_suffix: str
username: Any = ...
password: Any = ...
error_messages: Any = ...
request: django.core.handlers.wsgi.WSGIRequest = ...
request: WSGIRequest = ...
user_cache: None = ...
username_field: Any = ...
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 get_user(self) -> User: ...
def get_invalid_login_error(self) -> ValidationError: ...
@@ -92,7 +94,7 @@ class PasswordResetForm(forms.Form):
auto_id: str
data: Dict[Any, Any]
empty_permitted: bool
error_class: Type[django.forms.utils.ErrorList]
error_class: Type[ErrorList]
fields: collections.OrderedDict
files: Dict[Any, Any]
initial: Dict[Any, Any]
@@ -126,7 +128,7 @@ class SetPasswordForm(forms.Form):
auto_id: str
data: Dict[Any, Any]
empty_permitted: bool
error_class: Type[django.forms.utils.ErrorList]
error_class: Type[ErrorList]
fields: collections.OrderedDict
files: Dict[Any, Any]
initial: Dict[Any, Any]
@@ -135,7 +137,7 @@ class SetPasswordForm(forms.Form):
error_messages: Any = ...
new_password1: Any = ...
new_password2: Any = ...
user: django.contrib.auth.models.User = ...
user: User = ...
def __init__(self, user: Optional[AbstractBaseUser], *args: Any, **kwargs: Any) -> None: ...
def clean_new_password2(self) -> str: ...
def save(self, commit: bool = ...) -> AbstractBaseUser: ...
@@ -144,13 +146,13 @@ class PasswordChangeForm(SetPasswordForm):
auto_id: str
data: Dict[Any, Any]
empty_permitted: bool
error_class: Type[django.forms.utils.ErrorList]
error_class: Type[ErrorList]
fields: collections.OrderedDict
files: Dict[Any, Any]
initial: Dict[Any, Any]
is_bound: bool
label_suffix: str
user: django.contrib.auth.models.User
user: User
error_messages: Any = ...
old_password: Any = ...
field_order: Any = ...
@@ -160,7 +162,7 @@ class AdminPasswordChangeForm(forms.Form):
auto_id: str
data: Dict[Any, Any]
empty_permitted: bool
error_class: Type[django.forms.utils.ErrorList]
error_class: Type[ErrorList]
fields: collections.OrderedDict
files: Dict[Any, Any]
initial: Dict[Any, Any]
@@ -170,7 +172,7 @@ class AdminPasswordChangeForm(forms.Form):
required_css_class: str = ...
password1: Any = ...
password2: Any = ...
user: django.contrib.auth.models.User = ...
user: User = ...
def __init__(self, user: AbstractUser, *args: Any, **kwargs: Any) -> None: ...
def clean_password2(self) -> str: ...
def save(self, commit: bool = ...) -> AbstractUser: ...

View File

@@ -102,8 +102,6 @@ class AnonymousUser:
is_staff: bool = ...
is_active: bool = ...
is_superuser: bool = ...
def __eq__(self, other: Union[AnonymousUser, User]) -> bool: ...
def __hash__(self) -> int: ...
def save(self) -> Any: ...
def delete(self) -> 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.core.checks.messages import Error
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.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_utils import FilteredRelation, PathInfo
from django.db.models.sql.where import WhereNode
@@ -47,7 +50,7 @@ class GenericForeignKey(FieldCacheMixin):
def __set__(self, instance: Model, value: Optional[Model]) -> None: ...
class GenericRel(ForeignObjectRel):
field: django.contrib.contenttypes.fields.GenericRelation
field: GenericRelation
limit_choices_to: Dict[Any, Any]
model: Type[Model]
multiple: bool
@@ -103,8 +106,8 @@ class GenericRelation(ForeignObject):
def bulk_related_objects(self, objs: List[Model], using: str = ...) -> QuerySet: ...
class ReverseGenericManyToOneDescriptor(ReverseManyToOneDescriptor):
field: django.contrib.contenttypes.fields.GenericRelation
rel: django.contrib.contenttypes.fields.GenericRel
field: GenericRelation
rel: GenericRel
def related_manager_cls(self): ...
def create_generic_related_manager(superclass: Any, rel: Any): ...

View File

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

View File

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

View File

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

View File

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

View File

@@ -5,7 +5,7 @@ from django.http.request import HttpRequest
class SessionStorage(BaseStorage):
added_new: bool
request: django.core.handlers.wsgi.WSGIRequest
request: WSGIRequest
used: bool
session_key: str = ...
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):
priority: None = ...
changefreq: None = ...
queryset: django.db.models.query.QuerySet = ...
queryset: QuerySet = ...
date_field: None = ...
protocol: None = ...
def __init__(

View File

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

View File

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

View File

@@ -1,7 +1,7 @@
from typing import Any, Dict, Iterator, List, Optional, Tuple, Type, Union
from django.db.models.base import Model
from django.forms.utils import ErrorDict, ErrorList
from django.forms.utils import ErrorDict
class FieldDoesNotExist(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 django.core.files import File
class ImageFile(File):
file: BufferedReader
mode: str
name: str
@property
@@ -12,4 +11,4 @@ class ImageFile(File):
@property
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_available_name(self, name: str, max_length: Optional[int] = ...) -> str: ...
def generate_filename(self, filename: str) -> str: ...
def path(self, name: str) -> Any: ...
def delete(self, name: Any) -> None: ...
def exists(self, name: Any) -> None: ...
def listdir(self, path: Any) -> None: ...
def size(self, name: Any) -> None: ...
def url(self, name: Any) -> None: ...
def get_accessed_time(self, name: Any) -> None: ...
def get_created_time(self, name: Any) -> None: ...
def get_modified_time(self, name: Any) -> None: ...
def path(self, name: str) -> str: ...
def delete(self, name: str) -> None: ...
def exists(self, name: str) -> bool: ...
def listdir(self, path: Any) -> Optional[Tuple[List[str], List[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 FileSystemStorage(Storage):
def __init__(
@@ -36,15 +36,6 @@ class FileSystemStorage(Storage):
def base_url(self) -> str: ...
def file_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): ...

View File

@@ -3,14 +3,13 @@ from typing import Any, Callable, Dict, Optional, Union
from django.contrib.auth.models import AbstractUser
from django.contrib.sessions.backends.base import SessionBase
from django.http.request import QueryDict
from django.http.response import HttpResponse
from django.utils.datastructures import MultiValueDict
from django.core.handlers import base
from django.http import HttpRequest
_Stream = Union[BytesIO, str]
_WSGIEnviron = Dict[str, Any]
class LimitedStream:
stream: _Stream = ...
@@ -22,31 +21,18 @@ class LimitedStream:
def readline(self, size: Optional[int] = ...) -> bytes: ...
class WSGIRequest(HttpRequest):
content_params: Dict[str, str]
content_type: str
environ: Dict[str, Any] = ...
path_info: str = ...
path: str = ...
environ: _WSGIEnviron = ...
user: AbstractUser
session: SessionBase
META: Dict[str, Any] = ...
method: str = ...
encoding: Any = ...
resolver_match: 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 = ...
def __init__(self, environ: _WSGIEnviron) -> None: ...
class WSGIHandler(base.BaseHandler):
request_class: Any = ...
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_script_name(environ: Dict[str, Any]) -> str: ...
def get_bytes_from_wsgi(environ: Dict[str, Any], key: str, default: str) -> bytes: ...
def get_str_from_wsgi(environ: Dict[str, Any], key: str, default: str) -> str: ...
def get_path_info(environ: _WSGIEnviron) -> str: ...
def get_script_name(environ: _WSGIEnviron) -> str: ...
def get_bytes_from_wsgi(environ: _WSGIEnviron, key: str, default: str) -> bytes: ...
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 = ...
called_from_command_line: bool = ...
def __init__(self, **kwargs: Any) -> None: ...
def parse_args(self, args: List[str] = ..., namespace: None = ...) -> Namespace: ...
def error(self, message: str) -> Any: ...
def handle_default_options(options: Namespace) -> None: ...

View File

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

View File

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

View File

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

View File

@@ -15,17 +15,14 @@ class WSGIServer(simple_server.WSGIServer):
class ThreadedWSGIServer(socketserver.ThreadingMixIn, WSGIServer): ...
class ServerHandler(simple_server.ServerHandler):
http_version: str = ...
def handle_error(self) -> None: ...
class WSGIRequestHandler(simple_server.WSGIRequestHandler):
client_address: str
close_connection: bool
connection: WSGIRequest
request: WSGIRequest
rfile: BytesIO
server: None
wfile: socketserver._SocketWriter
wfile: BytesIO
protocol_version: str = ...
def address_string(self) -> str: ...
def log_message(self, format: str, *args: Any) -> None: ...
@@ -33,5 +30,4 @@ class WSGIRequestHandler(simple_server.WSGIRequestHandler):
raw_requestline: bytes = ...
requestline: str = ...
request_version: str = ...
command: 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 django.core.files.base import File
from django.utils.functional import SimpleLazyObject
EMPTY_VALUES: Any
@@ -27,7 +26,7 @@ class RegexValidator:
inverse_match: Optional[bool] = ...,
flags: Optional[RegexFlag] = ...,
) -> None: ...
def __call__(self, value: Optional[Union[float, str]]) -> None: ...
def __call__(self, value: Optional[str]) -> None: ...
class URLValidator(RegexValidator):
ul: str = ...
@@ -39,7 +38,6 @@ class URLValidator(RegexValidator):
host_re: Any = ...
schemes: Any = ...
def __init__(self, schemes: Optional[List[str]] = ..., **kwargs: Any) -> None: ...
def __call__(self, value: str) -> None: ...
integer_validator: Any
@@ -80,33 +78,29 @@ validate_comma_separated_integer_list: Any
class BaseValidator:
message: Any = ...
code: str = ...
limit_value: bool = ...
limit_value: Any = ...
def __init__(self, limit_value: Any, message: Optional[str] = ...) -> None: ...
def __call__(self, value: Any) -> None: ...
def compare(self, a: bool, b: bool) -> bool: ...
def clean(self, x: Any) -> Any: ...
class MaxValueValidator(BaseValidator):
limit_value: Decimal
message: Any = ...
code: str = ...
def compare(self, a: Union[datetime, Decimal, float], b: Union[datetime, Decimal, float]) -> bool: ...
class MinValueValidator(BaseValidator):
limit_value: int
message: Any = ...
code: str = ...
def compare(self, a: Union[datetime, Decimal, float], b: Union[datetime, Decimal, float]) -> bool: ...
class MinLengthValidator(BaseValidator):
limit_value: int
message: Any = ...
code: str = ...
def compare(self, a: int, b: int) -> bool: ...
def clean(self, x: str) -> int: ...
class MaxLengthValidator(BaseValidator):
limit_value: int
message: Any = ...
code: str = ...
def compare(self, a: int, b: int) -> bool: ...

View File

@@ -10,7 +10,6 @@ class Node:
children: Set[Any] = ...
parents: Set[Any] = ...
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 __hash__(self) -> int: ...
def __getitem__(self, item: int) -> str: ...

View File

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

View File

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

View File

@@ -18,7 +18,6 @@ from .fields import (
TextField as TextField,
BooleanField as BooleanField,
NullBooleanField as NullBooleanField,
FileField as FileField,
DateField as DateField,
TimeField as TimeField,
DateTimeField as DateTimeField,
@@ -31,7 +30,12 @@ from .fields import (
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 .deletion import (

View File

@@ -79,7 +79,6 @@ class BaseExpression:
def desc(self, **kwargs: Any) -> Expression: ...
def reverse_ordering(self): ...
def flatten(self) -> Iterator[Expression]: ...
def __eq__(self, other: object) -> bool: ...
def __hash__(self) -> int: ...
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.files.base import File
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.fields import Field
from django.forms import fields as form_fields
@@ -13,8 +14,6 @@ class FieldFile(File):
field: FileField = ...
storage: FileSystemStorage = ...
def __init__(self, instance: Model, field: FileField, name: Optional[str]) -> None: ...
def __eq__(self, other: Any) -> bool: ...
def __hash__(self): ...
file: Any = ...
@property
def path(self) -> str: ...
@@ -22,19 +21,16 @@ class FieldFile(File):
def url(self) -> str: ...
@property
def size(self) -> int: ...
def open(self, mode: str = ...) -> FieldFile: ...
name: Optional[str] = ...
def save(self, name: str, content: File, save: bool = ...) -> None: ...
def delete(self, save: bool = ...) -> None: ...
@property
def closed(self) -> bool: ...
def close(self) -> None: ...
class FileDescriptor:
field: FileField = ...
def __init__(self, field: FileField) -> None: ...
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):
attr_class: Any = ...
@@ -66,9 +62,6 @@ class ImageFileDescriptor(FileDescriptor):
class ImageFieldFile(ImageFile, FieldFile):
field: ImageField
instance: Model
name: Optional[str]
storage: DefaultStorage
def delete(self, save: bool = ...) -> None: ...
class ImageField(FileField):

View File

@@ -5,7 +5,7 @@ from django.db.models.base import Model
NOT_PROVIDED: Any
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 is_cached(self, instance: Model) -> bool: ...
def set_cached_value(self, instance: Model, value: Optional[Model]) -> None: ...

View File

@@ -34,6 +34,8 @@ class RelatedField(FieldCacheMixin, Field):
@property
def target_field(self) -> Field: ...
class ForeignObject(RelatedField): ...
class ForeignKey(RelatedField, Generic[_T]):
def __init__(self, to: Union[Type[_T], str], on_delete: Any, related_name: str = ..., **kwargs): ...
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.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.related import RelatedField, OneToOneField
from django.db.models.fields.reverse_related import ManyToManyRel, OneToOneRel
from django.db.models.query import QuerySet
from django.db.models.fields import Field
_T = TypeVar("_T")
class ForwardManyToOneDescriptor:
@@ -24,14 +24,13 @@ class ForwardManyToOneDescriptor:
def __get__(
self, instance: Optional[Model], cls: Type[Model] = ...
) -> 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]]: ...
class ForwardOneToOneDescriptor(ForwardManyToOneDescriptor):
RelatedObjectDoesNotExist: Type[ObjectDoesNotExist]
field: OneToOneField
def get_object(self, instance: Model) -> Model: ...
def __set__(self, instance: Model, value: Optional[Model]) -> None: ...
class ReverseOneToOneDescriptor:
RelatedObjectDoesNotExist: Type[ObjectDoesNotExist]

View File

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

View File

@@ -21,4 +21,3 @@ class Index:
def deconstruct(self) -> Tuple[str, Tuple, Dict[str, Union[List[str], str]]]: ...
def clone(self) -> Index: ...
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 django.apps.config import AppConfig
from django.contrib.auth.base_user import AbstractBaseUser
from django.contrib.auth.models import AbstractUser, PermissionsMixin
from django.apps.registry import Apps
from django.contrib.contenttypes.fields import GenericForeignKey
from django.contrib.postgres.fields.array import ArrayField
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.models.base import Model
from django.db.models.fields import Field
from django.db.models.fields.mixins import FieldCacheMixin
from django.db.models.fields.related import OneToOneField
from django.db.models.fields.related import OneToOneField, ManyToManyField
from django.db.models.fields.reverse_related import ForeignObjectRel
from django.db.models.manager import Manager
from django.db.models.query_utils import PathInfo
from django.utils.datastructures import ImmutableList
from django.db.models.fields import Field, mixins, AutoField
PROXY_PARENTS: Any
EMPTY_RELATION_TREE: Any
IMMUTABLE_WARNING: str
@@ -30,21 +30,21 @@ def make_immutable_fields_list(
) -> ImmutableList: ...
class Options:
base_manager: django.db.models.manager.Manager
concrete_fields: django.utils.datastructures.ImmutableList
default_manager: django.db.models.manager.Manager
fields: django.utils.datastructures.ImmutableList
local_concrete_fields: django.utils.datastructures.ImmutableList
managers: django.utils.datastructures.ImmutableList
managers_map: Dict[str, django.db.models.manager.Manager]
related_objects: django.utils.datastructures.ImmutableList
base_manager: Manager
concrete_fields: ImmutableList
default_manager: Manager
fields: ImmutableList
local_concrete_fields: ImmutableList
managers: ImmutableList
managers_map: Dict[str, Manager]
related_objects: ImmutableList
FORWARD_PROPERTIES: Any = ...
REVERSE_PROPERTIES: Any = ...
default_apps: Any = ...
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] = ...
local_managers: List[django.db.models.manager.Manager] = ...
local_managers: List[Manager] = ...
base_manager_name: None = ...
default_manager_name: None = ...
model_name: Optional[str] = ...
@@ -65,18 +65,9 @@ class Options:
db_tablespace: str = ...
required_db_features: List[Any] = ...
required_db_vendor: None = ...
meta: Optional[
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,
]
]
] = ...
meta: Optional[type] = ...
pk: Optional[Field] = ...
auto_field: Optional[django.db.models.fields.AutoField] = ...
auto_field: Optional[AutoField] = ...
abstract: bool = ...
managed: bool = ...
proxy: bool = ...
@@ -88,13 +79,7 @@ class Options:
related_fkey_lookups: List[Any] = ...
apps: Apps = ...
default_related_name: None = ...
def __init__(
self,
meta: Optional[
Type[Union[AbstractBaseUser.Meta, AbstractUser.Meta, PermissionsMixin.Meta, AbstractBaseSession.Meta]]
],
app_label: Optional[str] = ...,
) -> None: ...
def __init__(self, meta: Optional[type], app_label: Optional[str] = ...) -> None: ...
@property
def label(self) -> str: ...
@property
@@ -115,15 +100,7 @@ class Options:
def verbose_name_raw(self) -> Any: ...
@property
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 related_objects(self) -> ImmutableList: ...
def fields_map(self) -> Dict[str, ForeignObjectRel]: ...
def get_field(self, field_name: Union[Callable, str]) -> Union[Field, mixins.FieldCacheMixin]: ...
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 relabeled_clone(self, change_map: Union[Dict[str, str], OrderedDict]) -> Join: ...
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 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: ...
@property
def id_for_label(self) -> str: ...
def initial(self) -> Any: ...
def build_widget_attrs(
self, attrs: Dict[str, str], widget: Optional[Widget] = ...
) -> 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 decimal import Decimal
from typing import Any, Callable, Dict, List, Optional, Tuple, Union, Type
from uuid import UUID
from django.core.files.base import File
from django.core.files.uploadedfile import SimpleUploadedFile
from django.core.validators import BaseValidator
from django.db.models.fields.files import FieldFile
from django.forms.boundfield import BoundField
from django.forms.forms import BaseForm
from django.forms.widgets import Input, Widget
from django.forms.widgets import Widget
class Field:
initial: None
label: None
initial: Any
label: Optional[str]
required: bool
widget: Input = ...
widget: Widget = ...
hidden_widget: Any = ...
default_validators: Any = ...
default_error_messages: Any = ...
@@ -24,7 +23,7 @@ class Field:
show_hidden_initial: bool = ...
help_text: str = ...
disabled: bool = ...
label_suffix: None = ...
label_suffix: Optional[Any] = ...
localize: bool = ...
error_messages: Any = ...
validators: List[BaseValidator] = ...
@@ -44,28 +43,19 @@ class Field:
label_suffix: Optional[Any] = ...
) -> None: ...
def prepare_value(self, value: Any) -> Any: ...
def to_python(
self, value: Optional[Union[List[None], List[str], datetime, float, str]]
) -> Optional[Union[List[None], List[str], datetime, float, str]]: ...
def to_python(self, value: Optional[Any]) -> Optional[Any]: ...
def validate(self, value: Any) -> None: ...
def run_validators(self, value: Any) -> None: ...
def clean(self, value: Any) -> Any: ...
def bound_data(self, data: Any, initial: Any) -> Any: ...
def widget_attrs(self, widget: Widget) -> Dict[Any, Any]: ...
def has_changed(self, initial: Optional[Union[datetime, Decimal, float, str]], data: Optional[str]) -> bool: ...
def widget_attrs(self, widget: Widget) -> Any: ...
def has_changed(self, initial: Any, data: Optional[str]) -> bool: ...
def get_bound_field(self, form: BaseForm, field_name: str) -> BoundField: ...
def __deepcopy__(
self, memo: Dict[int, Union[List[Tuple[Union[int, str], str]], List[Widget], OrderedDict, Field, Widget]]
) -> Field: ...
def __deepcopy__(self, memo: Dict[Any, Any]) -> Field: ...
class CharField(Field):
disabled: bool
error_messages: Dict[str, str]
help_text: str
initial: Optional[Union[Callable, str]]
label: Optional[str]
label_suffix: Optional[str]
localize: bool
required: bool
show_hidden_initial: bool
max_length: Optional[Union[int, str]] = ...
@@ -81,53 +71,32 @@ class CharField(Field):
empty_value: str = ...,
**kwargs: Any
) -> 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):
disabled: bool
error_messages: Dict[str, str]
help_text: str
initial: Optional[Union[Callable, int]]
label: Optional[str]
label_suffix: None
localize: bool
max_value: Optional[int]
min_value: Optional[int]
max_value: Optional[Any]
min_value: Optional[Any]
required: bool
show_hidden_initial: bool
default_error_messages: Any = ...
re_decimal: Any = ...
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):
disabled: bool
error_messages: Dict[str, str]
help_text: str
initial: None
label: Optional[str]
label_suffix: None
localize: bool
max_value: Optional[float]
min_value: Optional[float]
required: bool
show_hidden_initial: bool
default_error_messages: Any = ...
def to_python(self, value: Optional[Union[float, str]]) -> Optional[float]: ...
def validate(self, value: Optional[float]) -> None: ...
def widget_attrs(self, widget: Input) -> Dict[str, Union[float, str]]: ...
class DecimalField(IntegerField):
decimal_places: Optional[int]
disabled: bool
error_messages: Dict[str, str]
help_text: str
initial: None
label: Optional[str]
label_suffix: None
localize: bool
max_digits: Optional[int]
max_value: Optional[Union[decimal.Decimal, int]]
min_value: Optional[Union[decimal.Decimal, int]]
@@ -143,84 +112,52 @@ class DecimalField(IntegerField):
decimal_places: Optional[Any] = ...,
**kwargs: Any
) -> None: ...
def to_python(self, value: Optional[Union[Decimal, float, str]]) -> Optional[Decimal]: ...
def validate(self, value: Optional[Decimal]) -> None: ...
def widget_attrs(self, widget: Widget) -> Dict[str, Union[Decimal, int, str]]: ...
class BaseTemporalField(Field):
input_formats: Any = ...
def __init__(self, *, input_formats: Optional[Any] = ..., **kwargs: Any) -> None: ...
def to_python(self, value: str) -> datetime: ...
def strptime(self, value: Any, format: Any) -> None: ...
def strptime(self, value: Any, format: Any) -> Any: ...
class DateField(BaseTemporalField):
disabled: bool
error_messages: Dict[str, str]
help_text: str
initial: Optional[Union[Callable, datetime.date]]
label: Optional[str]
label_suffix: None
localize: bool
required: bool
show_hidden_initial: bool
input_formats: Any = ...
default_error_messages: Any = ...
def to_python(self, value: Optional[Union[date, str]]) -> Optional[date]: ...
def strptime(self, value: str, format: str) -> date: ...
class TimeField(BaseTemporalField):
disabled: bool
error_messages: Dict[str, str]
help_text: str
initial: Optional[Callable]
label: Optional[str]
label_suffix: None
localize: bool
required: bool
show_hidden_initial: bool
input_formats: Any = ...
default_error_messages: Any = ...
def to_python(self, value: Optional[Union[time, str]]) -> Optional[time]: ...
def strptime(self, value: str, format: str) -> time: ...
class DateTimeField(BaseTemporalField):
disabled: bool
error_messages: Dict[str, str]
help_text: str
initial: Optional[Union[Callable, datetime.datetime]]
label: Optional[str]
label_suffix: None
localize: bool
required: bool
show_hidden_initial: bool
input_formats: Any = ...
default_error_messages: Any = ...
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: ...
class DurationField(Field):
disabled: bool
help_text: str
initial: Optional[datetime.timedelta]
label: None
label_suffix: None
localize: bool
required: bool
show_hidden_initial: bool
default_error_messages: Any = ...
def prepare_value(self, value: Optional[Union[timedelta, str]]) -> Optional[str]: ...
def to_python(self, value: Union[int, str]) -> timedelta: ...
class RegexField(CharField):
disabled: bool
empty_value: str
error_messages: Dict[str, str]
help_text: str
initial: None
label: None
label_suffix: None
localize: bool
max_length: Optional[int]
min_length: Optional[int]
required: bool
@@ -233,11 +170,6 @@ class EmailField(CharField):
disabled: bool
empty_value: Optional[str]
error_messages: Dict[str, str]
help_text: str
initial: None
label: Optional[str]
label_suffix: None
localize: bool
max_length: Optional[int]
min_length: Optional[int]
required: bool
@@ -248,49 +180,27 @@ class EmailField(CharField):
class FileField(Field):
disabled: bool
help_text: str
initial: Optional[Union[Callable, str]]
label: Optional[str]
label_suffix: None
localize: bool
required: bool
show_hidden_initial: bool
default_error_messages: Any = ...
max_length: Optional[int] = ...
allow_empty_file: bool = ...
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 has_changed(
self, initial: Optional[Union[FieldFile, str]], data: Optional[Union[Dict[str, str], str]]
) -> bool: ...
class ImageField(FileField):
allow_empty_file: bool
disabled: bool
help_text: str
initial: None
label: Optional[str]
label_suffix: None
localize: bool
max_length: Optional[int]
required: bool
show_hidden_initial: bool
default_validators: 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):
disabled: bool
empty_value: Optional[str]
error_messages: Dict[str, str]
help_text: str
initial: None
label: Optional[str]
label_suffix: None
localize: bool
max_length: Optional[int]
min_length: Optional[int]
required: bool
@@ -299,32 +209,18 @@ class URLField(CharField):
default_error_messages: Any = ...
default_validators: Any = ...
def __init__(self, **kwargs: Any) -> None: ...
def to_python(self, value: Optional[Union[int, str]]) -> Optional[str]: ...
class BooleanField(Field):
disabled: bool
error_messages: Dict[str, str]
help_text: str
initial: Optional[int]
label: Optional[str]
label_suffix: None
localize: bool
required: bool
show_hidden_initial: bool
def to_python(self, value: Optional[Union[int, str]]) -> bool: ...
def validate(self, value: bool) -> None: ...
def has_changed(self, initial: Optional[Union[bool, str]], data: Optional[Union[bool, str]]) -> bool: ...
class NullBooleanField(BooleanField):
disabled: bool
help_text: str
initial: Optional[bool]
label: Optional[str]
label_suffix: None
localize: bool
required: bool
show_hidden_initial: bool
def to_python(self, value: Optional[Union[bool, str]]) -> Optional[bool]: ...
def validate(self, value: Optional[bool]) -> None: ...
class CallableChoiceIterator:
@@ -335,117 +231,62 @@ class CallableChoiceIterator:
class ChoiceField(Field):
disabled: bool
error_messages: Dict[str, str]
help_text: str
initial: None
label: Optional[str]
label_suffix: None
localize: bool
required: bool
show_hidden_initial: bool
default_error_messages: Any = ...
choices: Any = ...
def __init__(self, *, choices: Any = ..., **kwargs: Any) -> None: ...
def __deepcopy__(
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 validate(self, value: Any) -> None: ...
def valid_value(self, value: str) -> bool: ...
class TypedChoiceField(ChoiceField):
disabled: bool
help_text: str
initial: Optional[Union[Callable, int]]
label: Optional[str]
label_suffix: None
localize: bool
required: bool
show_hidden_initial: bool
coerce: Union[Callable, Type[Union[bool, float, str]]] = ...
empty_value: Optional[str] = ...
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):
disabled: bool
error_messages: Dict[str, str]
help_text: str
initial: Optional[Callable]
label: None
label_suffix: None
localize: bool
required: bool
show_hidden_initial: bool
hidden_widget: 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 has_changed(
self, initial: Optional[Union[List[int], List[str], str]], data: Optional[Union[List[str], str]]
) -> bool: ...
class TypedMultipleChoiceField(MultipleChoiceField):
disabled: bool
help_text: str
initial: None
label: None
label_suffix: None
localize: bool
required: bool
show_hidden_initial: bool
coerce: Union[Callable, Type[float]] = ...
empty_value: Optional[List[Any]] = ...
def __init__(self, *, coerce: Any = ..., **kwargs: Any) -> None: ...
def clean(self, value: List[str]) -> Optional[Union[List[bool], List[Decimal], List[float]]]: ...
def validate(self, value: List[str]) -> None: ...
class ComboField(Field):
disabled: bool
help_text: str
initial: None
label: None
label_suffix: None
localize: bool
required: bool
show_hidden_initial: bool
fields: Any = ...
def __init__(self, fields: List[CharField], **kwargs: Any) -> None: ...
def clean(self, value: Optional[str]) -> str: ...
class MultiValueField(Field):
disabled: bool
help_text: str
initial: None
label: None
label_suffix: None
localize: bool
required: bool
show_hidden_initial: bool
default_error_messages: Any = ...
require_all_fields: bool = ...
fields: Any = ...
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 clean(
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: ...
def compress(self, data_list: Any) -> Any: ...
class FilePathField(ChoiceField):
allow_files: bool
allow_folders: bool
disabled: bool
help_text: str
initial: None
label: Optional[str]
label_suffix: None
localize: bool
match: Optional[str]
path: str
recursive: bool
@@ -466,11 +307,6 @@ class FilePathField(ChoiceField):
class SplitDateTimeField(MultiValueField):
disabled: bool
help_text: str
initial: Optional[Union[Callable, datetime.datetime]]
label: Optional[str]
label_suffix: None
localize: bool
require_all_fields: bool
required: bool
show_hidden_initial: bool
@@ -485,11 +321,6 @@ class GenericIPAddressField(CharField):
disabled: bool
empty_value: str
error_messages: Dict[str, str]
help_text: str
initial: None
label: None
label_suffix: None
localize: bool
max_length: None
min_length: None
required: bool
@@ -498,16 +329,10 @@ class GenericIPAddressField(CharField):
unpack_ipv4: bool = ...
default_validators: List[Callable] = ...
def __init__(self, *, protocol: str = ..., unpack_ipv4: bool = ..., **kwargs: Any) -> None: ...
def to_python(self, value: Optional[str]) -> str: ...
class SlugField(CharField):
disabled: bool
empty_value: str
help_text: str
initial: None
label: Optional[str]
label_suffix: None
localize: bool
max_length: Optional[int]
min_length: None
required: bool
@@ -519,11 +344,6 @@ class SlugField(CharField):
class UUIDField(CharField):
disabled: bool
empty_value: str
help_text: str
initial: Optional[Callable]
label: Optional[str]
label_suffix: None
localize: bool
max_length: None
min_length: None
required: bool
@@ -531,4 +351,3 @@ class UUIDField(CharField):
strip: bool
default_error_messages: Any = ...
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 datetime import date, datetime
from decimal import Decimal
from typing import Any, Callable, Dict, Iterator, List, Optional, Tuple, Type, Union
from unittest.mock import MagicMock
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.formsets import BaseFormSet
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.utils.datastructures import MultiValueDict
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(
instance: Model,
fields: Optional[Union[List[Union[Callable, str]], Tuple[str]]] = ...,
fields: Optional[_Fields] = ...,
exclude: Optional[Union[List[Union[Callable, str]], Tuple[str]]] = ...,
) -> Dict[str, Optional[Union[bool, date, float]]]: ...
def fields_for_model(
model: Type[Model],
fields: Optional[Union[List[Union[Callable, str]], Tuple]] = ...,
fields: Optional[_Fields] = ...,
exclude: Optional[Union[List[Union[Callable, str]], Tuple]] = ...,
widgets: Optional[Union[Dict[str, Type[Input]], Dict[str, Widget]]] = ...,
formfield_callback: Optional[Union[Callable, str]] = ...,
localized_fields: Optional[Union[Tuple[str], str]] = ...,
labels: Optional[Dict[str, str]] = ...,
labels: Optional[_Labels] = ...,
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]]] = ...,
*,
apply_limit_choices_to: bool = ...
@@ -42,13 +45,13 @@ def fields_for_model(
class ModelFormOptions:
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]] = ...
widgets: Optional[Dict[str, Union[Widget, Input]]] = ...
localized_fields: Optional[Union[Tuple[str], str]] = ...
labels: Optional[Dict[str, str]] = ...
labels: Optional[_Labels] = ...
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]]] = ...
def __init__(self, options: Optional[type] = ...) -> None: ...
@@ -61,14 +64,7 @@ class BaseModelForm(BaseForm):
instance: Any = ...
def __init__(
self,
data: Optional[
Union[
Dict[str, Optional[Union[List[int], datetime, int, str]]],
Dict[str, Union[List[str], str]],
Dict[str, Union[datetime, Decimal, int, str]],
QueryDict,
]
] = ...,
data: Optional[Union[Dict[str, Any], QueryDict]] = ...,
files: Optional[Union[Dict[str, SimpleUploadedFile], MultiValueDict]] = ...,
auto_id: Union[bool, str] = ...,
prefix: None = ...,
@@ -207,10 +203,6 @@ def inlineformset_factory(
class InlineForeignKeyField(Field):
disabled: bool
help_text: str
initial: Optional[Union[Model, int, str]]
label: Optional[str]
label_suffix: None
localize: bool
required: bool
show_hidden_initial: bool
widget: Any = ...
@@ -221,12 +213,10 @@ class InlineForeignKeyField(Field):
def __init__(
self, parent_instance: Model, *args: Any, pk_field: bool = ..., to_field: Optional[Any] = ..., **kwargs: Any
) -> 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:
field: django.forms.models.ModelChoiceField = ...
queryset: Optional[django.db.models.query.QuerySet] = ...
field: ModelChoiceField = ...
queryset: Optional[QuerySet] = ...
def __init__(self, field: ModelChoiceField) -> None: ...
def __iter__(self) -> Iterator[Tuple[Union[int, str], str]]: ...
def __len__(self) -> int: ...
@@ -237,14 +227,9 @@ class ModelChoiceField(ChoiceField):
disabled: bool
error_messages: Dict[str, str]
help_text: str
initial: Optional[Union[Callable, int, str, uuid.UUID]]
label: Optional[str]
label_suffix: None
localize: bool
required: bool
show_hidden_initial: bool
validators: List[Any]
widget: django.forms.widgets.Select
default_error_messages: Any = ...
iterator: Any = ...
empty_label: Optional[str] = ...
@@ -266,13 +251,8 @@ class ModelChoiceField(ChoiceField):
**kwargs: Any
) -> None: ...
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: ...
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 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
empty_label: None
help_text: str
initial: Optional[Union[Callable, List[int]]]
label: Optional[str]
label_suffix: None
localize: bool
required: bool
show_hidden_initial: bool
widget: Any = ...
hidden_widget: Any = ...
default_error_messages: Any = ...
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.engine import Engine
from django.template import Template
ROOT: Any
@@ -13,17 +14,13 @@ class BaseRenderer:
def render(self, template_name: str, context: Dict[str, Any], request: None = ...) -> str: ...
class EngineMixin:
def get_template(
self, template_name: str
) -> Union[template_backends.django.Template, template_backends.jinja2.Template]: ...
def get_template(self, template_name: str) -> Any: ...
def engine(self) -> BaseEngine: ...
class DjangoTemplates(EngineMixin, BaseRenderer):
engine: template_backends.django.DjangoTemplates
backend: Any = ...
class Jinja2(EngineMixin, BaseRenderer):
engine: template_backends.jinja2.Jinja2
backend: Any = ...
class TemplatesSetting(BaseRenderer):

View File

@@ -15,7 +15,7 @@ class ErrorDict(dict):
def as_ul(self) -> str: ...
def as_text(self) -> str: ...
class ErrorList(UserList, list):
class ErrorList(UserList):
data: List[Union[ValidationError, str]]
error_class: str = ...
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_ul(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__(
self, *args: Any, **kwargs: Any
) -> 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 date, datetime, time
from datetime import time
from decimal import Decimal
from itertools import chain
from typing import Any, Callable, Dict, Iterator, List, Optional, Set, Tuple, Type, Union
from typing import Any, Callable, Dict, Iterator, List, Optional, Set, Tuple, Type, Union, Iterable
from django.contrib.admin.options import BaseModelAdmin
from django.core.files.base import File
from django.core.files.uploadedfile import SimpleUploadedFile
from django.db.models.fields.files import FieldFile
from django.forms.fields import Field
from django.forms.forms import BaseForm
from django.forms.renderers import EngineMixin
from django.http.request import QueryDict
from django.utils.datastructures import MultiValueDict
from django.utils.safestring import SafeText
@@ -20,19 +17,17 @@ class MediaOrderConflictWarning(RuntimeWarning): ...
class Media:
def __init__(
self,
media: Optional[Type[Any]] = ...,
css: Optional[Union[Dict[str, List[str]], Dict[str, Tuple[str]]]] = ...,
js: Optional[Union[List[str], Tuple[str]]] = ...,
media: Optional[type] = ...,
css: Optional[Dict[str, Iterable[str]]] = ...,
js: Optional[Iterable[str]] = ...,
) -> None: ...
def render(self) -> SafeText: ...
def render_js(self) -> List[SafeText]: ...
def render(self) -> str: ...
def render_js(self) -> List[str]: ...
def render_css(self) -> chain: ...
def absolute_path(self, path: str) -> str: ...
def __getitem__(self, name: str) -> Media: ...
@staticmethod
def merge(
list_1: Union[List[int], List[str], Tuple[str]], list_2: Union[List[int], List[str], Tuple[str]]
) -> Union[List[int], List[str]]: ...
def merge(list_1: Iterable[Any], list_2: Iterable[Any]) -> Iterable[Any]: ...
def __add__(self, other: Media) -> Media: ...
class MediaDefiningClass(type):
@@ -45,14 +40,13 @@ class Widget:
is_localized: bool = ...
is_required: bool = ...
supports_microseconds: bool = ...
attrs: Dict[Any, Any] = ...
def __init__(self, attrs: Optional[Union[Dict[str, None], Dict[str, bool], Dict[str, float]]] = ...) -> None: ...
def __deepcopy__(self, memo: Dict[int, Union[Dict[Any, Any], List[Any]]]) -> Widget: ...
attrs: Dict[str, Any] = ...
def __init__(self, attrs: Optional[Dict[str, Any]] = ...) -> None: ...
@property
def is_hidden(self) -> bool: ...
def subwidgets(
self, name: str, value: None, attrs: Dict[str, bool] = ...
) -> Iterator[Dict[str, Optional[Union[Dict[str, bool], bool, str]]]]: ...
self, name: str, value: Optional[List[str]], attrs: Dict[str, bool] = ...
) -> Iterator[Dict[str, Any]]: ...
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 render(
@@ -75,188 +69,59 @@ class Widget:
def use_required_attribute(self, initial: Any) -> bool: ...
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 = ...
template_name: str = ...
class NumberInput(Input):
attrs: Dict[str, Union[float, str]]
is_required: bool
input_type: str = ...
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 TextInput(Input): ...
class NumberInput(Input): ...
class EmailInput(Input): ...
class URLInput(Input): ...
class PasswordInput(Input):
attrs: Dict[str, Union[bool, str]]
is_required: bool
input_type: str = ...
template_name: str = ...
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):
attrs: Dict[str, str]
choices: django.forms.models.ModelChoiceIterator
is_localized: bool
is_required: bool
input_type: str = ...
template_name: str = ...
choices: Iterable[Tuple[str, str]]
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 MultipleHiddenInput(HiddenInput): ...
class FileInput(Input):
attrs: Dict[str, Union[bool, str]]
is_required: bool
input_type: str = ...
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):
attrs: Dict[str, str]
is_required: bool
clear_checkbox_label: Any = ...
initial_text: Any = ...
input_text: Any = ...
template_name: str = ...
def clear_checkbox_name(self, name: str) -> str: ...
def clear_checkbox_id(self, name: str) -> str: ...
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 value_omitted_from_data(
self, data: Dict[str, str], files: Dict[str, Union[SimpleUploadedFile, str]], name: str
) -> bool: ...
class Textarea(Widget):
attrs: Dict[str, Union[int, str]]
is_required: bool
template_name: str = ...
def __init__(self, attrs: Optional[Union[Dict[str, int], Dict[str, str]]] = ...) -> None: ...
class DateTimeBaseInput(TextInput):
format_key: str = ...
supports_microseconds: bool = ...
format: Any = ...
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]: ...
format: Optional[str] = ...
class DateInput(DateTimeBaseInput):
attrs: Dict[str, str]
format: Optional[str]
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 DateInput(DateTimeBaseInput): ...
class DateTimeInput(DateTimeBaseInput): ...
class TimeInput(DateTimeBaseInput): ...
class CheckboxInput(Input):
attrs: Dict[str, str]
is_required: bool
input_type: str = ...
template_name: str = ...
check_test: Callable = ...
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):
allow_multiple_selected: bool = ...
input_type: Any = ...
template_name: Any = ...
input_type: Optional[str] = ...
template_name: Optional[str] = ...
option_template_name: Any = ...
add_id_index: bool = ...
checked_attribute: Any = ...
option_inherits_attrs: bool = ...
choices: Any = ...
choices: List[List[Union[int, str]]] = ...
def __init__(
self,
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
] = ...,
) -> 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 optgroups(
self, name: str, value: List[str], attrs: Optional[Dict[str, Union[bool, str]]] = ...
@@ -280,90 +143,32 @@ class ChoiceWidget(Widget):
subindex: Optional[int] = ...,
attrs: Optional[Dict[str, Union[bool, 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 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):
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 = ...
add_id_index: bool = ...
checked_attribute: Any = ...
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: ...
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 NullBooleanSelect(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 = ...
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):
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 = ...
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 = ...
input_type: str = ...
template_name: str = ...
option_template_name: str = ...
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: ...
class MultiWidget(Widget):
attrs: Dict[Any, Any]
template_name: str = ...
widgets: List[django.forms.widgets.Widget] = ...
widgets: List[Widget] = ...
def __init__(
self,
widgets: Union[List[Type[DateTimeBaseInput]], Tuple[Union[Type[TextInput], Input]]],
@@ -371,36 +176,11 @@ class MultiWidget(Widget):
) -> None: ...
@property
def is_hidden(self) -> bool: ...
def get_context(
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: ...
def decompress(self, value: Any) -> Optional[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):
attrs: Dict[Any, Any]
is_required: bool
widgets: List[django.forms.widgets.DateTimeBaseInput]
supports_microseconds: bool = ...
template_name: str = ...
def __init__(
self,
attrs: Optional[Dict[str, str]] = ...,
@@ -409,13 +189,8 @@ class SplitDateTimeWidget(MultiWidget):
date_attrs: Optional[Dict[str, str]] = ...,
time_attrs: Optional[Dict[str, str]] = ...,
) -> None: ...
def decompress(self, value: Optional[Union[datetime, str]]) -> Union[List[None], List[datetime]]: ...
class SplitHiddenDateTimeWidget(SplitDateTimeWidget):
attrs: Dict[Any, Any]
is_required: bool
widgets: List[django.forms.widgets.DateTimeBaseInput]
template_name: str = ...
def __init__(
self,
attrs: Optional[Dict[str, str]] = ...,
@@ -434,7 +209,6 @@ class SelectDateWidget(Widget):
input_type: str = ...
select_widget: Any = ...
date_re: Any = ...
attrs: Any = ...
years: Any = ...
months: Any = ...
year_none_value: Any = ...
@@ -447,8 +221,3 @@ class SelectDateWidget(Widget):
months: None = ...,
empty_label: Optional[Union[Tuple[str, str], str]] = ...,
) -> 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)
#
# 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 django.core.files import uploadhandler, uploadedfile
@@ -16,7 +16,7 @@ class RawPostDataException(Exception): ...
UploadHandlerList = Union[List[uploadhandler.FileUploadHandler], ImmutableList[uploadhandler.FileUploadHandler]]
class HttpRequest(BinaryIO):
class HttpRequest(BytesIO):
GET = ... # type: QueryDict
POST = ... # type: QueryDict
COOKIES = ... # type: Dict[str, str]

View File

@@ -3,14 +3,14 @@
import datetime
from io import BytesIO
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.http.cookie import SimpleCookie
import six
from django.template import Context, Template
from django.test import Client
from django.test.client import Client
from django.template import Context, Template
from django.urls import ResolverMatch
class BadHeaderError(ValueError): ...
@@ -64,7 +64,6 @@ class HttpResponse(HttpResponseBase):
client: Client
closed: bool
context: Optional[Context]
cookies: cookies.SimpleCookie
csrf_cookie_set: bool
redirect_chain: List[Tuple[str, int]]
request: Dict[str, Any]
@@ -84,11 +83,9 @@ class HttpResponse(HttpResponseBase):
@content.setter
def content(self, value: Any) -> None: ...
def __iter__(self) -> Iterator[bytes]: ...
def write(self, content: Union[bytes, str]) -> None: ...
def tell(self) -> int: ...
def getvalue(self) -> bytes: ...
def writable(self) -> bool: ...
def writelines(self, lines: List[str]) -> None: ...
@property
def url(self) -> str: ...
def json(self) -> Dict[str, Any]: ...
@@ -110,7 +107,6 @@ class FileResponse(StreamingHttpResponse):
client: Client
closed: bool
context: None
cookies: cookies.SimpleCookie
file_to_stream: Optional[BytesIO]
request: Dict[str, str]
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 Origin, Template
from django.template.base import Template
from django.template.exceptions import TemplateDoesNotExist
from django.utils.safestring import SafeText
from django.template.engine import Engine
from .base import BaseEngine
class DjangoTemplates(BaseEngine):
@@ -12,20 +11,12 @@ class DjangoTemplates(BaseEngine):
dirs: List[str]
name: str
app_dirname: str = ...
engine: django.template.engine.Engine = ...
engine: Engine = ...
def __init__(self, params: Dict[str, Any]) -> None: ...
def from_string(self, template_code: str) -> Template: ...
def get_template(self, template_name: str) -> Template: ...
def get_templatetag_libraries(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 reraise(exc: TemplateDoesNotExist, backend: DjangoTemplates) -> Any: ...
def get_installed_libraries() -> Dict[str, str]: ...

View File

@@ -1,10 +1,9 @@
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 .base import BaseEngine
from .utils import csrf_input_lazy, csrf_token_lazy
class TemplateStrings(BaseEngine):
app_dirs: bool

View File

@@ -1,11 +1,7 @@
from datetime import time
from typing import Any, Callable, Dict, List, Optional, Tuple, Union
from typing import Callable, Dict, List, Optional, Tuple, Any
from jinja2.environment import Template
from jinja2.exceptions import TemplateSyntaxError
from django.http.request import HttpRequest
from django.views.generic.base import TemplateView
from django.template.base import Template
from django.template.exceptions import TemplateSyntaxError
from .base import BaseEngine
@@ -17,99 +13,13 @@ class Jinja2(BaseEngine):
template_dirs: Tuple[str]
app_dirname: str = ...
context_processors: List[str] = ...
env: jinja2.environment.Environment = ...
def __init__(self, params: Dict[str, Union[Dict[str, Union[List[str], bool]], List[str], bool, str]]) -> None: ...
def __init__(self, params: Dict[str, Any]) -> None: ...
def from_string(self, template_code: str) -> Template: ...
def get_template(self, template_name: str) -> Template: ...
def 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:
name: str = ...
template_name: Optional[str] = ...
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 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.engine import Engine
from django.template.library import Library
@@ -38,23 +37,19 @@ class VariableDoesNotExist(Exception):
class Origin:
name: 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__(
self,
name: str,
template_name: Optional[Union[bytes, str]] = ...,
loader: Optional[Union[TemplateStrings, Loader]] = ...,
self, name: str, template_name: Optional[Union[bytes, str]] = ..., loader: Optional[Loader] = ...
) -> None: ...
def __eq__(self, other: Origin) -> bool: ...
@property
def loader_name(self) -> Optional[str]: ...
class Template:
name: Optional[str] = ...
origin: Origin = ...
engine: django.template.engine.Engine = ...
engine: Engine = ...
source: str = ...
nodelist: django.template.base.NodeList = ...
nodelist: NodeList = ...
def __init__(
self,
template_string: str,
@@ -136,8 +131,8 @@ class FilterExpression:
var: Union[Variable, SafeText] = ...
def __init__(self, token: str, parser: Parser) -> None: ...
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: ...
args_check: Any = ...
class Variable:
var: Union[Dict[Any, Any], str] = ...
@@ -151,8 +146,9 @@ class Variable:
class Node:
must_be_first: bool = ...
child_nodelists: Any = ...
token: Any = ...
def render(self, context: Any) -> None: ...
origin: Origin
token: Token = ...
def render(self, context: Context) -> str: ...
def render_annotated(self, context: Context) -> Union[int, str]: ...
def __iter__(self) -> None: ...
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):
origin: Origin
token: Token
filter_expression: django.template.base.FilterExpression = ...
filter_expression: FilterExpression = ...
def __init__(self, filter_expression: FilterExpression) -> None: ...
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 django.contrib.admin.templatetags.admin_list import ResultList
from django.contrib.admin.views.main import ChangeList
from django.db.models.base import Model
from django.db.models.options import Options
from django.forms.boundfield import BoundField
from django.http.request import HttpRequest
from django.template.base import Node, Origin, Template
from django.template.defaulttags import CycleNode, IfChangedNode
from django.template.library import InclusionNode
from django.template.loader_tags import BlockContext
from django.template.defaulttags import IfChangedNode
from django.template.loader_tags import IncludeNode
_ContextValues = Union[Dict[str, Any], "Context"]
class ContextPopException(Exception): ...
class ContextDict(dict):
context: django.template.context.BaseContext = ...
context: BaseContext = ...
def __init__(self, context: BaseContext, *args: Any, **kwargs: Any) -> None: ...
def __enter__(self) -> ContextDict: ...
def __exit__(self, *args: Any, **kwargs: Any) -> None: ...
@@ -31,23 +26,12 @@ class BaseContext:
def __getitem__(self, key: Union[int, str]) -> Any: ...
def __delitem__(self, key: Any) -> None: ...
def __contains__(self, key: str) -> bool: ...
def get(self, key: str, otherwise: Optional[int] = ...) -> Optional[Union[Options, int, str]]: ...
def get(self, key: str, otherwise: Optional[Any] = ...) -> Optional[Any]: ...
def setdefault(
self, key: Union[IfChangedNode, str], default: Optional[Union[List[Origin], int]] = ...
) -> Optional[Union[List[Origin], int]]: ...
def new(
self,
values: Optional[
Union[
Dict[str, Union[List[Dict[str, Union[int, str]]], List[ResultList], List[BoundField], ChangeList, int]],
Dict[str, Union[List[Dict[str, str]], ChangeList, int, str]],
Dict[str, Union[ChangeList, int, range, str]],
Context,
]
] = ...,
) -> Context: ...
def new(self, values: Optional[_ContextValues] = ...) -> Context: ...
def flatten(self) -> Dict[str, Optional[Union[Dict[str, Union[Type[Any], str]], int, str]]]: ...
def __eq__(self, other: Context) -> bool: ...
class Context(BaseContext):
dicts: Any
@@ -55,36 +39,32 @@ class Context(BaseContext):
use_l10n: Optional[bool] = ...
use_tz: Optional[bool] = ...
template_name: Optional[str] = ...
render_context: django.template.context.RenderContext = ...
render_context: RenderContext = ...
template: Optional[Template] = ...
def __init__(
self, dict_: Any = ..., autoescape: bool = ..., use_l10n: Optional[bool] = ..., use_tz: None = ...
) -> None: ...
def bind_template(self, template: Template) -> Iterator[None]: ...
def __copy__(self) -> Context: ...
def update(self, other_dict: Union[Dict[str, Model], Dict[str, int], Dict[str, str], Context]) -> ContextDict: ...
def update(self, other_dict: Union[Dict[str, Any], Context]) -> ContextDict: ...
class RenderContext(BaseContext):
dicts: List[Dict[Union[django.template.loader_tags.IncludeNode, str], str]]
dicts: List[Dict[Union[IncludeNode, str], str]]
template: Optional[Template] = ...
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]: ...
class RequestContext(Context):
autoescape: bool
dicts: List[Dict[str, str]]
render_context: django.template.context.RenderContext
render_context: RenderContext
template_name: Optional[str]
use_l10n: None
use_tz: None
request: django.http.request.HttpRequest = ...
request: HttpRequest = ...
def __init__(
self,
request: HttpRequest,
dict_: Optional[Dict[str, Union[Dict[str, Union[Type[Any], str]], str]]] = ...,
dict_: Optional[Dict[str, Any]] = ...,
processors: Optional[List[Callable]] = ...,
use_l10n: None = ...,
use_tz: None = ...,
@@ -92,22 +72,6 @@ class RequestContext(Context):
) -> None: ...
template: Optional[Template] = ...
def bind_template(self, template: Template) -> Iterator[None]: ...
def new(
self,
values: Optional[
Union[
Dict[str, Union[Dict[str, str], List[Dict[str, str]], bool]],
Dict[str, Union[List[Any], ChangeList, int, str]],
Dict[
str,
Union[
List[Dict[str, Optional[Union[int, str]]]], List[ResultList], List[BoundField], ChangeList, int
],
],
Dict[str, Union[ChangeList, int, range, str]],
Context,
]
] = ...,
) -> RequestContext: ...
def new(self, values: Optional[_ContextValues] = ...) -> RequestContext: ...
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 typing import Any, Dict, List, Optional, Tuple, Union
from django.template.base import FilterExpression, NodeList, Parser, Token
from django.template.context import Context, RequestContext
from django.template.library import Library
from django.template.base import FilterExpression, Parser, Token
from django.template.context import RequestContext, Context
from django.utils.safestring import SafeText
from .base import (
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 .base import Node, NodeList
from .library import Library
from .smartif import IfParser, Literal
register: Any
class AutoEscapeControlNode(Node):
nodelist: django.template.base.NodeList
origin: django.template.base.Origin
nodelist: NodeList
setting: bool
token: django.template.base.Token
def __init__(self, setting: bool, nodelist: NodeList) -> None: ...
def render(self, context: Context) -> SafeText: ...
class CommentNode(Node):
origin: django.template.base.Origin
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 CommentNode(Node): ...
class CsrfTokenNode(Node): ...
class CycleNode(Node):
origin: django.template.base.Origin
token: django.template.base.Token
cyclevars: List[django.template.base.FilterExpression] = ...
cyclevars: List[FilterExpression] = ...
variable_name: Optional[str] = ...
silent: bool = ...
def __init__(
self, cyclevars: List[FilterExpression], variable_name: Optional[str] = ..., silent: bool = ...
) -> None: ...
def render(self, context: Context) -> str: ...
def reset(self, context: Context) -> None: ...
class DebugNode(Node):
origin: django.template.base.Origin
token: django.template.base.Token
def render(self, context: Context) -> str: ...
class DebugNode(Node): ...
class FilterNode(Node):
filter_expr: django.template.base.FilterExpression
nodelist: django.template.base.NodeList
origin: django.template.base.Origin
token: django.template.base.Token
filter_expr: FilterExpression
nodelist: NodeList
def __init__(self, filter_expr: FilterExpression, nodelist: NodeList) -> None: ...
def render(self, context: Context) -> Any: ...
class FirstOfNode(Node):
origin: django.template.base.Origin
token: django.template.base.Token
vars: List[django.template.base.FilterExpression] = ...
vars: List[FilterExpression] = ...
asvar: Optional[str] = ...
def __init__(self, variables: List[FilterExpression], asvar: Optional[str] = ...) -> None: ...
def render(self, context: Context) -> str: ...
class ForNode(Node):
loopvars: Union[List[str], str]
origin: django.template.base.Origin
sequence: Union[django.template.base.FilterExpression, str]
token: django.template.base.Token
sequence: Union[FilterExpression, str]
child_nodelists: Any = ...
is_reversed: bool = ...
nodelist_loop: Union[List[str], django.template.base.NodeList] = ...
nodelist_empty: Union[List[str], django.template.base.NodeList] = ...
nodelist_loop: Union[List[str], NodeList] = ...
nodelist_empty: Union[List[str], NodeList] = ...
def __init__(
self,
loopvars: Union[List[str], str],
@@ -101,24 +56,18 @@ class ForNode(Node):
nodelist_loop: Union[List[str], NodeList],
nodelist_empty: Optional[Union[List[str], NodeList]] = ...,
) -> None: ...
def render(self, context: Context) -> SafeText: ...
class IfChangedNode(Node):
nodelist_false: django.template.base.NodeList
nodelist_true: django.template.base.NodeList
origin: django.template.base.Origin
token: django.template.base.Token
nodelist_false: NodeList
nodelist_true: NodeList
child_nodelists: Any = ...
def __init__(self, nodelist_true: NodeList, nodelist_false: NodeList, *varlist: Any) -> None: ...
def render(self, context: Context) -> str: ...
class IfEqualNode(Node):
nodelist_false: Union[List[Any], django.template.base.NodeList]
nodelist_true: Union[List[Any], django.template.base.NodeList]
origin: django.template.base.Origin
token: django.template.base.Token
var1: Union[django.template.base.FilterExpression, str]
var2: Union[django.template.base.FilterExpression, str]
nodelist_false: Union[List[Any], NodeList]
nodelist_true: Union[List[Any], NodeList]
var1: Union[FilterExpression, str]
var2: Union[FilterExpression, str]
child_nodelists: Any = ...
negate: bool = ...
def __init__(
@@ -129,82 +78,53 @@ class IfEqualNode(Node):
nodelist_false: Union[List[Any], NodeList],
negate: bool,
) -> None: ...
def render(self, context: Context) -> SafeText: ...
class IfNode(Node):
origin: django.template.base.Origin
token: django.template.base.Token
conditions_nodelists: List[
Tuple[Optional[django.template.defaulttags.TemplateLiteral], django.template.base.NodeList]
] = ...
conditions_nodelists: List[Tuple[Optional[TemplateLiteral], NodeList]] = ...
def __init__(self, conditions_nodelists: List[Tuple[Optional[TemplateLiteral], NodeList]]) -> None: ...
def __iter__(self) -> None: ...
@property
def nodelist(self) -> NodeList: ...
def render(self, context: Context) -> str: ...
class LoremNode(Node):
common: bool
count: django.template.base.FilterExpression
count: FilterExpression
method: str
origin: django.template.base.Origin
token: django.template.base.Token
def __init__(self, count: FilterExpression, method: str, common: bool) -> None: ...
def render(self, context: Context) -> str: ...
GroupedResult = namedtuple("GroupedResult", ["grouper", "list"])
class RegroupNode(Node):
expression: django.template.base.FilterExpression
origin: django.template.base.Origin
target: django.template.base.FilterExpression
token: django.template.base.Token
expression: FilterExpression
target: FilterExpression
var_name: str = ...
def __init__(self, target: FilterExpression, expression: FilterExpression, var_name: str) -> None: ...
def resolve_expression(self, obj: Dict[str, date], context: Context) -> Union[int, str]: ...
def render(self, context: Context) -> str: ...
class LoadNode(Node):
origin: django.template.base.Origin
token: django.template.base.Token
def render(self, context: Context) -> str: ...
class LoadNode(Node): ...
class NowNode(Node):
origin: django.template.base.Origin
token: django.template.base.Token
format_string: str = ...
asvar: Optional[str] = ...
def __init__(self, format_string: str, asvar: Optional[str] = ...) -> None: ...
def render(self, context: Context) -> str: ...
class ResetCycleNode(Node):
origin: django.template.base.Origin
token: django.template.base.Token
node: django.template.defaulttags.CycleNode = ...
node: CycleNode = ...
def __init__(self, node: CycleNode) -> None: ...
def render(self, context: Context) -> str: ...
class SpacelessNode(Node):
origin: django.template.base.Origin
token: django.template.base.Token
nodelist: django.template.base.NodeList = ...
nodelist: NodeList = ...
def __init__(self, nodelist: NodeList) -> None: ...
def render(self, context: Context) -> str: ...
class TemplateTagNode(Node):
origin: django.template.base.Origin
token: django.template.base.Token
mapping: Any = ...
tagtype: str = ...
def __init__(self, tagtype: str) -> None: ...
def render(self, context: Context) -> str: ...
class URLNode(Node):
origin: django.template.base.Origin
token: django.template.base.Token
view_name: django.template.base.FilterExpression = ...
args: List[django.template.base.FilterExpression] = ...
kwargs: Dict[str, django.template.base.FilterExpression] = ...
view_name: FilterExpression = ...
args: List[FilterExpression] = ...
kwargs: Dict[str, FilterExpression] = ...
asvar: Optional[str] = ...
def __init__(
self,
@@ -213,21 +133,15 @@ class URLNode(Node):
kwargs: Dict[str, FilterExpression],
asvar: Optional[str],
) -> None: ...
def render(self, context: Context) -> str: ...
class VerbatimNode(Node):
origin: django.template.base.Origin
token: django.template.base.Token
content: django.utils.safestring.SafeText = ...
content: SafeText = ...
def __init__(self, content: SafeText) -> None: ...
def render(self, context: Context) -> SafeText: ...
class WidthRatioNode(Node):
origin: django.template.base.Origin
token: django.template.base.Token
val_expr: django.template.base.FilterExpression = ...
max_expr: django.template.base.FilterExpression = ...
max_width: django.template.base.FilterExpression = ...
val_expr: FilterExpression = ...
max_expr: FilterExpression = ...
max_width: FilterExpression = ...
asvar: Optional[str] = ...
def __init__(
self,
@@ -236,21 +150,13 @@ class WidthRatioNode(Node):
max_width: FilterExpression,
asvar: Optional[str] = ...,
) -> None: ...
def render(self, context: Context) -> str: ...
class WithNode(Node):
origin: django.template.base.Origin
token: django.template.base.Token
nodelist: Union[List[Any], django.template.base.NodeList] = ...
extra_context: Dict[str, Union[django.template.base.FilterExpression, str]] = ...
nodelist: NodeList = ...
extra_context: Dict[str, Union[FilterExpression, str]] = ...
def __init__(
self,
var: Optional[str],
name: Optional[str],
nodelist: Union[List[Any], NodeList],
extra_context: Optional[Dict[str, FilterExpression]] = ...,
self, var: Optional[str], name: Optional[str], nodelist: NodeList, extra_context: Optional[Dict[str, Any]] = ...
) -> None: ...
def render(self, context: Context) -> Any: ...
def autoescape(parser: Parser, token: Token) -> AutoEscapeControlNode: ...
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: ...
class TemplateLiteral(Literal):
value: django.template.base.FilterExpression = ...
text: str = ...
def __init__(self, value: FilterExpression, text: str) -> None: ...
def display(self) -> str: ...
def eval(self, context: Context) -> Any: ...
class TemplateIfParser(IfParser):
current_token: django.template.defaulttags.TemplateLiteral
current_token: TemplateLiteral
pos: int
tokens: List[django.template.defaulttags.TemplateLiteral]
tokens: List[TemplateLiteral]
error_class: Any = ...
template_parser: django.template.base.Parser = ...
template_parser: Parser = ...
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 ifchanged(parser: Parser, token: Token) -> IfChangedNode: ...

View File

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

View File

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

View File

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

View File

@@ -6,7 +6,7 @@ from django.template.engine import Engine
from .base import Loader as BaseLoader
class Loader(BaseLoader):
engine: django.template.engine.Engine
engine: Engine
template_cache: Dict[Any, Any] = ...
get_template_cache: Dict[str, django.template.exceptions.TemplateDoesNotExist] = ...
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
class Loader(BaseLoader):
engine: django.template.engine.Engine
engine: Engine
dirs: Optional[List[str]] = ...
def __init__(self, engine: Engine, dirs: Optional[List[str]] = ...) -> None: ...
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 typing import Any, Callable, Dict, List, Optional, Tuple, Union
from unittest.mock import MagicMock
from django.db.models.base import Model
from django.http import HttpResponse
from django.core.handlers.wsgi import WSGIRequest
from django.http.request import HttpRequest
from django.template.backends.django import Template
from django.template.backends.jinja2 import Template
from django.views.generic.base import TemplateResponseMixin
from django.template.base import Template
from django.template.context import RequestContext
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): ...
@@ -47,36 +46,26 @@ class SimpleTemplateResponse(HttpResponse):
def content(self, value: Any) -> None: ...
class TemplateResponse(SimpleTemplateResponse):
client: django.test.client.Client
client: Client
closed: bool
context: django.template.context.RequestContext
context: RequestContext
context_data: Optional[Dict[str, Any]]
cookies: SimpleCookie
csrf_cookie_set: bool
json: functools.partial
redirect_chain: List[Tuple[str, int]]
request: Dict[str, Union[django.test.client.FakePayload, int, str]]
resolver_match: django.utils.functional.SimpleLazyObject
request: Dict[str, Union[int, str]]
status_code: int
template_name: Union[List[str], django.template.backends.django.Template, str]
template_name: Union[List[str], Template, str]
templates: List[Template]
using: Optional[str]
wsgi_request: django.core.handlers.wsgi.WSGIRequest
wsgi_request: WSGIRequest
rendering_attrs: Any = ...
def __init__(
self,
request: HttpRequest,
template: Union[List[str], Template, str],
context: Optional[
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,
]
] = ...,
context: Optional[Dict[str, Any]] = ...,
content_type: Optional[str] = ...,
status: Optional[int] = ...,
charset: None = ...,

View File

@@ -2,6 +2,8 @@ from typing import Any, Dict, List, Optional, Union
from django.template.defaulttags import TemplateLiteral
_Token = Union[List[int], int, str]
class TokenBase:
id: Any = ...
value: Any = ...
@@ -19,11 +21,10 @@ OPERATORS: Any
class Literal(TokenBase):
id: str = ...
lbp: int = ...
value: Optional[Union[List[int], int]] = ...
def __init__(self, value: Optional[Union[List[int], int]]) -> None: ...
value: Optional[_Token] = ...
def __init__(self, value: Optional[_Token]) -> None: ...
def display(self): ...
def nud(self, parser: IfParser) -> Literal: ...
def eval(self, context: Dict[Any, Any]) -> Optional[Union[List[int], int]]: ...
def eval(self, context: Dict[Any, Any]) -> Optional[_Token]: ...
class EndToken(TokenBase):
lbp: int = ...
@@ -34,14 +35,9 @@ class IfParser:
tokens: Any = ...
pos: int = ...
current_token: Any = ...
def __init__(
self,
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 __init__(self, tokens: List[Optional[_Token]]) -> None: ...
def translate_token(self, token: Optional[_Token]) -> Literal: ...
def next_token(self) -> Literal: ...
def parse(self) -> TemplateLiteral: ...
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
from collections import OrderedDict
from typing import Any, Dict, List, Tuple, Union
from typing import Any, Dict, List, Tuple
from django.core.exceptions import ImproperlyConfigured
from django.template.backends.base import BaseEngine
@@ -9,8 +8,7 @@ class InvalidTemplateEngineError(ImproperlyConfigured): ...
class EngineHandler:
templates: collections.OrderedDict
def __init__(self, templates: List[Dict[str, Union[Dict[str, bool], str]]] = ...) -> None: ...
def templates(self) -> OrderedDict: ...
def __init__(self, templates: List[Dict[str, Any]] = ...) -> None: ...
def __getitem__(self, alias: str) -> BaseEngine: ...
def __iter__(self) -> Any: ...
def all(self) -> List[BaseEngine]: ...

View File

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

View File

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

View File

@@ -7,8 +7,8 @@ from django.template.context import Context
register: Any
class PrefixNode(template.Node):
origin: django.template.base.Origin
token: django.template.base.Token
origin: Origin
token: Token
varname: Optional[str] = ...
name: str = ...
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: ...
class StaticNode(template.Node):
origin: django.template.base.Origin
token: django.template.base.Token
path: django.template.base.FilterExpression = ...
origin: Origin
token: Token
path: FilterExpression = ...
varname: Optional[str] = ...
def __init__(self, varname: Optional[str] = ..., path: FilterExpression = ...) -> None: ...
def url(self, context: Context) -> str: ...

View File

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

View File

@@ -6,3 +6,5 @@ from .testcases import (
)
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.serializers.json import DjangoJSONEncoder
from django.http.cookie import SimpleCookie
from django.http.response import HttpResponse, HttpResponseBase
from django.http.response import HttpResponseBase
class RedirectCycleError(Exception):
last_response: HttpResponseBase = ...
@@ -79,31 +79,6 @@ class Client(RequestFactory):
def store_exc_info(self, **kwargs: Any) -> None: ...
@property
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 force_login(self, user: User, backend: Optional[str] = ...) -> None: ...
cookies: SimpleCookie = ...

View File

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

View File

@@ -1,9 +1,7 @@
import threading
import unittest
from contextlib import _GeneratorContextManager
from datetime import date
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.handlers.wsgi import WSGIHandler
@@ -62,9 +60,9 @@ class SimpleTestCase(unittest.TestCase):
def setUpClass(cls) -> None: ...
@classmethod
def tearDownClass(cls) -> None: ...
def __call__(self, result: TextTestResult = ...) -> None: ...
def settings(self, **kwargs: Any) -> override_settings: ...
def modify_settings(self, **kwargs: Any) -> modify_settings: ...
def __call__(self, result: unittest.TestResult = ...) -> None: ...
def settings(self, **kwargs: Any) -> Any: ...
def modify_settings(self, **kwargs: Any) -> Any: ...
def assertRedirects(
self,
response: HttpResponse,
@@ -120,10 +118,10 @@ class SimpleTestCase(unittest.TestCase):
) -> Optional[_AssertTemplateNotUsedContext]: ...
def assertRaisesMessage(
self, expected_exception: Type[Exception], expected_message: str, *args: Any, **kwargs: Any
) -> Optional[_GeneratorContextManager]: ...
) -> Any: ...
def assertWarnsMessage(
self, expected_warning: Type[Exception], expected_message: str, *args: Any, **kwargs: Any
) -> _GeneratorContextManager: ...
) -> Any: ...
def assertFieldOutput(
self,
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.testcases import SimpleTestCase
from django.conf import LazySettings
from django.conf import LazySettings, Settings
_TestClass = Type[SimpleTestCase]
_DecoratedTest = Union[Callable, _TestClass]
class Approximate:
val: Union[decimal.Decimal, float] = ...
places: int = ...
def __init__(self, val: Union[Decimal, float], places: int = ...) -> None: ...
def __eq__(self, other: Union[Decimal, float]) -> bool: ...
class ContextList(list):
def __getitem__(self, key: Union[int, str]) -> Any: ...
def get(self, key: str, default: Optional[str] = ...) -> str: ...
def __contains__(self, key: str) -> bool: ...
def keys(self) -> Set[str]: ...
class _TestState: ...
@@ -29,53 +29,38 @@ def teardown_test_environment() -> None: ...
def get_runner(settings: LazySettings, test_runner_class: Optional[str] = ...) -> Type[DiscoverRunner]: ...
class TestContextDecorator:
attr_name: Any = ...
kwarg_name: Any = ...
attr_name: Optional[str] = ...
kwarg_name: Optional[str] = ...
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 __enter__(self) -> Optional[Apps]: ...
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 __call__(
self, decorated: Union[Callable, Type[Union[SimpleTestCase, LoggingCaptureMixin]]]
) -> Union[Callable, Type[Union[SimpleTestCase, LoggingCaptureMixin]]]: ...
def __call__(self, decorated: _DecoratedTest) -> _DecoratedTest: ...
class override_settings(TestContextDecorator):
attr_name: None
kwarg_name: None
options: Dict[str, Any] = ...
def __init__(self, **kwargs: Any) -> None: ...
wrapped: Settings = ...
def enable(self) -> None: ...
def disable(self) -> None: ...
def save_options(self, test_func: Type[Union[SimpleTestCase, LoggingCaptureMixin]]) -> None: ...
def decorate_class(
self, cls: Type[Union[SimpleTestCase, LoggingCaptureMixin]]
) -> Type[Union[SimpleTestCase, LoggingCaptureMixin]]: ...
def save_options(self, test_func: _DecoratedTest) -> None: ...
def decorate_class(self, cls: type) -> type: ...
class modify_settings(override_settings):
attr_name: None
kwarg_name: None
wrapped: Settings
operations: List[Tuple[str, Dict[str, Union[List[str], str]]]] = ...
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]]] = ...
def enable(self) -> None: ...
class override_system_checks(TestContextDecorator):
attr_name: None
kwarg_name: None
registry: CheckRegistry = ...
new_checks: List[Callable] = ...
deployment_checks: Optional[List[Callable]] = ...
def __init__(self, new_checks: List[Callable], deployment_checks: Optional[List[Callable]] = ...) -> None: ...
old_checks: Set[Callable] = ...
old_deployment_checks: Set[Callable] = ...
def enable(self) -> None: ...
def disable(self) -> None: ...
class CaptureQueriesContext:
connection: Any = ...
@@ -92,27 +77,19 @@ class CaptureQueriesContext:
def __exit__(self, exc_type: None, exc_value: None, traceback: None) -> None: ...
class ignore_warnings(TestContextDecorator):
attr_name: None
kwarg_name: None
ignore_kwargs: Dict[str, Any] = ...
filter_func: Callable = ...
def __init__(self, **kwargs: Any) -> None: ...
catch_warnings: warnings.catch_warnings = ...
def enable(self) -> None: ...
def disable(self) -> None: ...
requires_tz_support: Any
def isolate_lru_cache(lru_cache_object: Callable) -> Iterator[None]: ...
class override_script_prefix(TestContextDecorator):
attr_name: None
kwarg_name: None
prefix: str = ...
def __init__(self, prefix: str) -> None: ...
old_prefix: str = ...
def enable(self) -> None: ...
def disable(self) -> None: ...
class LoggingCaptureMixin:
logger: Any = ...
@@ -122,10 +99,6 @@ class LoggingCaptureMixin:
def tearDown(self) -> None: ...
class isolate_apps(TestContextDecorator):
attr_name: Optional[str]
kwarg_name: Optional[str]
installed_apps: Tuple[str] = ...
def __init__(self, *installed_apps: Any, **kwargs: Any) -> None: ...
old_apps: Apps = ...
def enable(self) -> Apps: ...
def disable(self) -> None: ...

View File

@@ -99,7 +99,5 @@ class URLResolver:
@property
def app_dict(self) -> Dict[str, List[str]]: ...
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 reverse(self, lookup_view: str, *args: Any, **kwargs: Any) -> str: ...

View File

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

View File

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