PyFoam.Basics.TemplateFile module¶
-
class
PyFoam.Basics.TemplateFile.
EvalPseudoSandboxWithMath
(allowExec=False)[source]¶ Bases:
PyFoam.ThirdParty.pyratemp.EvalPseudoSandbox
Add mathematical functions to the valid functons
-
__module__
= 'PyFoam.Basics.TemplateFile'¶
-
-
class
PyFoam.Basics.TemplateFile.
EvalPseudoSandboxWithMathWithImport
[source]¶ Bases:
PyFoam.Basics.TemplateFile.EvalPseudoSandboxWithMath
Class that allows the import of packages
-
__module__
= 'PyFoam.Basics.TemplateFile'¶
-
-
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
-
__dict__
= mappingproxy({'__weakref__': <attribute '__weakref__' of 'PyratempPreprocessor' objects>, '__init__': <function PyratempPreprocessor.__init__>, '__doc__': 'This class preprocesses the input that is give to it in such a\n way that the old format (using $$ at the line beginnings and $\n .. $ for expressions) is reworked into something that pyratemp understands\n ', '__dict__': <attribute '__dict__' of 'PyratempPreprocessor' objects>, '__module__': 'PyFoam.Basics.TemplateFile', '__call__': <function PyratempPreprocessor.__call__>})¶
-
__init__
(dovarline=True, doexpr=True, expressionDelimiter='$', assignmentLineStart='$$', allowExec=False, assignmentDebug=None, specials=[])[source]¶ Create the regexp once for performance reasons :param dovarline: look for variable lines that start with $$ :param doexpr: substitute expressions that are between $ :param expressionDelimiter: character/string that is used before and after an expression. After the expression the reverse of the string is used :param assignmentLineStart: character sequence that signals an assignment line :param assignmentDebug: Add a commented line to debug assignments. Prefix used is this parameter :param allowExec: allows execution of code. This is potentially unsafe :param specials: a list. If any expression starts with one of these values then the full expression (including delimiters) is left verbatim in the template
-
__module__
= 'PyFoam.Basics.TemplateFile'¶
-
__weakref__
¶ list of weak references to the object (if defined)
-
-
class
PyFoam.Basics.TemplateFile.
RendererWithFilename
(evalfunc, escapefunc, filename=None)[source]¶ Bases:
PyFoam.ThirdParty.pyratemp.Renderer
Usual renderer but report a filename
-
__module__
= 'PyFoam.Basics.TemplateFile'¶
-
-
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
-
__init__
(name=None, content=None, encoding='utf-8', expressionDelimiter='|', assignmentLineStart='$$', assignmentDebug=None, specials=[], renderer_class=None, tolerantRender=False, allowExec=False)[source]¶ Exactly one of the parameters must be specified :param name: name of the template file. :param content: Content of the template :param expressionDelimiter: character/string that delimits expression strings. :param assignmentLineStart: Start of a line that holds an assignment operation :param assignmentDebug: Add a commented line to debug assignments. Prefix used is this parameter :param allowExec: allow execution (and import). This is potentially unsafe :param special: list with strings that leave expression untreated
-
__module__
= 'PyFoam.Basics.TemplateFile'¶
-
-
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
-
__dict__
= mappingproxy({'__weakref__': <attribute '__weakref__' of 'TemplateFileOldFormat' objects>, '__dict__': <attribute '__dict__' of 'TemplateFileOldFormat' objects>, '__init__': <function TemplateFileOldFormat.__init__>, '__doc__': 'Works on template files. Does calculations between $$.\n Lines that start with $$ contain definitions', 'writeToFile': <function TemplateFileOldFormat.writeToFile>, '__module__': 'PyFoam.Basics.TemplateFile', 'buildTemplate': <function TemplateFileOldFormat.buildTemplate>, 'getString': <function TemplateFileOldFormat.getString>})¶
-
__init__
(name=None, content=None)[source]¶ Exactly one of the parameters must be specified :param name: name of the template file. :param content: Content of the template
-
__module__
= 'PyFoam.Basics.TemplateFile'¶
-
__weakref__
¶ list of weak references to the object (if defined)
-
-
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
-
__module__
= 'PyFoam.Basics.TemplateFile'¶
-