[pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci
This commit is contained in:
pre-commit-ci[bot] 2024-06-03 22:10:44 +00:00
parent 951868f355
commit 4b6dac1b6b
9 changed files with 10 additions and 10 deletions

View File

@ -133,7 +133,7 @@ def get_template_locals(real_locals: t.Mapping[str, t.Any]) -> t.Dict[str, t.Any
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()

View File

@ -1250,7 +1250,7 @@ class Template:
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"]

View File

@ -1116,7 +1116,7 @@ def do_batch(
{%- endfor %}
</table>
"""
tmp: "t.List[V]" = []
tmp: t.List[V] = []
for item in value:
if len(tmp) == linecount:

View File

@ -146,7 +146,7 @@ class Symbols:
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):
@ -159,7 +159,7 @@ class Symbols:
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():

View File

@ -329,7 +329,7 @@ class TokenStream:
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

View File

@ -64,7 +64,7 @@ class Parser:
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:

View File

@ -172,7 +172,7 @@ class Context:
):
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

View File

@ -5,11 +5,11 @@ Useful when the template itself comes from an untrusted source.
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

View File

@ -428,7 +428,7 @@ class LRUCache:
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: