run black over stubs, add checking to travis

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

No files matched your search

@@ -1,13 +1,10 @@
from typing import Any, Dict, Iterator, List, Optional, Tuple, Union
class BaseEngine:
name: Any = ...
dirs: Any = ...
app_dirs: Any = ...
def __init__(
self, params: Dict[str, Union[List[str], bool, str]]
) -> None: ...
def __init__(self, params: Dict[str, Union[List[str], bool, str]]) -> None: ...
@property
def app_dirname(self) -> None: ...
def from_string(self, template_code: Any) -> None: ...
@@ -7,7 +7,6 @@ from django.utils.safestring import SafeText
from .base import BaseEngine
class DjangoTemplates(BaseEngine):
app_dirs: bool
dirs: List[str]
@@ -17,25 +16,17 @@ class DjangoTemplates(BaseEngine):
def __init__(self, params: Dict[str, Any]) -> None: ...
def from_string(self, template_code: str) -> Template: ...
def get_template(self, template_name: str) -> Template: ...
def get_templatetag_libraries(
self, custom_libraries: Dict[str, str]
) -> Dict[str, str]: ...
def get_templatetag_libraries(self, custom_libraries: Dict[str, str]) -> Dict[str, str]: ...
class Template:
template: django.template.base.Template = ...
backend: django.template.backends.django.DjangoTemplates = ...
def __init__(
self, template: Template, backend: DjangoTemplates
) -> None: ...
def __init__(self, template: Template, backend: DjangoTemplates) -> None: ...
@property
def origin(self) -> Origin: ...
def render(
self, context: Any = ..., request: Optional[HttpRequest] = ...
) -> SafeText: ...
def render(self, context: Any = ..., request: Optional[HttpRequest] = ...) -> SafeText: ...
def copy_exception(
exc: TemplateDoesNotExist, backend: Optional[DjangoTemplates] = ...
) -> TemplateDoesNotExist: ...
def copy_exception(exc: TemplateDoesNotExist, backend: Optional[DjangoTemplates] = ...) -> TemplateDoesNotExist: ...
def reraise(exc: TemplateDoesNotExist, backend: DjangoTemplates) -> Any: ...
def get_installed_libraries() -> Dict[str, str]: ...
def get_package_libraries(pkg: Any) -> Iterator[str]: ...
@@ -6,23 +6,16 @@ from django.http.request import HttpRequest
from .base import BaseEngine
from .utils import csrf_input_lazy, csrf_token_lazy
class TemplateStrings(BaseEngine):
app_dirs: bool
dirs: List[Any]
name: str
template_dirs: Tuple[str]
app_dirname: str = ...
def __init__(
self, params: Dict[str, Union[Dict[Any, Any], List[Any], bool, str]]
) -> None: ...
def __init__(self, params: Dict[str, Union[Dict[Any, Any], List[Any], bool, str]]) -> None: ...
def from_string(self, template_code: str) -> Template: ...
def get_template(self, template_name: str) -> Template: ...
class Template(string.Template):
template: str
def render(
self,
context: Optional[Dict[str, str]] = ...,
request: Optional[HttpRequest] = ...,
) -> str: ...
def render(self, context: Optional[Dict[str, str]] = ..., request: Optional[HttpRequest] = ...) -> str: ...
@@ -9,7 +9,6 @@ from django.views.generic.base import TemplateView
from .base import BaseEngine
class Jinja2(BaseEngine):
app_dirs: bool
dirs: List[str]
@@ -19,12 +18,7 @@ class Jinja2(BaseEngine):
app_dirname: str = ...
context_processors: List[str] = ...
env: jinja2.environment.Environment = ...
def __init__(
self,
params: Dict[
str, Union[Dict[str, Union[List[str], bool]], List[str], bool, str]
],
) -> None: ...
def __init__(self, params: Dict[str, Union[Dict[str, Union[List[str], bool]], List[str], bool, str]]) -> None: ...
def from_string(self, template_code: str) -> Template: ...
def get_template(self, template_name: str) -> Template: ...
def template_context_processors(self) -> List[Callable]: ...
@@ -38,28 +32,12 @@ class Template:
self,
context: Optional[
Union[
Dict[
str, Dict[str, Optional[Union[Dict[str, bool], bool, str]]]
],
Dict[str, Dict[str, Optional[Union[Dict[str, bool], bool, str]]]],
Dict[
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[
@@ -68,18 +46,7 @@ class Template:
str,
Union[
Dict[str, int],
List[
Tuple[
Optional[str],
List[
Dict[
str,
Union[Dict[str, bool], bool, str],
]
],
int,
]
],
List[Tuple[Optional[str], List[Dict[str, Union[Dict[str, bool], bool, str]]], int]],
List[str],
bool,
str,
@@ -97,22 +64,7 @@ class Template:
str,
Union[
Dict[str, str],
List[
Tuple[
None,
List[
Dict[
str,
Union[
Dict[str, bool],
bool,
str,
],
]
],
int,
]
],
List[Tuple[None, List[Dict[str, Union[Dict[str, bool], bool, str]]], int]],
List[str],
bool,
str,
@@ -131,23 +83,7 @@ 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,
@@ -166,6 +102,4 @@ class Origin:
template_name: Optional[str] = ...
def __init__(self, name: str, template_name: Optional[str]) -> None: ...
def get_exception_info(
exception: TemplateSyntaxError
) -> Dict[str, Union[List[Tuple[int, str]], int, str]]: ...
def get_exception_info(exception: TemplateSyntaxError) -> Dict[str, Union[List[Tuple[int, str]], int, str]]: ...
@@ -3,7 +3,6 @@ from typing import Any, Optional
from django.http.request import HttpRequest
from django.utils.safestring import SafeText
def csrf_input(request: HttpRequest) -> SafeText: ...
csrf_input_lazy: Any
+15 -75
View File
@@ -1,6 +1,5 @@
from enum import Enum
from typing import (Any, Callable, Dict, Iterator, List, Optional, Tuple, Type,
Union)
from typing import Any, Callable, Dict, Iterator, List, Optional, Tuple, Type, Union
from django.template.backends.dummy import TemplateStrings
from django.template.context import Context
@@ -36,24 +35,14 @@ class TokenType(Enum):
class VariableDoesNotExist(Exception):
msg: str = ...
params: Tuple[Union[Dict[str, str], str]] = ...
def __init__(
self, msg: str, params: Tuple[Union[Dict[str, str], str]] = ...
) -> None: ...
def __init__(self, msg: str, params: Tuple[Union[Dict[str, str], str]] = ...) -> None: ...
class Origin:
name: str = ...
template_name: Optional[Union[bytes, str]] = ...
loader: Optional[
Union[
django.template.backends.dummy.TemplateStrings,
django.template.loaders.base.Loader,
]
] = ...
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
@@ -66,11 +55,7 @@ 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: ...
@@ -87,11 +72,7 @@ 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]: ...
@@ -100,13 +81,7 @@ 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
@@ -129,16 +104,9 @@ class Parser:
) -> None: ...
def parse(self, parse_until: Optional[Tuple[str]] = ...) -> NodeList: ...
def skip_past(self, endtag: str) -> None: ...
def extend_nodelist(
self, nodelist: NodeList, node: Node, token: Token
) -> None: ...
def extend_nodelist(self, nodelist: NodeList, node: Node, token: Token) -> None: ...
def error(self, token: Token, e: Union[Exception, str]) -> Exception: ...
def invalid_block_tag(
self,
token: Token,
command: str,
parse_until: Union[List[Any], Tuple[str]] = ...,
) -> Any: ...
def invalid_block_tag(self, token: Token, command: str, parse_until: Union[List[Any], Tuple[str]] = ...) -> Any: ...
def unclosed_block_tag(self, parse_until: Tuple[str]) -> Any: ...
def next_token(self) -> Token: ...
def prepend_token(self, token: Token) -> None: ...
@@ -154,33 +122,12 @@ 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
Tuple[Callable, List[Tuple[bool, Union[django.template.base.Variable, django.utils.safestring.SafeText]]]]
] = ...
var: Union[django.template.base.Variable, django.utils.safestring.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: ...
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: ...
args_check: Any = ...
class Variable:
@@ -190,12 +137,7 @@ class Variable:
translate: bool = ...
message_context: Optional[str] = ...
def __init__(self, var: Union[Dict[Any, Any], str]) -> None: ...
def resolve(
self,
context: Union[
Dict[str, Dict[str, Union[int, str]]], Context, int, str
],
) -> Any: ...
def resolve(self, context: Union[Dict[str, Dict[str, Union[int, str]]], Context, int, str]) -> Any: ...
class Node:
must_be_first: bool = ...
@@ -229,6 +171,4 @@ 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]: ...
+13 -63
View File
@@ -12,14 +12,11 @@ from django.template.defaulttags import CycleNode, IfChangedNode
from django.template.library import InclusionNode
from django.template.loader_tags import BlockContext
class ContextPopException(Exception): ...
class ContextDict(dict):
context: django.template.context.BaseContext = ...
def __init__(
self, context: BaseContext, *args: Any, **kwargs: Any
) -> None: ...
def __init__(self, context: BaseContext, *args: Any, **kwargs: Any) -> None: ...
def __enter__(self) -> ContextDict: ...
def __exit__(self, *args: Any, **kwargs: Any) -> None: ...
@@ -34,39 +31,22 @@ class BaseContext:
def __getitem__(self, key: Union[int, str]) -> Any: ...
def __delitem__(self, key: Any) -> None: ...
def __contains__(self, key: str) -> bool: ...
def get(
self, key: str, otherwise: Optional[int] = ...
) -> Optional[Union[Options, int, str]]: ...
def get(self, key: str, otherwise: Optional[int] = ...) -> Optional[Union[Options, int, str]]: ...
def setdefault(
self,
key: Union[IfChangedNode, str],
default: Optional[Union[List[Origin], int]] = ...,
self, key: Union[IfChangedNode, str], default: Optional[Union[List[Origin], int]] = ...
) -> Optional[Union[List[Origin], int]]: ...
def new(
self,
values: Optional[
Union[
Dict[
str,
Union[
List[Dict[str, Union[int, str]]],
List[ResultList],
List[BoundField],
ChangeList,
int,
],
],
Dict[str, Union[List[Dict[str, Union[int, str]]], List[ResultList], List[BoundField], ChangeList, int]],
Dict[str, Union[List[Dict[str, str]], ChangeList, int, str]],
Dict[str, Union[ChangeList, int, range, str]],
Context,
]
] = ...,
) -> Context: ...
def flatten(
self
) -> Dict[
str, Optional[Union[Dict[str, Union[Type[Any], str]], int, str]]
]: ...
def flatten(self) -> Dict[str, Optional[Union[Dict[str, Union[Type[Any], str]], int, str]]]: ...
def __eq__(self, other: Context) -> bool: ...
class Context(BaseContext):
@@ -77,36 +57,19 @@ 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: ...
def update(self, other_dict: Union[Dict[str, Model], Dict[str, int], Dict[str, str], Context]) -> ContextDict: ...
class RenderContext(BaseContext):
dicts: List[Dict[Union[django.template.loader_tags.IncludeNode, str], str]]
template: Optional[django.template.base.Template] = ...
def __iter__(self) -> None: ...
def __contains__(self, key: Union[CycleNode, str]) -> bool: ...
def get(
self, key: Union[InclusionNode, str], otherwise: None = ...
) -> Optional[Union[Template, BlockContext]]: ...
def __getitem__(
self, key: Union[Node, str]
) -> Optional[Union[List[Origin], BlockContext, cycle]]: ...
def push_state(
self, template: Template, isolated_context: bool = ...
) -> Iterator[None]: ...
def get(self, key: Union[InclusionNode, str], otherwise: None = ...) -> Optional[Union[Template, BlockContext]]: ...
def __getitem__(self, key: Union[Node, str]) -> Optional[Union[List[Origin], BlockContext, cycle]]: ...
def push_state(self, template: Template, isolated_context: bool = ...) -> Iterator[None]: ...
class RequestContext(Context):
autoescape: bool
@@ -119,9 +82,7 @@ class RequestContext(Context):
def __init__(
self,
request: HttpRequest,
dict_: Optional[
Dict[str, Union[Dict[str, Union[Type[Any], str]], str]]
] = ...,
dict_: Optional[Dict[str, Union[Dict[str, Union[Type[Any], str]], str]]] = ...,
processors: Optional[List[Callable]] = ...,
use_l10n: None = ...,
use_tz: None = ...,
@@ -135,22 +96,11 @@ 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,
]
] = ...,
) -> RequestContext: ...
def make_context(
context: Any, request: Optional[HttpRequest] = ..., **kwargs: Any
) -> Context: ...
def make_context(context: Any, request: Optional[HttpRequest] = ..., **kwargs: Any) -> Context: ...
@@ -4,12 +4,9 @@ from django.core.handlers.wsgi import WSGIRequest
from django.http.request import HttpRequest
from django.utils.functional import SimpleLazyObject
def csrf(request: HttpRequest) -> Dict[str, SimpleLazyObject]: ...
def debug(request: HttpRequest) -> Dict[str, Union[Callable, bool]]: ...
def i18n(
request: WSGIRequest
) -> Dict[str, Union[List[Tuple[str, str]], bool, str]]: ...
def i18n(request: WSGIRequest) -> Dict[str, Union[List[Tuple[str, str]], bool, str]]: ...
def tz(request: HttpRequest) -> Dict[str, str]: ...
def static(request: HttpRequest) -> Dict[str, str]: ...
def media(request: Any): ...
@@ -14,9 +14,7 @@ def addslashes(value: str) -> str: ...
def capfirst(value: str) -> str: ...
def escapejs_filter(value: str) -> SafeText: ...
def json_script(value: Dict[str, str], element_id: SafeText) -> SafeText: ...
def floatformat(
text: Optional[Union[Decimal, float, str]], arg: Union[int, str] = ...
) -> str: ...
def floatformat(text: Optional[Union[Decimal, float, str]], arg: Union[int, str] = ...) -> str: ...
def iriencode(value: str) -> str: ...
def linenumbers(value: str, autoescape: bool = ...) -> SafeText: ...
def lower(value: str) -> str: ...
@@ -31,9 +29,7 @@ def truncatewords_html(value: str, arg: Union[int, str]) -> str: ...
def upper(value: str) -> str: ...
def urlencode(value: str, safe: Optional[SafeText] = ...) -> str: ...
def urlize(value: str, autoescape: bool = ...) -> SafeText: ...
def urlizetrunc(
value: str, limit: Union[SafeText, int], autoescape: bool = ...
) -> SafeText: ...
def urlizetrunc(value: str, limit: Union[SafeText, int], autoescape: bool = ...) -> SafeText: ...
def wordcount(value: str) -> int: ...
def wordwrap(value: str, arg: Union[SafeText, int]) -> str: ...
def ljust(value: str, arg: Union[SafeText, int]) -> str: ...
@@ -58,21 +54,9 @@ def dictsort(
str,
],
arg: Union[int, str],
) -> Union[
List[Dict[str, Dict[str, Union[int, str]]]],
List[Dict[str, str]],
List[Tuple[str, str]],
str,
]: ...
) -> Union[List[Dict[str, Dict[str, Union[int, str]]]], List[Dict[str, str]], List[Tuple[str, str]], str]: ...
def dictsortreversed(
value: Union[
Dict[str, int],
List[Dict[str, Union[int, str]]],
List[Tuple[str, str]],
List[int],
int,
str,
],
value: Union[Dict[str, int], List[Dict[str, Union[int, str]]], List[Tuple[str, str]], List[int], int, str],
arg: Union[int, str],
) -> Union[List[Dict[str, Union[int, str]]], List[Tuple[str, str]], str]: ...
def first(value: Union[List[int], List[str], str]) -> Union[int, str]: ...
@@ -80,45 +64,25 @@ def join(value: Any, arg: str, autoescape: bool = ...) -> Any: ...
def last(value: List[str]) -> str: ...
def length(value: Any) -> int: ...
def length_is(
value: Optional[Union[List[Callable], Tuple[str, str], int, str]],
arg: Union[SafeText, int],
value: Optional[Union[List[Callable], Tuple[str, str], int, str]], arg: Union[SafeText, int]
) -> Union[bool, str]: ...
def random(value: List[str]) -> str: ...
def slice_filter(value: Any, arg: str) -> Any: ...
def unordered_list(
value: Union[
Iterator[Any],
List[Union[List[Union[List[Union[List[str], str]], str]], str]],
],
autoescape: bool = ...,
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: ...
def time(
value: Optional[Union[datetime, str]], arg: Optional[str] = ...
) -> str: ...
def timesince_filter(
value: Optional[date], arg: Optional[date] = ...
) -> str: ...
def timeuntil_filter(
value: Optional[date], arg: Optional[date] = ...
) -> str: ...
def default(
value: Optional[Union[int, str]], arg: Union[int, str]
) -> Union[int, str]: ...
def default_if_none(
value: Optional[str], arg: Union[int, str]
) -> Union[int, str]: ...
def date(value: Optional[Union[datetime, str]], arg: Optional[str] = ...) -> str: ...
def time(value: Optional[Union[datetime, str]], arg: Optional[str] = ...) -> str: ...
def timesince_filter(value: Optional[date], arg: Optional[date] = ...) -> str: ...
def timeuntil_filter(value: Optional[date], arg: Optional[date] = ...) -> str: ...
def default(value: Optional[Union[int, str]], arg: Union[int, str]) -> Union[int, str]: ...
def default_if_none(value: Optional[str], arg: Union[int, str]) -> Union[int, str]: ...
def divisibleby(value: int, arg: int) -> bool: ...
def yesno(
value: Optional[int], arg: Optional[str] = ...
) -> Optional[Union[bool, str]]: ...
def yesno(value: Optional[int], arg: Optional[str] = ...) -> Optional[Union[bool, str]]: ...
def filesizeformat(bytes_: Union[complex, int, str]) -> str: ...
def pluralize(value: Any, arg: str = ...) -> str: ...
def phone2numeric_filter(value: str) -> str: ...
+34 -62
View File
@@ -7,12 +7,26 @@ from django.template.context import Context, RequestContext
from django.template.library import Library
from django.utils.safestring import SafeText
from .base import (BLOCK_TAG_END, BLOCK_TAG_START, COMMENT_TAG_END,
COMMENT_TAG_START, FILTER_SEPARATOR, SINGLE_BRACE_END,
SINGLE_BRACE_START, VARIABLE_ATTRIBUTE_SEPARATOR,
VARIABLE_TAG_END, VARIABLE_TAG_START, Context, Node,
NodeList, TemplateSyntaxError, VariableDoesNotExist,
kwarg_re, render_value_in_context, token_kwargs)
from .base import (
BLOCK_TAG_END,
BLOCK_TAG_START,
COMMENT_TAG_END,
COMMENT_TAG_START,
FILTER_SEPARATOR,
SINGLE_BRACE_END,
SINGLE_BRACE_START,
VARIABLE_ATTRIBUTE_SEPARATOR,
VARIABLE_TAG_END,
VARIABLE_TAG_START,
Context,
Node,
NodeList,
TemplateSyntaxError,
VariableDoesNotExist,
kwarg_re,
render_value_in_context,
token_kwargs,
)
from .defaultfilters import date
from .library import Library
from .smartif import IfParser, Literal
@@ -43,12 +57,7 @@ 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: ...
@@ -62,9 +71,7 @@ class FilterNode(Node):
nodelist: django.template.base.NodeList
origin: django.template.base.Origin
token: django.template.base.Token
def __init__(
self, filter_expr: FilterExpression, nodelist: NodeList
) -> None: ...
def __init__(self, filter_expr: FilterExpression, nodelist: NodeList) -> None: ...
def render(self, context: Context) -> Any: ...
class FirstOfNode(Node):
@@ -72,9 +79,7 @@ class FirstOfNode(Node):
token: django.template.base.Token
vars: List[django.template.base.FilterExpression] = ...
asvar: Optional[str] = ...
def __init__(
self, variables: List[FilterExpression], asvar: Optional[str] = ...
) -> None: ...
def __init__(self, variables: List[FilterExpression], asvar: Optional[str] = ...) -> None: ...
def render(self, context: Context) -> str: ...
class ForNode(Node):
@@ -102,9 +107,7 @@ class IfChangedNode(Node):
origin: django.template.base.Origin
token: django.template.base.Token
child_nodelists: Any = ...
def __init__(
self, nodelist_true: NodeList, nodelist_false: NodeList, *varlist: Any
) -> None: ...
def __init__(self, nodelist_true: NodeList, nodelist_false: NodeList, *varlist: Any) -> None: ...
def render(self, context: Context) -> str: ...
class IfEqualNode(Node):
@@ -129,16 +132,8 @@ 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,
]
] = ...
def __init__(
self,
conditions_nodelists: List[Tuple[Optional[TemplateLiteral], NodeList]],
) -> None: ...
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
def nodelist(self) -> NodeList: ...
@@ -150,9 +145,7 @@ class LoremNode(Node):
method: str
origin: django.template.base.Origin
token: django.template.base.Token
def __init__(
self, count: FilterExpression, method: str, common: bool
) -> None: ...
def __init__(self, count: FilterExpression, method: str, common: bool) -> None: ...
def render(self, context: Context) -> str: ...
GroupedResult = namedtuple("GroupedResult", ["grouper", "list"])
@@ -163,15 +156,8 @@ class RegroupNode(Node):
target: django.template.base.FilterExpression
token: django.template.base.Token
var_name: str = ...
def __init__(
self,
target: FilterExpression,
expression: FilterExpression,
var_name: str,
) -> None: ...
def resolve_expression(
self, obj: Dict[str, date], context: Context
) -> Union[int, str]: ...
def __init__(self, target: FilterExpression, expression: FilterExpression, var_name: str) -> None: ...
def resolve_expression(self, obj: Dict[str, date], context: Context) -> Union[int, str]: ...
def render(self, context: Context) -> str: ...
class LoadNode(Node):
@@ -184,9 +170,7 @@ class NowNode(Node):
token: django.template.base.Token
format_string: str = ...
asvar: Optional[str] = ...
def __init__(
self, format_string: str, asvar: Optional[str] = ...
) -> None: ...
def __init__(self, format_string: str, asvar: Optional[str] = ...) -> None: ...
def render(self, context: Context) -> str: ...
class ResetCycleNode(Node):
@@ -219,11 +203,7 @@ 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: ...
@@ -242,11 +222,7 @@ 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: ...
@@ -254,9 +230,7 @@ class WithNode(Node):
origin: django.template.base.Origin
token: django.template.base.Token
nodelist: Union[List[Any], django.template.base.NodeList] = ...
extra_context: Dict[
str, Union[django.template.base.FilterExpression, str]
] = ...
extra_context: Dict[str, Union[django.template.base.FilterExpression, str]] = ...
def __init__(
self,
var: Optional[str],
@@ -297,9 +271,7 @@ class TemplateIfParser(IfParser):
def do_if(parser: Parser, token: Token) -> IfNode: ...
def ifchanged(parser: Parser, token: Token) -> IfChangedNode: ...
def find_library(parser: Parser, name: str) -> Library: ...
def load_from_library(
library: Library, label: str, names: List[str]
) -> Library: ...
def load_from_library(library: Library, label: str, names: List[str]) -> Library: ...
def load(parser: Parser, token: Token) -> LoadNode: ...
def lorem(parser: Parser, token: Token) -> LoremNode: ...
def now(parser: Parser, token: Token) -> NowNode: ...
+7 -34
View File
@@ -10,7 +10,6 @@ from .context import _builtin_context_processors
from .exceptions import TemplateDoesNotExist
from .library import import_library
class Engine:
template_context_processors: Tuple[Callable]
template_loaders: List[django.template.loaders.base.Loader]
@@ -20,11 +19,7 @@ class Engine:
autoescape: bool = ...
context_processors: Union[List[str], Tuple[str]] = ...
debug: bool = ...
loaders: Union[
List[List[Union[Dict[str, str], str]]],
List[Tuple[str, List[str]]],
List[str],
] = ...
loaders: Union[List[List[Union[Dict[str, str], str]]], List[Tuple[str, List[str]]], List[str]] = ...
string_if_invalid: str = ...
file_charset: str = ...
libraries: Dict[str, str] = ...
@@ -37,13 +32,7 @@ class Engine:
app_dirs: bool = ...,
context_processors: Optional[Union[List[str], Tuple[str]]] = ...,
debug: bool = ...,
loaders: Optional[
Union[
List[List[Union[Dict[str, str], str]]],
List[Tuple[str, List[str]]],
List[str],
]
] = ...,
loaders: Optional[Union[List[List[Union[Dict[str, str], str]]], List[Tuple[str, List[str]]], List[str]]] = ...,
string_if_invalid: str = ...,
file_charset: str = ...,
libraries: Optional[Dict[str, str]] = ...,
@@ -54,30 +43,14 @@ class Engine:
def get_default() -> Engine: ...
def template_context_processors(self) -> Tuple[Callable]: ...
def get_template_builtins(self, builtins: List[str]) -> List[Library]: ...
def get_template_libraries(
self, libraries: Dict[str, str]
) -> Dict[str, Library]: ...
def get_template_libraries(self, libraries: Dict[str, str]) -> Dict[str, Library]: ...
def template_loaders(self) -> List[Loader]: ...
def get_template_loaders(
self,
template_loaders: Union[
List[List[Union[Dict[str, str], str]]],
List[Tuple[str, List[str]]],
List[str],
],
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: ...
def render_to_string(self, template_name: str, context: Any = ...) -> SafeText: ...
def select_template(self, template_name_list: List[str]) -> Template: ...
@@ -3,7 +3,6 @@ from typing import Any, List, Optional, Tuple, Union
from django.template.backends.base import BaseEngine
from django.template.base import Origin
class TemplateDoesNotExist(Exception):
backend: Optional[django.template.backends.base.BaseEngine] = ...
tried: List[Tuple[django.template.base.Origin, str]] = ...
+6 -25
View File
@@ -7,7 +7,6 @@ from django.utils.safestring import SafeText
from .base import Node, Template
from .exceptions import TemplateSyntaxError as TemplateSyntaxError
class InvalidTemplateLibrary(Exception): ...
class Library:
@@ -15,30 +14,18 @@ class Library:
tags: Dict[str, Callable] = ...
def __init__(self) -> None: ...
def tag(
self,
name: Optional[Union[Callable, str]] = ...,
compile_function: Optional[Union[Callable, str]] = ...,
self, name: Optional[Union[Callable, str]] = ..., compile_function: Optional[Union[Callable, str]] = ...
) -> 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] = ...,
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):
@@ -47,15 +34,9 @@ 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]]]: ...
def get_resolved_arguments(self, context: Context) -> Tuple[List[int], Dict[str, Union[SafeText, int]]]: ...
class SimpleNode(TagHelperNode):
args: List[FilterExpression]
+1 -4
View File
@@ -5,10 +5,7 @@ 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]: ...
@@ -1,12 +1,10 @@
from typing import Any, Dict, List, Optional, Union
from django.template.base import (FilterExpression, Node, NodeList, Parser,
Template, Token)
from django.template.base import FilterExpression, Node, NodeList, Parser, Template, Token
from django.template.context import Context
from django.utils.safestring import SafeText
from .base import (Node, Template, TemplateSyntaxError, TextNode, Variable,
token_kwargs)
from .base import Node, Template, TemplateSyntaxError, TextNode, Variable, token_kwargs
from .library import Library
register: Any
@@ -27,9 +25,7 @@ class BlockNode(Node):
origin: django.template.base.Origin
parent: None
token: django.template.base.Token
def __init__(
self, name: str, nodelist: NodeList, parent: None = ...
) -> None: ...
def __init__(self, name: str, nodelist: NodeList, parent: None = ...) -> None: ...
def render(self, context: Context) -> SafeText: ...
def super(self) -> SafeText: ...
@@ -39,20 +35,13 @@ class ExtendsNode(Node):
must_be_first: bool = ...
context_key: str = ...
nodelist: django.template.base.NodeList = ...
parent_name: Union[
django.template.base.FilterExpression, django.template.base.Node
] = ...
parent_name: Union[django.template.base.FilterExpression, django.template.base.Node] = ...
template_dirs: Optional[List[Any]] = ...
blocks: Dict[str, django.template.loader_tags.BlockNode] = ...
def __init__(
self,
nodelist: NodeList,
parent_name: Union[FilterExpression, Node],
template_dirs: Optional[List[Any]] = ...,
self, nodelist: NodeList, parent_name: Union[FilterExpression, Node], template_dirs: Optional[List[Any]] = ...
) -> None: ...
def find_template(
self, template_name: str, context: Context
) -> Template: ...
def find_template(self, template_name: str, context: Context) -> Template: ...
def get_parent(self, context: Context) -> Template: ...
def render(self, context: Context) -> Any: ...
@@ -74,8 +63,6 @@ class IncludeNode(Node):
def render(self, context: Context) -> SafeText: ...
def do_block(parser: Parser, token: Token) -> BlockNode: ...
def construct_relative_path(
current_template_name: Optional[str], relative_name: str
) -> str: ...
def construct_relative_path(current_template_name: Optional[str], relative_name: str) -> str: ...
def do_extends(parser: Parser, token: Token) -> ExtendsNode: ...
def do_include(parser: Parser, token: Token) -> IncludeNode: ...
@@ -4,7 +4,6 @@ from django.template import Engine
from .filesystem import Loader as FilesystemLoader
class Loader(FilesystemLoader):
dirs: None
engine: Engine
@@ -3,12 +3,9 @@ from typing import Any, List, Optional
from django.template.base import Origin, Template
from django.template.engine import Engine
class Loader:
engine: Any = ...
def __init__(self, engine: Engine) -> None: ...
def get_template(
self, template_name: str, skip: Optional[List[Origin]] = ...
) -> Template: ...
def get_template(self, template_name: str, skip: Optional[List[Origin]] = ...) -> Template: ...
def get_template_sources(self, template_name: Any) -> None: ...
def reset(self) -> None: ...
@@ -5,26 +5,15 @@ from django.template.engine import Engine
from .base import Loader as BaseLoader
class Loader(BaseLoader):
engine: django.template.engine.Engine
template_cache: Dict[Any, Any] = ...
get_template_cache: Dict[
str, django.template.exceptions.TemplateDoesNotExist
] = ...
get_template_cache: Dict[str, django.template.exceptions.TemplateDoesNotExist] = ...
loaders: List[django.template.loaders.base.Loader] = ...
def __init__(
self,
engine: Engine,
loaders: Union[List[Tuple[str, Dict[str, str]]], List[str]],
) -> None: ...
def __init__(self, engine: Engine, loaders: Union[List[Tuple[str, Dict[str, str]]], List[str]]) -> None: ...
def get_contents(self, origin: Origin) -> str: ...
def get_template(
self, template_name: str, skip: Optional[List[Origin]] = ...
) -> Template: ...
def get_template(self, template_name: str, skip: Optional[List[Origin]] = ...) -> Template: ...
def get_template_sources(self, template_name: str) -> None: ...
def cache_key(
self, template_name: str, skip: Optional[List[Origin]] = ...
) -> str: ...
def cache_key(self, template_name: str, skip: Optional[List[Origin]] = ...) -> str: ...
def generate_hash(self, values: List[str]) -> str: ...
def reset(self) -> None: ...
@@ -5,15 +5,10 @@ from django.template.engine import Engine
from .base import Loader as BaseLoader
class Loader(BaseLoader):
engine: django.template.engine.Engine
dirs: Optional[List[str]] = ...
def __init__(
self, engine: Engine, dirs: Optional[List[str]] = ...
) -> None: ...
def __init__(self, engine: Engine, dirs: Optional[List[str]] = ...) -> None: ...
def get_dirs(self) -> Union[List[bytes], List[str]]: ...
def get_contents(self, origin: Origin) -> Any: ...
def get_template_sources(
self, template_name: Union[bytes, str]
) -> Iterator[Origin]: ...
def get_template_sources(self, template_name: Union[bytes, str]) -> Iterator[Origin]: ...
@@ -5,12 +5,9 @@ from django.template.engine import Engine
from .base import Loader as BaseLoader
class Loader(BaseLoader):
engine: Engine
templates_dict: Dict[str, str] = ...
def __init__(
self, engine: Engine, templates_dict: Dict[str, str]
) -> None: ...
def __init__(self, engine: Engine, templates_dict: Dict[str, str]) -> None: ...
def get_contents(self, origin: Origin) -> str: ...
def get_template_sources(self, template_name: str) -> Iterator[Origin]: ...
+5 -17
View File
@@ -12,7 +12,6 @@ from django.views.generic.base import TemplateResponseMixin
from .loader import get_template as get_template, select_template as select_template
class ContentNotRenderedError(Exception): ...
class SimpleTemplateResponse(HttpResponse):
@@ -20,9 +19,7 @@ class SimpleTemplateResponse(HttpResponse):
cookies: SimpleCookie
status_code: int
rendering_attrs: Any = ...
template_name: Union[
List[str], Template, str
] = ...
template_name: Union[List[str], Template, str] = ...
context_data: Optional[Dict[str, str]] = ...
using: Optional[str] = ...
def __init__(
@@ -34,13 +31,8 @@ class SimpleTemplateResponse(HttpResponse):
charset: Optional[str] = ...,
using: Optional[str] = ...,
) -> None: ...
def resolve_template(
self, template: Union[List[str], Template, str]
) -> Union[Template, Template]: ...
def resolve_context(
self,
context: Optional[Dict[str, Any]],
) -> Optional[Dict[str, Any]]: ...
def resolve_template(self, template: Union[List[str], Template, str]) -> Union[Template, Template]: ...
def resolve_context(self, context: Optional[Dict[str, Any]]) -> Optional[Dict[str, Any]]: ...
@property
def rendered_content(self) -> str: ...
def add_post_render_callback(self, callback: Callable) -> None: ...
@@ -66,9 +58,7 @@ class TemplateResponse(SimpleTemplateResponse):
request: Dict[str, Union[django.test.client.FakePayload, int, str]]
resolver_match: django.utils.functional.SimpleLazyObject
status_code: int
template_name: Union[
List[str], django.template.backends.django.Template, str
]
template_name: Union[List[str], django.template.backends.django.Template, str]
templates: List[django.template.base.Template]
using: Optional[str]
wsgi_request: django.core.handlers.wsgi.WSGIRequest
@@ -79,9 +69,7 @@ class TemplateResponse(SimpleTemplateResponse):
template: Union[List[str], Template, str],
context: Optional[
Union[
Dict[
str, List[Dict[str, Optional[Union[datetime, Model, str]]]]
],
Dict[str, List[Dict[str, Optional[Union[datetime, Model, str]]]]],
Dict[str, List[str]],
Dict[str, Model],
Dict[str, TemplateResponseMixin],
+3 -12
View File
@@ -2,7 +2,6 @@ from typing import Any, Dict, List, Optional, Union
from django.template.defaulttags import TemplateLiteral
class TokenBase:
id: Any = ...
value: Any = ...
@@ -24,9 +23,7 @@ class Literal(TokenBase):
def __init__(self, value: Optional[Union[List[int], int]]) -> None: ...
def display(self): ...
def nud(self, parser: IfParser) -> Literal: ...
def eval(
self, context: Dict[Any, Any]
) -> Optional[Union[List[int], int]]: ...
def eval(self, context: Dict[Any, Any]) -> Optional[Union[List[int], int]]: ...
class EndToken(TokenBase):
lbp: int = ...
@@ -39,15 +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 translate_token(self, token: Optional[Union[List[int], int, str]]) -> Literal: ...
def next_token(self) -> Literal: ...
def parse(self) -> TemplateLiteral: ...
def expression(self, rbp: int = ...) -> Literal: ...
+1 -4
View File
@@ -5,14 +5,11 @@ from typing import Any, Dict, List, Tuple, Union
from django.core.exceptions import ImproperlyConfigured
from django.template.backends.base import BaseEngine
class InvalidTemplateEngineError(ImproperlyConfigured): ...
class EngineHandler:
templates: collections.OrderedDict
def __init__(
self, templates: List[Dict[str, Union[Dict[str, bool], str]]] = ...
) -> None: ...
def __init__(self, templates: List[Dict[str, Union[Dict[str, bool], str]]] = ...) -> None: ...
def templates(self) -> OrderedDict: ...
def __getitem__(self, alias: str) -> BaseEngine: ...
def __iter__(self) -> Any: ...