Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(deps): update pyo3 requirement from 0.21.1 to 0.22.2 in the pyo3 group #73

Merged
merged 3 commits into from
Aug 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ name = "integration"
path = "tests/lib.rs"

[workspace.dependencies]
pyo3 = "0.21.1"
pythonize = "0.21.1"
pyo3 = "0.22.2"
pythonize = "0.22.0"
rstest = "0.22.0"
serde = "1.0"
serde_json = "1.0"
Expand Down
16 changes: 1 addition & 15 deletions src/optype.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,11 @@

#[cfg(feature = "pyo3")]
use pyo3::prelude::*;
#[cfg(feature = "pyo3")]
use pyo3::{exceptions::PyNotImplementedError, pyclass::CompareOp};
use serde::{Deserialize, Serialize};
use strum::EnumString;

/// Operation types in a quantum circuit.
#[cfg_attr(feature = "pyo3", pyclass(name = "RsOpType"))]
#[cfg_attr(feature = "pyo3", pyclass(name = "RsOpType", eq, eq_int))]
#[derive(Deserialize, Serialize, Clone, Debug, Default, PartialEq, Eq, Hash, EnumString)]
#[non_exhaustive]
pub enum OpType {
Expand Down Expand Up @@ -550,15 +548,3 @@ pub enum OpType {
/// [`DiagonalBox`]: crate::opbox::OpBox::DiagonalBox
DiagonalBox,
}

#[cfg(feature = "pyo3")]
#[pymethods]
impl OpType {
fn __richcmp__(&self, other: &Self, op: CompareOp) -> PyResult<bool> {
match op {
CompareOp::Eq => Ok(self == other),
CompareOp::Ne => Ok(self != other),
_ => Err(PyNotImplementedError::new_err("Unsupported comparison.")),
}
}
}
4 changes: 2 additions & 2 deletions src/pytket.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

use crate::circuit_json::SerialCircuit;
use pyo3::prelude::*;
use pythonize::{depythonize_bound, pythonize};
use pythonize::{depythonize, pythonize};

impl SerialCircuit {
/// Create a new `SerialCircuit` from a `pytket.Circuit`.
pub fn from_tket1(circ: &Bound<PyAny>) -> PyResult<Self> {
let circ = depythonize_bound(circ.call_method0("to_dict").unwrap())?;
let circ = depythonize(&circ.call_method0("to_dict").unwrap())?;
Ok(circ)
}

Expand Down
Loading