mirror of
https://github.com/davidhalter/django-stubs.git
synced 2025-12-08 21:14:49 +08:00
more cleanups
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
from datetime import date, datetime, timedelta
|
from datetime import date, datetime, timedelta
|
||||||
from decimal import Decimal
|
from decimal import Decimal
|
||||||
from typing import Any, List, Optional, Set, Tuple, Type, Union
|
from typing import Any, List, Optional, Set, Tuple, Type, Union, Sequence
|
||||||
|
|
||||||
from django.core.management.color import Style
|
from django.core.management.color import Style
|
||||||
from django.db import DefaultConnectionProxy
|
from django.db import DefaultConnectionProxy
|
||||||
@@ -97,7 +97,7 @@ class BaseDatabaseOperations:
|
|||||||
def sequence_reset_sql(
|
def sequence_reset_sql(
|
||||||
self,
|
self,
|
||||||
style: Style,
|
style: Style,
|
||||||
model_list: Union[List[Type[Model]], Set[Type[Model]]],
|
model_list: Sequence[Type[Model]],
|
||||||
) -> List[Any]: ...
|
) -> List[Any]: ...
|
||||||
def start_transaction_sql(self) -> str: ...
|
def start_transaction_sql(self) -> str: ...
|
||||||
def end_transaction_sql(self, success: bool = ...) -> str: ...
|
def end_transaction_sql(self, success: bool = ...) -> str: ...
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ class DatabaseClient(BaseDatabaseClient):
|
|||||||
settings_dict: Dict[
|
settings_dict: Dict[
|
||||||
str,
|
str,
|
||||||
Optional[
|
Optional[
|
||||||
Union[Dict[Any, Any], Dict[str, Dict[str, str]], int, str]
|
Union[Dict[str, Dict[str, str]], int, str]
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
) -> List[str]: ...
|
) -> List[str]: ...
|
||||||
|
|||||||
@@ -111,17 +111,7 @@ class ForeignObject(RelatedField):
|
|||||||
Optional[str],
|
Optional[str],
|
||||||
str,
|
str,
|
||||||
List[Any],
|
List[Any],
|
||||||
Dict[
|
Dict[str, Any],
|
||||||
str,
|
|
||||||
Union[
|
|
||||||
Callable,
|
|
||||||
Dict[str, Union[int, str]],
|
|
||||||
List[None],
|
|
||||||
List[str],
|
|
||||||
bool,
|
|
||||||
str,
|
|
||||||
],
|
|
||||||
],
|
|
||||||
]: ...
|
]: ...
|
||||||
def resolve_related_fields(self) -> List[Tuple[Field, Field]]: ...
|
def resolve_related_fields(self) -> List[Tuple[Field, Field]]: ...
|
||||||
@property
|
@property
|
||||||
|
|||||||
@@ -1,14 +1,12 @@
|
|||||||
from collections import OrderedDict
|
from collections import OrderedDict
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from typing import Any, Dict, List, Optional, Tuple, Type, Union
|
from typing import Any, Dict, List, Optional, Tuple, Type, Union, Iterable
|
||||||
from uuid import UUID
|
|
||||||
|
|
||||||
from django.db.backends.sqlite3.base import DatabaseWrapper
|
from django.db.backends.sqlite3.base import DatabaseWrapper
|
||||||
from django.db.models.base import Model
|
from django.db.models import expressions, lookups
|
||||||
from django.db.models.expressions import (Col, Combinable, Expression, Func,
|
from django.db.models.expressions import (Col, Combinable, Expression, Func,
|
||||||
Ref, Subquery)
|
Ref)
|
||||||
from django.db.models.fields import TextField
|
from django.db.models.fields import TextField, related_lookups
|
||||||
from django.db.models.fields.related_lookups import MultiColSource
|
|
||||||
from django.db.models.query_utils import RegisterLookupMixin
|
from django.db.models.query_utils import RegisterLookupMixin
|
||||||
from django.db.models.sql.compiler import SQLCompiler
|
from django.db.models.sql.compiler import SQLCompiler
|
||||||
from django.db.models.sql.query import Query
|
from django.db.models.sql.query import Query
|
||||||
@@ -90,16 +88,7 @@ class FieldGetDbPrepValueIterableMixin(FieldGetDbPrepValueMixin):
|
|||||||
get_db_prep_lookup_value_is_iterable: bool = ...
|
get_db_prep_lookup_value_is_iterable: bool = ...
|
||||||
def get_prep_lookup(
|
def get_prep_lookup(
|
||||||
self
|
self
|
||||||
) -> Union[
|
) -> Iterable[Any]: ...
|
||||||
List[datetime],
|
|
||||||
List[Model],
|
|
||||||
List[Combinable],
|
|
||||||
List[int],
|
|
||||||
List[str],
|
|
||||||
List[UUID],
|
|
||||||
Subquery,
|
|
||||||
Query,
|
|
||||||
]: ...
|
|
||||||
def process_rhs(
|
def process_rhs(
|
||||||
self, compiler: SQLCompiler, connection: DatabaseWrapper
|
self, compiler: SQLCompiler, connection: DatabaseWrapper
|
||||||
) -> Tuple[Union[Tuple[str, str], str], Tuple]: ...
|
) -> Tuple[Union[Tuple[str, str], str], Tuple]: ...
|
||||||
@@ -118,10 +107,10 @@ class FieldGetDbPrepValueIterableMixin(FieldGetDbPrepValueMixin):
|
|||||||
) -> Tuple[Tuple[str], Tuple]: ...
|
) -> Tuple[Tuple[str], Tuple]: ...
|
||||||
|
|
||||||
class Exact(FieldGetDbPrepValueMixin, BuiltinLookup):
|
class Exact(FieldGetDbPrepValueMixin, BuiltinLookup):
|
||||||
bilateral_transforms: List[Type[django.db.models.lookups.Transform]]
|
bilateral_transforms: List[Type[lookups.Transform]]
|
||||||
contains_aggregate: bool
|
contains_aggregate: bool
|
||||||
contains_over_clause: bool
|
contains_over_clause: bool
|
||||||
lhs: django.db.models.expressions.Expression
|
lhs: Expression
|
||||||
rhs: Any
|
rhs: Any
|
||||||
lookup_name: str = ...
|
lookup_name: str = ...
|
||||||
def process_rhs(
|
def process_rhs(
|
||||||
@@ -131,8 +120,8 @@ class Exact(FieldGetDbPrepValueMixin, BuiltinLookup):
|
|||||||
class IExact(BuiltinLookup):
|
class IExact(BuiltinLookup):
|
||||||
bilateral_transforms: List[Any]
|
bilateral_transforms: List[Any]
|
||||||
contains_aggregate: bool
|
contains_aggregate: bool
|
||||||
lhs: django.db.models.expressions.Col
|
lhs: expressions.Col
|
||||||
rhs: Optional[Union[django.db.models.expressions.Col, str]]
|
rhs: Optional[Union[expressions.Col, str]]
|
||||||
lookup_name: str = ...
|
lookup_name: str = ...
|
||||||
prepare_rhs: bool = ...
|
prepare_rhs: bool = ...
|
||||||
def process_rhs(
|
def process_rhs(
|
||||||
@@ -142,47 +131,30 @@ class IExact(BuiltinLookup):
|
|||||||
class GreaterThan(FieldGetDbPrepValueMixin, BuiltinLookup):
|
class GreaterThan(FieldGetDbPrepValueMixin, BuiltinLookup):
|
||||||
bilateral_transforms: List[Any]
|
bilateral_transforms: List[Any]
|
||||||
contains_aggregate: bool
|
contains_aggregate: bool
|
||||||
lhs: django.db.models.expressions.Expression
|
lhs: Expression
|
||||||
rhs: Any
|
rhs: Any
|
||||||
lookup_name: str = ...
|
lookup_name: str = ...
|
||||||
|
|
||||||
class GreaterThanOrEqual(FieldGetDbPrepValueMixin, BuiltinLookup):
|
class GreaterThanOrEqual(FieldGetDbPrepValueMixin, BuiltinLookup):
|
||||||
bilateral_transforms: List[Any]
|
bilateral_transforms: List[Any]
|
||||||
contains_aggregate: bool
|
contains_aggregate: bool
|
||||||
lhs: django.db.models.expressions.Expression
|
lhs: Expression
|
||||||
rhs: Union[
|
rhs: Any
|
||||||
datetime.datetime,
|
|
||||||
decimal.Decimal,
|
|
||||||
django.db.models.expressions.Combinable,
|
|
||||||
int,
|
|
||||||
str,
|
|
||||||
]
|
|
||||||
lookup_name: str = ...
|
lookup_name: str = ...
|
||||||
|
|
||||||
class LessThan(FieldGetDbPrepValueMixin, BuiltinLookup):
|
class LessThan(FieldGetDbPrepValueMixin, BuiltinLookup):
|
||||||
bilateral_transforms: List[Any]
|
bilateral_transforms: List[Any]
|
||||||
contains_aggregate: bool
|
contains_aggregate: bool
|
||||||
lhs: django.db.models.expressions.Expression
|
lhs: Expression
|
||||||
rhs: Union[
|
rhs: Any
|
||||||
datetime.datetime,
|
|
||||||
decimal.Decimal,
|
|
||||||
django.db.models.expressions.CombinedExpression,
|
|
||||||
float,
|
|
||||||
str,
|
|
||||||
]
|
|
||||||
lookup_name: str = ...
|
lookup_name: str = ...
|
||||||
|
|
||||||
class LessThanOrEqual(FieldGetDbPrepValueMixin, BuiltinLookup):
|
class LessThanOrEqual(FieldGetDbPrepValueMixin, BuiltinLookup):
|
||||||
bilateral_transforms: List[Type[django.db.models.lookups.Transform]]
|
bilateral_transforms: List[Type[lookups.Transform]]
|
||||||
contains_aggregate: bool
|
contains_aggregate: bool
|
||||||
contains_over_clause: bool
|
contains_over_clause: bool
|
||||||
lhs: django.db.models.expressions.Expression
|
lhs: Expression
|
||||||
rhs: Union[
|
rhs: Any
|
||||||
datetime.date,
|
|
||||||
decimal.Decimal,
|
|
||||||
django.db.models.expressions.Expression,
|
|
||||||
float,
|
|
||||||
]
|
|
||||||
lookup_name: str = ...
|
lookup_name: str = ...
|
||||||
|
|
||||||
class IntegerFieldFloatRounding:
|
class IntegerFieldFloatRounding:
|
||||||
@@ -195,9 +167,9 @@ class IntegerGreaterThanOrEqual(
|
|||||||
class IntegerLessThan(IntegerFieldFloatRounding, LessThan): ...
|
class IntegerLessThan(IntegerFieldFloatRounding, LessThan): ...
|
||||||
|
|
||||||
class In(FieldGetDbPrepValueIterableMixin, BuiltinLookup):
|
class In(FieldGetDbPrepValueIterableMixin, BuiltinLookup):
|
||||||
bilateral_transforms: List[Type[django.db.models.lookups.Transform]]
|
bilateral_transforms: List[Type[lookups.Transform]]
|
||||||
contains_aggregate: bool
|
contains_aggregate: bool
|
||||||
lhs: django.db.models.expressions.Expression
|
lhs: Expression
|
||||||
rhs: Any
|
rhs: Any
|
||||||
lookup_name: str = ...
|
lookup_name: str = ...
|
||||||
def process_rhs(
|
def process_rhs(
|
||||||
@@ -218,57 +190,57 @@ class PatternLookup(BuiltinLookup):
|
|||||||
) -> Tuple[str, List[Any]]: ...
|
) -> Tuple[str, List[Any]]: ...
|
||||||
|
|
||||||
class Contains(PatternLookup):
|
class Contains(PatternLookup):
|
||||||
bilateral_transforms: List[Type[django.db.models.lookups.Transform]]
|
bilateral_transforms: List[Type[lookups.Transform]]
|
||||||
contains_aggregate: bool
|
contains_aggregate: bool
|
||||||
lhs: django.db.models.expressions.Expression
|
lhs: Expression
|
||||||
rhs: Union[django.db.models.expressions.Expression, str]
|
rhs: Union[Expression, str]
|
||||||
lookup_name: str = ...
|
lookup_name: str = ...
|
||||||
|
|
||||||
class IContains(Contains):
|
class IContains(Contains):
|
||||||
bilateral_transforms: List[Any]
|
bilateral_transforms: List[Any]
|
||||||
contains_aggregate: bool
|
contains_aggregate: bool
|
||||||
lhs: django.db.models.expressions.Col
|
lhs: expressions.Col
|
||||||
rhs: Union[django.db.models.expressions.Expression, str]
|
rhs: Union[Expression, str]
|
||||||
lookup_name: str = ...
|
lookup_name: str = ...
|
||||||
|
|
||||||
class StartsWith(PatternLookup):
|
class StartsWith(PatternLookup):
|
||||||
bilateral_transforms: List[Any]
|
bilateral_transforms: List[Any]
|
||||||
contains_aggregate: bool
|
contains_aggregate: bool
|
||||||
lhs: django.db.models.expressions.Col
|
lhs: expressions.Col
|
||||||
rhs: Union[django.db.models.expressions.Expression, str]
|
rhs: Union[Expression, str]
|
||||||
lookup_name: str = ...
|
lookup_name: str = ...
|
||||||
param_pattern: str = ...
|
param_pattern: str = ...
|
||||||
|
|
||||||
class IStartsWith(StartsWith):
|
class IStartsWith(StartsWith):
|
||||||
bilateral_transforms: List[Any]
|
bilateral_transforms: List[Any]
|
||||||
contains_aggregate: bool
|
contains_aggregate: bool
|
||||||
lhs: django.db.models.expressions.Col
|
lhs: expressions.Col
|
||||||
rhs: Union[django.db.models.expressions.Expression, str]
|
rhs: Union[Expression, str]
|
||||||
lookup_name: str = ...
|
lookup_name: str = ...
|
||||||
|
|
||||||
class EndsWith(PatternLookup):
|
class EndsWith(PatternLookup):
|
||||||
bilateral_transforms: List[Any]
|
bilateral_transforms: List[Any]
|
||||||
contains_aggregate: bool
|
contains_aggregate: bool
|
||||||
lhs: django.db.models.expressions.Col
|
lhs: expressions.Col
|
||||||
rhs: Union[django.db.models.expressions.Expression, str]
|
rhs: Union[Expression, str]
|
||||||
lookup_name: str = ...
|
lookup_name: str = ...
|
||||||
param_pattern: str = ...
|
param_pattern: str = ...
|
||||||
|
|
||||||
class IEndsWith(EndsWith):
|
class IEndsWith(EndsWith):
|
||||||
bilateral_transforms: List[Any]
|
bilateral_transforms: List[Any]
|
||||||
contains_aggregate: bool
|
contains_aggregate: bool
|
||||||
lhs: django.db.models.expressions.Col
|
lhs: expressions.Col
|
||||||
rhs: Union[django.db.models.expressions.Expression, str]
|
rhs: Union[Expression, str]
|
||||||
lookup_name: str = ...
|
lookup_name: str = ...
|
||||||
|
|
||||||
class Range(FieldGetDbPrepValueIterableMixin, BuiltinLookup):
|
class Range(FieldGetDbPrepValueIterableMixin, BuiltinLookup):
|
||||||
bilateral_transforms: List[Type[django.db.models.lookups.Transform]]
|
bilateral_transforms: List[Type[lookups.Transform]]
|
||||||
contains_aggregate: bool
|
contains_aggregate: bool
|
||||||
lhs: django.db.models.expressions.Expression
|
lhs: Expression
|
||||||
rhs: Union[
|
rhs: Union[
|
||||||
List[datetime.datetime],
|
List[datetime.datetime],
|
||||||
Tuple[
|
Tuple[
|
||||||
Union[django.db.models.expressions.F, int],
|
Union[expressions.F, int],
|
||||||
Union[datetime.datetime, int],
|
Union[datetime.datetime, int],
|
||||||
],
|
],
|
||||||
]
|
]
|
||||||
@@ -280,7 +252,7 @@ class Range(FieldGetDbPrepValueIterableMixin, BuiltinLookup):
|
|||||||
class IsNull(BuiltinLookup):
|
class IsNull(BuiltinLookup):
|
||||||
bilateral_transforms: List[Any]
|
bilateral_transforms: List[Any]
|
||||||
contains_aggregate: bool
|
contains_aggregate: bool
|
||||||
lhs: django.db.models.expressions.Expression
|
lhs: Expression
|
||||||
rhs: bool
|
rhs: bool
|
||||||
lookup_name: str = ...
|
lookup_name: str = ...
|
||||||
prepare_rhs: bool = ...
|
prepare_rhs: bool = ...
|
||||||
@@ -291,7 +263,7 @@ class IsNull(BuiltinLookup):
|
|||||||
class Regex(BuiltinLookup):
|
class Regex(BuiltinLookup):
|
||||||
bilateral_transforms: List[Any]
|
bilateral_transforms: List[Any]
|
||||||
contains_aggregate: bool
|
contains_aggregate: bool
|
||||||
lhs: django.db.models.expressions.Col
|
lhs: expressions.Col
|
||||||
rhs: str
|
rhs: str
|
||||||
lookup_name: str = ...
|
lookup_name: str = ...
|
||||||
prepare_rhs: bool = ...
|
prepare_rhs: bool = ...
|
||||||
@@ -302,7 +274,7 @@ class Regex(BuiltinLookup):
|
|||||||
class IRegex(Regex):
|
class IRegex(Regex):
|
||||||
bilateral_transforms: List[Any]
|
bilateral_transforms: List[Any]
|
||||||
contains_aggregate: bool
|
contains_aggregate: bool
|
||||||
lhs: django.db.models.expressions.Col
|
lhs: expressions.Col
|
||||||
rhs: str
|
rhs: str
|
||||||
lookup_name: str = ...
|
lookup_name: str = ...
|
||||||
|
|
||||||
@@ -313,8 +285,8 @@ class YearLookup(Lookup):
|
|||||||
|
|
||||||
class YearComparisonLookup(YearLookup):
|
class YearComparisonLookup(YearLookup):
|
||||||
bilateral_transforms: List[Any]
|
bilateral_transforms: List[Any]
|
||||||
lhs: django.db.models.expressions.Value
|
lhs: expressions.Value
|
||||||
rhs: django.db.models.expressions.Value
|
rhs: expressions.Value
|
||||||
def as_sql(
|
def as_sql(
|
||||||
self, compiler: SQLCompiler, connection: DatabaseWrapper
|
self, compiler: SQLCompiler, connection: DatabaseWrapper
|
||||||
) -> Tuple[str, List[str]]: ...
|
) -> Tuple[str, List[str]]: ...
|
||||||
|
|||||||
Reference in New Issue
Block a user