Jinja2 async support (#2278)

This commit is contained in:
potykion
2018-06-28 20:24:37 +03:00
committed by Jelle Zijlstra
parent b261b228ba
commit f35c5d1349

View File

@@ -1,9 +1,13 @@
import sys
from typing import Any, Callable, Dict, Iterator, List, Optional, Text, Type, Union
from .bccache import BytecodeCache
from .loaders import BaseLoader
from .runtime import Context, Undefined
if sys.version_info >= (3, 6):
from typing import Awaitable, AsyncIterator
def get_spontaneous_environment(*args): ...
def create_cache(size): ...
def copy_cache(cache): ...
@@ -42,7 +46,7 @@ class Environment:
bytecode_cache = ... # type: BytecodeCache
auto_reload = ... # type: bool
extensions = ... # type: List
def __init__(self, block_start_string: Text = ..., block_end_string: Text = ..., variable_start_string: Text = ..., variable_end_string: Text = ..., comment_start_string: Any = ..., comment_end_string: Text = ..., line_statement_prefix: Text = ..., line_comment_prefix: Text = ..., trim_blocks: bool = ..., lstrip_blocks: bool = ..., newline_sequence: Text = ..., keep_trailing_newline: bool = ..., extensions: List = ..., optimized: bool = ..., undefined: Type[Undefined] = ..., finalize: Optional[Callable] = ..., autoescape: Union[bool, Callable[[str], bool]] = ..., loader: Optional[BaseLoader] = ..., cache_size: int = ..., auto_reload: bool = ..., bytecode_cache: Optional[BytecodeCache] = ...) -> None: ...
def __init__(self, block_start_string: Text = ..., block_end_string: Text = ..., variable_start_string: Text = ..., variable_end_string: Text = ..., comment_start_string: Any = ..., comment_end_string: Text = ..., line_statement_prefix: Text = ..., line_comment_prefix: Text = ..., trim_blocks: bool = ..., lstrip_blocks: bool = ..., newline_sequence: Text = ..., keep_trailing_newline: bool = ..., extensions: List = ..., optimized: bool = ..., undefined: Type[Undefined] = ..., finalize: Optional[Callable] = ..., autoescape: Union[bool, Callable[[str], bool]] = ..., loader: Optional[BaseLoader] = ..., cache_size: int = ..., auto_reload: bool = ..., bytecode_cache: Optional[BytecodeCache] = ..., enable_async: bool = ...) -> None: ...
def add_extension(self, extension): ...
def extend(self, **attributes): ...
def overlay(self, block_start_string: Text = ..., block_end_string: Text = ..., variable_start_string: Text = ..., variable_end_string: Text = ..., comment_start_string: Any = ..., comment_end_string: Text = ..., line_statement_prefix: Text = ..., line_comment_prefix: Text = ..., trim_blocks: bool = ..., lstrip_blocks: bool = ..., extensions: List = ..., optimized: bool = ..., undefined: Type[Undefined] = ..., finalize: Callable = ..., autoescape: bool = ..., loader: Optional[BaseLoader] = ..., cache_size: int = ..., auto_reload: bool = ..., bytecode_cache: Optional[BytecodeCache] = ...): ...
@@ -97,6 +101,11 @@ class Template:
@property
def debug_info(self): ...
if sys.version_info >= (3, 6):
def render_async(self, *args, **kwargs) -> Awaitable[Text]: ...
def generate_async(self, *args, **kwargs) -> AsyncIterator[Text]: ...
class TemplateModule:
__name__ = ... # type: Any
def __init__(self, template, context) -> None: ...