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
+7
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
-1
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]]: ...
+15 -196
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]: ...
+15 -47
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: ...
+5 -8
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):
+1 -4
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]: ...
+28 -259
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: ...