From d390ac0d5f7cbb51355f5c23eb792259f91d1bfb Mon Sep 17 00:00:00 2001 From: Michael Broughton Date: Mon, 13 Jun 2022 15:30:22 -0700 Subject: [PATCH 1/2] [API docs] Fix Moment API docs. --- cirq-core/cirq/circuits/moment.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/cirq-core/cirq/circuits/moment.py b/cirq-core/cirq/circuits/moment.py index e4084d51f99..fbe50795080 100644 --- a/cirq-core/cirq/circuits/moment.py +++ b/cirq-core/cirq/circuits/moment.py @@ -357,7 +357,18 @@ def transform_qubits( return self.__class__(op.transform_qubits(qubit_map) for op in self.operations) def expand_to(self, qubits: Iterable['cirq.Qid']) -> 'cirq.Moment': - """Returns self expanded to given superset of qubits by making identities explicit.""" + """Returns self expanded to given superset of qubits by making identities explicit. + + Args: + qubits: Iterable of `cirq.Qid`s to expand this moment to. + + Returns: + A new `cirq.Moment` with identity operations on the new qubits + not currently found in the moment. + + Raises: + ValueError: if `qubits` is not a subset of this moments qubits. + """ if not self.qubits.issubset(qubits): raise ValueError(f'{qubits} is not a superset of {self.qubits}') From 5eecb4cb95f5dca30cff3b073ee23852e1d472c6 Mon Sep 17 00:00:00 2001 From: Michael Broughton Date: Mon, 13 Jun 2022 15:49:14 -0700 Subject: [PATCH 2/2] Adam feedback. --- cirq-core/cirq/circuits/moment.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cirq-core/cirq/circuits/moment.py b/cirq-core/cirq/circuits/moment.py index fbe50795080..f2179a7c635 100644 --- a/cirq-core/cirq/circuits/moment.py +++ b/cirq-core/cirq/circuits/moment.py @@ -367,7 +367,7 @@ def expand_to(self, qubits: Iterable['cirq.Qid']) -> 'cirq.Moment': not currently found in the moment. Raises: - ValueError: if `qubits` is not a subset of this moments qubits. + ValueError: if this moments' qubits are not a subset of `qubits`. """ if not self.qubits.issubset(qubits): raise ValueError(f'{qubits} is not a superset of {self.qubits}')