PyFoam.Basics.TemplateFile module¶
-
class
PyFoam.Basics.TemplateFile.
EvalPseudoSandboxWithMath
(allowExec=False)[source]¶ Bases:
PyFoam.ThirdParty.pyratemp.EvalPseudoSandbox
Add mathematical functions to the valid functons
-
class
PyFoam.Basics.TemplateFile.
EvalPseudoSandboxWithMathWithImport
[source]¶ Bases:
PyFoam.Basics.TemplateFile.EvalPseudoSandboxWithMath
Class that allows the import of packages
-
class
PyFoam.Basics.TemplateFile.
PyratempPreprocessor
(dovarline=True, doexpr=True, expressionDelimiter='$', assignmentLineStart='$$', allowExec=False, assignmentDebug=None, specials=[])[source]¶ Bases:
object
This class preprocesses the input that is give to it in such a way that the old format (using $$ at the line beginnings and $ .. $ for expressions) is reworked into something that pyratemp understands
-
class
PyFoam.Basics.TemplateFile.
RendererWithFilename
(evalfunc, escapefunc, filename=None)[source]¶ Bases:
PyFoam.ThirdParty.pyratemp.Renderer
Usual renderer but report a filename
-
class
PyFoam.Basics.TemplateFile.
TemplateFile
(name=None, content=None, encoding='utf-8', expressionDelimiter='|', assignmentLineStart='$$', assignmentDebug=None, specials=[], renderer_class=None, tolerantRender=False, allowExec=False)[source]¶ Bases:
PyFoam.Basics.TemplateFile.TemplateFileOldFormat
Works on template files. Does calculations between $$. Lines that start with $$ contain definitions
-
class
PyFoam.Basics.TemplateFile.
TemplateFileOldFormat
(name=None, content=None)[source]¶ Bases:
object
Works on template files. Does calculations between $$. Lines that start with $$ contain definitions
-
getString
(vals)[source]¶ In the template, replaces all the strings between $$ with the evaluation of the expressions :param vals: dictionary with the values :returns: The string with the replaced expressions
-
writeToFile
(outfile, vals, gzip=False)[source]¶ In the template, replaces all the strings between $$ with the evaluation of the expressions and writes the results to a file :param outfile: the resulting output file :param vals: dictionary with the values :param gzip: Zip the file (and add a .gz to the name)
-
-
class
PyFoam.Basics.TemplateFile.
TolerantRenderer
(evalfunc, escapefunc, filename=None)[source]¶ Bases:
PyFoam.Basics.TemplateFile.RendererWithFilename
Variant of the renderer that doesn’t choke on problems with evaluations