Skip to content

Commit 2b9c762

Browse files
authored
Change GridDeviceMetadata gate duration property to Mapping type (#5656)
To make the property immutable. Left constructor arg as `Dict`. @MichaelBroughton cc @maffoo
1 parent b436c4b commit 2b9c762

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

cirq-core/cirq/devices/grid_device_metadata.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
# limitations under the License.
1414
"""Metadata subtype for 2D Homogenous devices."""
1515

16-
from typing import TYPE_CHECKING, cast, Optional, FrozenSet, Iterable, Tuple, Dict
16+
from typing import TYPE_CHECKING, cast, FrozenSet, Iterable, Mapping, Optional, Tuple
1717

1818
import networkx as nx
1919
from cirq import value
@@ -31,7 +31,7 @@ def __init__(
3131
self,
3232
qubit_pairs: Iterable[Tuple['cirq.GridQubit', 'cirq.GridQubit']],
3333
gateset: 'cirq.Gateset',
34-
gate_durations: Optional[Dict['cirq.GateFamily', 'cirq.Duration']] = None,
34+
gate_durations: Optional[Mapping['cirq.GateFamily', 'cirq.Duration']] = None,
3535
all_qubits: Optional[Iterable['cirq.GridQubit']] = None,
3636
compilation_target_gatesets: Iterable['cirq.CompilationTargetGateset'] = (),
3737
):
@@ -147,7 +147,7 @@ def compilation_target_gatesets(self) -> Tuple['cirq.CompilationTargetGateset',
147147
return self._compilation_target_gatesets
148148

149149
@property
150-
def gate_durations(self) -> Optional[Dict['cirq.GateFamily', 'cirq.Duration']]:
150+
def gate_durations(self) -> Optional[Mapping['cirq.GateFamily', 'cirq.Duration']]:
151151
"""Get a dictionary mapping from gate family to duration for gates.
152152
153153
To look up the duration of a specific gate instance / gate type / operation which is part of

0 commit comments

Comments
 (0)