cirq-aqt 1.5.0.dev20250409222543__py3-none-any.whl → 1.6.0__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-aqt might be problematic. Click here for more details.

cirq_aqt/_version.py CHANGED
@@ -14,4 +14,4 @@
14
14
 
15
15
  """Define version number here, read it from setup.py automatically"""
16
16
 
17
- __version__ = "1.5.0.dev20250409222543"
17
+ __version__ = "1.6.0"
cirq_aqt/_version_test.py CHANGED
@@ -3,4 +3,4 @@ import cirq_aqt
3
3
 
4
4
 
5
5
  def test_version():
6
- assert cirq_aqt.__version__ == "1.5.0.dev20250409222543"
6
+ assert cirq_aqt.__version__ == "1.6.0"
cirq_aqt/aqt_device.py CHANGED
@@ -24,9 +24,11 @@ arbitrary connectivity. For more information see:
24
24
  The native gate set consists of the local gates: X, Y, and XX entangling gates
25
25
  """
26
26
 
27
+ from __future__ import annotations
28
+
27
29
  import json
28
30
  from enum import Enum
29
- from typing import Any, cast, Dict, Iterable, List, Optional, Sequence, Set, Tuple, Union
31
+ from typing import Any, cast, Iterable, Sequence
30
32
 
31
33
  import networkx as nx
32
34
  import numpy as np
@@ -87,7 +89,7 @@ class AQTNoiseModel(cirq.NoiseModel):
87
89
 
88
90
  def noisy_moment(
89
91
  self, moment: cirq.Moment, system_qubits: Sequence[cirq.Qid]
90
- ) -> List[cirq.Operation]:
92
+ ) -> list[cirq.Operation]:
91
93
  """Returns a list of noisy moments.
92
94
 
93
95
  The model includes
@@ -115,7 +117,7 @@ class AQTNoiseModel(cirq.NoiseModel):
115
117
 
116
118
  def get_crosstalk_operation(
117
119
  self, operation: cirq.Operation, system_qubits: Sequence[cirq.Qid]
118
- ) -> List[cirq.Operation]:
120
+ ) -> list[cirq.Operation]:
119
121
  """Returns a list of operations including crosstalk
120
122
 
121
123
  Args:
@@ -125,7 +127,7 @@ class AQTNoiseModel(cirq.NoiseModel):
125
127
  Returns:
126
128
  List of operations including crosstalk
127
129
  """
128
- cast(Tuple[cirq.LineQubit], system_qubits)
130
+ cast(tuple[cirq.LineQubit], system_qubits)
129
131
  num_qubits = len(system_qubits)
130
132
  xtlk_arr = np.zeros(num_qubits)
131
133
  idx_list = []
@@ -167,7 +169,7 @@ class AQTSimulator:
167
169
  num_qubits: int,
168
170
  circuit: cirq.Circuit = cirq.Circuit(),
169
171
  simulate_ideal: bool = False,
170
- noise_dict: Optional[Dict] = None,
172
+ noise_dict: dict | None = None,
171
173
  ):
172
174
  """Initializes the AQT simulator.
173
175
 
@@ -187,7 +189,7 @@ class AQTSimulator:
187
189
  self.noise_dict = noise_dict
188
190
  self.simulate_ideal = simulate_ideal
189
191
 
190
- def generate_circuit_from_list(self, json_string: str):
192
+ def generate_circuit_from_list(self, json_string: str) -> None:
191
193
  """Generates a list of cirq operations from a json string.
192
194
 
193
195
  The default behavior is to add a measurement to any qubit at the end
@@ -198,7 +200,7 @@ class AQTSimulator:
198
200
  """
199
201
  self.circuit = cirq.Circuit()
200
202
  json_obj = json.loads(json_string)
201
- gate: Union[cirq.PhasedXPowGate, cirq.EigenGate]
203
+ gate: cirq.PhasedXPowGate | cirq.EigenGate
202
204
  for circuit_list in json_obj:
203
205
  op_str = circuit_list[0]
204
206
  if op_str == 'R':
@@ -286,11 +288,11 @@ class AQTDevice(cirq.Device):
286
288
  def metadata(self) -> aqt_device_metadata.AQTDeviceMetadata:
287
289
  return self._metadata
288
290
 
289
- def validate_gate(self, gate: cirq.Gate):
291
+ def validate_gate(self, gate: cirq.Gate) -> None:
290
292
  if gate not in self.metadata.gateset:
291
293
  raise ValueError(f'Unsupported gate type: {gate!r}')
292
294
 
293
- def validate_operation(self, operation):
295
+ def validate_operation(self, operation) -> None:
294
296
  if not isinstance(operation, cirq.GateOperation):
295
297
  raise ValueError(f'Unsupported operation: {operation!r}')
296
298
 
@@ -302,11 +304,11 @@ class AQTDevice(cirq.Device):
302
304
  if q not in self.qubits:
303
305
  raise ValueError(f'Qubit not on device: {q!r}')
304
306
 
305
- def validate_circuit(self, circuit: cirq.AbstractCircuit):
307
+ def validate_circuit(self, circuit: cirq.AbstractCircuit) -> None:
306
308
  super().validate_circuit(circuit)
307
309
  _verify_unique_measurement_keys(circuit.all_operations())
308
310
 
309
- def at(self, position: int) -> Optional[cirq.LineQubit]:
311
+ def at(self, position: int) -> cirq.LineQubit | None:
310
312
  """Returns the qubit at the given position, if there is one, else None."""
311
313
  q = cirq.LineQubit(position)
312
314
  return q if q in self.qubits else None
@@ -339,7 +341,7 @@ class AQTDevice(cirq.Device):
339
341
  p.text("AQTDevice(...)" if cycle else self.__str__())
340
342
 
341
343
 
342
- def get_aqt_device(num_qubits: int) -> Tuple[AQTDevice, List[cirq.LineQubit]]:
344
+ def get_aqt_device(num_qubits: int) -> tuple[AQTDevice, list[cirq.LineQubit]]:
343
345
  """Returns an AQT ion device
