azure-quantum 3.5.1.dev1__py3-none-any.whl → 3.6.1__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 (39) hide show
  1. azure/quantum/_client/__init__.py +2 -2
  2. azure/quantum/_client/_client.py +18 -57
  3. azure/quantum/_client/_configuration.py +13 -22
  4. azure/quantum/_client/_patch.py +7 -6
  5. azure/quantum/_client/_utils/__init__.py +6 -0
  6. azure/quantum/_client/{_model_base.py → _utils/model_base.py} +210 -45
  7. azure/quantum/_client/{_serialization.py → _utils/serialization.py} +74 -151
  8. azure/quantum/_client/_validation.py +66 -0
  9. azure/quantum/_client/_version.py +1 -1
  10. azure/quantum/_client/aio/__init__.py +29 -0
  11. azure/quantum/_client/aio/_client.py +110 -0
  12. azure/quantum/_client/aio/_configuration.py +75 -0
  13. azure/quantum/_client/aio/_patch.py +21 -0
  14. azure/quantum/_client/aio/operations/__init__.py +25 -0
  15. azure/quantum/_client/aio/operations/_operations.py +1988 -0
  16. azure/quantum/_client/aio/operations/_patch.py +21 -0
  17. azure/quantum/_client/models/__init__.py +8 -4
  18. azure/quantum/_client/models/_enums.py +28 -23
  19. azure/quantum/_client/models/_models.py +198 -106
  20. azure/quantum/_client/models/_patch.py +7 -6
  21. azure/quantum/_client/operations/__init__.py +2 -12
  22. azure/quantum/_client/operations/_operations.py +900 -715
  23. azure/quantum/_client/operations/_patch.py +7 -6
  24. azure/quantum/_constants.py +6 -1
  25. azure/quantum/_mgmt_client.py +19 -9
  26. azure/quantum/_workspace_connection_params.py +27 -2
  27. azure/quantum/job/base_job.py +8 -0
  28. azure/quantum/job/job.py +13 -4
  29. azure/quantum/job/session.py +11 -0
  30. azure/quantum/target/rigetti/target.py +1 -6
  31. azure/quantum/target/target.py +5 -1
  32. azure/quantum/target/target_factory.py +14 -7
  33. azure/quantum/version.py +1 -1
  34. azure/quantum/workspace.py +35 -31
  35. {azure_quantum-3.5.1.dev1.dist-info → azure_quantum-3.6.1.dist-info}/METADATA +2 -6
  36. azure_quantum-3.6.1.dist-info/RECORD +74 -0
  37. {azure_quantum-3.5.1.dev1.dist-info → azure_quantum-3.6.1.dist-info}/WHEEL +1 -1
  38. azure_quantum-3.5.1.dev1.dist-info/RECORD +0 -65
  39. {azure_quantum-3.5.1.dev1.dist-info → azure_quantum-3.6.1.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,110 @@
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 .._utils.serialization import Deserializer, Serializer
19
+ from ._configuration import WorkspaceClientConfiguration
20
+ from .operations import ServicesOperations
21
+
22
+ if TYPE_CHECKING:
23
+ from azure.core.credentials_async import AsyncTokenCredential
24
+
25
+
26
+ class WorkspaceClient:
27
+ """Azure Quantum Workspace Services.
28
+
29
+ :ivar services: ServicesOperations operations
30
+ :vartype services: azure.quantum.aio.operations.ServicesOperations
31
+ :param endpoint: The endpoint of the Azure Quantum service. For example,
32
+ https://{region}.quantum.azure.com. Required.
33
+ :type endpoint: str
34
+ :param credential: Credential used to authenticate requests to the service. Is either a token
35
+ credential type or a key credential type. Required.
36
+ :type credential: ~azure.core.credentials_async.AsyncTokenCredential or
37
+ ~azure.core.credentials.AzureKeyCredential
38
+ :keyword api_version: The API version to use for this operation. Default value is
39
+ "2025-12-01-preview". Note that overriding this default value may result in unsupported
40
+ behavior.
41
+ :paramtype api_version: str
42
+ """
43
+
44
+ def __init__(
45
+ self, endpoint: str, credential: Union["AsyncTokenCredential", AzureKeyCredential], **kwargs: Any
46
+ ) -> None:
47
+ _endpoint = "{endpoint}"
48
+ self._config = WorkspaceClientConfiguration(endpoint=endpoint, credential=credential, **kwargs)
49
+
50
+ _policies = kwargs.pop("policies", None)
51
+ if _policies is None:
52
+ _policies = [
53
+ policies.RequestIdPolicy(**kwargs),
54
+ self._config.headers_policy,
55
+ self._config.user_agent_policy,
56
+ self._config.proxy_policy,
57
+ policies.ContentDecodePolicy(**kwargs),
58
+ self._config.redirect_policy,
59
+ self._config.retry_policy,
60
+ self._config.authentication_policy,
61
+ self._config.custom_hook_policy,
62
+ self._config.logging_policy,
63
+ policies.DistributedTracingPolicy(**kwargs),
64
+ policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None,
65
+ self._config.http_logging_policy,
66
+ ]
67
+ self._client: AsyncPipelineClient = AsyncPipelineClient(base_url=_endpoint, policies=_policies, **kwargs)
68
+
69
+ self._serialize = Serializer()
70
+ self._deserialize = Deserializer()
71
+ self._serialize.client_side_validation = False
72
+ self.services = ServicesOperations(self._client, self._config, self._serialize, self._deserialize)
73
+
74
+ def send_request(
75
+ self, request: HttpRequest, *, stream: bool = False, **kwargs: Any
76
+ ) -> Awaitable[AsyncHttpResponse]:
77
+ """Runs the network request through the client's chained policies.
78
+
79
+ >>> from azure.core.rest import HttpRequest
80
+ >>> request = HttpRequest("GET", "https://www.example.org/")
81
+ <HttpRequest [GET], url: 'https://www.example.org/'>
82
+ >>> response = await client.send_request(request)
83
+ <AsyncHttpResponse: 200 OK>
84
+
85
+ For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request
86
+
87
+ :param request: The network request you want to make. Required.
88
+ :type request: ~azure.core.rest.HttpRequest
89
+ :keyword bool stream: Whether the response payload will be streamed. Defaults to False.
90
+ :return: The response of your network call. Does not do error handling on your response.
91
+ :rtype: ~azure.core.rest.AsyncHttpResponse
92
+ """
93
+
94
+ request_copy = deepcopy(request)
95
+ path_format_arguments = {
96
+ "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True),
97
+ }
98
+
99
+ request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments)
100
+ return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore
101
+
102
+ async def close(self) -> None:
103
+ await self._client.close()
104
+
105
+ async def __aenter__(self) -> Self:
106
+ await self._client.__aenter__()
107
+ return self
108
+
109
+ async def __aexit__(self, *exc_details: Any) -> None:
110
+ await self._client.__aexit__(*exc_details)
@@ -0,0 +1,75 @@
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 WorkspaceClientConfiguration: # pylint: disable=too-many-instance-attributes
21
+ """Configuration for WorkspaceClient.
22
+
23
+ Note that all parameters used to create this instance are saved as instance
24
+ attributes.
25
+
26
+ :param endpoint: The endpoint of the Azure Quantum service. For example,
27
+ https://{region}.quantum.azure.com. Required.
28
+ :type endpoint: str
29
+ :param credential: Credential used to authenticate requests to the service. Is either a token
30
+ credential type or a key credential type. Required.
31
+ :type credential: ~azure.core.credentials_async.AsyncTokenCredential or
32
+ ~azure.core.credentials.AzureKeyCredential
33
+ :keyword api_version: The API version to use for this operation. Default value is
34
+ "2025-12-01-preview". Note that overriding this default value may result in unsupported
35
+ behavior.
36
+ :paramtype api_version: str
37
+ """
38
+
39
+ def __init__(
40
+ self, endpoint: str, credential: Union["AsyncTokenCredential", AzureKeyCredential], **kwargs: Any
41
+ ) -> None:
42
+ api_version: str = kwargs.pop("api_version", "2025-12-01-preview")
43
+
44
+ if endpoint is None:
45
+ raise ValueError("Parameter 'endpoint' must not be None.")
46
+ if credential is None:
47
+ raise ValueError("Parameter 'credential' must not be None.")
48
+
49
+ self.endpoint = endpoint
50
+ self.credential = credential
51
+ self.api_version = api_version
52
+ self.credential_scopes = kwargs.pop("credential_scopes", ["https://quantum.microsoft.com/.default"])
53
+ kwargs.setdefault("sdk_moniker", "quantum/{}".format(VERSION))
54
+ self.polling_interval = kwargs.get("polling_interval", 30)
55
+ self._configure(**kwargs)
56
+
57
+ def _infer_policy(self, **kwargs):
58
+ if hasattr(self.credential, "get_token"):
59
+ return policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs)
60
+ if isinstance(self.credential, AzureKeyCredential):
61
+ return policies.AzureKeyCredentialPolicy(self.credential, "x-ms-quantum-api-key", **kwargs)
62
+ raise TypeError(f"Unsupported credential: {self.credential}")
63
+
64
+ def _configure(self, **kwargs: Any) -> None:
65
+ self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs)
66
+ self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs)
67
+ self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs)
68
+ self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs)
69
+ self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs)
70
+ self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs)
71
+ self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs)
72
+ self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs)
73
+ self.authentication_policy = kwargs.get("authentication_policy")
74
+ if self.credential and not self.authentication_policy:
75
+ self.authentication_policy = self._infer_policy(**kwargs)
@@ -0,0 +1,21 @@
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
+ # --------------------------------------------------------------------------
6
+ """Customize generated code here.
7
+
8
+ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize
9
+ """
10
+
11
+
12
+ __all__: list[str] = [] # Add all objects you want publicly available to users at this package level
13
+
14
+
15
+ def patch_sdk():
16
+ """Do not remove from this file.
17
+
18
+ `patch_sdk` is a last resort escape hatch that allows you to do customizations
19
+ you can't accomplish using the techniques described in
20
+ https://aka.ms/azsdk/python/dpcodegen/python/customize
21
+ """
@@ -0,0 +1,25 @@
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 ServicesOperations # type: ignore
16
+
17
+ from ._patch import __all__ as _patch_all
18
+ from ._patch import *
19
+ from ._patch import patch_sdk as _patch_sdk
20
+
21
+ __all__ = [
22
+ "ServicesOperations",
23
+ ]
24
+ __all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore
25
+ _patch_sdk()