reformat with black

This commit is contained in:
Maxim Kurnikov
2018-07-29 23:34:58 +03:00
parent 4866354600
commit cf85607969
343 changed files with 6054 additions and 2158 deletions
+28 -6
View File
@@ -9,9 +9,15 @@ from django.forms.forms import Form
from django.forms.models import ModelForm
from django.forms.renderers import DjangoTemplates
from django.forms.utils import ErrorList
from django.forms.widgets import ChoiceWidget, HiddenInput, SplitHiddenDateTimeWidget, Widget
from django.forms.widgets import (
ChoiceWidget,
HiddenInput,
SplitHiddenDateTimeWidget,
Widget,
)
from django.utils.safestring import SafeText
from typing import Any, Dict, List, Optional, Union
class BoundField:
form: Any = ...
field: Any = ...
@@ -27,17 +33,29 @@ class BoundField:
def __bool__(self): ...
def __iter__(self): ...
def __len__(self) -> int: ...
def __getitem__(self, idx: Union[slice, str, int]) -> Union[List[BoundWidget], BoundWidget]: ...
def __getitem__(
self, idx: Union[slice, str, int]
) -> Union[List[BoundWidget], BoundWidget]: ...
@property
def errors(self) -> ErrorList: ...
def as_widget(self, widget: Optional[Union[HiddenInput, SplitHiddenDateTimeWidget]] = ..., attrs: None = ..., only_initial: bool = ...) -> SafeText: ...
def as_widget(
self,
widget: Optional[Union[HiddenInput, SplitHiddenDateTimeWidget]] = ...,
attrs: None = ...,
only_initial: bool = ...,
) -> SafeText: ...
def as_text(self, attrs: None = ..., **kwargs: Any) -> SafeText: ...
def as_textarea(self, attrs: None = ..., **kwargs: Any) -> SafeText: ...
def as_hidden(self, attrs: None = ..., **kwargs: Any) -> SafeText: ...
@property
def data(self) -> Any: ...
def value(self) -> Any: ...
def label_tag(self, contents: Optional[SafeText] = ..., attrs: Optional[Dict[str, str]] = ..., label_suffix: Optional[str] = ...) -> SafeText: ...
def label_tag(
self,
contents: Optional[SafeText] = ...,
attrs: Optional[Dict[str, str]] = ...,
label_suffix: Optional[str] = ...,
) -> SafeText: ...
def css_classes(self, extra_classes: None = ...) -> str: ...
@property
def is_hidden(self) -> bool: ...
@@ -46,13 +64,17 @@ class BoundField:
@property
def id_for_label(self): ...
def initial(self) -> Any: ...
def build_widget_attrs(self, attrs: Dict[str, str], widget: Optional[Widget] = ...) -> Dict[str, Union[bool, str]]: ...
def build_widget_attrs(
self, attrs: Dict[str, str], widget: Optional[Widget] = ...
) -> Dict[str, Union[bool, str]]: ...
class BoundWidget:
parent_widget: Any = ...
data: Any = ...
renderer: Any = ...
def __init__(self, parent_widget: ChoiceWidget, data: Dict[str, Any], renderer: DjangoTemplates) -> None: ...
def __init__(
self, parent_widget: ChoiceWidget, data: Dict[str, Any], renderer: DjangoTemplates
) -> None: ...
def __str__(self): ...
def tag(self, wrap_label: bool = ...) -> SafeText: ...
@property
+113 -19
View File
@@ -13,6 +13,7 @@ from django.forms.forms import Form
from django.forms.models import ModelForm
from django.forms.widgets import ClearableFileInput, Input, Textarea, Widget
from typing import Any, Callable, Dict, List, Optional, Tuple, Union
class Field:
widget: Any = ...
hidden_widget: Any = ...
@@ -26,16 +27,34 @@ class Field:
localize: Any = ...
error_messages: Any = ...
validators: Any = ...
def __init__(self, *, required: bool = ..., widget: Optional[Any] = ..., label: Optional[Any] = ..., initial: Optional[Any] = ..., help_text: str = ..., error_messages: Optional[Any] = ..., show_hidden_initial: bool = ..., validators: Any = ..., localize: bool = ..., disabled: bool = ..., label_suffix: Optional[Any] = ...) -> None: ...
def __init__(
self,
*,
required: bool = ...,
widget: Optional[Any] = ...,
label: Optional[Any] = ...,
initial: Optional[Any] = ...,
help_text: str = ...,
error_messages: Optional[Any] = ...,
show_hidden_initial: bool = ...,
validators: Any = ...,
localize: bool = ...,
disabled: bool = ...,
label_suffix: Optional[Any] = ...,
) -> None: ...
def prepare_value(self, value: Any) -> Any: ...
def to_python(self, value: Any) -> 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: Optional[Union[str, float, datetime]]) -> Any: ...
def bound_data(
self, data: Any, initial: Optional[Union[str, float, datetime]]
) -> Any: ...
def widget_attrs(self, widget: Widget) -> Dict[Any, Any]: ...
def has_changed(self, initial: Any, data: Optional[str]) -> bool: ...
def get_bound_field(self, form: Union[Form, ModelForm], field_name: str) -> BoundField: ...
def get_bound_field(
self, form: Union[Form, ModelForm], field_name: str
) -> BoundField: ...
def __deepcopy__(self, memo: Dict[int, Any]) -> Field: ...
class CharField(Field):
@@ -43,7 +62,15 @@ class CharField(Field):
min_length: Any = ...
strip: Any = ...
empty_value: Any = ...
def __init__(self, *, max_length: Optional[Any] = ..., min_length: Optional[Any] = ..., strip: bool = ..., empty_value: str = ..., **kwargs: Any) -> None: ...
def __init__(
self,
*,
max_length: Optional[Any] = ...,
min_length: Optional[Any] = ...,
strip: bool = ...,
empty_value: str = ...,
**kwargs: Any,
) -> None: ...
def to_python(self, value: Optional[Union[int, str, Tuple]]) -> Optional[str]: ...
def widget_attrs(self, widget: Union[Textarea, Input]) -> Dict[str, str]: ...
@@ -51,7 +78,13 @@ class IntegerField(Field):
widget: Any = ...
default_error_messages: Any = ...
re_decimal: Any = ...
def __init__(self, *, max_value: Optional[Any] = ..., min_value: Optional[Any] = ..., **kwargs: Any) -> None: ...
def __init__(
self,
*,
max_value: Optional[Any] = ...,
min_value: Optional[Any] = ...,
**kwargs: Any,
) -> None: ...
def to_python(self, value: Optional[Union[str, float]]) -> Optional[int]: ...
def widget_attrs(self, widget: Input) -> Dict[str, Union[int, Decimal]]: ...
@@ -63,7 +96,15 @@ class FloatField(IntegerField):
class DecimalField(IntegerField):
default_error_messages: Any = ...
def __init__(self, *, max_value: Optional[Any] = ..., min_value: Optional[Any] = ..., max_digits: Optional[Any] = ..., decimal_places: Optional[Any] = ..., **kwargs: Any) -> None: ...
def __init__(
self,
*,
max_value: Optional[Any] = ...,
min_value: Optional[Any] = ...,
max_digits: Optional[Any] = ...,
decimal_places: Optional[Any] = ...,
**kwargs: Any,
) -> None: ...
def to_python(self, value: Optional[Union[str, float]]) -> Optional[Decimal]: ...
def validate(self, value: Decimal) -> None: ...
def widget_attrs(self, widget: Widget) -> Dict[str, str]: ...
@@ -119,10 +160,24 @@ class FileField(Field):
default_error_messages: Any = ...
max_length: Any = ...
allow_empty_file: Any = ...
def __init__(self, *, max_length: Optional[Any] = ..., allow_empty_file: bool = ..., **kwargs: Any) -> None: ...
def to_python(self, data: Optional[Union[str, SimpleUploadedFile]]) -> Optional[SimpleUploadedFile]: ...
def clean(self, data: Optional[Union[bool, str, SimpleUploadedFile]], initial: Optional[Union[str, FieldFile]] = ...) -> Any: ...
def bound_data(self, data: Union[str, SimpleUploadedFile], initial: None) -> Union[str, SimpleUploadedFile]: ...
def __init__(
self,
*,
max_length: Optional[Any] = ...,
allow_empty_file: bool = ...,
**kwargs: Any,
) -> None: ...
def to_python(
self, data: Optional[Union[str, SimpleUploadedFile]]
) -> Optional[SimpleUploadedFile]: ...
def clean(
self,
data: Optional[Union[bool, str, SimpleUploadedFile]],
initial: Optional[Union[str, FieldFile]] = ...,
) -> Any: ...
def bound_data(
self, data: Union[str, SimpleUploadedFile], initial: None
) -> Union[str, SimpleUploadedFile]: ...
def has_changed(self, initial: Union[str, FieldFile], data: Optional[str]) -> bool: ...
class ImageField(FileField):
@@ -142,7 +197,9 @@ class BooleanField(Field):
widget: Any = ...
def to_python(self, value: Optional[Union[str, int]]) -> bool: ...
def validate(self, value: bool) -> None: ...
def has_changed(self, initial: Optional[bool], data: Optional[Union[bool, str]]) -> bool: ...
def has_changed(
self, initial: Optional[bool], data: Optional[Union[bool, str]]
) -> bool: ...
class NullBooleanField(BooleanField):
widget: Any = ...
@@ -170,7 +227,9 @@ class ChoiceField(Field):
class TypedChoiceField(ChoiceField):
coerce: Any = ...
empty_value: Any = ...
def __init__(self, *, coerce: Any = ..., empty_value: str = ..., **kwargs: Any) -> None: ...
def __init__(
self, *, coerce: Any = ..., empty_value: str = ..., **kwargs: Any
) -> None: ...
def _coerce(self, value: Optional[Union[str, int]]) -> Optional[Union[str, int]]: ...
def clean(self, value: Optional[str]) -> Optional[Union[str, int]]: ...
@@ -180,7 +239,9 @@ class MultipleChoiceField(ChoiceField):
default_error_messages: Any = ...
def to_python(self, value: Optional[Union[str, List[str], Tuple]]) -> List[str]: ...
def validate(self, value: List[str]) -> None: ...
def has_changed(self, initial: Optional[Union[str, List[int]]], data: Union[str, List[str]]) -> bool: ...
def has_changed(
self, initial: Optional[Union[str, List[int]]], data: Union[str, List[str]]
) -> bool: ...
class TypedMultipleChoiceField(MultipleChoiceField):
coerce: Any = ...
@@ -199,29 +260,62 @@ class MultiValueField(Field):
default_error_messages: Any = ...
require_all_fields: Any = ...
fields: Any = ...
def __init__(self, fields: Union[Tuple[CharField, MultipleChoiceField, SplitDateTimeField], Tuple[DateField, TimeField], Tuple[CharField, CharField]], *, require_all_fields: bool = ..., **kwargs: Any) -> None: ...
def __init__(
self,
fields: Union[
Tuple[CharField, MultipleChoiceField, SplitDateTimeField],
Tuple[DateField, TimeField],
Tuple[CharField, CharField],
],
*,
require_all_fields: bool = ...,
**kwargs: Any,
) -> None: ...
def __deepcopy__(self, memo: Dict[int, Any]) -> MultiValueField: ...
def validate(self, value: Union[str, datetime]) -> None: ...
def clean(self, value: Union[str, List[str], List[Union[str, List[str]]]]) -> Optional[Union[str, datetime]]: ...
def clean(
self, value: Union[str, List[str], List[Union[str, List[str]]]]
) -> Optional[Union[str, datetime]]: ...
def compress(self, data_list: Any) -> None: ...
def has_changed(self, initial: Optional[Union[datetime, List[None], List[str]]], data: Union[List[None], List[str]]) -> bool: ...
def has_changed(
self,
initial: Optional[Union[datetime, List[None], List[str]]],
data: Union[List[None], List[str]],
) -> bool: ...
class FilePathField(ChoiceField):
choices: Any = ...
match_re: Any = ...
def __init__(self, path: str, *, match: Optional[Any] = ..., recursive: bool = ..., allow_files: bool = ..., allow_folders: bool = ..., **kwargs: Any) -> None: ...
def __init__(
self,
path: str,
*,
match: Optional[Any] = ...,
recursive: bool = ...,
allow_files: bool = ...,
allow_folders: bool = ...,
**kwargs: Any,
) -> None: ...
class SplitDateTimeField(MultiValueField):
widget: Any = ...
hidden_widget: Any = ...
default_error_messages: Any = ...
def __init__(self, *, input_date_formats: Optional[Any] = ..., input_time_formats: Optional[Any] = ..., **kwargs: Any) -> None: ...
def __init__(
self,
*,
input_date_formats: Optional[Any] = ...,
input_time_formats: Optional[Any] = ...,
**kwargs: Any,
) -> None: ...
def compress(self, data_list: List[Union[date, time]]) -> Optional[datetime]: ...
class GenericIPAddressField(CharField):
unpack_ipv4: Any = ...
default_validators: Any = ...
def __init__(self, *, protocol: str = ..., unpack_ipv4: bool = ..., **kwargs: Any) -> None: ...
def __init__(
self, *, protocol: str = ..., unpack_ipv4: bool = ..., **kwargs: Any
) -> None: ...
def to_python(self, value: str) -> str: ...
class SlugField(CharField):
+26 -3
View File
@@ -12,6 +12,7 @@ from django.forms.utils import ErrorDict, ErrorList
from django.utils.datastructures import MultiValueDict
from django.utils.safestring import SafeText
from typing import Any, Dict, Iterator, List, Optional, Type, Union
class DeclarativeFieldsMetaclass(MediaDefiningClass):
def __new__(mcs: Any, name: Any, bases: Any, attrs: Any): ...
@classmethod
@@ -34,7 +35,20 @@ class BaseForm:
fields: Any = ...
_bound_fields_cache: Any = ...
renderer: Any = ...
def __init__(self, data: Any = ..., files: Optional[Union[MultiValueDict, Dict[str, SimpleUploadedFile]]] = ..., auto_id: Optional[Union[str, bool]] = ..., prefix: Optional[str] = ..., initial: Any = ..., error_class: Type[ErrorList] = ..., label_suffix: None = ..., empty_permitted: bool = ..., field_order: None = ..., use_required_attribute: Optional[bool] = ..., renderer: object = ...) -> None: ...
def __init__(
self,
data: Any = ...,
files: Optional[Union[MultiValueDict, Dict[str, SimpleUploadedFile]]] = ...,
auto_id: Optional[Union[str, bool]] = ...,
prefix: Optional[str] = ...,
initial: Any = ...,
error_class: Type[ErrorList] = ...,
label_suffix: None = ...,
empty_permitted: bool = ...,
field_order: None = ...,
use_required_attribute: Optional[bool] = ...,
renderer: object = ...,
) -> None: ...
def order_fields(self, field_order: Any): ...
def __str__(self): ...
def __repr__(self) -> str: ...
@@ -45,12 +59,21 @@ class BaseForm:
def is_valid(self): ...
def add_prefix(self, field_name: str) -> str: ...
def add_initial_prefix(self, field_name: str) -> str: ...
def _html_output(self, normal_row: str, error_row: str, row_ender: str, help_text_html: str, errors_on_separate_row: bool) -> SafeText: ...
def _html_output(
self,
normal_row: str,
error_row: str,
row_ender: str,
help_text_html: str,
errors_on_separate_row: bool,
) -> SafeText: ...
def as_table(self) -> SafeText: ...
def as_ul(self) -> SafeText: ...
def as_p(self) -> SafeText: ...
def non_field_errors(self): ...
def add_error(self, field: Optional[str], error: Union[str, ValidationError]) -> None: ...
def add_error(
self, field: Optional[str], error: Union[str, ValidationError]
) -> None: ...
def has_error(self, field: Any, code: Optional[Any] = ...): ...
cleaned_data: Any = ...
def full_clean(self) -> None: ...
+2 -7
View File
@@ -1,11 +1,6 @@
from typing import (
Any,
List,
)
from typing import Any, List
def all_valid(formsets: List[Any]) -> bool: ...
class ManagementForm:
def __init__(self, *args, **kwargs) -> None: ...
def __init__(self, *args, **kwargs) -> None: ...
+139 -50
View File
@@ -1,8 +1,5 @@
from collections import OrderedDict
from django.contrib.auth.forms import (
UserChangeForm,
UserCreationForm,
)
from django.contrib.auth.forms import UserChangeForm, UserCreationForm
from django.core.exceptions import ValidationError
from django.core.files.uploadedfile import SimpleUploadedFile
from django.db.models.base import Model
@@ -11,30 +8,17 @@ from django.db.models.manager import Manager
from django.db.models.query import QuerySet
from django.forms.fields import Field
from django.forms.utils import ErrorList
from typing import (
Any,
Dict,
Iterator,
List,
Optional,
Tuple,
Type,
Union,
)
from typing import Any, Dict, Iterator, List, Optional, Tuple, Type, Union
from uuid import UUID
def _get_foreign_key(
parent_model: Type[Model],
model: Type[Model],
fk_name: Optional[str] = ...,
can_fail: bool = ...
can_fail: bool = ...,
) -> ForeignKey: ...
def apply_limit_choices_to_to_formfield(formfield: Field) -> None: ...
class BaseModelForm:
def __init__(
self,
@@ -48,7 +32,7 @@ class BaseModelForm:
empty_permitted: bool = ...,
instance: Optional[Model] = ...,
use_required_attribute: None = ...,
renderer: None = ...
renderer: None = ...,
) -> None: ...
def _get_validation_exclusions(self) -> List[str]: ...
def _post_clean(self) -> None: ...
@@ -58,19 +42,14 @@ class BaseModelForm:
def save(self, commit: bool = ...) -> Model: ...
def validate_unique(self) -> None: ...
class InlineForeignKeyField:
def __init__(
self,
parent_instance: Model,
*args,
pk_field = ...,
to_field = ...,
**kwargs
self, parent_instance: Model, *args, pk_field=..., to_field=..., **kwargs
) -> None: ...
def clean(self, value: Optional[Union[str, int]]) -> Model: ...
def has_changed(self, initial: Optional[Union[str, int]], data: Optional[Union[str, int]]) -> bool: ...
def has_changed(
self, initial: Optional[Union[str, int]], data: Optional[Union[str, int]]
) -> bool: ...
class ModelChoiceField:
def __deepcopy__(self, memo: Dict[int, Any]) -> ModelChoiceField: ...
@@ -78,27 +57,30 @@ class ModelChoiceField:
self,
queryset: QuerySet,
*,
empty_label = ...,
required = ...,
widget = ...,
label = ...,
initial = ...,
help_text = ...,
to_field_name = ...,
limit_choices_to = ...,
**kwargs
empty_label=...,
required=...,
widget=...,
label=...,
initial=...,
help_text=...,
to_field_name=...,
limit_choices_to=...,
**kwargs,
) -> None: ...
def _get_choices(self) -> ModelChoiceIterator: ...
def _get_queryset(self) -> QuerySet: ...
def _set_queryset(self, queryset: Union[QuerySet, Manager]) -> None: ...
def get_limit_choices_to(self) -> Any: ...
def has_changed(self, initial: Optional[Union[UUID, int]], data: Optional[Union[str, int]]) -> bool: ...
def has_changed(
self, initial: Optional[Union[UUID, int]], data: Optional[Union[str, int]]
) -> bool: ...
def label_from_instance(self, obj: Model) -> str: ...
def prepare_value(self, value: Any) -> Optional[Union[str, UUID, int]]: ...
def to_python(self, value: Optional[Union[str, List[List[str]], int]]) -> Optional[Model]: ...
def to_python(
self, value: Optional[Union[str, List[List[str]], int]]
) -> Optional[Model]: ...
def validate(self, value: Optional[Model]) -> None: ...
class ModelChoiceIterator:
def __bool__(self) -> bool: ...
def __init__(self, field: ModelChoiceField) -> None: ...
@@ -106,34 +88,141 @@ class ModelChoiceIterator:
def __len__(self) -> int: ...
def choice(self, obj: Model) -> Tuple[int, str]: ...
class ModelFormMetaclass:
@staticmethod
def __new__(
mcs: Type[ModelFormMetaclass],
name: str,
bases: Tuple[Type[ModelForm]],
attrs: OrderedDict
attrs: OrderedDict,
) -> Type[ModelForm]: ...
class ModelFormOptions:
def __init__(
self,
options: Optional[Union[Type[object], Type[UserChangeForm.Meta], Type[UserCreationForm.Meta]]] = ...
options: Optional[
Union[Type[object], Type[UserChangeForm.Meta], Type[UserCreationForm.Meta]]
] = ...,
) -> None: ...
class ModelMultipleChoiceField:
def __init__(self, queryset: QuerySet, **kwargs) -> None: ...
def _check_values(
self,
value: Union[List[int], Tuple[int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int], List[str]]
value: Union[
List[int],
Tuple[
int,
int,
int,
int,
int,
int,
int,
int,
int,
int,
int,
int,
int,
int,
int,
int,
int,
int,
int,
int,
int,
int,
int,
int,
int,
int,
int,
int,
int,
int,
int,
int,
int,
int,
int,
int,
int,
int,
int,
int,
int,
int,
int,
int,
int,
int,
int,
int,
int,
int,
],
List[str],
],
) -> QuerySet: ...
def clean(
self, value: Union[List[List[str]], List[int], str, List[str]]
) -> QuerySet: ...
def clean(self, value: Union[List[List[str]], List[int], str, List[str]]) -> QuerySet: ...
def has_changed(self, initial: List[Model], data: List[str]) -> bool: ...
def prepare_value(self, value: Any) -> Any: ...
def to_python(
self,
value: Tuple[int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int]
) -> List[Model]: ...
value: Tuple[
int,
int,
int,
int,
int,
int,
int,
int,
int,
int,
int,
int,
int,
int,
int,
int,
int,
int,
int,
int,
int,
int,
int,
int,
int,
int,
int,
int,
int,
int,
int,
int,
int,
int,
int,
int,
int,
int,
int,
int,
int,
int,
int,
int,
int,
int,
int,
int,
int,
int,
],
) -> List[Model]: ...
+4 -1
View File
@@ -6,13 +6,16 @@ from typing import Any, Optional
from django.template.backends.django import DjangoTemplates, Template
from typing import Any, Dict
ROOT: Any
def get_default_renderer() -> DjangoTemplates: ...
class BaseRenderer:
def get_template(self, template_name: Any) -> None: ...
def render(self, template_name: str, context: Dict[str, Any], request: None = ...) -> str: ...
def render(
self, template_name: str, context: Dict[str, Any], request: None = ...
) -> str: ...
class EngineMixin:
def get_template(self, template_name: str) -> Template: ...
+15 -2
View File
@@ -9,6 +9,7 @@ from datetime import datetime
from django.core.exceptions import ValidationError
from django.utils.safestring import SafeText
from typing import Callable, Dict, List, Optional, Tuple, Type, Union
def pretty_name(name: str) -> str: ...
def flatatt(attrs: Dict[str, Optional[str]]) -> SafeText: ...
@@ -22,7 +23,11 @@ class ErrorDict(dict):
class ErrorList(UserList, list):
error_class: str = ...
def __init__(self, initlist: Optional[Union[ErrorList, List[str], List[ValidationError]]] = ..., error_class: Optional[str] = ...) -> None: ...
def __init__(
self,
initlist: Optional[Union[ErrorList, List[str], List[ValidationError]]] = ...,
error_class: Optional[str] = ...,
) -> None: ...
def as_data(self) -> List[ValidationError]: ...
def get_json_data(self, escape_html: bool = ...) -> List[Dict[str, str]]: ...
def as_json(self, escape_html: bool = ...): ...
@@ -33,7 +38,15 @@ class ErrorList(UserList, list):
def __contains__(self, item: str) -> bool: ...
def __eq__(self, other: Union[ErrorList, List[str]]) -> bool: ...
def __getitem__(self, i: Union[str, int]) -> str: ...
def __reduce_ex__(self, *args: Any, **kwargs: Any) -> Tuple[Callable, Tuple[Type[ErrorList]], Dict[str, Union[List[ValidationError], str]], None, None]: ...
def __reduce_ex__(
self, *args: Any, **kwargs: Any
) -> Tuple[
Callable,
Tuple[Type[ErrorList]],
Dict[str, Union[List[ValidationError], str]],
None,
None,
]: ...
def from_current_timezone(value: datetime) -> datetime: ...
def to_current_timezone(value: datetime) -> datetime: ...
+248 -48
View File
@@ -13,12 +13,20 @@ from django.utils.datastructures import MultiValueDict
from django.utils.safestring import SafeText
from itertools import chain
from typing import Any, Callable, Dict, Iterator, List, Optional, Set, Tuple, Type, Union
class MediaOrderConflictWarning(RuntimeWarning): ...
class Media:
_css: Any = ...
_js: Any = ...
def __init__(self, media: Optional[Type[object]] = ..., css: Optional[Union[Dict[str, Tuple[str, str]], Dict[str, List[str]], Dict[str, Tuple[str]]]] = ..., js: Any = ...) -> None: ...
def __init__(
self,
media: Optional[Type[object]] = ...,
css: Optional[
Union[Dict[str, Tuple[str, str]], Dict[str, List[str]], Dict[str, Tuple[str]]]
] = ...,
js: Any = ...,
) -> None: ...
def __repr__(self) -> str: ...
def __str__(self): ...
def render(self) -> SafeText: ...
@@ -27,11 +35,15 @@ class Media:
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: Any) -> Union[List[int], List[str]]: ...
def merge(
list_1: Union[List[int], List[str], Tuple[str]], list_2: Any
) -> Union[List[int], List[str]]: ...
def __add__(self, other: Media) -> Media: ...
class MediaDefiningClass(type):
def __new__(mcs: Type[MediaDefiningClass], name: str, bases: Tuple, attrs: Any) -> Type[Any]: ...
def __new__(
mcs: Type[MediaDefiningClass], name: str, bases: Tuple, attrs: Any
) -> Type[Any]: ...
class Widget:
needs_multipart_form: bool = ...
@@ -45,10 +57,34 @@ class Widget:
def is_hidden(self): ...
def subwidgets(self, name: Any, value: Any, attrs: Optional[Any] = ...) -> None: ...
def format_value(self, value: Any) -> Optional[str]: ...
def get_context(self, name: str, value: Any, attrs: Optional[Union[Dict[str, Union[bool, str]], Dict[str, bool], Dict[str, str]]]) -> Dict[str, Dict[str, Any]]: ...
def render(self, name: Any, value: Any, attrs: Optional[Any] = ..., renderer: Optional[Any] = ...): ...
def _render(self, template_name: str, context: Dict[str, Any], renderer: Optional[DjangoTemplates] = ...) -> SafeText: ...
def build_attrs(self, base_attrs: Dict[str, Union[float, str]], extra_attrs: Optional[Union[Dict[str, Union[bool, str]], Dict[str, bool], Dict[str, str]]] = ...) -> Dict[str, Union[float, str]]: ...
def get_context(
self,
name: str,
value: Any,
attrs: Optional[
Union[Dict[str, Union[bool, str]], Dict[str, bool], Dict[str, str]]
],
) -> Dict[str, Dict[str, Any]]: ...
def render(
self,
name: Any,
value: Any,
attrs: Optional[Any] = ...,
renderer: Optional[Any] = ...,
): ...
def _render(
self,
template_name: str,
context: Dict[str, Any],
renderer: Optional[DjangoTemplates] = ...,
) -> SafeText: ...
def build_attrs(
self,
base_attrs: Dict[str, Union[float, str]],
extra_attrs: Optional[
Union[Dict[str, Union[bool, str]], Dict[str, bool], Dict[str, str]]
] = ...,
) -> Dict[str, Union[float, str]]: ...
def value_from_datadict(self, data: Any, files: Any, name: Any): ...
def value_omitted_from_data(self, data: Any, files: Any, name: Any): ...
def id_for_label(self, id_: Any): ...
@@ -57,8 +93,17 @@ class Widget:
class Input(Widget):
input_type: Any = ...
template_name: str = ...
def __init__(self, attrs: Optional[Union[Dict[str, int], Dict[str, str], Dict[str, bool]]] = ...) -> None: ...
def get_context(self, name: str, value: Any, attrs: Optional[Union[Dict[str, Union[bool, str]], Dict[str, bool], Dict[str, str]]]) -> Dict[str, Dict[str, Any]]: ...
def __init__(
self, attrs: Optional[Union[Dict[str, int], Dict[str, str], Dict[str, bool]]] = ...
) -> None: ...
def get_context(
self,
name: str,
value: Any,
attrs: Optional[
Union[Dict[str, Union[bool, str]], Dict[str, bool], Dict[str, str]]
],
) -> Dict[str, Dict[str, Any]]: ...
class TextInput(Input):
input_type: str = ...
@@ -80,8 +125,15 @@ class PasswordInput(Input):
input_type: str = ...
template_name: str = ...
render_value: Any = ...
def __init__(self, attrs: Optional[Dict[str, bool]] = ..., render_value: bool = ...) -> None: ...
def get_context(self, name: str, value: Optional[str], attrs: Optional[Union[Dict[str, Union[str, bool]], Dict[str, bool]]]) -> Dict[str, Dict[str, Any]]: ...
def __init__(
self, attrs: Optional[Dict[str, bool]] = ..., render_value: bool = ...
) -> None: ...
def get_context(
self,
name: str,
value: Optional[str],
attrs: Optional[Union[Dict[str, Union[str, bool]], Dict[str, bool]]],
) -> Dict[str, Dict[str, Any]]: ...
class HiddenInput(Input):
input_type: str = ...
@@ -89,17 +141,33 @@ class HiddenInput(Input):
class MultipleHiddenInput(HiddenInput):
template_name: str = ...
def get_context(self, name: str, value: List[str], attrs: Optional[Dict[str, str]]) -> Dict[str, Dict[str, Any]]: ...
def value_from_datadict(self, data: MultiValueDict, files: Dict[Any, Any], name: str) -> List[str]: ...
def format_value(self, value: Union[List[int], List[str]]) -> Union[List[int], List[str]]: ...
def get_context(
self, name: str, value: List[str], attrs: Optional[Dict[str, str]]
) -> Dict[str, Dict[str, Any]]: ...
def value_from_datadict(
self, data: MultiValueDict, files: Dict[Any, Any], name: str
) -> List[str]: ...
def format_value(
self, value: Union[List[int], List[str]]
) -> Union[List[int], List[str]]: ...
class FileInput(Input):
input_type: str = ...
needs_multipart_form: bool = ...
template_name: str = ...
def format_value(self, value: None) -> None: ...
def value_from_datadict(self, data: Union[Dict[str, str], Dict[str, bool], QueryDict], files: Dict[str, SimpleUploadedFile], name: str) -> Optional[SimpleUploadedFile]: ...
def value_omitted_from_data(self, data: Dict[Any, Any], files: Dict[str, Union[SimpleUploadedFile, str]], name: str) -> bool: ...
def value_from_datadict(
self,
data: Union[Dict[str, str], Dict[str, bool], QueryDict],
files: Dict[str, SimpleUploadedFile],
name: str,
) -> Optional[SimpleUploadedFile]: ...
def value_omitted_from_data(
self,
data: Dict[Any, Any],
files: Dict[str, Union[SimpleUploadedFile, str]],
name: str,
) -> bool: ...
class ClearableFileInput(FileInput):
clear_checkbox_label: Any = ...
@@ -109,21 +177,34 @@ class ClearableFileInput(FileInput):
def clear_checkbox_name(self, name: str) -> str: ...
def clear_checkbox_id(self, name: str) -> str: ...
def is_initial(self, value: object) -> bool: ...
def format_value(self, value: Optional[Union[str, FieldFile]]) -> Optional[FieldFile]: ...
def format_value(
self, value: Optional[Union[str, FieldFile]]
) -> Optional[FieldFile]: ...
def get_context(self, name: Any, value: Any, attrs: Any): ...
def value_from_datadict(self, data: Union[Dict[str, bool], Dict[str, None], Dict[str, str], QueryDict], files: Dict[str, Union[SimpleUploadedFile, str]], name: str) -> Optional[Union[str, SimpleUploadedFile]]: ...
def value_from_datadict(
self,
data: Union[Dict[str, bool], Dict[str, None], Dict[str, str], QueryDict],
files: Dict[str, Union[SimpleUploadedFile, str]],
name: str,
) -> Optional[Union[str, SimpleUploadedFile]]: ...
def use_required_attribute(self, initial: Optional[FieldFile]) -> bool: ...
def value_omitted_from_data(self, data: Dict[str, str], files: Dict[Any, Any], name: str) -> bool: ...
def value_omitted_from_data(
self, data: Dict[str, str], files: Dict[Any, Any], name: str
) -> bool: ...
class Textarea(Widget):
template_name: str = ...
def __init__(self, attrs: Optional[Union[Dict[str, int], Dict[str, str]]] = ...) -> None: ...
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, str]] = ..., format: Optional[str] = ...) -> None: ...
def __init__(
self, attrs: Optional[Dict[str, str]] = ..., format: Optional[str] = ...
) -> None: ...
def format_value(self, value: Optional[Union[time, str, date]]) -> Optional[str]: ...
class DateInput(DateTimeBaseInput):
@@ -142,11 +223,35 @@ class CheckboxInput(Input):
input_type: str = ...
template_name: str = ...
check_test: Any = ...
def __init__(self, attrs: Optional[Dict[str, str]] = ..., check_test: Optional[Callable] = ...) -> None: ...
def __init__(
self, attrs: Optional[Dict[str, str]] = ..., check_test: Optional[Callable] = ...
) -> None: ...
def format_value(self, value: Optional[Union[str, int]]) -> Optional[str]: ...
def get_context(self, name: str, value: Optional[Union[int, str]], attrs: Optional[Union[Dict[str, Union[bool, str]], Dict[str, bool], Dict[str, str]]]) -> Dict[str, Dict[str, Any]]: ...
def value_from_datadict(self, data: Any, files: Union[MultiValueDict, Dict[str, SimpleUploadedFile]], name: str) -> bool: ...
def value_omitted_from_data(self, data: Union[Dict[str, Union[str, List[int]]], Dict[str, str], Dict[str, Union[int, str, None, datetime]], QueryDict], files: MultiValueDict, name: str) -> bool: ...
def get_context(
self,
name: str,
value: Optional[Union[int, str]],
attrs: Optional[
Union[Dict[str, Union[bool, str]], Dict[str, bool], Dict[str, str]]
],
) -> Dict[str, Dict[str, Any]]: ...
def value_from_datadict(
self,
data: Any,
files: Union[MultiValueDict, Dict[str, SimpleUploadedFile]],
name: str,
) -> bool: ...
def value_omitted_from_data(
self,
data: Union[
Dict[str, Union[str, List[int]]],
Dict[str, str],
Dict[str, Union[int, str, None, datetime]],
QueryDict,
],
files: MultiValueDict,
name: str,
) -> bool: ...
class ChoiceWidget(Widget):
allow_multiple_selected: bool = ...
@@ -157,15 +262,53 @@ class ChoiceWidget(Widget):
checked_attribute: Any = ...
option_inherits_attrs: bool = ...
choices: Any = ...
def __init__(self, attrs: Optional[Union[Dict[str, Union[bool, str]], Dict[str, str]]] = ..., choices: Any = ...) -> None: ...
def __init__(
self,
attrs: Optional[Union[Dict[str, Union[bool, str]], Dict[str, str]]] = ...,
choices: Any = ...,
) -> None: ...
def __deepcopy__(self, memo: Dict[int, 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[Union[Dict[str, Union[bool, str]], Dict[str, bool], Dict[str, str]]] = ...) -> Any: ...
def create_option(self, name: str, value: Union[str, time, int], label: Union[str, int], selected: Union[bool, Set[str]], index: int, subindex: Optional[int] = ..., attrs: Optional[Union[Dict[str, Union[bool, str]], Dict[str, bool], Dict[str, str]]] = ...) -> Dict[str, Any]: ...
def get_context(self, name: str, value: Any, attrs: Optional[Union[Dict[str, Union[bool, str]], Dict[str, bool], Dict[str, str]]]) -> Dict[str, Dict[str, Any]]: ...
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[
Union[Dict[str, Union[bool, str]], Dict[str, bool], Dict[str, str]]
] = ...,
) -> Any: ...
def create_option(
self,
name: str,
value: Union[str, time, int],
label: Union[str, int],
selected: Union[bool, Set[str]],
index: int,
subindex: Optional[int] = ...,
attrs: Optional[
Union[Dict[str, Union[bool, str]], Dict[str, bool], Dict[str, str]]
] = ...,
) -> Dict[str, Any]: ...
def get_context(
self,
name: str,
value: Any,
attrs: Optional[
Union[Dict[str, Union[bool, str]], Dict[str, bool], Dict[str, str]]
],
) -> Dict[str, Dict[str, Any]]: ...
def id_for_label(self, id_: str, index: str = ...) -> str: ...
def value_from_datadict(self, data: dict, files: MultiValueDict, name: str) -> Optional[Union[str, List[str], int]]: ...
def value_from_datadict(
self, data: dict, files: MultiValueDict, name: str
) -> Optional[Union[str, List[str], int]]: ...
def format_value(self, value: Any) -> List[str]: ...
class Select(ChoiceWidget):
@@ -175,20 +318,35 @@ class Select(ChoiceWidget):
add_id_index: bool = ...
checked_attribute: Any = ...
option_inherits_attrs: bool = ...
def get_context(self, name: str, value: Any, attrs: Optional[Union[Dict[str, Union[str, bool]], Dict[str, bool], Dict[str, str]]]) -> Dict[str, Dict[str, Any]]: ...
def get_context(
self,
name: str,
value: Any,
attrs: Optional[
Union[Dict[str, Union[str, bool]], Dict[str, bool], Dict[str, str]]
],
) -> Dict[str, Dict[str, Any]]: ...
@staticmethod
def _choice_has_empty_value(choice: Union[Tuple[None, str], Tuple[str, str]]) -> bool: ...
def _choice_has_empty_value(
choice: Union[Tuple[None, str], Tuple[str, str]]
) -> bool: ...
def use_required_attribute(self, initial: Any) -> bool: ...
class NullBooleanSelect(Select):
def __init__(self, attrs: None = ...) -> None: ...
def format_value(self, value: Optional[str]) -> str: ...
def value_from_datadict(self, data: Dict[str, Union[str, bool]], files: Dict[Any, Any], name: str) -> Optional[bool]: ...
def value_from_datadict(
self, data: Dict[str, Union[str, bool]], files: Dict[Any, Any], name: str
) -> Optional[bool]: ...
class SelectMultiple(Select):
allow_multiple_selected: bool = ...
def value_from_datadict(self, data: Any, files: MultiValueDict, name: str) -> Optional[Union[List[int], str, List[str]]]: ...
def value_omitted_from_data(self, data: Dict[Any, Any], files: Dict[Any, Any], name: str) -> bool: ...
def value_from_datadict(
self, data: Any, files: MultiValueDict, name: str
) -> Optional[Union[List[int], str, List[str]]]: ...
def value_omitted_from_data(
self, data: Dict[Any, Any], files: Dict[Any, Any], name: str
) -> bool: ...
class RadioSelect(ChoiceWidget):
input_type: str = ...
@@ -201,7 +359,9 @@ class CheckboxSelectMultiple(ChoiceWidget):
template_name: str = ...
option_template_name: str = ...
def use_required_attribute(self, initial: None) -> bool: ...
def value_omitted_from_data(self, data: Dict[Any, Any], files: Dict[Any, Any], name: str) -> bool: ...
def value_omitted_from_data(
self, data: Dict[Any, Any], files: Dict[Any, Any], name: str
) -> bool: ...
def id_for_label(self, id_: str, index: Optional[str] = ...) -> str: ...
class MultiWidget(Widget):
@@ -210,10 +370,22 @@ class MultiWidget(Widget):
def __init__(self, widgets: Any, attrs: Optional[Dict[str, str]] = ...) -> None: ...
@property
def is_hidden(self) -> bool: ...
def get_context(self, name: str, value: Optional[Union[str, datetime, List[str]]], attrs: Optional[Union[Dict[str, Union[str, bool]], Dict[str, str]]]) -> Dict[str, Dict[str, Any]]: ...
def get_context(
self,
name: str,
value: Optional[Union[str, datetime, List[str]]],
attrs: Optional[Union[Dict[str, Union[str, bool]], Dict[str, str]]],
) -> Dict[str, Dict[str, Any]]: ...
def id_for_label(self, id_: str) -> str: ...
def value_from_datadict(self, data: Union[Dict[str, str], Dict[str, Union[str, List[str]]], QueryDict], files: MultiValueDict, name: str) -> Union[List[None], List[str]]: ...
def value_omitted_from_data(self, data: Union[Dict[str, str], QueryDict], files: MultiValueDict, name: str) -> bool: ...
def value_from_datadict(
self,
data: Union[Dict[str, str], Dict[str, Union[str, List[str]]], QueryDict],
files: MultiValueDict,
name: str,
) -> Union[List[None], List[str]]: ...
def value_omitted_from_data(
self, data: Union[Dict[str, str], QueryDict], files: MultiValueDict, name: str
) -> bool: ...
def decompress(self, value: Any) -> None: ...
def _get_media(self) -> Media: ...
media: Any = ...
@@ -224,12 +396,28 @@ class MultiWidget(Widget):
class SplitDateTimeWidget(MultiWidget):
supports_microseconds: bool = ...
template_name: str = ...
def __init__(self, attrs: Optional[Dict[str, str]] = ..., date_format: None = ..., time_format: None = ..., date_attrs: Optional[Dict[str, str]] = ..., time_attrs: Optional[Dict[str, str]] = ...) -> None: ...
def decompress(self, value: Optional[datetime]) -> Union[List[Union[date, time]], List[None]]: ...
def __init__(
self,
attrs: Optional[Dict[str, str]] = ...,
date_format: None = ...,
time_format: None = ...,
date_attrs: Optional[Dict[str, str]] = ...,
time_attrs: Optional[Dict[str, str]] = ...,
) -> None: ...
def decompress(
self, value: Optional[datetime]
) -> Union[List[Union[date, time]], List[None]]: ...
class SplitHiddenDateTimeWidget(SplitDateTimeWidget):
template_name: str = ...
def __init__(self, attrs: None = ..., date_format: None = ..., time_format: None = ..., date_attrs: None = ..., time_attrs: None = ...) -> None: ...
def __init__(
self,
attrs: None = ...,
date_format: None = ...,
time_format: None = ...,
date_attrs: None = ...,
time_attrs: None = ...,
) -> None: ...
class SelectDateWidget(Widget):
none_value: Any = ...
@@ -246,11 +434,23 @@ class SelectDateWidget(Widget):
year_none_value: Any = ...
month_none_value: Any = ...
day_none_value: Any = ...
def __init__(self, attrs: None = ..., years: Optional[Union[range, Tuple[str]]] = ..., months: None = ..., empty_label: Optional[Tuple[str, str, str]] = ...) -> None: ...
def __init__(
self,
attrs: None = ...,
years: Optional[Union[range, Tuple[str]]] = ...,
months: None = ...,
empty_label: Optional[Tuple[str, str, str]] = ...,
) -> None: ...
def get_context(self, name: Any, value: Any, attrs: Any): ...
def format_value(self, value: Optional[Union[str, date]]) -> Dict[str, Optional[Union[str, int]]]: ...
def format_value(
self, value: Optional[Union[str, date]]
) -> Dict[str, Optional[Union[str, int]]]: ...
@staticmethod
def _parse_date_fmt() -> Iterator[str]: ...
def id_for_label(self, id_: Any): ...
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: ...
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: ...