diff --git a/src/braket/circuits/circuit.py b/src/braket/circuits/circuit.py index ae52a1b3a..a55bc6dbb 100644 --- a/src/braket/circuits/circuit.py +++ b/src/braket/circuits/circuit.py @@ -47,7 +47,7 @@ def register_subroutine(cls, func: SubroutineCallable) -> None: >>> def h_on_all(target): ... circ = Circuit() ... for qubit in target: - ... circ += Instruction(Gate.H, qubit) + ... circ += Instruction(Gate.H(), qubit) ... return circ ... >>> Circuit.register_subroutine(h_on_all) @@ -81,7 +81,7 @@ def __init__(self, addable: AddableTypes = None, *args, **kwargs): TypeError: If `addable` is an unsupported type. Examples: - >>> circ = Circuit([Instruction(Gate.H, 4), Instruction(Gate.CNot, [4, 5])]) + >>> circ = Circuit([Instruction(Gate.H(), 4), Instruction(Gate.CNot(), [4, 5])]) >>> circ = Circuit().h(0).cnot(0, 1) >>> @circuit.subroutine(register=True) @@ -146,22 +146,22 @@ def add_instruction( TypeError: If both `target_mapping` and `target` are supplied. Examples: - >>> instr = Instruction(Gate.CNot, [0, 1]) + >>> instr = Instruction(Gate.CNot(), [0, 1]) >>> circ = Circuit().add_instruction(instr) >>> print(circ.instructions[0]) Instruction('operator': 'CNOT', 'target': QubitSet(Qubit(0), Qubit(1))) - >>> instr = Instruction(Gate.CNot, [0, 1]) + >>> instr = Instruction(Gate.CNot(), [0, 1]) >>> circ = Circuit().add_instruction(instr, target_mapping={0: 10, 1: 11}) >>> print(circ.instructions[0]) Instruction('operator': 'CNOT', 'target': QubitSet(Qubit(10), Qubit(11))) - >>> instr = Instruction(Gate.CNot, [0, 1]) + >>> instr = Instruction(Gate.CNot(), [0, 1]) >>> circ = Circuit().add_instruction(instr, target=[10, 11]) >>> print(circ.instructions[0]) Instruction('operator': 'CNOT', 'target': QubitSet(Qubit(10), Qubit(11))) - >>> instr = Instruction(Gate.H, 0) + >>> instr = Instruction(Gate.H(), 0) >>> circ = Circuit().add_instruction(instr, target=[10, 11]) >>> print(circ.instructions[0]) Instruction('operator': 'H', 'target': QubitSet(Qubit(10),)) @@ -280,7 +280,7 @@ def add(self, addable: AddableTypes, *args, **kwargs) -> "Circuit": `add_instruction()` Examples: - >>> circ = Circuit().add([Instruction(Gate.H, 4), Instruction(Gate.CNot, [4, 5])]) + >>> circ = Circuit().add([Instruction(Gate.H(), 4), Instruction(Gate.CNot(), [4, 5])]) >>> circ = Circuit().h(4).cnot([4, 5]) diff --git a/src/braket/circuits/moments.py b/src/braket/circuits/moments.py index c553b00fa..5e4da7797 100644 --- a/src/braket/circuits/moments.py +++ b/src/braket/circuits/moments.py @@ -53,8 +53,8 @@ class Moments(Mapping[MomentsKey, Instruction]): Examples: >>> moments = Moments() - >>> moments.add([Instruction(Gate.H, 0), Instruction(Gate.CNot, [0, 1])]) - >>> moments.add([Instruction(Gate.H, 0), Instruction(Gate.H, 1)]) + >>> moments.add([Instruction(Gate.H(), 0), Instruction(Gate.CNot(), [0, 1])]) + >>> moments.add([Instruction(Gate.H(), 0), Instruction(Gate.H(), 1)]) >>> for i, item in enumerate(moments.items()): ... print(f"Item {i}") ... print(f"\\tKey: {item[0]}")