diff --git a/django-stubs/template/__init__.pyi b/django-stubs/template/__init__.pyi index e69de29..48fdf2c 100644 --- a/django-stubs/template/__init__.pyi +++ b/django-stubs/template/__init__.pyi @@ -0,0 +1,14 @@ +from .engine import Engine as Engine +from .utils import EngineHandler as EngineHandler + +engines: EngineHandler + +from .base import VariableDoesNotExist as VariableDoesNotExist +from .context import ContextPopException as ContextPopException +from .exceptions import TemplateDoesNotExist as TemplateDoesNotExist, TemplateSyntaxError as TemplateSyntaxError + +# Template parts +from .base import Node as Node, NodeList as NodeList, Origin as Origin, Template as Template, Variable as Variable +from .context import Context as Context, RequestContext as RequestContext + +from .library import Library as Library diff --git a/django-stubs/template/base.pyi b/django-stubs/template/base.pyi index 1271e9c..5243cf4 100644 --- a/django-stubs/template/base.pyi +++ b/django-stubs/template/base.pyi @@ -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: ...