Skip to content

Commit d6df3a6

Browse files
committed
fix: connection_strategy is no longer required to set when using
ExecutionOptionsBuilder
1 parent 965f63d commit d6df3a6

2 files changed

Lines changed: 19 additions & 2 deletions

File tree

crates/lib/src/qpu/api.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,7 @@ pub async fn retrieve_results(
173173
#[derive(Builder, Clone, Debug, Default, PartialEq, Eq)]
174174
pub struct ExecutionOptions {
175175
#[doc = "The [`ConnectionStrategy`] to use to establish a connection to the QPU."]
176+
#[builder(default)]
176177
connection_strategy: ConnectionStrategy,
177178
#[doc = "The timeout to use for the request, defaults to 30 seconds. If set to `None`, then there is no timeout."]
178179
#[builder(default = "Some(Duration::from_secs(30))")]

crates/python/src/qpu/api.rs

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,11 @@ use std::time::Duration;
55
use numpy::Complex32;
66
use pyo3::{
77
exceptions::{PyRuntimeError, PyValueError},
8-
pyclass, pyfunction, pymethods,
8+
pyclass,
9+
pyclass::CompareOp,
10+
pyfunction, pymethods,
911
types::{PyComplex, PyInt},
10-
Py, PyResult,
12+
IntoPy, Py, PyObject, PyResult, Python,
1113
};
1214
use qcs::qpu::api::{ConnectionStrategy, ExecutionOptions, ExecutionOptionsBuilder};
1315
use qcs_api_client_grpc::models::controller::{readout_values, ControllerJobExecutionResult};
@@ -231,6 +233,13 @@ impl PyExecutionOptions {
231233
.timeout()
232234
.map(|timeout| timeout.as_secs_f64())
233235
}
236+
237+
fn __richcmp__(&self, py: Python<'_>, other: &Self, op: CompareOp) -> PyObject {
238+
match op {
239+
CompareOp::Eq => (self.as_inner() == other.as_inner()).into_py(py),
240+
_ => py.NotImplemented(),
241+
}
242+
}
234243
}
235244

236245
py_wrap_type! {
@@ -305,4 +314,11 @@ impl PyConnectionStrategy {
305314
fn endpoint_id(endpoint_id: String) -> PyResult<Self> {
306315
Ok(Self(ConnectionStrategy::EndpointId(endpoint_id)))
307316
}
317+
318+
fn __richcmp__(&self, py: Python<'_>, other: &Self, op: CompareOp) -> PyObject {
319+
match op {
320+
CompareOp::Eq => (self.as_inner() == other.as_inner()).into_py(py),
321+
_ => py.NotImplemented(),
322+
}
323+
}
308324
}

0 commit comments

Comments
 (0)