next up previous Python Library Reference contents modules index

Wpre - Functions

The following is a brief discussion of the functions available in the Wpre system. Some of these functions have already been discussed and used in examples that are presented in the Using the wpre module and Advanced Features sections.

Wpre

Wpre ()
Creates a new instance of the Wpre object.
compile (raw_string)
Compiles the provided string into an internal representation. Called before calling the process() function. The string contains all of the tags and embedded variables.
evaluate (variable_dictionary)
Uses the supplied dictionary of variables to replace the embedded variable names with their defined values. If an embedded variable is not found in the dictionary, an error string is embedded in place of the variable.
getRep ()
Returns the internal representation of a compiled string. This is to be used by "exert" users for debugging or expanding on the code.
getVars ()
Returns a list of variables that appeared in the raw string when the compile() function was called.
hasVar (var)
Checks to see if the specified variable was embedded in the raw string that was compiled.


WpreFile

WpreFile (ML_file, search_path_list, variable_dictionary)
Creates a new instance of the WpreFile object. The ML_file is any file that contains embedded python variables and expressions. The serach_path_list is a list of path names that are to be used to find the specified ML_file. Finally, the variable_dictionary provides a the variable names and there respective definitions, for all of the variables embedded in the ML_file. This dictionary can be obtained by calling the vars().
process ()
All of the variable or expressions defined in the mark-up file (that was defined when the WpreFile object was created) are replaced by their values or resulting values. The resulting information is sent to the standard output stream.
addFileRule (ML_file, variable, function)
Assigns a function to a variable that is defined in the mark-up file ML_file. When the evaluate() function is called, the defined function is called and the assigned variable is replaced by the results of the function call.
evaluate (variable_dictionary)
Calls all functions that are assigned to the variables and replaces embed variables with their definitions. The variable_dictionary contains all of the embedded variables and their respective values. This can be custom defined or obtained by calling the vars() function.



next up previous Python Library Reference contents modules index

Send comments on this document to pshafae@leibniz.jhpc.cs.depaul.edu

Copyright(C) Java and High-Performance Computing Laboratory (JHPC) at DePaul University Chicago
Documentation template borrowed from python.org