Skip to content

Commit

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

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Lukas Burgholzer <burgholzer@me.com>
  • Loading branch information
pre-commit-ci[bot] and burgholzer authored Nov 9, 2023
1 parent 7e03f0a commit 1b74685
Show file tree
Hide file tree
Showing 13 changed files with 43 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 @@ -51,7 +51,7 @@ repos:

# Python linting using ruff
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.1.3
rev: v0.1.4
hooks:
- id: ruff
args: ["--fix", "--show-fixes"]
Expand Down Expand Up @@ -88,7 +88,7 @@ repos:

# Clang-format the C++ part of the code base automatically
- repo: https://github.com/pre-commit/mirrors-clang-format
rev: v17.0.3
rev: v17.0.4
hooks:
- id: clang-format
types_or: [c++, c, cuda]
Expand Down
3 changes: 2 additions & 1 deletion docs/source/conf.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Sphinx configuration file."""

from __future__ import annotations

import warnings
Expand Down Expand Up @@ -108,7 +109,7 @@
class CDAStyle(UnsrtStyle):
"""Custom style for including PDF links."""

def format_url(self, _e: Entry) -> HRef:
def format_url(self, _e: Entry) -> HRef: # noqa: PLR6301
"""Format URL field as a link to the PDF."""
url = field("url", raw=True)
return href()[url, "[PDF]"]
Expand Down
22 changes: 19 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -187,9 +187,11 @@ extend-select = [
"EXE", # flake8-executable
"FA", # flake8-future-annotations
"FLY", # flynt
"FURB", # refurb
"I", # isort
"ICN", # flake8-import-conventions
"ISC", # flake8-implicit-str-concat
"LOG", # flake8-logging-format
"N", # flake8-naming
"NPY", # numpy
"PERF", # perflint
Expand All @@ -203,23 +205,37 @@ extend-select = [
"RET", # flake8-return
"RSE", # flake8-raise
"RUF", # Ruff-specific
"S", # flake8-bandit
"SLF", # flake8-self
"SLOT", # flake8-slots
"SIM", # flake8-simplify
"T20", # flake8-print
"TCH", # flake8-type-checking
"TID", # flake8-tidy-imports
"TRY", # tryceratops
"UP", # pyupgrade
"YTT", # flake8-2020
]
extend-ignore = [
"ANN101", # Missing type annotation for self in method
"ANN102", # Missing type annotation for cls in classmethod
"PLR", # Design related pylint codes
"ANN101", # Missing type annotation for `self` in method
"ANN102", # Missing type annotation for `cls` in classmethod
"ISC001", # Conflicts with formatter
"PLR0904", # Too many public methods
"PLR0911", # Too many return statements
"PLR0912", # Too many branches
"PLR0913", # Too many arguments
"PLR0915", # Too many local statements
"PLR2004", # Magic value used in comparison
"PLC0415", # Import should be at top of file
"PT004", # Incorrect, just usefixtures instead.
"S101", # Use of assert detected
]
isort.required-imports = ["from __future__ import annotations"]

[tool.ruff.lint.per-file-ignores]
"test/python/**" = ["T20", "ANN"]
"docs/**" = ["T20"]
"noxfile.py" = ["T20", "TID251"]
"*.pyi" = ["D"] # pydocstyle
"*.ipynb" = [
"D", # pydocstyle
Expand Down
1 change: 1 addition & 0 deletions src/mqt/qmap/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
This file is part of the MQT QMAP library released under the MIT license.
See README.md or go to https://github.com/cda-tum/qmap for more information.
"""

from __future__ import annotations

