libqasm 0.6.2__cp311-cp311-macosx_10_10_universal2.whl → 0.6.4__cp311-cp311-macosx_10_10_universal2.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- cqasm/v3x/ast.py +51 -44
- libQasm/_libQasm.cpython-311-darwin.so +0 -0
- {libqasm-0.6.2.dist-info → libqasm-0.6.4.dist-info}/METADATA +1 -1
- {libqasm-0.6.2.dist-info → libqasm-0.6.4.dist-info}/RECORD +7 -7
- {libqasm-0.6.2.dist-info → libqasm-0.6.4.dist-info}/LICENSE.md +0 -0
- {libqasm-0.6.2.dist-info → libqasm-0.6.4.dist-info}/WHEEL +0 -0
- {libqasm-0.6.2.dist-info → libqasm-0.6.4.dist-info}/top_level.txt +0 -0
cqasm/v3x/ast.py
CHANGED
@@ -5333,19 +5333,19 @@ class GlobalBlock(Block):
|
|
5333
5333
|
__slots__ = [
|
5334
5334
|
'_attr_qubit_variable_declaration',
|
5335
5335
|
'_attr_gates',
|
5336
|
-
'
|
5336
|
+
'_attr_measure_instructions',
|
5337
5337
|
]
|
5338
5338
|
|
5339
5339
|
def __init__(
|
5340
5340
|
self,
|
5341
5341
|
qubit_variable_declaration=None,
|
5342
5342
|
gates=None,
|
5343
|
-
|
5343
|
+
measure_instructions=None,
|
5344
5344
|
):
|
5345
5345
|
super().__init__()
|
5346
5346
|
self.qubit_variable_declaration = qubit_variable_declaration
|
5347
5347
|
self.gates = gates
|
5348
|
-
self.
|
5348
|
+
self.measure_instructions = measure_instructions
|
5349
5349
|
|
5350
5350
|
@property
|
5351
5351
|
def qubit_variable_declaration(self):
|
@@ -5388,24 +5388,24 @@ class GlobalBlock(Block):
|
|
5388
5388
|
self._attr_gates = MultiGate()
|
5389
5389
|
|
5390
5390
|
@property
|
5391
|
-
def
|
5392
|
-
return self.
|
5391
|
+
def measure_instructions(self):
|
5392
|
+
return self._attr_measure_instructions
|
5393
5393
|
|
5394
|
-
@
|
5395
|
-
def
|
5394
|
+
@measure_instructions.setter
|
5395
|
+
def measure_instructions(self, val):
|
5396
5396
|
if val is None:
|
5397
|
-
del self.
|
5397
|
+
del self.measure_instructions
|
5398
5398
|
return
|
5399
|
-
if not isinstance(val,
|
5399
|
+
if not isinstance(val, MultiMeasureInstruction):
|
5400
5400
|
# Try to "typecast" if this isn't an obvious mistake.
|
5401
5401
|
if isinstance(val, Node):
|
5402
|
-
raise TypeError('
|
5403
|
-
val =
|
5404
|
-
self.
|
5402
|
+
raise TypeError('measure_instructions must be of type MultiMeasureInstruction')
|
5403
|
+
val = MultiMeasureInstruction(val)
|
5404
|
+
self._attr_measure_instructions = val
|
5405
5405
|
|
5406
|
-
@
|
5407
|
-
def
|
5408
|
-
self.
|
5406
|
+
@measure_instructions.deleter
|
5407
|
+
def measure_instructions(self):
|
5408
|
+
self._attr_measure_instructions = MultiMeasureInstruction()
|
5409
5409
|
|
5410
5410
|
def __eq__(self, other):
|
5411
5411
|
"""Equality operator. Ignores annotations!"""
|
@@ -5415,7 +5415,7 @@ class GlobalBlock(Block):
|
|
5415
5415
|
return False
|
5416
5416
|
if self.gates != other.gates:
|
5417
5417
|
return False
|
5418
|
-
if self.
|
5418
|
+
if self.measure_instructions != other.measure_instructions:
|
5419
5419
|
return False
|
5420
5420
|
return True
|
5421
5421
|
|
@@ -5452,13 +5452,14 @@ class GlobalBlock(Block):
|
|
5452
5452
|
s.append(child.dump(indent + 1, annotations, links) + '\n')
|
5453
5453
|
s.append(' '*indent + ']\n')
|
5454
5454
|
s.append(' '*indent)
|
5455
|
-
s.append('
|
5456
|
-
if self.
|
5455
|
+
s.append('measure_instructions: ')
|
5456
|
+
if not self.measure_instructions:
|
5457
5457
|
s.append('-\n')
|
5458
5458
|
else:
|
5459
|
-
s.append('
|
5460
|
-
|
5461
|
-
|
5459
|
+
s.append('[\n')
|
5460
|
+
for child in self.measure_instructions:
|
5461
|
+
s.append(child.dump(indent + 1, annotations, links) + '\n')
|
5462
|
+
s.append(' '*indent + ']\n')
|
5462
5463
|
indent -= 1
|
5463
5464
|
s.append(' '*indent)
|
5464
5465
|
s.append(')')
|
@@ -5480,8 +5481,8 @@ class GlobalBlock(Block):
|
|
5480
5481
|
self._attr_qubit_variable_declaration.find_reachable(id_map)
|
5481
5482
|
for el in self._attr_gates:
|
5482
5483
|
el.find_reachable(id_map)
|
5483
|
-
|
5484
|
-
|
5484
|
+
for el in self._attr_measure_instructions:
|
5485
|
+
el.find_reachable(id_map)
|
5485
5486
|
return id_map
|
5486
5487
|
|
5487
5488
|
def check_complete(self, id_map=None):
|
@@ -5497,15 +5498,15 @@ class GlobalBlock(Block):
|
|
5497
5498
|
self._attr_qubit_variable_declaration.check_complete(id_map)
|
5498
5499
|
for child in self._attr_gates:
|
5499
5500
|
child.check_complete(id_map)
|
5500
|
-
|
5501
|
-
|
5501
|
+
for child in self._attr_measure_instructions:
|
5502
|
+
child.check_complete(id_map)
|
5502
5503
|
|
5503
5504
|
def copy(self):
|
5504
5505
|
"""Returns a shallow copy of this node."""
|
5505
5506
|
return GlobalBlock(
|
5506
5507
|
qubit_variable_declaration=self._attr_qubit_variable_declaration,
|
5507
5508
|
gates=self._attr_gates.copy(),
|
5508
|
-
|
5509
|
+
measure_instructions=self._attr_measure_instructions.copy()
|
5509
5510
|
)
|
5510
5511
|
|
5511
5512
|
def clone(self):
|
@@ -5517,7 +5518,7 @@ class GlobalBlock(Block):
|
|
5517
5518
|
return GlobalBlock(
|
5518
5519
|
qubit_variable_declaration=_cloned(self._attr_qubit_variable_declaration),
|
5519
5520
|
gates=_cloned(self._attr_gates),
|
5520
|
-
|
5521
|
+
measure_instructions=_cloned(self._attr_measure_instructions)
|
5521
5522
|
)
|
5522
5523
|
|
5523
5524
|
@staticmethod
|
@@ -5562,19 +5563,23 @@ class GlobalBlock(Block):
|
|
5562
5563
|
raise ValueError('unexpected edge type for Any/Many element')
|
5563
5564
|
f_gates.append(Gate._deserialize(element, seq_to_ob, links))
|
5564
5565
|
|
5565
|
-
# Deserialize the
|
5566
|
-
field = cbor.get('
|
5566
|
+
# Deserialize the measure_instructions field.
|
5567
|
+
field = cbor.get('measure_instructions', None)
|
5567
5568
|
if not isinstance(field, dict):
|
5568
|
-
raise ValueError('missing or invalid serialization of field
|
5569
|
-
if field.get('@T') != '
|
5570
|
-
raise ValueError('unexpected edge type for field
|
5571
|
-
|
5572
|
-
|
5573
|
-
|
5574
|
-
|
5569
|
+
raise ValueError('missing or invalid serialization of field measure_instructions')
|
5570
|
+
if field.get('@T') != '*':
|
5571
|
+
raise ValueError('unexpected edge type for field measure_instructions')
|
5572
|
+
data = field.get('@d', None)
|
5573
|
+
if not isinstance(data, list):
|
5574
|
+
raise ValueError('missing serialization of Any/Many contents')
|
5575
|
+
f_measure_instructions = MultiMeasureInstruction()
|
5576
|
+
for element in data:
|
5577
|
+
if element.get('@T') != '1':
|
5578
|
+
raise ValueError('unexpected edge type for Any/Many element')
|
5579
|
+
f_measure_instructions.append(MeasureInstruction._deserialize(element, seq_to_ob, links))
|
5575
5580
|
|
5576
5581
|
# Construct the GlobalBlock node.
|
5577
|
-
node = GlobalBlock(f_qubit_variable_declaration, f_gates,
|
5582
|
+
node = GlobalBlock(f_qubit_variable_declaration, f_gates, f_measure_instructions)
|
5578
5583
|
|
5579
5584
|
# Deserialize annotations.
|
5580
5585
|
for key, val in cbor.items():
|
@@ -5618,13 +5623,15 @@ class GlobalBlock(Block):
|
|
5618
5623
|
field['@d'] = lst
|
5619
5624
|
cbor['gates'] = field
|
5620
5625
|
|
5621
|
-
# Serialize the
|
5622
|
-
field = {'@T': '
|
5623
|
-
|
5624
|
-
|
5625
|
-
|
5626
|
-
|
5627
|
-
|
5626
|
+
# Serialize the measure_instructions field.
|
5627
|
+
field = {'@T': '*'}
|
5628
|
+
lst = []
|
5629
|
+
for el in self._attr_measure_instructions:
|
5630
|
+
el = el._serialize(id_map)
|
5631
|
+
el['@T'] = '1'
|
5632
|
+
lst.append(el)
|
5633
|
+
field['@d'] = lst
|
5634
|
+
cbor['measure_instructions'] = field
|
5628
5635
|
|
5629
5636
|
# Serialize annotations.
|
5630
5637
|
for key, val in self._annot.items():
|
Binary file
|
@@ -1,16 +1,16 @@
|
|
1
1
|
cqasm/__init__.py,sha256=MsSFjiLMLJZ7QhUPpVBWKiyDnCzryquRyr329NoCACI,2
|
2
2
|
cqasm/v3x/__init__.py,sha256=vZyVREhVeJdxipgSMSHGhKfyg70x1ISKn1v2bFO2734,2785
|
3
|
-
cqasm/v3x/ast.py,sha256=
|
3
|
+
cqasm/v3x/ast.py,sha256=JyrkdyfyHaxWWzyxlTcYLF1w88D-fjs4Jqqkz3_cUws,412518
|
4
4
|
cqasm/v3x/instruction.py,sha256=AEOwKV2riafpyTiJvgq7azwOhyhhZfpKV12uWWJ5M2A,1177
|
5
5
|
cqasm/v3x/primitives.py,sha256=ESCsMHP1GeuKh2gHQSP0ha24Abp453U-I7JSGK9dZas,1664
|
6
6
|
cqasm/v3x/semantic.py,sha256=8zWB24LKxPymLW4lPgxmURGol2LXh7mqBKtZWo1GNKs,86535
|
7
7
|
cqasm/v3x/types.py,sha256=NBp3uh23nnGNzKHtOrJBafDJ2wKqhQJ5eJSJtsr0uMk,51593
|
8
8
|
cqasm/v3x/values.py,sha256=YY_41YQ7iU2te7FqtstGnQJd4W3CFH7LmkawSKh5e_A,61680
|
9
9
|
libQasm/__init__.py,sha256=qxoyhS4wo8oA5cwO4IIbrLuCHztOJAT2MrpCOR2mSF4,727
|
10
|
-
libQasm/_libQasm.cpython-311-darwin.so,sha256
|
10
|
+
libQasm/_libQasm.cpython-311-darwin.so,sha256=Uo6zahuNiykGZ1gYxvL5vUGTro-sVDdtpMSAScoLrCs,4145208
|
11
11
|
libQasm/libQasm.py,sha256=hzX-iSOvyoM2FBHbKvvol76Mt1lS2F3FweDm37Y-3RM,30595
|
12
|
-
libqasm-0.6.
|
13
|
-
libqasm-0.6.
|
14
|
-
libqasm-0.6.
|
15
|
-
libqasm-0.6.
|
16
|
-
libqasm-0.6.
|
12
|
+
libqasm-0.6.4.dist-info/LICENSE.md,sha256=duRlJgy46W8Cw_IQjOmud5xJUvgJkX6pkBmBJkoKi4I,566
|
13
|
+
libqasm-0.6.4.dist-info/METADATA,sha256=5hEL-YRZMbnEQBGjXqwEqjllwy2LvEQjwTvNzVHyxX4,5913
|
14
|
+
libqasm-0.6.4.dist-info/WHEEL,sha256=4F58ZCesPOUjwzTHMKuwuydHHOQLmBKJtTM5AtvBHqQ,116
|
15
|
+
libqasm-0.6.4.dist-info/top_level.txt,sha256=w7QwYbOjqjU8FE8PSUGSKMILn4kqQEJWKNLvab5ehEg,14
|
16
|
+
libqasm-0.6.4.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|