available at that point in the template.
"""
# Start with the current template context.
- ctx: "t.Optional[Context]" = real_locals.get("context")
+ ctx: t.Optional[Context] = real_locals.get("context")
if ctx is not None:
data: t.Dict[str, t.Any] = ctx.get_all().copy()
namespace: t.MutableMapping[str, t.Any],
globals: t.MutableMapping[str, t.Any],
) -> "Template":
- t: "Template" = object.__new__(cls)
+ t: Template = object.__new__(cls)
t.environment = environment
t.globals = globals
t.name = namespace["name"]
{%- endfor %}
</table>
"""
- tmp: "t.List[V]" = []
+ tmp: t.List[V] = []
for item in value:
if len(tmp) == linecount:
def dump_stores(self) -> t.Dict[str, str]:
rv: t.Dict[str, str] = {}
- node: t.Optional["Symbols"] = self
+ node: t.Optional[Symbols] = self
while node is not None:
for name in sorted(node.stores):
def dump_param_targets(self) -> t.Set[str]:
rv = set()
- node: t.Optional["Symbols"] = self
+ node: t.Optional[Symbols] = self
while node is not None:
for target, (instr, _) in self.loads.items():
filename: t.Optional[str],
):
self._iter = iter(generator)
- self._pushed: "te.Deque[Token]" = deque()
+ self._pushed: te.Deque[Token] = deque()
self.name = name
self.filename = filename
self.closed = False
self.filename = filename
self.closed = False
self.extensions: t.Dict[
- str, t.Callable[["Parser"], t.Union[nodes.Node, t.List[nodes.Node]]]
+ str, t.Callable[[Parser], t.Union[nodes.Node, t.List[nodes.Node]]]
] = {}
for extension in environment.iter_extensions():
for tag in extension.tags:
):
self.parent = parent
self.vars: t.Dict[str, t.Any] = {}
- self.environment: "Environment" = environment
+ self.environment: Environment = environment
self.eval_ctx = EvalContext(self.environment, name)
self.exported_vars: t.Set[str] = set()
self.name = name
import operator
import types
import typing as t
+from _string import formatter_field_name_split # type: ignore
from collections import abc
from collections import deque
from string import Formatter
-from _string import formatter_field_name_split # type: ignore
from markupsafe import EscapeFormatter
from markupsafe import Markup
def __init__(self, capacity: int) -> None:
self.capacity = capacity
self._mapping: t.Dict[t.Any, t.Any] = {}
- self._queue: "te.Deque[t.Any]" = deque()
+ self._queue: te.Deque[t.Any] = deque()
self._postinit()
def _postinit(self) -> None: