Source code for planemo.templates

"""Templating abstraction around jinja2 for Planemo."""

    from jinja2 import Template
except ImportError:
    Template = None  # type: ignore

    "This functionality requires Jinja2 but this library is " "unavailable. Install with `pip install jinja2`."

[docs] def render(template_str: str, **kwds): """Use jinja2 to render specified template.""" if Template is None: raise Exception(NO_JINJA2_MESSAGE) template = Template(template_str) contents = template.render(**kwds) return contents