Skip to content

Commit

Permalink
⬆️🪝 update pre-commit hooks (#375)
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] committed May 13, 2024
1 parent 59dea83 commit 2f7d92e
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 6 deletions.
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,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 All @@ -82,7 +82,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
6 changes: 4 additions & 2 deletions docs/source/simulators/CircuitSimulator.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
"metadata": {},
"outputs": [],
"source": [
"import locale\n",
"from pathlib import Path\n",
"\n",
"qasm = \"\"\"\n",
Expand All @@ -55,7 +56,7 @@
"measure q[1] -> c[1];\n",
"\"\"\"\n",
"filename = \"bell.qasm\"\n",
"with Path(filename).open(\"w\") as f:\n",
"with Path(filename).open(\"w\", encoding=locale.getpreferredencoding(False)) as f:\n",
" f.write(qasm)"
]
},
Expand Down Expand Up @@ -205,6 +206,7 @@
"metadata": {},
"outputs": [],
"source": [
"import locale\n",
"from pathlib import Path\n",
"\n",
"qasm = \"\"\"\n",
Expand Down Expand Up @@ -248,7 +250,7 @@
"c[2] = measure q[0];\n",
"\"\"\"\n",
"filename = \"iqpe.qasm\"\n",
"with Path(filename).open(\"w\") as f:\n",
"with Path(filename).open(\"w\", encoding=locale.getpreferredencoding(False)) as f:\n",
" f.write(qasm)"
]
},
Expand Down
4 changes: 3 additions & 1 deletion src/mqt/ddsim/pathqasmsimulator.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
if TYPE_CHECKING:
from quimb.tensor import Tensor, TensorNetwork

import locale

from qiskit import QuantumCircuit
from qiskit.providers import Options
from qiskit.result.models import ExperimentResult, ExperimentResultData
Expand Down Expand Up @@ -102,7 +104,7 @@ def get_simulation_path(

if dump_path:
filename = qc.name + "_" + str(qc.num_qubits) + ".path" if isinstance(qc, QuantumCircuit) else "simulation.path"
with pathlib.Path(filename).open("w") as file:
with pathlib.Path(filename).open("w", encoding=locale.getpreferredencoding(False)) as file:
file.write(str(path))

if plot_ring:
Expand Down
3 changes: 2 additions & 1 deletion test/python/simulator/grover.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from __future__ import annotations

import locale
import pathlib

from qiskit import BasicAer
Expand All @@ -17,7 +18,7 @@
1 -2 -3 0
-1 2 3 0
"""
with pathlib.Path("dimacs_file.txt").open("w") as fd:
with pathlib.Path("dimacs_file.txt").open("w", encoding=locale.getpreferredencoding(False)) as fd:
fd.write(input_3sat_instance)

print("pyddsim")
Expand Down

0 comments on commit 2f7d92e

Please sign in to comment.