pytuflow.TGC.comment_out

pytuflow.TGC.comment_out#

TGC.comment_out(inp)#

Comments out a given input. This has the same effect as remove_input(), but keeps the input in the control file as a comment. The input can be uncommnented later using the uncomment() method. Comments can also still be searched for within the control file using the find_input() method.

The input is not mutated, rather a new input is created and replaces the original input in the control file. Further reference to the input should use the returned input. The commented out input retains the same UUID.

Parameters:

inp (InputBuildState) – The input to comment out.

Returns:

The commented out input.

Return type:

CommentInput

Examples

1! Control File
2Solution Scheme == HPC
3Hardware == GPU
4SGS == On

The following code comments out the SGS input:

>>> cf = ... # assume this is the loaded control file object
>>> sgs_inp = cf.find_input('SGS == On')[0]
>>> commented_inp = cf.comment_out(sgs_inp)
>>> commented_inp
<CommentInput> ! SGS == On

The content of the control file can be previewed using preview():

>>> cf.preview()
Solution Scheme == HPC
Hardware == GPU
! SGS == On

The new input is not written to disk until write() is called. undo() can be used to revert the last change made to the control file, which in this case would be to uncomment the given input.