Skip to content

Commit

Permalink
Update pre-commit... finally...
Browse files Browse the repository at this point in the history
  • Loading branch information
edyounis committed Aug 5, 2024
1 parent 6232ea7 commit e26b639
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 14 deletions.
16 changes: 8 additions & 8 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ ci:
skip: [mypy]
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
rev: v4.6.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
Expand Down Expand Up @@ -30,7 +30,7 @@ repos:
- --wrap-summaries=80
- --wrap-descriptions=80
- repo: https://github.com/pre-commit/mirrors-autopep8
rev: v2.0.2
rev: v2.0.4
hooks:
- id: autopep8
args:
Expand All @@ -39,13 +39,13 @@ repos:
- --ignore=E731
exclude: 'tests/ext.*'
- repo: https://github.com/asottile/pyupgrade
rev: v3.10.1
rev: v3.17.0
hooks:
- id: pyupgrade
args:
- --py38-plus
- repo: https://github.com/asottile/reorder_python_imports
rev: v3.10.0
rev: v3.13.0
hooks:
- id: reorder-python-imports
args:
Expand All @@ -54,25 +54,25 @@ repos:
- --py37-plus
exclude: 'tests/ext.*'
- repo: https://github.com/asottile/add-trailing-comma
rev: v3.0.1
rev: v3.1.0
hooks:
- id: add-trailing-comma
args:
- --py36-plus
- repo: https://github.com/PyCQA/autoflake
rev: v2.2.0
rev: v2.3.1
hooks:
- id: autoflake
args:
- --in-place
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.5.0
rev: v1.11.1
hooks:
- id: mypy
exclude: tests/qis/test_pauli.py
additional_dependencies: ["numpy>=1.21"]
- repo: https://github.com/PyCQA/flake8
rev: 6.1.0
rev: 7.1.1
hooks:
- id: flake8
args:
Expand Down
2 changes: 1 addition & 1 deletion bqskit/ext/qiskit/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def model_from_backend(backend: BackendV1) -> MachineModel:
num_qudits = config.n_qubits
gate_set = _basis_gate_str_to_bqskit_gate(config.basis_gates)
coupling_map = list({tuple(sorted(e)) for e in config.coupling_map})
return MachineModel(num_qudits, coupling_map, gate_set) # type: ignore
return MachineModel(num_qudits, coupling_map, gate_set)


def _basis_gate_str_to_bqskit_gate(basis_gates: list[str]) -> set[Gate]:
Expand Down
2 changes: 1 addition & 1 deletion bqskit/ir/interval.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ def __new__(
'Expected positive integers, got {lower} and {upper}.',
)

return super().__new__(cls, (lower, upper)) # type: ignore
return super().__new__(cls, (lower, upper))

@property
def lower(self) -> int:
Expand Down
2 changes: 1 addition & 1 deletion bqskit/ir/point.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def __new__(
else:
raise TypeError('Expected two integer arguments.')

return super().__new__(cls, (cycle, qudit)) # type: ignore
return super().__new__(cls, (cycle, qudit))

@property
def cycle(self) -> int:
Expand Down
6 changes: 5 additions & 1 deletion bqskit/qis/state/state.py
Original file line number Diff line number Diff line change
Expand Up @@ -433,4 +433,8 @@ def __repr__(self) -> str:
return repr(self._vec)


StateLike = Union[StateVector, np.ndarray, Sequence[Union[int, float, complex]]]
StateLike = Union[
StateVector,
npt.NDArray[np.complex128],
Sequence[Union[int, float, complex]],
]
7 changes: 6 additions & 1 deletion bqskit/qis/unitary/unitary.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from typing import Union

import numpy as np
import numpy.typing as npt

from bqskit.qis.unitary.meta import UnitaryMeta
from bqskit.utils.typing import is_real_number
Expand Down Expand Up @@ -151,4 +152,8 @@ def is_self_inverse(self, params: RealVector = []) -> bool:
return np.allclose(unitary_matrix, hermitian_conjugate)


RealVector = Union[Sequence[float], np.ndarray]
RealVector = Union[
Sequence[float],
npt.NDArray[np.float64],
npt.NDArray[np.float32],
]
7 changes: 6 additions & 1 deletion bqskit/qis/unitary/unitarymatrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -540,6 +540,11 @@ def __hash__(self) -> int:

UnitaryLike = Union[
UnitaryMatrix,
np.ndarray,
npt.NDArray[np.complex128],
npt.NDArray[np.complex64],
npt.NDArray[np.int64],
npt.NDArray[np.int32],
npt.NDArray[np.float64],
npt.NDArray[np.float32],
Sequence[Sequence[Union[int, float, complex]]],
]

0 comments on commit e26b639

Please sign in to comment.