finesse.script.generator.KatUnbuilder
¶
Overview
- class finesse.script.generator.KatUnbuilder(spec=None)[source]¶
Bases:
object
Model to KatScript converter.
This class defines single-dispatch methods to recursively fill Finesse objects into a
KatGraph
. The graph is then serialised to KatScript viaKatUnfiller
.The single-dispatch uses the type of the object to create appropriate nodes and edges in the
KatGraph
.Typically unbuilding starts with the passing of a
Model
tounbuild()
orunbuild_file()
. The single-dispatch method that handles models then extracts the elements, commands and analyses and passes them recursively to the same single-dispatch, whereupon matching fill methods further handle them. The underlying tokens that form Finesse objects are eventually reached by recursively calling the fill method, and these are added as terminal nodes in the graph and connected to their parents by edges.Special behaviour applies in some cases. One such case is the handling of objects from containers with corresponding type annotations specifying that they are
Parameter
objects. These are assumed to have name KatScript representation, rather than value. This is used for example in the dumping of axis parameters, which must be written as e.g. xaxis(m1.phi, …) rather than xaxis(0, …) (in the case that m1.phi has value 0).
Properties
Methods
|
|
|
|
|
Generate KatScript for item and write to fobj. |