opto.trace.nodes.get_op_name

Contents

opto.trace.nodes.get_op_name#

get_op_name(description)[source]#

Extract the operator type from the description.

Parameters:

description (str) – A string containing the description of the node.

Returns:

The extracted operator type.

Return type:

str

Raises:

ValueError – If the description does not contain an operator type in square brackets.

Notes

The get_op_name function takes a description as input and uses regular expression to search for the operator type enclosed in square brackets at the beginning of the description. If a match is found, the operator type is extracted and returned. Otherwise, a ValueError is raised with a specific error message.