Skip to content

Commit 8767124

Browse files
authored
Add stimcirq tag conversions (#866)
- Add `tag: str = ""` to `stim.Circuit.append` - Stim tags now become string tags on cirq circuit operations - A string tag on a cirq operation will turn into a stim tag by default if there is exactly one such string tag - Add optional `tag_func` argument to `stimcirq.cirq_circuit_to_stim_circuit` Some inspiration from #862
1 parent d70b206 commit 8767124

18 files changed

+307
-111
lines changed

doc/python_api_reference_vDev.md

+5
Original file line numberDiff line numberDiff line change
@@ -831,6 +831,8 @@ def append(
831831
name: str,
832832
targets: Union[int, stim.GateTarget, Iterable[Union[int, stim.GateTarget]]],
833833
arg: Union[float, Iterable[float]],
834+
*,
835+
tag: str = "",
834836
) -> None:
835837
pass
836838
@overload
@@ -844,6 +846,8 @@ def append(
844846
name: object,
845847
targets: object = (),
846848
arg: object = None,
849+
*,
850+
tag: str = '',
847851
) -> None:
848852
"""Appends an operation into the circuit.
849853
@@ -894,6 +898,7 @@ def append(
894898
compatibility reasons, `cirq.append_operation` (but not
895899
`cirq.append`) will default to a single 0.0 argument for gates that
896900
take exactly one argument.
901+
tag: A customizable string attached to the instruction.
897902
"""
898903
```
899904

doc/stim.pyi

+7
Original file line numberDiff line numberDiff line change
@@ -303,6 +303,8 @@ class Circuit:
303303
name: str,
304304
targets: Union[int, stim.GateTarget, Iterable[Union[int, stim.GateTarget]]],
305305
arg: Union[float, Iterable[float]],
306+
*,
307+
tag: str = "",
306308
) -> None:
307309
pass
308310
@overload
@@ -316,6 +318,8 @@ class Circuit:
316318
name: object,
317319
targets: object = (),
318320
arg: object = None,
321+
*,
322+
tag: str = '',
319323
) -> None:
320324
"""Appends an operation into the circuit.
321325
@@ -366,6 +370,7 @@ class Circuit:
366370
compatibility reasons, `cirq.append_operation` (but not
367371
`cirq.append`) will default to a single 0.0 argument for gates that
368372
take exactly one argument.
373+
tag: A customizable string attached to the instruction.
369374
"""
370375
def append_from_stim_program_text(
371376
self,
@@ -398,6 +403,8 @@ class Circuit:
398403
name: object,
399404
targets: object = (),
400405
arg: object = None,
406+
*,
407+
tag: str = '',
401408
) -> None:
402409
"""[DEPRECATED] use stim.Circuit.append instead
403410
"""

0 commit comments

Comments
 (0)