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

Change GridDeviceMetadata gate duration property to Mapping type #5656

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions cirq-core/cirq/devices/grid_device_metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# limitations under the License.
"""Metadata subtype for 2D Homogenous devices."""

from typing import TYPE_CHECKING, cast, Optional, FrozenSet, Iterable, Tuple, Dict
from typing import TYPE_CHECKING, cast, FrozenSet, Iterable, Mapping, Optional, Tuple

import networkx as nx
from cirq import value
Expand All @@ -31,7 +31,7 @@ def __init__(
self,
qubit_pairs: Iterable[Tuple['cirq.GridQubit', 'cirq.GridQubit']],
gateset: 'cirq.Gateset',
gate_durations: Optional[Dict['cirq.GateFamily', 'cirq.Duration']] = None,
gate_durations: Optional[Mapping['cirq.GateFamily', 'cirq.Duration']] = None,
all_qubits: Optional[Iterable['cirq.GridQubit']] = None,
compilation_target_gatesets: Iterable['cirq.CompilationTargetGateset'] = (),
):
Expand Down Expand Up @@ -147,7 +147,7 @@ def compilation_target_gatesets(self) -> Tuple['cirq.CompilationTargetGateset',
return self._compilation_target_gatesets

@property
def gate_durations(self) -> Optional[Dict['cirq.GateFamily', 'cirq.Duration']]:
def gate_durations(self) -> Optional[Mapping['cirq.GateFamily', 'cirq.Duration']]:
"""Get a dictionary mapping from gate family to duration for gates.

To look up the duration of a specific gate instance / gate type / operation which is part of
Expand Down