From: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 3 Jun 2024 22:10:44 +0000 (+0000) Subject: [pre-commit.ci] auto fixes from pre-commit.com hooks X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F1993%2Fhead;p=thirdparty%2Fjinja.git [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- diff --git a/src/jinja2/debug.py b/src/jinja2/debug.py index 9fda24ca..f85a319e 100644 --- a/src/jinja2/debug.py +++ b/src/jinja2/debug.py @@ -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() diff --git a/src/jinja2/environment.py b/src/jinja2/environment.py index 78657c69..4e6586e6 100644 --- a/src/jinja2/environment.py +++ b/src/jinja2/environment.py @@ -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"] diff --git a/src/jinja2/filters.py b/src/jinja2/filters.py index acd11976..14208770 100644 --- a/src/jinja2/filters.py +++ b/src/jinja2/filters.py @@ -1116,7 +1116,7 @@ def do_batch( {%- endfor %} """ - tmp: "t.List[V]" = [] + tmp: t.List[V] = [] for item in value: if len(tmp) == linecount: diff --git a/src/jinja2/idtracking.py b/src/jinja2/idtracking.py index 995ebaa0..d6cb635b 100644 --- a/src/jinja2/idtracking.py +++ b/src/jinja2/idtracking.py @@ -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(): diff --git a/src/jinja2/lexer.py b/src/jinja2/lexer.py index 62b0471a..6dc94b67 100644 --- a/src/jinja2/lexer.py +++ b/src/jinja2/lexer.py @@ -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 diff --git a/src/jinja2/parser.py b/src/jinja2/parser.py index 3bb9981e..817abecc 100644 --- a/src/jinja2/parser.py +++ b/src/jinja2/parser.py @@ -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: diff --git a/src/jinja2/runtime.py b/src/jinja2/runtime.py index 0148e435..9dcc9d4f 100644 --- a/src/jinja2/runtime.py +++ b/src/jinja2/runtime.py @@ -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 diff --git a/src/jinja2/sandbox.py b/src/jinja2/sandbox.py index 0b4fc12d..ce276156 100644 --- a/src/jinja2/sandbox.py +++ b/src/jinja2/sandbox.py @@ -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 diff --git a/src/jinja2/utils.py b/src/jinja2/utils.py index 7fb76935..5c1ff5d7 100644 --- a/src/jinja2/utils.py +++ b/src/jinja2/utils.py @@ -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: