Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Jul 18, 2023
1 parent f328834 commit 3f2d946
Show file tree
Hide file tree
Showing 83 changed files with 293 additions and 933 deletions.
32 changes: 4 additions & 28 deletions examples/gate_zoo.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,34 +7,10 @@

from projectq import MainEngine
from projectq.backends import CircuitDrawer
from projectq.ops import (
CNOT,
QFT,
All,
Barrier,
BasicMathGate,
C,
Entangle,
H,
Measure,
Ph,
QubitOperator,
Rx,
Ry,
Rz,
S,
SqrtSwap,
SqrtX,
Swap,
T,
Tensor,
TimeEvolution,
Toffoli,
X,
Y,
Z,
get_inverse,
)
from projectq.ops import (CNOT, QFT, All, Barrier, BasicMathGate, C, Entangle,
H, Measure, Ph, QubitOperator, Rx, Ry, Rz, S,
SqrtSwap, SqrtX, Swap, T, Tensor, TimeEvolution,
Toffoli, X, Y, Z, get_inverse)


def zoo_profile():
Expand Down
17 changes: 7 additions & 10 deletions examples/shor.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,14 @@
import projectq.libs.math
import projectq.setups.decompositions
from projectq.backends import ResourceCounter, Simulator
from projectq.cengines import (
AutoReplacer,
DecompositionRuleSet,
InstructionFilter,
LocalOptimizer,
MainEngine,
TagRemover,
)
from projectq.libs.math import AddConstant, AddConstantModN, MultiplyByConstantModN
from projectq.cengines import (AutoReplacer, DecompositionRuleSet,
InstructionFilter, LocalOptimizer, MainEngine,
TagRemover)
from projectq.libs.math import (AddConstant, AddConstantModN,
MultiplyByConstantModN)
from projectq.meta import Control
from projectq.ops import QFT, All, BasicMathGate, H, Measure, R, Swap, X, get_inverse
from projectq.ops import (QFT, All, BasicMathGate, H, Measure, R, Swap, X,
get_inverse)


def run_shor(eng, N, a, verbose=False):
Expand Down
3 changes: 2 additions & 1 deletion projectq/backends/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@
from ._awsbraket import AWSBraketBackend
from ._azure import AzureQuantumBackend
from ._circuits import CircuitDrawer, CircuitDrawerMatplotlib
from ._exceptions import DeviceNotHandledError, DeviceOfflineError, DeviceTooSmall
from ._exceptions import (DeviceNotHandledError, DeviceOfflineError,
DeviceTooSmall)
from ._ibm import IBMBackend
from ._ionq import IonQBackend
from ._printer import CommandPrinter
Expand Down
3 changes: 2 additions & 1 deletion projectq/backends/_aqt/_aqt.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@

from projectq.cengines import BasicEngine
from projectq.meta import LogicalQubitIDTag, get_control_count
from projectq.ops import Allocate, Barrier, Deallocate, FlushGate, Measure, Rx, Rxx, Ry
from projectq.ops import (Allocate, Barrier, Deallocate, FlushGate, Measure,
Rx, Rxx, Ry)
from projectq.types import WeakQubitRef

from .._exceptions import InvalidCommandError
Expand Down
3 changes: 2 additions & 1 deletion projectq/backends/_aqt/_aqt_http_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@
from requests import Session
from requests.compat import urljoin

from .._exceptions import DeviceOfflineError, DeviceTooSmall, RequestTimeoutError
from .._exceptions import (DeviceOfflineError, DeviceTooSmall,
RequestTimeoutError)

# An AQT token can be requested at:
# https://gateway-portal.aqt.eu/
Expand Down
24 changes: 3 additions & 21 deletions projectq/backends/_aqt/_aqt_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,27 +20,9 @@
from projectq import MainEngine
from projectq.backends._aqt import _aqt
from projectq.cengines import BasicMapperEngine, DummyEngine
from projectq.ops import (
NOT,
All,
Allocate,
Barrier,
Command,
Deallocate,
Entangle,
Measure,
Rx,
Rxx,
Ry,
Rz,
S,
Sdag,
T,
Tdag,
X,
Y,
Z,
)
from projectq.ops import (NOT, All, Allocate, Barrier, Command, Deallocate,
Entangle, Measure, Rx, Rxx, Ry, Rz, S, Sdag, T, Tdag,
X, Y, Z)
from projectq.types import WeakQubitRef


