From c6ae410552ab00c49aca2e5c0a85f0d5d7f4b5cc Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 28 Feb 2023 05:14:03 +0000 Subject: [PATCH 1/3] =?UTF-8?q?=E2=AC=86=EF=B8=8F=F0=9F=AA=9D=20update=20p?= =?UTF-8?q?re-commit=20hooks?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/charliermarsh/ruff-pre-commit: v0.0.248 → v0.0.253](https://github.com/charliermarsh/ruff-pre-commit/compare/v0.0.248...v0.0.253) --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 447f327ec..9f890cd1f 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -51,7 +51,7 @@ repos: # Run ruff (subsumes pyupgrade, isort, flake8+plugins, and more) - repo: https://github.com/charliermarsh/ruff-pre-commit - rev: v0.0.248 + rev: v0.0.253 hooks: - id: ruff args: ["--fix"] From 475ab9bb78d4e2e0ea360928c3be405d75472b76 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 28 Feb 2023 05:14:21 +0000 Subject: [PATCH 2/3] =?UTF-8?q?=F0=9F=8E=A8=20pre-commit=20fixes?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- mqt/qmap/subarchitectures.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mqt/qmap/subarchitectures.py b/mqt/qmap/subarchitectures.py index 04f465721..4c6dedd90 100644 --- a/mqt/qmap/subarchitectures.py +++ b/mqt/qmap/subarchitectures.py @@ -375,7 +375,7 @@ def __compute_desirable_subarchitectures(self) -> None: new_des: set[tuple[int, int]] = set() for j, (n_prime, i_prime) in enumerate(reversed(des)): j = len(des) - j - 1 - if not any([(n_prime, i_prime) in self.subarch_order[k] for k in des[:j]]): + if not any((n_prime, i_prime) in self.subarch_order[k] for k in des[:j]): new_des.add((n_prime, i_prime)) self.desirable_subarchitectures[(n, i)] = new_des From 893f84aa9c422018d33ed8ef3787c4e3f3ee3c00 Mon Sep 17 00:00:00 2001 From: burgholzer Date: Tue, 28 Feb 2023 10:08:48 +0100 Subject: [PATCH 3/3] =?UTF-8?q?=F0=9F=9A=A8=20fix=20new=20ruff=20warnings?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: burgholzer --- mqt/qmap/compile.py | 4 ++-- mqt/qmap/subarchitectures.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/mqt/qmap/compile.py b/mqt/qmap/compile.py index 1b29c8b6e..c313ec498 100644 --- a/mqt/qmap/compile.py +++ b/mqt/qmap/compile.py @@ -42,9 +42,9 @@ def extract_initial_layout_from_qasm(qasm: str, qregs: list[QuantumRegister]) -> for line in qasm.split("\n"): if line.startswith("// i "): # strip away initial part of line - line = line[5:] + stripped_line = line[5:] # split line into tokens - tokens = line.split(" ") + tokens = stripped_line.split(" ") # convert tokens to integers int_tokens = [int(token) for token in tokens] # create an empty layout diff --git a/mqt/qmap/subarchitectures.py b/mqt/qmap/subarchitectures.py index 4c6dedd90..2266cc857 100644 --- a/mqt/qmap/subarchitectures.py +++ b/mqt/qmap/subarchitectures.py @@ -374,8 +374,8 @@ def __compute_desirable_subarchitectures(self) -> None: des.sort() new_des: set[tuple[int, int]] = set() for j, (n_prime, i_prime) in enumerate(reversed(des)): - j = len(des) - j - 1 - if not any((n_prime, i_prime) in self.subarch_order[k] for k in des[:j]): + idx = len(des) - j - 1 + if not any((n_prime, i_prime) in self.subarch_order[k] for k in des[:idx]): new_des.add((n_prime, i_prime)) self.desirable_subarchitectures[(n, i)] = new_des