Skip to content

Commit

Permalink
⬆️🪝 update pre-commit hooks (#23)
Browse files Browse the repository at this point in the history
<!--pre-commit.ci start-->
updates:
- [github.com/astral-sh/ruff-pre-commit: v0.4.3 →
v0.4.4](astral-sh/ruff-pre-commit@v0.4.3...v0.4.4)
- [github.com/pre-commit/mirrors-clang-format: v18.1.4 →
v18.1.5](pre-commit/mirrors-clang-format@v18.1.4...v18.1.5)
<!--pre-commit.ci end-->

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
pre-commit-ci[bot] authored May 13, 2024
1 parent 75846eb commit f19ac1f
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 18 deletions.
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand Down Expand Up @@ -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]
Expand Down
3 changes: 2 additions & 1 deletion include/dd/ComplexTable.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
3 changes: 2 additions & 1 deletion include/dd/UniqueTable.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<std::size_t>(q) << ":" << "\n";
std::cout << "\tq" << static_cast<std::size_t>(q) << ":"
<< "\n";
for (std::size_t key = 0; key < table.size(); ++key) {
auto p = table[key];
if (p != nullptr) {
Expand Down
3 changes: 2 additions & 1 deletion src/mqt/qudits/quantum_circuit/circuit.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from __future__ import annotations

import copy
import locale
from pathlib import Path
from typing import TYPE_CHECKING

Expand Down Expand Up @@ -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)

Expand Down
21 changes: 14 additions & 7 deletions test/data_collect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -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);
Expand All @@ -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);
Expand All @@ -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);
Expand All @@ -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);
Expand All @@ -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);
Expand All @@ -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;
Expand Down
18 changes: 12 additions & 6 deletions test/test_pkg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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<dd::GateMatrix>(
Expand All @@ -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.;
Expand Down Expand Up @@ -936,7 +939,8 @@ TEST(DDPackageTest, RandomCircuits) {
}
} else { // entangling
std::cout << "\n"
<< "entangling" << "\n"
<< "entangling"
<< "\n"
<< std::endl;

auto entChoice = pickbool(gen);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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<dd::GateMatrix>(
Expand Down

0 comments on commit f19ac1f

Please sign in to comment.