Expand Down
29 changes: 6 additions & 23 deletions projectq/backends/_awsbraket/_awsbraket.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,29 +18,12 @@
import random

from projectq.cengines import BasicEngine
from projectq.meta import LogicalQubitIDTag, get_control_count, has_negative_control
from projectq.ops import (
Allocate,
Barrier,
DaggeredGate,
Deallocate,
FlushGate,
HGate,
Measure,
R,
Rx,
Ry,
Rz,
Sdag,
SGate,
SqrtXGate,
SwapGate,
Tdag,
TGate,
XGate,
YGate,
ZGate,
)
from projectq.meta import (LogicalQubitIDTag, get_control_count,
has_negative_control)
from projectq.ops import (Allocate, Barrier, DaggeredGate, Deallocate,
FlushGate, HGate, Measure, R, Rx, Ry, Rz, Sdag,
SGate, SqrtXGate, SwapGate, Tdag, TGate, XGate,
YGate, ZGate)
from projectq.types import WeakQubitRef

from ._awsbraket_boto3_client import retrieve, send
Expand Down
3 changes: 2 additions & 1 deletion projectq/backends/_awsbraket/_awsbraket_boto3_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@
import boto3
import botocore

from .._exceptions import DeviceOfflineError, DeviceTooSmall, RequestTimeoutError
from .._exceptions import (DeviceOfflineError, DeviceTooSmall,
RequestTimeoutError)


class AWSBraket:
Expand Down
39 changes: 5 additions & 34 deletions projectq/backends/_awsbraket/_awsbraket_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,41 +19,12 @@
import pytest

from projectq import MainEngine
from projectq.cengines import (
AutoReplacer,
BasicMapperEngine,
DecompositionRuleSet,
DummyEngine,
)
from projectq.cengines import (AutoReplacer, BasicMapperEngine,
DecompositionRuleSet, DummyEngine)
from projectq.cengines._replacer import NoGateDecompositionError
from projectq.ops import (
CNOT,
NOT,
All,
Allocate,
Barrier,
C,
Command,
Deallocate,
Entangle,
H,
MatrixGate,
Measure,
Ph,
R,
Rx,
Ry,
Rz,
S,
Sdag,
SqrtX,
Swap,
T,
Tdag,
X,
Y,
Z,
)
from projectq.ops import (CNOT, NOT, All, Allocate, Barrier, C, Command,
Deallocate, Entangle, H, MatrixGate, Measure, Ph, R,
Rx, Ry, Rz, S, Sdag, SqrtX, Swap, T, Tdag, X, Y, Z)
from projectq.types import WeakQubitRef

from ._awsbraket_test_fixtures import * # noqa: F401,F403
Expand Down
14 changes: 5 additions & 9 deletions projectq/backends/_azure/_azure_quantum.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,20 +20,16 @@

from projectq.cengines import BasicEngine
from projectq.meta import LogicalQubitIDTag
from projectq.ops import AllocateQubitGate, DeallocateQubitGate, FlushGate, MeasureGate
from projectq.ops import (AllocateQubitGate, DeallocateQubitGate, FlushGate,
MeasureGate)
from projectq.types import WeakQubitRef

from .._utils import _rearrange_result
from ._azure_quantum_client import retrieve, send
from ._exceptions import AzureQuantumTargetNotFoundError
from ._utils import (
IONQ_PROVIDER_ID,
QUANTINUUM_PROVIDER_ID,
is_available_ionq,
is_available_quantinuum,
to_json,
to_qasm,
)
from ._utils import (IONQ_PROVIDER_ID, QUANTINUUM_PROVIDER_ID,
is_available_ionq, is_available_quantinuum, to_json,
to_qasm)

