reformat with black

This commit is contained in:
Maxim Kurnikov
2018-07-29 23:34:58 +03:00
parent 4866354600
commit cf85607969
343 changed files with 6054 additions and 2158 deletions

View File

@@ -16,6 +16,7 @@ from django.template.loader_tags import BlockNode, ExtendsNode
from django.template.loaders.base import Loader
from django.utils.safestring import SafeText
from typing import Any, Callable, Dict, Iterator, List, Optional, Tuple, Type, Union
FILTER_SEPARATOR: str
FILTER_ARGUMENT_SEPARATOR: str
VARIABLE_ATTRIBUTE_SEPARATOR: str
@@ -48,7 +49,12 @@ class Origin:
name: Any = ...
template_name: Any = ...
loader: Any = ...
def __init__(self, name: str, template_name: Optional[str] = ..., loader: Optional[Union[Loader, TemplateStrings]] = ...) -> None: ...
def __init__(
self,
name: str,
template_name: Optional[str] = ...,
loader: Optional[Union[Loader, TemplateStrings]] = ...,
) -> None: ...
def __str__(self): ...
def __eq__(self, other: Origin) -> bool: ...
@property
@@ -60,19 +66,33 @@ class Template:
engine: Any = ...
source: Any = ...
nodelist: Any = ...
def __init__(self, template_string: str, origin: Optional[Origin] = ..., name: Optional[str] = ..., engine: Optional[Engine] = ...) -> None: ...
def __init__(
self,
template_string: str,
origin: Optional[Origin] = ...,
name: Optional[str] = ...,
engine: Optional[Engine] = ...,
) -> None: ...
def __iter__(self) -> None: ...
def _render(self, context: Any): ...
def render(self, context: Context): ...
def compile_nodelist(self) -> NodeList: ...
def get_exception_info(self, exception: Exception, token: Token) -> Dict[str, Union[str, List[Tuple[int, SafeText]], int]]: ...
def get_exception_info(
self, exception: Exception, token: Token
) -> Dict[str, Union[str, List[Tuple[int, SafeText]], int]]: ...
def linebreak_iter(template_source: str) -> Iterator[int]: ...
class Token:
lineno: Any = ...
position: Any = ...
def __init__(self, token_type: TokenType, contents: str, position: Optional[Tuple[int, int]] = ..., lineno: Optional[int] = ...) -> None: ...
def __init__(
self,
token_type: TokenType,
contents: str,
position: Optional[Tuple[int, int]] = ...,
lineno: Optional[int] = ...,
) -> None: ...
def __str__(self): ...
def split_contents(self) -> List[str]: ...
@@ -81,7 +101,13 @@ class Lexer:
verbatim: bool = ...
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):
def tokenize(self) -> List[Token]: ...
@@ -93,13 +119,33 @@ class Parser:
command_stack: Any = ...
libraries: Any = ...
origin: Any = ...
def __init__(self, tokens: Union[str, List[Token]], libraries: Optional[Dict[str, Library]] = ..., builtins: List[Library] = ..., origin: Optional[Origin] = ...) -> None: ...
def parse(self, parse_until: Optional[Union[Tuple[str, str], Tuple[str], Tuple[str, str, str]]] = ...) -> NodeList: ...
def __init__(
self,
tokens: Union[str, List[Token]],
libraries: Optional[Dict[str, Library]] = ...,
builtins: List[Library] = ...,
origin: Optional[Origin] = ...,
) -> None: ...
def parse(
self,
parse_until: Optional[
Union[Tuple[str, str], Tuple[str], Tuple[str, str, str]]
] = ...,
) -> NodeList: ...
def skip_past(self, endtag: str) -> None: ...
def extend_nodelist(self, nodelist: NodeList, node: Node, token: Token) -> None: ...
def error(self, token: Token, e: Union[str, RuntimeError, TemplateSyntaxError]) -> Union[RuntimeError, TemplateSyntaxError]: ...
def invalid_block_tag(self, token: Token, command: str, parse_until: Union[Tuple[str], Tuple[str, str]] = ...) -> None: ...
def unclosed_block_tag(self, parse_until: Union[Tuple[str], Tuple[str, str, str]]) -> None: ...
def error(
self, token: Token, e: Union[str, RuntimeError, TemplateSyntaxError]
) -> Union[RuntimeError, TemplateSyntaxError]: ...
def invalid_block_tag(
self,
token: Token,
command: str,
parse_until: Union[Tuple[str], Tuple[str, str]] = ...,
) -> None: ...
def unclosed_block_tag(
self, parse_until: Union[Tuple[str], Tuple[str, str, str]]
) -> None: ...
def next_token(self) -> Token: ...
def prepend_token(self, token: Token) -> None: ...
def delete_first_token(self) -> None: ...
@@ -116,8 +162,16 @@ class FilterExpression:
filters: Any = ...
var: Any = ...
def __init__(self, token: str, parser: Parser) -> None: ...
def resolve(self, context: Union[Dict[str, Dict[str, str]], Context], ignore_failures: bool = ...) -> object: ...
def args_check(name: str, func: Callable, provided: Union[List[Tuple[bool, SafeText]], List[Tuple[bool, Variable]]]) -> bool: ...
def resolve(
self,
context: Union[Dict[str, Dict[str, str]], Context],
ignore_failures: bool = ...,
) -> object: ...
def args_check(
name: str,
func: Callable,
provided: Union[List[Tuple[bool, SafeText]], List[Tuple[bool, Variable]]],
) -> bool: ...
args_check: Any = ...
def __str__(self) -> str: ...
@@ -140,12 +194,16 @@ class Node:
def render(self, context: Any) -> None: ...
def render_annotated(self, context: Context) -> Union[int, str]: ...
def __iter__(self) -> None: ...
def get_nodes_by_type(self, nodetype: Type[Node]) -> Union[List[LoadNode], List[VariableNode], List[BlockNode], List[ExtendsNode]]: ...
def get_nodes_by_type(
self, nodetype: Type[Node]
) -> Union[List[LoadNode], List[VariableNode], List[BlockNode], List[ExtendsNode]]: ...
class NodeList(list):
contains_nontext: bool = ...
def render(self, context: Context) -> SafeText: ...
def get_nodes_by_type(self, nodetype: Type[Node]) -> Union[List[BlockNode], List[VariableNode]]: ...
def get_nodes_by_type(
self, nodetype: Type[Node]
) -> Union[List[BlockNode], List[VariableNode]]: ...
class TextNode(Node):
s: Any = ...
@@ -163,4 +221,6 @@ class VariableNode(Node):
kwarg_re: Any
def token_kwargs(bits: List[str], parser: Parser, support_legacy: bool = ...) -> Dict[str, FilterExpression]: ...
def token_kwargs(
bits: List[str], parser: Parser, support_legacy: bool = ...
) -> Dict[str, FilterExpression]: ...