def implement_passive_quantum_computer_with_results(
        self, results: list[np.ndarray]
    ) -> QuantumComputer:
        """Mocks compilation methods on the `quantum_computer.compiler`, passively passing the
        `Program` through. Sequentially adds results to the
        `quantum_computer.qam._memory_region` (this will not work for asynchronous runs).

        Args:
            results: np.ndarray to sequentially write to `QAM._memory_region`.

        Returns:
            A mocked QuantumComputer.
        """
        quantum_computer = self.quantum_computer

        def quil_to_native_quil(program: Program, *, protoquil: bool | None = None) -> Program:
            return program

        quantum_computer.compiler.quil_to_native_quil = create_autospec(  # type: ignore
            quantum_computer.compiler.quil_to_native_quil, side_effect=quil_to_native_quil
        )

        def native_quil_to_executable(nq_program: Program) -> QuantumExecutable:
            assert 2 == nq_program.num_shots
            return nq_program

        quantum_computer.compiler.native_quil_to_executable = create_autospec(  # type: ignore
            quantum_computer.compiler.native_quil_to_executable,
            side_effect=native_quil_to_executable,
        )

        def run(program: Program | EncryptedProgram, memory_map: MemoryMap) -> QAMExecutionResult:
            qam = quantum_computer.qam
            qam._mock_results = qam._mock_results or {}  # type: ignore
            qam._mock_results["m0"] = results[qam._run_count]  # type: ignore

            quantum_computer.qam._run_count += 1  # type: ignore
            return QAMExecutionResult(
                executable=program,
                data=ExecutionData(
                    result_data=ResultData.from_qvm(
                        QVMResultData.from_memory_map(
                            {
                                k: RegisterData.from_f64([v])
                                for k, v in qam._mock_results.items()  # type: ignore
                            }
                        )
                    )
                ),
            )

        quantum_computer.qam.run = Mock(quantum_computer.qam.run, side_effect=run)  # type: ignore
        return quantum_computer
Mocks compilation methods on the `quantum_computer.compiler`, passively passing the
        `Program` through. Sequentially adds results to the
        `quantum_computer.qam._memory_region` (this will not work for asynchronous runs).

        Args:
            results: np.ndarray to sequentially write to `QAM._memory_region`.

        Returns:
            A mocked QuantumComputer.
        
cirq-rigetti/cirq_rigetti/conftest.py