Skip to content

sequence

sequence #

cg.procedure_sequence() — collect a block into a ProcedureSequence.

The block's leftover roots run in order, as one step of the enclosing context. The wrapping ProcedureSequence is built on exit, while the parent context is active, so it is emitted into the parent like any other node.

SequenceContext #

Bases: ProcedureContext

Reduce a block's roots to a ProcedureSequence (ordered execution).

Source code in capturegraph-lib/capturegraph/procedures/procedure/authoring/contexts/sequence.py
class SequenceContext(ProcedureContext):
    """Reduce a block's roots to a ``ProcedureSequence`` (ordered execution)."""

    def _finish(self) -> None:
        from capturegraph.procedures.nodes.process.structural import (
            ProcedureSequence,
        )

        ProcedureSequence(procedures=self._step_roots())

procedure_sequence() #

Run the with block's steps in order, as one step of the enclosing context.

Source code in capturegraph-lib/capturegraph/procedures/procedure/authoring/contexts/sequence.py
@contextmanager
def procedure_sequence() -> Iterator[None]:
    """Run the ``with`` block's steps in order, as one step of the enclosing context."""
    with SequenceContext().collect():
        yield