Buckets:
AnonymousSpottedToad/candidate_bucket / codebase /python /freqtrade_freqtrade /freqtrade /util /template_renderer.py
| """ | |
| Jinja2 rendering utils, used to generate new strategy and configurations. | |
| """ | |
| def render_template(templatefile: str, arguments: dict) -> str: | |
| from jinja2 import Environment, PackageLoader, select_autoescape | |
| env = Environment( | |
| loader=PackageLoader("freqtrade", "templates"), | |
| autoescape=select_autoescape(["html", "xml"]), | |
| ) | |
| template = env.get_template(templatefile) | |
| return template.render(**arguments) | |
| def render_template_with_fallback( | |
| templatefile: str, templatefallbackfile: str, arguments: dict | None = None | |
| ) -> str: | |
| """ | |
| Use templatefile if possible, otherwise fall back to templatefallbackfile | |
| """ | |
| from jinja2.exceptions import TemplateNotFound | |
| if arguments is None: | |
| arguments = {} | |
| try: | |
| return render_template(templatefile, arguments) | |
| except TemplateNotFound: | |
| return render_template(templatefallbackfile, arguments) | |
Xet Storage Details
- Size:
- 924 Bytes
- Xet hash:
- 42544490080526bf831c5c5c8ef556999cb71c3bf704fd02644a44acec45e0fe
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.