mirror of
https://github.com/davidhalter/django-stubs.git
synced 2025-12-20 02:41:16 +08:00
integrate some generated stubs
This commit is contained in:
@@ -1 +1,3 @@
|
||||
from .array import ArrayField as ArrayField
|
||||
from .array import * # NOQA
|
||||
from .jsonb import * # NOQA
|
||||
from .ranges import * # NOQA
|
||||
|
||||
@@ -1,14 +1,44 @@
|
||||
from typing import List, Any, TypeVar, Generic
|
||||
from typing import Any, Dict, List, Optional, Tuple, Union, TypeVar, Generic
|
||||
|
||||
from django.contrib.postgres.fields.mixins import CheckFieldDefaultMixin
|
||||
from django.db.models import Field
|
||||
from django.db.models.fields import Field
|
||||
|
||||
from .mixins import CheckFieldDefaultMixin
|
||||
|
||||
_T = TypeVar('_T', bound=Field)
|
||||
|
||||
|
||||
class ArrayField(CheckFieldDefaultMixin, Field, Generic[_T]):
|
||||
def __init__(self,
|
||||
base_field: Field,
|
||||
**kwargs): ...
|
||||
empty_strings_allowed: bool = ...
|
||||
default_error_messages: Any = ...
|
||||
base_field: Any = ...
|
||||
size: Any = ...
|
||||
default_validators: Any = ...
|
||||
from_db_value: Any = ...
|
||||
|
||||
def __get__(self, instance, owner) -> List[_T]: ...
|
||||
def __init__(
|
||||
self, base_field: Field, size: None = ..., **kwargs: Any
|
||||
) -> None: ...
|
||||
@property
|
||||
def model(self): ...
|
||||
@model.setter
|
||||
def model(self, model: Any) -> None: ...
|
||||
def check(self, **kwargs: Any) -> List[Any]: ...
|
||||
def set_attributes_from_name(self, name: str) -> None: ...
|
||||
@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 to_python(self, value: Any): ...
|
||||
def value_to_string(self, obj: Any): ...
|
||||
def get_transform(self, name: Any): ...
|
||||
def validate(self, value: Any, model_instance: Any) -> None: ...
|
||||
def run_validators(self, value: Any) -> None: ...
|
||||
def formfield(self, **kwargs: Any): ...
|
||||
def __get__(self, instance, owner) -> List[_T]: ...
|
||||
41
django-stubs/contrib/postgres/fields/jsonb.pyi
Normal file
41
django-stubs/contrib/postgres/fields/jsonb.pyi
Normal file
@@ -0,0 +1,41 @@
|
||||
from json import JSONEncoder
|
||||
from typing import Any, Dict, List, Optional, Tuple, Type, Union
|
||||
|
||||
from django.db.models import Field
|
||||
|
||||
from .mixins import CheckFieldDefaultMixin
|
||||
|
||||
|
||||
class JsonAdapter(object):
|
||||
encoder: Any = ...
|
||||
def __init__(
|
||||
self,
|
||||
adapted: Any,
|
||||
dumps: Optional[Any] = ...,
|
||||
encoder: Optional[Any] = ...,
|
||||
) -> None: ...
|
||||
def dumps(self, obj: Any): ...
|
||||
|
||||
class JSONField(CheckFieldDefaultMixin, Field):
|
||||
empty_strings_allowed: bool = ...
|
||||
description: Any = ...
|
||||
default_error_messages: Any = ...
|
||||
encoder: Any = ...
|
||||
def __init__(
|
||||
self,
|
||||
verbose_name: None = ...,
|
||||
name: None = ...,
|
||||
encoder: Optional[Type[JSONEncoder]] = ...,
|
||||
**kwargs: Any
|
||||
) -> None: ...
|
||||
def db_type(self, connection: Any): ...
|
||||
def deconstruct(
|
||||
self
|
||||
) -> Tuple[
|
||||
None, str, List[Any], Dict[str, Union[Type[JSONEncoder], bool]]
|
||||
]: ...
|
||||
def get_transform(self, name: Any): ...
|
||||
def get_prep_value(self, value: Any): ...
|
||||
def validate(self, value: Any, model_instance: Any) -> None: ...
|
||||
def value_to_string(self, obj: Any): ...
|
||||
def formfield(self, **kwargs: Any): ...
|
||||
@@ -1,2 +1,5 @@
|
||||
from typing import Any, List, Optional
|
||||
|
||||
|
||||
class CheckFieldDefaultMixin:
|
||||
pass
|
||||
def check(self, **kwargs: Any) -> List[Any]: ...
|
||||
|
||||
48
django-stubs/contrib/postgres/fields/ranges.pyi
Normal file
48
django-stubs/contrib/postgres/fields/ranges.pyi
Normal file
@@ -0,0 +1,48 @@
|
||||
from typing import Any
|
||||
|
||||
from django.db import models
|
||||
|
||||
|
||||
class RangeField(models.Field):
|
||||
empty_strings_allowed: bool = ...
|
||||
base_field: Any = ...
|
||||
def __init__(self, *args: Any, **kwargs: Any) -> None: ...
|
||||
@property
|
||||
def model(self): ...
|
||||
@model.setter
|
||||
def model(self, model: Any) -> None: ...
|
||||
def get_prep_value(self, value: Any): ...
|
||||
def to_python(self, value: Any): ...
|
||||
def set_attributes_from_name(self, name: str) -> None: ...
|
||||
def value_to_string(self, obj: Any): ...
|
||||
def formfield(self, **kwargs: Any): ...
|
||||
|
||||
class IntegerRangeField(RangeField):
|
||||
base_field: Any = ...
|
||||
range_type: Any = ...
|
||||
form_field: Any = ...
|
||||
def db_type(self, connection: Any): ...
|
||||
|
||||
class BigIntegerRangeField(RangeField):
|
||||
base_field: Any = ...
|
||||
range_type: Any = ...
|
||||
form_field: Any = ...
|
||||
def db_type(self, connection: Any): ...
|
||||
|
||||
class FloatRangeField(RangeField):
|
||||
base_field: Any = ...
|
||||
range_type: Any = ...
|
||||
form_field: Any = ...
|
||||
def db_type(self, connection: Any): ...
|
||||
|
||||
class DateTimeRangeField(RangeField):
|
||||
base_field: Any = ...
|
||||
range_type: Any = ...
|
||||
form_field: Any = ...
|
||||
def db_type(self, connection: Any): ...
|
||||
|
||||
class DateRangeField(RangeField):
|
||||
base_field: Any = ...
|
||||
range_type: Any = ...
|
||||
form_field: Any = ...
|
||||
def db_type(self, connection: Any): ...
|
||||
51
django-stubs/contrib/postgres/operations.pyi
Normal file
51
django-stubs/contrib/postgres/operations.pyi
Normal file
@@ -0,0 +1,51 @@
|
||||
from typing import Any, Optional
|
||||
|
||||
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
|
||||
) -> None: ...
|
||||
def describe(self): ...
|
||||
|
||||
class BtreeGinExtension(CreateExtension):
|
||||
name: str = ...
|
||||
def __init__(self) -> None: ...
|
||||
|
||||
class BtreeGistExtension(CreateExtension):
|
||||
name: str = ...
|
||||
def __init__(self) -> None: ...
|
||||
|
||||
class CITextExtension(CreateExtension):
|
||||
name: str = ...
|
||||
def __init__(self) -> None: ...
|
||||
|
||||
class CryptoExtension(CreateExtension):
|
||||
name: str = ...
|
||||
def __init__(self) -> None: ...
|
||||
|
||||
class HStoreExtension(CreateExtension):
|
||||
name: str = ...
|
||||
def __init__(self) -> None: ...
|
||||
|
||||
class TrigramExtension(CreateExtension):
|
||||
name: str = ...
|
||||
def __init__(self) -> None: ...
|
||||
|
||||
class UnaccentExtension(CreateExtension):
|
||||
name: str = ...
|
||||
def __init__(self) -> None: ...
|
||||
Reference in New Issue
Block a user