Skip to content

Commit

Permalink
Fix deprecation warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
aborgna-q committed Aug 12, 2024
1 parent 419f24b commit 5a1a944
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 17 deletions.
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

0 comments on commit 5a1a944

Please sign in to comment.