django.template cleanups

This commit is contained in:
Maxim Kurnikov
2018-12-22 04:25:22 +03:00
parent e9cd2b6b62
commit 59b8008a21
2 changed files with 27 additions and 17 deletions

View File

@@ -8,8 +8,6 @@ from django.template.library import Library
from django.template.loaders.base import Loader
from django.utils.safestring import SafeText
from .exceptions import TemplateSyntaxError
FILTER_SEPARATOR: str
FILTER_ARGUMENT_SEPARATOR: str
VARIABLE_ATTRIBUTE_SEPARATOR: str
@@ -53,7 +51,7 @@ class Origin:
class Template:
name: Optional[str] = ...
origin: django.template.base.Origin = ...
origin: Origin = ...
engine: django.template.engine.Engine = ...
source: str = ...
nodelist: django.template.base.NodeList = ...
@@ -75,7 +73,7 @@ def linebreak_iter(template_source: str) -> Iterator[int]: ...
class Token:
contents: str
token_type: django.template.base.TokenType
token_type: TokenType
lineno: Optional[int] = ...
position: Optional[Tuple[int, int]] = ...
def __init__(
@@ -102,12 +100,12 @@ class DebugLexer(Lexer):
def tokenize(self) -> List[Token]: ...
class Parser:
tokens: Union[List[django.template.base.Token], str] = ...
tokens: Union[List[Token], str] = ...
tags: Dict[str, Callable] = ...
filters: Dict[str, Callable] = ...
command_stack: List[Tuple[str, django.template.base.Token]] = ...
libraries: Dict[str, django.template.library.Library] = ...
origin: Optional[django.template.base.Origin] = ...
command_stack: List[Tuple[str, Token]] = ...
libraries: Dict[str, Library] = ...
origin: Optional[Origin] = ...
def __init__(
self,
tokens: Union[List[Token], str],
@@ -134,10 +132,8 @@ filter_re: Any
class FilterExpression:
token: str = ...
filters: List[
Tuple[Callable, List[Tuple[bool, Union[django.template.base.Variable, django.utils.safestring.SafeText]]]]
] = ...
var: Union[django.template.base.Variable, django.utils.safestring.SafeText] = ...
filters: List[Tuple[Callable, List[Tuple[bool, Union[Variable, SafeText]]]]] = ...
var: Union[Variable, SafeText] = ...
def __init__(self, token: str, parser: Parser) -> None: ...
def resolve(self, context: Union[Dict[str, Dict[str, str]], Context], ignore_failures: bool = ...) -> Any: ...
def args_check(name: str, func: Callable, provided: List[Tuple[bool, Union[Variable, SafeText]]]) -> bool: ...
@@ -145,7 +141,7 @@ class FilterExpression:
class Variable:
var: Union[Dict[Any, Any], str] = ...
literal: Optional[Union[django.utils.safestring.SafeText, float]] = ...
literal: Optional[Union[SafeText, float]] = ...
lookups: Optional[Tuple[str]] = ...
translate: bool = ...
message_context: Optional[str] = ...
@@ -167,8 +163,8 @@ class NodeList(list):
def get_nodes_by_type(self, nodetype: Type[Node]) -> List[Node]: ...
class TextNode(Node):
origin: django.template.base.Origin
token: django.template.base.Token
origin: Origin
token: Token
s: str = ...
def __init__(self, s: str) -> None: ...
def render(self, context: Context) -> str: ...
@@ -176,8 +172,8 @@ class TextNode(Node):
def render_value_in_context(value: Any, context: Context) -> str: ...
class VariableNode(Node):
origin: django.template.base.Origin
token: django.template.base.Token
origin: Origin
token: Token
filter_expression: django.template.base.FilterExpression = ...
def __init__(self, filter_expression: FilterExpression) -> None: ...
def render(self, context: Context) -> str: ...