Skip to content

Commit

Permalink
feat(python): define default arguments to methods
Browse files Browse the repository at this point in the history
  • Loading branch information
Shadow53 committed Jan 10, 2023
1 parent e847da7 commit 1ae1298
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
8 changes: 8 additions & 0 deletions crates/python/src/executable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<String>,
Expand Down
1 change: 1 addition & 0 deletions crates/python/src/qpu/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<bool>) -> PyResult<Self> {
future_into_py(py, async move {
let client = Qcs::load()
Expand Down
1 change: 1 addition & 0 deletions crates/python/src/qpu/quilc/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ py_wrap_type! {
#[pymethods]
impl PyCompilerOpts {
#[new]
#[args("/", timeout = "DEFAULT_COMPILER_TIMEOUT")]
pub fn new(timeout: Option<u8>) -> Self {
Self::from(CompilerOpts::new().with_timeout(timeout))
}
Expand Down

0 comments on commit 1ae1298

Please sign in to comment.