apply ruff fixes
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by David Lord · committed by David Lord · parent 65b27af · Browse files · 11 files·+12 added−13 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
11 files+12 added−13 removed
- other:+12 added−13 removed
Provenance
- Commit
3adf44d- Tree
c3e7002- Author
David Lord <davidism@gmail.com>- Committer
David Lord <davidism@gmail.com>- Parent
65b27af
11 files changed+12 added−13 removed
modified:src/jinja2/async_utils.py+1 added-1 removed
65 unmodified lines66 67 if inspect.isawaitable(value):68 return await t.cast("t.Awaitable[V]", value)69 70- return t.cast("V", value)70+ return value71 72 73 class _IteratorToAsyncIterator(t.Generic[V]):74 def __init__(self, iterator: "t.Iterator[V]"):25 unmodified linesmodified:src/jinja2/debug.py+1 added-1 removed
150 unmodified lines151 """Based on the runtime locals, get the context that would be152 available at that point in the template.153 """154 # Start with the current template context.155- ctx: "t.Optional[Context]" = real_locals.get("context")155+ ctx: t.Optional[Context] = real_locals.get("context")156 157 if ctx is not None:158 data: t.Dict[str, t.Any] = ctx.get_all().copy()159 else:32 unmodified linesmodified:src/jinja2/environment.py+2 added-2 removed
704 unmodified lines705 """706 return compile(source, filename, "exec")707 708 @typing.overload709- def compile( # type: ignore709+ def compile(710 self,711 source: t.Union[str, nodes.Template],712 name: t.Optional[str] = None,713 filename: t.Optional[str] = None,533 unmodified lines1247 environment: Environment,1248 namespace: t.MutableMapping[str, t.Any],1249 globals: t.MutableMapping[str, t.Any],1250 ) -> "Template":1251- t: "Template" = object.__new__(cls)1251+ t: Template = object.__new__(cls)1252 t.environment = environment1253 t.globals = globals1254 t.name = namespace["name"]1255 t.filename = namespace["__file__"]414 unmodified linesmodified:src/jinja2/filters.py+1 added-1 removed
1114 unmodified lines1115 </tr>1116 {%- endfor %}1117 </table>1118 """1119- tmp: "t.List[V]" = []1119+ tmp: t.List[V] = []1120 1121 for item in value:1122 if len(tmp) == linecount:1123 yield tmp743 unmodified linesmodified:src/jinja2/idtracking.py+2 added-2 removed
144 unmodified lines145 self.loads[target] = (VAR_LOAD_RESOLVE, name)146 147 def dump_stores(self) -> t.Dict[str, str]:148 rv: t.Dict[str, str] = {}149- node: t.Optional["Symbols"] = self149+ node: t.Optional[Symbols] = self150 151 while node is not None:152 for name in sorted(node.stores):153 if name not in rv:4 unmodified lines158 return rv159 160 def dump_param_targets(self) -> t.Set[str]:161 rv = set()162- node: t.Optional["Symbols"] = self162+ node: t.Optional[Symbols] = self163 164 while node is not None:165 for target, (instr, _) in self.loads.items():166 if instr == VAR_LOAD_PARAMETER:152 unmodified linesmodified:src/jinja2/lexer.py+1 added-1 removed
327 unmodified lines328 name: t.Optional[str],329 filename: t.Optional[str],330 ):331 self._iter = iter(generator)332- self._pushed: "te.Deque[Token]" = deque()332+ self._pushed: te.Deque[Token] = deque()333 self.name = name334 self.filename = filename335 self.closed = False336 self.current = Token(1, TOKEN_INITIAL, "")532 unmodified linesmodified:src/jinja2/parser.py+1 added-1 removed
62 unmodified lines63 self.name = name64 self.filename = filename65 self.closed = False66 self.extensions: t.Dict[67- str, t.Callable[["Parser"], t.Union[nodes.Node, t.List[nodes.Node]]]67+ str, t.Callable[[Parser], t.Union[nodes.Node, t.List[nodes.Node]]]68 ] = {}69 for extension in environment.iter_extensions():70 for tag in extension.tags:71 self.extensions[tag] = extension.parse970 unmodified linesmodified:src/jinja2/runtime.py+1 added-1 removed
170 unmodified lines171 globals: t.Optional[t.MutableMapping[str, t.Any]] = None,172 ):173 self.parent = parent174 self.vars: t.Dict[str, t.Any] = {}175- self.environment: "Environment" = environment175+ self.environment: Environment = environment176 self.eval_ctx = EvalContext(self.environment, name)177 self.exported_vars: t.Set[str] = set()178 self.name = name179 self.globals_keys = set() if globals is None else set(globals)877 unmodified linesmodified:src/jinja2/sandbox.py+1 added-1 removed
3 unmodified lines4 5 import operator6 import types7 import typing as t8+from _string import formatter_field_name_split # type: ignore9 from collections import abc10 from collections import deque11 from string import Formatter12 12-from _string import formatter_field_name_split # type: ignore13 from markupsafe import EscapeFormatter14 from markupsafe import Markup15 16 from .environment import Environment413 unmodified linesmodified:src/jinja2/utils.py+1 added-1 removed
426 unmodified lines427 428 def __init__(self, capacity: int) -> None:429 self.capacity = capacity430 self._mapping: t.Dict[t.Any, t.Any] = {}431- self._queue: "te.Deque[t.Any]" = deque()431+ self._queue: te.Deque[t.Any] = deque()432 self._postinit()433 434 def _postinit(self) -> None:435 # alias all queue methods for faster lookup320 unmodified linesmodified:pyproject.toml-1 removed
89 unmodified lines90 "I", # isort91 "UP", # pyupgrade92 "W", # pycodestyle warning93 ]94-ignore-init-module-imports = true94 95 [tool.ruff.lint.isort]96 force-single-line = true97 order-by-type = false5 unmodified lines