mirror of
https://github.com/davidhalter/django-stubs.git
synced 2025-12-09 21:46:43 +08:00
run black over stubs, add checking to travis
This commit is contained in:
@@ -7,8 +7,7 @@ from django.db.models.lookups import Exact, In
|
||||
|
||||
from .mixins import CheckFieldDefaultMixin
|
||||
|
||||
_T = TypeVar('_T', bound=Field)
|
||||
|
||||
_T = TypeVar("_T", bound=Field)
|
||||
|
||||
class ArrayField(CheckFieldDefaultMixin, Field, Generic[_T]):
|
||||
empty_strings_allowed: bool = ...
|
||||
@@ -17,10 +16,7 @@ class ArrayField(CheckFieldDefaultMixin, Field, Generic[_T]):
|
||||
size: Any = ...
|
||||
default_validators: Any = ...
|
||||
from_db_value: Any = ...
|
||||
|
||||
def __init__(
|
||||
self, base_field: Field, size: None = ..., **kwargs: Any
|
||||
) -> None: ...
|
||||
def __init__(self, base_field: Field, size: None = ..., **kwargs: Any) -> None: ...
|
||||
@property
|
||||
def model(self): ...
|
||||
@model.setter
|
||||
@@ -30,14 +26,8 @@ class ArrayField(CheckFieldDefaultMixin, Field, Generic[_T]):
|
||||
@property
|
||||
def description(self): ...
|
||||
def db_type(self, connection: Any): ...
|
||||
def get_db_prep_value(
|
||||
self, value: Any, connection: Any, prepared: bool = ...
|
||||
): ...
|
||||
def deconstruct(
|
||||
self
|
||||
) -> Tuple[
|
||||
None, str, List[Any], Dict[str, Optional[Union[bool, Field]]]
|
||||
]: ...
|
||||
def get_db_prep_value(self, value: Any, connection: Any, prepared: bool = ...): ...
|
||||
def deconstruct(self) -> Tuple[None, str, List[Any], Dict[str, Optional[Union[bool, Field]]]]: ...
|
||||
def to_python(self, value: Any): ...
|
||||
def value_to_string(self, obj: Any): ...
|
||||
def get_transform(self, name: Any): ...
|
||||
@@ -69,9 +59,7 @@ class ArrayInLookup(In):
|
||||
class IndexTransform(Transform):
|
||||
index: Any = ...
|
||||
base_field: Any = ...
|
||||
def __init__(
|
||||
self, index: Any, base_field: Any, *args: Any, **kwargs: Any
|
||||
) -> None: ...
|
||||
def __init__(self, index: Any, base_field: Any, *args: Any, **kwargs: Any) -> None: ...
|
||||
def as_sql(self, compiler: Any, connection: Any): ...
|
||||
@property
|
||||
def output_field(self): ...
|
||||
@@ -85,9 +73,7 @@ class IndexTransformFactory:
|
||||
class SliceTransform(Transform):
|
||||
start: Any = ...
|
||||
end: Any = ...
|
||||
def __init__(
|
||||
self, start: Any, end: Any, *args: Any, **kwargs: Any
|
||||
) -> None: ...
|
||||
def __init__(self, start: Any, end: Any, *args: Any, **kwargs: Any) -> None: ...
|
||||
def as_sql(self, compiler: Any, connection: Any): ...
|
||||
|
||||
class SliceTransformFactory:
|
||||
|
||||
@@ -8,15 +8,9 @@ from django.db.models import lookups as builtin_lookups
|
||||
|
||||
from .mixins import CheckFieldDefaultMixin
|
||||
|
||||
|
||||
class JsonAdapter(Json):
|
||||
encoder: Any = ...
|
||||
def __init__(
|
||||
self,
|
||||
adapted: Any,
|
||||
dumps: Optional[Any] = ...,
|
||||
encoder: Optional[Any] = ...,
|
||||
) -> None: ...
|
||||
def __init__(self, adapted: Any, dumps: Optional[Any] = ..., encoder: Optional[Any] = ...) -> None: ...
|
||||
def dumps(self, obj: Any): ...
|
||||
|
||||
class JSONField(CheckFieldDefaultMixin, Field):
|
||||
@@ -25,18 +19,10 @@ class JSONField(CheckFieldDefaultMixin, Field):
|
||||
default_error_messages: Any = ...
|
||||
encoder: Any = ...
|
||||
def __init__(
|
||||
self,
|
||||
verbose_name: None = ...,
|
||||
name: None = ...,
|
||||
encoder: Optional[Type[DjangoJSONEncoder]] = ...,
|
||||
**kwargs: Any
|
||||
self, verbose_name: None = ..., name: None = ..., encoder: Optional[Type[DjangoJSONEncoder]] = ..., **kwargs: Any
|
||||
) -> None: ...
|
||||
def db_type(self, connection: Any): ...
|
||||
def deconstruct(
|
||||
self
|
||||
) -> Tuple[
|
||||
None, str, List[Any], Dict[str, Union[Type[DjangoJSONEncoder], bool]]
|
||||
]: ...
|
||||
def deconstruct(self) -> Tuple[None, str, List[Any], Dict[str, Union[Type[DjangoJSONEncoder], bool]]]: ...
|
||||
def get_transform(self, name: Any): ...
|
||||
def get_prep_value(self, value: Any): ...
|
||||
def validate(self, value: Any, model_instance: Any) -> None: ...
|
||||
@@ -56,32 +42,16 @@ class KeyTextTransform(KeyTransform):
|
||||
output_field: Any = ...
|
||||
|
||||
class KeyTransformTextLookupMixin:
|
||||
def __init__(
|
||||
self, key_transform: Any, *args: Any, **kwargs: Any
|
||||
) -> None: ...
|
||||
def __init__(self, key_transform: Any, *args: Any, **kwargs: Any) -> None: ...
|
||||
|
||||
class KeyTransformIExact(
|
||||
KeyTransformTextLookupMixin, builtin_lookups.IExact
|
||||
): ...
|
||||
class KeyTransformIContains(
|
||||
KeyTransformTextLookupMixin, builtin_lookups.IContains
|
||||
): ...
|
||||
class KeyTransformStartsWith(
|
||||
KeyTransformTextLookupMixin, builtin_lookups.StartsWith
|
||||
): ...
|
||||
class KeyTransformIStartsWith(
|
||||
KeyTransformTextLookupMixin, builtin_lookups.IStartsWith
|
||||
): ...
|
||||
class KeyTransformEndsWith(
|
||||
KeyTransformTextLookupMixin, builtin_lookups.EndsWith
|
||||
): ...
|
||||
class KeyTransformIEndsWith(
|
||||
KeyTransformTextLookupMixin, builtin_lookups.IEndsWith
|
||||
): ...
|
||||
class KeyTransformIExact(KeyTransformTextLookupMixin, builtin_lookups.IExact): ...
|
||||
class KeyTransformIContains(KeyTransformTextLookupMixin, builtin_lookups.IContains): ...
|
||||
class KeyTransformStartsWith(KeyTransformTextLookupMixin, builtin_lookups.StartsWith): ...
|
||||
class KeyTransformIStartsWith(KeyTransformTextLookupMixin, builtin_lookups.IStartsWith): ...
|
||||
class KeyTransformEndsWith(KeyTransformTextLookupMixin, builtin_lookups.EndsWith): ...
|
||||
class KeyTransformIEndsWith(KeyTransformTextLookupMixin, builtin_lookups.IEndsWith): ...
|
||||
class KeyTransformRegex(KeyTransformTextLookupMixin, builtin_lookups.Regex): ...
|
||||
class KeyTransformIRegex(
|
||||
KeyTransformTextLookupMixin, builtin_lookups.IRegex
|
||||
): ...
|
||||
class KeyTransformIRegex(KeyTransformTextLookupMixin, builtin_lookups.IRegex): ...
|
||||
|
||||
class KeyTransformFactory:
|
||||
key_name: Any = ...
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
from typing import Any, List, Optional
|
||||
|
||||
|
||||
class CheckFieldDefaultMixin:
|
||||
def check(self, **kwargs: Any) -> List[Any]: ...
|
||||
|
||||
@@ -3,7 +3,6 @@ from typing import Any, Optional
|
||||
from django.contrib.postgres import lookups
|
||||
from django.db import models
|
||||
|
||||
|
||||
class RangeField(models.Field):
|
||||
empty_strings_allowed: bool = ...
|
||||
base_field: Any = ...
|
||||
|
||||
@@ -4,22 +4,15 @@ from django.db.backends.sqlite3.schema import DatabaseSchemaEditor
|
||||
from django.db.migrations.operations.base import Operation
|
||||
from django.db.migrations.state import ProjectState
|
||||
|
||||
|
||||
class CreateExtension(Operation):
|
||||
reversible: bool = ...
|
||||
name: Any = ...
|
||||
def __init__(self, name: str) -> None: ...
|
||||
def state_forwards(self, app_label: str, state: ProjectState) -> None: ...
|
||||
def database_forwards(
|
||||
self,
|
||||
app_label: str,
|
||||
schema_editor: DatabaseSchemaEditor,
|
||||
from_state: ProjectState,
|
||||
to_state: ProjectState,
|
||||
) -> None: ...
|
||||
def database_backwards(
|
||||
self, app_label: Any, schema_editor: Any, from_state: Any, to_state: Any
|
||||
self, app_label: str, schema_editor: DatabaseSchemaEditor, from_state: ProjectState, to_state: ProjectState
|
||||
) -> None: ...
|
||||
def database_backwards(self, app_label: Any, schema_editor: Any, from_state: Any, to_state: Any) -> None: ...
|
||||
def describe(self): ...
|
||||
|
||||
class BtreeGinExtension(CreateExtension):
|
||||
|
||||
Reference in New Issue
Block a user