pytuflow.TESF.undo#
- TESF.undo(include_children=True)#
Undo the last recorded change. Recorded changes are automatically stored when inputs are changed, added, or removed from the control file. The
dirty
attribute can be checked to see if any changes have been made to the control file since the last call towrite()
.Note, the returned list of inputs is stored as a
AlteredInput
, which is different from the input class used to store the inputs in the control file.- Parameters:
include_children (bool, optional) – This is only applicable for the TCF class. If set to
True
, will undo the last change regardless if it was made in the current control file or a child. If set toFalse
, will only undo the last change in the current control file.- Returns:
A list of inputs that were changed by the undo operation. If no changes were made, an empty list is returned.
- Return type:
list[AlteredInput]
Examples
1! Control File 2Solution Scheme == HPC 3Hardware == GPU 4SGS == On
The following code comments out the SGS input then uses the
undo
method to revert the change:>>> cf = ... # assume this is the loaded control file object >>> sgs_inp = cf.find_input('SGS == On')[0] >>> cf.comment_out(sgs_inp) <CommentInput> ! SGS == On
Preview the content of the control file to confirm that the SGS input has been commented out:
>>> cf.preview() ! Control File Solution Scheme == HPC Hardware == GPU ! SGS == On
Undo the previous operation to uncomment the SGS input:
>>> cf.undo() [<AlteredInput comment_out> ! SGS == On] >>> cf.preview() ! Control File Solution Scheme == HPC Hardware == GPU SGS == On