azure-quantum 2.4.0__py3-none-any.whl → 2.5.0.dev0__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.
@@ -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 = "2.4.0"
9
+ VERSION = "2.5.0.dev0"
@@ -0,0 +1,29 @@
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) Python Code Generator.
6
+ # Changes may cause incorrect behavior and will be lost if the code is regenerated.
7
+ # --------------------------------------------------------------------------
8
+ # pylint: disable=wrong-import-position
9
+
10
+ from typing import TYPE_CHECKING
11
+
12
+ if TYPE_CHECKING:
13
+ from ._patch import * # pylint: disable=unused-wildcard-import
14
+
15
+ from ._client import ServicesClient # type: ignore
16
+
17
+ try:
18
+ from ._patch import __all__ as _patch_all
19
+ from ._patch import *
20
+ except ImportError:
21
+ _patch_all = []
22
+ from ._patch import patch_sdk as _patch_sdk
23
+
24
+ __all__ = [
25
+ "ServicesClient",
26
+ ]
27
+ __all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore
28
+
29
+ _patch_sdk()
@@ -0,0 +1,143 @@
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) Python 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, Union
11
+ from typing_extensions import Self
12
+
13
+ from azure.core import AsyncPipelineClient
14
+ from azure.core.credentials import AzureKeyCredential
15
+ from azure.core.pipeline import policies
16
+ from azure.core.rest import AsyncHttpResponse, HttpRequest
17
+
18
+ from .._serialization import Deserializer, Serializer
19
+ from ._configuration import ServicesClientConfiguration
20
+ from .operations import (
21
+ JobsOperations,
22
+ ProvidersOperations,
23
+ QuotasOperations,
24
+ SessionsOperations,
25
+ StorageOperations,
26
+ TopLevelItemsOperations,
27
+ )
28
+
29
+ if TYPE_CHECKING:
30
+ from azure.core.credentials_async import AsyncTokenCredential
31
+
32
+
33
+ class ServicesClient:
34
+ """Azure Quantum Workspace Services.
35
+
36
+ :ivar jobs: JobsOperations operations
37
+ :vartype jobs: azure.quantum.aio.operations.JobsOperations
38
+ :ivar sessions: SessionsOperations operations
39
+ :vartype sessions: azure.quantum.aio.operations.SessionsOperations
40
+ :ivar providers: ProvidersOperations operations
41
+ :vartype providers: azure.quantum.aio.operations.ProvidersOperations
42
+ :ivar storage: StorageOperations operations
43
+ :vartype storage: azure.quantum.aio.operations.StorageOperations
44
+ :ivar quotas: QuotasOperations operations
45
+ :vartype quotas: azure.quantum.aio.operations.QuotasOperations
46
+ :ivar top_level_items: TopLevelItemsOperations operations
47
+ :vartype top_level_items: azure.quantum.aio.operations.TopLevelItemsOperations
48
+ :param region: The Azure region where the Azure Quantum Workspace is located. Required.
49
+ :type region: str
50
+ :param credential: Credential used to authenticate requests to the service. Is either a
51
+ TokenCredential type or a AzureKeyCredential type. Required.
52
+ :type credential: ~azure.core.credentials_async.AsyncTokenCredential or
53
+ ~azure.core.credentials.AzureKeyCredential
54
+ :keyword service_base_url: The Azure Quantum service base url. Default value is
55
+ "quantum.azure.com".
56
+ :paramtype service_base_url: str
57
+ :keyword api_version: The API version to use for this operation. Default value is
58
+ "2024-10-01-preview". Note that overriding this default value may result in unsupported
59
+ behavior.
60
+ :paramtype api_version: str
61
+ """
62
+
63
+ def __init__(
64
+ self,
65
+ region: str,
66
+ credential: Union["AsyncTokenCredential", AzureKeyCredential],
67
+ *,
68
+ service_base_url: str = "quantum.azure.com",
69
+ **kwargs: Any
70
+ ) -> None:
71
+ _endpoint = "https://{region}.{serviceBaseUrl}"
72
+ self._config = ServicesClientConfiguration(
73
+ region=region, credential=credential, service_base_url=service_base_url, **kwargs
74
+ )
75
+ _policies = kwargs.pop("policies", None)
76
+ if _policies is None:
77
+ _policies = [
78
+ policies.RequestIdPolicy(**kwargs),
79
+ self._config.headers_policy,
80
+ self._config.user_agent_policy,
81
+ self._config.proxy_policy,
82
+ policies.ContentDecodePolicy(**kwargs),
83
+ self._config.redirect_policy,
84
+ self._config.retry_policy,
85
+ self._config.authentication_policy,
86
+ self._config.custom_hook_policy,
87
+ self._config.logging_policy,
88
+ policies.DistributedTracingPolicy(**kwargs),
89
+ policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None,
90
+ self._config.http_logging_policy,
91
+ ]
92
+ self._client: AsyncPipelineClient = AsyncPipelineClient(base_url=_endpoint, policies=_policies, **kwargs)
93
+
94
+ self._serialize = Serializer()
95
+ self._deserialize = Deserializer()
96
+ self._serialize.client_side_validation = False
97
+ self.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize)
98
+ self.sessions = SessionsOperations(self._client, self._config, self._serialize, self._deserialize)
99
+ self.providers = ProvidersOperations(self._client, self._config, self._serialize, self._deserialize)
100
+ self.storage = StorageOperations(self._client, self._config, self._serialize, self._deserialize)
101
+ self.quotas = QuotasOperations(self._client, self._config, self._serialize, self._deserialize)
102
+ self.top_level_items = TopLevelItemsOperations(self._client, self._config, self._serialize, self._deserialize)
103
+
104
+ def send_request(
105
+ self, request: HttpRequest, *, stream: bool = False, **kwargs: Any
106
+ ) -> Awaitable[AsyncHttpResponse]:
107
+ """Runs the network request through the client's chained policies.
108
+
109
+ >>> from azure.core.rest import HttpRequest
110
+ >>> request = HttpRequest("GET", "https://www.example.org/")
111
+ <HttpRequest [GET], url: 'https://www.example.org/'>
112
+ >>> response = await client.send_request(request)
113
+ <AsyncHttpResponse: 200 OK>
114
+
115
+ For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request
116
+
117
+ :param request: The network request you want to make. Required.
118
+ :type request: ~azure.core.rest.HttpRequest
119
+ :keyword bool stream: Whether the response payload will be streamed. Defaults to False.
120
+ :return: The response of your network call. Does not do error handling on your response.
121
+ :rtype: ~azure.core.rest.AsyncHttpResponse
122
+ """
123
+
124
+ request_copy = deepcopy(request)
125
+ path_format_arguments = {
126
+ "region": self._serialize.url("self._config.region", self._config.region, "str"),
127
+ "serviceBaseUrl": self._serialize.url(
128
+ "self._config.service_base_url", self._config.service_base_url, "str"
129
+ ),
130
+ }
131
+
132
+ request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments)
133
+ return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore
134
+
135
+ async def close(self) -> None:
136
+ await self._client.close()
137
+
138
+ async def __aenter__(self) -> Self:
139
+ await self._client.__aenter__()
140
+ return self
141
+
142
+ async def __aexit__(self, *exc_details: Any) -> None:
143
+ await self._client.__aexit__(*exc_details)
@@ -0,0 +1,82 @@
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) Python Code Generator.
6
+ # Changes may cause incorrect behavior and will be lost if the code is regenerated.
7
+ # --------------------------------------------------------------------------
8
+
9
+ from typing import Any, TYPE_CHECKING, Union
10
+
11
+ from azure.core.credentials import AzureKeyCredential
12
+ from azure.core.pipeline import policies
13
+
14
+ from .._version import VERSION
15
+
16
+ if TYPE_CHECKING:
17
+ from azure.core.credentials_async import AsyncTokenCredential
18
+
19
+
20
+ class ServicesClientConfiguration: # pylint: disable=too-many-instance-attributes
21
+ """Configuration for ServicesClient.
22
+
23
+ Note that all parameters used to create this instance are saved as instance
24
+ attributes.
25
+
26
+ :param region: The Azure region where the Azure Quantum Workspace is located. Required.
27
+ :type region: str
28
+ :param credential: Credential used to authenticate requests to the service. Is either a
29
+ TokenCredential type or a AzureKeyCredential type. Required.
30
+ :type credential: ~azure.core.credentials_async.AsyncTokenCredential or
31
+ ~azure.core.credentials.AzureKeyCredential
32
+ :param service_base_url: The Azure Quantum service base url. Default value is
33
+ "quantum.azure.com".
34
+ :type service_base_url: str
35
+ :keyword api_version: The API version to use for this operation. Default value is
36
+ "2024-10-01-preview". Note that overriding this default value may result in unsupported
37
+ behavior.
38
+ :paramtype api_version: str
39
+ """
40
+
41
+ def __init__(
42
+ self,
43
+ region: str,
44
+ credential: Union["AsyncTokenCredential", AzureKeyCredential],
45
+ service_base_url: str = "quantum.azure.com",
46
+ **kwargs: Any,
47
+ ) -> None:
48
+ api_version: str = kwargs.pop("api_version", "2024-10-01-preview")
49
+
50
+ if region is None:
51
+ raise ValueError("Parameter 'region' must not be None.")
52
+ if credential is None:
53
+ raise ValueError("Parameter 'credential' must not be None.")
54
+
55
+ self.region = region
56
+ self.credential = credential
57
+ self.service_base_url = service_base_url
58
+ self.api_version = api_version
59
+ self.credential_scopes = kwargs.pop("credential_scopes", ["https://quantum.microsoft.com/.default"])
60
+ kwargs.setdefault("sdk_moniker", "quantum/{}".format(VERSION))
61
+ self.polling_interval = kwargs.get("polling_interval", 30)
62
+ self._configure(**kwargs)
63
+
64
+ def _infer_policy(self, **kwargs):
65
+ if hasattr(self.credential, "get_token"):
66
+ return policies.AsyncBearerTokenCredentialPolicy(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
+ def _configure(self, **kwargs: Any) -> None:
72
+ self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs)
73
+ self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs)
74
+ self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs)
75
+ self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs)
76
+ self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs)
77
+ self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs)
78
+ self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs)
79
+ self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs)
80
+ self.authentication_policy = kwargs.get("authentication_policy")
81
+ if self.credential and not self.authentication_policy:
82
+ self.authentication_policy = self._infer_policy(**kwargs)
@@ -0,0 +1,20 @@
1
+ # ------------------------------------
2
+ # Copyright (c) Microsoft Corporation.
3
+ # Licensed under the MIT License.
4
+ # ------------------------------------
5
+ """Customize generated code here.
6
+
7
+ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize
8
+ """
9
+ from typing import List
10
+
11
+ __all__: List[str] = [] # Add all objects you want publicly available to users at this package level
12
+
13
+
14
+ def patch_sdk():
15
+ """Do not remove from this file.
16
+
17
+ `patch_sdk` is a last resort escape hatch that allows you to do customizations
18
+ you can't accomplish using the techniques described in
19
+ https://aka.ms/azsdk/python/dpcodegen/python/customize
20
+ """
@@ -0,0 +1,35 @@
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) Python Code Generator.
6
+ # Changes may cause incorrect behavior and will be lost if the code is regenerated.
7
+ # --------------------------------------------------------------------------
8
+ # pylint: disable=wrong-import-position
9
+
10
+ from typing import TYPE_CHECKING
11
+
12
+ if TYPE_CHECKING:
13
+ from ._patch import * # pylint: disable=unused-wildcard-import
14
+
15
+ from ._operations import JobsOperations # type: ignore
16
+ from ._operations import SessionsOperations # type: ignore
17
+ from ._operations import ProvidersOperations # type: ignore
18
+ from ._operations import StorageOperations # type: ignore
19
+ from ._operations import QuotasOperations # type: ignore
20
+ from ._operations import TopLevelItemsOperations # type: ignore
21
+
22
+ from ._patch import __all__ as _patch_all
23
+ from ._patch import *
24
+ from ._patch import patch_sdk as _patch_sdk
25
+
26
+ __all__ = [
27
+ "JobsOperations",
28
+ "SessionsOperations",
29
+ "ProvidersOperations",
30
+ "StorageOperations",
31
+ "QuotasOperations",
32
+ "TopLevelItemsOperations",
33
+ ]
34
+ __all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore
35
+ _patch_sdk()