Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch to unquoted type annotations part 1 #7193

Merged
merged 8 commits into from
Apr 4, 2025
6 changes: 3 additions & 3 deletions cirq-aqt/cirq_aqt/aqt_device.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,9 +249,9 @@ class AQTDevice(cirq.Device):

def __init__(
self,
measurement_duration: 'cirq.DURATION_LIKE',
twoq_gates_duration: 'cirq.DURATION_LIKE',
oneq_gates_duration: 'cirq.DURATION_LIKE',
measurement_duration: cirq.DURATION_LIKE,
twoq_gates_duration: cirq.DURATION_LIKE,
oneq_gates_duration: cirq.DURATION_LIKE,
qubits: Iterable[cirq.LineQubit],
) -> None:
"""Initializes the description of an ion trap device.
Expand Down
21 changes: 10 additions & 11 deletions cirq-aqt/cirq_aqt/aqt_device_metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.


"""DeviceMetadata for ion trap device with mutually linked qubits placed on a line."""

from typing import Any, Iterable, Mapping
Expand All @@ -28,10 +27,10 @@ class AQTDeviceMetadata(cirq.DeviceMetadata):

def __init__(
self,
qubits: Iterable['cirq.LineQubit'],
measurement_duration: 'cirq.DURATION_LIKE',
twoq_gates_duration: 'cirq.DURATION_LIKE',
oneq_gates_duration: 'cirq.DURATION_LIKE',
qubits: Iterable[cirq.LineQubit],
measurement_duration: cirq.DURATION_LIKE,
twoq_gates_duration: cirq.DURATION_LIKE,
oneq_gates_duration: cirq.DURATION_LIKE,
):
"""Create metadata object for AQTDevice.

Expand Down Expand Up @@ -60,34 +59,34 @@ def __init__(
)

@property
def gateset(self) -> 'cirq.Gateset':
def gateset(self) -> cirq.Gateset:
"""Returns the `cirq.Gateset` of supported gates on this device."""
return self._gateset

@property
def gate_durations(self) -> Mapping['cirq.GateFamily', 'cirq.Duration']:
def gate_durations(self) -> Mapping[cirq.GateFamily, cirq.Duration]:
"""Get a dictionary of supported gate families and their gate operation durations.

Use `duration_of` to obtain duration of a specific `cirq.GateOperation` instance.
"""
return self._gate_durations

@property
def measurement_duration(self) -> 'cirq.DURATION_LIKE':
def measurement_duration(self) -> cirq.DURATION_LIKE:
"""Return the maximum duration of the measurement operation."""
return self._measurement_duration

@property
def oneq_gates_duration(self) -> 'cirq.DURATION_LIKE':
def oneq_gates_duration(self) -> cirq.DURATION_LIKE:
"""Return the maximum duration of an operation on one-qubit gates."""
return self._oneq_gates_duration

@property
def twoq_gates_duration(self) -> 'cirq.DURATION_LIKE':
def twoq_gates_duration(self) -> cirq.DURATION_LIKE:
"""Return the maximum duration of an operation on two-qubit gates."""
return self._twoq_gates_duration

def duration_of(self, operation: 'cirq.Operation') -> 'cirq.DURATION_LIKE':
def duration_of(self, operation: cirq.Operation) -> cirq.DURATION_LIKE:
"""Return the maximum duration of the specified gate operation.

Args:
Expand Down
6 changes: 3 additions & 3 deletions cirq-aqt/cirq_aqt/aqt_target_gateset.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def __init__(self):
unroll_circuit_op=False,
)

def _decompose_single_qubit_operation(self, op: 'cirq.Operation', _: int) -> DecomposeResult:
def _decompose_single_qubit_operation(self, op: cirq.Operation, _: int) -> DecomposeResult:
# unwrap tagged and circuit operations to get the actual operation
opu = op.untagged
opu = (
Expand All @@ -57,14 +57,14 @@ def _decompose_single_qubit_operation(self, op: 'cirq.Operation', _: int) -> Dec
return [g.on(opu.qubits[0]) for g in gates]
return NotImplemented

def _decompose_two_qubit_operation(self, op: 'cirq.Operation', _) -> DecomposeResult:
def _decompose_two_qubit_operation(self, op: cirq.Operation, _) -> DecomposeResult:
if cirq.has_unitary(op):
return cirq.two_qubit_matrix_to_ion_operations(
op.qubits[0], op.qubits[1], cirq.unitary(op)
)
return NotImplemented

@property
def postprocess_transformers(self) -> List['cirq.TRANSFORMER']:
def postprocess_transformers(self) -> List[cirq.TRANSFORMER]:
"""List of transformers which should be run after decomposing individual operations."""
return [cirq.drop_negligible_operations, cirq.drop_empty_moments]
Loading
Loading