Skip to content

Commit

Permalink
fix: Remove use of removed auto_rebase_pass (#708)
Browse files Browse the repository at this point in the history
Pytket 1.36 removed the auto_rebase_pass function, replacing it with
AutoRebase. This commit updates the code that uses with function and
replaces it with the new class.

Co-authored-by: Seyon Sivarajah <[email protected]>
  • Loading branch information
johnchildren and ss2165 authored Nov 29, 2024
1 parent b17736d commit ea122a7
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions tket2-py/src/passes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,13 @@ fn greedy_depth_reduce<'py>(circ: &Bound<'py, PyAny>) -> PyResult<(Bound<'py, Py
///
/// Equivalent to running the following code:
/// ```python
/// from pytket.passes.auto_rebase import auto_rebase_pass
/// from pytket.passes import AutoRebase
/// from pytket import OpType
/// auto_rebase_pass({OpType.CX, OpType.Rz, OpType.H}).apply(circ)"
/// AutoRebase({OpType.CX, OpType.Rz, OpType.H}).apply(circ)"
// ```
fn rebase_nam(circ: &Bound<PyAny>) -> PyResult<()> {
let py = circ.py();
let auto_rebase = py
.import("pytket.passes.auto_rebase")?
.getattr("auto_rebase_pass")?;
let auto_rebase = py.import("pytket.passes")?.getattr("AutoRebase")?;
let optype = py.import("pytket")?.getattr("OpType")?;
let locals = [("OpType", &optype)].into_py_dict(py)?;
let op_set = py.eval(c"{OpType.CX, OpType.Rz, OpType.H}", None, Some(&locals))?;
Expand Down

0 comments on commit ea122a7

Please sign in to comment.