mirror of
https://github.com/gentoo-mirror/guru.git
synced 2025-04-20 08:18:49 -04:00
46 lines
1.6 KiB
Diff
46 lines
1.6 KiB
Diff
Chevron, an engine for the Mustache templating language, has been unmaintained
|
|
since 2021 and is not part of ::gentoo. The Jinja and Mustache templating
|
|
languages use the same syntax as far as this project is concerned.
|
|
|
|
PR issued upstream by <watermanpaint@posteo.net>:
|
|
https://github.com/typeddjango/pytest-mypy-plugins/pull/117
|
|
--- a/pytest_mypy_plugins/utils.py
|
|
+++ b/pytest_mypy_plugins/utils.py
|
|
@@ -11,10 +11,11 @@ from itertools import zip_longest
|
|
from pathlib import Path
|
|
from typing import Any, Callable, Dict, Iterator, List, Mapping, Optional, Tuple, Union
|
|
|
|
-import chevron
|
|
+import jinja2
|
|
import regex
|
|
from decorator import contextmanager
|
|
|
|
+_rendering_env = jinja2.Environment()
|
|
|
|
@contextmanager
|
|
def temp_environ() -> Iterator[None]:
|
|
@@ -351,9 +352,10 @@ def extract_output_matchers_from_out(out: str, params: Mapping[str, Any], regex:
|
|
return matchers
|
|
|
|
|
|
-def render_template(template: str, data: Mapping[str, Any]) -> str:
|
|
- return chevron.render(template=template, data={k: v if v is not None else "None" for k, v in data.items()})
|
|
|
|
+def render_template(template: str, data: Mapping[str, Any]) -> str:
|
|
+ template = _rendering_env.from_string(template)
|
|
+ return template.render({k: v if v is not None else "None" for k, v in data.items()})
|
|
|
|
def get_func_first_lnum(attr: Callable[..., None]) -> Optional[Tuple[int, List[str]]]:
|
|
lines, _ = inspect.getsourcelines(attr)
|
|
--- a/setup.py
|
|
+++ b/setup.py
|
|
@@ -8,7 +8,7 @@ dependencies = [
|
|
"mypy>=0.970",
|
|
"decorator",
|
|
"pyyaml",
|
|
- "chevron",
|
|
+ "jinja2",
|
|
"regex",
|
|
"packaging",
|
|
]
|