344
346
 
345
347
  Args:
@@ -359,7 +361,7 @@ def get_aqt_device(num_qubits: int) -> Tuple[AQTDevice, List[cirq.LineQubit]]:
359
361
  return ion_device, qubit_list
360
362
 
361
363
 
362
- def get_default_noise_dict() -> Dict[str, Any]:
364
+ def get_default_noise_dict() -> dict[str, Any]:
363
365
  """Returns the current noise parameters"""
364
366
  default_noise_dict = {
365
367
  OperationString.R.value: cirq.depolarize(1e-3),
@@ -371,7 +373,7 @@ def get_default_noise_dict() -> Dict[str, Any]:
371
373
 
372
374
 
373
375
  def _verify_unique_measurement_keys(operations: Iterable[cirq.Operation]):
374
- seen: Set[str] = set()
376
+ seen: set[str] = set()
375
377
  for op in operations:
376
378
  if isinstance(op.gate, cirq.MeasurementGate):
377
379
  meas = op.gate
@@ -14,6 +14,8 @@
14
14
 
15
15
  """DeviceMetadata for ion trap device with mutually linked qubits placed on a line."""
16
16
 
17
+ from __future__ import annotations
18
+
17
19
  from typing import Any, Iterable, Mapping
18
20
 
19
21
  import networkx as nx
@@ -54,9 +56,9 @@ class AQTDeviceMetadata(cirq.DeviceMetadata):
54
56
  cirq.GateFamily(cirq.ZPowGate): self._oneq_gates_duration,
55
57
  cirq.GateFamily(cirq.PhasedXPowGate): self._oneq_gates_duration,
56
58
  }
57
- assert not self._gateset.gates.symmetric_difference(self._gate_durations.keys()), (
58
- "AQTDeviceMetadata.gate_durations must have the same Gates " "as AQTTargetGateset."
59
- )
59
+ assert not self._gateset.gates.symmetric_difference(
60
+ self._gate_durations.keys()
61
+ ), "AQTDeviceMetadata.gate_durations must have the same Gates as AQTTargetGateset."
60
62
 
61
63
  @property
62
64
  def gateset(self) -> cirq.Gateset:
@@ -14,7 +14,7 @@
14
14
 
15
15
  """Tests for AQTDeviceMetadata."""
16
16
 
17
- from typing import List
17
+ from __future__ import annotations
18
18
 
19
19
  import pytest
20
20
 
@@ -24,7 +24,7 @@ from cirq_aqt.aqt_target_gateset import AQTTargetGateset
24
24
 
25
25
 
26
26
  @pytest.fixture
27
- def qubits() -> List[cirq.LineQubit]:
27
+ def qubits() -> list[cirq.LineQubit]:
28
28
  return cirq.LineQubit.range(5)
29
29
 
30
30
 
@@ -38,7 +38,7 @@ def metadata(qubits) -> AQTDeviceMetadata:
38
38
  )
39
39
 
40
40
 
41
- def test_aqtdevice_metadata(metadata, qubits):
41
+ def test_aqtdevice_metadata(metadata, qubits) -> None:
42
42
  assert metadata.qubit_set == frozenset(qubits)
43
43
  assert set(qubits) == set(metadata.nx_graph.nodes())
44
44
  edges = metadata.nx_graph.edges()
@@ -48,7 +48,7 @@ def test_aqtdevice_metadata(metadata, qubits):
48
48
  assert len(metadata.gate_durations) == 4
49
49
 
50
50
 
51
- def test_aqtdevice_duration_of(metadata, qubits):
51
+ def test_aqtdevice_duration_of(metadata, qubits) -> None:
52
52
  q0, q1 = qubits[:2]
53
53
  ms = cirq.Duration(millis=1)
54
54
  assert metadata.duration_of(cirq.Z(q0)) == 10 * ms
@@ -59,5 +59,5 @@ def test_aqtdevice_duration_of(metadata, qubits):
59
59
  metadata.duration_of(cirq.I(q0))
60
60
 
61
61
 
62
- def test_repr(metadata):
62
+ def test_repr(metadata) -> None:
63
63
  cirq.testing.assert_equivalent_repr(metadata, setup_code='import cirq\nimport cirq_aqt\n')
@@ -12,8 +12,9 @@
12
12
  # See the License for the specific language governing permissions and
13
13
  # limitations under the License.
14
14
 
15
+ from __future__ import annotations
16
+
15
17
  from datetime import timedelta