try:
from azure.quantum import Workspace
Expand Down
3 changes: 2 additions & 1 deletion projectq/backends/_azure/_azure_quantum_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@

import projectq.backends._azure._azure_quantum
from projectq.backends import AzureQuantumBackend
from projectq.backends._azure._exceptions import AzureQuantumTargetNotFoundError
from projectq.backends._azure._exceptions import \
AzureQuantumTargetNotFoundError
except ImportError:
_has_azure_quantum = False

Expand Down
31 changes: 5 additions & 26 deletions projectq/backends/_azure/_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,32 +15,11 @@
"""Utility functions for Azure Quantum."""

from projectq.meta import get_control_count, has_negative_control
from projectq.ops import (
AllocateQubitGate,
BarrierGate,
ControlledGate,
DaggeredGate,
DeallocateQubitGate,
HGate,
MeasureGate,
R,
Rx,
Rxx,
Ry,
Ryy,
Rz,
Rzz,
Sdag,
SGate,
SqrtXGate,
SwapGate,
Tdag,
TGate,
XGate,
YGate,
ZGate,
get_inverse,
)
from projectq.ops import (AllocateQubitGate, BarrierGate, ControlledGate,
DaggeredGate, DeallocateQubitGate, HGate,
MeasureGate, R, Rx, Rxx, Ry, Ryy, Rz, Rzz, Sdag,
SGate, SqrtXGate, SwapGate, Tdag, TGate, XGate,
YGate, ZGate, get_inverse)

from .._exceptions import InvalidCommandError

Expand Down
44 changes: 7 additions & 37 deletions projectq/backends/_azure/_utils_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,37 +19,10 @@
import pytest

from projectq.cengines import DummyEngine, MainEngine
from projectq.ops import (
CNOT,
CX,
NOT,
Allocate,
Barrier,
C,
Command,
Deallocate,
H,
Measure,
Rx,
Rxx,
Ry,
Ryy,
Rz,
Rzz,
S,
Sdag,
Sdagger,
SqrtX,
SqrtXGate,
Swap,
T,
Tdag,
Tdagger,
X,
Y,
Z,
get_inverse,
)
from projectq.ops import (CNOT, CX, NOT, Allocate, Barrier, C, Command,
Deallocate, H, Measure, Rx, Rxx, Ry, Ryy, Rz, Rzz, S,
Sdag, Sdagger, SqrtX, SqrtXGate, Swap, T, Tdag,
Tdagger, X, Y, Z, get_inverse)
from projectq.types import WeakQubitRef

from .._exceptions import InvalidCommandError
Expand All @@ -58,12 +31,9 @@
try:
import azure.quantum # noqa: F401

from projectq.backends._azure._utils import (
is_available_ionq,
is_available_quantinuum,
to_json,
to_qasm,
)
from projectq.backends._azure._utils import (is_available_ionq,
is_available_quantinuum,
to_json, to_qasm)
except ImportError:
_has_azure_quantum = False

Expand Down
13 changes: 2 additions & 11 deletions projectq/backends/_circuits/_to_latex.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,8 @@

import json

from projectq.ops import (
Allocate,
DaggeredGate,
Deallocate,
Measure,
SqrtSwap,
Swap,
X,
Z,
get_inverse,
)
from projectq.ops import (Allocate, DaggeredGate, Deallocate, Measure,
SqrtSwap, Swap, X, Z, get_inverse)


def _gate_name(gate):
Expand Down
15 changes: 2 additions & 13 deletions projectq/backends/_circuits/_to_latex_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,8 @@
import projectq.backends._circuits._to_latex as _to_latex
from projectq import MainEngine
from projectq.meta import Control
from projectq.ops import (
CNOT,
BasicGate,
C,
H,
Measure,
SqrtSwap,
SqrtX,
Swap,
X,
Z,
get_inverse,
)
from projectq.ops import (CNOT, BasicGate, C, H, Measure, SqrtSwap, SqrtX,
Swap, X, Z, get_inverse)


def test_tolatex():
Expand Down
Loading

0 comments on commit 3f2d946

Please sign in to comment.