1212# See the License for the specific language governing permissions and
1313# limitations under the License.
1414
15+ """Transformers that symbolizes operations."""
16+
1517import re
1618from typing import Hashable , Optional , TYPE_CHECKING
1719
@@ -37,21 +39,22 @@ def symbolize_single_qubit_gates_by_indexed_tags(
3739 context : Optional ['cirq.TransformerContext' ] = None ,
3840 symbolize_tag : SymbolizeTag = SymbolizeTag (prefix = "TO-PHXZ" ),
3941) -> 'cirq.Circuit' :
40- """Symbolizes single qubit operations by indexed tags prefixed by tag_prefix .
42+ """Symbolizes single qubit operations by indexed tags prefixed by symbolize_tag.prefix .
4143
4244 Example:
45+ >>> from cirq import transformers
4346 >>> q0, q1 = cirq.LineQubit.range(2)
44- >>> c = cirq.Circuit(\
45- cirq.X(q0).with_tags("phxz_0"),\
46- cirq.CZ(q0,q1),\
47- cirq.Y(q0).with_tags("phxz_1"),\
48- cirq.X(q0))
47+ >>> c = cirq.Circuit(
48+ ... cirq.X(q0).with_tags("phxz_0"),
49+ ... cirq.CZ(q0,q1),
50+ ... cirq.Y(q0).with_tags("phxz_1"),
51+ ... cirq.X(q0))
4952 >>> print(c)
5053 0: ───X[phxz_0]───@───Y[phxz_1]───X───
5154 │
5255 1: ───────────────@───────────────────
53- >>> new_circuit = cirq.symbolize_single_qubit_gates_by_indexed_tags(\
54- c, symbolize_tag=cirq. transformers.symbolize .SymbolizeTag(prefix="phxz"))
56+ >>> new_circuit = cirq.symbolize_single_qubit_gates_by_indexed_tags(
57+ ... c, symbolize_tag=transformers.SymbolizeTag(prefix="phxz"))
5558 >>> print(new_circuit)
5659 0: ───PhXZ(a=a0,x=x0,z=z0)───@───PhXZ(a=a1,x=x1,z=z1)───X───
5760 │
0 commit comments