16
- from typing import List
17
18
 
18
19
  import pytest
19
20
 
@@ -22,7 +23,7 @@ from cirq_aqt import aqt_device, aqt_device_metadata
22
23
 
23
24
 
24
25
  @pytest.fixture
25
- def qubits() -> List[cirq.LineQubit]:
26
+ def qubits() -> list[cirq.LineQubit]:
26
27
  return cirq.LineQubit.range(3)
27
28
 
28
29
 
@@ -38,15 +39,15 @@ def device(qubits) -> aqt_device.AQTDevice:
38
39
 
39
40
 
40
41
  class NotImplementedOperation(cirq.Operation):
41
- def with_qubits(self, *new_qubits) -> 'NotImplementedOperation':
42
+ def with_qubits(self, *new_qubits) -> NotImplementedOperation:
42
43
  raise NotImplementedError()
43
44
 
44
45
  @property
45
- def qubits(self):
46
+ def qubits(self) -> tuple[cirq.Qid, ...]:
46
47
  raise NotImplementedError()
47
48
 
48
49
 
49
- def test_init_qubits(device, qubits):
50
+ def test_init_qubits(device, qubits) -> None:
50
51
  ms = cirq.Duration(millis=1)
51
52
  assert device.qubits == frozenset(qubits)
52
53
  with pytest.raises(TypeError, match="NamedQubit"):
@@ -54,12 +55,12 @@ def test_init_qubits(device, qubits):
54
55
  measurement_duration=100 * ms,
55
56
  twoq_gates_duration=200 * ms,
56
57
  oneq_gates_duration=10 * ms,
57
- qubits=[cirq.LineQubit(0), cirq.NamedQubit("a")],
58
+ qubits=[cirq.LineQubit(0), cirq.NamedQubit("a")], # type: ignore[list-item]
58
59
  )
59
60
 
60
61
 
61
62
  @pytest.mark.parametrize('ms', [cirq.Duration(millis=1), timedelta(milliseconds=1)])
