mirror of
https://github.com/davidhalter/django-stubs.git
synced 2025-12-09 05:24:53 +08:00
run black over stubs, add checking to travis
This commit is contained in:
@@ -11,7 +11,6 @@ from django.forms.boundfield import BoundField
|
||||
from django.forms.forms import BaseForm
|
||||
from django.forms.widgets import Input, Widget
|
||||
|
||||
|
||||
class Field:
|
||||
initial: None
|
||||
label: None
|
||||
@@ -45,34 +44,17 @@ class Field:
|
||||
) -> None: ...
|
||||
def prepare_value(self, value: Any) -> Any: ...
|
||||
def to_python(
|
||||
self,
|
||||
value: Optional[Union[List[None], List[str], datetime, float, str]],
|
||||
self, value: Optional[Union[List[None], List[str], datetime, float, str]]
|
||||
) -> Optional[Union[List[None], List[str], datetime, float, str]]: ...
|
||||
def validate(self, value: Any) -> None: ...
|
||||
def run_validators(self, value: Any) -> None: ...
|
||||
def clean(self, value: Any) -> Any: ...
|
||||
def bound_data(self, data: Any, initial: Any) -> Any: ...
|
||||
def widget_attrs(self, widget: Widget) -> Dict[Any, Any]: ...
|
||||
def has_changed(
|
||||
self,
|
||||
initial: Optional[Union[datetime, Decimal, float, str]],
|
||||
data: Optional[str],
|
||||
) -> bool: ...
|
||||
def get_bound_field(
|
||||
self, form: BaseForm, field_name: str
|
||||
) -> BoundField: ...
|
||||
def has_changed(self, initial: Optional[Union[datetime, Decimal, float, str]], data: Optional[str]) -> bool: ...
|
||||
def get_bound_field(self, form: BaseForm, field_name: str) -> BoundField: ...
|
||||
def __deepcopy__(
|
||||
self,
|
||||
memo: Dict[
|
||||
int,
|
||||
Union[
|
||||
List[Tuple[Union[int, str], str]],
|
||||
List[Widget],
|
||||
OrderedDict,
|
||||
Field,
|
||||
Widget,
|
||||
],
|
||||
],
|
||||
self, memo: Dict[int, Union[List[Tuple[Union[int, str], str]], List[Widget], OrderedDict, Field, Widget]]
|
||||
) -> Field: ...
|
||||
|
||||
class CharField(Field):
|
||||
@@ -85,12 +67,7 @@ class CharField(Field):
|
||||
localize: bool
|
||||
required: bool
|
||||
show_hidden_initial: bool
|
||||
validators: List[
|
||||
Union[
|
||||
django.core.validators.BaseValidator,
|
||||
django.core.validators.ProhibitNullCharactersValidator,
|
||||
]
|
||||
]
|
||||
validators: List[Union[django.core.validators.BaseValidator, django.core.validators.ProhibitNullCharactersValidator]]
|
||||
widget: django.forms.widgets.TextInput
|
||||
max_length: Optional[Union[int, str]] = ...
|
||||
min_length: Optional[Union[int, str]] = ...
|
||||
@@ -105,9 +82,7 @@ class CharField(Field):
|
||||
empty_value: str = ...,
|
||||
**kwargs: Any
|
||||
) -> None: ...
|
||||
def to_python(
|
||||
self, value: Optional[Union[List[int], Tuple, int, str]]
|
||||
) -> Optional[str]: ...
|
||||
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):
|
||||
@@ -126,19 +101,9 @@ class IntegerField(Field):
|
||||
widget: django.forms.widgets.NumberInput = ...
|
||||
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]]: ...
|
||||
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
|
||||
@@ -155,9 +120,7 @@ class FloatField(IntegerField):
|
||||
validators: List[django.core.validators.BaseValidator]
|
||||
widget: django.forms.widgets.NumberInput
|
||||
default_error_messages: Any = ...
|
||||
def to_python(
|
||||
self, value: Optional[Union[float, str]]
|
||||
) -> Optional[float]: ...
|
||||
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]]: ...
|
||||
|
||||
@@ -175,12 +138,7 @@ class DecimalField(IntegerField):
|
||||
min_value: Optional[Union[decimal.Decimal, int]]
|
||||
required: bool
|
||||
show_hidden_initial: bool
|
||||
validators: List[
|
||||
Union[
|
||||
django.core.validators.BaseValidator,
|
||||
django.core.validators.DecimalValidator,
|
||||
]
|
||||
]
|
||||
validators: List[Union[django.core.validators.BaseValidator, django.core.validators.DecimalValidator]]
|
||||
widget: django.forms.widgets.NumberInput
|
||||
default_error_messages: Any = ...
|
||||
def __init__(
|
||||
@@ -192,19 +150,13 @@ class DecimalField(IntegerField):
|
||||
decimal_places: Optional[Any] = ...,
|
||||
**kwargs: Any
|
||||
) -> None: ...
|
||||
def to_python(
|
||||
self, value: Optional[Union[Decimal, float, str]]
|
||||
) -> Optional[Decimal]: ...
|
||||
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]]: ...
|
||||
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 __init__(self, *, input_formats: Optional[Any] = ..., **kwargs: Any) -> None: ...
|
||||
def to_python(self, value: str) -> datetime: ...
|
||||
def strptime(self, value: Any, format: Any) -> None: ...
|
||||
|
||||
@@ -222,9 +174,7 @@ class DateField(BaseTemporalField):
|
||||
widget: django.forms.widgets.DateInput = ...
|
||||
input_formats: Any = ...
|
||||
default_error_messages: Any = ...
|
||||
def to_python(
|
||||
self, value: Optional[Union[date, str]]
|
||||
) -> Optional[date]: ...
|
||||
def to_python(self, value: Optional[Union[date, str]]) -> Optional[date]: ...
|
||||
def strptime(self, value: str, format: str) -> date: ...
|
||||
|
||||
class TimeField(BaseTemporalField):
|
||||
@@ -241,9 +191,7 @@ class TimeField(BaseTemporalField):
|
||||
widget: django.forms.widgets.TimeInput = ...
|
||||
input_formats: Any = ...
|
||||
default_error_messages: Any = ...
|
||||
def to_python(
|
||||
self, value: Optional[Union[time, str]]
|
||||
) -> Optional[time]: ...
|
||||
def to_python(self, value: Optional[Union[time, str]]) -> Optional[time]: ...
|
||||
def strptime(self, value: str, format: str) -> time: ...
|
||||
|
||||
class DateTimeField(BaseTemporalField):
|
||||
@@ -260,12 +208,8 @@ class DateTimeField(BaseTemporalField):
|
||||
widget: django.forms.widgets.DateTimeInput = ...
|
||||
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 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):
|
||||
@@ -278,9 +222,7 @@ class DurationField(Field):
|
||||
required: bool
|
||||
show_hidden_initial: bool
|
||||
default_error_messages: Any = ...
|
||||
def prepare_value(
|
||||
self, value: Optional[Union[timedelta, str]]
|
||||
) -> Optional[str]: ...
|
||||
def prepare_value(self, value: Optional[Union[timedelta, str]]) -> Optional[str]: ...
|
||||
def to_python(self, value: Union[int, str]) -> timedelta: ...
|
||||
|
||||
class RegexField(CharField):
|
||||
@@ -346,27 +288,11 @@ class FileField(Field):
|
||||
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: ...
|
||||
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
|
||||
@@ -381,9 +307,7 @@ class ImageField(FileField):
|
||||
show_hidden_initial: bool
|
||||
default_validators: Any = ...
|
||||
default_error_messages: Any = ...
|
||||
def to_python(
|
||||
self, data: Optional[SimpleUploadedFile]
|
||||
) -> Optional[SimpleUploadedFile]: ...
|
||||
def to_python(self, data: Optional[SimpleUploadedFile]) -> Optional[SimpleUploadedFile]: ...
|
||||
def widget_attrs(self, widget: Widget) -> Dict[str, str]: ...
|
||||
|
||||
class URLField(CharField):
|
||||
@@ -427,11 +351,7 @@ class BooleanField(Field):
|
||||
widget: django.forms.widgets.CheckboxInput = ...
|
||||
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: ...
|
||||
def has_changed(self, initial: Optional[Union[bool, str]], data: Optional[Union[bool, str]]) -> bool: ...
|
||||
|
||||
class NullBooleanField(BooleanField):
|
||||
disabled: bool
|
||||
@@ -443,9 +363,7 @@ class NullBooleanField(BooleanField):
|
||||
required: bool
|
||||
show_hidden_initial: bool
|
||||
widget: Any = ...
|
||||
def to_python(
|
||||
self, value: Optional[Union[bool, str]]
|
||||
) -> Optional[bool]: ...
|
||||
def to_python(self, value: Optional[Union[bool, str]]) -> Optional[bool]: ...
|
||||
def validate(self, value: Optional[bool]) -> None: ...
|
||||
|
||||
class CallableChoiceIterator:
|
||||
@@ -469,17 +387,7 @@ class ChoiceField(Field):
|
||||
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,
|
||||
],
|
||||
],
|
||||
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: ...
|
||||
@@ -496,12 +404,8 @@ class TypedChoiceField(ChoiceField):
|
||||
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]]: ...
|
||||
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
|
||||
@@ -517,15 +421,9 @@ class MultipleChoiceField(ChoiceField):
|
||||
hidden_widget: Any = ...
|
||||
widget: django.forms.widgets.SelectMultiple = ...
|
||||
default_error_messages: Any = ...
|
||||
def to_python(
|
||||
self, value: Optional[Union[List[Union[int, str]], Tuple, str]]
|
||||
) -> List[str]: ...
|
||||
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: ...
|
||||
def has_changed(self, initial: Optional[Union[List[int], List[str], str]], data: Optional[Union[List[str], str]]) -> bool: ...
|
||||
|
||||
class TypedMultipleChoiceField(MultipleChoiceField):
|
||||
disabled: bool
|
||||
@@ -539,9 +437,7 @@ class TypedMultipleChoiceField(MultipleChoiceField):
|
||||
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 clean(self, value: List[str]) -> Optional[Union[List[bool], List[Decimal], List[float]]]: ...
|
||||
def validate(self, value: List[str]) -> None: ...
|
||||
|
||||
class ComboField(Field):
|
||||
@@ -569,31 +465,15 @@ class MultiValueField(Field):
|
||||
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 __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]
|
||||
],
|
||||
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]],
|
||||
self, initial: Optional[Union[List[None], List[str], datetime, str]], data: Union[List[None], List[str]]
|
||||
) -> bool: ...
|
||||
|
||||
class FilePathField(ChoiceField):
|
||||
@@ -637,15 +517,9 @@ class SplitDateTimeField(MultiValueField):
|
||||
hidden_widget: Any = ...
|
||||
default_error_messages: Any = ...
|
||||
def __init__(
|
||||
self,
|
||||
*,
|
||||
input_date_formats: Optional[Any] = ...,
|
||||
input_time_formats: Optional[Any] = ...,
|
||||
**kwargs: Any
|
||||
self, *, input_date_formats: Optional[Any] = ..., input_time_formats: Optional[Any] = ..., **kwargs: Any
|
||||
) -> None: ...
|
||||
def compress(
|
||||
self, data_list: List[Optional[datetime]]
|
||||
) -> Optional[datetime]: ...
|
||||
def compress(self, data_list: List[Optional[datetime]]) -> Optional[datetime]: ...
|
||||
|
||||
class GenericIPAddressField(CharField):
|
||||
disabled: bool
|
||||
@@ -665,9 +539,7 @@ class GenericIPAddressField(CharField):
|
||||
widget: django.forms.widgets.TextInput
|
||||
unpack_ipv4: bool = ...
|
||||
default_validators: List[Callable] = ...
|
||||
def __init__(
|
||||
self, *, protocol: str = ..., unpack_ipv4: bool = ..., **kwargs: Any
|
||||
) -> None: ...
|
||||
def __init__(self, *, protocol: str = ..., unpack_ipv4: bool = ..., **kwargs: Any) -> None: ...
|
||||
def to_python(self, value: Optional[str]) -> str: ...
|
||||
|
||||
class SlugField(CharField):
|
||||
|
||||
Reference in New Issue
Block a user