better stubs

This commit is contained in:
Maxim Kurnikov
2018-08-05 03:13:19 +03:00
parent 4013fe4d03
commit fa718b8e55
380 changed files with 11805 additions and 8503 deletions

View File

@@ -1,21 +1,15 @@
# Stubs for django.template.base (Python 3.6)
#
# NOTE: This dynamically typed stub was automatically generated by stubgen.
from .exceptions import TemplateSyntaxError
from enum import Enum
from typing import Any, Optional
from typing import Any, Callable, Dict, List, Optional, Tuple, Type, Union
from django.template.backends.dummy import TemplateStrings
from django.contrib.admin.views.main import ChangeList
from django.template.context import Context
from django.template.defaulttags import LoadNode
from django.template.engine import Engine
from django.template.exceptions import TemplateSyntaxError
from django.template.library import Library
from django.template.loader_tags import BlockNode, ExtendsNode
from django.template.loaders.base import Loader
from django.template.loaders.filesystem import Loader
from django.utils.safestring import SafeText
from typing import Any, Callable, Dict, Iterator, List, Optional, Tuple, Type, Union
from .exceptions import TemplateSyntaxError
FILTER_SEPARATOR: str
FILTER_ARGUMENT_SEPARATOR: str
@@ -40,65 +34,89 @@ class TokenType(Enum):
COMMENT: int = ...
class VariableDoesNotExist(Exception):
msg: Any = ...
params: Any = ...
def __init__(self, msg: str, params: Any = ...) -> None: ...
def __str__(self) -> str: ...
class Origin:
name: Any = ...
template_name: Any = ...
loader: Any = ...
msg: str = ...
params: Union[
Tuple[
str,
Union[
int,
django.urls.resolvers.URLResolver,
Dict[Any, Any],
django.contrib.admin.views.main.ChangeList,
Dict[str, str],
List[str],
None,
django.template.context.Context,
Dict[str, int],
Any,
Dict[str, bool],
Dict[str, Union[str, bool]],
str,
],
],
Tuple[Dict[str, str]],
] = ...
def __init__(
self,
name: str,
template_name: Optional[str] = ...,
loader: Optional[Union[Loader, TemplateStrings]] = ...,
msg: str,
params: Tuple[str, Optional[Union[Context, ChangeList]]] = ...,
) -> None: ...
class Origin:
name: str = ...
template_name: Optional[Union[str, bytes]] = ...
loader: Optional[
Union[
django.template.loaders.base.Loader,
django.template.backends.dummy.TemplateStrings,
]
] = ...
def __init__(
self, name: str, template_name: str = ..., loader: Loader = ...
) -> None: ...
def __str__(self): ...
def __eq__(self, other: Origin) -> bool: ...
@property
def loader_name(self) -> Optional[str]: ...
def loader_name(self): ...
class Template:
name: Any = ...
origin: Any = ...
engine: Any = ...
source: Any = ...
nodelist: Any = ...
name: Optional[str] = ...
origin: django.template.base.Origin = ...
engine: django.template.engine.Engine = ...
source: str = ...
nodelist: django.template.base.NodeList = ...
def __init__(
self,
template_string: str,
origin: Optional[Origin] = ...,
name: Optional[str] = ...,
engine: Optional[Engine] = ...,
origin: Origin = ...,
name: str = ...,
engine: Engine = ...,
) -> None: ...
def __iter__(self) -> None: ...
def _render(self, context: Any): ...
def render(self, context: Context): ...
def render(self, context: Context) -> Any: ...
def compile_nodelist(self) -> NodeList: ...
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]: ...
def linebreak_iter(template_source: Any) -> None: ...
class Token:
lineno: Any = ...
position: Any = ...
contents: str
token_type: django.template.base.TokenType
lineno: Optional[int] = ...
position: Optional[Tuple[int, int]] = ...
def __init__(
self,
token_type: TokenType,
contents: str,
position: Optional[Tuple[int, int]] = ...,
lineno: Optional[int] = ...,
lineno: int = ...,
) -> None: ...
def __str__(self): ...
def split_contents(self) -> List[str]: ...
class Lexer:
template_string: Any = ...
verbatim: bool = ...
template_string: str = ...
verbatim: Union[str, bool] = ...
def __init__(self, template_string: str) -> None: ...
def tokenize(self) -> List[Token]: ...
def create_token(
@@ -110,42 +128,34 @@ class Lexer:
) -> Token: ...
class DebugLexer(Lexer):
template_string: str
verbatim: Union[str, bool]
def tokenize(self) -> List[Token]: ...
class Parser:
tokens: Any = ...
tags: Any = ...
filters: Any = ...
command_stack: Any = ...
libraries: Any = ...
origin: Any = ...
tokens: Union[str, List[django.template.base.Token]] = ...
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] = ...
def __init__(
self,
tokens: Union[str, List[Token]],
libraries: Optional[Dict[str, Library]] = ...,
tokens: List[Token],
libraries: Dict[str, Library] = ...,
builtins: List[Library] = ...,
origin: Optional[Origin] = ...,
origin: 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 parse(self, parse_until: Optional[Tuple[str]] = ...) -> NodeList: ...
def skip_past(self, endtag: Any): ...
def extend_nodelist(
self, nodelist: NodeList, node: Node, token: Token
) -> None: ...
def error(self, token: Any, e: Any): ...
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]]
self, token: Any, command: Any, parse_until: Optional[Any] = ...
) -> None: ...
def unclosed_block_tag(self, parse_until: Any) -> None: ...
def next_token(self) -> Token: ...
def prepend_token(self, token: Token) -> None: ...
def delete_first_token(self) -> None: ...
@@ -158,66 +168,69 @@ filter_raw_string: Any
filter_re: Any
class FilterExpression:
token: Any = ...
filters: Any = ...
var: Any = ...
token: str = ...
filters: Union[
List[
Tuple[Callable, List[Tuple[bool, django.utils.safestring.SafeText]]]
],
List[Tuple[Callable, List[Tuple[bool, django.template.base.Variable]]]],
] = ...
var: Union[
django.utils.safestring.SafeText, django.template.base.Variable
] = ...
def __init__(self, token: str, parser: Parser) -> None: ...
def resolve(
self,
context: Union[Dict[str, Dict[str, str]], Context],
ignore_failures: bool = ...,
) -> object: ...
def resolve(self, context: Context, ignore_failures: bool = ...) -> Any: ...
def args_check(
name: str,
func: Callable,
provided: Union[List[Tuple[bool, SafeText]], List[Tuple[bool, Variable]]],
provided: Union[
List[Tuple[bool, Variable]], List[Tuple[bool, SafeText]]
],
) -> bool: ...
args_check: Any = ...
def __str__(self) -> str: ...
class Variable:
var: Any = ...
literal: Any = ...
lookups: Any = ...
var: Union[str, Dict[Any, Any]] = ...
literal: Optional[Union[float, django.utils.safestring.SafeText]] = ...
lookups: Optional[Tuple[str]] = ...
translate: bool = ...
message_context: Any = ...
message_context: Optional[str] = ...
def __init__(self, var: str) -> None: ...
def resolve(self, context: Any) -> object: ...
def __repr__(self): ...
def __str__(self): ...
def _resolve_lookup(self, context: Any) -> object: ...
def resolve(self, context: Union[Context, Dict[Any, Any]]) -> Any: ...
class Node:
must_be_first: bool = ...
child_nodelists: Any = ...
token: Any = ...
def render(self, context: Any) -> None: ...
def render_annotated(self, context: Context) -> Union[int, str]: ...
def render_annotated(self, context: Context) -> str: ...
def __iter__(self) -> None: ...
def get_nodes_by_type(
self, nodetype: Type[Node]
) -> Union[List[LoadNode], List[VariableNode], List[BlockNode], List[ExtendsNode]]: ...
self, nodetype: Type[Union[ExtendsNode, BlockNode]]
) -> List[BlockNode]: ...
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]]: ...
self, nodetype: Type[Union[ExtendsNode, BlockNode]]
) -> List[BlockNode]: ...
class TextNode(Node):
s: Any = ...
origin: django.template.base.Origin
token: django.template.base.Token
s: str = ...
def __init__(self, s: str) -> None: ...
def __repr__(self) -> str: ...
def render(self, context: Context) -> str: ...
def render_value_in_context(value: object, context: Context) -> str: ...
def render_value_in_context(value: Any, context: Context) -> SafeText: ...
class VariableNode(Node):
filter_expression: Any = ...
origin: django.template.base.Origin
token: django.template.base.Token
filter_expression: django.template.base.FilterExpression = ...
def __init__(self, filter_expression: FilterExpression) -> None: ...
def __repr__(self) -> str: ...
def render(self, context: Context) -> str: ...
def render(self, context: Context) -> SafeText: ...
kwarg_re: Any