From f19ac1fab650522f8848c83a89632219cec41586 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 13 May 2024 20:31:52 +0200 Subject: [PATCH] =?UTF-8?q?=E2=AC=86=EF=B8=8F=F0=9F=AA=9D=20update=20pre-c?= =?UTF-8?q?ommit=20hooks=20(#23)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/astral-sh/ruff-pre-commit: v0.4.3 → v0.4.4](https://github.com/astral-sh/ruff-pre-commit/compare/v0.4.3...v0.4.4) - [github.com/pre-commit/mirrors-clang-format: v18.1.4 → v18.1.5](https://github.com/pre-commit/mirrors-clang-format/compare/v18.1.4...v18.1.5) --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- .pre-commit-config.yaml | 4 ++-- include/dd/ComplexTable.hpp | 3 ++- include/dd/UniqueTable.hpp | 3 ++- src/mqt/qudits/quantum_circuit/circuit.py | 3 ++- test/data_collect.cpp | 21 ++++++++++++++------- test/test_pkg.cpp | 18 ++++++++++++------ 6 files changed, 34 insertions(+), 18 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 5a88d3b..3ba1f55 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -58,7 +58,7 @@ repos: # Python linting using ruff - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.4.3 + rev: v0.4.4 hooks: - id: ruff args: ["--fix", "--show-fixes"] @@ -86,7 +86,7 @@ repos: # Clang-format the C++ part of the code base automatically - repo: https://github.com/pre-commit/mirrors-clang-format - rev: v18.1.4 + rev: v18.1.5 hooks: - id: clang-format types_or: [c++, c, cuda] diff --git a/include/dd/ComplexTable.hpp b/include/dd/ComplexTable.hpp index 2a691dd..f3566ed 100644 --- a/include/dd/ComplexTable.hpp +++ b/include/dd/ComplexTable.hpp @@ -426,7 +426,8 @@ class ComplexTable { for (std::size_t key = 0; key < table.size(); ++key) { auto p = table[key]; if (p != nullptr) { - std::cout << key << ": " << "\n"; + std::cout << key << ": " + << "\n"; } while (p != nullptr) { diff --git a/include/dd/UniqueTable.hpp b/include/dd/UniqueTable.hpp index aa9ca8c..e984ac1 100644 --- a/include/dd/UniqueTable.hpp +++ b/include/dd/UniqueTable.hpp @@ -323,7 +323,8 @@ class UniqueTable { QuantumRegister q = nvars - 1; for (auto it = tables.rbegin(); it != tables.rend(); ++it) { auto& table = *it; - std::cout << "\tq" << static_cast(q) << ":" << "\n"; + std::cout << "\tq" << static_cast(q) << ":" + << "\n"; for (std::size_t key = 0; key < table.size(); ++key) { auto p = table[key]; if (p != nullptr) { diff --git a/src/mqt/qudits/quantum_circuit/circuit.py b/src/mqt/qudits/quantum_circuit/circuit.py index 5cf47fb..882514d 100644 --- a/src/mqt/qudits/quantum_circuit/circuit.py +++ b/src/mqt/qudits/quantum_circuit/circuit.py @@ -1,6 +1,7 @@ from __future__ import annotations import copy +import locale from pathlib import Path from typing import TYPE_CHECKING @@ -378,7 +379,7 @@ def load_from_file(self, file_path: str) -> None: Returns: str: The text loaded from the file. """ - with Path(file_path).open("r") as file: + with Path(file_path).open("r", encoding=locale.getpreferredencoding(False)) as file: text = file.read() self.from_qasm(text) diff --git a/test/data_collect.cpp b/test/data_collect.cpp index 9b99756..72c01f3 100644 --- a/test/data_collect.cpp +++ b/test/data_collect.cpp @@ -468,7 +468,8 @@ int main() { // NOLINT(bugprone-exception-escape) fullMixWState(myfile, {2, 3, 2, 5}); fullMixWState(myfile, {2, 3, 3, 3}); fullMixWState(myfile, {5, 5, 2, 2}); - std::cout << "First set" << "\n"; + std::cout << "First set" + << "\n"; myfile.close(); myfile.open("/home/k3vn/Desktop/trycollect.csv", std::ios_base::app); @@ -478,7 +479,8 @@ int main() { // NOLINT(bugprone-exception-escape) ghzQutritStateScaled(myfile, 60); ghzQutritStateScaled(myfile, 120); ghzQutritStateScaled(myfile, 128); - std::cout << "Second set" << "\n"; + std::cout << "Second set" + << "\n"; myfile.close(); myfile.open("/home/k3vn/Desktop/trycollect.csv", std::ios_base::app); randomCircuits(3, 1000, myfile); @@ -487,7 +489,8 @@ int main() { // NOLINT(bugprone-exception-escape) randomCircuits(6, 1000, myfile); randomCircuits(7, 1000, myfile); - std::cout << "Third set" << "\n"; + std::cout << "Third set" + << "\n"; myfile.close(); myfile.open("/home/k3vn/Desktop/trycollect.csv", std::ios_base::app); randomCircuits(3, 1000, myfile); @@ -496,7 +499,8 @@ int main() { // NOLINT(bugprone-exception-escape) randomCircuits(6, 1000, myfile); randomCircuits(7, 1000, myfile); - std::cout << "fourth set" << "\n"; + std::cout << "fourth set" + << "\n"; myfile.close(); myfile.open("/home/k3vn/Desktop/trycollect.csv", std::ios_base::app); randomCircuits(3, 1000, myfile); @@ -505,7 +509,8 @@ int main() { // NOLINT(bugprone-exception-escape) randomCircuits(6, 1000, myfile); randomCircuits(7, 1000, myfile); - std::cout << "fifth set" << "\n"; + std::cout << "fifth set" + << "\n"; myfile.close(); myfile.open("/home/k3vn/Desktop/trycollect.csv", std::ios_base::app); randomCircuits(8, 1000, myfile); @@ -515,7 +520,8 @@ int main() { // NOLINT(bugprone-exception-escape) randomCircuits(12, 1000, myfile); randomCircuits(13, 1000, myfile); - std::cout << "6 set" << "\n"; + std::cout << "6 set" + << "\n"; myfile.close(); myfile.open("/home/k3vn/Desktop/trycollect.csv", std::ios_base::app); randomCircuits(8, 1000, myfile); @@ -525,7 +531,8 @@ int main() { // NOLINT(bugprone-exception-escape) randomCircuits(12, 1000, myfile); randomCircuits(13, 1000, myfile); - std::cout << "7 set" << "\n"; + std::cout << "7 set" + << "\n"; myfile.close(); return 0; diff --git a/test/test_pkg.cpp b/test/test_pkg.cpp index 1e50057..560fab7 100644 --- a/test/test_pkg.cpp +++ b/test/test_pkg.cpp @@ -833,7 +833,8 @@ TEST(DDPackageTest, RandomCircuits) { auto evolution = dd->makeZeroState(width); std::cout << "\n" - << "STARTED" << "\n" + << "STARTED" + << "\n" << std::endl; std::uniform_int_distribution<> pickbool(0, 1); @@ -851,7 +852,8 @@ TEST(DDPackageTest, RandomCircuits) { if (localChoice == 0) { // hadamard std::cout << "\n" - << "hadamard" << "\n" + << "hadamard" + << "\n" << std::endl; if (particles.at(line) == 2) { auto chosenGate = dd->makeGateDD( @@ -872,7 +874,8 @@ TEST(DDPackageTest, RandomCircuits) { } } else { // givens std::cout << "\n" - << "givens" << "\n" + << "givens" + << "\n" << std::endl; if (particles.at(line) == 2) { double const theta = 0.; @@ -936,7 +939,8 @@ TEST(DDPackageTest, RandomCircuits) { } } else { // entangling std::cout << "\n" - << "entangling" << "\n" + << "entangling" + << "\n" << std::endl; auto entChoice = pickbool(gen); @@ -970,7 +974,8 @@ TEST(DDPackageTest, RandomCircuits) { if (entChoice == 0) { // CEX based // selection of controls std::cout << "\n" - << "CEX" << "\n" + << "CEX" + << "\n" << std::endl; if (particles.at(line) == 2) { double const theta = angles(gen); @@ -1033,7 +1038,8 @@ TEST(DDPackageTest, RandomCircuits) { } } else { // Controlled clifford std::cout << "\n" - << "clifford" << "\n" + << "clifford" + << "\n" << std::endl; if (particles.at(line) == 2) { auto chosenGate = dd->makeGateDD(