62
- def test_init_durations(ms, qubits):
63
+ def test_init_durations(ms, qubits) -> None:
63
64
  dev = aqt_device.AQTDevice(
64
65
  qubits=qubits,
65
66
  measurement_duration=100 * ms,
@@ -71,12 +72,12 @@ def test_init_durations(ms, qubits):
71
72
  assert dev.metadata.measurement_duration == cirq.Duration(millis=100)
72
73
 
73
74
 
74
- def test_metadata(device, qubits):
75
+ def test_metadata(device, qubits) -> None:
75
76
  assert isinstance(device.metadata, aqt_device_metadata.AQTDeviceMetadata)
76
77
  assert device.metadata.qubit_set == frozenset(qubits)
77
78
 
78
79
 
79
- def test_repr(device):
80
+ def test_repr(device) -> None:
80
81
  assert repr(device) == (
81
82
  "cirq_aqt.aqt_device.AQTDevice("
82
83
  "measurement_duration=cirq.Duration(millis=100), "
@@ -88,13 +89,13 @@ def test_repr(device):
88
89
  cirq.testing.assert_equivalent_repr(device, setup_code='import cirq\nimport cirq_aqt\n')
89
90
 
90
91
 
91
- def test_validate_measurement_non_adjacent_qubits_ok(device):
92
+ def test_validate_measurement_non_adjacent_qubits_ok(device) -> None:
92
93
  device.validate_operation(
93
94
  cirq.GateOperation(cirq.MeasurementGate(2, 'key'), (cirq.LineQubit(0), cirq.LineQubit(1)))
94
95
  )
95
96
 
96
97
 
97
- def test_validate_operation_existing_qubits(device):
98
+ def test_validate_operation_existing_qubits(device) -> None:
98
99
  device.validate_operation(cirq.GateOperation(cirq.XX, (cirq.LineQubit(0), cirq.LineQubit(1))))
99
100
  device.validate_operation(cirq.Z(cirq.LineQubit(0)))
100
101
  device.validate_operation(
@@ -113,7 +114,7 @@ def test_validate_operation_existing_qubits(device):
113
114
  device.validate_operation(cirq.X(cirq.NamedQubit("q1")))
114
115
 
115
116
 
116
- def test_validate_operation_supported_gate(device):
117
+ def test_validate_operation_supported_gate(device) -> None:
117
118
  class MyGate(cirq.Gate):
118
119
  def num_qubits(self):
119
120
  return 1
@@ -127,12 +128,12 @@ def test_validate_operation_supported_gate(device):
127
128
  device.validate_operation(NotImplementedOperation())
128
129
 
129
130
 
130
- def test_aqt_device_eq(device):
131
+ def test_aqt_device_eq(device) -> None:
131
132
  eq = cirq.testing.EqualsTester()
132
133
  eq.make_equality_group(lambda: device)
133
134
 
134
135
 
135
- def test_validate_circuit_repeat_measurement_keys(device):
136
+ def test_validate_circuit_repeat_measurement_keys(device) -> None:
136
137
  circuit = cirq.Circuit()
137
138
  circuit.append(
138
139
  [cirq.measure(cirq.LineQubit(0), key='a'), cirq.measure(cirq.LineQubit(1), key='a')]
@@ -142,16 +143,16 @@ def test_validate_circuit_repeat_measurement_keys(device):
142
143
  device.validate_circuit(circuit)
143
144
 
144
145
 
145
- def test_aqt_device_str(device):
146
+ def test_aqt_device_str(device) -> None:
146
147
  assert str(device) == "q(0)───q(1)───q(2)"
147
148
 
148
149
 
149
- def test_aqt_device_pretty_repr(device):
150
+ def test_aqt_device_pretty_repr(device) -> None:
150
151
  cirq.testing.assert_repr_pretty(device, "q(0)───q(1)───q(2)")
151
152
  cirq.testing.assert_repr_pretty(device, "AQTDevice(...)", cycle=True)
152
153
 
153
154
 
154
- def test_at(device):
155
+ def test_at(device) -> None:
155
156
  assert device.at(-1) is None
156
157
  assert device.at(0) == cirq.LineQubit(0)
157
158
  assert device.at(2) == cirq.LineQubit(2)
cirq_aqt/aqt_sampler.py CHANGED
@@ -22,10 +22,12 @@ API keys for classical simulators and quantum devices can be obtained at:
22
22
 
23
23
  """
24
24
 
25
+ from __future__ import annotations
26
+
25
27
  import json
26
28
  import time
27
29
  import uuid
28
- from typing import Callable, cast, Dict, List, Literal, Sequence, Tuple, TypedDict, Union
30
+ from typing import Callable, cast, Literal, Sequence, TypedDict
29
31
  from urllib.parse import urljoin
30
32
 
31
33
  import numpy as np
@@ -249,16 +251,14 @@ class AQTSampler(cirq.Sampler):
249
251
  RuntimeError: If the circuit is empty.
250
252
  """
251
253
 
252
- seq_list: List[Union[Tuple[str, float, List[int]], Tuple[str, float, float, List[int]]]] = (
253
- []
254
- )
254
+ seq_list: list[tuple[str, float, list[int]] | tuple[str, float, float, list[int]]] = []
255
255
  circuit = cirq.resolve_parameters(circuit, param_resolver)
256
256
  for op in circuit.all_operations():
257
- line_qubit = cast(Tuple[cirq.LineQubit], op.qubits)
257
+ line_qubit = cast(tuple[cirq.LineQubit], op.qubits)
258
258
  op = cast(cirq.GateOperation, op)
259
259
  qubit_idx = [obj.x for obj in line_qubit]
260
260
  op_str = get_op_string(op)
261
- gate: Union[cirq.EigenGate, cirq.PhasedXPowGate]
261
+ gate: cirq.EigenGate | cirq.PhasedXPowGate
262
262
  if op_str == 'R':
263
263
  gate = cast(cirq.PhasedXPowGate, op.gate)
264
264
  seq_list.append(
@@ -367,7 +367,7 @@ class AQTSampler(cirq.Sampler):
367
367
 
368
368
  response = post(submission_url, json=submission_data, headers=headers)
369
369
  response = response.json()
370
- data = cast(Dict, response)
370
+ data = cast(dict, response)
371
371
 
372
372
  if 'response' not in data.keys() or 'status' not in data['response'].keys():
373
373
  raise RuntimeError('Got unexpected return data from server: \n' + str(data))
@@ -382,7 +382,7 @@ class AQTSampler(cirq.Sampler):
382
382
  while True:
383
383
  response = get(result_url, headers=headers)
384
384
  response = response.json()
385
- data = cast(Dict, response)
385
+ data = cast(dict, response)
386
386
 
387
387
  if 'response' not in data.keys() or 'status' not in data['response'].keys():
388
388
  raise RuntimeError('Got unexpected return data from AQT server: \n' + str(data))
@@ -424,7 +424,7 @@ class AQTSampler(cirq.Sampler):
424
424
  # TODO: Use measurement name from circuit.
425
425
  # Github issue: https://github.com/quantumlib/Cirq/issues/2199
426
426
  meas_name = 'm'
427
- trial_results: List[cirq.Result] = []
427
+ trial_results: list[cirq.Result] = []
428
428
  for param_resolver in cirq.to_resolvers(params):
429
429
  id_str = str(uuid.uuid1())
430
430
  num_qubits = len(program.all_qubits())
@@ -12,7 +12,10 @@
12
12
  # See the License for the specific language governing permissions and
13
13
  # limitations under the License.
14
14
 
15
+ from __future__ import annotations
16
+
15
17
  import json
18
+ from typing import Any, Self
16
19
  from unittest import mock
17
20
 
18
21
  import numpy as np
@@ -31,11 +34,11 @@ class GetResultReturn:
31
34
  self.test_dict = {'job': {'job_id': '2131da'}, 'response': {'status': 'queued'}}
32
35
  self.counter = 0
33
36
 
34
- def json(self):
37
+ def json(self) -> dict[str, Any]:
35
38
  self.counter += 1
36
39
  return self.test_dict
37
40
 
38
- def update(self, *args, **kwargs):
41
+ def update(self, *args, **kwargs) -> Self:
39
42
  return self
40
43
 
41
44
 
@@ -53,7 +56,7 @@ class GetResultNoStatus(GetResultReturn):
53
56
  """A put mock class for testing error responses
54
57
  This will not return a status in the second call"""
55
58
 
56
- def update(self, *args, **kwargs):
59
+ def update(self, *args, **kwargs) -> Self:
57
60
  del self.test_dict['response']['status']
58
61
  return self
59
62
 
@@ -62,14 +65,14 @@ class GetResultErrorSecond(GetResultReturn):
62
65
  """A put mock class for testing error responses
63
66
  This will return an error on the second put call"""
64
67
 
65
- def update(self, *args, **kwargs):
68
+ def update(self, *args, **kwargs) -> Self:
66
69
  if self.counter >= 1:
67
70
  self.test_dict['response']['status'] = 'error'
68
71
  return self
69
72
 
70
73
 
71
74
  class SubmitGoodResponse:
72
- def json(self):
75
+ def json(self) -> dict[str, Any]:
73
76
  return {"job": {"job_id": "test_job"}, "response": {"status": "queued"}}
74
77
 
75
78
 
@@ -77,7 +80,7 @@ class SubmitResultNoID:
77
80
  """A put mock class for testing error responses
78
81
  This will not return an id at the first call"""
79
82
 
80
- def json(self):
83
+ def json(self) -> dict[str, Any]:
81
84
  return {"job": {}, "response": {"status": "queued"}}
82
85
 
83
86
 
@@ -85,7 +88,7 @@ class SubmitResultNoStatus:
85
88
  """A put mock class for testing error responses
86
89
  This will not return an id at the first call"""
87
90
 
88
- def json(self):
91
+ def json(self) -> dict[str, Any]:
89
92
  return {"job": {"job_id": "test_job"}, "response": {}}
90
93
 
91
94
 
@@ -93,11 +96,11 @@ class SubmitResultWithError:
93
96
  """A put mock class for testing error responses
94
97
  This will not return an id at the first call"""
95
98
 
96
- def json(self):
99
+ def json(self) -> dict[str, Any]:
97
100
  return {"job": {"job_id": "test_job"}, "response": {"status": "error"}}
98
101
 
99
102
 
100
- def test_aqt_sampler_submit_job_error_handling():
103
+ def test_aqt_sampler_submit_job_error_handling() -> None:
101
104
  for e_return in [SubmitResultNoID(), SubmitResultNoStatus(), SubmitResultWithError()]:
102
105
  with (
103
106
  mock.patch('cirq_aqt.aqt_sampler.post', return_value=e_return),
@@ -117,7 +120,7 @@ def test_aqt_sampler_submit_job_error_handling():
117
120
  _results = sampler.run_sweep(circuit, params=sweep, repetitions=repetitions)
118
121
 
119
122
 
120
- def test_aqt_sampler_get_result_error_handling():
123
+ def test_aqt_sampler_get_result_error_handling() -> None:
121
124
  for e_return in [GetResultError(), GetResultErrorSecond(), GetResultNoStatus()]:
122
125
  with (
123
126
  mock.patch('cirq_aqt.aqt_sampler.post', return_value=SubmitGoodResponse()),
@@ -139,7 +142,7 @@ def test_aqt_sampler_get_result_error_handling():
139
142
  _results = sampler.run_sweep(circuit, params=sweep, repetitions=repetitions)
140
143
 
141
144
 
142
- def test_aqt_sampler_empty_circuit():
145
+ def test_aqt_sampler_empty_circuit() -> None:
143
146
  num_points = 10
144
147
  max_angle = np.pi
145
148
  repetitions = 1000
@@ -153,7 +156,7 @@ def test_aqt_sampler_empty_circuit():
153
156
  _results = sampler.run_sweep(circuit, params=sweep, repetitions=repetitions)
154
157
 
155
158
 
156
- def test_aqt_sampler():
159
+ def test_aqt_sampler() -> None:
157
160
  class ResultReturn:
158
161
  def __init__(self):
159
162
  self.request_counter = 0
@@ -198,7 +201,7 @@ def test_aqt_sampler():
198
201
  assert result_method.call_count == 3
199
202
 
200
203
 
201
- def test_aqt_sampler_sim():
204
+ def test_aqt_sampler_sim() -> None:
202
205
  theta = sympy.Symbol('theta')
203
206
  num_points = 10
204
207
  max_angle = np.pi
@@ -226,7 +229,7 @@ def test_aqt_sampler_sim():
226
229
  assert excited_state_probs[-1] == 0.25
227
230
 
228
231
 
229
- def test_aqt_sampler_sim_xtalk():
232
+ def test_aqt_sampler_sim_xtalk() -> None:
230
233
  num_points = 10
231
234
  max_angle = np.pi
232
235
  repetitions = 100
@@ -247,7 +250,7 @@ def test_aqt_sampler_sim_xtalk():
247
250
  _results = sampler.run_sweep(circuit, params=sweep, repetitions=repetitions)
248
251
 
249
252
 
250
- def test_aqt_sampler_ms():
253
+ def test_aqt_sampler_ms() -> None:
251
254
  repetitions = 1000
252
255
  num_qubits = 4
253
256
  _, qubits = get_aqt_device(num_qubits)
@@ -262,7 +265,7 @@ def test_aqt_sampler_ms():
262
265
  assert hist[0] > repetitions / 3
263
266
 
264
267
 
265
- def test_aqt_device_wrong_op_str():
268
+ def test_aqt_device_wrong_op_str() -> None:
266
269
  circuit = cirq.Circuit()
267
270
  q0, q1 = cirq.LineQubit.range(2)
268
271
  circuit.append(cirq.CNOT(q0, q1) ** 1.0)
@@ -12,6 +12,8 @@
12
12
  # See the License for the specific language governing permissions and
13
13
  # limitations under the License.
14
14
 
15
+ from __future__ import annotations
16
+
15
17
  import pytest
16
18
 
17
19
  import cirq
@@ -19,13 +21,13 @@ from cirq_aqt import AQTSimulator
19
21
  from cirq_aqt.aqt_device import AQTNoiseModel, get_aqt_device
20
22
 
21
23
 
22
- def test_simulator_no_circ():
24
+ def test_simulator_no_circ() -> None:
23
25
  with pytest.raises(RuntimeError):
24
26
  sim = AQTSimulator(num_qubits=1)
25
27
  sim.simulate_samples(1)
26
28
 
27
29
 
28
- def test_ms_crosstalk_n_noise():
30
+ def test_ms_crosstalk_n_noise() -> None:
29
31
  num_qubits = 4
30
32
  noise_mod = AQTNoiseModel()
31
33
  _, qubits = get_aqt_device(num_qubits)
@@ -14,12 +14,16 @@
14
14
 
15
15
  """Target gateset for ion trap device with mutually linked qubits placed on a line."""
16
16
 
17
- from typing import List
17
+ from __future__ import annotations
18
+
19
+ from typing import TYPE_CHECKING
18
20
 
19
21
  import numpy as np
20
22
 
21
23
  import cirq
22
- from cirq.protocols.decompose_protocol import DecomposeResult
24
+
25
+ if TYPE_CHECKING:
26
+ from cirq.protocols.decompose_protocol import DecomposeResult
23
27
 
24
28
 
25
29
  class AQTTargetGateset(cirq.TwoQubitCompilationTargetGateset):
@@ -65,6 +69,6 @@ class AQTTargetGateset(cirq.TwoQubitCompilationTargetGateset):
65
69
  return NotImplemented
66
70
 
67
71
  @property
68
- def postprocess_transformers(self) -> List[cirq.TRANSFORMER]:
72
+ def postprocess_transformers(self) -> list[cirq.TRANSFORMER]:
69
73
  """List of transformers which should be run after decomposing individual operations."""
70
74
  return [cirq.drop_negligible_operations, cirq.drop_empty_moments]
@@ -14,6 +14,8 @@
14
14
 
15
15
  """Tests for AQTTargetGateset."""
16
16
 
17
+ from __future__ import annotations
18
+
17
19
  import pytest
18
20
  import sympy
19
21
 
@@ -49,24 +51,27 @@ Q, Q2, Q3, Q4 = cirq.LineQubit.range(4)
49
51
  (cirq.ZPowGate(exponent=0.5)(Q).controlled_by(Q2, Q3), False),
50
52
  ],
51
53
  )
52
- def test_gateset(op: cirq.Operation, expected: bool):
54
+ def test_gateset(op: cirq.Operation, expected: bool) -> None:
53
55
  gs = aqt_target_gateset.AQTTargetGateset()
54
56
  assert gs.validate(op) == expected
55
57
  assert gs.validate(cirq.Circuit(op)) == expected
56
58
 
57
59
 
58
- def test_decompose_single_qubit_operation():
60
+ def test_decompose_single_qubit_operation() -> None:
59
61
  gs = aqt_target_gateset.AQTTargetGateset()
60
62
  tgoph = gs.decompose_to_target_gateset(cirq.H(Q), 0)
63
+ assert isinstance(tgoph, list)
61
64
  assert len(tgoph) == 2
62
65
  assert isinstance(tgoph[0].gate, cirq.Rx)
63
66
  assert isinstance(tgoph[1].gate, cirq.Ry)
64
67
  tcoph = cirq.CircuitOperation(cirq.FrozenCircuit(cirq.H(Q))).with_tags('tagged')
65
68
  tgtcoph = gs.decompose_to_target_gateset(tcoph, 0)
69
+ assert isinstance(tgtcoph, list)
66
70
  assert len(tgtcoph) == 2
67
71
  assert isinstance(tgtcoph[0].gate, cirq.Rx)
68
72
  assert isinstance(tgtcoph[1].gate, cirq.Ry)
69
73
  tgopz = gs.decompose_to_target_gateset(cirq.Z(Q), 0)
74
+ assert isinstance(tgopz, list)
70
75
  assert len(tgopz) == 1
71
76
  assert isinstance(tgopz[0].gate, cirq.ZPowGate)
72
77
  theta = sympy.Symbol('theta')
@@ -74,9 +79,10 @@ def test_decompose_single_qubit_operation():
74
79
  return
75
80
 
76
81
 
77
- def test_decompose_two_qubit_operation():
82
+ def test_decompose_two_qubit_operation() -> None:
78
83
  gs = aqt_target_gateset.AQTTargetGateset()
79
84
  tgopsqrtxx = gs.decompose_to_target_gateset(cirq.XX(Q, Q2) ** 0.5, 0)
85
+ assert isinstance(tgopsqrtxx, list)
80
86
  assert len(tgopsqrtxx) == 1
81
87
  assert isinstance(tgopsqrtxx[0].gate, cirq.XXPowGate)
82
88
  theta = sympy.Symbol('theta')
@@ -84,6 +90,6 @@ def test_decompose_two_qubit_operation():
84
90
  return
85
91
 
86
92
 
87
- def test_postprocess_transformers():
93
+ def test_postprocess_transformers() -> None:
88
94
  gs = aqt_target_gateset.AQTTargetGateset()
89
95
  assert len(gs.postprocess_transformers) == 2
cirq_aqt/conftest.py CHANGED
@@ -15,5 +15,5 @@
15
15
  import os
16
16
 
17
17
 
18
- def pytest_configure(config):
18
+ def pytest_configure(config) -> None:
19
19
  os.environ['CIRQ_TESTING'] = "true"
@@ -12,12 +12,15 @@
12
12
  # See the License for the specific language governing permissions and
13
13
  # limitations under the License.
14
14
 
15
+ from __future__ import annotations
16
+
15
17
  import functools
16
- from typing import Dict
18
+ from typing import TYPE_CHECKING
17
19
 
18
- from cirq.protocols.json_serialization import ObjectFactory
20
+ if TYPE_CHECKING:
21
+ from cirq.protocols.json_serialization import ObjectFactory
19
22
 
20
23
 
21
24
  @functools.lru_cache()
22
- def _class_resolver_dictionary() -> Dict[str, ObjectFactory]:
25
+ def _class_resolver_dictionary() -> dict[str, ObjectFactory]:
23
26
  return {}
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cirq-aqt
3
- Version: 1.5.0.dev20250409222543
3
+ Version: 1.6.0
4
4
  Summary: A Cirq package to simulate and connect to Alpine Quantum Technologies quantum computers
5
5
  Home-page: http://github.com/quantumlib/cirq
6
6
  Author: The Cirq Developers
@@ -18,18 +18,17 @@ Classifier: Operating System :: MacOS :: MacOS X
18
18
  Classifier: Operating System :: Microsoft :: Windows
19
19
  Classifier: Operating System :: POSIX :: Linux
20
20
  Classifier: Programming Language :: Python :: 3
21
- Classifier: Programming Language :: Python :: 3.10
22
21
  Classifier: Programming Language :: Python :: 3.11
23
22
  Classifier: Programming Language :: Python :: 3.12
24
23
  Classifier: Programming Language :: Python :: 3.13
25
24
  Classifier: Topic :: Scientific/Engineering :: Quantum Computing
26
25
  Classifier: Topic :: Software Development :: Libraries :: Python Modules
27
26
  Classifier: Typing :: Typed
28
- Requires-Python: >=3.10.0
27
+ Requires-Python: >=3.11.0
29
28
  Description-Content-Type: text/markdown
30
29
  License-File: LICENSE
31
30
  Requires-Dist: requests~=2.32
32
- Requires-Dist: cirq-core==1.5.0.dev20250409222543
31
+ Requires-Dist: cirq-core==1.6.0
33
32
  Dynamic: author
34
33
  Dynamic: author-email
35
34
  Dynamic: classifier
@@ -0,0 +1,21 @@
1
+ cirq_aqt/__init__.py,sha256=M8r1U_8xYpcIUhs8U110BFWQ4jUCqS9IQf8trjq0rvI,888
2
+ cirq_aqt/_version.py,sha256=ONCkEb6AdakhuCOuRYjc6qxHCOCb-oqhyqBOFTDWtY0,678
3
+ cirq_aqt/_version_test.py,sha256=IWhBrV3ujtLNObDEWTZVFsXmKtKgKRE9VjdyiEgeK2k,137
4
+ cirq_aqt/aqt_device.py,sha256=9W0iKChiEF5vBhYfXizfwTky30NB9N2hPpiw_YjQ7fc,13663
5
+ cirq_aqt/aqt_device_metadata.py,sha256=pWUdFCy7Ag89yK-p0KZ-80zKWSHHhq1u60INtauDbeA,4784
6
+ cirq_aqt/aqt_device_metadata_test.py,sha256=jzKPFEHuHJ_GeKBKCu5eQDQHak4TKFv_GmLIR9Wfm80,2146
7
+ cirq_aqt/aqt_device_test.py,sha256=uu9EWQAOZ8bw0fvlRgFPcmLqJvhu48sLjVBJHOLVrH0,5367
8
+ cirq_aqt/aqt_sampler.py,sha256=TlI1q671__OR8OObB5KkXHVMlld1apvr2sNDIVuxTsY,18352
9
+ cirq_aqt/aqt_sampler_test.py,sha256=2N1-cs1emcSKTQo3qTdHqsddcxKndiII5RSlh8qVhwM,16646
10
+ cirq_aqt/aqt_simulator_test.py,sha256=Kwd8bnQGSA_NTymPedOo8wvy2AZHp2fWyKFW4WFhWQM,1693
11
+ cirq_aqt/aqt_target_gateset.py,sha256=ZxrmxhXwM81OL5HFJ_jrW7TkliN4X4CAJa8dIJxHaz8,2840
12
+ cirq_aqt/aqt_target_gateset_test.py,sha256=Y6xgNE_bMC1934FHQwvjoswm2gQzz6tI2wjV98EG8bo,3550
13
+ cirq_aqt/conftest.py,sha256=sl0zfNCkCC6KnRiH5uWpL8lk9xrnNZsUc8-Kff29dic,675
14
+ cirq_aqt/json_resolver_cache.py,sha256=qGUV-S69bnqqg2UAgnhVbW0ZHC8UczZr8KBmj09KCso,855
15
+ cirq_aqt/json_test_data/__init__.py,sha256=UZKkYSBrgpUKN5Y5Gb-SJzJAa7h-oTA0K3BKecMbDs8,904
16
+ cirq_aqt/json_test_data/spec.py,sha256=OfF8lLmTIVJF9ZgGoKBjx7tqYG5qvkLo6RqK19DtFCA,1050
17
+ cirq_aqt-1.6.0.dist-info/licenses/LICENSE,sha256=tAkwu8-AdEyGxGoSvJ2gVmQdcicWw3j1ZZueVV74M-E,11357
18
+ cirq_aqt-1.6.0.dist-info/METADATA,sha256=4tx18WlZxRmS9Njp6FlJogWhLinj73B2mwYBuEqGC1c,4742
19
+ cirq_aqt-1.6.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
20
+ cirq_aqt-1.6.0.dist-info/top_level.txt,sha256=culYyFTEtuC3Z7wT3wZ6kGVspH3hYFZUEKooByfe9h0,9
21
+ cirq_aqt-1.6.0.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (78.1.0)
2
+ Generator: setuptools (80.9.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
@@ -1,21 +0,0 @@
1
- cirq_aqt/__init__.py,sha256=M8r1U_8xYpcIUhs8U110BFWQ4jUCqS9IQf8trjq0rvI,888
2
- cirq_aqt/_version.py,sha256=3GU-zPgCtchXFgrwB3SikjWlsAgvCqjADns6L9AhfZw,696
3
- cirq_aqt/_version_test.py,sha256=nKoetYJMqlQ19nTJf9KIBk8bq8AD7TgO8oNeE4BZqAg,155
4
- cirq_aqt/aqt_device.py,sha256=kiKhKPSUmebzFRiZrF7cq76ueHCC3SMF2CVrAAc6NfI,13648
5
- cirq_aqt/aqt_device_metadata.py,sha256=2YIDZKJbt0iHdplBkjfDWK9FSbTzp6m_ggJTcFJfphk,4753
6
- cirq_aqt/aqt_device_metadata_test.py,sha256=naTXEU4VCCdR__gBlzbWjR0-DzViZ1xgVrH_GAyjskY,2111
7
- cirq_aqt/aqt_device_test.py,sha256=eYHT1DIt3EI_4e-rSROiUw5_E4A9Bjt8tIchvUrKnxs,5210
8
- cirq_aqt/aqt_sampler.py,sha256=wBgTenfELWTx1fCMFaTio9WYpxiBiQndWNp8NAEsfMk,18378
9
- cirq_aqt/aqt_sampler_test.py,sha256=cA68zrJTh57Ge8TW6xd4Q__l0wah_VJ4k6BL_SVPnHw,16403
10
- cirq_aqt/aqt_simulator_test.py,sha256=QjqR6cULJdHEdTI4IxFCaJkhPIvR728hYCvg4RLPW-A,1641
11
- cirq_aqt/aqt_target_gateset.py,sha256=-dxZ-dAEAZHtjPjTJ3VpTipXyYLI5m9-9skOCJmmAAE,2772
12
- cirq_aqt/aqt_target_gateset_test.py,sha256=mZuuDvBl-o6l7ShNzcf_BrIc79I00To_RHt3y7hyOHg,3335
13
- cirq_aqt/conftest.py,sha256=2-K0ZniZ28adwVNB-f5IqvYjavKEBwC4jes_WQ17Xzg,667
14
- cirq_aqt/json_resolver_cache.py,sha256=oZUTckLvATBDSrn-Y6kEAjHjiGXtKc-Bz_i23WsxFj8,788
15
- cirq_aqt/json_test_data/__init__.py,sha256=UZKkYSBrgpUKN5Y5Gb-SJzJAa7h-oTA0K3BKecMbDs8,904
16
- cirq_aqt/json_test_data/spec.py,sha256=OfF8lLmTIVJF9ZgGoKBjx7tqYG5qvkLo6RqK19DtFCA,1050
17
- cirq_aqt-1.5.0.dev20250409222543.dist-info/licenses/LICENSE,sha256=tAkwu8-AdEyGxGoSvJ2gVmQdcicWw3j1ZZueVV74M-E,11357
18
- cirq_aqt-1.5.0.dev20250409222543.dist-info/METADATA,sha256=5V2HLoqj8ndxN9iTMuDkTqG4ftj7YQqwN4pYKW-R_9s,4829
19
- cirq_aqt-1.5.0.dev20250409222543.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
20
- cirq_aqt-1.5.0.dev20250409222543.dist-info/top_level.txt,sha256=culYyFTEtuC3Z7wT3wZ6kGVspH3hYFZUEKooByfe9h0,9
21
- cirq_aqt-1.5.0.dev20250409222543.dist-info/RECORD,,