cirq-core 1.5.0.dev20250102031424__py3-none-any.whl → 1.5.0.dev20250102034819__py3-none-any.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.

Potentially problematic release.


This version of cirq-core might be problematic. Click here for more details.

cirq/_version.py CHANGED
@@ -28,4 +28,4 @@ if sys.version_info < (3, 10, 0): # pragma: no cover
28
28
  'of cirq (e.g. "python -m pip install cirq==1.1.*")'
29
29
  )
30
30
 
31
- __version__ = "1.5.0.dev20250102031424"
31
+ __version__ = "1.5.0.dev20250102034819"
cirq/_version_test.py CHANGED
@@ -3,4 +3,4 @@ import cirq
3
3
 
4
4
 
5
5
  def test_version():
6
- assert cirq.__version__ == "1.5.0.dev20250102031424"
6
+ assert cirq.__version__ == "1.5.0.dev20250102034819"
@@ -189,6 +189,8 @@ class PauliStringPhasor(gate_operation.GateOperation):
189
189
  self, args: 'cirq.CircuitDiagramInfoArgs'
190
190
  ) -> 'cirq.CircuitDiagramInfo':
191
191
  qubits = self.qubits if args.known_qubits is None else args.known_qubits
192
+ if not qubits:
193
+ return NotImplemented
192
194
 
193
195
  def sym(qubit):
194
196
  if qubit in self.pauli_string:
@@ -422,6 +422,13 @@ q2: ────────────────────[Z]───[X]^
422
422
  )
423
423
 
424
424
 
425
+ def test_empty_phasor_diagram():
426
+ q = cirq.LineQubit(0)
427
+ op = cirq.PauliSumExponential(cirq.I(q))
428
+ circuit = cirq.Circuit(op)
429
+ cirq.testing.assert_has_diagram(circuit, ' (I)**-0.6366197723675815')
430
+
431
+
425
432
  def test_repr():
426
433
  q0, q1, q2 = _make_qubits(3)
