11
11
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
12
# See the License for the specific language governing permissions and
13
13
# limitations under the License.
14
+
14
15
"""Metadata subtype for 2D Homogenous devices."""
15
16
17
+ from __future__ import annotations
18
+
16
19
from typing import cast , FrozenSet , Iterable , Mapping , Optional , Tuple , TYPE_CHECKING
17
20
18
21
import networkx as nx
@@ -30,11 +33,11 @@ class GridDeviceMetadata(device.DeviceMetadata):
30
33
31
34
def __init__ (
32
35
self ,
33
- qubit_pairs : Iterable [Tuple [' cirq.GridQubit' , ' cirq.GridQubit' ]],
34
- gateset : ' cirq.Gateset' ,
35
- gate_durations : Optional [Mapping [' cirq.GateFamily' , ' cirq.Duration' ]] = None ,
36
- all_qubits : Optional [Iterable [' cirq.GridQubit' ]] = None ,
37
- compilation_target_gatesets : Iterable [' cirq.CompilationTargetGateset' ] = (),
36
+ qubit_pairs : Iterable [Tuple [cirq .GridQubit , cirq .GridQubit ]],
37
+ gateset : cirq .Gateset ,
38
+ gate_durations : Optional [Mapping [cirq .GateFamily , cirq .Duration ]] = None ,
39
+ all_qubits : Optional [Iterable [cirq .GridQubit ]] = None ,
40
+ compilation_target_gatesets : Iterable [cirq .CompilationTargetGateset ] = (),
38
41
):
39
42
"""Create a GridDeviceMetadata object.
40
43
@@ -115,7 +118,7 @@ def __init__(
115
118
self ._gate_durations = gate_durations
116
119
117
120
@property
118
- def qubit_set (self ) -> FrozenSet [' cirq.GridQubit' ]:
121
+ def qubit_set (self ) -> FrozenSet [cirq .GridQubit ]:
119
122
"""Returns the set of grid qubits on the device.
120
123
121
124
Returns:
@@ -124,7 +127,7 @@ def qubit_set(self) -> FrozenSet['cirq.GridQubit']:
124
127
return cast (FrozenSet ['cirq.GridQubit' ], super ().qubit_set )
125
128
126
129
@property
127
- def qubit_pairs (self ) -> FrozenSet [FrozenSet [' cirq.GridQubit' ]]:
130
+ def qubit_pairs (self ) -> FrozenSet [FrozenSet [cirq .GridQubit ]]:
128
131
"""Returns the set of all couple-able qubits on the device.
129
132
130
133
Each element in the outer frozenset is a 2-element frozenset representing a bidirectional
@@ -133,22 +136,22 @@ def qubit_pairs(self) -> FrozenSet[FrozenSet['cirq.GridQubit']]:
133
136
return self ._qubit_pairs
134
137
135
138
@property
136
- def isolated_qubits (self ) -> FrozenSet [' cirq.GridQubit' ]:
139
+ def isolated_qubits (self ) -> FrozenSet [cirq .GridQubit ]:
137
140
"""Returns the set of all isolated qubits on the device (if applicable)."""
138
141
return self ._isolated_qubits
139
142
140
143
@property
141
- def gateset (self ) -> ' cirq.Gateset' :
144
+ def gateset (self ) -> cirq .Gateset :
142
145
"""Returns the `cirq.Gateset` of supported gates on this device."""
143
146
return self ._gateset
144
147
145
148
@property
146
- def compilation_target_gatesets (self ) -> Tuple [' cirq.CompilationTargetGateset' , ...]:
149
+ def compilation_target_gatesets (self ) -> Tuple [cirq .CompilationTargetGateset , ...]:
147
150
"""Returns a sequence of valid `cirq.CompilationTargetGateset`s for this device."""
148
151
return self ._compilation_target_gatesets
149
152
150
153
@property
151
- def gate_durations (self ) -> Optional [Mapping [' cirq.GateFamily' , ' cirq.Duration' ]]:
154
+ def gate_durations (self ) -> Optional [Mapping [cirq .GateFamily , cirq .Duration ]]:
152
155
"""Get a dictionary mapping from gate family to duration for gates.
153
156
154
157
To look up the duration of a specific gate instance / gate type / operation which is part of
0 commit comments