mirror of
https://github.com/davidhalter/django-stubs.git
synced 2026-05-25 17:58:41 +08:00
initial commit
This commit is contained in:
@@ -0,0 +1,66 @@
|
||||
from django.db.backends.sqlite3.base import DatabaseWrapper
|
||||
from django.db.models.fields import Field
|
||||
from django.db.models.query_utils import Q
|
||||
from django.db.models.sql.compiler import SQLCompiler
|
||||
from django.db.models.sql.query import Query
|
||||
from typing import (
|
||||
Any,
|
||||
Dict,
|
||||
List,
|
||||
Optional,
|
||||
)
|
||||
|
||||
|
||||
class Aggregate:
|
||||
def __init__(self, *args, filter = ..., **kwargs) -> None: ...
|
||||
def _get_repr_options(self) -> Dict[str, Q]: ...
|
||||
def as_sql(
|
||||
self,
|
||||
compiler: SQLCompiler,
|
||||
connection: DatabaseWrapper,
|
||||
**extra_context
|
||||
) -> Any: ...
|
||||
@property
|
||||
def default_alias(self) -> str: ...
|
||||
def get_group_by_cols(self) -> List[Any]: ...
|
||||
def get_source_expressions(self) -> Any: ...
|
||||
def get_source_fields(self) -> Any: ...
|
||||
def resolve_expression(
|
||||
self,
|
||||
query: Query = ...,
|
||||
allow_joins: bool = ...,
|
||||
reuse: None = ...,
|
||||
summarize: bool = ...,
|
||||
for_save: bool = ...
|
||||
) -> Aggregate: ...
|
||||
def set_source_expressions(self, exprs: Any) -> None: ...
|
||||
|
||||
|
||||
class Avg:
|
||||
def _resolve_output_field(self) -> Field: ...
|
||||
|
||||
|
||||
class Count:
|
||||
def __init__(
|
||||
self,
|
||||
expression: str,
|
||||
distinct: bool = ...,
|
||||
filter: Optional[Q] = ...,
|
||||
**extra
|
||||
) -> None: ...
|
||||
def _get_repr_options(self) -> Dict[str, bool]: ...
|
||||
def convert_value(
|
||||
self,
|
||||
value: Optional[int],
|
||||
expression: Count,
|
||||
connection: DatabaseWrapper
|
||||
) -> int: ...
|
||||
|
||||
|
||||
class StdDev:
|
||||
def __init__(self, expression: str, sample: bool = ..., **extra) -> None: ...
|
||||
|
||||
|
||||
class Variance:
|
||||
def __init__(self, expression: str, sample: bool = ..., **extra) -> None: ...
|
||||
def _get_repr_options(self) -> Dict[str, bool]: ...
|
||||
@@ -0,0 +1,18 @@
|
||||
from typing import (
|
||||
Any,
|
||||
Dict,
|
||||
List,
|
||||
)
|
||||
|
||||
|
||||
class Model:
|
||||
def __eq__(self, other: object) -> bool: ...
|
||||
def __getstate__(self) -> Dict[str, Any]: ...
|
||||
def __hash__(self) -> int: ...
|
||||
def __init__(self, *args, **kwargs) -> None: ...
|
||||
def __reduce__(self) -> Any: ...
|
||||
def __repr__(self) -> str: ...
|
||||
def __setstate__(self, state: Dict[str, Any]) -> None: ...
|
||||
def __str__(self) -> str: ...
|
||||
@classmethod
|
||||
def _check_column_name_clashes(cls) -> List[Any]: ...
|
||||
@@ -0,0 +1,94 @@
|
||||
from django.db.models.base import Model
|
||||
from django.db.models.fields.related import ForeignKey
|
||||
from django.db.models.fields.reverse_related import ManyToOneRel
|
||||
from django.db.models.options import Options
|
||||
from django.db.models.query import QuerySet
|
||||
from typing import (
|
||||
Any,
|
||||
Callable,
|
||||
Dict,
|
||||
Iterator,
|
||||
List,
|
||||
Optional,
|
||||
Tuple,
|
||||
Union,
|
||||
)
|
||||
|
||||
|
||||
def CASCADE(
|
||||
collector: Collector,
|
||||
field: ForeignKey,
|
||||
sub_objs: QuerySet,
|
||||
using: str
|
||||
) -> None: ...
|
||||
|
||||
|
||||
def SET(value: int) -> Callable: ...
|
||||
|
||||
|
||||
def SET_DEFAULT(
|
||||
collector: Collector,
|
||||
field: ForeignKey,
|
||||
sub_objs: QuerySet,
|
||||
using: str
|
||||
) -> None: ...
|
||||
|
||||
|
||||
def SET_NULL(
|
||||
collector: Collector,
|
||||
field: ForeignKey,
|
||||
sub_objs: QuerySet,
|
||||
using: str
|
||||
) -> None: ...
|
||||
|
||||
|
||||
def get_candidate_relations_to_delete(opts: Options) -> Iterator[Any]: ...
|
||||
|
||||
|
||||
class Collector:
|
||||
def __init__(self, using: str) -> None: ...
|
||||
def add(
|
||||
self,
|
||||
objs: Any,
|
||||
source: Any = ...,
|
||||
nullable: bool = ...,
|
||||
reverse_dependency: bool = ...
|
||||
) -> Any: ...
|
||||
def add_field_update(
|
||||
self,
|
||||
field: ForeignKey,
|
||||
value: Optional[int],
|
||||
objs: QuerySet
|
||||
) -> None: ...
|
||||
def can_fast_delete(
|
||||
self,
|
||||
objs: Any,
|
||||
from_field: Optional[ForeignKey] = ...
|
||||
) -> bool: ...
|
||||
def collect(
|
||||
self,
|
||||
objs: Any,
|
||||
source: Any = ...,
|
||||
nullable: bool = ...,
|
||||
collect_related: bool = ...,
|
||||
source_attr: Optional[str] = ...,
|
||||
reverse_dependency: bool = ...,
|
||||
keep_parents: bool = ...
|
||||
) -> None: ...
|
||||
def delete(self) -> Union[Tuple[int, Dict[Any, Any]], Tuple[int, Dict[str, int]]]: ...
|
||||
def get_del_batches(self, objs: Any, field: ForeignKey) -> Any: ...
|
||||
def instances_with_model(self) -> Iterator[Any]: ...
|
||||
def related_objects(
|
||||
self,
|
||||
related: ManyToOneRel,
|
||||
objs: Any
|
||||
) -> QuerySet: ...
|
||||
def sort(self) -> None: ...
|
||||
|
||||
|
||||
class ProtectedError:
|
||||
def __init__(
|
||||
self,
|
||||
msg: str,
|
||||
protected_objects: Union[QuerySet, List[Model]]
|
||||
) -> None: ...
|
||||
@@ -0,0 +1,335 @@
|
||||
from collections import OrderedDict
|
||||
from datetime import (
|
||||
datetime,
|
||||
timedelta,
|
||||
)
|
||||
from django.db.backends.sqlite3.base import DatabaseWrapper
|
||||
from django.db.models.aggregates import Count
|
||||
from django.db.models.fields import Field
|
||||
from django.db.models.fields.related import ForeignKey
|
||||
from django.db.models.fields.reverse_related import ForeignObjectRel
|
||||
from django.db.models.functions.datetime import Trunc
|
||||
from django.db.models.functions.text import BytesToCharFieldConversionMixin
|
||||
from django.db.models.query_utils import Q
|
||||
from django.db.models.sql.compiler import SQLCompiler
|
||||
from django.db.models.sql.query import Query
|
||||
from django.db.models.sql.where import WhereNode
|
||||
from typing import (
|
||||
Any,
|
||||
Callable,
|
||||
Dict,
|
||||
Iterator,
|
||||
List,
|
||||
Optional,
|
||||
Set,
|
||||
Tuple,
|
||||
Union,
|
||||
)
|
||||
|
||||
|
||||
class BaseExpression:
|
||||
def __eq__(self, other: Expression) -> bool: ...
|
||||
def __getstate__(self) -> Dict[str, Any]: ...
|
||||
def __hash__(self) -> int: ...
|
||||
def __init__(
|
||||
self,
|
||||
output_field: Optional[Union[str, ForeignObjectRel, Field]] = ...
|
||||
) -> None: ...
|
||||
@staticmethod
|
||||
def _convert_value_noop(
|
||||
value: str,
|
||||
expression: BytesToCharFieldConversionMixin,
|
||||
connection: DatabaseWrapper
|
||||
) -> str: ...
|
||||
@cached_property
|
||||
def _output_field_or_none(self) -> Any: ...
|
||||
def _parse_expressions(self, *expressions) -> Any: ...
|
||||
def _prepare(self, field: Any) -> Expression: ...
|
||||
def _resolve_output_field(self) -> Any: ...
|
||||
def asc(self, **kwargs) -> OrderBy: ...
|
||||
@cached_property
|
||||
def contains_aggregate(self) -> bool: ...
|
||||
@cached_property
|
||||
def contains_column_references(self) -> bool: ...
|
||||
@cached_property
|
||||
def contains_over_clause(self) -> bool: ...
|
||||
@cached_property
|
||||
def convert_value(self) -> Callable: ...
|
||||
def copy(self) -> BaseExpression: ...
|
||||
def desc(self, **kwargs) -> OrderBy: ...
|
||||
@property
|
||||
def field(self) -> Any: ...
|
||||
def flatten(self) -> Iterator[Union[Value, Func]]: ...
|
||||
def get_db_converters(self, connection: DatabaseWrapper) -> List[Callable]: ...
|
||||
def get_group_by_cols(
|
||||
self
|
||||
) -> Union[List[CombinedExpression], List[Trunc], List[Col]]: ...
|
||||
def get_lookup(self, lookup: str) -> Any: ...
|
||||
def get_source_expressions(self) -> List[Any]: ...
|
||||
def get_source_fields(self) -> Any: ...
|
||||
def get_transform(self, name: str) -> Any: ...
|
||||
@cached_property
|
||||
def output_field(self) -> Field: ...
|
||||
def relabeled_clone(
|
||||
self,
|
||||
change_map: Union[OrderedDict, Dict[Union[str, None], str]]
|
||||
) -> Expression: ...
|
||||
def resolve_expression(
|
||||
self,
|
||||
query: Query = ...,
|
||||
allow_joins: bool = ...,
|
||||
reuse: Optional[Set[str]] = ...,
|
||||
summarize: bool = ...,
|
||||
for_save: bool = ...
|
||||
) -> BaseExpression: ...
|
||||
def set_source_expressions(self, exprs: List[Any]) -> None: ...
|
||||
|
||||
|
||||
class Case:
|
||||
def __init__(self, *cases, default = ..., output_field = ..., **extra) -> None: ...
|
||||
def __repr__(self) -> str: ...
|
||||
def as_sql(
|
||||
self,
|
||||
compiler: SQLCompiler,
|
||||
connection: DatabaseWrapper,
|
||||
template: None = ...,
|
||||
case_joiner: None = ...,
|
||||
**extra_context
|
||||
) -> Any: ...
|
||||
def copy(self) -> Case: ...
|
||||
def get_source_expressions(self) -> List[Expression]: ...
|
||||
def resolve_expression(
|
||||
self,
|
||||
query: Query = ...,
|
||||
allow_joins: bool = ...,
|
||||
reuse: None = ...,
|
||||
summarize: bool = ...,
|
||||
for_save: bool = ...
|
||||
) -> Case: ...
|
||||
def set_source_expressions(self, exprs: List[Expression]) -> None: ...
|
||||
|
||||
|
||||
class Col:
|
||||
def __init__(self, alias: str, target: Field, output_field: Any = ...) -> None: ...
|
||||
def __repr__(self) -> str: ...
|
||||
def as_sql(
|
||||
self,
|
||||
compiler: SQLCompiler,
|
||||
connection: DatabaseWrapper
|
||||
) -> Tuple[str, List[Any]]: ...
|
||||
def get_db_converters(self, connection: DatabaseWrapper) -> List[Callable]: ...
|
||||
def get_group_by_cols(self) -> List[Col]: ...
|
||||
def relabeled_clone(
|
||||
self,
|
||||
relabels: Union[OrderedDict, Dict[str, str]]
|
||||
) -> Col: ...
|
||||
|
||||
|
||||
class Combinable:
|
||||
def __add__(self, other: Any) -> CombinedExpression: ...
|
||||
def __mod__(self, other: int) -> CombinedExpression: ...
|
||||
def __mul__(
|
||||
self,
|
||||
other: Union[int, F, Value]
|
||||
) -> CombinedExpression: ...
|
||||
def __radd__(
|
||||
self,
|
||||
other: Optional[Union[float, int, timedelta]]
|
||||
) -> CombinedExpression: ...
|
||||
def __rand__(self, other: object): ...
|
||||
def __rmul__(self, other: float) -> CombinedExpression: ...
|
||||
def __ror__(self, other: object): ...
|
||||
def __rsub__(self, other: Union[float, int]) -> CombinedExpression: ...
|
||||
def __rtruediv__(self, other: int) -> CombinedExpression: ...
|
||||
def __sub__(
|
||||
self,
|
||||
other: Union[float, timedelta, int, F]
|
||||
) -> CombinedExpression: ...
|
||||
def __truediv__(
|
||||
self,
|
||||
other: Union[int, Count]
|
||||
) -> CombinedExpression: ...
|
||||
def _combine(self, other: Any, connector: str, reversed: bool) -> CombinedExpression: ...
|
||||
def bitleftshift(self, other: int) -> CombinedExpression: ...
|
||||
|
||||
|
||||
class CombinedExpression:
|
||||
def __init__(
|
||||
self,
|
||||
lhs: Combinable,
|
||||
connector: str,
|
||||
rhs: Combinable,
|
||||
output_field: None = ...
|
||||
) -> None: ...
|
||||
def __str__(self) -> str: ...
|
||||
def as_sql(
|
||||
self,
|
||||
compiler: SQLCompiler,
|
||||
connection: DatabaseWrapper
|
||||
) -> Union[Tuple[str, List[datetime]], Tuple[str, List[int]], Tuple[str, List[Any]], Tuple[str, List[float]]]: ...
|
||||
def get_source_expressions(self) -> Any: ...
|
||||
def resolve_expression(
|
||||
self,
|
||||
query: Query = ...,
|
||||
allow_joins: bool = ...,
|
||||
reuse: Optional[Set[str]] = ...,
|
||||
summarize: bool = ...,
|
||||
for_save: bool = ...
|
||||
) -> CombinedExpression: ...
|
||||
def set_source_expressions(self, exprs: Any) -> None: ...
|
||||
|
||||
|
||||
class DurationExpression:
|
||||
def as_sql(
|
||||
self,
|
||||
compiler: SQLCompiler,
|
||||
connection: DatabaseWrapper
|
||||
) -> Tuple[str, List[Any]]: ...
|
||||
def compile(
|
||||
self,
|
||||
side: Expression,
|
||||
compiler: SQLCompiler,
|
||||
connection: DatabaseWrapper
|
||||
) -> Union[Tuple[str, List[datetime]], Tuple[str, List[Any]]]: ...
|
||||
|
||||
|
||||
class DurationValue:
|
||||
def as_sql(
|
||||
self,
|
||||
compiler: SQLCompiler,
|
||||
connection: DatabaseWrapper
|
||||
) -> Tuple[str, List[Any]]: ...
|
||||
|
||||
|
||||
class Exists:
|
||||
def __init__(self, *args, negated = ..., **kwargs) -> None: ...
|
||||
def as_sql(
|
||||
self,
|
||||
compiler: SQLCompiler,
|
||||
connection: DatabaseWrapper,
|
||||
template: None = ...,
|
||||
**extra_context
|
||||
) -> Union[Tuple[str, Tuple[int]], Tuple[str, Tuple]]: ...
|
||||
def resolve_expression(
|
||||
self,
|
||||
query: Query = ...,
|
||||
*args,
|
||||
**kwargs
|
||||
) -> Exists: ...
|
||||
|
||||
|
||||
class ExpressionList:
|
||||
def __init__(self, *expressions, **extra): ...
|
||||
|
||||
|
||||
class ExpressionWrapper:
|
||||
def __init__(
|
||||
self,
|
||||
expression: Union[Q, CombinedExpression],
|
||||
output_field: Field
|
||||
) -> None: ...
|
||||
def __repr__(self) -> str: ...
|
||||
def as_sql(
|
||||
self,
|
||||
compiler: SQLCompiler,
|
||||
connection: DatabaseWrapper
|
||||
) -> Union[Tuple[str, List[int]], Tuple[str, List[Any]]]: ...
|
||||
def get_source_expressions(
|
||||
self
|
||||
) -> Union[List[Q], List[CombinedExpression], List[WhereNode]]: ...
|
||||
def set_source_expressions(
|
||||
self,
|
||||
exprs: Union[List[WhereNode], List[CombinedExpression]]
|
||||
) -> None: ...
|
||||
|
||||
|
||||
class F:
|
||||
def __eq__(self, other: F) -> bool: ...
|
||||
def __hash__(self) -> int: ...
|
||||
def __init__(self, name: Union[str, OuterRef]) -> None: ...
|
||||
def __repr__(self) -> str: ...
|
||||
def asc(self, **kwargs) -> OrderBy: ...
|
||||
def desc(self, **kwargs) -> OrderBy: ...
|
||||
def resolve_expression(
|
||||
self,
|
||||
query: Query = ...,
|
||||
allow_joins: bool = ...,
|
||||
reuse: Optional[Set[str]] = ...,
|
||||
summarize: bool = ...,
|
||||
for_save: bool = ...
|
||||
) -> Expression: ...
|
||||
|
||||
|
||||
class Func:
|
||||
def __init__(self, *expressions, output_field = ..., **extra) -> None: ...
|
||||
def __repr__(self) -> str: ...
|
||||
def _get_repr_options(self) -> Dict[Any, Any]: ...
|
||||
def as_sql(
|
||||
self,
|
||||
compiler: SQLCompiler,
|
||||
connection: DatabaseWrapper,
|
||||
function: Optional[str] = ...,
|
||||
template: Optional[str] = ...,
|
||||
arg_joiner: Optional[str] = ...,
|
||||
**extra_context
|
||||
) -> Any: ...
|
||||
def copy(self) -> Func: ...
|
||||
def get_source_expressions(self) -> Any: ...
|
||||
def resolve_expression(
|
||||
self,
|
||||
query: Query = ...,
|
||||
allow_joins: bool = ...,
|
||||
reuse: None = ...,
|
||||
summarize: bool = ...,
|
||||
for_save: bool = ...
|
||||
) -> Func: ...
|
||||
def set_source_expressions(self, exprs: Any) -> None: ...
|
||||
|
||||
|
||||
class OrderBy:
|
||||
def __init__(
|
||||
self,
|
||||
expression: Combinable,
|
||||
descending: bool = ...,
|
||||
nulls_first: bool = ...,
|
||||
nulls_last: bool = ...
|
||||
) -> None: ...
|
||||
def __repr__(self) -> str: ...
|
||||
def as_sql(
|
||||
self,
|
||||
compiler: SQLCompiler,
|
||||
connection: DatabaseWrapper,
|
||||
template: Optional[str] = ...,
|
||||
**extra_context
|
||||
) -> Union[Tuple[str, List[int]], Tuple[str, Tuple], Tuple[str, List[Any]]]: ...
|
||||
def as_sqlite(
|
||||
self,
|
||||
compiler: SQLCompiler,
|
||||
connection: DatabaseWrapper
|
||||
) -> Any: ...
|
||||
def get_source_expressions(self) -> Any: ...
|
||||
def reverse_ordering(self) -> OrderBy: ...
|
||||
def set_source_expressions(self, exprs: Any) -> None: ...
|
||||
|
||||
|
||||
class OuterRef:
|
||||
def _prepare(
|
||||
self,
|
||||
output_field: ForeignKey = ...
|
||||
) -> OuterRef: ...
|
||||
def resolve_expression(
|
||||
self,
|
||||
query: Query = ...,
|
||||
allow_joins: bool = ...,
|
||||
reuse: None = ...,
|
||||
summarize: bool = ...,
|
||||
for_save: bool = ...
|
||||
) -> F: ...
|
||||
|
||||
|
||||
class Random:
|
||||
def __repr__(self) -> str: ...
|
||||
|
||||
|
||||
class RawSQL:
|
||||
def __init__(self, sql: str, params: List[int], output_field: None = ...) -> None: ...
|
||||
@@ -0,0 +1,117 @@
|
||||
from datetime import date
|
||||
from django.core.checks.messages import (
|
||||
Error,
|
||||
Warning,
|
||||
)
|
||||
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 typing import (
|
||||
Any,
|
||||
List,
|
||||
Optional,
|
||||
Union,
|
||||
)
|
||||
|
||||
|
||||
class AutoField:
|
||||
def __init__(self, *args, **kwargs) -> None: ...
|
||||
def _check_primary_key(self) -> List[Any]: ...
|
||||
def check(self, **kwargs) -> List[Any]: ...
|
||||
def contribute_to_class(self, cls: Any, name: str, **kwargs) -> None: ...
|
||||
def deconstruct(self) -> Any: ...
|
||||
def formfield(self, **kwargs) -> None: ...
|
||||
def get_db_prep_value(
|
||||
self,
|
||||
value: Union[str, int],
|
||||
connection: DatabaseWrapper,
|
||||
prepared: bool = ...
|
||||
) -> Union[str, int]: ...
|
||||
def get_internal_type(self) -> str: ...
|
||||
def get_prep_value(self, value: Any) -> Optional[Union[int, OuterRef]]: ...
|
||||
def rel_db_type(self, connection: DatabaseWrapper) -> str: ...
|
||||
def to_python(self, value: Optional[Union[str, int]]) -> Optional[int]: ...
|
||||
def validate(self, value: int, model_instance: Model) -> None: ...
|
||||
|
||||
|
||||
class BigAutoField:
|
||||
def get_internal_type(self) -> str: ...
|
||||
def rel_db_type(self, connection: DatabaseWrapper) -> str: ...
|
||||
|
||||
|
||||
class BigIntegerField:
|
||||
def formfield(self, **kwargs) -> IntegerField: ...
|
||||
def get_internal_type(self) -> str: ...
|
||||
|
||||
|
||||
class BinaryField:
|
||||
def __init__(self, *args, **kwargs) -> None: ...
|
||||
def deconstruct(self) -> Any: ...
|
||||
def get_db_prep_value(
|
||||
self,
|
||||
value: Optional[Union[bytes, memoryview]],
|
||||
connection: DatabaseWrapper,
|
||||
prepared: bool = ...
|
||||
) -> Optional[memoryview]: ...
|
||||
def get_default(self) -> Optional[bytes]: ...
|
||||
def get_internal_type(self) -> str: ...
|
||||
def get_placeholder(
|
||||
self,
|
||||
value: Optional[memoryview],
|
||||
compiler: SQLCompiler,
|
||||
connection: DatabaseWrapper
|
||||
) -> str: ...
|
||||
def to_python(self, value: Optional[Union[str, bytes]]) -> Optional[Union[bytes, memoryview]]: ...
|
||||
|
||||
|
||||
class BooleanField:
|
||||
def formfield(self, **kwargs) -> BooleanField: ...
|
||||
def get_internal_type(self) -> str: ...
|
||||
def get_prep_value(self, value: Optional[Union[str, int]]) -> Optional[bool]: ...
|
||||
def to_python(self, value: Optional[Union[str, int]]) -> bool: ...
|
||||
|
||||
|
||||
class CharField:
|
||||
def __init__(self, *args, **kwargs) -> None: ...
|
||||
def _check_max_length_attribute(self, **kwargs) -> List[Error]: ...
|
||||
def check(self, **kwargs) -> List[Error]: ...
|
||||
def formfield(self, **kwargs) -> Union[CharField, TypedChoiceField]: ...
|
||||
def get_internal_type(self) -> str: ...
|
||||
def get_prep_value(self, value: Any) -> object: ...
|
||||
def to_python(self, value: Optional[Union[int, str, Model]]) -> Optional[str]: ...
|
||||
|
||||
|
||||
class DateField:
|
||||
def __init__(
|
||||
self,
|
||||
verbose_name: Optional[str] = ...,
|
||||
name: Optional[str] = ...,
|
||||
auto_now: bool = ...,
|
||||
auto_now_add: bool = ...,
|
||||
**kwargs
|
||||
) -> None: ...
|
||||
def _check_fix_default_value(self) -> List[Warning]: ...
|
||||
def contribute_to_class(self, cls: Any, name: str, **kwargs) -> None: ...
|
||||
def deconstruct(self) -> Any: ...
|
||||
def formfield(
|
||||
self,
|
||||
**kwargs
|
||||
) -> Union[SplitDateTimeField, BaseTemporalField]: ...
|
||||
def get_db_prep_value(
|
||||
self,
|
||||
value: Optional[Union[date, str]],
|
||||
connection: DatabaseWrapper,
|
||||
prepared: bool = ...
|
||||
) -> Optional[str]: ...
|
||||
def get_internal_type(self) -> str: ...
|
||||
def get_prep_value(self, value: Optional[Union[str, date]]) -> Optional[date]: ...
|
||||
def pre_save(self, model_instance: Model, add: bool) -> Optional[date]: ...
|
||||
@@ -0,0 +1,92 @@
|
||||
from django.core.checks.messages import Error
|
||||
from django.core.files.base import (
|
||||
ContentFile,
|
||||
File,
|
||||
)
|
||||
from django.core.files.storage import Storage
|
||||
from django.core.files.uploadedfile import (
|
||||
InMemoryUploadedFile,
|
||||
SimpleUploadedFile,
|
||||
UploadedFile,
|
||||
)
|
||||
from django.db.models.base import Model
|
||||
from django.forms.fields import FileField
|
||||
from typing import (
|
||||
Any,
|
||||
Callable,
|
||||
Dict,
|
||||
List,
|
||||
Optional,
|
||||
Tuple,
|
||||
Union,
|
||||
)
|
||||
|
||||
|
||||
class FieldFile:
|
||||
def __eq__(self, other: Optional[Union[Tuple, str, FieldFile]]) -> bool: ...
|
||||
def __getstate__(self) -> Dict[str, Union[str, bool, None]]: ...
|
||||
def __init__(
|
||||
self,
|
||||
instance: Model,
|
||||
field: FileField,
|
||||
name: Optional[str]
|
||||
) -> None: ...
|
||||
def _del_file(self) -> None: ...
|
||||
def _get_file(self) -> File: ...
|
||||
def _require_file(self) -> None: ...
|
||||
def _set_file(self, file: Optional[File]) -> None: ...
|
||||
def close(self) -> None: ...
|
||||
def delete(self, save: bool = ...) -> None: ...
|
||||
def open(self, mode: str = ...) -> FieldFile: ...
|
||||
def save(
|
||||
self,
|
||||
name: str,
|
||||
content: Union[ContentFile, UploadedFile],
|
||||
save: bool = ...
|
||||
) -> None: ...
|
||||
@property
|
||||
def url(self) -> str: ...
|
||||
|
||||
|
||||
class FileDescriptor:
|
||||
def __get__(
|
||||
self,
|
||||
instance: Any,
|
||||
cls: Any = ...
|
||||
) -> Union[FileDescriptor, FieldFile]: ...
|
||||
def __init__(self, field: FileField) -> None: ...
|
||||
def __set__(
|
||||
self,
|
||||
instance: Model,
|
||||
value: Optional[Union[str, FieldFile, InMemoryUploadedFile]]
|
||||
) -> None: ...
|
||||
|
||||
|
||||
class FileField:
|
||||
def __init__(
|
||||
self,
|
||||
verbose_name: Optional[str] = ...,
|
||||
name: None = ...,
|
||||
upload_to: Union[str, Callable] = ...,
|
||||
storage: Optional[Storage] = ...,
|
||||
**kwargs
|
||||
) -> None: ...
|
||||
def _check_primary_key(self) -> List[Error]: ...
|
||||
def _check_upload_to(self) -> List[Any]: ...
|
||||
def check(self, **kwargs) -> List[Any]: ...
|
||||
def contribute_to_class(self, cls: Any, name: str, **kwargs) -> None: ...
|
||||
def deconstruct(self) -> Any: ...
|
||||
def formfield(self, **kwargs) -> FileField: ...
|
||||
def generate_filename(self, instance: Any, filename: str) -> str: ...
|
||||
def get_internal_type(self) -> str: ...
|
||||
def get_prep_value(self, value: FieldFile) -> str: ...
|
||||
def pre_save(
|
||||
self,
|
||||
model_instance: Model,
|
||||
add: bool
|
||||
) -> FieldFile: ...
|
||||
def save_form_data(
|
||||
self,
|
||||
instance: Model,
|
||||
data: Optional[Union[bool, FieldFile, SimpleUploadedFile]]
|
||||
) -> None: ...
|
||||
@@ -0,0 +1,9 @@
|
||||
from django.db.models.base import Model
|
||||
from typing import Any
|
||||
|
||||
|
||||
class FieldCacheMixin:
|
||||
def delete_cached_value(self, instance: Model) -> None: ...
|
||||
def get_cached_value(self, instance: Model, default: object = ...) -> Any: ...
|
||||
def is_cached(self, instance: Model) -> bool: ...
|
||||
def set_cached_value(self, instance: Model, value: Any) -> None: ...
|
||||
@@ -0,0 +1,2 @@
|
||||
class OrderWrt:
|
||||
def __init__(self, *args, **kwargs) -> None: ...
|
||||
@@ -0,0 +1,101 @@
|
||||
from django.core.checks.messages import (
|
||||
Error,
|
||||
Warning,
|
||||
)
|
||||
from django.db.backends.sqlite3.base import DatabaseWrapper
|
||||
from django.db.models.expressions import Col
|
||||
from django.db.models.fields import Field
|
||||
from django.db.models.fields.reverse_related import (
|
||||
ForeignObjectRel,
|
||||
ManyToOneRel,
|
||||
)
|
||||
from django.db.models.query_utils import (
|
||||
FilteredRelation,
|
||||
PathInfo,
|
||||
)
|
||||
from django.forms.models import ModelChoiceField
|
||||
from typing import (
|
||||
Any,
|
||||
Callable,
|
||||
Dict,
|
||||
List,
|
||||
Optional,
|
||||
Tuple,
|
||||
Union,
|
||||
)
|
||||
from uuid import UUID
|
||||
|
||||
|
||||
class ForeignKey:
|
||||
def __init__(
|
||||
self,
|
||||
to: Any,
|
||||
on_delete: Callable,
|
||||
related_name: Optional[str] = ...,
|
||||
related_query_name: Optional[str] = ...,
|
||||
limit_choices_to: Any = ...,
|
||||
parent_link: bool = ...,
|
||||
to_field: Optional[str] = ...,
|
||||
db_constraint: bool = ...,
|
||||
**kwargs
|
||||
) -> None: ...
|
||||
def _check_on_delete(self) -> List[Any]: ...
|
||||
def _check_unique(self, **kwargs) -> List[Warning]: ...
|
||||
def check(
|
||||
self,
|
||||
**kwargs
|
||||
) -> Union[List[Error], List[Warning]]: ...
|
||||
def contribute_to_related_class(
|
||||
self,
|
||||
cls: Any,
|
||||
related: ManyToOneRel
|
||||
) -> None: ...
|
||||
def db_check(self, connection: DatabaseWrapper) -> List[Any]: ...
|
||||
def db_parameters(self, connection: DatabaseWrapper) -> Dict[str, str]: ...
|
||||
def db_type(self, connection: DatabaseWrapper) -> str: ...
|
||||
def deconstruct(self) -> Any: ...
|
||||
def formfield(self, *, using = ..., **kwargs) -> ModelChoiceField: ...
|
||||
def get_attname(self) -> str: ...
|
||||
def get_attname_column(self) -> Tuple[str, str]: ...
|
||||
def get_col(self, alias: str, output_field: Any = ...) -> Col: ...
|
||||
def get_db_converters(self, connection: DatabaseWrapper) -> List[Any]: ...
|
||||
def get_db_prep_save(
|
||||
self,
|
||||
value: Any,
|
||||
connection: DatabaseWrapper
|
||||
) -> Optional[Union[str, int]]: ...
|
||||
def get_db_prep_value(
|
||||
self,
|
||||
value: Union[str, UUID, int],
|
||||
connection: DatabaseWrapper,
|
||||
prepared: bool = ...
|
||||
) -> Union[str, int]: ...
|
||||
def get_default(self) -> Optional[int]: ...
|
||||
def get_reverse_path_info(
|
||||
self,
|
||||
filtered_relation: Optional[FilteredRelation] = ...
|
||||
) -> List[PathInfo]: ...
|
||||
@property
|
||||
def target_field(self) -> Field: ...
|
||||
def to_python(self, value: Union[str, int]) -> Union[str, int]: ...
|
||||
def validate(self, value: int, model_instance: Any) -> None: ...
|
||||
|
||||
|
||||
class ForeignObject:
|
||||
def __init__(
|
||||
self,
|
||||
to: Any,
|
||||
on_delete: Callable,
|
||||
from_fields: Union[Tuple[str, str], List[str]],
|
||||
to_fields: Union[List[str], List[None], Tuple[str, str]],
|
||||
rel: Optional[ForeignObjectRel] = ...,
|
||||
related_name: Optional[str] = ...,
|
||||
related_query_name: None = ...,
|
||||
limit_choices_to: None = ...,
|
||||
parent_link: bool = ...,
|
||||
swappable: bool = ...,
|
||||
**kwargs
|
||||
) -> None: ...
|
||||
def _check_to_fields_exist(self) -> List[Error]: ...
|
||||
def _check_unique_target(self) -> List[Error]: ...
|
||||
def check(self, **kwargs) -> List[Error]: ...
|
||||
@@ -0,0 +1,61 @@
|
||||
from django.core.exceptions import ObjectDoesNotExist
|
||||
from django.db.models.base import Model
|
||||
from django.db.models.fields.related import ForeignObject
|
||||
from django.db.models.fields.reverse_related import (
|
||||
ForeignObjectRel,
|
||||
ManyToManyRel,
|
||||
OneToOneRel,
|
||||
)
|
||||
from django.db.models.query import QuerySet
|
||||
from typing import (
|
||||
Any,
|
||||
Callable,
|
||||
Optional,
|
||||
Tuple,
|
||||
Type,
|
||||
)
|
||||
|
||||
|
||||
class ForwardManyToOneDescriptor:
|
||||
@cached_property
|
||||
def RelatedObjectDoesNotExist(self) -> Type[ObjectDoesNotExist]: ...
|
||||
def __get__(self, instance: Any, cls: Any = ...) -> Any: ...
|
||||
def __init__(self, field_with_rel: ForeignObject) -> None: ...
|
||||
def __set__(self, instance: Model, value: Any) -> None: ...
|
||||
def get_object(self, instance: Model) -> Model: ...
|
||||
def get_prefetch_queryset(
|
||||
self,
|
||||
instances: Any,
|
||||
queryset: Optional[QuerySet] = ...
|
||||
) -> Tuple[QuerySet, Callable, Callable, bool, str, bool]: ...
|
||||
def get_queryset(self, **hints) -> QuerySet: ...
|
||||
def is_cached(self, instance: Model) -> bool: ...
|
||||
|
||||
|
||||
class ForwardOneToOneDescriptor:
|
||||
def __set__(self, instance: Model, value: Any) -> None: ...
|
||||
def get_object(self, instance: Model) -> Model: ...
|
||||
|
||||
|
||||
class ManyToManyDescriptor:
|
||||
def __init__(self, rel: ManyToManyRel, reverse: bool = ...) -> None: ...
|
||||
|
||||
|
||||
class ReverseManyToOneDescriptor:
|
||||
def __get__(
|
||||
self,
|
||||
instance: Optional[Model],
|
||||
cls: Any = ...
|
||||
) -> ReverseManyToOneDescriptor: ...
|
||||
def __init__(self, rel: ForeignObjectRel) -> None: ...
|
||||
def _get_set_deprecation_msg_params(self) -> Tuple[str, str]: ...
|
||||
|
||||
|
||||
class ReverseOneToOneDescriptor:
|
||||
@cached_property
|
||||
def RelatedObjectDoesNotExist(self) -> Type[ObjectDoesNotExist]: ...
|
||||
def __get__(self, instance: Any, cls: Any = ...) -> Any: ...
|
||||
def __init__(self, related: OneToOneRel) -> None: ...
|
||||
def __set__(self, instance: Model, value: Optional[Model]) -> None: ...
|
||||
def get_queryset(self, **hints) -> QuerySet: ...
|
||||
def is_cached(self, instance: Model) -> bool: ...
|
||||
@@ -0,0 +1,63 @@
|
||||
from collections import OrderedDict
|
||||
from django.db.backends.sqlite3.base import DatabaseWrapper
|
||||
from django.db.models.expressions import Col
|
||||
from django.db.models.fields import (
|
||||
AutoField,
|
||||
IntegerField,
|
||||
)
|
||||
from django.db.models.fields.related import (
|
||||
ForeignKey,
|
||||
ForeignObject,
|
||||
)
|
||||
from django.db.models.sql.compiler import SQLCompiler
|
||||
from django.db.models.sql.query import Query
|
||||
from typing import (
|
||||
Any,
|
||||
List,
|
||||
Tuple,
|
||||
Type,
|
||||
Union,
|
||||
)
|
||||
from uuid import UUID
|
||||
|
||||
|
||||
def get_normalized_value(
|
||||
value: Any,
|
||||
lhs: Union[MultiColSource, Col]
|
||||
) -> Any: ...
|
||||
|
||||
|
||||
class MultiColSource:
|
||||
def __init__(
|
||||
self,
|
||||
alias: str,
|
||||
targets: Union[Tuple[IntegerField, related.ForeignKey], Tuple[IntegerField, IntegerField]],
|
||||
sources: Union[Tuple[AutoField, IntegerField], Tuple[IntegerField, AutoField]],
|
||||
field: related.ForeignObject
|
||||
) -> None: ...
|
||||
def get_lookup(
|
||||
self,
|
||||
lookup: str
|
||||
) -> Type[Union[RelatedIn, RelatedExact]]: ...
|
||||
def relabeled_clone(
|
||||
self,
|
||||
relabels: OrderedDict
|
||||
) -> MultiColSource: ...
|
||||
|
||||
|
||||
class RelatedIn:
|
||||
def as_sql(
|
||||
self,
|
||||
compiler: SQLCompiler,
|
||||
connection: DatabaseWrapper
|
||||
) -> Union[Tuple[str, List[int]], Tuple[str, List[Any]], Tuple[str, List[str]]]: ...
|
||||
def get_prep_lookup(self) -> Union[List[UUID], Query, List[int], List[str]]: ...
|
||||
|
||||
|
||||
class RelatedLookupMixin:
|
||||
def as_sql(
|
||||
self,
|
||||
compiler: SQLCompiler,
|
||||
connection: DatabaseWrapper
|
||||
) -> Union[Tuple[str, List[int]], Tuple[str, List[Any]], Tuple[str, List[str]]]: ...
|
||||
def get_prep_lookup(self) -> Any: ...
|
||||
@@ -0,0 +1,122 @@
|
||||
from django.db.models.base import Model
|
||||
from django.db.models.fields import (
|
||||
AutoField,
|
||||
Field,
|
||||
)
|
||||
from django.db.models.fields.related import (
|
||||
ForeignKey,
|
||||
ManyToManyField,
|
||||
RelatedField,
|
||||
)
|
||||
from django.db.models.fields.related_lookups import (
|
||||
RelatedExact,
|
||||
RelatedIn,
|
||||
RelatedIsNull,
|
||||
)
|
||||
from django.db.models.query_utils import (
|
||||
FilteredRelation,
|
||||
PathInfo,
|
||||
)
|
||||
from django.db.models.sql.where import WhereNode
|
||||
from typing import (
|
||||
Any,
|
||||
Callable,
|
||||
Dict,
|
||||
List,
|
||||
Optional,
|
||||
Tuple,
|
||||
Type,
|
||||
Union,
|
||||
)
|
||||
|
||||
|
||||
class ForeignObjectRel:
|
||||
def __init__(
|
||||
self,
|
||||
field: RelatedField,
|
||||
to: Any,
|
||||
related_name: Optional[str] = ...,
|
||||
related_query_name: Optional[str] = ...,
|
||||
limit_choices_to: Any = ...,
|
||||
parent_link: bool = ...,
|
||||
on_delete: Optional[Callable] = ...
|
||||
) -> None: ...
|
||||
def __repr__(self) -> str: ...
|
||||
@property
|
||||
def db_type(self) -> Callable: ...
|
||||
def get_accessor_name(self, model: Any = ...) -> Optional[str]: ...
|
||||
def get_cache_name(self) -> str: ...
|
||||
def get_choices(
|
||||
self,
|
||||
include_blank: bool = ...,
|
||||
blank_choice: List[Tuple[str, str]] = ...
|
||||
) -> List[Tuple[int, str]]: ...
|
||||
def get_extra_restriction(
|
||||
self,
|
||||
where_class: Type[WhereNode],
|
||||
alias: str,
|
||||
related_alias: str
|
||||
) -> Optional[WhereNode]: ...
|
||||
def get_internal_type(self) -> str: ...
|
||||
def get_joining_columns(self) -> Union[Tuple[Tuple[str, str]], Tuple[Tuple[str, str], Tuple[str, str]]]: ...
|
||||
def get_lookup(
|
||||
self,
|
||||
lookup_name: str
|
||||
) -> Type[Union[RelatedIsNull, RelatedIn, RelatedExact]]: ...
|
||||
def get_path_info(
|
||||
self,
|
||||
filtered_relation: Optional[FilteredRelation] = ...
|
||||
) -> List[PathInfo]: ...
|
||||
@cached_property
|
||||
def hidden(self) -> bool: ...
|
||||
def is_hidden(self) -> bool: ...
|
||||
@cached_property
|
||||
def many_to_many(self) -> bool: ...
|
||||
@cached_property
|
||||
def many_to_one(self) -> bool: ...
|
||||
@cached_property
|
||||
def name(self) -> str: ...
|
||||
@cached_property
|
||||
def one_to_many(self) -> bool: ...
|
||||
@cached_property
|
||||
def one_to_one(self) -> bool: ...
|
||||
@cached_property
|
||||
def related_model(self) -> Any: ...
|
||||
@property
|
||||
def remote_field(
|
||||
self
|
||||
) -> Union[ManyToManyField, ForeignKey]: ...
|
||||
def set_field_name(self) -> None: ...
|
||||
@property
|
||||
def target_field(self) -> AutoField: ...
|
||||
|
||||
|
||||
class ManyToManyRel:
|
||||
def __init__(
|
||||
self,
|
||||
field: RelatedField,
|
||||
to: Any,
|
||||
related_name: Optional[str] = ...,
|
||||
related_query_name: Optional[str] = ...,
|
||||
limit_choices_to: Optional[Callable] = ...,
|
||||
symmetrical: bool = ...,
|
||||
through: Optional[Union[str, Type[Model]]] = ...,
|
||||
through_fields: Optional[Tuple[str, str]] = ...,
|
||||
db_constraint: bool = ...
|
||||
) -> None: ...
|
||||
def get_related_field(self) -> Field: ...
|
||||
|
||||
|
||||
class ManyToOneRel:
|
||||
def __getstate__(self) -> Dict[str, Any]: ...
|
||||
def __init__(
|
||||
self,
|
||||
field: ForeignKey,
|
||||
to: Any,
|
||||
field_name: Optional[str],
|
||||
related_name: Optional[str] = ...,
|
||||
related_query_name: Optional[str] = ...,
|
||||
limit_choices_to: Any = ...,
|
||||
parent_link: bool = ...,
|
||||
on_delete: Callable = ...
|
||||
) -> None: ...
|
||||
@@ -0,0 +1,50 @@
|
||||
from datetime import (
|
||||
date,
|
||||
datetime,
|
||||
)
|
||||
from decimal import Decimal
|
||||
from django.db.backends.sqlite3.base import DatabaseWrapper
|
||||
from django.db.models.fields import Field
|
||||
from django.db.models.sql.compiler import SQLCompiler
|
||||
from typing import (
|
||||
Any,
|
||||
List,
|
||||
Tuple,
|
||||
Union,
|
||||
)
|
||||
|
||||
|
||||
class Cast:
|
||||
def __init__(
|
||||
self,
|
||||
expression: Union[str, date, Decimal],
|
||||
output_field: Field
|
||||
) -> None: ...
|
||||
def as_sql(
|
||||
self,
|
||||
compiler: SQLCompiler,
|
||||
connection: DatabaseWrapper,
|
||||
**extra_context
|
||||
) -> Union[Tuple[str, List[datetime]], Tuple[str, List[Any]]]: ...
|
||||
|
||||
|
||||
class Coalesce:
|
||||
def __init__(self, *expressions, **extra) -> None: ...
|
||||
|
||||
|
||||
class Greatest:
|
||||
def __init__(self, *expressions, **extra) -> None: ...
|
||||
def as_sqlite(
|
||||
self,
|
||||
compiler: SQLCompiler,
|
||||
connection: DatabaseWrapper
|
||||
) -> Tuple[str, List[Any]]: ...
|
||||
|
||||
|
||||
class Least:
|
||||
def __init__(self, *expressions, **extra) -> None: ...
|
||||
def as_sqlite(
|
||||
self,
|
||||
compiler: SQLCompiler,
|
||||
connection: DatabaseWrapper
|
||||
) -> Union[Tuple[str, List[datetime]], Tuple[str, List[Any]]]: ...
|
||||
@@ -0,0 +1,102 @@
|
||||
from datetime import (
|
||||
date,
|
||||
time,
|
||||
)
|
||||
from django.db.backends.sqlite3.base import DatabaseWrapper
|
||||
from django.db.models.expressions import Col
|
||||
from django.db.models.fields import (
|
||||
DateTimeCheckMixin,
|
||||
IntegerField,
|
||||
)
|
||||
from django.db.models.sql.compiler import SQLCompiler
|
||||
from django.db.models.sql.query import Query
|
||||
from typing import (
|
||||
Any,
|
||||
List,
|
||||
Optional,
|
||||
Tuple,
|
||||
Union,
|
||||
)
|
||||
|
||||
|
||||
class Extract:
|
||||
def __init__(
|
||||
self,
|
||||
expression: Union[str, Col, TruncDate],
|
||||
lookup_name: Optional[str] = ...,
|
||||
tzinfo: None = ...,
|
||||
**extra
|
||||
) -> None: ...
|
||||
def as_sql(
|
||||
self,
|
||||
compiler: SQLCompiler,
|
||||
connection: DatabaseWrapper
|
||||
) -> Tuple[str, List[Any]]: ...
|
||||
def resolve_expression(
|
||||
self,
|
||||
query: Query = ...,
|
||||
allow_joins: bool = ...,
|
||||
reuse: None = ...,
|
||||
summarize: bool = ...,
|
||||
for_save: bool = ...
|
||||
) -> Extract: ...
|
||||
|
||||
|
||||
class TimezoneMixin:
|
||||
def get_tzname(self) -> Optional[str]: ...
|
||||
|
||||
|
||||
class Trunc:
|
||||
def __init__(
|
||||
self,
|
||||
expression: str,
|
||||
kind: str,
|
||||
output_field: Optional[Union[IntegerField, DateTimeCheckMixin]] = ...,
|
||||
tzinfo: None = ...,
|
||||
**extra
|
||||
) -> None: ...
|
||||
|
||||
|
||||
class TruncBase:
|
||||
def __init__(
|
||||
self,
|
||||
expression: Union[str, Col],
|
||||
output_field: Optional[DateTimeCheckMixin] = ...,
|
||||
tzinfo: None = ...,
|
||||
**extra
|
||||
) -> None: ...
|
||||
def as_sql(
|
||||
self,
|
||||
compiler: SQLCompiler,
|
||||
connection: DatabaseWrapper
|
||||
) -> Tuple[str, List[Any]]: ...
|
||||
def convert_value(
|
||||
self,
|
||||
value: Union[date, time],
|
||||
expression: django.db.models.functions.TruncBase,
|
||||
connection: DatabaseWrapper
|
||||
) -> Union[date, time]: ...
|
||||
def resolve_expression(
|
||||
self,
|
||||
query: Query = ...,
|
||||
allow_joins: bool = ...,
|
||||
reuse: None = ...,
|
||||
summarize: bool = ...,
|
||||
for_save: bool = ...
|
||||
) -> TruncBase: ...
|
||||
|
||||
|
||||
class TruncDate:
|
||||
def as_sql(
|
||||
self,
|
||||
compiler: SQLCompiler,
|
||||
connection: DatabaseWrapper
|
||||
) -> Tuple[str, List[Any]]: ...
|
||||
|
||||
|
||||
class TruncTime:
|
||||
def as_sql(
|
||||
self,
|
||||
compiler: SQLCompiler,
|
||||
connection: DatabaseWrapper
|
||||
) -> Tuple[str, List[Any]]: ...
|
||||
@@ -0,0 +1,112 @@
|
||||
from django.db.backends.sqlite3.base import DatabaseWrapper
|
||||
from django.db.models.expressions import (
|
||||
Col,
|
||||
F,
|
||||
Value,
|
||||
)
|
||||
from django.db.models.sql.compiler import SQLCompiler
|
||||
from typing import (
|
||||
Any,
|
||||
List,
|
||||
Tuple,
|
||||
Union,
|
||||
)
|
||||
|
||||
|
||||
class BytesToCharFieldConversionMixin:
|
||||
def convert_value(
|
||||
self,
|
||||
value: str,
|
||||
expression: LPad,
|
||||
connection: DatabaseWrapper
|
||||
) -> str: ...
|
||||
|
||||
|
||||
class Chr:
|
||||
def as_sqlite(
|
||||
self,
|
||||
compiler: SQLCompiler,
|
||||
connection: DatabaseWrapper,
|
||||
**extra_context
|
||||
) -> Union[Tuple[str, List[int]], Tuple[str, List[Any]]]: ...
|
||||
|
||||
|
||||
class Concat:
|
||||
def __init__(self, *expressions, **extra) -> None: ...
|
||||
def _paired(
|
||||
self,
|
||||
expressions: Union[Tuple[Value, str], Tuple[str, str], Tuple[Value, str, Value]]
|
||||
) -> ConcatPair: ...
|
||||
|
||||
|
||||
class ConcatPair:
|
||||
def as_sqlite(
|
||||
self,
|
||||
compiler: SQLCompiler,
|
||||
connection: DatabaseWrapper
|
||||
) -> Tuple[str, List[str]]: ...
|
||||
def coalesce(self) -> ConcatPair: ...
|
||||
|
||||
|
||||
class LPad:
|
||||
def __init__(
|
||||
self,
|
||||
expression: str,
|
||||
length: Union[int, Length],
|
||||
fill_text: Value = ...,
|
||||
**extra
|
||||
) -> None: ...
|
||||
|
||||
|
||||
class Left:
|
||||
def __init__(self, expression: str, length: int, **extra) -> None: ...
|
||||
def get_substr(self) -> Substr: ...
|
||||
def use_substr(
|
||||
self,
|
||||
compiler: SQLCompiler,
|
||||
connection: DatabaseWrapper,
|
||||
**extra_context
|
||||
) -> Tuple[str, List[int]]: ...
|
||||
|
||||
|
||||
class Ord:
|
||||
def as_sqlite(
|
||||
self,
|
||||
compiler: SQLCompiler,
|
||||
connection: DatabaseWrapper,
|
||||
**extra_context
|
||||
) -> Union[Tuple[str, List[Any]], Tuple[str, List[str]]]: ...
|
||||
|
||||
|
||||
class Replace:
|
||||
def __init__(
|
||||
self,
|
||||
expression: F,
|
||||
text: Value,
|
||||
replacement: Value = ...,
|
||||
**extra
|
||||
) -> None: ...
|
||||
|
||||
|
||||
class Right:
|
||||
def get_substr(self) -> Substr: ...
|
||||
|
||||
|
||||
class Substr:
|
||||
def __init__(
|
||||
self,
|
||||
expression: Union[str, Col],
|
||||
pos: Union[int, Value],
|
||||
length: Union[int, Value] = ...,
|
||||
**extra
|
||||
) -> None: ...
|
||||
def as_oracle(
|
||||
self,
|
||||
compiler: SQLCompiler,
|
||||
connection: DatabaseWrapper
|
||||
) -> Tuple[str, List[int]]: ...
|
||||
def as_sqlite(
|
||||
self,
|
||||
compiler: SQLCompiler,
|
||||
connection: DatabaseWrapper
|
||||
) -> Union[Tuple[str, List[int]], Tuple[str, List[Union[str, int]]]]: ...
|
||||
@@ -0,0 +1,5 @@
|
||||
from typing import Optional
|
||||
|
||||
|
||||
class LagLeadFunction:
|
||||
def __init__(self, expression: Optional[str], offset: int = ..., default: None = ..., **extra): ...
|
||||
@@ -0,0 +1,28 @@
|
||||
from django.db.backends.ddl_references import Statement
|
||||
from django.db.backends.sqlite3.schema import DatabaseSchemaEditor
|
||||
from django.db.models.base import Model
|
||||
from typing import (
|
||||
Any,
|
||||
Dict,
|
||||
List,
|
||||
Tuple,
|
||||
Type,
|
||||
Union,
|
||||
)
|
||||
|
||||
|
||||
class Index:
|
||||
def __eq__(self, other: Index) -> bool: ...
|
||||
def __init__(self, *, fields = ..., name = ..., db_tablespace = ...) -> None: ...
|
||||
@staticmethod
|
||||
def _hash_generator(*args) -> str: ...
|
||||
def check_name(self) -> List[Any]: ...
|
||||
def clone(self) -> Index: ...
|
||||
def create_sql(
|
||||
self,
|
||||
model: Type[Model],
|
||||
schema_editor: DatabaseSchemaEditor,
|
||||
using: str = ...
|
||||
) -> Statement: ...
|
||||
def deconstruct(self) -> Tuple[str, Tuple, Dict[str, Union[List[str], str]]]: ...
|
||||
def set_name_with_model(self, model: Type[Model]) -> None: ...
|
||||
@@ -0,0 +1,217 @@
|
||||
from collections import OrderedDict
|
||||
from datetime import datetime
|
||||
from django.db.backends.sqlite3.base import DatabaseWrapper
|
||||
from django.db.models.expressions import (
|
||||
Col,
|
||||
CombinedExpression,
|
||||
Expression,
|
||||
Ref,
|
||||
)
|
||||
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 typing import (
|
||||
Any,
|
||||
Dict,
|
||||
List,
|
||||
Optional,
|
||||
Tuple,
|
||||
Type,
|
||||
Union,
|
||||
)
|
||||
|
||||
|
||||
class BuiltinLookup:
|
||||
def as_sql(
|
||||
self,
|
||||
compiler: SQLCompiler,
|
||||
connection: DatabaseWrapper
|
||||
) -> Any: ...
|
||||
def get_rhs_op(self, connection: DatabaseWrapper, rhs: str) -> str: ...
|
||||
def process_lhs(
|
||||
self,
|
||||
compiler: SQLCompiler,
|
||||
connection: DatabaseWrapper,
|
||||
lhs: Optional[Col] = ...
|
||||
) -> Union[Tuple[str, List[str]], Tuple[str, List[int]], Tuple[str, List[Union[str, int]]], Tuple[str, List[Any]]]: ...
|
||||
|
||||
|
||||
class Exact:
|
||||
def process_rhs(
|
||||
self,
|
||||
compiler: SQLCompiler,
|
||||
connection: DatabaseWrapper
|
||||
) -> Any: ...
|
||||
|
||||
|
||||
class FieldGetDbPrepValueIterableMixin:
|
||||
def batch_process_rhs(
|
||||
self,
|
||||
compiler: SQLCompiler,
|
||||
connection: DatabaseWrapper,
|
||||
rhs: Optional[OrderedSet] = ...
|
||||
) -> Any: ...
|
||||
def get_prep_lookup(self) -> Any: ...
|
||||
def process_rhs(
|
||||
self,
|
||||
compiler: SQLCompiler,
|
||||
connection: DatabaseWrapper
|
||||
) -> Any: ...
|
||||
def resolve_expression_parameter(
|
||||
self,
|
||||
compiler: SQLCompiler,
|
||||
connection: DatabaseWrapper,
|
||||
sql: str,
|
||||
param: Any
|
||||
) -> Union[Tuple[str, List[None]], Tuple[str, List[int]], Tuple[str, List[Any]], Tuple[str, List[str]]]: ...
|
||||
|
||||
|
||||
class FieldGetDbPrepValueMixin:
|
||||
def get_db_prep_lookup(self, value: Any, connection: DatabaseWrapper) -> Any: ...
|
||||
|
||||
|
||||
class IExact:
|
||||
def process_rhs(
|
||||
self,
|
||||
qn: SQLCompiler,
|
||||
connection: DatabaseWrapper
|
||||
) -> Union[Tuple[str, List[Any]], Tuple[str, List[str]]]: ...
|
||||
|
||||
|
||||
class In:
|
||||
def as_sql(
|
||||
self,
|
||||
compiler: SQLCompiler,
|
||||
connection: DatabaseWrapper
|
||||
) -> Any: ...
|
||||
def get_rhs_op(self, connection: DatabaseWrapper, rhs: str) -> str: ...
|
||||
def process_rhs(
|
||||
self,
|
||||
compiler: SQLCompiler,
|
||||
connection: DatabaseWrapper
|
||||
) -> Any: ...
|
||||
|
||||
|
||||
class IntegerFieldFloatRounding:
|
||||
def get_prep_lookup(
|
||||
self
|
||||
) -> Union[Query, int, CombinedExpression]: ...
|
||||
|
||||
|
||||
class IsNull:
|
||||
def as_sql(
|
||||
self,
|
||||
compiler: SQLCompiler,
|
||||
connection: DatabaseWrapper
|
||||
) -> Tuple[str, List[Any]]: ...
|
||||
|
||||
|
||||
class Lookup:
|
||||
def __init__(self, lhs: Any, rhs: Any) -> None: ...
|
||||
def apply_bilateral_transforms(
|
||||
self,
|
||||
value: Expression
|
||||
) -> Transform: ...
|
||||
def batch_process_rhs(
|
||||
self,
|
||||
compiler: SQLCompiler,
|
||||
connection: DatabaseWrapper,
|
||||
rhs: Optional[OrderedSet] = ...
|
||||
) -> Any: ...
|
||||
@cached_property
|
||||
def contains_aggregate(self) -> bool: ...
|
||||
@cached_property
|
||||
def contains_over_clause(self) -> bool: ...
|
||||
def get_db_prep_lookup(
|
||||
self,
|
||||
value: Union[str, int],
|
||||
connection: DatabaseWrapper
|
||||
) -> Union[Tuple[str, List[int]], Tuple[str, List[SafeText]], Tuple[str, List[str]]]: ...
|
||||
def get_group_by_cols(
|
||||
self
|
||||
) -> Union[List[Col], List[CombinedExpression]]: ...
|
||||
def get_prep_lookup(self) -> Any: ...
|
||||
def get_source_expressions(self) -> List[Col]: ...
|
||||
def process_lhs(
|
||||
self,
|
||||
compiler: SQLCompiler,
|
||||
connection: DatabaseWrapper,
|
||||
lhs: Optional[Col] = ...
|
||||
) -> Any: ...
|
||||
def process_rhs(
|
||||
self,
|
||||
compiler: SQLCompiler,
|
||||
connection: DatabaseWrapper
|
||||
) -> Any: ...
|
||||
def relabeled_clone(
|
||||
self,
|
||||
relabels: Union[OrderedDict, Dict[str, str], Dict[Union[str, None], str]]
|
||||
) -> BuiltinLookup: ...
|
||||
def rhs_is_direct_value(self) -> bool: ...
|
||||
def set_source_expressions(self, new_exprs: List[Ref]) -> None: ...
|
||||
|
||||
|
||||
class PatternLookup:
|
||||
def get_rhs_op(self, connection: DatabaseWrapper, rhs: str) -> str: ...
|
||||
def process_rhs(
|
||||
self,
|
||||
qn: SQLCompiler,
|
||||
connection: DatabaseWrapper
|
||||
) -> Union[Tuple[str, List[str]], Tuple[str, List[int]], Tuple[str, List[Any]]]: ...
|
||||
|
||||
|
||||
class Range:
|
||||
def get_rhs_op(self, connection: DatabaseWrapper, rhs: Tuple[str, str]) -> str: ...
|
||||
|
||||
|
||||
class Regex:
|
||||
def as_sql(
|
||||
self,
|
||||
compiler: SQLCompiler,
|
||||
connection: DatabaseWrapper
|
||||
) -> Tuple[str, List[str]]: ...
|
||||
|
||||
|
||||
class Transform:
|
||||
def get_bilateral_transforms(self) -> List[Type[Transform]]: ...
|
||||
@property
|
||||
def lhs(self) -> Expression: ...
|
||||
|
||||
|
||||
class YearComparisonLookup:
|
||||
def as_sql(
|
||||
self,
|
||||
compiler: SQLCompiler,
|
||||
connection: DatabaseWrapper
|
||||
) -> Tuple[str, List[str]]: ...
|
||||
def get_bound(self, start: datetime, finish: datetime): ...
|
||||
def get_rhs_op(self, connection: DatabaseWrapper, rhs: str) -> str: ...
|
||||
|
||||
|
||||
class YearExact:
|
||||
def as_sql(
|
||||
self,
|
||||
compiler: SQLCompiler,
|
||||
connection: DatabaseWrapper
|
||||
) -> Union[Tuple[str, List[Any]], Tuple[str, List[str]]]: ...
|
||||
|
||||
|
||||
class YearGt:
|
||||
def get_bound(self, start: str, finish: str) -> str: ...
|
||||
|
||||
|
||||
class YearGte:
|
||||
def get_bound(self, start: str, finish: str) -> str: ...
|
||||
|
||||
|
||||
class YearLookup:
|
||||
def year_lookup_bounds(self, connection: DatabaseWrapper, year: int) -> List[str]: ...
|
||||
|
||||
|
||||
class YearLt:
|
||||
def get_bound(self, start: str, finish: str) -> str: ...
|
||||
|
||||
|
||||
class YearLte:
|
||||
def get_bound(self, start: str, finish: str) -> str: ...
|
||||
@@ -0,0 +1,36 @@
|
||||
from django.db.models.base import Model
|
||||
from django.db.models.query import QuerySet
|
||||
from typing import (
|
||||
Any,
|
||||
Callable,
|
||||
Dict,
|
||||
List,
|
||||
Optional,
|
||||
Tuple,
|
||||
Type,
|
||||
Union,
|
||||
)
|
||||
|
||||
|
||||
class BaseManager:
|
||||
def __eq__(self, other: Optional[Manager]) -> bool: ...
|
||||
def __init__(self) -> None: ...
|
||||
@staticmethod
|
||||
def __new__(cls: Any, *args, **kwargs) -> Manager: ...
|
||||
@classmethod
|
||||
def _get_queryset_methods(cls, queryset_class: Any) -> Dict[str, Callable]: ...
|
||||
def _set_creation_counter(self) -> None: ...
|
||||
def all(self) -> QuerySet: ...
|
||||
def check(self, **kwargs) -> List[Any]: ...
|
||||
def contribute_to_class(self, model: Any, name: str) -> None: ...
|
||||
@property
|
||||
def db(self) -> str: ...
|
||||
def db_manager(self, using: Optional[str] = ..., hints: Any = ...) -> Manager: ...
|
||||
def deconstruct(
|
||||
self
|
||||
) -> Union[Tuple[bool, str, None, Tuple[str, str, int, int], Dict[Any, Any]], Tuple[bool, str, None, Tuple, Dict[Any, Any]]]: ...
|
||||
def get_queryset(self) -> QuerySet: ...
|
||||
|
||||
|
||||
class EmptyManager:
|
||||
def __init__(self, model: Type[Model]) -> None: ...
|
||||
@@ -0,0 +1,24 @@
|
||||
from django.utils.datastructures import ImmutableList
|
||||
from typing import (
|
||||
Any,
|
||||
Dict,
|
||||
)
|
||||
|
||||
|
||||
class Options:
|
||||
def __init__(self, meta: Any, app_label: str = ...) -> None: ...
|
||||
def __repr__(self) -> str: ...
|
||||
def __str__(self) -> str: ...
|
||||
def _expire_cache(self, forward: bool = ..., reverse: bool = ...) -> None: ...
|
||||
@cached_property
|
||||
def _forward_fields_map(self) -> Dict[str, Any]: ...
|
||||
def _get_fields(
|
||||
self,
|
||||
forward: bool = ...,
|
||||
reverse: bool = ...,
|
||||
include_parents: object = ...,
|
||||
include_hidden: bool = ...,
|
||||
seen_models: Any = ...
|
||||
) -> ImmutableList: ...
|
||||
def _populate_directed_relation_graph(self) -> Any: ...
|
||||
def _prepare(self, model: Any) -> None: ...
|
||||
@@ -0,0 +1,65 @@
|
||||
from django.db.models.base import Model
|
||||
from django.db.models.sql.query import Query
|
||||
from typing import (
|
||||
Any,
|
||||
Dict,
|
||||
Iterator,
|
||||
Optional,
|
||||
Tuple,
|
||||
Union,
|
||||
)
|
||||
|
||||
|
||||
class BaseIterable:
|
||||
def __init__(
|
||||
self,
|
||||
queryset: QuerySet,
|
||||
chunked_fetch: bool = ...,
|
||||
chunk_size: int = ...
|
||||
) -> None: ...
|
||||
|
||||
|
||||
class FlatValuesListIterable:
|
||||
def __iter__(self) -> Iterator[Any]: ...
|
||||
|
||||
|
||||
class InstanceCheckMeta:
|
||||
def __instancecheck__(self, instance: Union[str, QuerySet]) -> bool: ...
|
||||
|
||||
|
||||
class ModelIterable:
|
||||
def __iter__(self) -> Iterator[Model]: ...
|
||||
|
||||
|
||||
class NamedValuesListIterable:
|
||||
def __iter__(self): ...
|
||||
|
||||
|
||||
class Prefetch:
|
||||
def __eq__(self, other: None) -> bool: ...
|
||||
def __getstate__(self) -> Dict[str, Union[str, QuerySet, None]]: ...
|
||||
def __hash__(self) -> int: ...
|
||||
def __init__(
|
||||
self,
|
||||
lookup: str,
|
||||
queryset: Optional[QuerySet] = ...,
|
||||
to_attr: Optional[str] = ...
|
||||
) -> None: ...
|
||||
def add_prefix(self, prefix: str) -> None: ...
|
||||
def get_current_prefetch_to(self, level: int) -> str: ...
|
||||
def get_current_queryset(self, level: int) -> Optional[QuerySet]: ...
|
||||
def get_current_to_attr(self, level: int) -> Union[Tuple[str, None], Tuple[str, bool]]: ...
|
||||
|
||||
|
||||
class QuerySet:
|
||||
def __and__(self, other: QuerySet) -> QuerySet: ...
|
||||
def __bool__(self) -> bool: ...
|
||||
def __getitem__(self, k: Union[slice, int]) -> Any: ...
|
||||
def __getstate__(self) -> Dict[str, Any]: ...
|
||||
def __init__(
|
||||
self,
|
||||
model: Any = ...,
|
||||
query: Optional[Query] = ...,
|
||||
using: Optional[str] = ...,
|
||||
hints: Dict[str, Model] = ...
|
||||
) -> None: ...
|
||||
@@ -0,0 +1,109 @@
|
||||
from collections import OrderedDict
|
||||
from django.db.backends.sqlite3.base import DatabaseWrapper
|
||||
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.related import ForeignKey
|
||||
from django.db.models.fields.reverse_related import ManyToOneRel
|
||||
from django.db.models.options import Options
|
||||
from django.db.models.sql.compiler import SQLCompiler
|
||||
from django.db.models.sql.query import Query
|
||||
from django.db.models.sql.where import WhereNode
|
||||
from typing import (
|
||||
Any,
|
||||
Dict,
|
||||
Iterator,
|
||||
List,
|
||||
Optional,
|
||||
Set,
|
||||
Tuple,
|
||||
Union,
|
||||
)
|
||||
|
||||
|
||||
def check_rel_lookup_compatibility(
|
||||
model: Any,
|
||||
target_opts: Options,
|
||||
field: Union[ManyToOneRel, ForeignKey]
|
||||
) -> bool: ...
|
||||
|
||||
|
||||
def refs_expression(lookup_parts: List[str], annotations: OrderedDict) -> Any: ...
|
||||
|
||||
|
||||
def select_related_descend(
|
||||
field: Field,
|
||||
restricted: bool,
|
||||
requested: Any,
|
||||
load_fields: Optional[Set[str]],
|
||||
reverse: bool = ...
|
||||
) -> bool: ...
|
||||
|
||||
|
||||
def subclasses(cls: Any) -> Iterator[Any]: ...
|
||||
|
||||
|
||||
class DeferredAttribute:
|
||||
def __get__(
|
||||
self,
|
||||
instance: Any,
|
||||
cls: Any = ...
|
||||
) -> Optional[Union[DeferredAttribute, str, int]]: ...
|
||||
def __init__(self, field_name: str) -> None: ...
|
||||
def _check_parent_chain(self, instance: Model, name: str) -> None: ...
|
||||
|
||||
|
||||
class FilteredRelation:
|
||||
def __eq__(self, other: FilteredRelation) -> bool: ...
|
||||
def __init__(self, relation_name: str, *, condition = ...) -> None: ...
|
||||
def as_sql(
|
||||
self,
|
||||
compiler: SQLCompiler,
|
||||
connection: DatabaseWrapper
|
||||
) -> Union[Tuple[str, List[str]], Tuple[str, List[int]], Tuple[str, List[Union[int, str]]], Tuple[str, List[Any]]]: ...
|
||||
def clone(self) -> FilteredRelation: ...
|
||||
|
||||
|
||||
class Q:
|
||||
def __and__(self, other: Q) -> Q: ...
|
||||
def __init__(self, *args, **kwargs) -> None: ...
|
||||
def __invert__(self) -> Q: ...
|
||||
def __or__(self, other: Q) -> Q: ...
|
||||
def _combine(self, other: Q, conn: str) -> Q: ...
|
||||
def deconstruct(
|
||||
self
|
||||
) -> Union[Tuple[str, Tuple, Dict[str, F]], Tuple[str, Tuple[Tuple[str, F], Tuple[str, F]], Dict[Any, Any]], Tuple[str, Tuple[Q], Dict[Any, Any]]]: ...
|
||||
def resolve_expression(
|
||||
self,
|
||||
query: Query = ...,
|
||||
allow_joins: bool = ...,
|
||||
reuse: Optional[Set[str]] = ...,
|
||||
summarize: bool = ...,
|
||||
for_save: bool = ...
|
||||
) -> WhereNode: ...
|
||||
|
||||
|
||||
class QueryWrapper:
|
||||
def __init__(self, sql: str, params: List[Any]) -> None: ...
|
||||
def as_sql(
|
||||
self,
|
||||
compiler: SQLCompiler = ...,
|
||||
connection: DatabaseWrapper = ...
|
||||
) -> Tuple[str, List[Any]]: ...
|
||||
|
||||
|
||||
class RegisterLookupMixin:
|
||||
@classmethod
|
||||
def _clear_cached_lookups(cls) -> None: ...
|
||||
@classmethod
|
||||
def _get_lookup(cls, lookup_name: str) -> Any: ...
|
||||
@classmethod
|
||||
def _unregister_lookup(cls, lookup: Any, lookup_name: Optional[str] = ...) -> None: ...
|
||||
def get_lookup(self, lookup_name: str) -> Any: ...
|
||||
@classmethod
|
||||
def get_lookups(cls) -> Dict[str, Any]: ...
|
||||
def get_transform(self, lookup_name: str) -> Any: ...
|
||||
@staticmethod
|
||||
def merge_dicts(dicts: Any) -> Dict[str, Any]: ...
|
||||
@classmethod
|
||||
def register_lookup(cls, lookup: Any, lookup_name: Optional[str] = ...) -> Any: ...
|
||||
@@ -0,0 +1,32 @@
|
||||
from django.apps.registry import Apps
|
||||
from typing import (
|
||||
Any,
|
||||
Callable,
|
||||
Optional,
|
||||
)
|
||||
|
||||
|
||||
class ModelSignal:
|
||||
def _lazy_method(
|
||||
self,
|
||||
method: Callable,
|
||||
apps: Optional[Apps],
|
||||
receiver: Callable,
|
||||
sender: Any,
|
||||
**kwargs
|
||||
) -> Optional[bool]: ...
|
||||
def connect(
|
||||
self,
|
||||
receiver: Callable,
|
||||
sender: Any = ...,
|
||||
weak: bool = ...,
|
||||
dispatch_uid: None = ...,
|
||||
apps: None = ...
|
||||
) -> None: ...
|
||||
def disconnect(
|
||||
self,
|
||||
receiver: Callable = ...,
|
||||
sender: Any = ...,
|
||||
dispatch_uid: None = ...,
|
||||
apps: None = ...
|
||||
) -> bool: ...
|
||||
@@ -0,0 +1,116 @@
|
||||
from django.db.backends.sqlite3.base import DatabaseWrapper
|
||||
from django.db.backends.utils import CursorWrapper
|
||||
from django.db.models.expressions import (
|
||||
Col,
|
||||
CombinedExpression,
|
||||
Expression,
|
||||
OrderBy,
|
||||
)
|
||||
from django.db.models.functions.datetime import Trunc
|
||||
from django.db.models.options import Options
|
||||
from django.db.models.sql.query import (
|
||||
Query,
|
||||
RawQuery,
|
||||
)
|
||||
from itertools import chain
|
||||
from typing import (
|
||||
Any,
|
||||
Dict,
|
||||
Iterator,
|
||||
List,
|
||||
Optional,
|
||||
Set,
|
||||
Tuple,
|
||||
Union,
|
||||
)
|
||||
|
||||
|
||||
class SQLAggregateCompiler:
|
||||
def as_sql(self) -> Any: ...
|
||||
|
||||
|
||||
class SQLCompiler:
|
||||
def __init__(
|
||||
self,
|
||||
query: Union[Query, RawQuery],
|
||||
connection: DatabaseWrapper,
|
||||
using: Optional[str]
|
||||
) -> None: ...
|
||||
def _setup_joins(self, pieces: List[str], opts: Options, alias: Optional[str]) -> Any: ...
|
||||
def apply_converters(self, rows: chain, converters: Dict[int, Any]) -> Iterator[Any]: ...
|
||||
def as_sql(self, with_limits: bool = ..., with_col_aliases: bool = ...): ...
|
||||
def as_subquery_condition(
|
||||
self,
|
||||
alias: str,
|
||||
columns: List[str],
|
||||
compiler: SQLCompiler
|
||||
) -> Union[Tuple[str, Tuple[str]], Tuple[str, Tuple]]: ...
|
||||
def collapse_group_by(
|
||||
self,
|
||||
expressions: Union[List[Col], List[Union[Col, Trunc]], List[Expression], List[Union[Col, CombinedExpression]]],
|
||||
having: Union[List[Col], Tuple, List[CombinedExpression]]
|
||||
) -> Union[List[Col], List[Union[Col, Trunc]], List[Expression], List[Union[Col, CombinedExpression]]]: ...
|
||||
def compile(self, node: Any, select_format: object = ...) -> Any: ...
|
||||
def deferred_to_columns(self) -> Any: ...
|
||||
def execute_sql(
|
||||
self,
|
||||
result_type: str = ...,
|
||||
chunked_fetch: bool = ...,
|
||||
chunk_size: int = ...
|
||||
) -> Optional[CursorWrapper]: ...
|
||||
def explain_query(self) -> Iterator[str]: ...
|
||||
def find_ordering_name(
|
||||
self,
|
||||
name: str,
|
||||
opts: Options,
|
||||
alias: Optional[str] = ...,
|
||||
default_order: str = ...,
|
||||
already_seen: Optional[Union[Set[Tuple[None, Tuple[Tuple[str, str]]]], Set[Tuple[None, Tuple[Tuple[str, str]], Tuple[Tuple[str, str]], Tuple[Tuple[str, str]]]], Set[Union[Tuple[None, Tuple[Tuple[str, str]]], Tuple[Tuple[Tuple[str, str]], Tuple[Tuple[str, str]]]]]]] = ...
|
||||
) -> List[Tuple[OrderBy, bool]]: ...
|
||||
def get_combinator_sql(
|
||||
self,
|
||||
combinator: str,
|
||||
all: bool
|
||||
) -> Union[Tuple[List[str], List[Any]], Tuple[List[str], List[int]], Tuple[List[str], List[str]]]: ...
|
||||
def get_converters(self, expressions: Any) -> Dict[int, Any]: ...
|
||||
def get_default_columns(
|
||||
self,
|
||||
start_alias: Optional[str] = ...,
|
||||
opts: Optional[Options] = ...,
|
||||
from_parent: Any = ...
|
||||
) -> List[Col]: ...
|
||||
def get_distinct(self) -> Tuple[List[Any], List[Any]]: ...
|
||||
def get_extra_select(
|
||||
self,
|
||||
order_by: Union[List[Tuple[OrderBy, Tuple[str, List[Any], bool]]], List[Union[Tuple[OrderBy, Tuple[str, List[int], bool]], Tuple[OrderBy, Tuple[str, List[Any], bool]]]], List[Tuple[OrderBy, Tuple[str, Tuple, bool]]]],
|
||||
select: Any
|
||||
) -> List[Tuple[OrderBy, Tuple[str, List[Any]], None]]: ...
|
||||
def get_from_clause(
|
||||
self
|
||||
) -> Union[Tuple[List[str], List[Union[int, str]]], Tuple[List[str], List[Any]], Tuple[List[str], List[int]], Tuple[List[str], List[str]]]: ...
|
||||
def get_group_by(
|
||||
self,
|
||||
select: Any,
|
||||
order_by: Any
|
||||
) -> Union[List[Union[Tuple[str, List[Any]], Tuple[str, List[str]]]], List[Tuple[str, List[Any]]], List[Union[Tuple[str, List[Any]], Tuple[str, List[int]]]]]: ...
|
||||
def get_order_by(self) -> Any: ...
|
||||
def get_related_selections(
|
||||
self,
|
||||
select: Any,
|
||||
opts: Optional[Options] = ...,
|
||||
root_alias: Optional[str] = ...,
|
||||
cur_depth: int = ...,
|
||||
requested: Any = ...,
|
||||
restricted: Optional[bool] = ...
|
||||
) -> Any: ...
|
||||
def get_select(self) -> Any: ...
|
||||
def has_results(self) -> bool: ...
|
||||
def pre_sql_setup(self) -> Any: ...
|
||||
def quote_name_unless_alias(self, name: str) -> str: ...
|
||||
def results_iter(
|
||||
self,
|
||||
results: Any = ...,
|
||||
tuple_expected: bool = ...,
|
||||
chunked_fetch: bool = ...,
|
||||
chunk_size: int = ...
|
||||
) -> chain: ...
|
||||
@@ -0,0 +1,69 @@
|
||||
from collections import OrderedDict
|
||||
from django.db.backends.sqlite3.base import DatabaseWrapper
|
||||
from django.db.models.fields.related import ForeignObject
|
||||
from django.db.models.fields.reverse_related import ForeignObjectRel
|
||||
from django.db.models.query_utils import (
|
||||
FilteredRelation,
|
||||
PathInfo,
|
||||
)
|
||||
from django.db.models.sql.compiler import SQLCompiler
|
||||
from typing import (
|
||||
Any,
|
||||
Dict,
|
||||
List,
|
||||
Optional,
|
||||
Tuple,
|
||||
Union,
|
||||
)
|
||||
|
||||
|
||||
class BaseTable:
|
||||
def __init__(self, table_name: str, alias: Optional[str]) -> None: ...
|
||||
def as_sql(
|
||||
self,
|
||||
compiler: SQLCompiler,
|
||||
connection: DatabaseWrapper
|
||||
) -> Tuple[str, List[Any]]: ...
|
||||
def equals(self, other: Join, with_filtered_relation: bool) -> bool: ...
|
||||
def relabeled_clone(self, change_map: OrderedDict) -> BaseTable: ...
|
||||
|
||||
|
||||
class Join:
|
||||
def __eq__(
|
||||
self,
|
||||
other: Union[Join, BaseTable]
|
||||
) -> bool: ...
|
||||
def __init__(
|
||||
self,
|
||||
table_name: str,
|
||||
parent_alias: str,
|
||||
table_alias: Optional[str],
|
||||
join_type: str,
|
||||
join_field: Union[ForeignObjectRel, ForeignObject],
|
||||
nullable: bool,
|
||||
filtered_relation: Optional[FilteredRelation] = ...
|
||||
) -> None: ...
|
||||
def as_sql(
|
||||
self,
|
||||
compiler: SQLCompiler,
|
||||
connection: DatabaseWrapper
|
||||
) -> Union[Tuple[str, List[int]], Tuple[str, List[Any]], Tuple[str, List[str]]]: ...
|
||||
def demote(self) -> Join: ...
|
||||
def equals(
|
||||
self,
|
||||
other: Union[Join, BaseTable],
|
||||
with_filtered_relation: bool
|
||||
) -> bool: ...
|
||||
def promote(self) -> Join: ...
|
||||
def relabeled_clone(
|
||||
self,
|
||||
change_map: Union[Dict[str, str], OrderedDict]
|
||||
) -> Join: ...
|
||||
|
||||
|
||||
class MultiJoin:
|
||||
def __init__(
|
||||
self,
|
||||
names_pos: int,
|
||||
path_with_names: List[Tuple[str, List[PathInfo]]]
|
||||
) -> None: ...
|
||||
@@ -0,0 +1,18 @@
|
||||
from django.db.models.sql.where import WhereNode
|
||||
from typing import (
|
||||
Any,
|
||||
Set,
|
||||
Tuple,
|
||||
Type,
|
||||
Union,
|
||||
)
|
||||
|
||||
|
||||
class JoinPromoter:
|
||||
def __init__(self, connector: str, num_children: int, negated: bool) -> None: ...
|
||||
def add_votes(self, votes: Union[Tuple, Set[str]]) -> None: ...
|
||||
def update_join_types(self, query: Query) -> Set[str]: ...
|
||||
|
||||
|
||||
class Query:
|
||||
def __init__(self, model: Any, where: Type[WhereNode] = ...) -> None: ...
|
||||
@@ -0,0 +1,44 @@
|
||||
from django.db.models.base import Model
|
||||
from django.db.models.fields import CharField
|
||||
from django.db.models.query import QuerySet
|
||||
from django.db.models.sql.query import Query
|
||||
from django.db.models.sql.where import WhereNode
|
||||
from typing import (
|
||||
Any,
|
||||
Dict,
|
||||
List,
|
||||
Optional,
|
||||
Type,
|
||||
Union,
|
||||
)
|
||||
|
||||
|
||||
class AggregateQuery:
|
||||
def add_subquery(self, query: Query, using: str) -> None: ...
|
||||
|
||||
|
||||
class DeleteQuery:
|
||||
def delete_batch(self, pk_list: Union[List[int], List[str]], using: str) -> int: ...
|
||||
def delete_qs(self, query: QuerySet, using: str) -> int: ...
|
||||
def do_query(self, table: str, where: WhereNode, using: str) -> int: ...
|
||||
|
||||
|
||||
class InsertQuery:
|
||||
def __init__(self, *args, **kwargs) -> None: ...
|
||||
def insert_values(self, fields: Any, objs: Any, raw: bool = ...) -> None: ...
|
||||
|
||||
|
||||
class UpdateQuery:
|
||||
def __init__(self, *args, **kwargs) -> None: ...
|
||||
def _setup_query(self) -> None: ...
|
||||
def add_related_update(
|
||||
self,
|
||||
model: Type[Model],
|
||||
field: CharField,
|
||||
value: str
|
||||
) -> None: ...
|
||||
def add_update_fields(self, values_seq: Any) -> None: ...
|
||||
def add_update_values(self, values: Dict[str, Any]) -> None: ...
|
||||
def clone(self) -> UpdateQuery: ...
|
||||
def get_related_updates(self) -> List[UpdateQuery]: ...
|
||||
def update_batch(self, pk_list: List[int], values: Dict[str, Union[None, int]], using: str) -> None: ...
|
||||
@@ -0,0 +1,99 @@
|
||||
from collections import OrderedDict
|
||||
from django.db import DefaultConnectionProxy
|
||||
from django.db.backends.sqlite3.base import DatabaseWrapper
|
||||
from django.db.models.expressions import (
|
||||
Col,
|
||||
CombinedExpression,
|
||||
)
|
||||
from django.db.models.lookups import (
|
||||
Exact,
|
||||
FieldGetDbPrepValueMixin,
|
||||
GreaterThan,
|
||||
IntegerLessThan,
|
||||
LessThanOrEqual,
|
||||
)
|
||||
from django.db.models.sql.compiler import SQLCompiler
|
||||
from django.db.models.sql.query import Query
|
||||
from typing import (
|
||||
Any,
|
||||
Dict,
|
||||
List,
|
||||
Optional,
|
||||
Tuple,
|
||||
Union,
|
||||
)
|
||||
|
||||
|
||||
class ExtraWhere:
|
||||
def __init__(self, sqls: List[str], params: Optional[List[int]]) -> None: ...
|
||||
def as_sql(
|
||||
self,
|
||||
compiler: SQLCompiler = ...,
|
||||
connection: DatabaseWrapper = ...
|
||||
) -> Union[Tuple[str, List[int]], Tuple[str, List[Any]]]: ...
|
||||
|
||||
|
||||
class NothingNode:
|
||||
def as_sql(
|
||||
self,
|
||||
compiler: object = ...,
|
||||
connection: Union[DefaultConnectionProxy, backends.sqlite3.base.DatabaseWrapper] = ...
|
||||
): ...
|
||||
|
||||
|
||||
class SubqueryConstraint:
|
||||
def __init__(
|
||||
self,
|
||||
alias: str,
|
||||
columns: List[str],
|
||||
targets: List[str],
|
||||
query_object: Query
|
||||
) -> None: ...
|
||||
def as_sql(
|
||||
self,
|
||||
compiler: SQLCompiler,
|
||||
connection: DatabaseWrapper
|
||||
) -> Tuple[str, Tuple]: ...
|
||||
|
||||
|
||||
class WhereNode:
|
||||
@classmethod
|
||||
def _contains_aggregate(cls, obj: Any) -> bool: ...
|
||||
@classmethod
|
||||
def _contains_over_clause(
|
||||
cls,
|
||||
obj: Union[WhereNode, FieldGetDbPrepValueMixin]
|
||||
) -> bool: ...
|
||||
def as_sql(
|
||||
self,
|
||||
compiler: object,
|
||||
connection: Union[DefaultConnectionProxy, backends.sqlite3.base.DatabaseWrapper]
|
||||
) -> Any: ...
|
||||
def clone(self) -> WhereNode: ...
|
||||
@cached_property
|
||||
def contains_aggregate(self) -> bool: ...
|
||||
@cached_property
|
||||
def contains_over_clause(self) -> bool: ...
|
||||
def get_group_by_cols(
|
||||
self
|
||||
) -> Union[List[CombinedExpression], List[Col]]: ...
|
||||
def get_source_expressions(
|
||||
self
|
||||
) -> Union[List[GreaterThan], List[IntegerLessThan], List[Exact], List[LessThanOrEqual]]: ...
|
||||
def relabel_aliases(
|
||||
self,
|
||||
change_map: Union[OrderedDict, Dict[str, str], Dict[Union[str, None], str]]
|
||||
) -> None: ...
|
||||
def relabeled_clone(
|
||||
self,
|
||||
change_map: Union[OrderedDict, Dict[Union[str, None], str]]
|
||||
) -> WhereNode: ...
|
||||
def resolve_expression(self, *args, **kwargs) -> WhereNode: ...
|
||||
def set_source_expressions(
|
||||
self,
|
||||
children: Union[List[GreaterThan], List[IntegerLessThan], List[Exact]]
|
||||
) -> None: ...
|
||||
def split_having(
|
||||
self,
|
||||
negated: bool = ...
|
||||
) -> Union[Tuple[WhereNode, None], Tuple[None, WhereNode], Tuple[WhereNode, WhereNode]]: ...
|
||||
@@ -0,0 +1,7 @@
|
||||
from typing import (
|
||||
Any,
|
||||
Tuple,
|
||||
)
|
||||
|
||||
|
||||
def make_model_tuple(model: Any) -> Tuple[str, str]: ...
|
||||
Reference in New Issue
Block a user