From 1ae12989cca19e61c28b8d9653d2e5a2e61da9e5 Mon Sep 17 00:00:00 2001 From: Michael Bryant Date: Mon, 9 Jan 2023 16:36:12 -0800 Subject: [PATCH] feat(python): define default arguments to methods --- crates/python/src/executable.rs | 8 ++++++++ crates/python/src/qpu/client.rs | 1 + crates/python/src/qpu/quilc/mod.rs | 1 + 3 files changed, 10 insertions(+) diff --git a/crates/python/src/executable.rs b/crates/python/src/executable.rs index 072a5643..b2ae881f 100644 --- a/crates/python/src/executable.rs +++ b/crates/python/src/executable.rs @@ -43,6 +43,14 @@ pub struct PyParameter { #[pymethods] impl PyExecutable { #[new] + #[args( + "/", + registers = "Vec::new()", + parameters = "Vec::new()", + shots = "None", + compile_with_quilc = "None", + compiler_options = "None" + )] pub fn new( quil: String, registers: Vec, diff --git a/crates/python/src/qpu/client.rs b/crates/python/src/qpu/client.rs index 4311262b..ca1af0fd 100644 --- a/crates/python/src/qpu/client.rs +++ b/crates/python/src/qpu/client.rs @@ -48,6 +48,7 @@ py_wrap_type! { impl PyQcsClient { // TODO: default arg #[new] + #[args("/", use_gateway = "None")] pub fn new(py: Python<'_>, use_gateway: Option) -> PyResult { future_into_py(py, async move { let client = Qcs::load() diff --git a/crates/python/src/qpu/quilc/mod.rs b/crates/python/src/qpu/quilc/mod.rs index e5f19c9e..9eb74f2a 100644 --- a/crates/python/src/qpu/quilc/mod.rs +++ b/crates/python/src/qpu/quilc/mod.rs @@ -21,6 +21,7 @@ py_wrap_type! { #[pymethods] impl PyCompilerOpts { #[new] + #[args("/", timeout = "DEFAULT_COMPILER_TIMEOUT")] pub fn new(timeout: Option) -> Self { Self::from(CompilerOpts::new().with_timeout(timeout)) }