parasweep.templates module

Template engines for generating configuration files.

class parasweep.templates.TemplateEngine[source]

Bases: abc.ABC

Abstract base class for template engines.

Subclasses should implement the load and render methods. Make sure to implement errors for providing parameters not present in the template, and for using parameters in the template that are not provided.

load(paths)[source]

Load configuration templates.

Parameters:paths (list) – List of paths of configuration templates to load.
render(param_set)[source]

Render a configuration file with the template engine.

Parameters:param_set (dict) – Dictionary with parameters and their values.
class parasweep.templates.PythonFormatTemplate[source]

Bases: parasweep.templates.TemplateEngine

Template engine using Python’s string formatting.

load(paths)[source]

Load configuration templates.

Parameters:paths (list) – List of paths of configuration templates to load.
render(param_set)[source]

Render a configuration file with the template engine.

Parameters:param_set (dict) – Dictionary with parameters and their values.
class parasweep.templates.MakoTemplate[source]

Bases: parasweep.templates.TemplateEngine

Template engine using Mako.

load(paths)[source]

Load configuration templates.

Parameters:paths (list) – List of paths of configuration templates to load.
render(param_set)[source]

Render a configuration file with the template engine.

Parameters:param_set (dict) – Dictionary with parameters and their values.