azure-quantum 1.0.0.dev1__py3-none-any.whl → 1.1.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.
Files changed (53) hide show
  1. azure/quantum/__init__.py +6 -0
  2. azure/quantum/_client/_version.py +1 -1
  3. azure/quantum/argument_types/__init__.py +3 -0
  4. azure/quantum/argument_types/types.py +19 -0
  5. azure/quantum/cirq/__init__.py +6 -0
  6. azure/quantum/cirq/job.py +9 -1
  7. azure/quantum/cirq/service.py +25 -12
  8. azure/quantum/cirq/targets/__init__.py +2 -0
  9. azure/quantum/job/__init__.py +22 -5
  10. azure/quantum/job/base_job.py +25 -17
  11. azure/quantum/job/filtered_job.py +6 -0
  12. azure/quantum/job/job.py +4 -4
  13. azure/quantum/job/session.py +17 -7
  14. azure/quantum/job/workspace_item.py +7 -2
  15. azure/quantum/qiskit/backends/__init__.py +2 -0
  16. azure/quantum/qiskit/backends/backend.py +9 -5
  17. azure/quantum/qiskit/backends/quantinuum.py +1 -1
  18. azure/quantum/qiskit/provider.py +13 -10
  19. azure/quantum/target/__init__.py +11 -5
  20. azure/quantum/target/ionq.py +3 -3
  21. azure/quantum/target/microsoft/__init__.py +3 -0
  22. azure/quantum/target/microsoft/elements/__init__.py +1 -0
  23. azure/quantum/target/microsoft/elements/dft/__init__.py +2 -0
  24. azure/quantum/target/microsoft/elements/dft/job.py +17 -0
  25. azure/quantum/target/microsoft/elements/dft/target.py +21 -0
  26. azure/quantum/target/microsoft/job.py +8 -0
  27. azure/quantum/target/microsoft/target.py +19 -1
  28. azure/quantum/target/params.py +3 -0
  29. azure/quantum/target/pasqal/result.py +11 -5
  30. azure/quantum/target/pasqal/target.py +2 -0
  31. azure/quantum/target/quantinuum.py +9 -10
  32. azure/quantum/target/rigetti/result.py +2 -0
  33. azure/quantum/target/rigetti/target.py +4 -5
  34. azure/quantum/target/target.py +38 -3
  35. azure/quantum/target/target_factory.py +2 -8
  36. azure/quantum/version.py +1 -1
  37. azure/quantum/workspace.py +40 -15
  38. {azure_quantum-1.0.0.dev1.dist-info → azure_quantum-1.1.0.dist-info}/METADATA +16 -17
  39. azure_quantum-1.1.0.dist-info/RECORD +76 -0
  40. azure/quantum/optimization/__init__.py +0 -11
  41. azure/quantum/optimization/online_problem.py +0 -21
  42. azure/quantum/optimization/problem.py +0 -393
  43. azure/quantum/optimization/solvers.py +0 -10
  44. azure/quantum/optimization/streaming_problem.py +0 -387
  45. azure/quantum/optimization/term.py +0 -203
  46. azure/quantum/optimization/toshiba/__init__.py +0 -10
  47. azure/quantum/optimization/toshiba/solvers.py +0 -12
  48. azure/quantum/target/solvers.py +0 -382
  49. azure/quantum/target/toshiba/__init__.py +0 -7
  50. azure/quantum/target/toshiba/solvers.py +0 -130
  51. azure_quantum-1.0.0.dev1.dist-info/RECORD +0 -86
  52. {azure_quantum-1.0.0.dev1.dist-info → azure_quantum-1.1.0.dist-info}/WHEEL +0 -0
  53. {azure_quantum-1.0.0.dev1.dist-info → azure_quantum-1.1.0.dist-info}/top_level.txt +0 -0
azure/quantum/__init__.py CHANGED
@@ -3,6 +3,9 @@
3
3
  # Licensed under the MIT License.
4
4
  ##
5
5
 
6
+ """Defines interfaces for interacting with Azure Quantum"""
7
+
8
+
6
9
  import logging
7
10
  from .version import __version__
8
11
 
@@ -14,3 +17,6 @@ from ._client.models._enums import JobStatus, SessionStatus, SessionJobFailurePo
14
17
 
15
18
  logger = logging.getLogger(__name__)
16
19
  logger.info(f"version: {__version__}")
