Source code for qrisp.interface.qunicorn.backend_client
"""\********************************************************************************* Copyright (c) 2025 the Qrisp authors** This program and the accompanying materials are made available under the* terms of the Eclipse Public License 2.0 which is available at* http://www.eclipse.org/legal/epl-2.0.** This Source Code may also be made available under the following Secondary* Licenses when the conditions for such availability set forth in the Eclipse* Public License, v. 2.0 are satisfied: GNU General Public License, version 2* with the GNU Classpath Exception which is* available at https://www.gnu.org/software/classpath/license.html.** SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0********************************************************************************/""""""This file sets up a client adhering to the interface specified by the Qunicorn middlewaredeveloped in the SeQuenC project: https://sequenc.de/To learn more about Qunicorn check out the Qunicorn GitHub: https://github.com/qunicorn/qunicorn-coreAnd it's documentation:https://qunicorn-core.readthedocs.io/en/latest/index.html"""importrequestsimporttime
[docs]classBackendClient:""" This object allows connecting to Qunicorn backend servers. Parameters ---------- socket_ip : string The IP address of the socket of the target server. port : int The port on which the server is listening. Examples -------- We assume that the example from BackendServer has been executed in the same console. >>> from qrisp.interface import BackendClient >>> example_backend = BackendClient(api_endpoint = "127.0.0.1", port = 8080) >>> from qrisp import QuantumCircuit >>> qc = QuantumCircuit(2) >>> qc.h(0) >>> qc.cx(0,1) >>> qc.measure(qc.qubits) >>> example_backend.run(qc, shots = 1000) {'00': 510, '11': 490} """