run black over stubs, add checking to travis

This commit is contained in:
Maxim Kurnikov
2018-12-03 18:52:44 +03:00
parent d5bc7d4ab2
commit cf6119bf9b
420 changed files with 2295 additions and 8384 deletions

View File

@@ -4,8 +4,7 @@ from typing import Any, Dict, List, Optional, Tuple, Type, Union, Iterable
from django.db.backends.sqlite3.base import DatabaseWrapper
from django.db.models import expressions, lookups
from django.db.models.expressions import (Col, Combinable, Expression, Func,
Ref)
from django.db.models.expressions import Col, Combinable, Expression, Func, Ref
from django.db.models.fields import TextField, related_lookups
from django.db.models.query_utils import RegisterLookupMixin
from django.db.models.sql.compiler import SQLCompiler
@@ -13,37 +12,24 @@ from django.db.models.sql.query import Query
from django.utils.datastructures import OrderedSet
from django.utils.safestring import SafeText
class Lookup:
lookup_name: Any = ...
prepare_rhs: bool = ...
can_use_none_as_rhs: bool = ...
rhs: Any = ...
bilateral_transforms: Any = ...
def __init__(
self,
lhs: Union[Expression, TextField, related_lookups.MultiColSource],
rhs: Any,
) -> None: ...
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: DatabaseWrapper,
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[Ref]) -> None: ...
def get_prep_lookup(self) -> Any: ...
def get_db_prep_lookup(
self, value: Union[int, str], connection: DatabaseWrapper
) -> 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: DatabaseWrapper,
lhs: Optional[Col] = ...,
self, compiler: SQLCompiler, connection: DatabaseWrapper, lhs: Optional[Col] = ...
) -> Tuple[str, List[Union[int, str]]]: ...
def process_rhs(
self, compiler: SQLCompiler, connection: DatabaseWrapper
@@ -68,42 +54,24 @@ class Transform(RegisterLookupMixin, Func):
class BuiltinLookup(Lookup):
def process_lhs(
self,
compiler: SQLCompiler,
connection: DatabaseWrapper,
lhs: Optional[Col] = ...,
self, compiler: SQLCompiler, connection: DatabaseWrapper, lhs: Optional[Col] = ...
) -> Tuple[str, List[Union[int, str]]]: ...
def as_sql(
self, compiler: SQLCompiler, connection: DatabaseWrapper
) -> Tuple[str, List[float]]: ...
def as_sql(self, compiler: SQLCompiler, connection: DatabaseWrapper) -> Tuple[str, List[float]]: ...
def get_rhs_op(self, connection: DatabaseWrapper, rhs: str) -> str: ...
class FieldGetDbPrepValueMixin:
get_db_prep_lookup_value_is_iterable: bool = ...
def get_db_prep_lookup(
self, value: Any, connection: DatabaseWrapper
) -> Tuple[str, List[float]]: ...
def get_db_prep_lookup(self, value: Any, connection: DatabaseWrapper) -> Tuple[str, List[float]]: ...
class FieldGetDbPrepValueIterableMixin(FieldGetDbPrepValueMixin):
get_db_prep_lookup_value_is_iterable: bool = ...
def get_prep_lookup(
self
) -> Iterable[Any]: ...
def process_rhs(
self, compiler: SQLCompiler, connection: DatabaseWrapper
) -> Tuple[Union[Tuple[str, str], str], Tuple]: ...
def get_prep_lookup(self) -> Iterable[Any]: ...
def process_rhs(self, compiler: SQLCompiler, connection: DatabaseWrapper) -> Tuple[Union[Tuple[str, str], str], Tuple]: ...
def resolve_expression_parameter(
self,
compiler: SQLCompiler,
connection: DatabaseWrapper,
sql: str,
param: Optional[Union[Combinable, int, str]],
self, compiler: SQLCompiler, connection: DatabaseWrapper, sql: str, param: Optional[Union[Combinable, int, str]]
) -> Tuple[str, List[None]]: ...
def batch_process_rhs(
self,
compiler: SQLCompiler,
connection: DatabaseWrapper,
rhs: Optional[OrderedSet] = ...,
self, compiler: SQLCompiler, connection: DatabaseWrapper, rhs: Optional[OrderedSet] = ...
) -> Tuple[Tuple[str], Tuple]: ...
class Exact(FieldGetDbPrepValueMixin, BuiltinLookup):
@@ -124,9 +92,7 @@ class IExact(BuiltinLookup):
rhs: Optional[Union[expressions.Col, str]]
lookup_name: str = ...
prepare_rhs: bool = ...
def process_rhs(
self, qn: SQLCompiler, connection: DatabaseWrapper
) -> Tuple[str, List[str]]: ...
def process_rhs(self, qn: SQLCompiler, connection: DatabaseWrapper) -> Tuple[str, List[str]]: ...
class GreaterThan(FieldGetDbPrepValueMixin, BuiltinLookup):
bilateral_transforms: List[Any]
@@ -161,9 +127,7 @@ class IntegerFieldFloatRounding:
rhs: Any = ...
def get_prep_lookup(self) -> Union[Combinable, Query, int]: ...
class IntegerGreaterThanOrEqual(
IntegerFieldFloatRounding, GreaterThanOrEqual
): ...
class IntegerGreaterThanOrEqual(IntegerFieldFloatRounding, GreaterThanOrEqual): ...
class IntegerLessThan(IntegerFieldFloatRounding, LessThan): ...
class In(FieldGetDbPrepValueIterableMixin, BuiltinLookup):
@@ -172,22 +136,16 @@ class In(FieldGetDbPrepValueIterableMixin, BuiltinLookup):
lhs: Expression
rhs: Any
lookup_name: str = ...
def process_rhs(
self, compiler: SQLCompiler, connection: DatabaseWrapper
) -> Tuple[str, Tuple]: ...
def process_rhs(self, compiler: SQLCompiler, connection: DatabaseWrapper) -> Tuple[str, Tuple]: ...
def get_rhs_op(self, connection: DatabaseWrapper, rhs: str) -> str: ...
def as_sql(
self, compiler: SQLCompiler, connection: DatabaseWrapper
) -> Tuple[str, List[Union[int, str]]]: ...
def as_sql(self, compiler: SQLCompiler, connection: DatabaseWrapper) -> Tuple[str, List[Union[int, 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: ...
def process_rhs(
self, qn: SQLCompiler, connection: DatabaseWrapper
) -> Tuple[str, List[Any]]: ...
def process_rhs(self, qn: SQLCompiler, connection: DatabaseWrapper) -> Tuple[str, List[Any]]: ...
class Contains(PatternLookup):
bilateral_transforms: List[Type[lookups.Transform]]
@@ -237,17 +195,9 @@ class Range(FieldGetDbPrepValueIterableMixin, BuiltinLookup):
bilateral_transforms: List[Type[lookups.Transform]]
contains_aggregate: bool
lhs: Expression
rhs: Union[
List[datetime.datetime],
Tuple[
Union[expressions.F, int],
Union[datetime.datetime, int],
],
]
rhs: Union[List[datetime.datetime], Tuple[Union[expressions.F, int], Union[datetime.datetime, int]]]
lookup_name: str = ...
def get_rhs_op(
self, connection: DatabaseWrapper, rhs: Tuple[str, str]
) -> str: ...
def get_rhs_op(self, connection: DatabaseWrapper, rhs: Tuple[str, str]) -> str: ...
class IsNull(BuiltinLookup):
bilateral_transforms: List[Any]
@@ -256,9 +206,7 @@ class IsNull(BuiltinLookup):
rhs: bool
lookup_name: str = ...
prepare_rhs: bool = ...
def as_sql(
self, compiler: SQLCompiler, connection: DatabaseWrapper
) -> Tuple[str, List[Any]]: ...
def as_sql(self, compiler: SQLCompiler, connection: DatabaseWrapper) -> Tuple[str, List[Any]]: ...
class Regex(BuiltinLookup):
bilateral_transforms: List[Any]
@@ -267,9 +215,7 @@ class Regex(BuiltinLookup):
rhs: str
lookup_name: str = ...
prepare_rhs: bool = ...
def as_sql(
self, compiler: SQLCompiler, connection: DatabaseWrapper
) -> Tuple[str, List[str]]: ...
def as_sql(self, compiler: SQLCompiler, connection: DatabaseWrapper) -> Tuple[str, List[str]]: ...
class IRegex(Regex):
bilateral_transforms: List[Any]
@@ -279,17 +225,13 @@ class IRegex(Regex):
lookup_name: str = ...
class YearLookup(Lookup):
def year_lookup_bounds(
self, connection: DatabaseWrapper, year: int
) -> List[str]: ...
def year_lookup_bounds(self, connection: DatabaseWrapper, year: int) -> List[str]: ...
class YearComparisonLookup(YearLookup):
bilateral_transforms: List[Any]
lhs: expressions.Value
rhs: expressions.Value
def as_sql(
self, compiler: SQLCompiler, connection: DatabaseWrapper
) -> Tuple[str, List[str]]: ...
def as_sql(self, compiler: SQLCompiler, connection: DatabaseWrapper) -> Tuple[str, List[str]]: ...
def get_rhs_op(self, connection: DatabaseWrapper, rhs: str) -> str: ...
def get_bound(self, start: datetime, finish: datetime) -> Any: ...
@@ -299,9 +241,7 @@ class YearExact(YearLookup, Exact):
lhs: django.db.models.functions.datetime.ExtractYear
rhs: Union[django.db.models.functions.datetime.Extract, int, str]
lookup_name: str = ...
def as_sql(
self, compiler: SQLCompiler, connection: DatabaseWrapper
) -> Tuple[str, List[str]]: ...
def as_sql(self, compiler: SQLCompiler, connection: DatabaseWrapper) -> Tuple[str, List[str]]: ...
class YearGt(YearComparisonLookup):
bilateral_transforms: List[Any]