import os
Expand Down
1 change: 1 addition & 0 deletions src/mqt/qmap/compile.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Main entry point for the compilation module."""

from __future__ import annotations

from typing import TYPE_CHECKING
Expand Down
18 changes: 9 additions & 9 deletions src/mqt/qmap/pyqmap.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class Arch:
def __eq__(self, other: object) -> bool: ...
def __getstate__(self) -> int: ...
def __hash__(self) -> int: ...
def __index__(self) -> int: ... # noqa: PLW3201
def __index__(self) -> int: ...
def __int__(self) -> int: ...
def __ne__(self, other: object) -> bool: ...
def __setstate__(self, state: int) -> None: ...
Expand Down Expand Up @@ -97,7 +97,7 @@ class CommanderGrouping:
def __eq__(self, other: object) -> bool: ...
def __getstate__(self) -> int: ...
def __hash__(self) -> int: ...
def __index__(self) -> int: ... # noqa: PLW3201
def __index__(self) -> int: ...
def __int__(self) -> int: ...
def __ne__(self, other: object) -> bool: ...
def __setstate__(self, state: int) -> None: ...
Expand Down Expand Up @@ -152,7 +152,7 @@ class Encoding:
def __eq__(self, other: object) -> bool: ...
def __getstate__(self) -> int: ...
def __hash__(self) -> int: ...
def __index__(self) -> int: ... # noqa: PLW3201
def __index__(self) -> int: ...
def __int__(self) -> int: ...
def __ne__(self, other: object) -> bool: ...
def __setstate__(self, state: int) -> None: ...
Expand All @@ -175,7 +175,7 @@ class InitialLayout:
def __eq__(self, other: object) -> bool: ...
def __getstate__(self) -> int: ...
def __hash__(self) -> int: ...
def __index__(self) -> int: ... # noqa: PLW3201
def __index__(self) -> int: ...
def __int__(self) -> int: ...
def __ne__(self, other: object) -> bool: ...
def __setstate__(self, state: int) -> None: ...
Expand All @@ -200,7 +200,7 @@ class Layering:
def __eq__(self, other: object) -> bool: ...
def __getstate__(self) -> int: ...
def __hash__(self) -> int: ...
def __index__(self) -> int: ... # noqa: PLW3201
def __index__(self) -> int: ...
def __int__(self) -> int: ...
def __ne__(self, other: object) -> bool: ...
def __setstate__(self, state: int) -> None: ...
Expand Down Expand Up @@ -234,7 +234,7 @@ class Method:
def __eq__(self, other: object) -> bool: ...
def __getstate__(self) -> int: ...
def __hash__(self) -> int: ...
def __index__(self) -> int: ... # noqa: PLW3201
def __index__(self) -> int: ...
def __int__(self) -> int: ...
def __ne__(self, other: object) -> bool: ...
def __setstate__(self, state: int) -> None: ...
Expand All @@ -258,7 +258,7 @@ class SwapReduction:
def __eq__(self, other: object) -> bool: ...
def __getstate__(self) -> int: ...
def __hash__(self) -> int: ...
def __index__(self) -> int: ... # noqa: PLW3201
def __index__(self) -> int: ...
def __int__(self) -> int: ...
def __ne__(self, other: object) -> bool: ...
def __setstate__(self, state: int) -> None: ...
Expand All @@ -283,7 +283,7 @@ class TargetMetric:
def __eq__(self, other: object) -> bool: ...
def __getstate__(self) -> int: ...
def __hash__(self) -> int: ...
def __index__(self) -> int: ... # noqa: PLW3201
def __index__(self) -> int: ...
def __int__(self) -> int: ...
def __ne__(self, other: object) -> bool: ...
def __setstate__(self, state: int) -> None: ...
Expand All @@ -310,7 +310,7 @@ class Verbosity:
def __eq__(self, other: object) -> bool: ...
def __getstate__(self) -> int: ...
def __hash__(self) -> int: ...
def __index__(self) -> int: ... # noqa: PLW3201
def __index__(self) -> int: ...
def __int__(self) -> int: ...
def __ne__(self, other: object) -> bool: ...
def __setstate__(self, state: int) -> None: ...
Expand Down
2 changes: 1 addition & 1 deletion src/mqt/qmap/qiskit/backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ def import_target(target: Target) -> Architecture.Properties:
props.set_frequency(i, qubit_props.frequency)

for instruction, qargs in target.instructions:
if instruction.name in ("reset", "delay"):
if instruction.name in {"reset", "delay"}:
continue

instruction_props = target[instruction.name][qargs]
Expand Down
5 changes: 3 additions & 2 deletions src/mqt/qmap/subarchitectures.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ def from_library(cls, lib_name: str | Path) -> SubarchitectureOrder:
"""
path = Path(lib_name).with_suffix(".pickle")
with path.open("rb") as f:
temp = pickle.load(f)
temp = pickle.load(f) # noqa: S301

so = SubarchitectureOrder()
so.__dict__.update(temp.__dict__)
Expand Down Expand Up @@ -329,7 +329,8 @@ def __transitive_closure(self, po: PartialOrder) -> PartialOrder:

return po_trans

def __reflexive_closure(self, po: PartialOrder) -> PartialOrder:
@classmethod
def __reflexive_closure(cls, po: PartialOrder) -> PartialOrder:
"""Compute reflexive closure of partial order."""
po_ref = PartialOrder({})
for k, v in po.items():
Expand Down
1 change: 1 addition & 0 deletions test/python/test.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""A simple example of using QMAP."""

from __future__ import annotations

from qiskit import QuantumCircuit
Expand Down
1 change: 1 addition & 0 deletions test/python/test_compile.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Test the compilation of circuits."""

from __future__ import annotations

from pathlib import Path
Expand Down
1 change: 1 addition & 0 deletions test/python/test_exact_mapper.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Test the exact mapper."""

from __future__ import annotations

from qiskit import QuantumCircuit
Expand Down
1 change: 1 addition & 0 deletions test/python/test_heuristic_mapper.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Test the heuristic mapper."""

from __future__ import annotations

from qiskit import QuantumCircuit
Expand Down
1 change: 1 addition & 0 deletions test/python/test_qiskit_backend_imports.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Test the Qiskit backend imports."""

from __future__ import annotations

import pytest
Expand Down

0 comments on commit 1b74685

Please sign in to comment.