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

fix: failed importlib import #254

Merged
merged 1 commit into from
Nov 21, 2023
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 tket2-py/tket2/passes.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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:
Expand Down
4 changes: 2 additions & 2 deletions tket2-py/tket2/rewrite.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from .tket2 import _rewrite

from pathlib import Path
import importlib
from importlib import resources

__all__ = [
"default_ecc_rewriter",
Expand All @@ -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)