diff --git a/tket2-py/tket2/passes.py b/tket2-py/tket2/passes.py index 28b2fe6b..2486d594 100644 --- a/tket2-py/tket2/passes.py +++ b/tket2-py/tket2/passes.py @@ -1,6 +1,6 @@ from pathlib import Path from typing import Optional -import importlib +from importlib import resources from pytket import Circuit from pytket.passes import CustomPass @@ -33,7 +33,7 @@ def badger_pass( The arguments `max_threads`, `timeout`, `log_dir` and `rebase` are optional and will be passed on to the Badger optimiser if provided.""" if rewriter is None: - rewriter = Path(importlib.resources.files("tket2").joinpath("data/nam_6_3.rwr")) + rewriter = Path(resources.files("tket2").joinpath("data/nam_6_3.rwr")) opt = optimiser.BadgerOptimiser.load_precompiled(rewriter) def apply(circuit: Circuit) -> Circuit: diff --git a/tket2-py/tket2/rewrite.py b/tket2-py/tket2/rewrite.py index 9566c6ff..6560c310 100644 --- a/tket2-py/tket2/rewrite.py +++ b/tket2-py/tket2/rewrite.py @@ -3,7 +3,7 @@ from .tket2 import _rewrite from pathlib import Path -import importlib +from importlib import resources __all__ = [ "default_ecc_rewriter", @@ -14,5 +14,5 @@ def default_ecc_rewriter() -> _rewrite.ECCRewriter: """Load the default ecc rewriter.""" # TODO: Cite, explain what this is - rewriter = Path(importlib.resources.files("tket2").joinpath("data/nam_6_3.rwr")) + rewriter = Path(resources.files("tket2").joinpath("data/nam_6_3.rwr")) return _rewrite.ECCRewriter.load_precompiled(rewriter)