template_interface#

class confs.template_interface.Template[source]#

DESCRIPTION:

This is the base-class object for all file generic template rendering.

read_tmpl(tmpl_path)[source]#

DESCRIPTION:

This method reads a template file path and returns a Python string containing the attributes collected from the file.

Parameters:
tmpl_path: str

A Python string defining the template file path.

Returns:
tmpl_str_in: str

A Python string containing the attributes collected from the template file path.

Return type:

str

write_tmpl(attr_dict, tmpl_path, template_path, fail_missing=False, f90_bool=False, warn=True)[source]#

DESCRIPTION:

This method collects attribute values, renders a string containing template attributes, and writes the updated template to a specified file path tmpl_path.

Parameters:
attr_dict: Dict

A Python dictionary containing the attributes to be used for updating a specified template.

tmpl_path: str

A Python string specifying the rendered (e.g., output) file path.

template_path: str

A Python string specifying the template file path to be rendered.

Keywords:
fail_missing: bool, optional

A Python boolean valued variable specifying whether to fail if a template string cannot be fully rendered.

f90_bool: bool, optional

A Python boolean valued variable specifying whether to transform boolean variables to a FORTRAN 90 format.

warn: bool, optional

A Python boolean valued variable specifying whether to create Logger warning messages for missing template variables.

Return type:

None