azure-quantum 0.29.2__py3-none-any.whl → 1.0.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.
- azure/quantum/_client/_version.py +1 -1
- azure/quantum/cirq/service.py +7 -0
- azure/quantum/cirq/targets/quantinuum.py +1 -1
- azure/quantum/job/__init__.py +1 -0
- azure/quantum/job/base_job.py +41 -15
- azure/quantum/job/job.py +35 -1
- azure/quantum/job/job_failed_with_results_error.py +41 -0
- azure/quantum/qiskit/backends/backend.py +130 -35
- azure/quantum/qiskit/backends/ionq.py +65 -5
- azure/quantum/qiskit/backends/qci.py +35 -2
- azure/quantum/qiskit/backends/quantinuum.py +25 -4
- azure/quantum/qiskit/backends/rigetti.py +8 -1
- azure/quantum/qiskit/job.py +7 -16
- azure/quantum/qiskit/provider.py +18 -2
- azure/quantum/storage.py +2 -1
- azure/quantum/target/__init__.py +1 -0
- azure/quantum/target/ionq.py +37 -12
- azure/quantum/target/microsoft/elements/dft/__init__.py +4 -0
- azure/quantum/target/microsoft/elements/dft/job.py +46 -0
- azure/quantum/target/microsoft/elements/dft/target.py +66 -0
- azure/quantum/target/microsoft/target.py +36 -9
- azure/quantum/target/params.py +1 -1
- azure/quantum/target/pasqal/target.py +16 -2
- azure/quantum/target/quantinuum.py +34 -9
- azure/quantum/target/rigetti/target.py +21 -3
- azure/quantum/target/solvers.py +7 -1
- azure/quantum/target/target.py +82 -0
- azure/quantum/target/target_factory.py +0 -2
- azure/quantum/version.py +1 -1
- azure/quantum/workspace.py +11 -8
- {azure_quantum-0.29.2.dist-info → azure_quantum-1.0.0.dist-info}/METADATA +3 -5
- azure_quantum-1.0.0.dist-info/RECORD +86 -0
- azure/quantum/_client/aio/__init__.py +0 -23
- azure/quantum/_client/aio/_client.py +0 -124
- azure/quantum/_client/aio/_configuration.py +0 -89
- azure/quantum/_client/aio/_patch.py +0 -20
- azure/quantum/_client/aio/operations/__init__.py +0 -29
- azure/quantum/_client/aio/operations/_operations.py +0 -1291
- azure/quantum/_client/aio/operations/_patch.py +0 -20
- azure/quantum/aio/__init__.py +0 -14
- azure/quantum/aio/_authentication/__init__.py +0 -9
- azure/quantum/aio/_authentication/_chained.py +0 -94
- azure/quantum/aio/_authentication/_default.py +0 -212
- azure/quantum/aio/_authentication/_token.py +0 -81
- azure/quantum/aio/job/__init__.py +0 -1
- azure/quantum/aio/job/base_job.py +0 -326
- azure/quantum/aio/job/job.py +0 -104
- azure/quantum/aio/optimization/__init__.py +0 -11
- azure/quantum/aio/optimization/online_problem.py +0 -17
- azure/quantum/aio/optimization/problem.py +0 -102
- azure/quantum/aio/optimization/streaming_problem.py +0 -280
- azure/quantum/aio/storage.py +0 -390
- azure/quantum/aio/target/__init__.py +0 -19
- azure/quantum/aio/target/ionq.py +0 -47
- azure/quantum/aio/target/quantinuum.py +0 -47
- azure/quantum/aio/target/solvers.py +0 -96
- azure/quantum/aio/target/target.py +0 -68
- azure/quantum/aio/target/target_factory.py +0 -72
- azure/quantum/aio/target/toshiba.py +0 -6
- azure/quantum/aio/workspace.py +0 -337
- azure_quantum-0.29.2.dist-info/RECORD +0 -110
- {azure_quantum-0.29.2.dist-info → azure_quantum-1.0.0.dist-info}/WHEEL +0 -0
- {azure_quantum-0.29.2.dist-info → azure_quantum-1.0.0.dist-info}/top_level.txt +0 -0
|
@@ -29,6 +29,7 @@ class RigettiTarget(str, Enum):
|
|
|
29
29
|
QVM = "rigetti.sim.qvm"
|
|
30
30
|
"""A simulator target for Quil. See https://github.com/quil-lang/qvm for more info."""
|
|
31
31
|
|
|
32
|
+
ANKAA_9Q_1 = "rigetti.qpu.ankaa-9q-1"
|
|
32
33
|
ASPEN_M_3 = "rigetti.qpu.aspen-m-3"
|
|
33
34
|
ANKAA_2 = "rigetti.qpu.ankaa-2"
|
|
34
35
|
|
|
@@ -41,13 +42,17 @@ class RigettiTarget(str, Enum):
|
|
|
41
42
|
def qpus() -> List[str]:
|
|
42
43
|
"""Returns a list of QPU targets"""
|
|
43
44
|
return [
|
|
45
|
+
RigettiTarget.ANKAA_9Q_1.value,
|
|
44
46
|
RigettiTarget.ASPEN_M_3.value,
|
|
45
47
|
RigettiTarget.ANKAA_2.value,
|
|
46
48
|
]
|
|
47
49
|
|
|
48
50
|
def num_qubits(target_name) -> int:
|
|
49
51
|
"""Returns the number of qubits supported by the given target"""
|
|
50
|
-
|
|
52
|
+
|
|
53
|
+
if target_name == RigettiTarget.ANKAA_9Q_1.value:
|
|
54
|
+
return 9
|
|
55
|
+
elif target_name == RigettiTarget.QVM.value:
|
|
51
56
|
return 20
|
|
52
57
|
elif target_name == RigettiTarget.ASPEN_M_3.value:
|
|
53
58
|
return 80
|
|
@@ -129,6 +134,8 @@ class Rigetti(Target):
|
|
|
129
134
|
|
|
130
135
|
target_names = tuple(target.value for target in RigettiTarget)
|
|
131
136
|
|
|
137
|
+
_SHOTS_PARAM_NAME = "count"
|
|
138
|
+
|
|
132
139
|
def __init__(
|
|
133
140
|
self,
|
|
134
141
|
workspace: Workspace,
|
|
@@ -156,6 +163,7 @@ class Rigetti(Target):
|
|
|
156
163
|
self,
|
|
157
164
|
input_data: Any,
|
|
158
165
|
name: str = "azure-quantum-job",
|
|
166
|
+
shots: int = None,
|
|
159
167
|
input_params: Union[InputParams, None, Dict[str, Any]] = None,
|
|
160
168
|
**kwargs,
|
|
161
169
|
) -> Job:
|
|
@@ -168,6 +176,8 @@ class Rigetti(Target):
|
|
|
168
176
|
:type input_data: Any
|
|
169
177
|
:param name: Job name
|
|
170
178
|
:type name: str
|
|
179
|
+
:param shots: Number of shots, defaults to None
|
|
180
|
+
:type shots: int
|
|
171
181
|
:param input_params: Input parameters, see :class:`azure.quantum.target.rigetti.InputParams` for details.
|
|
172
182
|
:type input_params: Union[InputParams, None, Dict[str, Any]]
|
|
173
183
|
:return: Azure Quantum job
|
|
@@ -176,10 +186,18 @@ class Rigetti(Target):
|
|
|
176
186
|
if isinstance(input_params, InputParams):
|
|
177
187
|
typed_input_params = input_params
|
|
178
188
|
input_params = {
|
|
179
|
-
|
|
189
|
+
Rigetti._SHOTS_PARAM_NAME: typed_input_params.count,
|
|
180
190
|
"skipQuilc": typed_input_params.skip_quilc,
|
|
181
191
|
}
|
|
182
192
|
if typed_input_params.substitutions is not None:
|
|
183
193
|
input_params["substitutions"] = typed_input_params.substitutions
|
|
194
|
+
elif input_params is None:
|
|
195
|
+
input_params = {}
|
|
184
196
|
|
|
185
|
-
return super().submit(
|
|
197
|
+
return super().submit(
|
|
198
|
+
input_data=input_data,
|
|
199
|
+
name=name,
|
|
200
|
+
shots=shots,
|
|
201
|
+
input_params=input_params,
|
|
202
|
+
**kwargs
|
|
203
|
+
)
|
azure/quantum/target/solvers.py
CHANGED
|
@@ -98,7 +98,10 @@ class Solver(Target):
|
|
|
98
98
|
return data.to_blob()
|
|
99
99
|
|
|
100
100
|
def submit(
|
|
101
|
-
self,
|
|
101
|
+
self,
|
|
102
|
+
problem: Union[str, "Problem"],
|
|
103
|
+
shots: int = None
|
|
104
|
+
) -> Job:
|
|
102
105
|
"""Submits a job to execution to the associated
|
|
103
106
|
Azure Quantum Workspace.
|
|
104
107
|
|
|
@@ -107,6 +110,9 @@ class Solver(Target):
|
|
|
107
110
|
or the URL of an Azure Storage Blob where the serialized version
|
|
108
111
|
of a Problem has been uploaded.
|
|
109
112
|
"""
|
|
113
|
+
if shots is not None:
|
|
114
|
+
warnings.warn("The 'shots' parameter is ignored for solver job.")
|
|
115
|
+
|
|
110
116
|
from azure.quantum.optimization import Problem
|
|
111
117
|
if isinstance(problem, Problem):
|
|
112
118
|
return super().submit(
|
azure/quantum/target/target.py
CHANGED
|
@@ -6,6 +6,7 @@ from typing import TYPE_CHECKING, Any, Dict, Optional, Union, Type, Protocol, r
|
|
|
6
6
|
import io
|
|
7
7
|
import json
|
|
8
8
|
import abc
|
|
9
|
+
import warnings
|
|
9
10
|
|
|
10
11
|
from azure.quantum._client.models import TargetStatus, SessionDetails
|
|
11
12
|
from azure.quantum._client.models._enums import SessionJobFailurePolicy
|
|
@@ -27,6 +28,9 @@ class QirRepresentable(Protocol):
|
|
|
27
28
|
|
|
28
29
|
|
|
29
30
|
class Target(abc.ABC, SessionHost):
|
|
31
|
+
|
|
32
|
+
_QSHARP_USER_AGENT = "azure-quantum-qsharp"
|
|
33
|
+
|
|
30
34
|
"""Azure Quantum Target."""
|
|
31
35
|
# Target IDs that are compatible with this Target class.
|
|
32
36
|
# This variable is used by TargetFactory. To set the default
|
|
@@ -39,6 +43,10 @@ class Target(abc.ABC, SessionHost):
|
|
|
39
43
|
# submit and get_job method.
|
|
40
44
|
target_names = ()
|
|
41
45
|
|
|
46
|
+
# Name of the provider's input parameter which specifies number of shots for a submitted job.
|
|
47
|
+
# If None, target will not pass this input parameter.
|
|
48
|
+
_SHOTS_PARAM_NAME = None
|
|
49
|
+
|
|
42
50
|
def __init__(
|
|
43
51
|
self,
|
|
44
52
|
workspace: "Workspace",
|
|
@@ -101,6 +109,13 @@ avg. queue time={self._average_queue_time} s, {self._current_availability}>"
|
|
|
101
109
|
The job class used by submit and get_job. The default is Job.
|
|
102
110
|
"""
|
|
103
111
|
return Job
|
|
112
|
+
|
|
113
|
+
@classmethod
|
|
114
|
+
def _can_send_shots_input_param(cls) -> bool:
|
|
115
|
+
"""
|
|
116
|
+
Tells if provider's target class is able to specify shots number for its jobs.
|
|
117
|
+
"""
|
|
118
|
+
return cls._SHOTS_PARAM_NAME is not None
|
|
104
119
|
|
|
105
120
|
def refresh(self):
|
|
106
121
|
"""Update the target availability and queue time"""
|
|
@@ -150,6 +165,7 @@ target '{self.name}' of provider '{self.provider_id}' not found."
|
|
|
150
165
|
self,
|
|
151
166
|
input_data: Any,
|
|
152
167
|
name: str = "azure-quantum-job",
|
|
168
|
+
shots: int = None,
|
|
153
169
|
input_params: Union[Dict[str, Any], InputParams, None] = None,
|
|
154
170
|
**kwargs
|
|
155
171
|
) -> Job:
|
|
@@ -162,6 +178,8 @@ target '{self.name}' of provider '{self.provider_id}' not found."
|
|
|
162
178
|
:type input_data: Any
|
|
163
179
|
:param name: Job name
|
|
164
180
|
:type name: str
|
|
181
|
+
:param shots: Number of shots, defaults to None
|
|
182
|
+
:type shots: int
|
|
165
183
|
:param input_params: Input parameters
|
|
166
184
|
:type input_params: Dict[str, Any]
|
|
167
185
|
:return: Azure Quantum job
|
|
@@ -182,6 +200,10 @@ target '{self.name}' of provider '{self.provider_id}' not found."
|
|
|
182
200
|
input_data_format = kwargs.pop("input_data_format", "qir.v1")
|
|
183
201
|
output_data_format = kwargs.pop("output_data_format", self._qir_output_data_format())
|
|
184
202
|
content_type = kwargs.pop("content_type", "qir.v1")
|
|
203
|
+
# setting UserAgent header to indicate Q# submission
|
|
204
|
+
# TODO: this is a temporary solution. We should be setting the User-Agent header
|
|
205
|
+
# on per-job basis as targets of different types could be submitted using the same Workspace object
|
|
206
|
+
self.workspace.append_user_agent(self._QSHARP_USER_AGENT)
|
|
185
207
|
|
|
186
208
|
def _get_entrypoint(input_data):
|
|
187
209
|
# TODO: this method should be part of QirRepresentable protocol
|
|
@@ -200,6 +222,36 @@ target '{self.name}' of provider '{self.provider_id}' not found."
|
|
|
200
222
|
input_data_format = kwargs.pop("input_data_format", self.input_data_format)
|
|
201
223
|
output_data_format = kwargs.pop("output_data_format", self.output_data_format)
|
|
202
224
|
content_type = kwargs.pop("content_type", self.content_type)
|
|
225
|
+
# re-setting UserAgent header to None for passthrough
|
|
226
|
+
self.workspace.append_user_agent(None)
|
|
227
|
+
|
|
228
|
+
# Set shots number, if possible.
|
|
229
|
+
if self._can_send_shots_input_param():
|
|
230
|
+
input_params_shots = input_params.pop(self.__class__._SHOTS_PARAM_NAME, None)
|
|
231
|
+
|
|
232
|
+
# If there is a parameter conflict, choose 'shots'.
|
|
233
|
+
if shots is not None and input_params_shots is not None:
|
|
234
|
+
warnings.warn(
|
|
235
|
+
f"Parameter 'shots' conflicts with the '{self.__class__._SHOTS_PARAM_NAME}' field of the 'input_params' "
|
|
236
|
+
"parameter. Please, provide only one option for setting shots. Defaulting to 'shots' parameter."
|
|
237
|
+
)
|
|
238
|
+
final_shots = shots
|
|
239
|
+
|
|
240
|
+
# The 'shots' parameter has highest priority.
|
|
241
|
+
elif shots is not None:
|
|
242
|
+
final_shots = shots
|
|
243
|
+
# if 'shots' parameter is not specified, try a provider-specific option.
|
|
244
|
+
elif input_params_shots is not None:
|
|
245
|
+
warnings.warn(
|
|
246
|
+
f"Field '{self.__class__._SHOTS_PARAM_NAME}' from the 'input_params' parameter is subject to change in future versions. "
|
|
247
|
+
"Please, use 'shots' parameter instead."
|
|
248
|
+
)
|
|
249
|
+
final_shots = input_params_shots
|
|
250
|
+
else:
|
|
251
|
+
final_shots = None
|
|
252
|
+
|
|
253
|
+
if final_shots is not None:
|
|
254
|
+
input_params[self.__class__._SHOTS_PARAM_NAME] = final_shots
|
|
203
255
|
|
|
204
256
|
encoding = kwargs.pop("encoding", self.encoding)
|
|
205
257
|
blob = self._encode_input_data(data=input_data)
|
|
@@ -241,3 +293,33 @@ target '{self.name}' of provider '{self.provider_id}' not found."
|
|
|
241
293
|
|
|
242
294
|
def _get_azure_provider_id(self) -> str:
|
|
243
295
|
return self.provider_id
|
|
296
|
+
|
|
297
|
+
|
|
298
|
+
def _determine_shots_or_deprecated_num_shots(
|
|
299
|
+
shots: int = None,
|
|
300
|
+
num_shots: int = None,
|
|
301
|
+
) -> int:
|
|
302
|
+
"""
|
|
303
|
+
This helper function checks if the deprecated 'num_shots' parameter is specified.
|
|
304
|
+
In earlier versions it was possible to pass this parameter to specify shots number for a job,
|
|
305
|
+
but now we only check for it for compatibility reasons.
|
|
306
|
+
"""
|
|
307
|
+
final_shots = None
|
|
308
|
+
if shots is not None and num_shots is not None:
|
|
309
|
+
warnings.warn(
|
|
310
|
+
"Both 'shots' and 'num_shots' parameters were specified. Defaulting to 'shots' parameter. "
|
|
311
|
+
"Please, use 'shots' since 'num_shots' will be deprecated.",
|
|
312
|
+
category=DeprecationWarning,
|
|
313
|
+
)
|
|
314
|
+
final_shots = shots
|
|
315
|
+
|
|
316
|
+
elif shots is not None:
|
|
317
|
+
final_shots = shots
|
|
318
|
+
elif num_shots is not None:
|
|
319
|
+
warnings.warn(
|
|
320
|
+
"The 'num_shots' parameter will be deprecated. Please, use 'shots' parameter instead.",
|
|
321
|
+
category=DeprecationWarning,
|
|
322
|
+
)
|
|
323
|
+
final_shots = num_shots
|
|
324
|
+
|
|
325
|
+
return final_shots
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
# Licensed under the MIT License.
|
|
4
4
|
##
|
|
5
5
|
import warnings
|
|
6
|
-
import asyncio
|
|
7
6
|
from typing import Any, Dict, List, TYPE_CHECKING, Union, Type
|
|
8
7
|
from azure.quantum.target import *
|
|
9
8
|
|
|
@@ -63,7 +62,6 @@ class TargetFactory:
|
|
|
63
62
|
for _t in t.__subclasses__() + [t]
|
|
64
63
|
if hasattr(_t, "target_names")
|
|
65
64
|
for name in _t.target_names
|
|
66
|
-
if not asyncio.iscoroutinefunction(_t.submit)
|
|
67
65
|
}
|
|
68
66
|
|
|
69
67
|
def _target_cls(self, provider_id: str, name: str):
|
azure/quantum/version.py
CHANGED
azure/quantum/workspace.py
CHANGED
|
@@ -218,21 +218,24 @@ class Workspace:
|
|
|
218
218
|
full_user_agent = f"{full_user_agent}-{env_app_id}" if full_user_agent else env_app_id
|
|
219
219
|
return full_user_agent
|
|
220
220
|
|
|
221
|
-
def append_user_agent(self, value: str):
|
|
221
|
+
def append_user_agent(self, value: Union[str, None]):
|
|
222
222
|
"""
|
|
223
223
|
Append a new value to the Workspace's UserAgent and re-initialize the
|
|
224
224
|
QuantumClient. The values are appended using a dash.
|
|
225
225
|
|
|
226
226
|
:param value: UserAgent value to add, e.g. "azure-quantum-<plugin>"
|
|
227
227
|
"""
|
|
228
|
-
|
|
228
|
+
new_user_agent = None
|
|
229
|
+
|
|
230
|
+
if value is not None and value not in (self._user_agent or ""):
|
|
229
231
|
new_user_agent = f"{self._user_agent}-{value}" if self._user_agent else value
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
232
|
+
|
|
233
|
+
if new_user_agent != self._user_agent:
|
|
234
|
+
self._user_agent = new_user_agent
|
|
235
|
+
# We need to recreate the client for it to
|
|
236
|
+
# pick the new UserAgent
|
|
237
|
+
if self._client is not None:
|
|
238
|
+
self._client = self._create_client()
|
|
236
239
|
|
|
237
240
|
def _get_top_level_items_client(self) -> TopLevelItemsOperations:
|
|
238
241
|
return self._client.top_level_items
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: azure-quantum
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 1.0.0
|
|
4
4
|
Summary: Python client for Azure Quantum
|
|
5
5
|
Home-page: https://github.com/microsoft/azure-quantum-python
|
|
6
6
|
Author: Microsoft
|
|
@@ -16,8 +16,6 @@ Requires-Dist: azure-storage-blob <13.0.0,>=12.14.1
|
|
|
16
16
|
Requires-Dist: msrest <1.0,>=0.7.1
|
|
17
17
|
Requires-Dist: numpy <2.0,>=1.21.0
|
|
18
18
|
Requires-Dist: deprecated <2.0,>=1.2.12
|
|
19
|
-
Requires-Dist: aiohttp <4.0,>=3.7.0
|
|
20
|
-
Requires-Dist: aiofile <4.0,>=3.7.2
|
|
21
19
|
Requires-Dist: Markdown >=3.4.1
|
|
22
20
|
Requires-Dist: python-markdown-math >=0.8
|
|
23
21
|
Provides-Extra: all
|
|
@@ -31,7 +29,7 @@ Requires-Dist: qiskit-terra <0.25.0,>=0.19.1 ; extra == 'all'
|
|
|
31
29
|
Requires-Dist: qiskit-qir <0.5,>=0.4 ; extra == 'all'
|
|
32
30
|
Requires-Dist: Markdown <4.0,>=3.4.1 ; extra == 'all'
|
|
33
31
|
Requires-Dist: python-markdown-math <1.0,>=0.8.0 ; extra == 'all'
|
|
34
|
-
Requires-Dist: qsharp
|
|
32
|
+
Requires-Dist: qsharp <2.0,>=1.0.33 ; extra == 'all'
|
|
35
33
|
Requires-Dist: pyquil >=3.3.2 ; extra == 'all'
|
|
36
34
|
Provides-Extra: cirq
|
|
37
35
|
Requires-Dist: cirq-core <=1.2.0,>=1.1.0 ; extra == 'cirq'
|
|
@@ -47,7 +45,7 @@ Requires-Dist: qiskit-qir <0.5,>=0.4 ; extra == 'qiskit'
|
|
|
47
45
|
Requires-Dist: Markdown <4.0,>=3.4.1 ; extra == 'qiskit'
|
|
48
46
|
Requires-Dist: python-markdown-math <1.0,>=0.8.0 ; extra == 'qiskit'
|
|
49
47
|
Provides-Extra: qsharp
|
|
50
|
-
Requires-Dist: qsharp
|
|
48
|
+
Requires-Dist: qsharp <2.0,>=1.0.33 ; extra == 'qsharp'
|
|
51
49
|
Provides-Extra: quil
|
|
52
50
|
Requires-Dist: pyquil >=3.3.2 ; extra == 'quil'
|
|
53
51
|
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
azure/quantum/__init__.py,sha256=NOaWt1VnPvQXbBsbtG8veadtp6LwBws9F1Rpla9kMAQ,414
|
|
2
|
+
azure/quantum/storage.py,sha256=_4bMniDk9LrB_K5CQwuCivJFZXdmhRvU2b6Z3xxXw9I,12556
|
|
3
|
+
azure/quantum/version.py,sha256=USnbflmJfvefA1OeZUQSCHFUHh373afdIwFZYc9gpjE,235
|
|
4
|
+
azure/quantum/workspace.py,sha256=RPjt5Jm7npxMCmzf2sMfF8-YUXhpYGMh0ivR98lYLYY,19180
|
|
5
|
+
azure/quantum/_authentication/__init__.py,sha256=bniNZlS0hMIjO_y7DevGBAS6MixyA5pbPHcdGipUWM4,236
|
|
6
|
+
azure/quantum/_authentication/_chained.py,sha256=bs4w7auiCoRaNB0f86yAQU04Jgmd8VcKfy1wWmUxt6Q,5047
|
|
7
|
+
azure/quantum/_authentication/_default.py,sha256=efU7o2yqsm7TJ88H6LEP2IZYL0Wj7cqcEmXv_rvELKo,10502
|
|
8
|
+
azure/quantum/_authentication/_token.py,sha256=1rEmuu5XY3MApx_rCo7lnsi0qhch-y3goK5zXriXS7A,3570
|
|
9
|
+
azure/quantum/_client/__init__.py,sha256=kzaVxPfnju-Y_EGMfOVYVB7pHjPvc-IWrkFI2eNk68s,896
|
|
10
|
+
azure/quantum/_client/_client.py,sha256=Ze9RgPOC2ByOei_sZ-t-HrIjr9gk9TisJQigp_zkHgs,5854
|
|
11
|
+
azure/quantum/_client/_configuration.py,sha256=bPbYqPE6tVIH1ApQ0X5GybMykYQs-hu2i5d05BRFx8E,4444
|
|
12
|
+
azure/quantum/_client/_patch.py,sha256=YTV6yZ9bRfBBaw2z7v4MdzR-zeHkdtKkGb4SU8C25mE,694
|
|
13
|
+
azure/quantum/_client/_serialization.py,sha256=CMxjYOWCILsk7kozMUGRsyeKUw-tkxI_k0EvYkqQZKU,80832
|
|
14
|
+
azure/quantum/_client/_vendor.py,sha256=h8ByiyZ4cCQyFxqnuhTQdv1Rms3dVjKsrgZDzwMcSJ0,996
|
|
15
|
+
azure/quantum/_client/_version.py,sha256=Aye83QhY0bPXB7xBHMXVazHzgZeZMD2rJwdT3BGd6QE,495
|
|
16
|
+
azure/quantum/_client/models/__init__.py,sha256=c1PRpzNsQTcDk4GkrFMMIlwNQQa2c0p5N0Lzd-23YBA,2100
|
|
17
|
+
azure/quantum/_client/models/_enums.py,sha256=omj_B8_E8ONzTHg5hLgDlFYibRRbdr9sEN298im_otA,2977
|
|
18
|
+
azure/quantum/_client/models/_models.py,sha256=LxIEord6GsqPbFqS4TWWqxVL9w7-TbsbVhsaUGwyP9M,41802
|
|
19
|
+
azure/quantum/_client/models/_patch.py,sha256=YTV6yZ9bRfBBaw2z7v4MdzR-zeHkdtKkGb4SU8C25mE,694
|
|
20
|
+
azure/quantum/_client/operations/__init__.py,sha256=1mIl1WjHa-yFdX45TZayC1JfYeEPj5v7E2i7vck69qM,1154
|
|
21
|
+
azure/quantum/_client/operations/_operations.py,sha256=qEsFFyPozfw384AV8EkDQJKiKG2Q8NRb4GoDYqKRpqQ,75919
|
|
22
|
+
azure/quantum/_client/operations/_patch.py,sha256=YTV6yZ9bRfBBaw2z7v4MdzR-zeHkdtKkGb4SU8C25mE,694
|
|
23
|
+
azure/quantum/argument_types/__init__.py,sha256=0BpvjqzfnvIVJ-uQEOEClusvgh2rzjSiqfkMjLVWOwE,213
|
|
24
|
+
azure/quantum/argument_types/types.py,sha256=lIwpMrhGLGJSVhadRm8U8Ip3BW-vRUGqEmhwF3XiIYY,721
|
|
25
|
+
azure/quantum/chemistry/__init__.py,sha256=IWy-J-agQviD6GN5Px9c3X6MgMO_QhUKon5ZvQWEHJM,351
|
|
26
|
+
azure/quantum/cirq/__init__.py,sha256=Ahmb63lL8zZBA9xDNfN2diuf9onLR6T_x4ZHhUwcIRE,125
|
|
27
|
+
azure/quantum/cirq/job.py,sha256=bWRPkhnzJmwetLg5ITflv_23xdV0nLE1AoccTtu1Fvc,2773
|
|
28
|
+
azure/quantum/cirq/service.py,sha256=qF3R5sPC1_Q3TsfsnwG44XvK6Ya3r-epkHrBeNNy-RY,8458
|
|
29
|
+
azure/quantum/cirq/targets/__init__.py,sha256=-e0kekRwnaT0PPAH5W0EAUhhdUCC1cKBRY__ket-T-s,502
|
|
30
|
+
azure/quantum/cirq/targets/ionq.py,sha256=xCabcYklH9wW1TFBzpMdxvipzqhKWCYbtcgNqDHbPXM,6804
|
|
31
|
+
azure/quantum/cirq/targets/quantinuum.py,sha256=t7L5prczDQJlzStth6Rh6r35DX1Z8J_my-VJxLBp2n4,4537
|
|
32
|
+
azure/quantum/cirq/targets/target.py,sha256=1EEog72dFZoiOTQP7obOrCuO3VH0yjXGAIMeO6bm22o,2184
|
|
33
|
+
azure/quantum/job/__init__.py,sha256=3JeWk3wojWdCE2y1EFMsIrVK5AhFmHmGwLDv_9yYyLo,459
|
|
34
|
+
azure/quantum/job/base_job.py,sha256=t7DliOBkKW0AbzGYclM4NXiCDmuYKFrw4O4_xK0VPbg,12737
|
|
35
|
+
azure/quantum/job/filtered_job.py,sha256=tiHL5XOY3ocI2jVLx7efE8hgh71MArwYdsSxSbNbeCM,1683
|
|
36
|
+
azure/quantum/job/job.py,sha256=GCUSFWZ0q19c5zrKAGDdQI_982cQHdBD3fn39s3uCjg,6159
|
|
37
|
+
azure/quantum/job/job_failed_with_results_error.py,sha256=4NZVUPnCnnJsSmNg9VkIjcRChK118jkCfKlVBlHNE24,1279
|
|
38
|
+
azure/quantum/job/session.py,sha256=GSpOZk5PihfLdQcho4cBxiwvIInm4JUp1mM_67vaX-I,11936
|
|
39
|
+
azure/quantum/job/workspace_item.py,sha256=3gyl2bTB61wQRbeD0XyizxTl4cBDo9cqfI7hRBU7nhY,1198
|
|
40
|
+
azure/quantum/job/workspace_item_factory.py,sha256=QRWyrtgcKZqUucJOFi9V_SYMV3lj6S74tGRrPtk3NE0,1200
|
|
41
|
+
azure/quantum/optimization/__init__.py,sha256=EQbilP4U-XfED1QCBOx8Nz2xapcpHx_CA5o0ZkiXyMg,276
|
|
42
|
+
azure/quantum/optimization/online_problem.py,sha256=6XMnl-5U17CSYsWaplEcuMIBpMzS-QyrcWPxq0Vmt3w,636
|
|
43
|
+
azure/quantum/optimization/problem.py,sha256=UpuMXfk4SRqmfCh68baVSUlEP_ZxtRET-DwPniBbOD8,13570
|
|
44
|
+
azure/quantum/optimization/solvers.py,sha256=m6O_n8-GJbnk_waO4vtZLiQskpGRGjy0BiyVHi6A9-M,319
|
|
45
|
+
azure/quantum/optimization/streaming_problem.py,sha256=tTvw-SRx90Z2XzmOYvxP42X4LGMy5ZecBzni_lwpCEY,13650
|
|
46
|
+
azure/quantum/optimization/term.py,sha256=5OP_XeGN4SjozesvpW9QV7g3pc2xEOINN5uiAW59UWo,5983
|
|
47
|
+
azure/quantum/optimization/toshiba/__init__.py,sha256=wdtNlaOhnN10P631WZvYFIvfUXjpGthNGxNQQAKxhmc,302
|
|
48
|
+
azure/quantum/optimization/toshiba/solvers.py,sha256=s3DceUtsMh1L6AycfFM9fa-eOEiE7tM5hIV3noYbV8U,374
|
|
49
|
+
azure/quantum/qiskit/__init__.py,sha256=7Ok1mrUf-fsVuOJjVBx7OGzXJ7oHAI1Zqm8R2wdjMgE,273
|
|
50
|
+
azure/quantum/qiskit/job.py,sha256=PHgEIY7dOQtpfo-J--frj-PVX3OWr8llfBUv9VClLNg,14370
|
|
51
|
+
azure/quantum/qiskit/provider.py,sha256=9FKIjm6_Re-m_CEDxMNlrNa2JbkBkIVEzcwYmgbgLQA,10785
|
|
52
|
+
azure/quantum/qiskit/backends/__init__.py,sha256=Y-kshHgY6nQsIatVR7inKcI3NcHyNURg2R7AVdqfRj0,1014
|
|
53
|
+
azure/quantum/qiskit/backends/backend.py,sha256=afXeGZvhVSXVxf0kuX0gn68-XMUv-uY514UEStXAiX4,20132
|
|
54
|
+
azure/quantum/qiskit/backends/ionq.py,sha256=rxAhWvXrAMuFbdg72qDy_MKIx8EuCV7BvKCgwQwpogY,18024
|
|
55
|
+
azure/quantum/qiskit/backends/microsoft.py,sha256=MDPIYpWcKxEQPNYjoRczYvw38iTVRH3JqqWXQNoFvVU,3441
|
|
56
|
+
azure/quantum/qiskit/backends/qci.py,sha256=U8xi9J1OjHt8EOF6uBrE4T_CGLighXhiLL-69aULggc,4819
|
|
57
|
+
azure/quantum/qiskit/backends/quantinuum.py,sha256=6lm4yWv-3724PBaB9dnJfdeOvlGroFSZWCvBDQVJ9eI,13603
|
|
58
|
+
azure/quantum/qiskit/backends/rigetti.py,sha256=QeV_kQveHk9uUZUZLR0CiHhrcVY8twJWLb2Wh1h5Lrk,4248
|
|
59
|
+
azure/quantum/qiskit/results/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
60
|
+
azure/quantum/qiskit/results/resource_estimator.py,sha256=pAP5ZpVxdzNekQ_qXfSdSKYWWuqL_Vq7WK6pWU4wbEQ,814
|
|
61
|
+
azure/quantum/target/__init__.py,sha256=-CqA5o7T64Ju3dRFFpqkojw_WmhE-5jAFMfyVLwe878,641
|
|
62
|
+
azure/quantum/target/ionq.py,sha256=YFjTR-CRDYSIRSEK3uY2Y-wza4kzCoSDzZHv3WLR7wk,8160
|
|
63
|
+
azure/quantum/target/params.py,sha256=v9uWCKw3TI1TYEwZHg2drMiNWnW9juE9xlRVbCsD2RY,9099
|
|
64
|
+
azure/quantum/target/quantinuum.py,sha256=TNITEcfmXo4TbTnX-R2lYffFmK_hyaHmZLLTirWe3TA,7763
|
|
65
|
+
azure/quantum/target/solvers.py,sha256=_Uhz9k7CNJk6cR6fsRrWp_ZhlpEerc3le16j75yg6Pg,14963
|
|
66
|
+
azure/quantum/target/target.py,sha256=cW5AjQubWTWp3vFGPyCXF4Vhrzdpaqbtz828e4uw1ps,12524
|
|
67
|
+
azure/quantum/target/target_factory.py,sha256=LYV8Smsnw0won9PdnTlq-rFpdRiszGriV54GQ6hcl8M,5247
|
|
68
|
+
azure/quantum/target/microsoft/__init__.py,sha256=a0ycec40xS7-_PhpAWerRS3rcOt6jmroJUd-8DnMZqc,502
|
|
69
|
+
azure/quantum/target/microsoft/job.py,sha256=1QPYPGeIlB0XMKDTxnXw8Q5fsgOetpByaIuKflBGoxQ,1005
|
|
70
|
+
azure/quantum/target/microsoft/result.py,sha256=AntJptXKHNRdRR6oxhTlKKPOJVSU7u9fIfH2GXJqfx0,18784
|
|
71
|
+
azure/quantum/target/microsoft/target.py,sha256=O5bWW_bS6py7AFudTcZD5gq_AYMHhA15BH13kkTBhpE,17566
|
|
72
|
+
azure/quantum/target/microsoft/elements/dft/__init__.py,sha256=ZfijP0o5NWW7KapvnsvzbpZDBttKQ1iWADewgkzZJ-U,147
|
|
73
|
+
azure/quantum/target/microsoft/elements/dft/job.py,sha256=ulWFgUvOI48UZ5xZCGJA3P53xxAv9ZmWKS0upqmSQMA,2117
|
|
74
|
+
azure/quantum/target/microsoft/elements/dft/target.py,sha256=jPgSzEtuX8RgEa-z_higOgHAxxZcFpIc4yGxlUNachc,1907
|
|
75
|
+
azure/quantum/target/pasqal/__init__.py,sha256=qbe6oWTQTsnTYwY3xZr32z4AWaYIchx71bYlqC2rQqw,348
|
|
76
|
+
azure/quantum/target/pasqal/result.py,sha256=RMYIOxoZY6Zn05bHEaIDyAIILJWGBIZ6swyQWBxBK7Q,1348
|
|
77
|
+
azure/quantum/target/pasqal/target.py,sha256=wrW5c6HAPpqBF-oIvuuzPCTHexAIseBxtuZU8EV97yM,3936
|
|
78
|
+
azure/quantum/target/rigetti/__init__.py,sha256=I1vyzZBYGI540pauTqJd0RSSyTShGqkEL7Yjo25_RNY,378
|
|
79
|
+
azure/quantum/target/rigetti/result.py,sha256=gwIkKnVu_7f3lScGbgawyFc0J_do06lxiGUt3kcrGKU,2215
|
|
80
|
+
azure/quantum/target/rigetti/target.py,sha256=4vgvWywuhraismAj-T7_pnD4EibKUkcDjF0HyDZO1FQ,6600
|
|
81
|
+
azure/quantum/target/toshiba/__init__.py,sha256=XOGavxw_ekyTealmx5EPYzlYIdVlUnlbsIXPZVSMU-g,146
|
|
82
|
+
azure/quantum/target/toshiba/solvers.py,sha256=-lao-2r_fzMxmxNjdH-hzWC3bfVuGtPkdj5k-kp5bwI,5722
|
|
83
|
+
azure_quantum-1.0.0.dist-info/METADATA,sha256=J05pqK3t9X4ZoC98ObFSCCM9WsWI4IoOpRQgEWjC4Dg,7351
|
|
84
|
+
azure_quantum-1.0.0.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
|
|
85
|
+
azure_quantum-1.0.0.dist-info/top_level.txt,sha256=S7DhWV9m80TBzAhOFjxDUiNbKszzoThbnrSz5MpbHSQ,6
|
|
86
|
+
azure_quantum-1.0.0.dist-info/RECORD,,
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
# coding=utf-8
|
|
2
|
-
# --------------------------------------------------------------------------
|
|
3
|
-
# Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4
|
-
# Licensed under the MIT License. See License.txt in the project root for license information.
|
|
5
|
-
# Code generated by Microsoft (R) AutoRest Code Generator.
|
|
6
|
-
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
|
7
|
-
# --------------------------------------------------------------------------
|
|
8
|
-
|
|
9
|
-
from ._client import QuantumClient
|
|
10
|
-
|
|
11
|
-
try:
|
|
12
|
-
from ._patch import __all__ as _patch_all
|
|
13
|
-
from ._patch import * # pylint: disable=unused-wildcard-import
|
|
14
|
-
except ImportError:
|
|
15
|
-
_patch_all = []
|
|
16
|
-
from ._patch import patch_sdk as _patch_sdk
|
|
17
|
-
|
|
18
|
-
__all__ = [
|
|
19
|
-
"QuantumClient",
|
|
20
|
-
]
|
|
21
|
-
__all__.extend([p for p in _patch_all if p not in __all__])
|
|
22
|
-
|
|
23
|
-
_patch_sdk()
|
|
@@ -1,124 +0,0 @@
|
|
|
1
|
-
# coding=utf-8
|
|
2
|
-
# --------------------------------------------------------------------------
|
|
3
|
-
# Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4
|
-
# Licensed under the MIT License. See License.txt in the project root for license information.
|
|
5
|
-
# Code generated by Microsoft (R) AutoRest Code Generator.
|
|
6
|
-
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
|
7
|
-
# --------------------------------------------------------------------------
|
|
8
|
-
|
|
9
|
-
from copy import deepcopy
|
|
10
|
-
from typing import Any, Awaitable, TYPE_CHECKING
|
|
11
|
-
|
|
12
|
-
from azure.core import AsyncPipelineClient
|
|
13
|
-
from azure.core.rest import AsyncHttpResponse, HttpRequest
|
|
14
|
-
|
|
15
|
-
from .. import models as _models
|
|
16
|
-
from .._serialization import Deserializer, Serializer
|
|
17
|
-
from ._configuration import QuantumClientConfiguration
|
|
18
|
-
from .operations import (
|
|
19
|
-
JobsOperations,
|
|
20
|
-
ProvidersOperations,
|
|
21
|
-
QuotasOperations,
|
|
22
|
-
SessionsOperations,
|
|
23
|
-
StorageOperations,
|
|
24
|
-
TopLevelItemsOperations,
|
|
25
|
-
)
|
|
26
|
-
|
|
27
|
-
if TYPE_CHECKING:
|
|
28
|
-
# pylint: disable=unused-import,ungrouped-imports
|
|
29
|
-
from azure.core.credentials_async import AsyncTokenCredential
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
class QuantumClient: # pylint: disable=client-accepts-api-version-keyword
|
|
33
|
-
"""Azure Quantum REST API client.
|
|
34
|
-
|
|
35
|
-
:ivar jobs: JobsOperations operations
|
|
36
|
-
:vartype jobs: azure.quantum._client.aio.operations.JobsOperations
|
|
37
|
-
:ivar providers: ProvidersOperations operations
|
|
38
|
-
:vartype providers: azure.quantum._client.aio.operations.ProvidersOperations
|
|
39
|
-
:ivar storage: StorageOperations operations
|
|
40
|
-
:vartype storage: azure.quantum._client.aio.operations.StorageOperations
|
|
41
|
-
:ivar quotas: QuotasOperations operations
|
|
42
|
-
:vartype quotas: azure.quantum._client.aio.operations.QuotasOperations
|
|
43
|
-
:ivar sessions: SessionsOperations operations
|
|
44
|
-
:vartype sessions: azure.quantum._client.aio.operations.SessionsOperations
|
|
45
|
-
:ivar top_level_items: TopLevelItemsOperations operations
|
|
46
|
-
:vartype top_level_items: azure.quantum._client.aio.operations.TopLevelItemsOperations
|
|
47
|
-
:param subscription_id: The Azure subscription ID. This is a GUID-formatted string (e.g.
|
|
48
|
-
00000000-0000-0000-0000-000000000000). Required.
|
|
49
|
-
:type subscription_id: str
|
|
50
|
-
:param resource_group_name: Name of an Azure resource group. Required.
|
|
51
|
-
:type resource_group_name: str
|
|
52
|
-
:param workspace_name: Name of the workspace. Required.
|
|
53
|
-
:type workspace_name: str
|
|
54
|
-
:param credential: Credential needed for the client to connect to Azure. Required.
|
|
55
|
-
:type credential: ~azure.core.credentials_async.AsyncTokenCredential
|
|
56
|
-
:keyword endpoint: Service URL. Default value is "https://quantum.azure.com".
|
|
57
|
-
:paramtype endpoint: str
|
|
58
|
-
:keyword api_version: Api Version. Default value is "2022-09-12-preview". Note that overriding
|
|
59
|
-
this default value may result in unsupported behavior.
|
|
60
|
-
:paramtype api_version: str
|
|
61
|
-
"""
|
|
62
|
-
|
|
63
|
-
def __init__(
|
|
64
|
-
self,
|
|
65
|
-
subscription_id: str,
|
|
66
|
-
resource_group_name: str,
|
|
67
|
-
workspace_name: str,
|
|
68
|
-
credential: "AsyncTokenCredential",
|
|
69
|
-
*,
|
|
70
|
-
endpoint: str = "https://quantum.azure.com",
|
|
71
|
-
**kwargs: Any
|
|
72
|
-
) -> None:
|
|
73
|
-
self._config = QuantumClientConfiguration(
|
|
74
|
-
subscription_id=subscription_id,
|
|
75
|
-
resource_group_name=resource_group_name,
|
|
76
|
-
workspace_name=workspace_name,
|
|
77
|
-
credential=credential,
|
|
78
|
-
**kwargs
|
|
79
|
-
)
|
|
80
|
-
self._client: AsyncPipelineClient = AsyncPipelineClient(base_url=endpoint, config=self._config, **kwargs)
|
|
81
|
-
|
|
82
|
-
client_models = {k: v for k, v in _models._models.__dict__.items() if isinstance(v, type)}
|
|
83
|
-
client_models.update({k: v for k, v in _models.__dict__.items() if isinstance(v, type)})
|
|
84
|
-
self._serialize = Serializer(client_models)
|
|
85
|
-
self._deserialize = Deserializer(client_models)
|
|
86
|
-
self._serialize.client_side_validation = False
|
|
87
|
-
self.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize)
|
|
88
|
-
self.providers = ProvidersOperations(self._client, self._config, self._serialize, self._deserialize)
|
|
89
|
-
self.storage = StorageOperations(self._client, self._config, self._serialize, self._deserialize)
|
|
90
|
-
self.quotas = QuotasOperations(self._client, self._config, self._serialize, self._deserialize)
|
|
91
|
-
self.sessions = SessionsOperations(self._client, self._config, self._serialize, self._deserialize)
|
|
92
|
-
self.top_level_items = TopLevelItemsOperations(self._client, self._config, self._serialize, self._deserialize)
|
|
93
|
-
|
|
94
|
-
def send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]:
|
|
95
|
-
"""Runs the network request through the client's chained policies.
|
|
96
|
-
|
|
97
|
-
>>> from azure.core.rest import HttpRequest
|
|
98
|
-
>>> request = HttpRequest("GET", "https://www.example.org/")
|
|
99
|
-
<HttpRequest [GET], url: 'https://www.example.org/'>
|
|
100
|
-
>>> response = await client.send_request(request)
|
|
101
|
-
<AsyncHttpResponse: 200 OK>
|
|
102
|
-
|
|
103
|
-
For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request
|
|
104
|
-
|
|
105
|
-
:param request: The network request you want to make. Required.
|
|
106
|
-
:type request: ~azure.core.rest.HttpRequest
|
|
107
|
-
:keyword bool stream: Whether the response payload will be streamed. Defaults to False.
|
|
108
|
-
:return: The response of your network call. Does not do error handling on your response.
|
|
109
|
-
:rtype: ~azure.core.rest.AsyncHttpResponse
|
|
110
|
-
"""
|
|
111
|
-
|
|
112
|
-
request_copy = deepcopy(request)
|
|
113
|
-
request_copy.url = self._client.format_url(request_copy.url)
|
|
114
|
-
return self._client.send_request(request_copy, **kwargs)
|
|
115
|
-
|
|
116
|
-
async def close(self) -> None:
|
|
117
|
-
await self._client.close()
|
|
118
|
-
|
|
119
|
-
async def __aenter__(self) -> "QuantumClient":
|
|
120
|
-
await self._client.__aenter__()
|
|
121
|
-
return self
|
|
122
|
-
|
|
123
|
-
async def __aexit__(self, *exc_details: Any) -> None:
|
|
124
|
-
await self._client.__aexit__(*exc_details)
|
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
# coding=utf-8
|
|
2
|
-
# --------------------------------------------------------------------------
|
|
3
|
-
# Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4
|
-
# Licensed under the MIT License. See License.txt in the project root for license information.
|
|
5
|
-
# Code generated by Microsoft (R) AutoRest Code Generator.
|
|
6
|
-
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
|
7
|
-
# --------------------------------------------------------------------------
|
|
8
|
-
|
|
9
|
-
import sys
|
|
10
|
-
from typing import Any, TYPE_CHECKING
|
|
11
|
-
|
|
12
|
-
from azure.core.configuration import Configuration
|
|
13
|
-
from azure.core.pipeline import policies
|
|
14
|
-
|
|
15
|
-
from .._version import VERSION
|
|
16
|
-
|
|
17
|
-
if sys.version_info >= (3, 8):
|
|
18
|
-
from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports
|
|
19
|
-
else:
|
|
20
|
-
from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports
|
|
21
|
-
|
|
22
|
-
if TYPE_CHECKING:
|
|
23
|
-
# pylint: disable=unused-import,ungrouped-imports
|
|
24
|
-
from azure.core.credentials_async import AsyncTokenCredential
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
class QuantumClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes
|
|
28
|
-
"""Configuration for QuantumClient.
|
|
29
|
-
|
|
30
|
-
Note that all parameters used to create this instance are saved as instance
|
|
31
|
-
attributes.
|
|
32
|
-
|
|
33
|
-
:param subscription_id: The Azure subscription ID. This is a GUID-formatted string (e.g.
|
|
34
|
-
00000000-0000-0000-0000-000000000000). Required.
|
|
35
|
-
:type subscription_id: str
|
|
36
|
-
:param resource_group_name: Name of an Azure resource group. Required.
|
|
37
|
-
:type resource_group_name: str
|
|
38
|
-
:param workspace_name: Name of the workspace. Required.
|
|
39
|
-
:type workspace_name: str
|
|
40
|
-
:param credential: Credential needed for the client to connect to Azure. Required.
|
|
41
|
-
:type credential: ~azure.core.credentials_async.AsyncTokenCredential
|
|
42
|
-
:keyword api_version: Api Version. Default value is "2022-09-12-preview". Note that overriding
|
|
43
|
-
this default value may result in unsupported behavior.
|
|
44
|
-
:paramtype api_version: str
|
|
45
|
-
"""
|
|
46
|
-
|
|
47
|
-
def __init__(
|
|
48
|
-
self,
|
|
49
|
-
subscription_id: str,
|
|
50
|
-
resource_group_name: str,
|
|
51
|
-
workspace_name: str,
|
|
52
|
-
credential: "AsyncTokenCredential",
|
|
53
|
-
**kwargs: Any
|
|
54
|
-
) -> None:
|
|
55
|
-
super(QuantumClientConfiguration, self).__init__(**kwargs)
|
|
56
|
-
api_version: Literal["2022-09-12-preview"] = kwargs.pop("api_version", "2022-09-12-preview")
|
|
57
|
-
|
|
58
|
-
if subscription_id is None:
|
|
59
|
-
raise ValueError("Parameter 'subscription_id' must not be None.")
|
|
60
|
-
if resource_group_name is None:
|
|
61
|
-
raise ValueError("Parameter 'resource_group_name' must not be None.")
|
|
62
|
-
if workspace_name is None:
|
|
63
|
-
raise ValueError("Parameter 'workspace_name' must not be None.")
|
|
64
|
-
if credential is None:
|
|
65
|
-
raise ValueError("Parameter 'credential' must not be None.")
|
|
66
|
-
|
|
67
|
-
self.subscription_id = subscription_id
|
|
68
|
-
self.resource_group_name = resource_group_name
|
|
69
|
-
self.workspace_name = workspace_name
|
|
70
|
-
self.credential = credential
|
|
71
|
-
self.api_version = api_version
|
|
72
|
-
self.credential_scopes = kwargs.pop("credential_scopes", ["https://quantum.microsoft.com/.default"])
|
|
73
|
-
kwargs.setdefault("sdk_moniker", "quantum/{}".format(VERSION))
|
|
74
|
-
self._configure(**kwargs)
|
|
75
|
-
|
|
76
|
-
def _configure(self, **kwargs: Any) -> None:
|
|
77
|
-
self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs)
|
|
78
|
-
self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs)
|
|
79
|
-
self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs)
|
|
80
|
-
self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs)
|
|
81
|
-
self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs)
|
|
82
|
-
self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs)
|
|
83
|
-
self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs)
|
|
84
|
-
self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs)
|
|
85
|
-
self.authentication_policy = kwargs.get("authentication_policy")
|
|
86
|
-
if self.credential and not self.authentication_policy:
|
|
87
|
-
self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy(
|
|
88
|
-
self.credential, *self.credential_scopes, **kwargs
|
|
89
|
-
)
|