Skip to content

Commit 9cb81ad

Browse files
authored
Switch to unquoted type annotations part 1 (#7193)
* Switch to unquoted type annotations files part 1/5 * Switch to unquoted type annotations files part 2/5 * Switch to unquoted type annotations files part 3/5 * Switch to unquoted type annotations files part 4/5 * Switch to unquoted type annotations files part 5/5 * Correct typing-only-first-party-import Executed ruff check --target-version=py310 --select=TC001
1 parent 56c13ab commit 9cb81ad

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+640
-597
lines changed

cirq-aqt/cirq_aqt/aqt_device.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -249,9 +249,9 @@ class AQTDevice(cirq.Device):
249249

250250
def __init__(
251251
self,
252-
measurement_duration: 'cirq.DURATION_LIKE',
253-
twoq_gates_duration: 'cirq.DURATION_LIKE',
254-
oneq_gates_duration: 'cirq.DURATION_LIKE',
252+
measurement_duration: cirq.DURATION_LIKE,
253+
twoq_gates_duration: cirq.DURATION_LIKE,
254+
oneq_gates_duration: cirq.DURATION_LIKE,
255255
qubits: Iterable[cirq.LineQubit],
256256
) -> None:
257257
"""Initializes the description of an ion trap device.

cirq-aqt/cirq_aqt/aqt_device_metadata.py

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
1615
"""DeviceMetadata for ion trap device with mutually linked qubits placed on a line."""
1716

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

2928
def __init__(
3029
self,
31-
qubits: Iterable['cirq.LineQubit'],
32-
measurement_duration: 'cirq.DURATION_LIKE',
33-
twoq_gates_duration: 'cirq.DURATION_LIKE',
34-
oneq_gates_duration: 'cirq.DURATION_LIKE',
30+
qubits: Iterable[cirq.LineQubit],
31+
measurement_duration: cirq.DURATION_LIKE,
32+
twoq_gates_duration: cirq.DURATION_LIKE,
33+
oneq_gates_duration: cirq.DURATION_LIKE,
3534
):
3635
"""Create metadata object for AQTDevice.
3736
@@ -60,34 +59,34 @@ def __init__(
6059
)
6160

6261
@property
63-
def gateset(self) -> 'cirq.Gateset':
62+
def gateset(self) -> cirq.Gateset:
6463
"""Returns the `cirq.Gateset` of supported gates on this device."""
6564
return self._gateset
6665

6766
@property
68-
def gate_durations(self) -> Mapping['cirq.GateFamily', 'cirq.Duration']:
67+
def gate_durations(self) -> Mapping[cirq.GateFamily, cirq.Duration]:
6968
"""Get a dictionary of supported gate families and their gate operation durations.
7069
7170
Use `duration_of` to obtain duration of a specific `cirq.GateOperation` instance.
7271
"""
7372
return self._gate_durations
7473

7574
@property
76-
def measurement_duration(self) -> 'cirq.DURATION_LIKE':
75+
def measurement_duration(self) -> cirq.DURATION_LIKE:
7776
"""Return the maximum duration of the measurement operation."""
7877
return self._measurement_duration
7978

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

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

90-
def duration_of(self, operation: 'cirq.Operation') -> 'cirq.DURATION_LIKE':
89+
def duration_of(self, operation: cirq.Operation) -> cirq.DURATION_LIKE:
9190
"""Return the maximum duration of the specified gate operation.
9291
9392
Args:

cirq-aqt/cirq_aqt/aqt_target_gateset.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ def __init__(self):
4242
unroll_circuit_op=False,
4343
)
4444

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

60-
def _decompose_two_qubit_operation(self, op: 'cirq.Operation', _) -> DecomposeResult:
60+
def _decompose_two_qubit_operation(self, op: cirq.Operation, _) -> DecomposeResult:
6161
if cirq.has_unitary(op):
6262
return cirq.two_qubit_matrix_to_ion_operations(
6363
op.qubits[0], op.qubits[1], cirq.unitary(op)
6464
)
6565
return NotImplemented
6666

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

0 commit comments

Comments
 (0)