black reformat, some fixes

This commit is contained in:
Maxim Kurnikov
2018-12-06 19:13:06 +03:00
parent 25a71a7ef5
commit 5ec2830ba6
108 changed files with 673 additions and 187 deletions

View File

@@ -37,7 +37,11 @@ class Template:
str,
Dict[
str,
Optional[Union[Dict[str, str], List[Dict[str, Optional[Union[Dict[str, str], bool, str]]]], bool, str]],
Optional[
Union[
Dict[str, str], List[Dict[str, Optional[Union[Dict[str, str], bool, str]]]], bool, str
]
],
],
],
Dict[
@@ -83,7 +87,13 @@ class Template:
str,
Union[
Dict[str, str],
List[Tuple[Optional[str], List[Dict[str, Union[Dict[str, Union[bool, str]], time, int, str]]], int]],
List[
Tuple[
Optional[str],
List[Dict[str, Union[Dict[str, Union[bool, str]], time, int, str]]],
int,
]
],
List[str],
bool,
str,

View File

@@ -42,7 +42,10 @@ class Origin:
template_name: Optional[Union[bytes, str]] = ...
loader: Optional[Union[django.template.backends.dummy.TemplateStrings, django.template.loaders.base.Loader]] = ...
def __init__(
self, name: str, template_name: Optional[Union[bytes, str]] = ..., loader: Optional[Union[TemplateStrings, Loader]] = ...
self,
name: str,
template_name: Optional[Union[bytes, str]] = ...,
loader: Optional[Union[TemplateStrings, Loader]] = ...,
) -> None: ...
def __eq__(self, other: Origin) -> bool: ...
@property
@@ -55,7 +58,11 @@ class Template:
source: str = ...
nodelist: django.template.base.NodeList = ...
def __init__(
self, template_string: str, origin: Optional[Origin] = ..., name: Optional[str] = ..., engine: Optional[Engine] = ...
self,
template_string: str,
origin: Optional[Origin] = ...,
name: Optional[str] = ...,
engine: Optional[Engine] = ...,
) -> None: ...
def __iter__(self) -> None: ...
def render(self, context: Context) -> Any: ...
@@ -72,7 +79,11 @@ class Token:
lineno: Optional[int] = ...
position: Optional[Tuple[int, int]] = ...
def __init__(
self, token_type: TokenType, contents: str, position: Optional[Tuple[int, int]] = ..., lineno: Optional[int] = ...
self,
token_type: TokenType,
contents: str,
position: Optional[Tuple[int, int]] = ...,
lineno: Optional[int] = ...,
) -> None: ...
def split_contents(self) -> List[str]: ...
@@ -81,7 +92,9 @@ class Lexer:
verbatim: Union[bool, str] = ...
def __init__(self, template_string: str) -> None: ...
def tokenize(self) -> List[Token]: ...
def create_token(self, token_string: str, position: Optional[Tuple[int, int]], lineno: int, in_tag: bool) -> Token: ...
def create_token(
self, token_string: str, position: Optional[Tuple[int, int]], lineno: int, in_tag: bool
) -> Token: ...
class DebugLexer(Lexer):
template_string: str

View File

@@ -57,7 +57,9 @@ class Context(BaseContext):
template_name: Optional[str] = ...
render_context: django.template.context.RenderContext = ...
template: Optional[django.template.base.Template] = ...
def __init__(self, dict_: Any = ..., autoescape: bool = ..., use_l10n: Optional[bool] = ..., use_tz: None = ...) -> None: ...
def __init__(
self, dict_: Any = ..., autoescape: bool = ..., use_l10n: Optional[bool] = ..., use_tz: None = ...
) -> None: ...
def bind_template(self, template: Template) -> Iterator[None]: ...
def __copy__(self) -> Context: ...
def update(self, other_dict: Union[Dict[str, Model], Dict[str, int], Dict[str, str], Context]) -> ContextDict: ...
@@ -96,7 +98,12 @@ class RequestContext(Context):
Union[
Dict[str, Union[Dict[str, str], List[Dict[str, str]], bool]],
Dict[str, Union[List[Any], ChangeList, int, str]],
Dict[str, Union[List[Dict[str, Optional[Union[int, str]]]], List[ResultList], List[BoundField], ChangeList, int]],
Dict[
str,
Union[
List[Dict[str, Optional[Union[int, str]]]], List[ResultList], List[BoundField], ChangeList, int
],
],
Dict[str, Union[ChangeList, int, range, str]],
Context,
]

View File

@@ -72,7 +72,8 @@ def unordered_list(
value: Union[Iterator[Any], List[Union[List[Union[List[Union[List[str], str]], str]], str]]], autoescape: bool = ...
) -> SafeText: ...
def add(
value: Union[List[int], Tuple[int, int], date, int, str], arg: Union[List[int], Tuple[int, int], timedelta, int, str]
value: Union[List[int], Tuple[int, int], date, int, str],
arg: Union[List[int], Tuple[int, int], timedelta, int, str],
) -> Union[List[int], Tuple[int, int, int, int], date, int, str]: ...
def get_digit(value: Union[int, str], arg: int) -> Union[int, str]: ...
def date(value: Optional[Union[datetime, str]], arg: Optional[str] = ...) -> str: ...

View File

@@ -57,7 +57,9 @@ class CycleNode(Node):
cyclevars: List[django.template.base.FilterExpression] = ...
variable_name: Optional[str] = ...
silent: bool = ...
def __init__(self, cyclevars: List[FilterExpression], variable_name: Optional[str] = ..., silent: bool = ...) -> None: ...
def __init__(
self, cyclevars: List[FilterExpression], variable_name: Optional[str] = ..., silent: bool = ...
) -> None: ...
def render(self, context: Context) -> str: ...
def reset(self, context: Context) -> None: ...
@@ -132,7 +134,9 @@ class IfEqualNode(Node):
class IfNode(Node):
origin: django.template.base.Origin
token: django.template.base.Token
conditions_nodelists: List[Tuple[Optional[django.template.defaulttags.TemplateLiteral], django.template.base.NodeList]] = ...
conditions_nodelists: List[
Tuple[Optional[django.template.defaulttags.TemplateLiteral], django.template.base.NodeList]
] = ...
def __init__(self, conditions_nodelists: List[Tuple[Optional[TemplateLiteral], NodeList]]) -> None: ...
def __iter__(self) -> None: ...
@property
@@ -203,7 +207,11 @@ class URLNode(Node):
kwargs: Dict[str, django.template.base.FilterExpression] = ...
asvar: Optional[str] = ...
def __init__(
self, view_name: FilterExpression, args: List[FilterExpression], kwargs: Dict[str, FilterExpression], asvar: Optional[str]
self,
view_name: FilterExpression,
args: List[FilterExpression],
kwargs: Dict[str, FilterExpression],
asvar: Optional[str],
) -> None: ...
def render(self, context: Context) -> str: ...
@@ -222,7 +230,11 @@ class WidthRatioNode(Node):
max_width: django.template.base.FilterExpression = ...
asvar: Optional[str] = ...
def __init__(
self, val_expr: FilterExpression, max_expr: FilterExpression, max_width: FilterExpression, asvar: Optional[str] = ...
self,
val_expr: FilterExpression,
max_expr: FilterExpression,
max_width: FilterExpression,
asvar: Optional[str] = ...,
) -> None: ...
def render(self, context: Context) -> str: ...

View File

@@ -48,8 +48,12 @@ class Engine:
def get_template_loaders(
self, template_loaders: Union[List[List[Union[Dict[str, str], str]]], List[Tuple[str, List[str]]], List[str]]
) -> List[Loader]: ...
def find_template_loader(self, loader: Union[List[Union[Dict[str, str], str]], Tuple[str, List[str]], str]) -> Loader: ...
def find_template(self, name: str, dirs: None = ..., skip: Optional[List[Origin]] = ...) -> Tuple[Template, Origin]: ...
def find_template_loader(
self, loader: Union[List[Union[Dict[str, str], str]], Tuple[str, List[str]], str]
) -> Loader: ...
def find_template(
self, name: str, dirs: None = ..., skip: Optional[List[Origin]] = ...
) -> Tuple[Template, Origin]: ...
def from_string(self, template_code: str) -> Template: ...
def get_template(self, template_name: str) -> Template: ...
def render_to_string(self, template_name: str, context: Any = ...) -> SafeText: ...

View File

@@ -18,14 +18,21 @@ class Library:
) -> Callable: ...
def tag_function(self, func: Callable) -> Callable: ...
def filter(
self, name: Optional[Union[Callable, str]] = ..., filter_func: Optional[Union[Callable, str]] = ..., **flags: Any
self,
name: Optional[Union[Callable, str]] = ...,
filter_func: Optional[Union[Callable, str]] = ...,
**flags: Any
) -> Callable: ...
def filter_function(self, func: Callable, **flags: Any) -> Callable: ...
def simple_tag(
self, func: Optional[Union[Callable, str]] = ..., takes_context: Optional[bool] = ..., name: Optional[str] = ...
) -> Callable: ...
def inclusion_tag(
self, filename: Union[Template, str], func: None = ..., takes_context: Optional[bool] = ..., name: Optional[str] = ...
self,
filename: Union[Template, str],
func: None = ...,
takes_context: Optional[bool] = ...,
name: Optional[str] = ...,
) -> Callable: ...
class TagHelperNode(Node):
@@ -34,7 +41,11 @@ class TagHelperNode(Node):
args: Any = ...
kwargs: Any = ...
def __init__(
self, func: Callable, takes_context: Optional[bool], args: List[FilterExpression], kwargs: Dict[str, FilterExpression]
self,
func: Callable,
takes_context: Optional[bool],
args: List[FilterExpression],
kwargs: Dict[str, FilterExpression],
) -> None: ...
def get_resolved_arguments(self, context: Context) -> Tuple[List[int], Dict[str, Union[SafeText, int]]]: ...

View File

@@ -5,7 +5,9 @@ from django.template.backends.django import Template as DjangoTemplate
from django.template.backends.dummy import Template as DummyTemplate
from django.template.backends.jinja2 import Template as Jinja2Template
def get_template(template_name: str, using: Optional[str] = ...) -> Union[DjangoTemplate, DummyTemplate, Jinja2Template]: ...
def get_template(
template_name: str, using: Optional[str] = ...
) -> Union[DjangoTemplate, DummyTemplate, Jinja2Template]: ...
def select_template(
template_name_list: Union[List[str], str], using: Optional[str] = ...
) -> Union[DjangoTemplate, DummyTemplate, Jinja2Template]: ...

View File

@@ -36,7 +36,9 @@ class IfParser:
current_token: Any = ...
def __init__(
self,
tokens: Union[List[Optional[Union[List[int], str]]], List[Optional[Union[int, str]]], List[Union[List[int], int, str]]],
tokens: Union[
List[Optional[Union[List[int], str]]], List[Optional[Union[int, str]]], List[Union[List[int], int, str]]
],
) -> None: ...
def translate_token(self, token: Optional[Union[List[int], int, str]]) -> Literal: ...
def next_token(self) -> Literal: ...