From 3bca1f3e0e54f0aa0088c79b6b4d68b470578b4c Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 7 Nov 2023 12:07:28 +0000 Subject: [PATCH] =?UTF-8?q?=E2=AC=86=EF=B8=8F=F0=9F=AA=9D=20update=20pre-c?= =?UTF-8?q?ommit=20hooks=20(#326)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/astral-sh/ruff-pre-commit: v0.1.3 → v0.1.4](https://github.com/astral-sh/ruff-pre-commit/compare/v0.1.3...v0.1.4) - [github.com/pre-commit/mirrors-clang-format: v17.0.3 → v17.0.4](https://github.com/pre-commit/mirrors-clang-format/compare/v17.0.3...v17.0.4) --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Lukas Burgholzer --- .pre-commit-config.yaml | 4 ++-- docs/source/conf.py | 1 + src/mqt/qcec/__init__.py | 1 + src/mqt/qcec/pyqcec/__init__.pyi | 6 +++--- src/mqt/qcec/types.py | 1 + src/mqt/qcec/verify_compilation_flow.py | 3 +-- test/python/test_compilation_flow_profiles.py | 4 ++-- test/python/test_construction.py | 4 ++-- test/python/test_verify.py | 6 ++---- 9 files changed, 15 insertions(+), 15 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index b6d960d5..cd9018c1 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -51,7 +51,7 @@ repos: # Python linting and formatting using ruff - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.1.3 + rev: v0.1.4 hooks: - id: ruff args: ["--fix", "--show-fixes"] @@ -77,7 +77,7 @@ repos: # Clang-format the C++ part of the code base automatically - repo: https://github.com/pre-commit/mirrors-clang-format - rev: v17.0.3 + rev: v17.0.4 hooks: - id: clang-format types_or: [c++, c, cuda] diff --git a/docs/source/conf.py b/docs/source/conf.py index 73110f24..d4a72b27 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -1,4 +1,5 @@ """Sphinx configuration file.""" + from __future__ import annotations import warnings diff --git a/src/mqt/qcec/__init__.py b/src/mqt/qcec/__init__.py index 1db4ca03..8ef93e78 100644 --- a/src/mqt/qcec/__init__.py +++ b/src/mqt/qcec/__init__.py @@ -3,6 +3,7 @@ This file is part of the MQT QCEC library released under the MIT license. See README.md or go to https://github.com/cda-tum/qcec for more information. """ + from __future__ import annotations from ._version import version as __version__ diff --git a/src/mqt/qcec/pyqcec/__init__.pyi b/src/mqt/qcec/pyqcec/__init__.pyi index f57d0cd9..79c3486d 100644 --- a/src/mqt/qcec/pyqcec/__init__.pyi +++ b/src/mqt/qcec/pyqcec/__init__.pyi @@ -19,7 +19,7 @@ class ApplicationScheme: def __eq__(self, other: object) -> bool: ... def __getstate__(self) -> int: ... def __hash__(self) -> int: ... - def __index__(self) -> int: ... # noqa: PLW3201 + def __index__(self) -> int: ... def __int__(self) -> int: ... def __ne__(self, other: object) -> bool: ... def __setstate__(self, state: int) -> None: ... @@ -150,7 +150,7 @@ class EquivalenceCriterion: def __eq__(self, other: object) -> bool: ... def __getstate__(self) -> int: ... def __hash__(self) -> int: ... - def __index__(self) -> int: ... # noqa: PLW3201 + def __index__(self) -> int: ... def __int__(self) -> int: ... def __ne__(self, other: object) -> bool: ... def __setstate__(self, state: int) -> None: ... @@ -171,7 +171,7 @@ class StateType: def __eq__(self, other: object) -> bool: ... def __getstate__(self) -> int: ... def __hash__(self) -> int: ... - def __index__(self) -> int: ... # noqa: PLW3201 + def __index__(self) -> int: ... def __int__(self) -> int: ... def __ne__(self, other: object) -> bool: ... def __setstate__(self, state: int) -> None: ... diff --git a/src/mqt/qcec/types.py b/src/mqt/qcec/types.py index 0ff60201..42245122 100644 --- a/src/mqt/qcec/types.py +++ b/src/mqt/qcec/types.py @@ -1,4 +1,5 @@ """Types for the QCEC module.""" + from __future__ import annotations from typing import Literal diff --git a/src/mqt/qcec/verify_compilation_flow.py b/src/mqt/qcec/verify_compilation_flow.py index b86de492..58f8854b 100644 --- a/src/mqt/qcec/verify_compilation_flow.py +++ b/src/mqt/qcec/verify_compilation_flow.py @@ -17,6 +17,7 @@ from importlib import resources from qiskit import QuantumCircuit +from qiskit.transpiler.passes import ContainsInstruction from . import ApplicationScheme, Configuration, EquivalenceCheckingManager from .compilation_flow_profiles import AncillaMode, generate_profile_name @@ -30,8 +31,6 @@ def __check_if_circuit_contains_measurements(circuit: QuantumCircuit) -> None: Args: circuit: The circuit to check. """ - from qiskit.transpiler.passes import ContainsInstruction - analysis_pass = ContainsInstruction("measure") analysis_pass(circuit) if not analysis_pass.property_set["contains_measure"]: diff --git a/test/python/test_compilation_flow_profiles.py b/test/python/test_compilation_flow_profiles.py index a1109f0b..7b110202 100644 --- a/test/python/test_compilation_flow_profiles.py +++ b/test/python/test_compilation_flow_profiles.py @@ -12,6 +12,8 @@ else: from importlib import resources +import difflib + import pytest from mqt import qcec @@ -61,8 +63,6 @@ def test_generated_profiles_are_still_valid(optimization_level: int, ancilla_mod if equal: return - import difflib - ref_profile = path.read_text().splitlines(keepends=True) gen_profile = Path(profile_name).read_text().splitlines(keepends=True) diff = difflib.unified_diff(ref_profile, gen_profile, fromfile="reference", tofile="generated", n=0) diff --git a/test/python/test_construction.py b/test/python/test_construction.py index e824e48f..770debf2 100644 --- a/test/python/test_construction.py +++ b/test/python/test_construction.py @@ -2,6 +2,8 @@ from __future__ import annotations +from pathlib import Path + import pytest from qiskit import QuantumCircuit @@ -29,8 +31,6 @@ def test_constructor_with_configuration(example_circuit: QuantumCircuit) -> None def test_default_constructor_with_file(example_circuit: QuantumCircuit) -> None: """Test constructing an instance from two circuit files with all default arguments.""" - from pathlib import Path - filename = "test.qasm" example_circuit.qasm(filename=filename) qcec.EquivalenceCheckingManager(circ1=filename, circ2=filename) diff --git a/test/python/test_verify.py b/test/python/test_verify.py index fd80d221..84e7840d 100644 --- a/test/python/test_verify.py +++ b/test/python/test_verify.py @@ -3,7 +3,8 @@ from __future__ import annotations import pytest -from qiskit import QuantumCircuit +from qiskit import QuantumCircuit, transpile +from qiskit.providers.fake_provider import FakeAthens from mqt import qcec @@ -67,9 +68,6 @@ def test_compiled_circuit_without_measurements() -> None: It makes sure that circuits compiled without measurements are handled correctly. """ - from qiskit import transpile - from qiskit.providers.fake_provider import FakeAthens - qc = QuantumCircuit(1) qc.x(0) qc_compiled = transpile(qc, backend=FakeAthens())