def keep(potential_op: ops.Operation) -> bool: return (protocols.has_channel(potential_op) or (ops.op_gate_of_type(potential_op, ops.MeasurementGate) is not None) or isinstance(potential_op, (ops.SamplesDisplay, ops.WaveFunctionDisplay, ops.DensityMatrixDisplay)))
def is_measurement(val: Any) -> bool: """Returns whether or not the given value is a measurement. A measurement must implement the `measurement_key` protocol and have a channel, as represented by the `has_channel` protocol returning true. """ return measurement_key(val, None) is not None and has_channel(val)
def keep(potential_op: ops.Operation) -> bool: return (protocols.has_channel(potential_op) or ops.MeasurementGate.is_measurement(potential_op) or isinstance(potential_op, (ops.SamplesDisplay, ops.WaveFunctionDisplay, ops.DensityMatrixDisplay)) )
def _has_channel_(self): return not self._is_parameterized_() and protocols.has_channel( self.sub_gate)
def _has_channel_(self) -> bool: return protocols.has_channel(self.sub_operation)
def keep(potential_op: ops.Operation) -> bool: return (protocols.has_channel(potential_op) or isinstance(potential_op.gate, ops.MeasurementGate))
def measure_or_mixture(op): return not protocols.has_unitary(op) and ( protocols.is_measurement(op) or protocols.has_channel(op))
def _has_channel_(self) -> bool: return protocols.has_channel(self.gate)
def keep(potential_op: ops.Operation) -> bool: return (protocols.has_channel(potential_op) or (ops.op_gate_of_type(potential_op, ops.MeasurementGate) is not None))
def keep(potential_op: ops.Operation) -> bool: return protocols.has_channel( potential_op, allow_decompose=False) or isinstance( potential_op.gate, ops.MeasurementGate)