azure-quantum 2.5.0.dev0__py3-none-any.whl → 2.5.0.dev2__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/__init__.py +5 -11
- azure/quantum/_client/_client.py +49 -40
- azure/quantum/_client/_configuration.py +41 -34
- azure/quantum/_client/_serialization.py +172 -285
- azure/quantum/_client/_vendor.py +20 -0
- azure/quantum/_client/_version.py +1 -1
- azure/quantum/_client/models/__init__.py +30 -41
- azure/quantum/_client/models/_enums.py +4 -34
- azure/quantum/_client/models/_models.py +764 -435
- azure/quantum/_client/operations/__init__.py +10 -16
- azure/quantum/_client/operations/_operations.py +772 -1194
- azure/quantum/target/microsoft/elements/dft/target.py +109 -29
- azure/quantum/target/rigetti/target.py +0 -5
- azure/quantum/version.py +1 -1
- azure/quantum/workspace.py +38 -371
- {azure_quantum-2.5.0.dev0.dist-info → azure_quantum-2.5.0.dev2.dist-info}/METADATA +1 -1
- {azure_quantum-2.5.0.dev0.dist-info → azure_quantum-2.5.0.dev2.dist-info}/RECORD +19 -26
- azure/quantum/_client/_model_base.py +0 -1159
- azure/quantum/_client/aio/__init__.py +0 -29
- azure/quantum/_client/aio/_client.py +0 -143
- azure/quantum/_client/aio/_configuration.py +0 -82
- azure/quantum/_client/aio/_patch.py +0 -20
- azure/quantum/_client/aio/operations/__init__.py +0 -35
- azure/quantum/_client/aio/operations/_operations.py +0 -1824
- azure/quantum/_client/aio/operations/_patch.py +0 -20
- {azure_quantum-2.5.0.dev0.dist-info → azure_quantum-2.5.0.dev2.dist-info}/WHEEL +0 -0
- {azure_quantum-2.5.0.dev0.dist-info → azure_quantum-2.5.0.dev2.dist-info}/top_level.txt +0 -0
|
@@ -2,31 +2,25 @@
|
|
|
2
2
|
# --------------------------------------------------------------------------
|
|
3
3
|
# Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4
4
|
# Licensed under the MIT License. See License.txt in the project root for license information.
|
|
5
|
-
# Code generated by Microsoft (R)
|
|
5
|
+
# Code generated by Microsoft (R) AutoRest Code Generator.
|
|
6
6
|
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
|
7
7
|
# --------------------------------------------------------------------------
|
|
8
|
-
# pylint: disable=wrong-import-position
|
|
9
8
|
|
|
10
|
-
from
|
|
11
|
-
|
|
12
|
-
if TYPE_CHECKING:
|
|
13
|
-
from ._patch import * # pylint: disable=unused-wildcard-import
|
|
14
|
-
|
|
15
|
-
from ._client import ServicesClient # type: ignore
|
|
9
|
+
from ._client import QuantumClient
|
|
16
10
|
from ._version import VERSION
|
|
17
11
|
|
|
18
12
|
__version__ = VERSION
|
|
19
13
|
|
|
20
14
|
try:
|
|
21
15
|
from ._patch import __all__ as _patch_all
|
|
22
|
-
from ._patch import *
|
|
16
|
+
from ._patch import * # pylint: disable=unused-wildcard-import
|
|
23
17
|
except ImportError:
|
|
24
18
|
_patch_all = []
|
|
25
19
|
from ._patch import patch_sdk as _patch_sdk
|
|
26
20
|
|
|
27
21
|
__all__ = [
|
|
28
|
-
"
|
|
22
|
+
"QuantumClient",
|
|
29
23
|
]
|
|
30
|
-
__all__.extend([p for p in _patch_all if p not in __all__])
|
|
24
|
+
__all__.extend([p for p in _patch_all if p not in __all__])
|
|
31
25
|
|
|
32
26
|
_patch_sdk()
|
azure/quantum/_client/_client.py
CHANGED
|
@@ -2,20 +2,19 @@
|
|
|
2
2
|
# --------------------------------------------------------------------------
|
|
3
3
|
# Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4
4
|
# Licensed under the MIT License. See License.txt in the project root for license information.
|
|
5
|
-
# Code generated by Microsoft (R)
|
|
5
|
+
# Code generated by Microsoft (R) AutoRest Code Generator.
|
|
6
6
|
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
|
7
7
|
# --------------------------------------------------------------------------
|
|
8
8
|
|
|
9
9
|
from copy import deepcopy
|
|
10
|
-
from typing import Any, TYPE_CHECKING
|
|
11
|
-
from typing_extensions import Self
|
|
10
|
+
from typing import Any, TYPE_CHECKING
|
|
12
11
|
|
|
13
12
|
from azure.core import PipelineClient
|
|
14
|
-
from azure.core.credentials import AzureKeyCredential
|
|
15
13
|
from azure.core.pipeline import policies
|
|
16
14
|
from azure.core.rest import HttpRequest, HttpResponse
|
|
17
15
|
|
|
18
|
-
from .
|
|
16
|
+
from . import models as _models
|
|
17
|
+
from ._configuration import QuantumClientConfiguration
|
|
19
18
|
from ._serialization import Deserializer, Serializer
|
|
20
19
|
from .operations import (
|
|
21
20
|
JobsOperations,
|
|
@@ -27,50 +26,59 @@ from .operations import (
|
|
|
27
26
|
)
|
|
28
27
|
|
|
29
28
|
if TYPE_CHECKING:
|
|
29
|
+
# pylint: disable=unused-import,ungrouped-imports
|
|
30
30
|
from azure.core.credentials import TokenCredential
|
|
31
31
|
|
|
32
32
|
|
|
33
|
-
class
|
|
34
|
-
"""Azure Quantum
|
|
33
|
+
class QuantumClient: # pylint: disable=client-accepts-api-version-keyword
|
|
34
|
+
"""Azure Quantum REST API client.
|
|
35
35
|
|
|
36
36
|
:ivar jobs: JobsOperations operations
|
|
37
|
-
:vartype jobs: azure.quantum.operations.JobsOperations
|
|
38
|
-
:ivar sessions: SessionsOperations operations
|
|
39
|
-
:vartype sessions: azure.quantum.operations.SessionsOperations
|
|
37
|
+
:vartype jobs: azure.quantum._client.operations.JobsOperations
|
|
40
38
|
:ivar providers: ProvidersOperations operations
|
|
41
|
-
:vartype providers: azure.quantum.operations.ProvidersOperations
|
|
39
|
+
:vartype providers: azure.quantum._client.operations.ProvidersOperations
|
|
42
40
|
:ivar storage: StorageOperations operations
|
|
43
|
-
:vartype storage: azure.quantum.operations.StorageOperations
|
|
41
|
+
:vartype storage: azure.quantum._client.operations.StorageOperations
|
|
44
42
|
:ivar quotas: QuotasOperations operations
|
|
45
|
-
:vartype quotas: azure.quantum.operations.QuotasOperations
|
|
43
|
+
:vartype quotas: azure.quantum._client.operations.QuotasOperations
|
|
44
|
+
:ivar sessions: SessionsOperations operations
|
|
45
|
+
:vartype sessions: azure.quantum._client.operations.SessionsOperations
|
|
46
46
|
:ivar top_level_items: TopLevelItemsOperations operations
|
|
47
|
-
:vartype top_level_items: azure.quantum.operations.TopLevelItemsOperations
|
|
48
|
-
:param
|
|
49
|
-
|
|
50
|
-
:
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
:
|
|
55
|
-
|
|
56
|
-
:
|
|
57
|
-
:
|
|
58
|
-
|
|
59
|
-
|
|
47
|
+
:vartype top_level_items: azure.quantum._client.operations.TopLevelItemsOperations
|
|
48
|
+
:param azure_region: Supported Azure regions for Azure Quantum Services. For example, "eastus".
|
|
49
|
+
Required.
|
|
50
|
+
:type azure_region: str
|
|
51
|
+
:param subscription_id: The Azure subscription ID. This is a GUID-formatted string (e.g.
|
|
52
|
+
00000000-0000-0000-0000-000000000000). Required.
|
|
53
|
+
:type subscription_id: str
|
|
54
|
+
:param resource_group_name: Name of an Azure resource group. Required.
|
|
55
|
+
:type resource_group_name: str
|
|
56
|
+
:param workspace_name: Name of the workspace. Required.
|
|
57
|
+
:type workspace_name: str
|
|
58
|
+
:param credential: Credential needed for the client to connect to Azure. Required.
|
|
59
|
+
:type credential: ~azure.core.credentials.TokenCredential
|
|
60
|
+
:keyword api_version: Api Version. Default value is "2023-11-13-preview". Note that overriding
|
|
61
|
+
this default value may result in unsupported behavior.
|
|
60
62
|
:paramtype api_version: str
|
|
61
63
|
"""
|
|
62
64
|
|
|
63
65
|
def __init__(
|
|
64
66
|
self,
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
67
|
+
azure_region: str,
|
|
68
|
+
subscription_id: str,
|
|
69
|
+
resource_group_name: str,
|
|
70
|
+
workspace_name: str,
|
|
71
|
+
credential: "TokenCredential",
|
|
69
72
|
**kwargs: Any
|
|
70
73
|
) -> None:
|
|
71
|
-
_endpoint = "https://{
|
|
72
|
-
self._config =
|
|
73
|
-
|
|
74
|
+
_endpoint = kwargs.pop("endpoint", f"https://{azure_region}.quantum.azure.com")
|
|
75
|
+
self._config = QuantumClientConfiguration(
|
|
76
|
+
azure_region=azure_region,
|
|
77
|
+
subscription_id=subscription_id,
|
|
78
|
+
resource_group_name=resource_group_name,
|
|
79
|
+
workspace_name=workspace_name,
|
|
80
|
+
credential=credential,
|
|
81
|
+
**kwargs
|
|
74
82
|
)
|
|
75
83
|
_policies = kwargs.pop("policies", None)
|
|
76
84
|
if _policies is None:
|
|
@@ -91,14 +99,16 @@ class ServicesClient:
|
|
|
91
99
|
]
|
|
92
100
|
self._client: PipelineClient = PipelineClient(base_url=_endpoint, policies=_policies, **kwargs)
|
|
93
101
|
|
|
94
|
-
|
|
95
|
-
|
|
102
|
+
client_models = {k: v for k, v in _models._models.__dict__.items() if isinstance(v, type)}
|
|
103
|
+
client_models.update({k: v for k, v in _models.__dict__.items() if isinstance(v, type)})
|
|
104
|
+
self._serialize = Serializer(client_models)
|
|
105
|
+
self._deserialize = Deserializer(client_models)
|
|
96
106
|
self._serialize.client_side_validation = False
|
|
97
107
|
self.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize)
|
|
98
|
-
self.sessions = SessionsOperations(self._client, self._config, self._serialize, self._deserialize)
|
|
99
108
|
self.providers = ProvidersOperations(self._client, self._config, self._serialize, self._deserialize)
|
|
100
109
|
self.storage = StorageOperations(self._client, self._config, self._serialize, self._deserialize)
|
|
101
110
|
self.quotas = QuotasOperations(self._client, self._config, self._serialize, self._deserialize)
|
|
111
|
+
self.sessions = SessionsOperations(self._client, self._config, self._serialize, self._deserialize)
|
|
102
112
|
self.top_level_items = TopLevelItemsOperations(self._client, self._config, self._serialize, self._deserialize)
|
|
103
113
|
|
|
104
114
|
def send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse:
|
|
@@ -121,9 +131,8 @@ class ServicesClient:
|
|
|
121
131
|
|
|
122
132
|
request_copy = deepcopy(request)
|
|
123
133
|
path_format_arguments = {
|
|
124
|
-
"
|
|
125
|
-
|
|
126
|
-
"self._config.service_base_url", self._config.service_base_url, "str"
|
|
134
|
+
"azureRegion": self._serialize.url(
|
|
135
|
+
"self._config.azure_region", self._config.azure_region, "str", skip_quote=True
|
|
127
136
|
),
|
|
128
137
|
}
|
|
129
138
|
|
|
@@ -133,7 +142,7 @@ class ServicesClient:
|
|
|
133
142
|
def close(self) -> None:
|
|
134
143
|
self._client.close()
|
|
135
144
|
|
|
136
|
-
def __enter__(self) ->
|
|
145
|
+
def __enter__(self) -> "QuantumClient":
|
|
137
146
|
self._client.__enter__()
|
|
138
147
|
return self
|
|
139
148
|
|
|
@@ -2,72 +2,77 @@
|
|
|
2
2
|
# --------------------------------------------------------------------------
|
|
3
3
|
# Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4
4
|
# Licensed under the MIT License. See License.txt in the project root for license information.
|
|
5
|
-
# Code generated by Microsoft (R)
|
|
5
|
+
# Code generated by Microsoft (R) AutoRest Code Generator.
|
|
6
6
|
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
|
7
7
|
# --------------------------------------------------------------------------
|
|
8
8
|
|
|
9
|
-
from typing import Any, TYPE_CHECKING
|
|
9
|
+
from typing import Any, TYPE_CHECKING
|
|
10
10
|
|
|
11
|
-
from azure.core.credentials import AzureKeyCredential
|
|
12
11
|
from azure.core.pipeline import policies
|
|
13
12
|
|
|
14
13
|
from ._version import VERSION
|
|
15
14
|
|
|
16
15
|
if TYPE_CHECKING:
|
|
16
|
+
# pylint: disable=unused-import,ungrouped-imports
|
|
17
17
|
from azure.core.credentials import TokenCredential
|
|
18
18
|
|
|
19
19
|
|
|
20
|
-
class
|
|
21
|
-
"""Configuration for
|
|
20
|
+
class QuantumClientConfiguration: # pylint: disable=too-many-instance-attributes
|
|
21
|
+
"""Configuration for QuantumClient.
|
|
22
22
|
|
|
23
23
|
Note that all parameters used to create this instance are saved as instance
|
|
24
24
|
attributes.
|
|
25
25
|
|
|
26
|
-
:param
|
|
27
|
-
|
|
28
|
-
:
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
:param
|
|
33
|
-
|
|
34
|
-
:
|
|
35
|
-
:
|
|
36
|
-
|
|
37
|
-
|
|
26
|
+
:param azure_region: Supported Azure regions for Azure Quantum Services. For example, "eastus".
|
|
27
|
+
Required.
|
|
28
|
+
:type azure_region: str
|
|
29
|
+
:param subscription_id: The Azure subscription ID. This is a GUID-formatted string (e.g.
|
|
30
|
+
00000000-0000-0000-0000-000000000000). Required.
|
|
31
|
+
:type subscription_id: str
|
|
32
|
+
:param resource_group_name: Name of an Azure resource group. Required.
|
|
33
|
+
:type resource_group_name: str
|
|
34
|
+
:param workspace_name: Name of the workspace. Required.
|
|
35
|
+
:type workspace_name: str
|
|
36
|
+
:param credential: Credential needed for the client to connect to Azure. Required.
|
|
37
|
+
:type credential: ~azure.core.credentials.TokenCredential
|
|
38
|
+
:keyword api_version: Api Version. Default value is "2023-11-13-preview". Note that overriding
|
|
39
|
+
this default value may result in unsupported behavior.
|
|
38
40
|
:paramtype api_version: str
|
|
39
41
|
"""
|
|
40
42
|
|
|
41
43
|
def __init__(
|
|
42
44
|
self,
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
45
|
+
azure_region: str,
|
|
46
|
+
subscription_id: str,
|
|
47
|
+
resource_group_name: str,
|
|
48
|
+
workspace_name: str,
|
|
49
|
+
credential: "TokenCredential",
|
|
50
|
+
**kwargs: Any
|
|
47
51
|
) -> None:
|
|
48
|
-
api_version: str = kwargs.pop("api_version", "
|
|
52
|
+
api_version: str = kwargs.pop("api_version", "2022-09-12-preview")
|
|
49
53
|
|
|
50
|
-
if
|
|
51
|
-
raise ValueError("Parameter '
|
|
54
|
+
if azure_region is None:
|
|
55
|
+
raise ValueError("Parameter 'azure_region' must not be None.")
|
|
56
|
+
if subscription_id is None:
|
|
57
|
+
raise ValueError("Parameter 'subscription_id' must not be None.")
|
|
58
|
+
if resource_group_name is None:
|
|
59
|
+
raise ValueError("Parameter 'resource_group_name' must not be None.")
|
|
60
|
+
if workspace_name is None:
|
|
61
|
+
raise ValueError("Parameter 'workspace_name' must not be None.")
|
|
52
62
|
if credential is None:
|
|
53
63
|
raise ValueError("Parameter 'credential' must not be None.")
|
|
54
64
|
|
|
55
|
-
self.
|
|
65
|
+
self.azure_region = azure_region
|
|
66
|
+
self.subscription_id = subscription_id
|
|
67
|
+
self.resource_group_name = resource_group_name
|
|
68
|
+
self.workspace_name = workspace_name
|
|
56
69
|
self.credential = credential
|
|
57
|
-
self.service_base_url = service_base_url
|
|
58
70
|
self.api_version = api_version
|
|
59
71
|
self.credential_scopes = kwargs.pop("credential_scopes", ["https://quantum.microsoft.com/.default"])
|
|
60
72
|
kwargs.setdefault("sdk_moniker", "quantum/{}".format(VERSION))
|
|
61
73
|
self.polling_interval = kwargs.get("polling_interval", 30)
|
|
62
74
|
self._configure(**kwargs)
|
|
63
75
|
|
|
64
|
-
def _infer_policy(self, **kwargs):
|
|
65
|
-
if hasattr(self.credential, "get_token"):
|
|
66
|
-
return policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs)
|
|
67
|
-
if isinstance(self.credential, AzureKeyCredential):
|
|
68
|
-
return policies.AzureKeyCredentialPolicy(self.credential, "x-ms-quantum-api-key", **kwargs)
|
|
69
|
-
raise TypeError(f"Unsupported credential: {self.credential}")
|
|
70
|
-
|
|
71
76
|
def _configure(self, **kwargs: Any) -> None:
|
|
72
77
|
self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs)
|
|
73
78
|
self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs)
|
|
@@ -79,4 +84,6 @@ class ServicesClientConfiguration: # pylint: disable=too-many-instance-attribut
|
|
|
79
84
|
self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs)
|
|
80
85
|
self.authentication_policy = kwargs.get("authentication_policy")
|
|
81
86
|
if self.credential and not self.authentication_policy:
|
|
82
|
-
self.authentication_policy =
|
|
87
|
+
self.authentication_policy = policies.BearerTokenCredentialPolicy(
|
|
88
|
+
self.credential, *self.credential_scopes, **kwargs
|
|
89
|
+
)
|