mirror of
https://github.com/davidhalter/django-stubs.git
synced 2026-08-16 04:38:03 +08:00
reformat with black
This commit is contained in:
@@ -12,8 +12,16 @@ from django.db.backends.sqlite3.base import DatabaseWrapper
|
||||
from django.db.models.base import Model
|
||||
from django.db.models.expressions import OuterRef
|
||||
from django.db.models.sql.compiler import SQLCompiler
|
||||
from django.forms.fields import BaseTemporalField, BooleanField, CharField, IntegerField, SplitDateTimeField, TypedChoiceField
|
||||
from django.forms.fields import (
|
||||
BaseTemporalField,
|
||||
BooleanField,
|
||||
CharField,
|
||||
IntegerField,
|
||||
SplitDateTimeField,
|
||||
TypedChoiceField,
|
||||
)
|
||||
from typing import Any, List, Optional, Type, Union
|
||||
|
||||
class Empty: ...
|
||||
class NOT_PROVIDED: ...
|
||||
|
||||
@@ -57,7 +65,31 @@ class Field(RegisterLookupMixin):
|
||||
_validators: Any = ...
|
||||
_error_messages: Any = ...
|
||||
error_messages: Any = ...
|
||||
def __init__(self, verbose_name: Optional[Any] = ..., name: Optional[Any] = ..., primary_key: bool = ..., max_length: Optional[Any] = ..., unique: bool = ..., blank: bool = ..., null: bool = ..., db_index: bool = ..., rel: Optional[Any] = ..., default: Any = ..., editable: bool = ..., serialize: bool = ..., unique_for_date: Optional[Any] = ..., unique_for_month: Optional[Any] = ..., unique_for_year: Optional[Any] = ..., choices: Optional[Any] = ..., help_text: str = ..., db_column: Optional[Any] = ..., db_tablespace: Optional[Any] = ..., auto_created: bool = ..., validators: Any = ..., error_messages: Optional[Any] = ...) -> None: ...
|
||||
def __init__(
|
||||
self,
|
||||
verbose_name: Optional[Any] = ...,
|
||||
name: Optional[Any] = ...,
|
||||
primary_key: bool = ...,
|
||||
max_length: Optional[Any] = ...,
|
||||
unique: bool = ...,
|
||||
blank: bool = ...,
|
||||
null: bool = ...,
|
||||
db_index: bool = ...,
|
||||
rel: Optional[Any] = ...,
|
||||
default: Any = ...,
|
||||
editable: bool = ...,
|
||||
serialize: bool = ...,
|
||||
unique_for_date: Optional[Any] = ...,
|
||||
unique_for_month: Optional[Any] = ...,
|
||||
unique_for_year: Optional[Any] = ...,
|
||||
choices: Optional[Any] = ...,
|
||||
help_text: str = ...,
|
||||
db_column: Optional[Any] = ...,
|
||||
db_tablespace: Optional[Any] = ...,
|
||||
auto_created: bool = ...,
|
||||
validators: Any = ...,
|
||||
error_messages: Optional[Any] = ...,
|
||||
) -> None: ...
|
||||
def __str__(self): ...
|
||||
def __repr__(self): ...
|
||||
def check(self, **kwargs: Any): ...
|
||||
@@ -100,7 +132,9 @@ class Field(RegisterLookupMixin):
|
||||
concrete: Any = ...
|
||||
def set_attributes_from_name(self, name: Any) -> None: ...
|
||||
model: Any = ...
|
||||
def contribute_to_class(self, cls: Any, name: Any, private_only: bool = ...) -> None: ...
|
||||
def contribute_to_class(
|
||||
self, cls: Any, name: Any, private_only: bool = ...
|
||||
) -> None: ...
|
||||
def get_filter_kwargs_for_object(self, obj: Any): ...
|
||||
def get_attname(self): ...
|
||||
def get_attname_column(self): ...
|
||||
@@ -112,12 +146,22 @@ class Field(RegisterLookupMixin):
|
||||
def has_default(self): ...
|
||||
def get_default(self): ...
|
||||
def _get_default(self): ...
|
||||
def get_choices(self, include_blank: bool = ..., blank_choice: Any = ..., limit_choices_to: Optional[Any] = ...): ...
|
||||
def get_choices(
|
||||
self,
|
||||
include_blank: bool = ...,
|
||||
blank_choice: Any = ...,
|
||||
limit_choices_to: Optional[Any] = ...,
|
||||
): ...
|
||||
def value_to_string(self, obj: Any): ...
|
||||
def _get_flatchoices(self): ...
|
||||
flatchoices: Any = ...
|
||||
def save_form_data(self, instance: Any, data: Any) -> None: ...
|
||||
def formfield(self, form_class: Optional[Any] = ..., choices_form_class: Optional[Any] = ..., **kwargs: Any): ...
|
||||
def formfield(
|
||||
self,
|
||||
form_class: Optional[Any] = ...,
|
||||
choices_form_class: Optional[Any] = ...,
|
||||
**kwargs: Any,
|
||||
): ...
|
||||
def value_from_object(self, obj: Any): ...
|
||||
|
||||
class AutoField(Field):
|
||||
@@ -132,7 +176,9 @@ class AutoField(Field):
|
||||
def to_python(self, value: Optional[Union[str, int]]) -> Optional[int]: ...
|
||||
def rel_db_type(self, connection: DatabaseWrapper) -> str: ...
|
||||
def validate(self, value: int, model_instance: Model) -> None: ...
|
||||
def get_db_prep_value(self, value: Union[str, int], connection: DatabaseWrapper, prepared: bool = ...) -> Union[str, int]: ...
|
||||
def get_db_prep_value(
|
||||
self, value: Union[str, int], connection: DatabaseWrapper, prepared: bool = ...
|
||||
) -> Union[str, int]: ...
|
||||
def get_prep_value(self, value: Any) -> Optional[Union[int, OuterRef]]: ...
|
||||
def contribute_to_class(self, cls: Type[Model], name: str, **kwargs: Any) -> None: ...
|
||||
def formfield(self, **kwargs: Any) -> None: ...
|
||||
@@ -176,7 +222,14 @@ class DateField(DateTimeCheckMixin, Field):
|
||||
empty_strings_allowed: bool = ...
|
||||
default_error_messages: Any = ...
|
||||
description: Any = ...
|
||||
def __init__(self, verbose_name: Optional[str] = ..., name: Optional[str] = ..., auto_now: bool = ..., auto_now_add: bool = ..., **kwargs: Any) -> None: ...
|
||||
def __init__(
|
||||
self,
|
||||
verbose_name: Optional[str] = ...,
|
||||
name: Optional[str] = ...,
|
||||
auto_now: bool = ...,
|
||||
auto_now_add: bool = ...,
|
||||
**kwargs: Any,
|
||||
) -> None: ...
|
||||
def _check_fix_default_value(self) -> List[Warning]: ...
|
||||
def deconstruct(self) -> Any: ...
|
||||
def get_internal_type(self) -> str: ...
|
||||
@@ -184,7 +237,12 @@ class DateField(DateTimeCheckMixin, Field):
|
||||
def pre_save(self, model_instance: Model, add: bool) -> Optional[date]: ...
|
||||
def contribute_to_class(self, cls: Type[Model], name: str, **kwargs: Any) -> None: ...
|
||||
def get_prep_value(self, value: Optional[Union[str, date]]) -> Optional[date]: ...
|
||||
def get_db_prep_value(self, value: Optional[Union[str, date]], connection: DatabaseWrapper, prepared: bool = ...) -> Optional[str]: ...
|
||||
def get_db_prep_value(
|
||||
self,
|
||||
value: Optional[Union[str, date]],
|
||||
connection: DatabaseWrapper,
|
||||
prepared: bool = ...,
|
||||
) -> Optional[str]: ...
|
||||
def value_to_string(self, obj: Any): ...
|
||||
def formfield(self, **kwargs: Any) -> Union[BaseTemporalField, SplitDateTimeField]: ...
|
||||
|
||||
@@ -205,7 +263,14 @@ class DecimalField(Field):
|
||||
empty_strings_allowed: bool = ...
|
||||
default_error_messages: Any = ...
|
||||
description: Any = ...
|
||||
def __init__(self, verbose_name: Optional[Any] = ..., name: Optional[Any] = ..., max_digits: Optional[Any] = ..., decimal_places: Optional[Any] = ..., **kwargs: Any) -> None: ...
|
||||
def __init__(
|
||||
self,
|
||||
verbose_name: Optional[Any] = ...,
|
||||
name: Optional[Any] = ...,
|
||||
max_digits: Optional[Any] = ...,
|
||||
decimal_places: Optional[Any] = ...,
|
||||
**kwargs: Any,
|
||||
) -> None: ...
|
||||
def check(self, **kwargs: Any): ...
|
||||
def _check_decimal_places(self): ...
|
||||
def _check_max_digits(self): ...
|
||||
@@ -239,7 +304,17 @@ class EmailField(CharField):
|
||||
|
||||
class FilePathField(Field):
|
||||
description: Any = ...
|
||||
def __init__(self, verbose_name: Optional[Any] = ..., name: Optional[Any] = ..., path: str = ..., match: Optional[Any] = ..., recursive: bool = ..., allow_files: bool = ..., allow_folders: bool = ..., **kwargs: Any) -> None: ...
|
||||
def __init__(
|
||||
self,
|
||||
verbose_name: Optional[Any] = ...,
|
||||
name: Optional[Any] = ...,
|
||||
path: str = ...,
|
||||
match: Optional[Any] = ...,
|
||||
recursive: bool = ...,
|
||||
allow_files: bool = ...,
|
||||
allow_folders: bool = ...,
|
||||
**kwargs: Any,
|
||||
) -> None: ...
|
||||
def check(self, **kwargs: Any): ...
|
||||
def _check_allowing_files_or_folders(self, **kwargs: Any): ...
|
||||
def deconstruct(self): ...
|
||||
@@ -290,7 +365,15 @@ class GenericIPAddressField(Field):
|
||||
default_error_messages: Any = ...
|
||||
unpack_ipv4: Any = ...
|
||||
protocol: Any = ...
|
||||
def __init__(self, verbose_name: Optional[Any] = ..., name: Optional[Any] = ..., protocol: str = ..., unpack_ipv4: bool = ..., *args: Any, **kwargs: Any) -> None: ...
|
||||
def __init__(
|
||||
self,
|
||||
verbose_name: Optional[Any] = ...,
|
||||
name: Optional[Any] = ...,
|
||||
protocol: str = ...,
|
||||
unpack_ipv4: bool = ...,
|
||||
*args: Any,
|
||||
**kwargs: Any,
|
||||
) -> None: ...
|
||||
def check(self, **kwargs: Any): ...
|
||||
def _check_blank_and_null_values(self, **kwargs: Any): ...
|
||||
def deconstruct(self): ...
|
||||
@@ -324,7 +407,14 @@ class SlugField(CharField):
|
||||
default_validators: Any = ...
|
||||
description: Any = ...
|
||||
allow_unicode: Any = ...
|
||||
def __init__(self, *args: Any, max_length: int = ..., db_index: bool = ..., allow_unicode: bool = ..., **kwargs: Any) -> None: ...
|
||||
def __init__(
|
||||
self,
|
||||
*args: Any,
|
||||
max_length: int = ...,
|
||||
db_index: bool = ...,
|
||||
allow_unicode: bool = ...,
|
||||
**kwargs: Any,
|
||||
) -> None: ...
|
||||
def deconstruct(self): ...
|
||||
def get_internal_type(self): ...
|
||||
def formfield(self, **kwargs: Any): ...
|
||||
@@ -344,7 +434,14 @@ class TimeField(DateTimeCheckMixin, Field):
|
||||
empty_strings_allowed: bool = ...
|
||||
default_error_messages: Any = ...
|
||||
description: Any = ...
|
||||
def __init__(self, verbose_name: Optional[Any] = ..., name: Optional[Any] = ..., auto_now: bool = ..., auto_now_add: bool = ..., **kwargs: Any) -> None: ...
|
||||
def __init__(
|
||||
self,
|
||||
verbose_name: Optional[Any] = ...,
|
||||
name: Optional[Any] = ...,
|
||||
auto_now: bool = ...,
|
||||
auto_now_add: bool = ...,
|
||||
**kwargs: Any,
|
||||
) -> None: ...
|
||||
def _check_fix_default_value(self): ...
|
||||
def deconstruct(self): ...
|
||||
def get_internal_type(self): ...
|
||||
@@ -358,7 +455,9 @@ class TimeField(DateTimeCheckMixin, Field):
|
||||
class URLField(CharField):
|
||||
default_validators: Any = ...
|
||||
description: Any = ...
|
||||
def __init__(self, verbose_name: Optional[Any] = ..., name: Optional[Any] = ..., **kwargs: Any) -> None: ...
|
||||
def __init__(
|
||||
self, verbose_name: Optional[Any] = ..., name: Optional[Any] = ..., **kwargs: Any
|
||||
) -> None: ...
|
||||
def deconstruct(self): ...
|
||||
def formfield(self, **kwargs: Any): ...
|
||||
|
||||
@@ -368,11 +467,23 @@ class BinaryField(Field):
|
||||
def __init__(self, *args: Any, **kwargs: Any) -> None: ...
|
||||
def deconstruct(self) -> Any: ...
|
||||
def get_internal_type(self) -> str: ...
|
||||
def get_placeholder(self, value: Optional[memoryview], compiler: SQLCompiler, connection: DatabaseWrapper) -> str: ...
|
||||
def get_placeholder(
|
||||
self,
|
||||
value: Optional[memoryview],
|
||||
compiler: SQLCompiler,
|
||||
connection: DatabaseWrapper,
|
||||
) -> str: ...
|
||||
def get_default(self) -> Optional[bytes]: ...
|
||||
def get_db_prep_value(self, value: Optional[Union[bytes, memoryview]], connection: DatabaseWrapper, prepared: bool = ...) -> Optional[memoryview]: ...
|
||||
def get_db_prep_value(
|
||||
self,
|
||||
value: Optional[Union[bytes, memoryview]],
|
||||
connection: DatabaseWrapper,
|
||||
prepared: bool = ...,
|
||||
) -> Optional[memoryview]: ...
|
||||
def value_to_string(self, obj: Any): ...
|
||||
def to_python(self, value: Optional[Union[str, bytes]]) -> Optional[Union[bytes, memoryview]]: ...
|
||||
def to_python(
|
||||
self, value: Optional[Union[str, bytes]]
|
||||
) -> Optional[Union[bytes, memoryview]]: ...
|
||||
|
||||
class UUIDField(Field):
|
||||
default_error_messages: Any = ...
|
||||
|
||||
Reference in New Issue
Block a user