20
+
21
+
22
+ __all__ = [ "Workspace" ]
@@ -6,4 +6,4 @@
6
6
  # Changes may cause incorrect behavior and will be lost if the code is regenerated.
7
7
  # --------------------------------------------------------------------------
8
8
 
9
- VERSION = "1.0.0.dev1"
9
+ VERSION = "1.1.0"
@@ -2,6 +2,9 @@
2
2
  # Copyright (c) Microsoft Corporation. All rights reserved.
3
3
  # Licensed under the MIT License.
4
4
  ##
5
+
6
+ """Defines argument types for Microsoft Estimator"""
7
+
5
8
  from .types import EmptyArray, Pauli, Range, Result
6
9
 
7
10
  __all__ = ['EmptyArray', 'Pauli', 'Range', 'Result']
@@ -7,6 +7,8 @@ from enum import Enum
7
7
  from typing import Optional, Type
8
8
 
9
9
  class Pauli(Enum):
10
+ """Pauli operators"""
11
+
10
12
  I = "PauliI"
11
13
  X = "PauliX"
12
14
  Y = "PauliY"
@@ -14,18 +16,32 @@ class Pauli(Enum):
14
16
 
15
17
 
16
18
  class Result(Enum):
19
+ """Result value"""
20
+
17
21
  Zero = False
18
22
  One = True
19
23
 
20
24
 
21
25
  @dataclass
22
26
  class Range:
27
+ """Range value
28
+
29
+ :param start: Start
30
+ :type start: int
31
+ :param end: End
32
+ :type end: int
33
+ :param step: Step
34
+ :type step: int
35
+ """
36
+
23
37
  start: int
24
38
  end: int
25
39
  step: Optional[int] = None
26
40
 
27
41
  @property
28
42
  def value(self):
43
+ """Range value"""
44
+
29
45
  if self.step is None:
30
46
  return {"start": self.start, "end": self.end}
31
47
  else:
@@ -33,4 +49,7 @@ class Range:
33
49
 
34
50
  @dataclass
35
51
  class EmptyArray:
52
+ """Empty array value"""
53
+
36
54
  element_type: Type
55
+ """Element type"""
@@ -2,4 +2,10 @@
2
2
  # Copyright (c) Microsoft Corporation.
3
3
  # Licensed under the MIT License.
4
4
  ##
5
+
6
+ """Azure Quantum Cirq Service"""
7
+
5
8
  from .service import AzureQuantumService
9
+ from .job import Job
10
+
11
+ __all__ = ["AzureQuantumService", "Job"]
azure/quantum/cirq/job.py CHANGED
@@ -20,7 +20,15 @@ class Job:
20
20
  program: "cirq.Circuit",
21
21
  measurement_dict: dict = None
22
22
  ):
23
- """Construct a Job."""
23
+ """Construct a Job.
24
+
25
+ :param azure_job: Job
26
+ :type azure_job: azure.quantum.job.Job
27
+ :param program: Cirq program
28
+ :type program: cirq.Circuit
29
+ :param measurement_dict: Measurments
30
+ :type measurement_dict: dict
31
+ """
24
32
  self._azure_job = azure_job
25
33
  self._program = program
26
34
  self._measurement_dict = measurement_dict
@@ -39,9 +39,9 @@ class AzureQuantumService:
39
39
  """AzureQuantumService class
40
40
 
41
41
  :param workspace: Azure Quantum workspace. If missing it will create a new Workspace passing `kwargs` to the constructor. Defaults to None.
42
- :type workspace: Workspace, optional
42
+ :type workspace: Workspace
43
43
  :param default_target: Default target name, defaults to None
44
- :type default_target: Optional[str], optional
44
+ :type default_target: Optional[str]
45
45
  """
46
46
  if kwargs is not None and len(kwargs) > 0:
47
47
  from warnings import warn
@@ -80,9 +80,9 @@ class AzureQuantumService:
80
80
  """Get all quantum computing targets available in the Azure Quantum Workspace.
81
81
 
82
82
  :param name: Target name, defaults to None
83
- :type name: str, optional
83
+ :type name: str
84
84
  :return: Target instance or list thereof
85
- :rtype: Union[Target, List[Target]]
85
+ :rtype: typing.Union[Target, typing.List[Target]]
86
86
  """
