Skip to content

Commit

Permalink
Merge branch 'cda-tum:main' into DDSIM_Sampler
Browse files Browse the repository at this point in the history
  • Loading branch information
andresbar98 authored Nov 3, 2023
2 parents 4e8d855 + e36f5c1 commit 09282bb
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 27 deletions.
16 changes: 6 additions & 10 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,26 +49,22 @@ repos:
- id: rst-directive-colons
- id: rst-inline-touching-normal

# Run ruff (subsumes pyupgrade, isort, flake8+plugins, and more)
# Python linting using ruff
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.1.1
rev: v0.1.3
hooks:
- id: ruff
args: ["--fix", "--show-fixes"]

# Run code formatting with Black
- repo: https://github.com/psf/black-pre-commit-mirror
rev: 23.10.0 # Keep in sync with blacken-docs
hooks:
- id: black-jupyter
types_or: [python, pyi, jupyter]
- id: ruff-format
types_or: [python, pyi, jupyter]

# Also run Black on examples in the documentation
- repo: https://github.com/adamchainz/blacken-docs
rev: 1.16.0
hooks:
- id: blacken-docs
additional_dependencies:
- black==23.10.0 # keep in sync with black hook
additional_dependencies: [black==23.*]

# CMake format and lint the CMakeLists.txt files
- repo: https://github.com/cheshirekow/cmake-format-precommit
Expand Down
3 changes: 2 additions & 1 deletion docs/source/Usage.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
"outputs": [],
"source": [
"from qiskit import QuantumCircuit\n",
"\n",
"from mqt.ddsim import CircuitSimulator\n",
"\n",
"# A simple circuit that creates a Bell state\n",
Expand Down Expand Up @@ -154,7 +155,7 @@
"metadata": {},
"outputs": [],
"source": [
"from qiskit import *\n",
"from qiskit import QuantumCircuit, execute\n",
"\n",
"from mqt import ddsim\n",
"\n",
Expand Down
22 changes: 9 additions & 13 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -154,9 +154,6 @@ report.exclude_also = [
'if TYPE_CHECKING:',
]

[tool.black]
line-length = 120


[tool.mypy]
files = ["src/mqt", "test/python"]
Expand All @@ -174,9 +171,14 @@ module = ["qiskit.*"]
ignore_missing_imports = true

[tool.ruff]
include = ["*.py", "*.pyi", "**/pyproject.toml", "*.ipynb"]
select = [
"E", "F", "W", # flake8
line-length = 120
extend-include = ["*.ipynb"]
src = ["src"]
preview = true
unsafe-fixes = true

[tool.ruff.lint]
extend-select = [
"A", # flake8-builtins
# "ANN", # flake8-annotations
"ARG", # flake8-unused-arguments
Expand Down Expand Up @@ -214,15 +216,9 @@ select = [
"YTT", # flake8-2020
]
extend-ignore = [
"ANN101", # Missing type annotation for self in method
"ANN102", # Missing type annotation for cls in classmethod
"E501", # Line too long (Black is enough)
"PLR", # Design related pylint codes
"PLR", # Design related pylint codes
]
src = ["src"]
flake8-unused-arguments.ignore-variadic-names = true
isort.required-imports = ["from __future__ import annotations"]
line-length = 120

[tool.ruff.per-file-ignores]
"*.pyi" = ["D"] # pydocstyle
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@ def setUp(self) -> None:
circ.cx(0, 1)
circ.cx(0, 2)
self.circuit = circ
self.unitary: npt.NDArray[np.complex_] = np.zeros(
(2**circ.num_qubits, 2**circ.num_qubits), dtype=np.complex_
)
self.unitary: npt.NDArray[np.complex_] = np.zeros((2**circ.num_qubits, 2**circ.num_qubits), dtype=np.complex_)
self.non_zeros_in_bell_circuit = 16

def test_standalone_sequential_mode(self):
Expand Down

0 comments on commit 09282bb

Please sign in to comment.