cirq.Circuit.findall_operations

Circuit.findall_operations(predicate: Callable[cirq.ops.raw_types.Operation, bool]) → Iterable[Tuple[int, cirq.ops.raw_types.Operation]][source]

Find the locations of all operations that satisfy a given condition.

This returns an iterator of (index, operation) tuples where each
operation satisfies op_cond(operation) is truthy. The indices are
in order of the moments and then order of the ops within that moment.
Parameters:predicate – A method that takes an Operation and returns a Truthy value indicating the operation meets the find condition.
Returns:An iterator (index, operation)’s that satisfy the op_condition.