@@ -55,16 +55,16 @@ def default_repetition_ids(repetitions: IntParam) -> Optional[List[str]]:
55
55
return None
56
56
57
57
58
- def _full_join_string_lists (list1 : Optional [List [str ]], list2 : Optional [List [str ]]):
58
+ def _full_join_string_lists (
59
+ list1 : Optional [List [str ]], list2 : Optional [List [str ]]
60
+ ) -> Optional [List [str ]]:
59
61
if list1 is None and list2 is None :
60
62
return None # coverage: ignore
61
63
if list1 is None :
62
64
return list2 # coverage: ignore
63
65
if list2 is None :
64
66
return list1
65
- return [
66
- f'{ REPETITION_ID_SEPARATOR .join ([first , second ])} ' for first in list1 for second in list2
67
- ]
67
+ return [f'{ first } { REPETITION_ID_SEPARATOR } { second } ' for first in list1 for second in list2 ]
68
68
69
69
70
70
@dataclasses .dataclass (frozen = True )
@@ -224,7 +224,7 @@ def qubits(self) -> Tuple['cirq.Qid', ...]:
224
224
return tuple (self .qubit_map .get (q , q ) for q in ordered_qubits )
225
225
226
226
def _default_repetition_ids (self ) -> Optional [List [str ]]:
227
- return default_repetition_ids (self .repetitions )
227
+ return default_repetition_ids (self .repetitions ) if self . use_repetition_ids else None
228
228
229
229
def _qid_shape_ (self ) -> Tuple [int , ...]:
230
230
return tuple (q .dimension for q in self .qubits )
@@ -524,7 +524,8 @@ def repeat(
524
524
expected_repetition_id_length = abs (repetitions )
525
525
526
526
if repetition_ids is None :
527
- repetition_ids = default_repetition_ids (expected_repetition_id_length )
527
+ if self .use_repetition_ids :
528
+ repetition_ids = default_repetition_ids (expected_repetition_id_length )
528
529
elif len (repetition_ids ) != expected_repetition_id_length :
529
530
raise ValueError (
530
531
f'Expected repetition_ids={ repetition_ids } length to be '
0 commit comments