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 Dec 20, 2022
1 parent 8213b67 commit c710bd5
Show file tree
Hide file tree
Showing 35 changed files with 12 additions and 80 deletions.
4 changes: 2 additions & 2 deletions bqskit/ext/rigetti.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
# Ring 4-5
(25, 38), (26, 37),
])
"""Retrieved August 31, 2022: https://qcs.rigetti.com/qpus"""
"""Retrieved August 31, 2022: https://qcs.rigetti.com/qpus."""

_octo_rings = [
[
Expand Down Expand Up @@ -77,7 +77,7 @@
_links.extend(l)

_aspen_m2_coupling_graph = CouplingGraph(_links)
"""Retrieved August 31, 2022: https://qcs.rigetti.com/qpus"""
"""Retrieved August 31, 2022: https://qcs.rigetti.com/qpus."""

Aspen11Model = MachineModel(40, _aspen_11_coupling_graph, rigetti_gate_set)
"""A BQSKit MachineModel for Rigetti's Aspen-11 quantum processor."""
Expand Down
20 changes: 10 additions & 10 deletions bqskit/ir/circuit.py
Original file line number Diff line number Diff line change
Expand Up @@ -2090,8 +2090,9 @@ def surround(

HalfWire = Tuple[CircuitPoint, str]
"""
A HalfWire is a point in the circuit and a direction. This
represents a point to start exploring from and a direction to
A HalfWire is a point in the circuit and a direction.
This represents a point to start exploring from and a direction to
explore in.
"""

Expand All @@ -2104,14 +2105,13 @@ def surround(
"""
A Node in the search tree.
Each node represents a region that may grow further.
The data structure tracks all HalfWires in the region and
the set of operations inside the region. During node exploration
each HalfWire is walked until we find a multi-qudit gate. Multi-
qudit gates form branches in the tree on whether on the gate
should be included. The node structure additionally stores the
set of qudit indices involved in the region currently. Also, we
track points that have already been explored to reduce repetition.
Each node represents a region that may grow further. The data structure
tracks all HalfWires in the region and the set of operations inside the
region. During node exploration each HalfWire is walked until we find a
multi-qudit gate. Multi- qudit gates form branches in the tree on
whether on the gate should be included. The node structure additionally
stores the set of qudit indices involved in the region currently. Also,
we track points that have already been explored to reduce repetition.
"""

# Initialize the frontier
Expand Down
1 change: 0 additions & 1 deletion bqskit/ir/opt/multistartgen.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@


class MultiStartGenerator(abc.ABC):

@abc.abstractmethod
def gen_starting_points(
self,
Expand Down
1 change: 0 additions & 1 deletion tests/ext/test_cirq.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@


class TestTranslate:

@pytest.fixture
def bqskit_circuit(self) -> Circuit:
circuit = Circuit(3)
Expand Down
1 change: 0 additions & 1 deletion tests/ext/test_pytket.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@


class TestTranslate:

@pytest.fixture
def bqskit_circuit(self) -> Circuit:
circuit = Circuit(3)
Expand Down
1 change: 0 additions & 1 deletion tests/ext/test_qiskit.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@


class TestTranslate:

@pytest.fixture
def bqskit_circuit(self) -> Circuit:
circuit = Circuit(3)
Expand Down
1 change: 0 additions & 1 deletion tests/ext/test_qutip.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@


class TestTranslate:

@pytest.fixture
def bqskit_circuit(self) -> Circuit:
circuit = Circuit(3)
Expand Down
3 changes: 0 additions & 3 deletions tests/ir/circuit/test_point_methods.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@


class TestIsPointInRange:

@valid_type_test(Circuit(1).is_point_in_range)
def test_valid_type(self) -> None:
pass
Expand Down Expand Up @@ -111,7 +110,6 @@ def test_false_pos(self, point: CircuitPointLike) -> None:


class TestIsPointIdle:

@valid_type_test(Circuit(1).is_point_idle)
def test_valid_type(self) -> None:
pass
Expand Down Expand Up @@ -141,7 +139,6 @@ def test_not_idle(self, circuit: Circuit) -> None:


class TestNormalizePoint:

@valid_type_test(Circuit(1).normalize_point)
def test_valid_type(self) -> None:
pass
Expand Down
2 changes: 0 additions & 2 deletions tests/ir/gates/parameterized/test_unitary.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@


class TestInit:

@given(num_qudits_and_radixes(3, (2, 3)))
def test_valid(self, pair: tuple[int, tuple[int, ...]]) -> None:
num_qudits, radixes = pair
Expand All @@ -29,7 +28,6 @@ def test_invalid(self, num_qudits: int) -> None:


class TestGetUnitary:

@given(unitaries())
def test_exact(self, utry: UnitaryMatrix) -> None:
params = list(np.reshape(np.real(utry.numpy), (-1,))) + \
Expand Down
1 change: 0 additions & 1 deletion tests/ir/gates/test_circuitgate.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@


class TestPickle:

@given(circuits([2, 2], max_gates=3), circuits([2, 2], max_gates=3))
def test_pickle_individual(self, c1: Circuit, c2: Circuit) -> None:
gate1 = CircuitGate(c1)
Expand Down
1 change: 0 additions & 1 deletion tests/ir/lang/test_qasm_decode.py
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,6 @@ def test_nested_gate_decl(self) -> None:


class TestIncludeStatements:

def test_include_no_exists(self) -> None:
input = """
OPENQASM 2.0;
Expand Down
1 change: 0 additions & 1 deletion tests/ir/opt/instantiaters/test_qfactor.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@


class TestQFactorEndToEnd:

def test_no_change(self) -> None:
u1 = unitary_group.rvs(8)
g1 = VariableUnitaryGate(3)
Expand Down
1 change: 0 additions & 1 deletion tests/ir/test_gate.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@


class TestBasicGate:

def test_get_name(self, gate: Gate) -> None:
assert isinstance(gate.name, str)

Expand Down
6 changes: 0 additions & 6 deletions tests/ir/test_interval.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ def test_strategy(interval: CycleInterval) -> None:


class TestCycleIntervalNew:

@valid_type_test(CycleInterval)
def test_valid_type(self) -> None:
pass
Expand Down Expand Up @@ -100,7 +99,6 @@ def test_indices(interval: CycleInterval) -> None:


class TestCycleIntervalOverlaps:

@valid_type_test(CycleInterval(0, 0).overlaps)
def test_valid_type(self) -> None:
pass
Expand All @@ -122,7 +120,6 @@ def test_overlaps(


class TestCycleIntervalIntersection:

@valid_type_test(CycleInterval(0, 0).intersection)
def test_valid_type(self) -> None:
pass
Expand Down Expand Up @@ -159,7 +156,6 @@ def test_valid(


class TestCycleIntervalUnion:

@valid_type_test(CycleInterval(0, 0).union)
def test_valid_type(self) -> None:
pass
Expand Down Expand Up @@ -196,7 +192,6 @@ def test_valid(


class TestCycleIntervalLt:

@given(cycle_intervals(), everything_except(tuple))
# @example(CycleInterval(0, 0), tuple())
def test_invalid(self, interval: CycleInterval, other: Any) -> None:
Expand All @@ -222,7 +217,6 @@ def test_valid(


class TestCycleIntervalIsBounds:

@given(cycle_intervals())
def test_true_1(self, interval: CycleInterval) -> None:
assert CycleInterval.is_interval(interval)
Expand Down
1 change: 0 additions & 1 deletion tests/ir/test_iterator.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@


class TestCircuitIterator:

def test_empty(self) -> None:
circuit = Circuit(1)
ops = [cast(Operation, op) for op in CircuitIterator(circuit)]
Expand Down
3 changes: 0 additions & 3 deletions tests/ir/test_location.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@


class TestInit:

@invalid_type_test(CircuitLocation)
def test_invalid_type(self) -> None:
pass
Expand All @@ -31,7 +30,6 @@ def test_from_list(self, loc: list[int]) -> None:


class TestUnion:

@given(circuit_locations())
def test_self(self, loc: CircuitLocation) -> None:
assert set(loc.union(loc)) == set(loc)
Expand All @@ -46,7 +44,6 @@ def test_other(self, l1: CircuitLocation, l2: CircuitLocationLike) -> None:


class TestIntersection:

@given(circuit_locations())
def test_self(self, loc: CircuitLocation) -> None:
assert loc.intersection(loc) == loc
Expand Down
1 change: 0 additions & 1 deletion tests/ir/test_operation.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ def test_init(op: Operation) -> None:


class TestGetQasm:

def test_cx(self) -> None:
op = Operation(CXGate(), (0, 1))
assert op.get_qasm() == 'cx q[0], q[1];\n'
Expand Down
3 changes: 0 additions & 3 deletions tests/ir/test_point.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@


class TestNew:

@invalid_type_test(CircuitPoint)
def test_invalid_type(self) -> None:
pass
Expand Down Expand Up @@ -56,7 +55,6 @@ def test_invalid(self, cycle: int) -> None:


class TestIsPoint:

@given(circuit_points())
def test_from_point(self, point: CircuitPoint) -> None:
assert CircuitPoint.is_point(point)
Expand All @@ -71,7 +69,6 @@ def test_false(self, not_a_point: Any) -> None:


class TestConversionToTuple:

@given(circuit_points())
def test_from_point(self, point: CircuitPoint) -> None:
assert isinstance(point, tuple)
Expand Down
7 changes: 0 additions & 7 deletions tests/ir/test_region.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ def test_strategy(region: CircuitRegion) -> None:


class TestCircuitRegionInit:

@valid_type_test(CircuitRegion)
def test_valid_type(self) -> None:
pass
Expand Down Expand Up @@ -187,7 +186,6 @@ def test_empty(region: CircuitRegion) -> None:


class TestShiftLeft:

@valid_type_test(CircuitRegion({}).shift_left)
def test_valid_type(self) -> None:
pass
Expand Down Expand Up @@ -230,7 +228,6 @@ def test_invalid(self, region: CircuitRegion) -> None:


class TestShiftRight:

@valid_type_test(CircuitRegion({}).shift_right)
def test_valid_type(self) -> None:
pass
Expand Down Expand Up @@ -273,7 +270,6 @@ def test_invalid(self, region: CircuitRegion) -> None:


class TestOverlaps:

@valid_type_test(CircuitRegion({}).overlaps)
def test_valid_type(self) -> None:
pass
Expand Down Expand Up @@ -306,7 +302,6 @@ def test_region_by_point(


class TestContains:

@given(circuit_regions(), circuit_regions())
def test_region_by_region(
self,
Expand Down Expand Up @@ -360,7 +355,6 @@ def test_transpose(region: CircuitRegion) -> None:


class TestIntersection:

@valid_type_test(CircuitRegion({}).intersection)
def test_valid_type(self) -> None:
pass
Expand All @@ -384,7 +378,6 @@ def test_region_by_region(


class TestUnion:

@valid_type_test(CircuitRegion({}).union)
def test_valid_type(self) -> None:
pass
Expand Down
1 change: 0 additions & 1 deletion tests/passes/partitioning/test_cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@


class TestClusteringPartitioner:

def test_run_r6(self, r6_qudit_circuit: Circuit) -> None:
utry = r6_qudit_circuit.get_unitary()
ClusteringPartitioner(3, 2).run(r6_qudit_circuit, {})
Expand Down
1 change: 0 additions & 1 deletion tests/passes/partitioning/test_greedy.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@


class TestGreedyPartitioner:

def test_run_r6(self, r6_qudit_circuit: Circuit) -> None:
utry = r6_qudit_circuit.get_unitary()
GreedyPartitioner(3).run(r6_qudit_circuit, {})
Expand Down
1 change: 0 additions & 1 deletion tests/passes/partitioning/test_quick.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@


class TestQuickPartitioner:

def test_run_r6(self, r6_qudit_circuit: Circuit) -> None:
utry = r6_qudit_circuit.get_unitary()
QuickPartitioner(3).run(r6_qudit_circuit, {})
Expand Down
1 change: 0 additions & 1 deletion tests/passes/partitioning/test_scan.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@


class TestScanPartitioner:

def test_run(self) -> None:
"""Test run with a linear topology."""
# 0 1 2 3 4 #########
Expand Down
1 change: 0 additions & 1 deletion tests/passes/processing/test_substitute.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@


class TestSubstitute:

def test_small_qubit(self) -> None:
utry = UnitaryMatrix.identity(4)
circuit = Circuit(2)
Expand Down
1 change: 0 additions & 1 deletion tests/passes/synthesis/test_leap.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@


class TestLeap:

def test_small_qubit(self) -> None:
utry = UnitaryMatrix.random(2)
circuit = Circuit.from_unitary(utry)
Expand Down
1 change: 0 additions & 1 deletion tests/passes/synthesis/test_qfast.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@


class TestQFAST:

def test_small_qubit(self) -> None:
utry = UnitaryMatrix.random(2)
circuit = Circuit.from_unitary(utry)
Expand Down
1 change: 0 additions & 1 deletion tests/passes/synthesis/test_qpredict.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@


class TestQPredict:

def test_small_qubit(self) -> None:
utry = UnitaryMatrix.random(2)
circuit = Circuit.from_unitary(utry)
Expand Down
Loading

0 comments on commit c710bd5

Please sign in to comment.