Skip to content

Commit

Permalink
⬆️🪝 update pre-commit hooks (#198)
Browse files Browse the repository at this point in the history
<!--pre-commit.ci start-->
updates:
- [github.com/pre-commit/pre-commit-hooks: v4.5.0 →
v4.6.0](pre-commit/pre-commit-hooks@v4.5.0...v4.6.0)
- [github.com/sirosen/texthooks: 0.6.3 →
0.6.6](sirosen/texthooks@0.6.3...0.6.6)
- [github.com/astral-sh/ruff-pre-commit: v0.1.11 →
v0.3.7](astral-sh/ruff-pre-commit@v0.1.11...v0.3.7)
- [github.com/pre-commit/mirrors-mypy: v1.8.0 →
v1.9.0](pre-commit/mirrors-mypy@v1.8.0...v1.9.0)
- [github.com/pre-commit/mirrors-clang-format: v17.0.6 →
v18.1.3](pre-commit/mirrors-clang-format@v17.0.6...v18.1.3)
<!--pre-commit.ci end-->
  • Loading branch information
lucasberent authored Apr 21, 2024
2 parents 2d38eec + 75b2f9d commit 26be531
Show file tree
Hide file tree
Showing 8 changed files with 26 additions and 23 deletions.
10 changes: 5 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ ci:
repos:
# Standard hooks
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
rev: v4.6.0
hooks:
- id: check-added-large-files
- id: check-case-conflict
Expand All @@ -36,7 +36,7 @@ repos:

# Handling unwanted unicode characters
- repo: https://github.com/sirosen/texthooks
rev: 0.6.3
rev: 0.6.6
hooks:
- id: fix-ligatures
- id: fix-smartquotes
Expand All @@ -51,7 +51,7 @@ repos:

# Python linting and formatting using ruff
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.1.11
rev: v0.3.7
hooks:
- id: ruff
args: ["--fix", "--show-fixes"]
Expand All @@ -68,7 +68,7 @@ repos:

# Check static types with mypy
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.8.0
rev: v1.9.0
hooks:
- id: mypy
files: ^(src/mqt|test/python)
Expand All @@ -92,7 +92,7 @@ repos:

# Clang-format the C++ part of the code base automatically
- repo: https://github.com/pre-commit/mirrors-clang-format
rev: v17.0.6
rev: v18.1.3
hooks:
- id: clang-format
types_or: [c++, c, cuda]
Expand Down
4 changes: 2 additions & 2 deletions include/Decoder.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ class Decoder {
GrowthVariant growth = GrowthVariant::AllComponents; // standard

Decoder() = default;
virtual void decode(const std::vector<bool>&){}; // NOLINT(readability-named-parameter)
virtual void decode(const std::vector<bool>&) {}; // NOLINT(readability-named-parameter)
virtual ~Decoder() = default;

[[nodiscard]] const std::unique_ptr<Code>& getCode() const {
Expand All @@ -92,6 +92,6 @@ class Decoder {
this->code = std::make_unique<Code>(*c.gethZ()->pcm, *c.gethX()->pcm);
}
}
virtual void reset(){};
virtual void reset() {};
};
#endif // QUNIONFIND_DECODER_HPP
5 changes: 4 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,10 @@ unsafe-fixes = true
[tool.ruff.lint]
exclude = [
"scripts/*",
"*/cc_decoder/plots.py"
"*/cc_decoder/plots.py",
"*/analog_information_decoding/code_construction/*",
"*/analog_information_decoding/utils/data_utils.py",

]
extend-select = [
"A", # flake8-builtins
Expand Down
2 changes: 1 addition & 1 deletion scripts/examples/atd_example.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
""" example simulation script """
"""example simulation script"""

import numpy as np
import scipy
Expand Down
16 changes: 8 additions & 8 deletions src/mqt/qecc/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,19 @@
)

__all__ = [
"__version__",
"AnalogTannergraphDecoder",
"AtdSimulator",
"Code",
"Decoder",
"UFHeuristic",
"UFDecoder",
"GrowthVariant",
"DecodingResult",
"DecodingResultStatus",
"DecodingRunInformation",
"sample_iid_pauli_err",
"apply_ecc",
"AnalogTannergraphDecoder",
"AtdSimulator",
"GrowthVariant",
# "SoftInfoDecoder",
"QssSimulator",
"UFDecoder",
"UFHeuristic",
"__version__",
"apply_ecc",
"sample_iid_pauli_err",
]
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def alist2numpy(fname: str) -> NDArray[np.int32]: # current original implementa
for i in range(m):
columns = [item for item in alist_file[i + 4].split() if item.isdigit()]
columns_two: NDArray[np.int32] = np.array(columns, dtype=np.int32)
columns_two = columns_two - 1 # convert to zero indexing
columns_two -= 1 # convert to zero indexing
mat[i, columns_two] = 1

return mat
Expand Down Expand Up @@ -98,7 +98,7 @@ def generate_err(
residual_err_z = residual_err[1]

for i in range(nr_qubits):
rand = np.random.random() # this returns a random float in [0,1)
rand = np.random.default_rng().random() # this returns a random float in [0,1)
# e.g. if err channel is p = 0.3, then an error will be applied if rand < p
if rand < channel_probs_z[i]: # if probability for z error high enough, rand < p, apply
# if there is a z error on the i-th bit, flip the bit but take residual error into account
Expand Down Expand Up @@ -165,7 +165,7 @@ def generate_syndr_err(channel_probs: NDArray[np.float64]) -> NDArray[np.int32]:
error: NDArray[np.int32] = np.zeros_like(channel_probs, dtype=np.int32)

for i, p in np.ndenumerate(channel_probs):
rand = np.random.random()
rand = np.random.default_rng().random()

if rand < p:
error[i] = 1
Expand Down
4 changes: 2 additions & 2 deletions src/mqt/qecc/cc_decoder/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ def code_from_string(lattice_type: str, distance: int) -> ColorCode:


__all__ = [
"tn_decoder",
"HexagonalColorCode",
"ColorCode",
"HexagonalColorCode",
"LatticeType",
"SquareOctagonColorCode",
"code_from_string",
"tn_decoder",
]
2 changes: 1 addition & 1 deletion src/mqt/qecc/cc_decoder/decoder.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import datetime
import json
import subprocess
import subprocess # noqa: S404
from dataclasses import dataclass, field
from pathlib import Path
from typing import TYPE_CHECKING, Any
Expand Down

0 comments on commit 26be531

Please sign in to comment.