def with_probability(self, probability: 'cirq.TParamVal') -> 'cirq.Operation': from cirq.ops.random_gate_channel import RandomGateChannel gate = self.gate if gate is None: raise NotImplementedError("with_probability on gateless operation.") if probability == 1: return self return RandomGateChannel(sub_gate=gate, probability=probability).on(*self.qubits)
def with_probability(self, probability: 'cirq.TParamVal') -> 'cirq.Gate': from cirq.ops.random_gate_channel import RandomGateChannel if probability == 1: return self return RandomGateChannel(sub_gate=self, probability=probability)