87
87
  return self._target_factory.get_targets(
88
88
  name=name,
@@ -95,7 +95,7 @@ class AzureQuantumService:
95
95
  :param name: Target name
96
96
  :type name: str
97
97
  :return: Cirq target
98
- :rtype: CirqTarget
98
+ :rtype: Target
99
99
  """
100
100
  if name is None:
101
101
  if self._default_target is None:
@@ -111,7 +111,7 @@ class AzureQuantumService:
111
111
  :param job_id: Job ID
112
112
  :type job_id: str
113
113
  :return: Job
114
- :rtype: azure.quantum.cirq.Job or cirq_ionq.Job
114
+ :rtype: azure.quantum.cirq.Job
115
115
  """
116
116
  job = self._workspace.get_job(job_id=job_id)
117
117
  target : CirqTarget = self._target_factory.create_target(
@@ -168,6 +168,19 @@ see https://aka.ms/AQ/Docs/AddProvider")
168
168
  param_resolver: cirq.ParamResolverOrSimilarType = cirq.ParamResolver({}),
169
169
  **kwargs
170
170
  ):
171
+ """
172
+ Estimate the cost for a given circuit.
173
+
174
+ :param program: Cirq program or circuit
175
+ :type program: cirq.Circuit
176
+ :param repetitions: Number of measurement repetitions
177
+ :type repetitions: int
178
+ :param target: Target name, defaults to default_target
179
+ :type target: str
180
+ :param param_resolver: Cirq parameters, defaults to `cirq.ParamResolver({})`
181
+ :type param_resolver: cirq.ParamResolverOrSimilarType
182
+ """
183
+
171
184
  # Resolve parameters
172
185
  resolved_circuit = cirq.resolve_parameters(program, param_resolver)
173
186
  target = self.get_target(name=target)
@@ -194,15 +207,15 @@ see https://aka.ms/AQ/Docs/AddProvider")
194
207
  :param repetitions: Number of measurement repetitions
195
208
  :type repetitions: int
196
209
  :param target: Target name, defaults to default_target
197
- :type target: str, optional
210
+ :type target: str
198
211
  :param name: Program name, defaults to "cirq-job"
199
- :type name: str, optional
200
- :param param_resolver: Cirq parameters, defaults to cirq.ParamResolver({})
201
- :type param_resolver: cirq.ParamResolverOrSimilarType, optional
212
+ :type name: str
213
+ :param param_resolver: Cirq parameters, defaults to `cirq.ParamResolver({})`
214
+ :type param_resolver: cirq.ParamResolverOrSimilarType
202
215
  :param seed: Random seed for simulator results, defaults to None
203
- :type seed: cirq.RANDOM_STATE_OR_SEED_LIKE, optional
216
+ :type seed: cirq.RANDOM_STATE_OR_SEED_LIKE
204
217
  :param timeout_seconds: Timeout in seconds, defaults to None
205
- :type timeout_seconds: int, optional
218
+ :type timeout_seconds: int
206
219
  :return: Measurement results
207
220
  :rtype: cirq.Result
208
221
  """
@@ -3,6 +3,8 @@
3
3
  # Licensed under the MIT License.
4
4
  ##
5
5
 
6
+ """Defines set of Cirq targets for interacting with Azure Quantum"""
7
+
6
8
  from azure.quantum.cirq.targets.target import Target
7
9
  from azure.quantum.cirq.targets.quantinuum import QuantinuumTarget
8
10
  from azure.quantum.cirq.targets.ionq import IonQTarget
@@ -3,9 +3,26 @@
3
3
  # Licensed under the MIT License.
4
4
  ##
5
5
 
6
- from azure.quantum.job.job import Job
7
- from azure.quantum.job.job_failed_with_results_error import JobFailedWithResultsError
8
- from azure.quantum.job.workspace_item import WorkspaceItem
9
- from azure.quantum.job.workspace_item_factory import WorkspaceItemFactory
10
- from azure.quantum.job.session import Session, SessionHost
6
+ """Defines Azure Quantum job model"""
7
+
11
8
  from azure.quantum._client.models import JobDetails
9
+ from .base_job import BaseJob
10
+ from .filtered_job import FilteredJob
11
+ from .job import Job
12
+ from .job_failed_with_results_error import JobFailedWithResultsError
13
+ from .workspace_item import WorkspaceItem
14
+ from .workspace_item_factory import WorkspaceItemFactory
15
+ from .session import Session, SessionHost, SessionDetails, SessionStatus, SessionJobFailurePolicy
16
+
17
+ __all__ = [
18
+ "Job",
19
+ "JobDetails",
20
+ "BaseJob",
21
+ "FilteredJob",
22
+ "WorkspaceItem",
23
+ "Session",
24
+ "SessionHost",
25
+ "SessionDetails",
26
+ "SessionStatus",
27
+ "SessionJobFailurePolicy"
28
+ ]
@@ -33,6 +33,12 @@ class BaseJob(WorkspaceItem):
33
33
  """
34
34
  Base job class with methods to create a job from raw blob data,
35
35
  upload blob data and download results.
36
+
37
+ :param workspace: Workspace instance of the job
38
+ :type workspace: Workspace
39
+ :param details: Item details model,
40
+ contains item ID, name and other details
41
+ :type details: ItemDetails
36
42
  """
37
43
 
38
44
  @staticmethod
@@ -42,6 +48,7 @@ class BaseJob(WorkspaceItem):
42
48
 
43
49
  @property
44
50
  def details(self) -> JobDetails:
51
+ """Job details"""
45
52
  return self._details
46
53
 
47
54
  @details.setter
@@ -50,6 +57,7 @@ class BaseJob(WorkspaceItem):
50
57
 
51
58
  @property
52
59
  def container_name(self):
60
+ """Job input/output data container name"""
53
61
  return f"job-{self.id}"
54
62
 
55
63
  @classmethod
@@ -74,7 +82,7 @@ class BaseJob(WorkspaceItem):
74
82
  """Create a new Azure Quantum job based on a raw input_data payload.
75
83
 
76
84
  :param workspace: Azure Quantum workspace to submit the input_data to
77
- :type workspace: "Workspace"
85
+ :type workspace: Workspace
78
86
  :param name: Name of the job
79
87
  :type name: str
80
88
  :param target: Azure Quantum target
@@ -88,17 +96,17 @@ class BaseJob(WorkspaceItem):
88
96
  :param encoding: input_data encoding, e.g. "gzip", defaults to empty string
89
97
  :type encoding: str
90
98
  :param job_id: Job ID, defaults to None
91
- :type job_id: str, optional
99
+ :type job_id: str
92
100
  :param container_name: Container name, defaults to None
93
101
  :type container_name: str
94
102
  :param provider_id: Provider ID, defaults to None
95
- :type provider_id: str, optional
103
+ :type provider_id: str
96
104
  :param input_data_format: Input data format, defaults to None
97
- :type input_data_format: str, optional
105
+ :type input_data_format: str
98
106
  :param output_data_format: Output data format, defaults to None
99
- :type output_data_format: str, optional
107
+ :type output_data_format: str
100
108
  :param input_params: Input parameters, defaults to None
101
- :type input_params: Dict[str, Any], optional
109
+ :type input_params: Dict[str, Any]
102
110
  :param input_params: Input params for job
103
111
  :type input_params: Dict[str, Any]
104
112
  :return: Azure Quantum Job
@@ -161,7 +169,7 @@ class BaseJob(WorkspaceItem):
161
169
  to blob storage
162
170
 
163
171
  :param workspace: Azure Quantum workspace to submit the blob to
164
- :type workspace: "Workspace"
172
+ :type workspace: Workspace
165
173
  :param name: Job name
166
174
  :type name: str
167
175
  :param target: Azure Quantum target
@@ -169,17 +177,17 @@ class BaseJob(WorkspaceItem):
169
177
  :param input_data_uri: Input data URI
170
178
  :type input_data_uri: str
171
179
  :param provider_id: Provider ID
172
- :type provider_id: str, optional
180
+ :type provider_id: str
173
181
  :param input_data_format: Input data format
174
- :type input_data_format: str, optional
182
+ :type input_data_format: str
175
183
  :param output_data_format: Output data format
176
- :type output_data_format: str, optional
184
+ :type output_data_format: str
177
185
  :param container_uri: Container URI, defaults to None
178
186
  :type container_uri: str
179
187
  :param job_id: Pre-generated job ID, defaults to None
180
188
  :type job_id: str
181
189
  :param input_params: Input parameters, defaults to None
182
- :type input_params: Dict[str, Any], optional
190
+ :type input_params: Dict[str, Any]
183
191
  :param submit_job: If job should be submitted to the service, defaults to True
184
192
  :type submit_job: bool
185
193
  :return: Job instance
@@ -212,7 +220,7 @@ class BaseJob(WorkspaceItem):
212
220
  job = cls(workspace, details, **kwargs)
213
221
 
214
222
  logger.info(
215
- f"Submitting problem '{name}'. \
223
+ f"Submitting job '{name}'. \
216
224
  Using payload from: '{job.details.input_data_uri}'"
217
225
  )
218
226
 
@@ -240,11 +248,11 @@ class BaseJob(WorkspaceItem):
240
248
  :param content_type: Content type, e.g. "application/json"
241
249
  :type content_type: Optional, ContentType
242
250
  :param blob_name: Blob name, defaults to "inputData"
243
- :type blob_name: str, optional
251
+ :type blob_name: str
244
252
  :param encoding: Encoding, e.g. "gzip", defaults to ""
245
- :type encoding: str, optional
253
+ :type encoding: str
246
254
  :param return_sas_token: Flag to return SAS token as part of URI, defaults to False
247
- :type return_sas_token: bool, optional
255
+ :type return_sas_token: bool
248
256
  :return: Uploaded data URI
249
257
  :rtype: str
250
258
  """
@@ -306,7 +314,7 @@ class BaseJob(WorkspaceItem):
306
314
  :param data: Attachment data in binary format
307
315
  :type input_data: bytes
308
316
  :param container_uri: Container URI, defaults to the job's linked container.
309
- :type container_uri: str, Optional
317
+ :type container_uri: str
310
318
 
311
319
  :return: Uploaded data URI
312
320
  :rtype: str
@@ -336,7 +344,7 @@ class BaseJob(WorkspaceItem):
336
344
  :param name: Attachment name
337
345
  :type name: str
338
346
  :param container_uri: Container URI, defaults to the job's linked container.
339
- :type container_uri: str, Optional
347
+ :type container_uri: str
340
348
 
341
349
  :return: Attachment data
342
350
  :rtype: bytes
@@ -22,9 +22,15 @@ class FilteredJob(abc.ABC):
22
22
  created_after: Optional[datetime] = None
23
23
  ) -> bool:
24
24
  """Checks if job (self) matches the given properties if any.
25
+
25
26
  :param name_match: regex expression for job name matching
27
+ :type name_match: str
26
28
  :param status: filter by job status
29
+ :type status: Optional[JobStatus]
27
30
  :param created_after: filter jobs after time of job creation
31
+ :type status: Optional[datetime]
32
+ :return: Is filter match
33
+ :rtype: bool
28
34
  """
29
35
  if name_match is not None and re.search(name_match, self.details.name) is None:
30
36
  return False
azure/quantum/job/job.py CHANGED
@@ -74,11 +74,11 @@ class Job(BaseJob, FilteredJob):
74
74
  until it reaches a finished status.
75
75
 
76
76
  :param max_poll_wait_secs: Maximum poll wait time, defaults to 30
77
- :type max_poll_wait_secs: int, optional
77
+ :type max_poll_wait_secs: int
78
78
  :param timeout_secs: Timeout in seconds, defaults to None
79
- :type timeout_secs: int, optional
79
+ :type timeout_secs: int
80
80
  :param print_progress: Print "." to stdout to display progress
81
- :type print_progress: bool, optional
81
+ :type print_progress: bool
82
82
  :raises TimeoutError: If the total poll time exceeds timeout, raise
83
83
  """
84
84
  self.refresh()
@@ -107,7 +107,7 @@ class Job(BaseJob, FilteredJob):
107
107
  storage container linked via the workspace.
108
108
 
109
109
  :param timeout_secs: Timeout in seconds, defaults to 300
110
- :type timeout_secs: int
110
+ :type timeout_secs: float
111
111
  :raises RuntimeError: Raises RuntimeError if job execution failed
112
112
  :return: Results dictionary with histogram shots, or raw results if not a json object.
113
113
  """
@@ -103,6 +103,7 @@ class Session(WorkspaceItem):
103
103
  @property
104
104
  def details(self) -> SessionDetails:
105
105
  """Get the session details.
106
+
106
107
  :return: The details about the session.
107
108
  :rtype: SessionDetails
108
109
  """
@@ -111,6 +112,7 @@ class Session(WorkspaceItem):
111
112
  @details.setter
112
113
  def details(self, value: SessionDetails):
113
114
  """Set session details.
115
+
114
116
  :param value: The details about the session
115
117
  :type value: SessionDetails
116
118
  """
@@ -119,6 +121,7 @@ class Session(WorkspaceItem):
119
121
  @property
120
122
  def target(self) -> "Target":
121
123
  """Get the target associated with the session.
124
+
122
125
  :return: The target associated with the session.
123
126
  :rtype: Target
124
127
  """
@@ -157,7 +160,7 @@ class Session(WorkspaceItem):
157
160
  """Lists all jobs associated with this session.
158
161
 
159
162
  :return: A list of all jobs associated with this session.
160
- :rtype: List[Job]
163
+ :rtype: typing.List[Job]
161
164
  """
162
165
  return self.workspace.list_session_jobs(session_id=self.id)
163
166
 
@@ -199,10 +202,15 @@ class SessionHost(Protocol):
199
202
  with that session.
200
203
 
201
204
  Example (job 1 to 3 will be associated the session "MySession"):
202
- with target.open_session(name="MySession") as session:
205
+
206
+ .. highlight:: python
207
+ .. code-block::
208
+
209
+ with target.open_session(name="MySession") as session:
203
210
  job1 = target.submit(input_data=input_data, job_name="Job 1")
204
211
  job2 = target.submit(input_data=input_data, job_name="Job 2")
205
212
  job3 = target.submit(input_data=input_data, job_name="Job 3")
213
+
206
214
  """
207
215
 
208
216
  _latest_session: Optional[Session] = None
@@ -212,7 +220,7 @@ class SessionHost(Protocol):
212
220
  """Get the latest (open) session associated with this object.
213
221
 
214
222
  :return: The latest session object.
215
- :rtype: Optional[Session]
223
+ :rtype: typing.Optional[Session]
216
224
  """
217
225
  return self._latest_session
218
226
 
@@ -229,7 +237,7 @@ class SessionHost(Protocol):
229
237
  This id is used to associate jobs to the latest (open) session.
230
238
 
231
239
  :return: The latest session id.
232
- :rtype: Optional[str]
240
+ :rtype: typing.Optional[str]
233
241
  """
234
242
  return self.latest_session.id if self.latest_session else None
235
243
 
@@ -258,7 +266,11 @@ class SessionHost(Protocol):
258
266
  after exiting a `with` block).
259
267
 
260
268
  Example (job 1 to 3 will be associated the session "MySession"):
261
- with target.open_session(name="MySession") as session:
269
+
270
+ .. highlight:: python
271
+ .. code-block::
272
+
273
+ with target.open_session(name="MySession") as session:
262
274
  job1 = target.submit(input_data=input_data, job_name="Job 1")
263
275
  job2 = target.submit(input_data=input_data, job_name="Job 2")
264
276
  job3 = target.submit(input_data=input_data, job_name="Job 3")
@@ -273,7 +285,6 @@ class SessionHost(Protocol):
273
285
  Either this parameter should be passed containing all
274
286
  the session detail values, the same values should be
275
287
  passed as individual parameters.
276
- :type details: Optional[SessionDetails]
277
288
 
278
289
  :param id: The id of the session. If not passed, one random uuid will used.
279
290
  :type id: Optional[str]
@@ -284,7 +295,6 @@ class SessionHost(Protocol):
284
295
 
285
296
  :param job_failure_policy: The policy that determines when a session would fail,
286
297
  close and not accept further jobs.
287
- :type job_failure_policy: Union[str, SessionJobFailurePolicy, None]
288
298
 
289
299
  :return: The session object with updated details after its opening.
290
300
  :rtype: Session
@@ -16,12 +16,13 @@ __all__ = ["WorkspaceItem"]
16
16
 
17
17
  class WorkspaceItem(abc.ABC):
18
18
  """
19
+ Workspace item base class.
19
20
 
20
21
  :param workspace: Workspace instance to submit job to
21
22
  :type workspace: Workspace
22
- :param item_details: Item details model,
23
+ :param details: Item details model,
23
24
  contains item ID, name and other details
24
- :type item_details: ItemDetails
25
+ :type details: ItemDetails
25
26
  """
26
27
 
27
28
  def __init__(self, workspace: "Workspace", details: ItemDetails, **kwargs):
@@ -31,16 +32,20 @@ class WorkspaceItem(abc.ABC):
31
32
 
32
33
  @property
33
34
  def workspace(self) -> "Workspace":
35
+ """Workspace of the Workspace item"""
34
36
  return self._workspace
35
37
 
36
38
  @property
37
39
  def details(self) -> Union[SessionDetails, JobDetails]:
40
+ """Workspace item details"""
38
41
  return self._details
39
42
 
40
43
  @property
41
44
  def id(self) -> str:
45
+ """Id of the Workspace item"""
42
46
  return self._details.id
43
47
 
44
48
  @property
45
49
  def item_type(self) -> ItemType:
50
+ """Workspace item type"""
46
51
  return self._item_type
@@ -3,6 +3,8 @@
3
3
  # Licensed under the MIT License.
4
4
  ##
5
5
 
6
+ """Defines set of backends for interacting with Azure Quantum"""
7
+
6
8
  from azure.quantum.qiskit.backends.ionq import (
7
9
  IonQBackend,
8
10
  IonQQPUBackend,
@@ -26,7 +26,7 @@ try:
26
26
  from qiskit.providers import Options
27
27
  from qiskit.providers import Provider
28
28
  from qiskit.providers.models import BackendConfiguration
29
- from qiskit.qobj import Qobj, QasmQobj
29
+ from qiskit.qobj import QasmQobj, PulseQobj
30
30
  from pyqir import Module
31
31
  from qiskit_qir import to_qir_module
32
32
 
@@ -121,7 +121,7 @@ class AzureBackendBase(Backend, SessionHost):
121
121
 
122
122
  return output_data_format
123
123
 
124
- def _get_input_params(self, options, shots: int = None) -> Dict[str, Any]:
124
+ def _get_input_params(self, options: Dict[str, Any], shots: int = None) -> Dict[str, Any]:
125
125
  # Backend options are mapped to input_params.
126
126
  input_params: Dict[str, Any] = vars(self.options).copy()
127
127
 
@@ -132,7 +132,7 @@ class AzureBackendBase(Backend, SessionHost):
132
132
  # First we check for the explicitly specified 'shots' parameter, then for a provider-specific
133
133
  # field in options, then for a backend's default value.
134
134
 
135
- # Warn abount options conflict, default to 'shots'.
135
+ # Warn about options conflict, default to 'shots'.
136
136
  if shots is not None and options_shots is not None:
137
137
  warnings.warn(
138
138
  f"Parameter 'shots' conflicts with the '{self.__class__._SHOTS_PARAM_NAME}' parameter. "
@@ -159,6 +159,10 @@ class AzureBackendBase(Backend, SessionHost):
159
159
  input_params["shots"] = final_shots
160
160
  input_params["count"] = final_shots
161
161
 
162
+ # Safely removing "shots" and "count" from options as they will be passed in input_params now.
163
+ _ = options.pop("shots", None)
164
+ _ = options.pop("count", None)
165
+
162
166
  input_params[self.__class__._SHOTS_PARAM_NAME] = final_shots
163
167
 
164
168
 
@@ -468,13 +472,13 @@ class AzureBackend(AzureBackendBase):
468
472
 
469
473
  # If the circuit was created using qiskit.assemble,
470
474
  # disassemble into QASM here
471
- if isinstance(circuit, QasmQobj) or isinstance(circuit, Qobj):
475
+ if isinstance(circuit, QasmQobj) or isinstance(circuit, PulseQobj):
472
476
  from qiskit.assembler import disassemble
473
477
 
474
478
  circuits, run, _ = disassemble(circuit)
475
479
  circuit = circuits[0]
476
480
  if options.get("shots") is None:
477
- # Note that the default number of shots for QObj is 1024
481
+ # Note that qiskit.assembler.disassemble() sets the default number of shots for QasmQobj and PulseQobj to 1024
478
482
  # unless the user specifies the backend.
479
483
  options["shots"] = run["shots"]
480
484
 
@@ -270,7 +270,7 @@ class QuantinuumBackend(AzureBackend):
270
270
  input_data = circuit.qasm()
271
271
  workspace = self.provider().get_workspace()
272
272
  target = workspace.get_targets(self.name())
273
- return target.estimate_cost(input_data, shots)
273
+ return target.estimate_cost(input_data, shots=shots)
274
274
 
275
275
  def _get_n_qubits(self, name):
276
276
  return _get_n_qubits(name)