mirror of
https://github.com/davidhalter/django-stubs.git
synced 2025-12-11 06:21:58 +08:00
finish moving generated stubs
This commit is contained in:
@@ -91,7 +91,7 @@ class BaseModelAdmin:
|
||||
|
||||
class ModelAdmin(BaseModelAdmin):
|
||||
formfield_overrides: Dict[
|
||||
Type[Union[django.db.models.fields.DateTimeCheckMixin, django.db.models.fields.Field]],
|
||||
Type[Union[django.db.models.fields.DateTimeCheckMixin, Field]],
|
||||
Dict[str, Type[Union[django.forms.fields.SplitDateTimeField, django.forms.widgets.Widget]]],
|
||||
]
|
||||
list_display: Any = ...
|
||||
@@ -122,7 +122,7 @@ class ModelAdmin(BaseModelAdmin):
|
||||
actions_on_bottom: bool = ...
|
||||
actions_selection_counter: bool = ...
|
||||
checks_class: Any = ...
|
||||
model: Type[django.db.models.base.Model] = ...
|
||||
model: Type[Model] = ...
|
||||
opts: django.db.models.options.Options = ...
|
||||
admin_site: django.contrib.admin.sites.AdminSite = ...
|
||||
def __init__(self, model: Type[Model], admin_site: Optional[AdminSite]) -> None: ...
|
||||
|
||||
@@ -17,7 +17,7 @@ ERROR_FLAG: str
|
||||
IGNORED_PARAMS: Any
|
||||
|
||||
class ChangeList:
|
||||
model: Type[django.db.models.base.Model] = ...
|
||||
model: Type[Model] = ...
|
||||
opts: django.db.models.options.Options = ...
|
||||
lookup_opts: django.db.models.options.Options = ...
|
||||
root_queryset: django.db.models.query.QuerySet = ...
|
||||
|
||||
@@ -28,7 +28,7 @@ class GroupAdmin(admin.ModelAdmin):
|
||||
class UserAdmin(admin.ModelAdmin):
|
||||
admin_site: django.contrib.admin.sites.AdminSite
|
||||
formfield_overrides: Dict[
|
||||
Type[Union[django.db.models.fields.DateTimeCheckMixin, django.db.models.fields.Field]],
|
||||
Type[Union[django.db.models.fields.DateTimeCheckMixin, Field]],
|
||||
Dict[str, Type[Union[django.forms.fields.SplitDateTimeField, django.forms.widgets.Widget]]],
|
||||
]
|
||||
model: Type[django.contrib.auth.models.User]
|
||||
|
||||
@@ -49,7 +49,7 @@ class GenericForeignKey(FieldCacheMixin):
|
||||
class GenericRel(ForeignObjectRel):
|
||||
field: django.contrib.contenttypes.fields.GenericRelation
|
||||
limit_choices_to: Dict[Any, Any]
|
||||
model: Type[django.db.models.base.Model]
|
||||
model: Type[Model]
|
||||
multiple: bool
|
||||
on_delete: Callable
|
||||
parent_link: bool
|
||||
|
||||
@@ -29,24 +29,19 @@ class CommandParser(ArgumentParser):
|
||||
def handle_default_options(options: Namespace) -> None: ...
|
||||
def no_translations(handle_func: Callable) -> Callable: ...
|
||||
|
||||
class DjangoHelpFormatter(HelpFormatter):
|
||||
show_last: Any = ...
|
||||
def add_usage(self, usage: None, actions: List[Any], *args: Any, **kwargs: Any) -> None: ...
|
||||
def add_arguments(self, actions: List[Any]) -> None: ...
|
||||
class DjangoHelpFormatter(HelpFormatter): ...
|
||||
|
||||
class OutputWrapper(TextIOBase):
|
||||
@property
|
||||
def style_func(self): ...
|
||||
@style_func.setter
|
||||
def style_func(self, style_func: Any): ...
|
||||
style_func: Any = ...
|
||||
ending: str = ...
|
||||
def __init__(
|
||||
self, out: Union[StringIO, TextIOWrapper], style_func: Optional[Callable] = ..., ending: str = ...
|
||||
) -> None: ...
|
||||
def __getattr__(self, name: str) -> Callable: ...
|
||||
def isatty(self) -> bool: ...
|
||||
def write(self, msg: str, style_func: Optional[Callable] = ..., ending: Optional[str] = ...) -> None: ...
|
||||
|
||||
class BaseCommand:
|
||||
help: str = ...
|
||||
@@ -80,13 +75,9 @@ class BaseCommand:
|
||||
|
||||
class AppCommand(BaseCommand):
|
||||
missing_args_message: str = ...
|
||||
def add_arguments(self, parser: Any) -> None: ...
|
||||
def handle(self, *app_labels: Any, **options: Any): ...
|
||||
def handle_app_config(self, app_config: Any, **options: Any) -> None: ...
|
||||
|
||||
class LabelCommand(BaseCommand):
|
||||
label: str = ...
|
||||
missing_args_message: Any = ...
|
||||
def add_arguments(self, parser: CommandParser) -> None: ...
|
||||
def handle(self, *labels: Any, **options: Any) -> str: ...
|
||||
def handle_label(self, label: Any, **options: Any) -> None: ...
|
||||
|
||||
0
django-stubs/db/backends/dummy/__init__.pyi
Normal file
0
django-stubs/db/backends/dummy/__init__.pyi
Normal file
65
django-stubs/db/backends/dummy/base.pyi
Normal file
65
django-stubs/db/backends/dummy/base.pyi
Normal file
@@ -0,0 +1,65 @@
|
||||
from typing import Any, Optional
|
||||
|
||||
from django.db.backends.base.base import BaseDatabaseWrapper
|
||||
from django.db.backends.base.client import BaseDatabaseClient
|
||||
from django.db.backends.base.creation import BaseDatabaseCreation
|
||||
from django.db.backends.base.introspection import BaseDatabaseIntrospection
|
||||
from django.db.backends.base.operations import BaseDatabaseOperations
|
||||
|
||||
def complain(*args: Any, **kwargs: Any) -> Any: ...
|
||||
def ignore(*args: Any, **kwargs: Any) -> None: ...
|
||||
|
||||
class DatabaseOperations(BaseDatabaseOperations):
|
||||
connection: django.db.backends.dummy.base.DatabaseWrapper
|
||||
quote_name: Any = ...
|
||||
|
||||
class DatabaseClient(BaseDatabaseClient):
|
||||
connection: django.db.backends.dummy.base.DatabaseWrapper
|
||||
runshell: Any = ...
|
||||
|
||||
class DatabaseCreation(BaseDatabaseCreation):
|
||||
connection: django.db.backends.dummy.base.DatabaseWrapper
|
||||
create_test_db: Any = ...
|
||||
destroy_test_db: Any = ...
|
||||
|
||||
class DatabaseIntrospection(BaseDatabaseIntrospection):
|
||||
connection: django.db.backends.dummy.base.DatabaseWrapper
|
||||
get_table_list: Any = ...
|
||||
get_table_description: Any = ...
|
||||
get_relations: Any = ...
|
||||
get_indexes: Any = ...
|
||||
get_key_columns: Any = ...
|
||||
|
||||
class DatabaseWrapper(BaseDatabaseWrapper):
|
||||
alias: str
|
||||
allow_thread_sharing: bool
|
||||
autocommit: bool
|
||||
client: django.db.backends.dummy.base.DatabaseClient
|
||||
close_at: None
|
||||
closed_in_transaction: bool
|
||||
commit_on_exit: bool
|
||||
connection: None
|
||||
creation: django.db.backends.dummy.base.DatabaseCreation
|
||||
errors_occurred: bool
|
||||
execute_wrappers: List[Any]
|
||||
features: django.db.backends.dummy.features.DummyDatabaseFeatures
|
||||
force_debug_cursor: bool
|
||||
in_atomic_block: bool
|
||||
introspection: django.db.backends.dummy.base.DatabaseIntrospection
|
||||
needs_rollback: bool
|
||||
ops: django.db.backends.dummy.base.DatabaseOperations
|
||||
queries_log: collections.deque
|
||||
run_commit_hooks_on_set_autocommit_on: bool
|
||||
run_on_commit: List[Any]
|
||||
savepoint_ids: List[Any]
|
||||
savepoint_state: int
|
||||
settings_dict: Dict[str, Optional[Union[Dict[str, None], int, str]]]
|
||||
validation: django.db.backends.base.validation.BaseDatabaseValidation
|
||||
operators: Any = ...
|
||||
ensure_connection: Any = ...
|
||||
client_class: Any = ...
|
||||
creation_class: Any = ...
|
||||
features_class: Any = ...
|
||||
introspection_class: Any = ...
|
||||
ops_class: Any = ...
|
||||
def is_usable(self): ...
|
||||
0
django-stubs/db/backends/mysql/__init__.pyi
Normal file
0
django-stubs/db/backends/mysql/__init__.pyi
Normal file
11
django-stubs/db/backends/mysql/client.pyi
Normal file
11
django-stubs/db/backends/mysql/client.pyi
Normal file
@@ -0,0 +1,11 @@
|
||||
from typing import Any, Dict, List, Optional, Union
|
||||
|
||||
from django.db.backends.base.client import BaseDatabaseClient
|
||||
|
||||
class DatabaseClient(BaseDatabaseClient):
|
||||
executable_name: str = ...
|
||||
@classmethod
|
||||
def settings_to_cmd_args(
|
||||
cls, settings_dict: Dict[str, Optional[Union[Dict[str, Dict[str, str]], int, str]]]
|
||||
) -> List[str]: ...
|
||||
def runshell(self) -> None: ...
|
||||
0
django-stubs/db/backends/postgresql/__init__.pyi
Normal file
0
django-stubs/db/backends/postgresql/__init__.pyi
Normal file
9
django-stubs/db/backends/postgresql/client.pyi
Normal file
9
django-stubs/db/backends/postgresql/client.pyi
Normal file
@@ -0,0 +1,9 @@
|
||||
from typing import Any, Dict, Optional
|
||||
|
||||
from django.db.backends.base.client import BaseDatabaseClient
|
||||
|
||||
class DatabaseClient(BaseDatabaseClient):
|
||||
executable_name: str = ...
|
||||
@classmethod
|
||||
def runshell_db(cls, conn_params: Dict[str, str]) -> None: ...
|
||||
def runshell(self) -> None: ...
|
||||
0
django-stubs/db/backends/sqlite3/__init__.pyi
Normal file
0
django-stubs/db/backends/sqlite3/__init__.pyi
Normal file
13
django-stubs/db/backends/sqlite3/base.pyi
Normal file
13
django-stubs/db/backends/sqlite3/base.pyi
Normal file
@@ -0,0 +1,13 @@
|
||||
from sqlite3 import dbapi2 as Database
|
||||
from sqlite3 import dbapi2 as Database
|
||||
from typing import Any, Callable, Iterator
|
||||
|
||||
from django.db.backends.base.base import BaseDatabaseWrapper
|
||||
|
||||
def decoder(conv_func: Callable) -> Callable: ...
|
||||
|
||||
class DatabaseWrapper(BaseDatabaseWrapper): ...
|
||||
|
||||
FORMAT_QMARK_REGEX: Any
|
||||
|
||||
class SQLiteCursorWrapper(Database.Cursor): ...
|
||||
3
django-stubs/db/backends/sqlite3/creation.pyi
Normal file
3
django-stubs/db/backends/sqlite3/creation.pyi
Normal file
@@ -0,0 +1,3 @@
|
||||
from django.db.backends.base.creation import BaseDatabaseCreation
|
||||
|
||||
class DatabaseCreation(BaseDatabaseCreation): ...
|
||||
3
django-stubs/db/backends/sqlite3/features.pyi
Normal file
3
django-stubs/db/backends/sqlite3/features.pyi
Normal file
@@ -0,0 +1,3 @@
|
||||
from django.db.backends.base.features import BaseDatabaseFeatures
|
||||
|
||||
class DatabaseFeatures(BaseDatabaseFeatures): ...
|
||||
13
django-stubs/db/backends/sqlite3/introspection.pyi
Normal file
13
django-stubs/db/backends/sqlite3/introspection.pyi
Normal file
@@ -0,0 +1,13 @@
|
||||
from typing import Any, Dict, Optional, Tuple, Union
|
||||
|
||||
from django.db.backends.base.introspection import BaseDatabaseIntrospection
|
||||
|
||||
field_size_re: Any
|
||||
|
||||
def get_field_size(name: str) -> Optional[int]: ...
|
||||
|
||||
class FlexibleFieldLookupDict:
|
||||
base_data_types_reverse: Any = ...
|
||||
def __getitem__(self, key: str) -> Union[Tuple[str, Dict[str, int]], str]: ...
|
||||
|
||||
class DatabaseIntrospection(BaseDatabaseIntrospection): ...
|
||||
3
django-stubs/db/backends/sqlite3/operations.pyi
Normal file
3
django-stubs/db/backends/sqlite3/operations.pyi
Normal file
@@ -0,0 +1,3 @@
|
||||
from django.db.backends.base.operations import BaseDatabaseOperations
|
||||
|
||||
class DatabaseOperations(BaseDatabaseOperations): ...
|
||||
25
django-stubs/db/backends/sqlite3/schema.pyi
Normal file
25
django-stubs/db/backends/sqlite3/schema.pyi
Normal file
@@ -0,0 +1,25 @@
|
||||
from typing import Any, Optional, Type, Union
|
||||
|
||||
from django.db.backends.base.schema import BaseDatabaseSchemaEditor
|
||||
from django.db.models.base import Model
|
||||
from django.db.models.fields import Field
|
||||
|
||||
class DatabaseSchemaEditor(BaseDatabaseSchemaEditor):
|
||||
atomic_migration: bool
|
||||
collect_sql: bool
|
||||
connection: Any
|
||||
sql_delete_table: str = ...
|
||||
sql_create_fk: Any = ...
|
||||
sql_create_inline_fk: str = ...
|
||||
sql_create_unique: str = ...
|
||||
sql_delete_unique: str = ...
|
||||
def __enter__(self) -> DatabaseSchemaEditor: ...
|
||||
def __exit__(self, exc_type: None, exc_value: None, traceback: None) -> None: ...
|
||||
def quote_value(self, value: Optional[Union[int, str]]) -> str: ...
|
||||
def alter_db_table(
|
||||
self, model: Type[Model], old_db_table: str, new_db_table: str, disable_constraints: bool = ...
|
||||
) -> None: ...
|
||||
def alter_field(self, model: Type[Model], old_field: Field, new_field: Field, strict: bool = ...) -> None: ...
|
||||
def delete_model(self, model: Type[Model], handle_autom2m: bool = ...) -> None: ...
|
||||
def add_field(self, model: Type[Model], field: Field) -> None: ...
|
||||
def remove_field(self, model: Type[Model], field: Field) -> None: ...
|
||||
@@ -1,6 +1,6 @@
|
||||
from datetime import date, datetime, time
|
||||
from decimal import Decimal
|
||||
from typing import Any, Callable, Dict, Iterator, List, Optional, Tuple, Union
|
||||
from typing import Any, Dict, Iterator, List, Optional, Tuple, Union
|
||||
|
||||
logger: Any
|
||||
|
||||
@@ -9,7 +9,7 @@ class CursorWrapper:
|
||||
db: Any = ...
|
||||
def __init__(self, cursor: Any, db: Any) -> None: ...
|
||||
WRAP_ERROR_ATTRS: Any = ...
|
||||
def __getattr__(self, attr: str) -> Union[Callable, Tuple[Tuple[str, None, None, None, None, None, None]], int]: ...
|
||||
def __getattr__(self, attr: str) -> Any: ...
|
||||
def __iter__(self) -> None: ...
|
||||
def __enter__(self) -> CursorWrapper: ...
|
||||
def __exit__(self, type: None, value: None, traceback: None) -> None: ...
|
||||
@@ -24,8 +24,6 @@ class CursorWrapper:
|
||||
class CursorDebugWrapper(CursorWrapper):
|
||||
cursor: Any
|
||||
db: Any
|
||||
def execute(self, sql: str, params: Optional[Union[List[str], Tuple]] = ...) -> Any: ...
|
||||
def executemany(self, sql: str, param_list: Iterator[Any]) -> Any: ...
|
||||
|
||||
def typecast_date(s: Optional[str]) -> Optional[date]: ...
|
||||
def typecast_time(s: Optional[str]) -> Optional[time]: ...
|
||||
|
||||
@@ -32,7 +32,7 @@ from .query import QuerySet as QuerySet, RawQuerySet as RawQuerySet
|
||||
|
||||
from .query_utils import Q as Q, FilteredRelation as FilteredRelation
|
||||
|
||||
from .lookups import Lookup as Lookup
|
||||
from .lookups import Lookup as Lookup, Transform as Transform
|
||||
|
||||
from .expressions import (
|
||||
F as F,
|
||||
@@ -45,6 +45,9 @@ from .expressions import (
|
||||
When as When,
|
||||
RawSQL as RawSQL,
|
||||
Value as Value,
|
||||
Func as Func,
|
||||
)
|
||||
|
||||
from .manager import BaseManager as BaseManager, Manager as Manager
|
||||
|
||||
from . import lookups as lookups
|
||||
|
||||
@@ -10,42 +10,14 @@ class Aggregate(Func):
|
||||
filter: Any = ...
|
||||
def __init__(self, *args: Any, filter: Optional[Any] = ..., **kwargs: Any) -> None: ...
|
||||
|
||||
class Avg(Aggregate):
|
||||
filter: None
|
||||
function: str = ...
|
||||
name: str = ...
|
||||
class Avg(Aggregate): ...
|
||||
|
||||
class Count(Aggregate):
|
||||
filter: None
|
||||
function: str = ...
|
||||
name: str = ...
|
||||
template: str = ...
|
||||
output_field: Any = ...
|
||||
def __init__(self, expression: str, distinct: bool = ..., filter: Optional[Q] = ..., **extra: Any) -> None: ...
|
||||
|
||||
class Max(Aggregate):
|
||||
filter: None
|
||||
function: str = ...
|
||||
name: str = ...
|
||||
|
||||
class Min(Aggregate):
|
||||
filter: None
|
||||
function: str = ...
|
||||
name: str = ...
|
||||
|
||||
class StdDev(Aggregate):
|
||||
filter: None
|
||||
name: str = ...
|
||||
output_field: Any = ...
|
||||
function: str = ...
|
||||
|
||||
class Sum(Aggregate):
|
||||
filter: None
|
||||
function: str = ...
|
||||
name: str = ...
|
||||
|
||||
class Variance(Aggregate):
|
||||
filter: None
|
||||
name: str = ...
|
||||
output_field: Any = ...
|
||||
function: str = ...
|
||||
class Max(Aggregate): ...
|
||||
class Min(Aggregate): ...
|
||||
class StdDev(Aggregate): ...
|
||||
class Sum(Aggregate): ...
|
||||
class Variance(Aggregate): ...
|
||||
|
||||
92
django-stubs/db/models/fields/files.pyi
Normal file
92
django-stubs/db/models/fields/files.pyi
Normal file
@@ -0,0 +1,92 @@
|
||||
from typing import Any, Callable, Dict, List, Optional, Tuple, Type, Union
|
||||
|
||||
from django.core.checks.messages import Error
|
||||
from django.core.files.base import File
|
||||
from django.core.files.images import ImageFile
|
||||
from django.core.files.storage import FileSystemStorage, Storage
|
||||
from django.db.models.base import Model
|
||||
from django.db.models.fields import Field
|
||||
from django.forms.fields import FileField, ImageField
|
||||
|
||||
class FieldFile(File):
|
||||
instance: Model = ...
|
||||
field: django.db.models.fields.files.FileField = ...
|
||||
storage: django.core.files.storage.FileSystemStorage = ...
|
||||
def __init__(self, instance: Model, field: FileField, name: Optional[str]) -> None: ...
|
||||
def __eq__(self, other: Any) -> bool: ...
|
||||
def __hash__(self): ...
|
||||
file: Any = ...
|
||||
@property
|
||||
def path(self) -> str: ...
|
||||
@property
|
||||
def url(self) -> str: ...
|
||||
@property
|
||||
def size(self) -> int: ...
|
||||
def open(self, mode: str = ...) -> FieldFile: ...
|
||||
name: Optional[str] = ...
|
||||
def save(self, name: str, content: File, save: bool = ...) -> None: ...
|
||||
def delete(self, save: bool = ...) -> None: ...
|
||||
@property
|
||||
def closed(self) -> bool: ...
|
||||
def close(self) -> None: ...
|
||||
|
||||
class FileDescriptor:
|
||||
field: django.db.models.fields.files.FileField = ...
|
||||
def __init__(self, field: FileField) -> None: ...
|
||||
def __get__(self, instance: Optional[Model], cls: Type[Model] = ...) -> Union[FieldFile, FileDescriptor]: ...
|
||||
def __set__(self, instance: Model, value: Optional[Union[File, str]]) -> None: ...
|
||||
|
||||
class FileField(Field):
|
||||
attr_class: Any = ...
|
||||
descriptor_class: Any = ...
|
||||
description: Any = ...
|
||||
storage: Any = ...
|
||||
upload_to: Any = ...
|
||||
def __init__(
|
||||
self,
|
||||
verbose_name: Optional[str] = ...,
|
||||
name: None = ...,
|
||||
upload_to: Union[Callable, str] = ...,
|
||||
storage: Optional[Storage] = ...,
|
||||
**kwargs: Any
|
||||
) -> None: ...
|
||||
def check(self, **kwargs: Any) -> List[Error]: ...
|
||||
def deconstruct(self) -> Tuple[Optional[str], str, List[Any], Dict[str, Union[bool, str]]]: ...
|
||||
def get_internal_type(self) -> str: ...
|
||||
def get_prep_value(self, value: Union[FieldFile, str]) -> str: ...
|
||||
def pre_save(self, model_instance: Model, add: bool) -> FieldFile: ...
|
||||
def contribute_to_class(self, cls: Type[Model], name: str, **kwargs: Any) -> None: ...
|
||||
def generate_filename(self, instance: Optional[Model], filename: str) -> str: ...
|
||||
def save_form_data(self, instance: Model, data: Optional[Union[bool, File, str]]) -> None: ...
|
||||
def formfield(self, **kwargs: Any) -> FileField: ...
|
||||
|
||||
class ImageFileDescriptor(FileDescriptor):
|
||||
field: django.db.models.fields.files.ImageField
|
||||
def __set__(self, instance: Model, value: Optional[str]) -> None: ...
|
||||
|
||||
class ImageFieldFile(ImageFile, FieldFile):
|
||||
field: django.db.models.fields.files.ImageField
|
||||
instance: Model
|
||||
name: Optional[str]
|
||||
storage: django.core.files.storage.DefaultStorage
|
||||
def delete(self, save: bool = ...) -> None: ...
|
||||
|
||||
class ImageField(FileField):
|
||||
attr_class: Any = ...
|
||||
descriptor_class: Any = ...
|
||||
description: Any = ...
|
||||
def __init__(
|
||||
self,
|
||||
verbose_name: None = ...,
|
||||
name: None = ...,
|
||||
width_field: Optional[str] = ...,
|
||||
height_field: Optional[str] = ...,
|
||||
**kwargs: Any
|
||||
) -> None: ...
|
||||
def check(self, **kwargs: Any) -> List[Any]: ...
|
||||
def deconstruct(
|
||||
self
|
||||
) -> Tuple[Optional[str], str, List[Any], Dict[str, Union[Callable, bool, FileSystemStorage, str]]]: ...
|
||||
def contribute_to_class(self, cls: Type[Model], name: str, **kwargs: Any) -> None: ...
|
||||
def update_dimension_fields(self, instance: Model, force: bool = ..., *args: Any, **kwargs: Any) -> None: ...
|
||||
def formfield(self, **kwargs: Any) -> ImageField: ...
|
||||
6
django-stubs/db/models/fields/proxy.pyi
Normal file
6
django-stubs/db/models/fields/proxy.pyi
Normal file
@@ -0,0 +1,6 @@
|
||||
from typing import Any, Optional
|
||||
|
||||
from django.db.models import fields
|
||||
|
||||
class OrderWrt(fields.IntegerField):
|
||||
def __init__(self, *args: Any, **kwargs: Any) -> None: ...
|
||||
71
django-stubs/db/models/fields/related_descriptors.pyi
Normal file
71
django-stubs/db/models/fields/related_descriptors.pyi
Normal file
@@ -0,0 +1,71 @@
|
||||
from typing import Any, Callable, List, Optional, Tuple, Type, Union, Generic, TypeVar
|
||||
|
||||
from django.core.exceptions import ObjectDoesNotExist
|
||||
from django.db.models.base import Model
|
||||
from django.db.models.expressions import F
|
||||
from django.db.models.fields import Field
|
||||
from django.db.models.fields.mixins import FieldCacheMixin
|
||||
from django.db.models.fields.related import RelatedField, OneToOneField
|
||||
from django.db.models.fields.reverse_related import ManyToManyRel, OneToOneRel
|
||||
from django.db.models.query import QuerySet
|
||||
|
||||
_T = TypeVar("_T")
|
||||
|
||||
class ForwardManyToOneDescriptor:
|
||||
RelatedObjectDoesNotExist: Type[ObjectDoesNotExist]
|
||||
field: Field = ...
|
||||
def __init__(self, field_with_rel: Field) -> None: ...
|
||||
def is_cached(self, instance: Model) -> bool: ...
|
||||
def get_queryset(self, **hints: Any) -> QuerySet: ...
|
||||
def get_prefetch_queryset(
|
||||
self, instances: List[Model], queryset: Optional[QuerySet] = ...
|
||||
) -> Tuple[QuerySet, Callable, Callable, bool, str, bool]: ...
|
||||
def get_object(self, instance: Model) -> Model: ...
|
||||
def __get__(
|
||||
self, instance: Optional[Model], cls: Type[Model] = ...
|
||||
) -> Optional[Union[Model, ForwardManyToOneDescriptor]]: ...
|
||||
def __set__(self, instance: Model, value: Optional[Union[Model, F]]) -> None: ...
|
||||
def __reduce__(self) -> Tuple[Callable, Tuple[Type[Model], str]]: ...
|
||||
|
||||
class ForwardOneToOneDescriptor(ForwardManyToOneDescriptor):
|
||||
RelatedObjectDoesNotExist: Type[ObjectDoesNotExist]
|
||||
field: OneToOneField
|
||||
def get_object(self, instance: Model) -> Model: ...
|
||||
def __set__(self, instance: Model, value: Optional[Model]) -> None: ...
|
||||
|
||||
class ReverseOneToOneDescriptor:
|
||||
RelatedObjectDoesNotExist: Type[ObjectDoesNotExist]
|
||||
related: OneToOneRel = ...
|
||||
def __init__(self, related: OneToOneRel) -> None: ...
|
||||
def is_cached(self, instance: Model) -> bool: ...
|
||||
def get_queryset(self, **hints: Any) -> QuerySet: ...
|
||||
def get_prefetch_queryset(
|
||||
self, instances: List[Model], queryset: Optional[QuerySet] = ...
|
||||
) -> Tuple[QuerySet, Callable, Callable, bool, str, bool]: ...
|
||||
def __get__(self, instance: Optional[Model], cls: Type[Model] = ...) -> Union[Model, ReverseOneToOneDescriptor]: ...
|
||||
def __set__(self, instance: Model, value: Optional[Model]) -> None: ...
|
||||
def __reduce__(self) -> Tuple[Callable, Tuple[Type[Model], str]]: ...
|
||||
|
||||
class ReverseManyToOneDescriptor:
|
||||
rel: FieldCacheMixin = ...
|
||||
field: FieldCacheMixin = ...
|
||||
def __init__(self, rel: FieldCacheMixin) -> None: ...
|
||||
def related_manager_cls(self): ...
|
||||
def __get__(self, instance: Optional[Model], cls: Type[Model] = ...) -> ReverseManyToOneDescriptor: ...
|
||||
def __set__(self, instance: Model, value: List[Model]) -> Any: ...
|
||||
|
||||
def create_reverse_many_to_one_manager(superclass: Any, rel: Any): ...
|
||||
|
||||
class ManyToManyDescriptor(ReverseManyToOneDescriptor):
|
||||
field: RelatedField
|
||||
rel: ManyToManyRel
|
||||
reverse: bool = ...
|
||||
def __init__(self, rel: ManyToManyRel, reverse: bool = ...) -> None: ...
|
||||
@property
|
||||
def through(self) -> Type[Model]: ...
|
||||
def related_manager_cls(self): ...
|
||||
|
||||
class _ForwardManyToManyManager(Generic[_T]):
|
||||
def all(self) -> QuerySet: ...
|
||||
|
||||
def create_forward_many_to_many_manager(superclass: Any, rel: Any, reverse: Any) -> _ForwardManyToManyManager: ...
|
||||
48
django-stubs/db/models/fields/related_lookups.pyi
Normal file
48
django-stubs/db/models/fields/related_lookups.pyi
Normal file
@@ -0,0 +1,48 @@
|
||||
from collections import OrderedDict
|
||||
from typing import Any, List, Tuple, Type, Iterable
|
||||
|
||||
from django.db.models.expressions import Expression
|
||||
from django.db.models.lookups import (
|
||||
BuiltinLookup,
|
||||
Exact,
|
||||
GreaterThan,
|
||||
GreaterThanOrEqual,
|
||||
In,
|
||||
IsNull,
|
||||
LessThan,
|
||||
LessThanOrEqual,
|
||||
)
|
||||
|
||||
from django.db.models.fields import Field
|
||||
|
||||
class MultiColSource:
|
||||
alias: str
|
||||
field: Field
|
||||
sources: Tuple[Field, Field]
|
||||
targets: Tuple[Field, Field]
|
||||
contains_aggregate: bool = ...
|
||||
output_field: Field = ...
|
||||
def __init__(
|
||||
self, alias: str, targets: Tuple[Field, Field], sources: Tuple[Field, Field], field: Field
|
||||
) -> None: ...
|
||||
def relabeled_clone(self, relabels: OrderedDict) -> MultiColSource: ...
|
||||
def get_lookup(self, lookup: str) -> Type[BuiltinLookup]: ...
|
||||
|
||||
def get_normalized_value(value: Any, lhs: Expression) -> Tuple[None]: ...
|
||||
|
||||
class RelatedIn(In):
|
||||
bilateral_transforms: List[Any]
|
||||
lhs: Expression
|
||||
rhs: Any = ...
|
||||
def get_prep_lookup(self) -> Iterable[Any]: ...
|
||||
|
||||
class RelatedLookupMixin:
|
||||
rhs: Any = ...
|
||||
def get_prep_lookup(self) -> Any: ...
|
||||
|
||||
class RelatedExact(RelatedLookupMixin, Exact): ...
|
||||
class RelatedLessThan(RelatedLookupMixin, LessThan): ...
|
||||
class RelatedGreaterThan(RelatedLookupMixin, GreaterThan): ...
|
||||
class RelatedGreaterThanOrEqual(RelatedLookupMixin, GreaterThanOrEqual): ...
|
||||
class RelatedLessThanOrEqual(RelatedLookupMixin, LessThanOrEqual): ...
|
||||
class RelatedIsNull(RelatedLookupMixin, IsNull): ...
|
||||
166
django-stubs/db/models/fields/reverse_related.pyi
Normal file
166
django-stubs/db/models/fields/reverse_related.pyi
Normal file
@@ -0,0 +1,166 @@
|
||||
from typing import Any, Callable, Dict, List, Optional, Tuple, Type, Union
|
||||
|
||||
from django.db.models.base import Model
|
||||
from django.db.models.fields import AutoField, Field
|
||||
from django.db.models.fields.related import ForeignKey, OneToOneField, RelatedField
|
||||
from django.db.models.lookups import BuiltinLookup, StartsWith
|
||||
from django.db.models.query_utils import FilteredRelation, PathInfo, Q
|
||||
from django.db.models.sql.where import WhereNode
|
||||
|
||||
from .mixins import FieldCacheMixin
|
||||
|
||||
class ForeignObjectRel(FieldCacheMixin):
|
||||
hidden: bool
|
||||
many_to_many: bool
|
||||
many_to_one: bool
|
||||
name: str
|
||||
one_to_many: bool
|
||||
one_to_one: bool
|
||||
related_model: Type[Model]
|
||||
auto_created: bool = ...
|
||||
concrete: bool = ...
|
||||
editable: bool = ...
|
||||
is_relation: bool = ...
|
||||
null: bool = ...
|
||||
field: Field = ...
|
||||
model: Union[Type[Model], str] = ...
|
||||
related_name: Optional[str] = ...
|
||||
related_query_name: None = ...
|
||||
limit_choices_to: Dict[Any, Any] = ...
|
||||
parent_link: bool = ...
|
||||
on_delete: Callable = ...
|
||||
symmetrical: bool = ...
|
||||
multiple: bool = ...
|
||||
def __init__(
|
||||
self,
|
||||
field: RelatedField,
|
||||
to: Union[Type[Model], str],
|
||||
related_name: Optional[str] = ...,
|
||||
related_query_name: Optional[str] = ...,
|
||||
limit_choices_to: Any = ...,
|
||||
parent_link: bool = ...,
|
||||
on_delete: Optional[Callable] = ...,
|
||||
) -> None: ...
|
||||
def hidden(self) -> bool: ...
|
||||
def name(self) -> str: ...
|
||||
@property
|
||||
def remote_field(self) -> RelatedField: ...
|
||||
@property
|
||||
def target_field(self) -> AutoField: ...
|
||||
def related_model(self) -> Type[Model]: ...
|
||||
def many_to_many(self) -> bool: ...
|
||||
def many_to_one(self) -> bool: ...
|
||||
def one_to_many(self) -> bool: ...
|
||||
def one_to_one(self) -> bool: ...
|
||||
def get_lookup(self, lookup_name: str) -> Type[BuiltinLookup]: ...
|
||||
def get_internal_type(self) -> str: ...
|
||||
@property
|
||||
def db_type(self) -> Callable: ...
|
||||
def get_choices(
|
||||
self, include_blank: bool = ..., blank_choice: List[Tuple[str, str]] = ...
|
||||
) -> List[Tuple[int, str]]: ...
|
||||
def is_hidden(self) -> bool: ...
|
||||
def get_joining_columns(self) -> Tuple: ...
|
||||
def get_extra_restriction(
|
||||
self, where_class: Type[WhereNode], alias: str, related_alias: str
|
||||
) -> Optional[Union[StartsWith, WhereNode]]: ...
|
||||
field_name: None = ...
|
||||
def set_field_name(self) -> None: ...
|
||||
def get_accessor_name(self, model: Optional[Type[Model]] = ...) -> Optional[str]: ...
|
||||
def get_path_info(self, filtered_relation: Optional[FilteredRelation] = ...) -> List[PathInfo]: ...
|
||||
def get_cache_name(self) -> str: ...
|
||||
|
||||
class ManyToOneRel(ForeignObjectRel):
|
||||
field: ForeignKey
|
||||
hidden: bool
|
||||
limit_choices_to: Any
|
||||
many_to_many: bool
|
||||
many_to_one: bool
|
||||
model: Union[Type[Model], str]
|
||||
multiple: bool
|
||||
name: str
|
||||
on_delete: Callable
|
||||
one_to_many: bool
|
||||
one_to_one: bool
|
||||
parent_link: bool
|
||||
related_model: Type[Model]
|
||||
related_name: Optional[str]
|
||||
related_query_name: Optional[str]
|
||||
symmetrical: bool
|
||||
field_name: Optional[str] = ...
|
||||
def __init__(
|
||||
self,
|
||||
field: ForeignKey,
|
||||
to: Union[Type[Model], str],
|
||||
field_name: Optional[str],
|
||||
related_name: Optional[str] = ...,
|
||||
related_query_name: Optional[str] = ...,
|
||||
limit_choices_to: Optional[Union[Callable, Dict[str, Union[int, str]], Q]] = ...,
|
||||
parent_link: bool = ...,
|
||||
on_delete: Callable = ...,
|
||||
) -> None: ...
|
||||
def get_related_field(self) -> Field: ...
|
||||
def set_field_name(self) -> None: ...
|
||||
|
||||
class OneToOneRel(ManyToOneRel):
|
||||
field: OneToOneField
|
||||
field_name: Optional[str]
|
||||
hidden: bool
|
||||
limit_choices_to: Dict[str, str]
|
||||
many_to_many: bool
|
||||
many_to_one: bool
|
||||
model: Union[Type[Model], str]
|
||||
name: str
|
||||
on_delete: Callable
|
||||
one_to_many: bool
|
||||
one_to_one: bool
|
||||
parent_link: bool
|
||||
related_model: Type[Model]
|
||||
related_name: Optional[str]
|
||||
related_query_name: Optional[str]
|
||||
symmetrical: bool
|
||||
multiple: bool = ...
|
||||
def __init__(
|
||||
self,
|
||||
field: OneToOneField,
|
||||
to: Union[Type[Model], str],
|
||||
field_name: Optional[str],
|
||||
related_name: Optional[str] = ...,
|
||||
related_query_name: Optional[str] = ...,
|
||||
limit_choices_to: Optional[Dict[str, str]] = ...,
|
||||
parent_link: bool = ...,
|
||||
on_delete: Callable = ...,
|
||||
) -> None: ...
|
||||
|
||||
class ManyToManyRel(ForeignObjectRel):
|
||||
field: RelatedField
|
||||
field_name: None
|
||||
hidden: bool
|
||||
limit_choices_to: Union[Callable, Dict[str, str]]
|
||||
model: Union[Type[Model], str]
|
||||
multiple: bool
|
||||
name: str
|
||||
on_delete: None
|
||||
one_to_many: bool
|
||||
one_to_one: bool
|
||||
parent_link: bool
|
||||
related_model: Type[Model]
|
||||
related_name: Optional[str]
|
||||
related_query_name: Optional[str]
|
||||
through: Optional[Union[Type[Model], str]] = ...
|
||||
through_fields: Optional[Tuple[str, str]] = ...
|
||||
symmetrical: bool = ...
|
||||
db_constraint: bool = ...
|
||||
def __init__(
|
||||
self,
|
||||
field: RelatedField,
|
||||
to: Union[Type[Model], str],
|
||||
related_name: Optional[str] = ...,
|
||||
related_query_name: Optional[str] = ...,
|
||||
limit_choices_to: Any = ...,
|
||||
symmetrical: bool = ...,
|
||||
through: Optional[Union[Type[Model], str]] = ...,
|
||||
through_fields: Optional[Tuple[str, str]] = ...,
|
||||
db_constraint: bool = ...,
|
||||
) -> None: ...
|
||||
def get_related_field(self) -> Field: ...
|
||||
0
django-stubs/db/models/functions/__init__.pyi
Normal file
0
django-stubs/db/models/functions/__init__.pyi
Normal file
60
django-stubs/db/models/functions/comparison.pyi
Normal file
60
django-stubs/db/models/functions/comparison.pyi
Normal file
@@ -0,0 +1,60 @@
|
||||
from datetime import date, datetime
|
||||
from decimal import Decimal
|
||||
from typing import Any, List, Optional, Tuple, Union
|
||||
|
||||
from django.db.backends.sqlite3.base import DatabaseWrapper
|
||||
from django.db.models import Func
|
||||
from django.db.models.expressions import Value
|
||||
from django.db.models.fields import Field
|
||||
from django.db.models.sql.compiler import SQLCompiler
|
||||
|
||||
class Cast(Func):
|
||||
contains_aggregate: bool
|
||||
convert_value: Callable
|
||||
extra: Dict[Any, Any]
|
||||
is_summary: bool
|
||||
output_field: Field
|
||||
source_expressions: List[django.db.models.expressions.Combinable]
|
||||
function: str = ...
|
||||
template: str = ...
|
||||
def __init__(self, expression: Union[date, Decimal, Value, str], output_field: Field) -> None: ...
|
||||
def as_sql(
|
||||
self, compiler: SQLCompiler, connection: DatabaseWrapper, **extra_context: Any
|
||||
) -> Tuple[str, Union[List[date], List[Decimal]]]: ...
|
||||
def as_mysql(self, compiler: Any, connection: Any): ...
|
||||
def as_postgresql(self, compiler: Any, connection: Any): ...
|
||||
|
||||
class Coalesce(Func):
|
||||
contains_aggregate: bool
|
||||
convert_value: Callable
|
||||
extra: Dict[Any, Any]
|
||||
is_summary: bool
|
||||
output_field: Field
|
||||
source_expressions: List[django.db.models.expressions.Combinable]
|
||||
function: str = ...
|
||||
def __init__(self, *expressions: Any, **extra: Any) -> None: ...
|
||||
def as_oracle(self, compiler: Any, connection: Any): ...
|
||||
|
||||
class Greatest(Func):
|
||||
contains_aggregate: bool
|
||||
contains_over_clause: bool
|
||||
convert_value: Callable
|
||||
extra: Dict[Any, Any]
|
||||
is_summary: bool
|
||||
output_field: Field
|
||||
source_expressions: List[django.db.models.expressions.Combinable]
|
||||
function: str = ...
|
||||
def __init__(self, *expressions: Any, **extra: Any) -> None: ...
|
||||
def as_sqlite(self, compiler: SQLCompiler, connection: DatabaseWrapper) -> Tuple[str, List[datetime]]: ...
|
||||
|
||||
class Least(Func):
|
||||
contains_aggregate: bool
|
||||
contains_over_clause: bool
|
||||
convert_value: Callable
|
||||
extra: Dict[Any, Any]
|
||||
is_summary: bool
|
||||
output_field: Field
|
||||
source_expressions: List[django.db.models.expressions.Combinable]
|
||||
function: str = ...
|
||||
def __init__(self, *expressions: Any, **extra: Any) -> None: ...
|
||||
def as_sqlite(self, compiler: SQLCompiler, connection: DatabaseWrapper) -> Tuple[str, List[datetime]]: ...
|
||||
31
django-stubs/db/models/functions/datetime.pyi
Normal file
31
django-stubs/db/models/functions/datetime.pyi
Normal file
@@ -0,0 +1,31 @@
|
||||
from typing import Any, Optional
|
||||
|
||||
from django.db.models import Func, Transform
|
||||
|
||||
class TimezoneMixin:
|
||||
tzinfo: Any = ...
|
||||
def get_tzname(self) -> Optional[str]: ...
|
||||
|
||||
class Extract(TimezoneMixin, Transform): ...
|
||||
class ExtractYear(Extract): ...
|
||||
class ExtractMonth(Extract): ...
|
||||
class ExtractDay(Extract): ...
|
||||
class ExtractWeek(Extract): ...
|
||||
class ExtractWeekDay(Extract): ...
|
||||
class ExtractQuarter(Extract): ...
|
||||
class ExtractHour(Extract): ...
|
||||
class ExtractMinute(Extract): ...
|
||||
class ExtractSecond(Extract): ...
|
||||
class Now(Func): ...
|
||||
class TruncBase(TimezoneMixin, Transform): ...
|
||||
class Trunc(TruncBase): ...
|
||||
class TruncYear(TruncBase): ...
|
||||
class TruncQuarter(TruncBase): ...
|
||||
class TruncMonth(TruncBase): ...
|
||||
class TruncWeek(TruncBase): ...
|
||||
class TruncDay(TruncBase): ...
|
||||
class TruncDate(TruncBase): ...
|
||||
class TruncTime(TruncBase): ...
|
||||
class TruncHour(TruncBase): ...
|
||||
class TruncMinute(TruncBase): ...
|
||||
class TruncSecond(TruncBase): ...
|
||||
225
django-stubs/db/models/functions/text.pyi
Normal file
225
django-stubs/db/models/functions/text.pyi
Normal file
@@ -0,0 +1,225 @@
|
||||
from typing import Any, List, Optional, Tuple, Union, Dict, Callable
|
||||
|
||||
from django.db.backends.sqlite3.base import DatabaseWrapper
|
||||
from django.db.models import Func, Transform
|
||||
from django.db.models.expressions import Combinable, Expression, Value
|
||||
from django.db.models.sql.compiler import SQLCompiler
|
||||
|
||||
class BytesToCharFieldConversionMixin:
|
||||
def convert_value(
|
||||
self, value: str, expression: BytesToCharFieldConversionMixin, connection: DatabaseWrapper
|
||||
) -> str: ...
|
||||
|
||||
class Chr(Transform):
|
||||
contains_aggregate: bool
|
||||
extra: Dict[Any, Any]
|
||||
is_summary: bool
|
||||
output_field: django.db.models.fields.IntegerField
|
||||
source_expressions: List[django.db.models.expressions.Expression]
|
||||
function: str = ...
|
||||
lookup_name: str = ...
|
||||
def as_mysql(self, compiler: Any, connection: Any): ...
|
||||
def as_oracle(self, compiler: Any, connection: Any): ...
|
||||
def as_sqlite(
|
||||
self, compiler: SQLCompiler, connection: DatabaseWrapper, **extra_context: Any
|
||||
) -> Tuple[str, List[int]]: ...
|
||||
|
||||
class ConcatPair(Func):
|
||||
contains_aggregate: bool
|
||||
extra: Dict[Any, Any]
|
||||
is_summary: bool
|
||||
output_field: django.db.models.fields.CharField
|
||||
source_expressions: List[django.db.models.expressions.Combinable]
|
||||
function: str = ...
|
||||
def as_sqlite(self, compiler: SQLCompiler, connection: DatabaseWrapper) -> Tuple[str, List[str]]: ...
|
||||
def as_mysql(self, compiler: Any, connection: Any): ...
|
||||
def coalesce(self) -> ConcatPair: ...
|
||||
|
||||
class Concat(Func):
|
||||
contains_aggregate: bool
|
||||
convert_value: Callable
|
||||
extra: Dict[Any, Any]
|
||||
is_summary: bool
|
||||
output_field: Field
|
||||
source_expressions: List[django.db.models.functions.text.ConcatPair]
|
||||
function: Any = ...
|
||||
template: str = ...
|
||||
def __init__(self, *expressions: Any, **extra: Any) -> None: ...
|
||||
|
||||
class Left(Func):
|
||||
contains_aggregate: bool
|
||||
contains_over_clause: bool
|
||||
convert_value: Callable
|
||||
extra: Dict[Any, Any]
|
||||
is_summary: bool
|
||||
output_field: django.db.models.fields.CharField
|
||||
source_expressions: List[django.db.models.expressions.Combinable]
|
||||
function: str = ...
|
||||
arity: int = ...
|
||||
def __init__(self, expression: str, length: Union[Value, int], **extra: Any) -> None: ...
|
||||
def get_substr(self) -> Substr: ...
|
||||
def use_substr(
|
||||
self, compiler: SQLCompiler, connection: DatabaseWrapper, **extra_context: Any
|
||||
) -> Tuple[str, List[int]]: ...
|
||||
as_oracle: Any = ...
|
||||
as_sqlite: Any = ...
|
||||
|
||||
class Length(Transform):
|
||||
contains_aggregate: bool
|
||||
convert_value: Callable
|
||||
extra: Dict[Any, Any]
|
||||
is_summary: bool
|
||||
source_expressions: List[django.db.models.expressions.Combinable]
|
||||
function: str = ...
|
||||
lookup_name: str = ...
|
||||
output_field: Any = ...
|
||||
def as_mysql(self, compiler: Any, connection: Any): ...
|
||||
|
||||
class Lower(Transform):
|
||||
contains_aggregate: bool
|
||||
contains_column_references: bool
|
||||
contains_over_clause: bool
|
||||
convert_value: Callable
|
||||
extra: Dict[Any, Any]
|
||||
is_summary: bool
|
||||
output_field: Field
|
||||
source_expressions: List[django.db.models.expressions.Combinable]
|
||||
function: str = ...
|
||||
lookup_name: str = ...
|
||||
|
||||
class LPad(BytesToCharFieldConversionMixin, Func):
|
||||
contains_aggregate: bool
|
||||
convert_value: Callable
|
||||
extra: Dict[Any, Any]
|
||||
is_summary: bool
|
||||
output_field: django.db.models.fields.CharField
|
||||
source_expressions: List[django.db.models.expressions.Combinable]
|
||||
function: str = ...
|
||||
def __init__(self, expression: str, length: Union[Length, int], fill_text: Value = ..., **extra: Any) -> None: ...
|
||||
|
||||
class LTrim(Transform):
|
||||
contains_aggregate: bool
|
||||
convert_value: Callable
|
||||
extra: Dict[Any, Any]
|
||||
is_summary: bool
|
||||
output_field: django.db.models.fields.CharField
|
||||
source_expressions: List[django.db.models.expressions.Combinable]
|
||||
function: str = ...
|
||||
lookup_name: str = ...
|
||||
|
||||
class Ord(Transform):
|
||||
contains_aggregate: bool
|
||||
convert_value: Callable
|
||||
extra: Dict[Any, Any]
|
||||
is_summary: bool
|
||||
source_expressions: List[django.db.models.expressions.Combinable]
|
||||
function: str = ...
|
||||
lookup_name: str = ...
|
||||
output_field: Any = ...
|
||||
def as_mysql(self, compiler: Any, connection: Any, **extra_context: Any): ...
|
||||
def as_sqlite(
|
||||
self, compiler: SQLCompiler, connection: DatabaseWrapper, **extra_context: Any
|
||||
) -> Tuple[str, List[Any]]: ...
|
||||
|
||||
class Repeat(BytesToCharFieldConversionMixin, Func):
|
||||
contains_aggregate: bool
|
||||
convert_value: Callable
|
||||
extra: Dict[Any, Any]
|
||||
is_summary: bool
|
||||
output_field: django.db.models.fields.CharField
|
||||
source_expressions: List[django.db.models.expressions.Combinable]
|
||||
function: str = ...
|
||||
def __init__(self, expression: Union[Value, str], number: Union[Length, int], **extra: Any) -> None: ...
|
||||
def as_oracle(self, compiler: Any, connection: Any, **extra_context: Any): ...
|
||||
|
||||
class Replace(Func):
|
||||
contains_aggregate: bool
|
||||
contains_over_clause: bool
|
||||
convert_value: Callable
|
||||
extra: Dict[Any, Any]
|
||||
is_summary: bool
|
||||
output_field: django.db.models.fields.CharField
|
||||
source_expressions: List[django.db.models.expressions.Combinable]
|
||||
function: str = ...
|
||||
def __init__(self, expression: Combinable, text: Value, replacement: Value = ..., **extra: Any) -> None: ...
|
||||
|
||||
class Right(Left):
|
||||
contains_aggregate: bool
|
||||
contains_over_clause: bool
|
||||
convert_value: Callable
|
||||
extra: Dict[Any, Any]
|
||||
is_summary: bool
|
||||
output_field: django.db.models.fields.CharField
|
||||
source_expressions: List[django.db.models.expressions.Combinable]
|
||||
function: str = ...
|
||||
def get_substr(self) -> Substr: ...
|
||||
|
||||
class RPad(LPad):
|
||||
contains_aggregate: bool
|
||||
convert_value: Callable
|
||||
extra: Dict[Any, Any]
|
||||
is_summary: bool
|
||||
output_field: django.db.models.fields.CharField
|
||||
source_expressions: List[django.db.models.expressions.Combinable]
|
||||
function: str = ...
|
||||
|
||||
class RTrim(Transform):
|
||||
contains_aggregate: bool
|
||||
convert_value: Callable
|
||||
extra: Dict[Any, Any]
|
||||
is_summary: bool
|
||||
output_field: django.db.models.fields.CharField
|
||||
source_expressions: List[django.db.models.expressions.Combinable]
|
||||
function: str = ...
|
||||
lookup_name: str = ...
|
||||
|
||||
class StrIndex(Func):
|
||||
contains_aggregate: bool
|
||||
convert_value: Callable
|
||||
extra: Dict[Any, Any]
|
||||
is_summary: bool
|
||||
source_expressions: List[django.db.models.expressions.Combinable]
|
||||
function: str = ...
|
||||
arity: int = ...
|
||||
output_field: Any = ...
|
||||
def as_postgresql(self, compiler: Any, connection: Any): ...
|
||||
|
||||
class Substr(Func):
|
||||
contains_aggregate: bool
|
||||
contains_over_clause: bool
|
||||
convert_value: Callable
|
||||
extra: Dict[Any, Any]
|
||||
is_summary: bool
|
||||
output_field: django.db.models.fields.CharField
|
||||
source_expressions: List[django.db.models.expressions.Combinable]
|
||||
function: str = ...
|
||||
def __init__(
|
||||
self,
|
||||
expression: Union[Expression, str],
|
||||
pos: Union[Expression, int],
|
||||
length: Optional[Union[Value, int]] = ...,
|
||||
**extra: Any
|
||||
) -> None: ...
|
||||
def as_sqlite(self, compiler: SQLCompiler, connection: DatabaseWrapper) -> Tuple[str, List[Union[int, str]]]: ...
|
||||
def as_oracle(self, compiler: SQLCompiler, connection: DatabaseWrapper) -> Tuple[str, List[int]]: ...
|
||||
|
||||
class Trim(Transform):
|
||||
contains_aggregate: bool
|
||||
convert_value: Callable
|
||||
extra: Dict[Any, Any]
|
||||
is_summary: bool
|
||||
output_field: django.db.models.fields.CharField
|
||||
source_expressions: List[django.db.models.expressions.Combinable]
|
||||
function: str = ...
|
||||
lookup_name: str = ...
|
||||
|
||||
class Upper(Transform):
|
||||
contains_aggregate: bool
|
||||
contains_over_clause: bool
|
||||
convert_value: Callable
|
||||
extra: Dict[Any, Any]
|
||||
is_summary: bool
|
||||
output_field: Field
|
||||
source_expressions: List[django.db.models.expressions.Combinable]
|
||||
function: str = ...
|
||||
lookup_name: str = ...
|
||||
72
django-stubs/db/models/functions/window.pyi
Normal file
72
django-stubs/db/models/functions/window.pyi
Normal file
@@ -0,0 +1,72 @@
|
||||
from typing import Any, Optional, Dict, List
|
||||
|
||||
from django.db.models import Func
|
||||
|
||||
class CumeDist(Func):
|
||||
function: str = ...
|
||||
name: str = ...
|
||||
output_field: Any = ...
|
||||
window_compatible: bool = ...
|
||||
|
||||
class DenseRank(Func):
|
||||
extra: Dict[Any, Any]
|
||||
source_expressions: List[Any]
|
||||
function: str = ...
|
||||
name: str = ...
|
||||
output_field: Any = ...
|
||||
window_compatible: bool = ...
|
||||
|
||||
class FirstValue(Func):
|
||||
arity: int = ...
|
||||
function: str = ...
|
||||
name: str = ...
|
||||
window_compatible: bool = ...
|
||||
|
||||
class LagLeadFunction(Func):
|
||||
window_compatible: bool = ...
|
||||
def __init__(self, expression: Optional[str], offset: int = ..., default: None = ..., **extra: Any) -> Any: ...
|
||||
|
||||
class Lag(LagLeadFunction):
|
||||
function: str = ...
|
||||
name: str = ...
|
||||
|
||||
class LastValue(Func):
|
||||
arity: int = ...
|
||||
function: str = ...
|
||||
name: str = ...
|
||||
window_compatible: bool = ...
|
||||
|
||||
class Lead(LagLeadFunction):
|
||||
function: str = ...
|
||||
name: str = ...
|
||||
|
||||
class NthValue(Func):
|
||||
function: str = ...
|
||||
name: str = ...
|
||||
window_compatible: bool = ...
|
||||
def __init__(self, expression: Optional[str], nth: int = ..., **extra: Any) -> Any: ...
|
||||
|
||||
class Ntile(Func):
|
||||
function: str = ...
|
||||
name: str = ...
|
||||
output_field: Any = ...
|
||||
window_compatible: bool = ...
|
||||
def __init__(self, num_buckets: int = ..., **extra: Any) -> Any: ...
|
||||
|
||||
class PercentRank(Func):
|
||||
function: str = ...
|
||||
name: str = ...
|
||||
output_field: Any = ...
|
||||
window_compatible: bool = ...
|
||||
|
||||
class Rank(Func):
|
||||
function: str = ...
|
||||
name: str = ...
|
||||
output_field: Any = ...
|
||||
window_compatible: bool = ...
|
||||
|
||||
class RowNumber(Func):
|
||||
function: str = ...
|
||||
name: str = ...
|
||||
output_field: Any = ...
|
||||
window_compatible: bool = ...
|
||||
@@ -1,39 +1,182 @@
|
||||
from collections import OrderedDict
|
||||
from typing import Any, Dict, List, Optional, Tuple, Union
|
||||
from datetime import datetime
|
||||
from typing import Any, Dict, List, Optional, Tuple, Type, Union, Iterable
|
||||
|
||||
from django.db.models.expressions import Expression
|
||||
from django.db.models.fields import TextField
|
||||
from django.db.backends.sqlite3.base import DatabaseWrapper
|
||||
from django.db.models.expressions import Combinable, Expression, Func
|
||||
from django.db.models.functions.datetime import ExtractYear
|
||||
from django.db.models.query_utils import RegisterLookupMixin
|
||||
from django.db.models.sql.compiler import SQLCompiler
|
||||
from django.db.models.sql.query import Query
|
||||
from django.utils.datastructures import OrderedSet
|
||||
from django.utils.safestring import SafeText
|
||||
|
||||
from django.db.models import expressions, lookups
|
||||
from django.db.models.fields import TextField, related_lookups
|
||||
|
||||
class Lookup:
|
||||
lookup_name: Any = ...
|
||||
prepare_rhs: bool = ...
|
||||
can_use_none_as_rhs: bool = ...
|
||||
lhs: Any = ...
|
||||
rhs: Any = ...
|
||||
bilateral_transforms: Any = ...
|
||||
def __init__(self, lhs: Union[Expression, TextField], rhs: Any) -> None: ...
|
||||
def apply_bilateral_transforms(self, value: Expression) -> Expression: ...
|
||||
def __init__(self, lhs: Union[Expression, TextField, related_lookups.MultiColSource], rhs: Any) -> None: ...
|
||||
def apply_bilateral_transforms(self, value: Expression) -> Transform: ...
|
||||
def batch_process_rhs(
|
||||
self, compiler: SQLCompiler, connection: Any, rhs: Optional[OrderedSet] = ...
|
||||
self, compiler: SQLCompiler, connection: DatabaseWrapper, rhs: Optional[OrderedSet] = ...
|
||||
) -> Tuple[List[str], List[str]]: ...
|
||||
def get_source_expressions(self) -> List[Expression]: ...
|
||||
lhs: Any = ...
|
||||
def set_source_expressions(self, new_exprs: List[Expression]) -> None: ...
|
||||
def get_prep_lookup(self) -> Any: ...
|
||||
def get_db_prep_lookup(self, value: Union[int, str], connection: Any) -> Tuple[str, List[SafeText]]: ...
|
||||
def get_db_prep_lookup(self, value: Union[int, str], connection: DatabaseWrapper) -> Tuple[str, List[SafeText]]: ...
|
||||
def process_lhs(
|
||||
self, compiler: SQLCompiler, connection: Any, lhs: Optional[Expression] = ...
|
||||
self, compiler: SQLCompiler, connection: DatabaseWrapper, lhs: Optional[Expression] = ...
|
||||
) -> Tuple[str, List[Union[int, str]]]: ...
|
||||
def process_rhs(
|
||||
self, compiler: SQLCompiler, connection: Any
|
||||
self, compiler: SQLCompiler, connection: DatabaseWrapper
|
||||
) -> Tuple[str, Union[List[Union[int, str]], Tuple[int, int]]]: ...
|
||||
def rhs_is_direct_value(self) -> bool: ...
|
||||
def relabeled_clone(self, relabels: Union[Dict[Optional[str], str], OrderedDict]) -> Lookup: ...
|
||||
def relabeled_clone(
|
||||
self, relabels: Union[Dict[Optional[str], str], OrderedDict]
|
||||
) -> Union[BuiltinLookup, FieldGetDbPrepValueMixin]: ...
|
||||
def get_group_by_cols(self) -> List[Expression]: ...
|
||||
def as_sql(self, compiler: Any, connection: Any) -> None: ...
|
||||
def contains_aggregate(self) -> bool: ...
|
||||
def contains_over_clause(self) -> bool: ...
|
||||
@property
|
||||
def is_summary(self): ...
|
||||
|
||||
class Transform(RegisterLookupMixin, Func):
|
||||
bilateral: bool = ...
|
||||
arity: int = ...
|
||||
@property
|
||||
def lhs(self) -> Expression: ...
|
||||
def get_bilateral_transforms(self) -> List[Type[Transform]]: ...
|
||||
|
||||
class BuiltinLookup(Lookup):
|
||||
def get_rhs_op(self, connection: DatabaseWrapper, rhs: str) -> str: ...
|
||||
|
||||
class FieldGetDbPrepValueMixin:
|
||||
get_db_prep_lookup_value_is_iterable: bool = ...
|
||||
|
||||
class FieldGetDbPrepValueIterableMixin(FieldGetDbPrepValueMixin):
|
||||
get_db_prep_lookup_value_is_iterable: bool = ...
|
||||
def get_prep_lookup(self) -> Iterable[Any]: ...
|
||||
def resolve_expression_parameter(
|
||||
self, compiler: SQLCompiler, connection: DatabaseWrapper, sql: str, param: Optional[Union[Combinable, int, str]]
|
||||
) -> Tuple[str, List[None]]: ...
|
||||
|
||||
class Exact(FieldGetDbPrepValueMixin, BuiltinLookup):
|
||||
bilateral_transforms: List[Type[lookups.Transform]]
|
||||
lookup_name: str = ...
|
||||
|
||||
class IExact(BuiltinLookup):
|
||||
bilateral_transforms: List[Any]
|
||||
lookup_name: str = ...
|
||||
|
||||
class GreaterThan(FieldGetDbPrepValueMixin, BuiltinLookup):
|
||||
bilateral_transforms: List[Any]
|
||||
lookup_name: str = ...
|
||||
|
||||
class GreaterThanOrEqual(FieldGetDbPrepValueMixin, BuiltinLookup):
|
||||
bilateral_transforms: List[Any]
|
||||
lookup_name: str = ...
|
||||
|
||||
class LessThan(FieldGetDbPrepValueMixin, BuiltinLookup):
|
||||
bilateral_transforms: List[Any]
|
||||
lookup_name: str = ...
|
||||
|
||||
class LessThanOrEqual(FieldGetDbPrepValueMixin, BuiltinLookup):
|
||||
bilateral_transforms: List[Type[lookups.Transform]]
|
||||
lookup_name: str = ...
|
||||
|
||||
class IntegerFieldFloatRounding:
|
||||
rhs: Any = ...
|
||||
def get_prep_lookup(self) -> Union[Combinable, Query, int]: ...
|
||||
|
||||
class IntegerGreaterThanOrEqual(IntegerFieldFloatRounding, GreaterThanOrEqual): ...
|
||||
class IntegerLessThan(IntegerFieldFloatRounding, LessThan): ...
|
||||
|
||||
class In(FieldGetDbPrepValueIterableMixin, BuiltinLookup):
|
||||
bilateral_transforms: List[Type[lookups.Transform]]
|
||||
lookup_name: str = ...
|
||||
def get_rhs_op(self, connection: DatabaseWrapper, rhs: str) -> str: ...
|
||||
def split_parameter_list_as_sql(self, compiler: Any, connection: Any): ...
|
||||
|
||||
class PatternLookup(BuiltinLookup):
|
||||
param_pattern: str = ...
|
||||
prepare_rhs: bool = ...
|
||||
def get_rhs_op(self, connection: DatabaseWrapper, rhs: str) -> str: ...
|
||||
|
||||
class Contains(PatternLookup):
|
||||
bilateral_transforms: List[Type[lookups.Transform]]
|
||||
lookup_name: str = ...
|
||||
|
||||
class IContains(Contains):
|
||||
bilateral_transforms: List[Any]
|
||||
lookup_name: str = ...
|
||||
|
||||
class StartsWith(PatternLookup):
|
||||
bilateral_transforms: List[Any]
|
||||
lookup_name: str = ...
|
||||
param_pattern: str = ...
|
||||
|
||||
class IStartsWith(StartsWith):
|
||||
bilateral_transforms: List[Any]
|
||||
lookup_name: str = ...
|
||||
|
||||
class EndsWith(PatternLookup):
|
||||
bilateral_transforms: List[Any]
|
||||
lookup_name: str = ...
|
||||
param_pattern: str = ...
|
||||
|
||||
class IEndsWith(EndsWith):
|
||||
bilateral_transforms: List[Any]
|
||||
lookup_name: str = ...
|
||||
|
||||
class Range(FieldGetDbPrepValueIterableMixin, BuiltinLookup):
|
||||
bilateral_transforms: List[Type[lookups.Transform]]
|
||||
lookup_name: str = ...
|
||||
|
||||
class IsNull(BuiltinLookup):
|
||||
bilateral_transforms: List[Any]
|
||||
lookup_name: str = ...
|
||||
prepare_rhs: bool = ...
|
||||
|
||||
class Regex(BuiltinLookup):
|
||||
bilateral_transforms: List[Any]
|
||||
lookup_name: str = ...
|
||||
prepare_rhs: bool = ...
|
||||
|
||||
class IRegex(Regex):
|
||||
bilateral_transforms: List[Any]
|
||||
lookup_name: str = ...
|
||||
|
||||
class YearLookup(Lookup):
|
||||
def year_lookup_bounds(self, connection: DatabaseWrapper, year: int) -> List[str]: ...
|
||||
|
||||
class YearComparisonLookup(YearLookup):
|
||||
bilateral_transforms: List[Any]
|
||||
def get_rhs_op(self, connection: DatabaseWrapper, rhs: str) -> str: ...
|
||||
def get_bound(self, start: datetime, finish: datetime) -> Any: ...
|
||||
|
||||
class YearExact(YearLookup, Exact):
|
||||
bilateral_transforms: List[Any]
|
||||
lookup_name: str = ...
|
||||
|
||||
class YearGt(YearComparisonLookup):
|
||||
bilateral_transforms: List[Any]
|
||||
lookup_name: str = ...
|
||||
|
||||
class YearGte(YearComparisonLookup):
|
||||
bilateral_transforms: List[Any]
|
||||
lookup_name: str = ...
|
||||
|
||||
class YearLt(YearComparisonLookup):
|
||||
bilateral_transforms: List[Any]
|
||||
lookup_name: str = ...
|
||||
|
||||
class YearLte(YearComparisonLookup):
|
||||
bilateral_transforms: List[Any]
|
||||
lookup_name: str = ...
|
||||
|
||||
134
django-stubs/db/models/options.pyi
Normal file
134
django-stubs/db/models/options.pyi
Normal file
@@ -0,0 +1,134 @@
|
||||
from typing import Any, Callable, Dict, Iterator, List, Optional, Set, Tuple, Type, Union
|
||||
|
||||
from django.apps.config import AppConfig
|
||||
from django.contrib.auth.base_user import AbstractBaseUser
|
||||
from django.contrib.auth.models import AbstractUser, PermissionsMixin
|
||||
from django.contrib.contenttypes.fields import GenericForeignKey
|
||||
from django.contrib.postgres.fields.array import ArrayField
|
||||
from django.contrib.postgres.fields.citext import CIText
|
||||
from django.contrib.sessions.base_session import AbstractBaseSession
|
||||
from django.db.backends.sqlite3.base import DatabaseWrapper
|
||||
from django.db.models.base import Model
|
||||
from django.db.models.fields import Field
|
||||
from django.db.models.fields.mixins import FieldCacheMixin
|
||||
from django.db.models.fields.related import OneToOneField
|
||||
from django.db.models.fields.reverse_related import ForeignObjectRel
|
||||
from django.db.models.manager import Manager
|
||||
from django.db.models.query_utils import PathInfo
|
||||
from django.utils.datastructures import ImmutableList
|
||||
|
||||
PROXY_PARENTS: Any
|
||||
EMPTY_RELATION_TREE: Any
|
||||
IMMUTABLE_WARNING: str
|
||||
DEFAULT_NAMES: Any
|
||||
|
||||
def normalize_together(
|
||||
option_together: Any
|
||||
) -> Union[List[Union[Tuple[str, str], int]], Set[Tuple[str, str]], Tuple, int, str]: ...
|
||||
def make_immutable_fields_list(
|
||||
name: str, data: Union[Iterator[Any], List[Union[ArrayField, CIText]], List[Union[Field, FieldCacheMixin]]]
|
||||
) -> ImmutableList: ...
|
||||
|
||||
class Options:
|
||||
base_manager: django.db.models.manager.Manager
|
||||
concrete_fields: django.utils.datastructures.ImmutableList
|
||||
default_manager: django.db.models.manager.Manager
|
||||
fields: django.utils.datastructures.ImmutableList
|
||||
local_concrete_fields: django.utils.datastructures.ImmutableList
|
||||
managers: django.utils.datastructures.ImmutableList
|
||||
managers_map: Dict[str, django.db.models.manager.Manager]
|
||||
related_objects: django.utils.datastructures.ImmutableList
|
||||
FORWARD_PROPERTIES: Any = ...
|
||||
REVERSE_PROPERTIES: Any = ...
|
||||
default_apps: Any = ...
|
||||
local_fields: List[Field] = ...
|
||||
local_many_to_many: List[django.db.models.fields.related.ManyToManyField] = ...
|
||||
private_fields: List[Any] = ...
|
||||
local_managers: List[django.db.models.manager.Manager] = ...
|
||||
base_manager_name: None = ...
|
||||
default_manager_name: None = ...
|
||||
model_name: Optional[str] = ...
|
||||
verbose_name: Optional[str] = ...
|
||||
verbose_name_plural: Optional[str] = ...
|
||||
db_table: str = ...
|
||||
ordering: List[str] = ...
|
||||
indexes: List[Any] = ...
|
||||
unique_together: Union[List[Any], Tuple] = ...
|
||||
index_together: Union[List[Any], Tuple] = ...
|
||||
select_on_save: bool = ...
|
||||
default_permissions: Tuple[str, str, str, str] = ...
|
||||
permissions: List[Any] = ...
|
||||
object_name: Optional[str] = ...
|
||||
app_label: str = ...
|
||||
get_latest_by: None = ...
|
||||
order_with_respect_to: None = ...
|
||||
db_tablespace: str = ...
|
||||
required_db_features: List[Any] = ...
|
||||
required_db_vendor: None = ...
|
||||
meta: Optional[
|
||||
Type[
|
||||
Union[
|
||||
django.contrib.auth.base_user.AbstractBaseUser.Meta,
|
||||
django.contrib.auth.models.AbstractUser.Meta,
|
||||
django.contrib.auth.models.PermissionsMixin.Meta,
|
||||
django.contrib.sessions.base_session.AbstractBaseSession.Meta,
|
||||
]
|
||||
]
|
||||
] = ...
|
||||
pk: Optional[Field] = ...
|
||||
auto_field: Optional[django.db.models.fields.AutoField] = ...
|
||||
abstract: bool = ...
|
||||
managed: bool = ...
|
||||
proxy: bool = ...
|
||||
proxy_for_model: None = ...
|
||||
concrete_model: Optional[Type[Model]] = ...
|
||||
swappable: None = ...
|
||||
parents: collections.OrderedDict = ...
|
||||
auto_created: bool = ...
|
||||
related_fkey_lookups: List[Any] = ...
|
||||
apps: Apps = ...
|
||||
default_related_name: None = ...
|
||||
def __init__(
|
||||
self,
|
||||
meta: Optional[
|
||||
Type[Union[AbstractBaseUser.Meta, AbstractUser.Meta, PermissionsMixin.Meta, AbstractBaseSession.Meta]]
|
||||
],
|
||||
app_label: Optional[str] = ...,
|
||||
) -> None: ...
|
||||
@property
|
||||
def label(self) -> str: ...
|
||||
@property
|
||||
def label_lower(self) -> str: ...
|
||||
@property
|
||||
def app_config(self) -> AppConfig: ...
|
||||
@property
|
||||
def installed(self): ...
|
||||
model: Type[Model] = ...
|
||||
original_attrs: Dict[str, Union[List[str], Apps, str]] = ...
|
||||
def contribute_to_class(self, cls: Type[Model], name: str) -> None: ...
|
||||
def add_manager(self, manager: Manager) -> None: ...
|
||||
def add_field(self, field: Union[GenericForeignKey, Field], private: bool = ...) -> None: ...
|
||||
def setup_pk(self, field: Field) -> None: ...
|
||||
def setup_proxy(self, target: Type[Model]) -> None: ...
|
||||
def can_migrate(self, connection: Union[DatabaseWrapper, str]) -> bool: ...
|
||||
@property
|
||||
def verbose_name_raw(self) -> Any: ...
|
||||
@property
|
||||
def swapped(self) -> Optional[str]: ...
|
||||
def managers(self) -> ImmutableList: ...
|
||||
def managers_map(self) -> Dict[str, Manager]: ...
|
||||
def base_manager(self) -> Manager: ...
|
||||
def default_manager(self) -> Manager: ...
|
||||
def fields(self) -> ImmutableList: ...
|
||||
def concrete_fields(self) -> ImmutableList: ...
|
||||
def local_concrete_fields(self) -> ImmutableList: ...
|
||||
def many_to_many(self) -> ImmutableList: ...
|
||||
def related_objects(self) -> ImmutableList: ...
|
||||
def fields_map(self) -> Dict[str, ForeignObjectRel]: ...
|
||||
def get_field(self, field_name: Union[Callable, str]) -> Union[Field, mixins.FieldCacheMixin]: ...
|
||||
def get_base_chain(self, model: Type[Model]) -> List[Type[Model]]: ...
|
||||
def get_parent_list(self) -> List[Type[Model]]: ...
|
||||
def get_ancestor_link(self, ancestor: Type[Model]) -> Optional[OneToOneField]: ...
|
||||
def get_path_to_parent(self, parent: Type[Model]) -> List[PathInfo]: ...
|
||||
def get_path_from_parent(self, parent: Type[Model]) -> List[PathInfo]: ...
|
||||
def get_fields(self, include_parents: bool = ..., include_hidden: bool = ...) -> ImmutableList: ...
|
||||
34
django-stubs/db/models/signals.pyi
Normal file
34
django-stubs/db/models/signals.pyi
Normal file
@@ -0,0 +1,34 @@
|
||||
from typing import Any, Callable, Optional, Type, Union
|
||||
|
||||
from django.apps.registry import Apps
|
||||
from django.db.models.base import Model
|
||||
from django.dispatch import Signal
|
||||
|
||||
class_prepared: Any
|
||||
|
||||
class ModelSignal(Signal):
|
||||
def connect(
|
||||
self,
|
||||
receiver: Callable,
|
||||
sender: Optional[Union[Type[Model], str]] = ...,
|
||||
weak: bool = ...,
|
||||
dispatch_uid: None = ...,
|
||||
apps: Optional[Apps] = ...,
|
||||
) -> None: ...
|
||||
def disconnect(
|
||||
self,
|
||||
receiver: Callable = ...,
|
||||
sender: Optional[Union[Type[Model], str]] = ...,
|
||||
dispatch_uid: None = ...,
|
||||
apps: Optional[Apps] = ...,
|
||||
) -> Optional[bool]: ...
|
||||
|
||||
pre_init: Any
|
||||
post_init: Any
|
||||
pre_save: Any
|
||||
post_save: Any
|
||||
pre_delete: Any
|
||||
post_delete: Any
|
||||
m2m_changed: Any
|
||||
pre_migrate: Any
|
||||
post_migrate: Any
|
||||
@@ -32,7 +32,7 @@ class DeleteQuery(Query):
|
||||
high_mark: None
|
||||
low_mark: int
|
||||
max_depth: int
|
||||
model: Type[django.db.models.base.Model]
|
||||
model: Type[Model]
|
||||
order_by: Tuple
|
||||
select: Tuple
|
||||
select_for_update: bool
|
||||
@@ -79,12 +79,10 @@ class UpdateQuery(Query):
|
||||
high_mark: None
|
||||
low_mark: int
|
||||
max_depth: int
|
||||
model: Type[django.db.models.base.Model]
|
||||
model: Type[Model]
|
||||
order_by: Tuple
|
||||
related_ids: Optional[List[int]]
|
||||
related_updates: Dict[
|
||||
Type[django.db.models.base.Model], List[Tuple[django.db.models.fields.Field, None, Union[int, str]]]
|
||||
]
|
||||
related_updates: Dict[Type[Model], List[Tuple[Field, None, Union[int, str]]]]
|
||||
select: Tuple
|
||||
select_for_update: bool
|
||||
select_for_update_nowait: bool
|
||||
@@ -96,13 +94,7 @@ class UpdateQuery(Query):
|
||||
subquery: bool
|
||||
table_map: Dict[str, List[str]]
|
||||
used_aliases: Set[str]
|
||||
values: List[
|
||||
Tuple[
|
||||
django.db.models.fields.Field,
|
||||
Optional[Type[django.db.models.base.Model]],
|
||||
Union[django.db.models.expressions.Case, uuid.UUID],
|
||||
]
|
||||
]
|
||||
values: List[Tuple[Field, Optional[Type[Model]], Union[django.db.models.expressions.Case, uuid.UUID]]]
|
||||
values_select: Tuple
|
||||
where_class: Type[django.db.models.sql.where.WhereNode]
|
||||
compiler: str = ...
|
||||
@@ -139,7 +131,7 @@ class InsertQuery(Query):
|
||||
high_mark: None
|
||||
low_mark: int
|
||||
max_depth: int
|
||||
model: Type[django.db.models.base.Model]
|
||||
model: Type[Model]
|
||||
order_by: Tuple
|
||||
select: Tuple
|
||||
select_for_update: bool
|
||||
@@ -156,11 +148,9 @@ class InsertQuery(Query):
|
||||
where_class: Type[django.db.models.sql.where.WhereNode]
|
||||
compiler: str = ...
|
||||
fields: Union[
|
||||
List[django.db.models.fields.DateTimeCheckMixin],
|
||||
List[django.db.models.fields.Field],
|
||||
django.utils.datastructures.ImmutableList,
|
||||
List[django.db.models.fields.DateTimeCheckMixin], List[Field], django.utils.datastructures.ImmutableList
|
||||
] = ...
|
||||
objs: List[django.db.models.base.Model] = ...
|
||||
objs: List[Model] = ...
|
||||
def __init__(self, *args: Any, **kwargs: Any) -> None: ...
|
||||
raw: bool = ...
|
||||
def insert_values(
|
||||
@@ -191,7 +181,7 @@ class AggregateQuery(Query):
|
||||
high_mark: None
|
||||
low_mark: int
|
||||
max_depth: int
|
||||
model: Type[django.db.models.base.Model]
|
||||
model: Type[Model]
|
||||
order_by: Tuple
|
||||
select: Tuple
|
||||
select_for_update: bool
|
||||
|
||||
5
django-stubs/db/models/utils.pyi
Normal file
5
django-stubs/db/models/utils.pyi
Normal file
@@ -0,0 +1,5 @@
|
||||
from typing import Any, Optional, Tuple, Type, Union
|
||||
|
||||
from django.db.models.base import Model
|
||||
|
||||
def make_model_tuple(model: Union[Type[Model], str]) -> Tuple[str, str]: ...
|
||||
@@ -207,7 +207,7 @@ def inlineformset_factory(
|
||||
class InlineForeignKeyField(Field):
|
||||
disabled: bool
|
||||
help_text: str
|
||||
initial: Optional[Union[django.db.models.base.Model, int, str]]
|
||||
initial: Optional[Union[Model, int, str]]
|
||||
label: Optional[str]
|
||||
label_suffix: None
|
||||
localize: bool
|
||||
@@ -215,7 +215,7 @@ class InlineForeignKeyField(Field):
|
||||
show_hidden_initial: bool
|
||||
widget: Any = ...
|
||||
default_error_messages: Any = ...
|
||||
parent_instance: django.db.models.base.Model = ...
|
||||
parent_instance: Model = ...
|
||||
pk_field: bool = ...
|
||||
to_field: Optional[str] = ...
|
||||
def __init__(
|
||||
|
||||
Reference in New Issue
Block a user