app.processing.pre.utils ======================== .. py:module:: app.processing.pre.utils .. autoapi-nested-parse:: Utils used within :mod:`app.processing.pre`. Module Contents --------------- .. py:exception:: PreprocessingException(msg: str, node: app.model.CompileRequest.Node | None = None) Exception raises during :mod:`app.processing.pre`. .. py:function:: expr_to_int(expr: openqasm3.ast.Expression | None) -> int Get an integer from an expression. This method does no analysis of the overall AST. If it cannot extract an integer from an expression, it throws. :param expr: Expression to be analyses :return: the resulting integer parsed from the Expression .. py:function:: annotate(statement: TQasmStatement, annotations: list[openqasm3.ast.Annotation]) -> TQasmStatement Sets annotations on the specified node. :param statement: The statement to be annotated :param annotations: The annotations to be applied :return: The node with annotations applied .. py:function:: parse_io_annotation(annotation: openqasm3.ast.Annotation) -> int Parse the :attr:`~openqasm3.ast.Annotation.command` of a `@leqo.input` or `@leqo.output` :class:`~openqasm3.ast.Annotation`. :param annotation: The annotation to parse :return: The indices .. py:function:: parse_range_definition(range_def: openqasm3.ast.RangeDefinition, length: int) -> list[int] Return list of integers expressed by qasm3-range. The complexity of this function arises because openqasm3 includes the last element and python does not. .. py:function:: parse_qasm_index(index: list[openqasm3.ast.IndexElement], length: int) -> list[int] | int Parse list of qasm3 indexes. This can return either a single index or a subset of them. Multiple indexes are applied iteratively (as qiskit also does it).