Skip to content

Commit 5062c78

Browse files
Reducing some code by cleaning up some logic (quantumlib#6003)
* reducing some indenting and amount of reading by changing some logic around in circuit.py * reverting change per code review --------- Co-authored-by: Adam Zalcman <[email protected]>
1 parent c118c51 commit 5062c78

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

Diff for: cirq/circuits/circuit.py

+3-5
Original file line numberDiff line numberDiff line change
@@ -1861,9 +1861,8 @@ def __setitem__(self, key: slice, value: Iterable['cirq.Moment']):
18611861
pass
18621862

18631863
def __setitem__(self, key, value):
1864-
if isinstance(key, int):
1865-
if not isinstance(value, Moment):
1866-
raise TypeError('Can only assign Moments into Circuits.')
1864+
if isinstance(key, int) and not isinstance(value, Moment):
1865+
raise TypeError('Can only assign Moments into Circuits.')
18671866

18681867
if isinstance(key, slice):
18691868
value = list(value)
@@ -2595,8 +2594,7 @@ def _get_global_phase_and_tags_for_op(op: 'cirq.Operation') -> Tuple[Optional[co
25952594
elif isinstance(op.untagged, CircuitOperation):
25962595
op_phase, op_tags = _get_global_phase_and_tags_for_ops(op.untagged.circuit.all_operations())
25972596
return op_phase, list(op.tags) + op_tags
2598-
else:
2599-
return None, []
2597+
return None, []
26002598

26012599

26022600
def _get_global_phase_and_tags_for_ops(op_list: Any) -> Tuple[Optional[complex], List[Any]]:

0 commit comments

Comments
 (0)