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

@@ -1,15 +1,13 @@
from collections import OrderedDict
from datetime import datetime, timedelta
from typing import (Any, Callable, Dict, Iterator, List, Optional, Set, Tuple,
Type, Union)
from typing import Any, Callable, Dict, Iterator, List, Optional, Set, Tuple, Type, Union
from django.db.backends.sqlite3.base import DatabaseWrapper
from django.db.models.aggregates import Aggregate, Count
from django.db.models.fields import Field, DurationField
from django.db.models.fields.reverse_related import ForeignObjectRel
from django.db.models.functions.window import DenseRank
from django.db.models.lookups import (FieldGetDbPrepValueMixin, Lookup,
Transform)
from django.db.models.lookups import FieldGetDbPrepValueMixin, Lookup, Transform
from django.db.models.query import QuerySet
from django.db.models.query_utils import Q
from django.db.models.sql.compiler import SQLCompiler
@@ -17,14 +15,8 @@ from django.db.models.sql.query import Query
from django.db.models.sql.where import WhereNode
from django.utils.tree import Node
class SQLiteNumericMixin:
def as_sqlite(
self,
compiler: SQLCompiler,
connection: DatabaseWrapper,
**extra_context: Any
) -> Tuple[str, List[float]]: ...
def as_sqlite(self, compiler: SQLCompiler, connection: DatabaseWrapper, **extra_context: Any) -> Tuple[str, List[float]]: ...
class Combinable:
ADD: str = ...
@@ -38,15 +30,9 @@ class Combinable:
BITLEFTSHIFT: str = ...
BITRIGHTSHIFT: str = ...
def __neg__(self) -> CombinedExpression: ...
def __add__(
self, other: Optional[Union[timedelta, Combinable, float, str]]
) -> CombinedExpression: ...
def __sub__(
self, other: Union[timedelta, Combinable, float]
) -> CombinedExpression: ...
def __mul__(
self, other: Union[timedelta, Combinable, float]
) -> CombinedExpression: ...
def __add__(self, other: Optional[Union[timedelta, Combinable, float, str]]) -> CombinedExpression: ...
def __sub__(self, other: Union[timedelta, Combinable, float]) -> CombinedExpression: ...
def __mul__(self, other: Union[timedelta, Combinable, float]) -> CombinedExpression: ...
def __truediv__(self, other: Union[Count, float]) -> CombinedExpression: ...
def __mod__(self, other: int) -> CombinedExpression: ...
def __pow__(self, other: float) -> CombinedExpression: ...
@@ -56,9 +42,7 @@ class Combinable:
def bitrightshift(self, other: int) -> CombinedExpression: ...
def __or__(self, other: Combinable) -> Any: ...
def bitor(self, other: int) -> CombinedExpression: ...
def __radd__(
self, other: Optional[Union[datetime, float]]
) -> CombinedExpression: ...
def __radd__(self, other: Optional[Union[datetime, float]]) -> CombinedExpression: ...
def __rsub__(self, other: float) -> CombinedExpression: ...
def __rmul__(self, other: float) -> CombinedExpression: ...
def __rtruediv__(self, other: float) -> CombinedExpression: ...
@@ -72,12 +56,8 @@ class BaseExpression:
filterable: bool = ...
window_compatible: bool = ...
output_field: Any = ...
def __init__(
self, output_field: Optional[Union[Field, ForeignObjectRel, str]] = ...
) -> None: ...
def get_db_converters(
self, connection: DatabaseWrapper
) -> List[Callable]: ...
def __init__(self, output_field: Optional[Union[Field, ForeignObjectRel, str]] = ...) -> None: ...
def get_db_converters(self, connection: DatabaseWrapper) -> List[Callable]: ...
def get_source_expressions(self) -> List[Any]: ...
def set_source_expressions(self, exprs: List[Any]) -> None: ...
def as_sql(self, compiler: Any, connection: Any) -> None: ...
@@ -96,13 +76,9 @@ class BaseExpression:
def field(self) -> Field: ...
def output_field(self) -> Field: ...
def convert_value(self) -> Callable: ...
def get_lookup(
self, lookup: str
) -> Optional[Type[Union[FieldGetDbPrepValueMixin, Lookup]]]: ...
def get_lookup(self, lookup: str) -> Optional[Type[Union[FieldGetDbPrepValueMixin, Lookup]]]: ...
def get_transform(self, name: str) -> Optional[Type[Transform]]: ...
def relabeled_clone(
self, change_map: Union[Dict[Optional[str], str], OrderedDict]
) -> Expression: ...
def relabeled_clone(self, change_map: Union[Dict[Optional[str], str], OrderedDict]) -> Expression: ...
def copy(self) -> BaseExpression: ...
def get_group_by_cols(self) -> List[Expression]: ...
def get_source_fields(self) -> List[Optional[Field]]: ...
@@ -119,20 +95,10 @@ class CombinedExpression(SQLiteNumericMixin, Expression):
connector: Any = ...
lhs: Any = ...
rhs: Any = ...
def __init__(
self,
lhs: Combinable,
connector: str,
rhs: Combinable,
output_field: None = ...,
) -> None: ...
def get_source_expressions(
self
) -> Union[List[Combinable], List[SQLiteNumericMixin]]: ...
def __init__(self, lhs: Combinable, connector: str, rhs: Combinable, output_field: None = ...) -> None: ...
def get_source_expressions(self) -> Union[List[Combinable], List[SQLiteNumericMixin]]: ...
def set_source_expressions(self, exprs: List[Combinable]) -> None: ...
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 resolve_expression(
self,
query: Query = ...,
@@ -144,21 +110,14 @@ class CombinedExpression(SQLiteNumericMixin, Expression):
class DurationExpression(CombinedExpression):
def compile(
self,
side: Expression,
compiler: SQLCompiler,
connection: DatabaseWrapper,
) -> Tuple[str, Union[List[datetime], List[int]]]: ...
def as_sql(
self, compiler: SQLCompiler, connection: DatabaseWrapper
self, side: Expression, compiler: SQLCompiler, connection: DatabaseWrapper
) -> Tuple[str, Union[List[datetime], List[int]]]: ...
def as_sql(self, compiler: SQLCompiler, connection: DatabaseWrapper) -> Tuple[str, Union[List[datetime], List[int]]]: ...
class TemporalSubtraction(CombinedExpression):
output_field: Any = ...
def __init__(self, lhs: Col, rhs: Expression) -> None: ...
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 F(Combinable):
filterable: bool = ...
@@ -200,9 +159,7 @@ class Func(SQLiteNumericMixin, Expression):
arity: Any = ...
source_expressions: Any = ...
extra: Any = ...
def __init__(
self, *expressions: Any, output_field: Optional[Any] = ..., **extra: Any
) -> None: ...
def __init__(self, *expressions: Any, output_field: Optional[Any] = ..., **extra: Any) -> None: ...
def get_source_expressions(self) -> List[Combinable]: ...
def set_source_expressions(self, exprs: List[Expression]) -> None: ...
def resolve_expression(
@@ -226,12 +183,8 @@ class Func(SQLiteNumericMixin, Expression):
class Value(Expression):
value: Any = ...
def __init__(
self, value: Any, output_field: Optional[Field] = ...
) -> None: ...
def as_sql(
self, compiler: SQLCompiler, connection: DatabaseWrapper
) -> Tuple[str, List[float]]: ...
def __init__(self, value: Any, output_field: Optional[Field] = ...) -> None: ...
def as_sql(self, compiler: SQLCompiler, connection: DatabaseWrapper) -> Tuple[str, List[float]]: ...
def resolve_expression(
self,
query: Query = ...,
@@ -244,30 +197,19 @@ class Value(Expression):
class DurationValue(Value):
output_field: DurationField
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 RawSQL(Expression):
output_field: Field
params: List[Any]
sql: str
def __init__(
self,
sql: str,
params: Union[List[int], List[str], Tuple],
output_field: None = ...,
) -> None: ...
def as_sql(
self, compiler: SQLCompiler, connection: DatabaseWrapper
) -> Tuple[str, List[str]]: ...
def __init__(self, sql: str, params: Union[List[int], List[str], Tuple], output_field: None = ...) -> None: ...
def as_sql(self, compiler: SQLCompiler, connection: DatabaseWrapper) -> Tuple[str, List[str]]: ...
def get_group_by_cols(self) -> List[RawSQL]: ...
def __hash__(self): ...
class Star(Expression):
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 Random(Expression):
output_field: Any = ...
@@ -276,41 +218,21 @@ class Random(Expression):
class Col(Expression):
output_field: Field
contains_column_references: bool = ...
def __init__(
self,
alias: str,
target: Union[Field, str],
output_field: Optional[Field] = ...,
) -> None: ...
def as_sql(
self, compiler: SQLCompiler, connection: DatabaseWrapper
) -> Tuple[str, List[Any]]: ...
def relabeled_clone(
self, relabels: Union[Dict[str, str], OrderedDict]
) -> Col: ...
def __init__(self, alias: str, target: Union[Field, str], output_field: Optional[Field] = ...) -> None: ...
def as_sql(self, compiler: SQLCompiler, connection: DatabaseWrapper) -> Tuple[str, List[Any]]: ...
def relabeled_clone(self, relabels: Union[Dict[str, str], OrderedDict]) -> Col: ...
def get_group_by_cols(self) -> List[Col]: ...
def get_db_converters(
self, connection: DatabaseWrapper
) -> List[Callable]: ...
def get_db_converters(self, connection: DatabaseWrapper) -> List[Callable]: ...
class Ref(Expression):
def __init__(self, refs: str, source: Expression) -> None: ...
def get_source_expressions(
self
) -> Union[List[Expression], List[SQLiteNumericMixin]]: ...
def get_source_expressions(self) -> Union[List[Expression], List[SQLiteNumericMixin]]: ...
def set_source_expressions(self, exprs: Any) -> None: ...
def resolve_expression(
self,
query: Query = ...,
allow_joins: bool = ...,
reuse: None = ...,
summarize: bool = ...,
for_save: bool = ...,
self, query: Query = ..., allow_joins: bool = ..., reuse: None = ..., summarize: bool = ..., for_save: bool = ...
) -> Ref: ...
def relabeled_clone(self, relabels: Dict[Optional[str], str]) -> Ref: ...
def as_sql(
self, compiler: SQLCompiler, connection: DatabaseWrapper
) -> Tuple[str, List[Any]]: ...
def as_sql(self, compiler: SQLCompiler, connection: DatabaseWrapper) -> Tuple[str, List[Any]]: ...
def get_group_by_cols(self): ...
class ExpressionList(Func):
@@ -319,30 +241,18 @@ class ExpressionList(Func):
class ExpressionWrapper(Expression):
expression: Any = ...
def __init__(
self, expression: Union[CombinedExpression, Q], output_field: Field
) -> None: ...
def set_source_expressions(
self, exprs: Union[List[CombinedExpression], List[WhereNode]]
) -> None: ...
def get_source_expressions(
self
) -> Union[List[CombinedExpression], List[Node]]: ...
def as_sql(
self, compiler: SQLCompiler, connection: DatabaseWrapper
) -> Tuple[str, List[Any]]: ...
def __init__(self, expression: Union[CombinedExpression, Q], output_field: Field) -> None: ...
def set_source_expressions(self, exprs: Union[List[CombinedExpression], List[WhereNode]]) -> None: ...
def get_source_expressions(self) -> Union[List[CombinedExpression], List[Node]]: ...
def as_sql(self, compiler: SQLCompiler, connection: DatabaseWrapper) -> Tuple[str, List[Any]]: ...
class When(Expression):
template: str = ...
condition: Any = ...
result: Any = ...
def __init__(
self, condition: Any = ..., then: Any = ..., **lookups: Any
) -> None: ...
def __init__(self, condition: Any = ..., then: Any = ..., **lookups: Any) -> None: ...
def get_source_expressions(self) -> List[Union[Expression, WhereNode]]: ...
def set_source_expressions(
self, exprs: List[Union[Expression, WhereNode]]
) -> None: ...
def set_source_expressions(self, exprs: List[Union[Expression, WhereNode]]) -> None: ...
def get_source_fields(self) -> Union[List[None], List[Field]]: ...
def resolve_expression(
self,
@@ -353,11 +263,7 @@ class When(Expression):
for_save: bool = ...,
) -> When: ...
def as_sql(
self,
compiler: SQLCompiler,
connection: DatabaseWrapper,
template: None = ...,
**extra_context: Any
self, compiler: SQLCompiler, connection: DatabaseWrapper, template: None = ..., **extra_context: Any
) -> Tuple[str, List[Union[int, str]]]: ...
def get_group_by_cols(self) -> List[Col]: ...
@@ -367,13 +273,7 @@ class Case(Expression):
cases: Any = ...
default: Any = ...
extra: Any = ...
def __init__(
self,
*cases: Any,
default: Optional[Any] = ...,
output_field: Optional[Any] = ...,
**extra: Any
) -> None: ...
def __init__(self, *cases: Any, default: Optional[Any] = ..., output_field: Optional[Any] = ..., **extra: Any) -> None: ...
def get_source_expressions(self) -> List[Expression]: ...
def set_source_expressions(self, exprs: List[Expression]) -> None: ...
def resolve_expression(
@@ -398,12 +298,7 @@ class Subquery(Expression):
template: str = ...
queryset: QuerySet = ...
extra: Dict[Any, Any] = ...
def __init__(
self,
queryset: QuerySet,
output_field: Optional[Field] = ...,
**extra: Any
) -> None: ...
def __init__(self, queryset: QuerySet, output_field: Optional[Field] = ..., **extra: Any) -> None: ...
def copy(self) -> Subquery: ...
def resolve_expression(
self,
@@ -416,38 +311,20 @@ class Subquery(Expression):
def get_source_expressions(self) -> List[Col]: ...
def relabeled_clone(self, change_map: OrderedDict) -> Subquery: ...
def as_sql(
self,
compiler: SQLCompiler,
connection: DatabaseWrapper,
template: None = ...,
**extra_context: Any
self, compiler: SQLCompiler, connection: DatabaseWrapper, template: None = ..., **extra_context: Any
) -> Tuple[str, Tuple]: ...
class Exists(Subquery):
extra: Dict[Any, Any]
template: str = ...
negated: bool = ...
def __init__(
self, *args: Any, negated: bool = ..., **kwargs: Any
) -> None: ...
def __init__(self, *args: Any, negated: bool = ..., **kwargs: Any) -> None: ...
def __invert__(self) -> Exists: ...
def resolve_expression(
self, query: Query = ..., *args: Any, **kwargs: Any
) -> Exists: ...
def resolve_expression(self, query: Query = ..., *args: Any, **kwargs: Any) -> Exists: ...
def as_sql(
self,
compiler: SQLCompiler,
connection: DatabaseWrapper,
template: None = ...,
**extra_context: Any
self, compiler: SQLCompiler, connection: DatabaseWrapper, template: None = ..., **extra_context: Any
) -> Tuple[str, Tuple]: ...
def as_oracle(
self,
compiler: Any,
connection: Any,
template: Optional[Any] = ...,
**extra_context: Any
): ...
def as_oracle(self, compiler: Any, connection: Any, template: Optional[Any] = ..., **extra_context: Any): ...
class OrderBy(BaseExpression):
template: str = ...
@@ -456,24 +333,14 @@ class OrderBy(BaseExpression):
descending: bool = ...
expression: Expression = ...
def __init__(
self,
expression: Combinable,
descending: bool = ...,
nulls_first: bool = ...,
nulls_last: bool = ...,
self, expression: Combinable, descending: bool = ..., nulls_first: bool = ..., nulls_last: bool = ...
) -> None: ...
def set_source_expressions(self, exprs: List[Expression]) -> None: ...
def get_source_expressions(self) -> List[Combinable]: ...
def as_sql(
self,
compiler: SQLCompiler,
connection: DatabaseWrapper,
template: Optional[str] = ...,
**extra_context: Any
) -> Tuple[str, List[Union[int, str]]]: ...
def as_sqlite(
self, compiler: SQLCompiler, connection: DatabaseWrapper
self, compiler: SQLCompiler, connection: DatabaseWrapper, template: Optional[str] = ..., **extra_context: Any
) -> Tuple[str, List[Union[int, str]]]: ...
def as_sqlite(self, compiler: SQLCompiler, connection: DatabaseWrapper) -> Tuple[str, List[Union[int, str]]]: ...
def as_mysql(self, compiler: Any, connection: Any): ...
def get_group_by_cols(self): ...
def reverse_ordering(self) -> OrderBy: ...
@@ -498,16 +365,8 @@ class Window(Expression):
output_field: None = ...,
) -> None: ...
def get_source_expressions(self): ...
def set_source_expressions(
self, exprs: List[Optional[DenseRank]]
) -> None: ...
def as_sql(
self,
compiler: Any,
connection: Any,
function: Optional[Any] = ...,
template: Optional[Any] = ...,
): ...
def set_source_expressions(self, exprs: List[Optional[DenseRank]]) -> None: ...
def as_sql(self, compiler: Any, connection: Any, function: Optional[Any] = ..., template: Optional[Any] = ...): ...
def get_group_by_cols(self) -> List[Any]: ...
class WindowFrame(Expression):
@@ -519,9 +378,7 @@ class WindowFrame(Expression):
def get_source_expressions(self): ...
def as_sql(self, compiler: Any, connection: Any): ...
def get_group_by_cols(self) -> List[Any]: ...
def window_frame_start_end(
self, connection: Any, start: Any, end: Any
) -> None: ...
def window_frame_start_end(self, connection: Any, start: Any, end: Any) -> None: ...
class RowRange(WindowFrame):
end: None