427
434
  cirq.testing.assert_equivalent_repr(
cirq/protocols/qasm.py CHANGED
@@ -151,7 +151,7 @@ def qasm(
151
151
  involving qubits that the operation wouldn't otherwise know about.
152
152
  qubits: A list of qubits that the value is being applied to. This is
153
153
  needed for `cirq.Gate` values, which otherwise wouldn't know what
154
- qubits to talk about.
154
+ qubits to talk about. It should generally not be specified otherwise.
155
155
  default: A default result to use if the value doesn't have a
156
156
  `_qasm_` method or that method returns `NotImplemented` or `None`.
157
157
  If not specified, non-decomposable values cause a `TypeError`.
@@ -172,10 +172,16 @@ def qasm(
172
172
  kwargs: Dict[str, Any] = {}
173
173
  if args is not None:
174
174
  kwargs['args'] = args
175
+ # pylint: disable=not-callable
175
176
  if qubits is not None:
176
177
  kwargs['qubits'] = tuple(qubits)
177
- # pylint: disable=not-callable
178
- result = method(**kwargs)
178
+ try:
179
+ result = method(**kwargs)
180
+ except TypeError as error:
181
+ raise TypeError(
182
+ "cirq.qasm does not expect qubits or args to be specified"
183
+ f"for the given value of type {type(val)}."
184
+ ) from error
179
185
  # pylint: enable=not-callable
180
186
  if result is not None and result is not NotImplemented:
181
187
  return result
@@ -54,6 +54,11 @@ def test_qasm():
54
54
  assert cirq.qasm(ExpectsArgsQubits(), args=cirq.QasmArgs(), qubits=()) == 'text'
55
55
 
56
56
 
57
+ def test_qasm_qubits_improperly_supplied():
58
+ with pytest.raises(TypeError, match="does not expect qubits or args to be specified"):
59
+ _ = cirq.qasm(cirq.Circuit(), qubits=[cirq.LineQubit(1)])
60
+
61
+
57
62
  def test_qasm_args_formatting():
58
63
  args = cirq.QasmArgs()
59
64
  assert args.format_field(0.01, '') == '0.01'
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: cirq-core
3
- Version: 1.5.0.dev20250102031424
3
+ Version: 1.5.0.dev20250102034819
4
4
  Summary: A framework for creating, editing, and invoking Noisy Intermediate Scale Quantum (NISQ) circuits.
5
5
  Home-page: http://github.com/quantumlib/cirq
6
6
  Author: The Cirq Developers
@@ -4,8 +4,8 @@ cirq/_compat_test.py,sha256=Qq3ZcfgD-Nb81cEppQdJqhAyrVqXKtfXZYGXT0p-Wh0,34718
4
4
  cirq/_doc.py,sha256=yDyWUD_2JDS0gShfGRb-rdqRt9-WeL7DhkqX7np0Nko,2879
5
5
  cirq/_import.py,sha256=p9gMHJscbtDDkfHOaulvd3Aer0pwUF5AXpL89XR8dNw,8402
6
6
  cirq/_import_test.py,sha256=6K_v0riZJXOXUphHNkGA8MY-JcmGlezFaGmvrNhm3OQ,1015
7
- cirq/_version.py,sha256=5pWmfxDp4iN4kw_7jAavnRAesEFgnkeMTB0U1IHsxbk,1206
8
- cirq/_version_test.py,sha256=1k0ZzJtAwKVheUlL8kw8ZHX8K5lp2F0KiQYxV533MSs,147
7
+ cirq/_version.py,sha256=kgvm5CodZqsqYoGH8-YpjCppJL-VTOmrGh6RnHNnq9c,1206
8
+ cirq/_version_test.py,sha256=YvMi76rsQapkszyzZ3F4dbiYTcAmostPi5RSQY2TjOI,147
9
9
  cirq/conftest.py,sha256=X7yLFL8GLhg2CjPw0hp5e_dGASfvHx1-QT03aUbhKJw,1168
10
10
  cirq/json_resolver_cache.py,sha256=03MVo6Y-UYrzt9CKHmwpiBLN2ixL6uSU-OWnKZXfG7k,13302
11
11
  cirq/py.typed,sha256=VFSlmh_lNwnaXzwY-ZuW-C2Ws5PkuDoVgBdNCs0jXJE,63
@@ -333,8 +333,8 @@ cirq/ops/pauli_interaction_gate_test.py,sha256=U9ORW5Ayx5PESPFiGESzWY-02qHklYcM1
333
333
  cirq/ops/pauli_measurement_gate.py,sha256=AS9tzLGAOhJzRzVsW9m-WPz5Wx0sMS1jzhppn5qtW84,7239
334
334
  cirq/ops/pauli_measurement_gate_test.py,sha256=uh3J0Ps3V3578V8qkRiEgIl6jBiv8DsXlk_vzLvOEhQ,6720
335
335
  cirq/ops/pauli_string.py,sha256=G_w4vq1Jt6eHp1YEtTnfnpQ9QnoIGhtRI6zgXOWh8vY,67503
336
- cirq/ops/pauli_string_phasor.py,sha256=qcQZqjg8Ua-_KmiHQYYt9X_vELjs_oXsyUwlYfrmcL0,17614
337
- cirq/ops/pauli_string_phasor_test.py,sha256=HGEPjPc7ySeshOnMJHNjtyckFuEXLvxgy-TtnU6fETM,27582
336
+ cirq/ops/pauli_string_phasor.py,sha256=U-axS69J_PRq9XsFGwTQqb9JaT_D1EUlgWuqDaWpbEc,17671
337
+ cirq/ops/pauli_string_phasor_test.py,sha256=91YXIm9RbqrG8dPdA18E9i4G7JT1epGvM4BZu6_YVzw,27796
338
338
  cirq/ops/pauli_string_raw_types.py,sha256=6CgdPWYmOziP4uZbrIsRW0sDSMmV1GioGdAk0owFITU,2240
339
339
  cirq/ops/pauli_string_raw_types_test.py,sha256=SZPluslZPGffPq93F5apESBygWZ2cj7BEX6dQuawRQE,2648
340
340
  cirq/ops/pauli_string_test.py,sha256=ekj755Fe5up8-0nXCozUlne6NCxvb8FrwZ8Qp6CAmRI,74583
@@ -419,8 +419,8 @@ cirq/protocols/phase_protocol.py,sha256=dXZRJb7aT8ZvtliItZOvoiaev-QvjBT4SknwZ5p-
419
419
  cirq/protocols/phase_protocol_test.py,sha256=eU4g6VDqfWZCpklVlY1t5msc5kAZsP-UlPrROLll_ms,1939
420
420
  cirq/protocols/pow_protocol.py,sha256=0wgb4LLAkOWjmP_u-_6IweXovDViocbdSgtsMOcXdkM,3290
421
421
  cirq/protocols/pow_protocol_test.py,sha256=8eBcGUqRWSSYkEkvSHXL6tcv1o-ilnl6nzgNl9vfctg,1626
422
- cirq/protocols/qasm.py,sha256=gvJNuqHfz2asDpysrCmTUPkaJUMfDarumsZlXqMvn5g,7116
423
- cirq/protocols/qasm_test.py,sha256=MFkqSHByCbB46XOlAJgKQgEpANVwnmfO-tD-XofqrQ4,2013
422
+ cirq/protocols/qasm.py,sha256=5i9_hznujNQ96dNipsBd7gy9B3p2SKlXk3VMTEBh-RY,7406
423
+ cirq/protocols/qasm_test.py,sha256=O6QdL45eEPigqzy_oLB_CjFSQhtKUBmCtQWNdk7j8Zg,2216
424
424
  cirq/protocols/qid_shape_protocol.py,sha256=jCAdpBBkEyK6JGmZwVBp__lHW3JhLmYt0Qzf8OgZtNU,7690
425
425
  cirq/protocols/qid_shape_protocol_test.py,sha256=Qjo-wemjkP__1jQnVkkB91mUs8EpfXyKI9GzeZQVb1E,2303
426
426
  cirq/protocols/resolve_parameters.py,sha256=NVFS5PSq18Hcvjv_P6vaZIa2D4OCgZY1u5j6QgPMlTA,7374
@@ -1189,8 +1189,8 @@ cirq/work/sampler.py,sha256=bE5tmVkcR6cZZMLETxDfHehdsYUMbx2RvBeIBetehI4,19187
1189
1189
  cirq/work/sampler_test.py,sha256=hL2UWx3dz2ukZVNxWftiKVvJcQoLplLZdQm-k1QcA40,13282
1190
1190
  cirq/work/zeros_sampler.py,sha256=x1C7cup66a43n-3tm8QjhiqJa07qcJW10FxNp9jJ59Q,2356
1191
1191
  cirq/work/zeros_sampler_test.py,sha256=JIkpBBFPJe5Ba4142vzogyWyboG1Q1ZAm0UVGgOoZn8,3279
1192
- cirq_core-1.5.0.dev20250102031424.dist-info/LICENSE,sha256=tAkwu8-AdEyGxGoSvJ2gVmQdcicWw3j1ZZueVV74M-E,11357
1193
- cirq_core-1.5.0.dev20250102031424.dist-info/METADATA,sha256=equ_3gS9FNaDWX50ZAcWEUz0X6CWWqLrKSjM-gLvt0Y,1992
1194
- cirq_core-1.5.0.dev20250102031424.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
1195
- cirq_core-1.5.0.dev20250102031424.dist-info/top_level.txt,sha256=Sz9iOxHU0IEMLSFGwiwOCaN2e9K-jFbBbtpPN1hB73g,5
1196
- cirq_core-1.5.0.dev20250102031424.dist-info/RECORD,,
1192
+ cirq_core-1.5.0.dev20250102034819.dist-info/LICENSE,sha256=tAkwu8-AdEyGxGoSvJ2gVmQdcicWw3j1ZZueVV74M-E,11357
1193
+ cirq_core-1.5.0.dev20250102034819.dist-info/METADATA,sha256=HnJ0M5elpdegeYKZnHgE2j8n3uWhvJxpAt9tnkoqoRU,1992
1194
+ cirq_core-1.5.0.dev20250102034819.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
1195
+ cirq_core-1.5.0.dev20250102034819.dist-info/top_level.txt,sha256=Sz9iOxHU0IEMLSFGwiwOCaN2e9K-jFbBbtpPN1hB73g,5
1196
+ cirq_core-1.5.0.dev20250102034819.dist-info/RECORD,,