azure-quantum 1.1.1__py3-none-any.whl → 1.1.2.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.
- azure/quantum/_authentication/_chained.py +21 -23
- azure/quantum/_authentication/_default.py +97 -159
- azure/quantum/_authentication/_token.py +41 -38
- azure/quantum/_client/_client.py +35 -9
- azure/quantum/_client/_configuration.py +12 -12
- azure/quantum/_client/_serialization.py +46 -37
- azure/quantum/_client/_version.py +1 -1
- azure/quantum/_client/models/_models.py +8 -8
- azure/quantum/_client/operations/_operations.py +261 -167
- azure/quantum/_constants.py +91 -0
- azure/quantum/_workspace_connection_params.py +544 -0
- azure/quantum/version.py +1 -1
- azure/quantum/workspace.py +119 -147
- {azure_quantum-1.1.1.dist-info → azure_quantum-1.1.2.dev0.dist-info}/METADATA +1 -1
- {azure_quantum-1.1.1.dist-info → azure_quantum-1.1.2.dev0.dist-info}/RECORD +17 -15
- {azure_quantum-1.1.1.dist-info → azure_quantum-1.1.2.dev0.dist-info}/WHEEL +0 -0
- {azure_quantum-1.1.1.dist-info → azure_quantum-1.1.2.dev0.dist-info}/top_level.txt +0 -0
|
@@ -6,30 +6,26 @@
|
|
|
6
6
|
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
|
7
7
|
# --------------------------------------------------------------------------
|
|
8
8
|
|
|
9
|
-
import sys
|
|
10
9
|
from typing import Any, TYPE_CHECKING
|
|
11
10
|
|
|
12
|
-
from azure.core.configuration import Configuration
|
|
13
11
|
from azure.core.pipeline import policies
|
|
14
12
|
|
|
15
13
|
from ._version import VERSION
|
|
16
14
|
|
|
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
15
|
if TYPE_CHECKING:
|
|
23
16
|
# pylint: disable=unused-import,ungrouped-imports
|
|
24
17
|
from azure.core.credentials import TokenCredential
|
|
25
18
|
|
|
26
19
|
|
|
27
|
-
class QuantumClientConfiguration
|
|
20
|
+
class QuantumClientConfiguration: # pylint: disable=too-many-instance-attributes
|
|
28
21
|
"""Configuration for QuantumClient.
|
|
29
22
|
|
|
30
23
|
Note that all parameters used to create this instance are saved as instance
|
|
31
24
|
attributes.
|
|
32
25
|
|
|
26
|
+
:param azure_region: Supported Azure regions for Azure Quantum Services. For example, "eastus".
|
|
27
|
+
Required.
|
|
28
|
+
:type azure_region: str
|
|
33
29
|
:param subscription_id: The Azure subscription ID. This is a GUID-formatted string (e.g.
|
|
34
30
|
00000000-0000-0000-0000-000000000000). Required.
|
|
35
31
|
:type subscription_id: str
|
|
@@ -39,22 +35,24 @@ class QuantumClientConfiguration(Configuration): # pylint: disable=too-many-ins
|
|
|
39
35
|
:type workspace_name: str
|
|
40
36
|
:param credential: Credential needed for the client to connect to Azure. Required.
|
|
41
37
|
:type credential: ~azure.core.credentials.TokenCredential
|
|
42
|
-
:keyword api_version: Api Version. Default value is "
|
|
38
|
+
:keyword api_version: Api Version. Default value is "2023-11-13-preview". Note that overriding
|
|
43
39
|
this default value may result in unsupported behavior.
|
|
44
40
|
:paramtype api_version: str
|
|
45
41
|
"""
|
|
46
42
|
|
|
47
43
|
def __init__(
|
|
48
44
|
self,
|
|
45
|
+
azure_region: str,
|
|
49
46
|
subscription_id: str,
|
|
50
47
|
resource_group_name: str,
|
|
51
48
|
workspace_name: str,
|
|
52
49
|
credential: "TokenCredential",
|
|
53
50
|
**kwargs: Any
|
|
54
51
|
) -> None:
|
|
55
|
-
|
|
56
|
-
api_version: Literal["2022-09-12-preview"] = kwargs.pop("api_version", "2022-09-12-preview")
|
|
52
|
+
api_version: str = kwargs.pop("api_version", "2022-09-12-preview")
|
|
57
53
|
|
|
54
|
+
if azure_region is None:
|
|
55
|
+
raise ValueError("Parameter 'azure_region' must not be None.")
|
|
58
56
|
if subscription_id is None:
|
|
59
57
|
raise ValueError("Parameter 'subscription_id' must not be None.")
|
|
60
58
|
if resource_group_name is None:
|
|
@@ -64,6 +62,7 @@ class QuantumClientConfiguration(Configuration): # pylint: disable=too-many-ins
|
|
|
64
62
|
if credential is None:
|
|
65
63
|
raise ValueError("Parameter 'credential' must not be None.")
|
|
66
64
|
|
|
65
|
+
self.azure_region = azure_region
|
|
67
66
|
self.subscription_id = subscription_id
|
|
68
67
|
self.resource_group_name = resource_group_name
|
|
69
68
|
self.workspace_name = workspace_name
|
|
@@ -71,6 +70,7 @@ class QuantumClientConfiguration(Configuration): # pylint: disable=too-many-ins
|
|
|
71
70
|
self.api_version = api_version
|
|
72
71
|
self.credential_scopes = kwargs.pop("credential_scopes", ["https://quantum.microsoft.com/.default"])
|
|
73
72
|
kwargs.setdefault("sdk_moniker", "quantum/{}".format(VERSION))
|
|
73
|
+
self.polling_interval = kwargs.get("polling_interval", 30)
|
|
74
74
|
self._configure(**kwargs)
|
|
75
75
|
|
|
76
76
|
def _configure(self, **kwargs: Any) -> None:
|
|
@@ -79,9 +79,9 @@ class QuantumClientConfiguration(Configuration): # pylint: disable=too-many-ins
|
|
|
79
79
|
self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs)
|
|
80
80
|
self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs)
|
|
81
81
|
self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs)
|
|
82
|
-
self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs)
|
|
83
82
|
self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs)
|
|
84
83
|
self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs)
|
|
84
|
+
self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs)
|
|
85
85
|
self.authentication_policy = kwargs.get("authentication_policy")
|
|
86
86
|
if self.credential and not self.authentication_policy:
|
|
87
87
|
self.authentication_policy = policies.BearerTokenCredentialPolicy(
|
|
@@ -63,8 +63,8 @@ import xml.etree.ElementTree as ET
|
|
|
63
63
|
|
|
64
64
|
import isodate # type: ignore
|
|
65
65
|
|
|
66
|
-
from azure.core.exceptions import DeserializationError, SerializationError
|
|
67
|
-
from azure.core.serialization import NULL as
|
|
66
|
+
from azure.core.exceptions import DeserializationError, SerializationError
|
|
67
|
+
from azure.core.serialization import NULL as CoreNull
|
|
68
68
|
|
|
69
69
|
_BOM = codecs.BOM_UTF8.decode(encoding="utf-8")
|
|
70
70
|
|
|
@@ -124,7 +124,7 @@ class RawDeserializer:
|
|
|
124
124
|
pass
|
|
125
125
|
|
|
126
126
|
return ET.fromstring(data_as_str) # nosec
|
|
127
|
-
except ET.ParseError:
|
|
127
|
+
except ET.ParseError as err:
|
|
128
128
|
# It might be because the server has an issue, and returned JSON with
|
|
129
129
|
# content-type XML....
|
|
130
130
|
# So let's try a JSON load, and if it's still broken
|
|
@@ -143,7 +143,7 @@ class RawDeserializer:
|
|
|
143
143
|
# The function hack is because Py2.7 messes up with exception
|
|
144
144
|
# context otherwise.
|
|
145
145
|
_LOGGER.critical("Wasn't XML not JSON, failing")
|
|
146
|
-
|
|
146
|
+
raise DeserializationError("XML is invalid") from err
|
|
147
147
|
raise DeserializationError("Cannot deserialize content-type: {}".format(content_type))
|
|
148
148
|
|
|
149
149
|
@classmethod
|
|
@@ -295,7 +295,7 @@ class Model(object):
|
|
|
295
295
|
_validation: Dict[str, Dict[str, Any]] = {}
|
|
296
296
|
|
|
297
297
|
def __init__(self, **kwargs: Any) -> None:
|
|
298
|
-
self.additional_properties: Dict[str, Any] = {}
|
|
298
|
+
self.additional_properties: Optional[Dict[str, Any]] = {}
|
|
299
299
|
for k in kwargs:
|
|
300
300
|
if k not in self._attribute_map:
|
|
301
301
|
_LOGGER.warning("%s is not a known attribute of class %s and will be ignored", k, self.__class__)
|
|
@@ -340,7 +340,7 @@ class Model(object):
|
|
|
340
340
|
return _create_xml_node(xml_map.get("name", cls.__name__), xml_map.get("prefix", None), xml_map.get("ns", None))
|
|
341
341
|
|
|
342
342
|
def serialize(self, keep_readonly: bool = False, **kwargs: Any) -> JSON:
|
|
343
|
-
"""Return the JSON that would be sent to
|
|
343
|
+
"""Return the JSON that would be sent to server from this model.
|
|
344
344
|
|
|
345
345
|
This is an alias to `as_dict(full_restapi_key_transformer, keep_readonly=False)`.
|
|
346
346
|
|
|
@@ -351,7 +351,7 @@ class Model(object):
|
|
|
351
351
|
:rtype: dict
|
|
352
352
|
"""
|
|
353
353
|
serializer = Serializer(self._infer_class_models())
|
|
354
|
-
return serializer._serialize(self, keep_readonly=keep_readonly, **kwargs)
|
|
354
|
+
return serializer._serialize(self, keep_readonly=keep_readonly, **kwargs) # type: ignore
|
|
355
355
|
|
|
356
356
|
def as_dict(
|
|
357
357
|
self,
|
|
@@ -390,7 +390,7 @@ class Model(object):
|
|
|
390
390
|
:rtype: dict
|
|
391
391
|
"""
|
|
392
392
|
serializer = Serializer(self._infer_class_models())
|
|
393
|
-
return serializer._serialize(self, key_transformer=key_transformer, keep_readonly=keep_readonly, **kwargs)
|
|
393
|
+
return serializer._serialize(self, key_transformer=key_transformer, keep_readonly=keep_readonly, **kwargs) # type: ignore
|
|
394
394
|
|
|
395
395
|
@classmethod
|
|
396
396
|
def _infer_class_models(cls):
|
|
@@ -415,7 +415,7 @@ class Model(object):
|
|
|
415
415
|
:raises: DeserializationError if something went wrong
|
|
416
416
|
"""
|
|
417
417
|
deserializer = Deserializer(cls._infer_class_models())
|
|
418
|
-
return deserializer(cls.__name__, data, content_type=content_type)
|
|
418
|
+
return deserializer(cls.__name__, data, content_type=content_type) # type: ignore
|
|
419
419
|
|
|
420
420
|
@classmethod
|
|
421
421
|
def from_dict(
|
|
@@ -445,7 +445,7 @@ class Model(object):
|
|
|
445
445
|
if key_extractors is None
|
|
446
446
|
else key_extractors
|
|
447
447
|
)
|
|
448
|
-
return deserializer(cls.__name__, data, content_type=content_type)
|
|
448
|
+
return deserializer(cls.__name__, data, content_type=content_type) # type: ignore
|
|
449
449
|
|
|
450
450
|
@classmethod
|
|
451
451
|
def _flatten_subtype(cls, key, objects):
|
|
@@ -662,12 +662,13 @@ class Serializer(object):
|
|
|
662
662
|
_serialized.update(_new_attr) # type: ignore
|
|
663
663
|
_new_attr = _new_attr[k] # type: ignore
|
|
664
664
|
_serialized = _serialized[k]
|
|
665
|
-
except ValueError:
|
|
666
|
-
|
|
665
|
+
except ValueError as err:
|
|
666
|
+
if isinstance(err, SerializationError):
|
|
667
|
+
raise
|
|
667
668
|
|
|
668
669
|
except (AttributeError, KeyError, TypeError) as err:
|
|
669
670
|
msg = "Attribute {} in object {} cannot be serialized.\n{}".format(attr_name, class_name, str(target_obj))
|
|
670
|
-
|
|
671
|
+
raise SerializationError(msg) from err
|
|
671
672
|
else:
|
|
672
673
|
return serialized
|
|
673
674
|
|
|
@@ -709,7 +710,7 @@ class Serializer(object):
|
|
|
709
710
|
]
|
|
710
711
|
data = deserializer._deserialize(data_type, data)
|
|
711
712
|
except DeserializationError as err:
|
|
712
|
-
|
|
713
|
+
raise SerializationError("Unable to build a model: " + str(err)) from err
|
|
713
714
|
|
|
714
715
|
return self._serialize(data, data_type, **kwargs)
|
|
715
716
|
|
|
@@ -729,6 +730,7 @@ class Serializer(object):
|
|
|
729
730
|
|
|
730
731
|
if kwargs.get("skip_quote") is True:
|
|
731
732
|
output = str(output)
|
|
733
|
+
output = output.replace("{", quote("{")).replace("}", quote("}"))
|
|
732
734
|
else:
|
|
733
735
|
output = quote(str(output), safe="")
|
|
734
736
|
except SerializationError:
|
|
@@ -741,7 +743,9 @@ class Serializer(object):
|
|
|
741
743
|
|
|
742
744
|
:param data: The data to be serialized.
|
|
743
745
|
:param str data_type: The type to be serialized from.
|
|
744
|
-
:
|
|
746
|
+
:keyword bool skip_quote: Whether to skip quote the serialized result.
|
|
747
|
+
Defaults to False.
|
|
748
|
+
:rtype: str, list
|
|
745
749
|
:raises: TypeError if serialization fails.
|
|
746
750
|
:raises: ValueError if data is None
|
|
747
751
|
"""
|
|
@@ -749,10 +753,8 @@ class Serializer(object):
|
|
|
749
753
|
# Treat the list aside, since we don't want to encode the div separator
|
|
750
754
|
if data_type.startswith("["):
|
|
751
755
|
internal_data_type = data_type[1:-1]
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
data = [quote(str(d), safe="") for d in data]
|
|
755
|
-
return str(self.serialize_iter(data, internal_data_type, **kwargs))
|
|
756
|
+
do_quote = not kwargs.get("skip_quote", False)
|
|
757
|
+
return self.serialize_iter(data, internal_data_type, do_quote=do_quote, **kwargs)
|
|
756
758
|
|
|
757
759
|
# Not a list, regular serialization
|
|
758
760
|
output = self.serialize_data(data, data_type, **kwargs)
|
|
@@ -803,7 +805,7 @@ class Serializer(object):
|
|
|
803
805
|
raise ValueError("No value for given attribute")
|
|
804
806
|
|
|
805
807
|
try:
|
|
806
|
-
if data is
|
|
808
|
+
if data is CoreNull:
|
|
807
809
|
return None
|
|
808
810
|
if data_type in self.basic_types.values():
|
|
809
811
|
return self.serialize_basic(data, data_type, **kwargs)
|
|
@@ -823,7 +825,7 @@ class Serializer(object):
|
|
|
823
825
|
|
|
824
826
|
except (ValueError, TypeError) as err:
|
|
825
827
|
msg = "Unable to serialize value: {!r} as type: {!r}."
|
|
826
|
-
|
|
828
|
+
raise SerializationError(msg.format(data, data_type)) from err
|
|
827
829
|
else:
|
|
828
830
|
return self._serialize(data, **kwargs)
|
|
829
831
|
|
|
@@ -891,6 +893,8 @@ class Serializer(object):
|
|
|
891
893
|
not be None or empty.
|
|
892
894
|
:param str div: If set, this str will be used to combine the elements
|
|
893
895
|
in the iterable into a combined string. Default is 'None'.
|
|
896
|
+
:keyword bool do_quote: Whether to quote the serialized result of each iterable element.
|
|
897
|
+
Defaults to False.
|
|
894
898
|
:rtype: list, str
|
|
895
899
|
"""
|
|
896
900
|
if isinstance(data, str):
|
|
@@ -903,9 +907,14 @@ class Serializer(object):
|
|
|
903
907
|
for d in data:
|
|
904
908
|
try:
|
|
905
909
|
serialized.append(self.serialize_data(d, iter_type, **kwargs))
|
|
906
|
-
except ValueError:
|
|
910
|
+
except ValueError as err:
|
|
911
|
+
if isinstance(err, SerializationError):
|
|
912
|
+
raise
|
|
907
913
|
serialized.append(None)
|
|
908
914
|
|
|
915
|
+
if kwargs.get("do_quote", False):
|
|
916
|
+
serialized = ["" if s is None else quote(str(s), safe="") for s in serialized]
|
|
917
|
+
|
|
909
918
|
if div:
|
|
910
919
|
serialized = ["" if s is None else str(s) for s in serialized]
|
|
911
920
|
serialized = div.join(serialized)
|
|
@@ -950,7 +959,9 @@ class Serializer(object):
|
|
|
950
959
|
for key, value in attr.items():
|
|
951
960
|
try:
|
|
952
961
|
serialized[self.serialize_unicode(key)] = self.serialize_data(value, dict_type, **kwargs)
|
|
953
|
-
except ValueError:
|
|
962
|
+
except ValueError as err:
|
|
963
|
+
if isinstance(err, SerializationError):
|
|
964
|
+
raise
|
|
954
965
|
serialized[self.serialize_unicode(key)] = None
|
|
955
966
|
|
|
956
967
|
if "xml" in serialization_ctxt:
|
|
@@ -1160,10 +1171,10 @@ class Serializer(object):
|
|
|
1160
1171
|
return date + microseconds + "Z"
|
|
1161
1172
|
except (ValueError, OverflowError) as err:
|
|
1162
1173
|
msg = "Unable to serialize datetime object."
|
|
1163
|
-
|
|
1174
|
+
raise SerializationError(msg) from err
|
|
1164
1175
|
except AttributeError as err:
|
|
1165
1176
|
msg = "ISO-8601 object must be valid Datetime object."
|
|
1166
|
-
|
|
1177
|
+
raise TypeError(msg) from err
|
|
1167
1178
|
|
|
1168
1179
|
@staticmethod
|
|
1169
1180
|
def serialize_unix(attr, **kwargs):
|
|
@@ -1199,7 +1210,6 @@ def rest_key_extractor(attr, attr_desc, data):
|
|
|
1199
1210
|
if working_data is None:
|
|
1200
1211
|
# If at any point while following flatten JSON path see None, it means
|
|
1201
1212
|
# that all properties under are None as well
|
|
1202
|
-
# https://github.com/Azure/msrest-for-python/issues/197
|
|
1203
1213
|
return None
|
|
1204
1214
|
key = ".".join(dict_keys[1:])
|
|
1205
1215
|
|
|
@@ -1220,7 +1230,6 @@ def rest_key_case_insensitive_extractor(attr, attr_desc, data):
|
|
|
1220
1230
|
if working_data is None:
|
|
1221
1231
|
# If at any point while following flatten JSON path see None, it means
|
|
1222
1232
|
# that all properties under are None as well
|
|
1223
|
-
# https://github.com/Azure/msrest-for-python/issues/197
|
|
1224
1233
|
return None
|
|
1225
1234
|
key = ".".join(dict_keys[1:])
|
|
1226
1235
|
|
|
@@ -1471,7 +1480,7 @@ class Deserializer(object):
|
|
|
1471
1480
|
d_attrs[attr] = value
|
|
1472
1481
|
except (AttributeError, TypeError, KeyError) as err:
|
|
1473
1482
|
msg = "Unable to deserialize to object: " + class_name # type: ignore
|
|
1474
|
-
|
|
1483
|
+
raise DeserializationError(msg) from err
|
|
1475
1484
|
else:
|
|
1476
1485
|
additional_properties = self._build_additional_properties(attributes, data)
|
|
1477
1486
|
return self._instantiate_model(response, d_attrs, additional_properties)
|
|
@@ -1642,7 +1651,7 @@ class Deserializer(object):
|
|
|
1642
1651
|
except (ValueError, TypeError, AttributeError) as err:
|
|
1643
1652
|
msg = "Unable to deserialize response data."
|
|
1644
1653
|
msg += " Data: {}, {}".format(data, data_type)
|
|
1645
|
-
|
|
1654
|
+
raise DeserializationError(msg) from err
|
|
1646
1655
|
else:
|
|
1647
1656
|
return self._deserialize(obj_type, data)
|
|
1648
1657
|
|
|
@@ -1798,7 +1807,6 @@ class Deserializer(object):
|
|
|
1798
1807
|
data = data.value
|
|
1799
1808
|
if isinstance(data, int):
|
|
1800
1809
|
# Workaround. We might consider remove it in the future.
|
|
1801
|
-
# https://github.com/Azure/azure-rest-api-specs/issues/141
|
|
1802
1810
|
try:
|
|
1803
1811
|
return list(enum_obj.__members__.values())[data]
|
|
1804
1812
|
except IndexError:
|
|
@@ -1852,10 +1860,10 @@ class Deserializer(object):
|
|
|
1852
1860
|
if isinstance(attr, ET.Element):
|
|
1853
1861
|
attr = attr.text
|
|
1854
1862
|
try:
|
|
1855
|
-
return decimal.Decimal(attr) # type: ignore
|
|
1863
|
+
return decimal.Decimal(str(attr)) # type: ignore
|
|
1856
1864
|
except decimal.DecimalException as err:
|
|
1857
1865
|
msg = "Invalid decimal {}".format(attr)
|
|
1858
|
-
|
|
1866
|
+
raise DeserializationError(msg) from err
|
|
1859
1867
|
|
|
1860
1868
|
@staticmethod
|
|
1861
1869
|
def deserialize_long(attr):
|
|
@@ -1883,7 +1891,7 @@ class Deserializer(object):
|
|
|
1883
1891
|
duration = isodate.parse_duration(attr)
|
|
1884
1892
|
except (ValueError, OverflowError, AttributeError) as err:
|
|
1885
1893
|
msg = "Cannot deserialize duration object."
|
|
1886
|
-
|
|
1894
|
+
raise DeserializationError(msg) from err
|
|
1887
1895
|
else:
|
|
1888
1896
|
return duration
|
|
1889
1897
|
|
|
@@ -1900,7 +1908,7 @@ class Deserializer(object):
|
|
|
1900
1908
|
if re.search(r"[^\W\d_]", attr, re.I + re.U): # type: ignore
|
|
1901
1909
|
raise DeserializationError("Date must have only digits and -. Received: %s" % attr)
|
|
1902
1910
|
# This must NOT use defaultmonth/defaultday. Using None ensure this raises an exception.
|
|
1903
|
-
return isodate.parse_date(attr, defaultmonth=
|
|
1911
|
+
return isodate.parse_date(attr, defaultmonth=0, defaultday=0)
|
|
1904
1912
|
|
|
1905
1913
|
@staticmethod
|
|
1906
1914
|
def deserialize_time(attr):
|
|
@@ -1935,7 +1943,7 @@ class Deserializer(object):
|
|
|
1935
1943
|
date_obj = date_obj.astimezone(tz=TZ_UTC)
|
|
1936
1944
|
except ValueError as err:
|
|
1937
1945
|
msg = "Cannot deserialize to rfc datetime object."
|
|
1938
|
-
|
|
1946
|
+
raise DeserializationError(msg) from err
|
|
1939
1947
|
else:
|
|
1940
1948
|
return date_obj
|
|
1941
1949
|
|
|
@@ -1972,7 +1980,7 @@ class Deserializer(object):
|
|
|
1972
1980
|
raise OverflowError("Hit max or min date")
|
|
1973
1981
|
except (ValueError, OverflowError, AttributeError) as err:
|
|
1974
1982
|
msg = "Cannot deserialize datetime object."
|
|
1975
|
-
|
|
1983
|
+
raise DeserializationError(msg) from err
|
|
1976
1984
|
else:
|
|
1977
1985
|
return date_obj
|
|
1978
1986
|
|
|
@@ -1988,9 +1996,10 @@ class Deserializer(object):
|
|
|
1988
1996
|
if isinstance(attr, ET.Element):
|
|
1989
1997
|
attr = int(attr.text) # type: ignore
|
|
1990
1998
|
try:
|
|
1999
|
+
attr = int(attr)
|
|
1991
2000
|
date_obj = datetime.datetime.fromtimestamp(attr, TZ_UTC)
|
|
1992
2001
|
except ValueError as err:
|
|
1993
2002
|
msg = "Cannot deserialize to unix datetime object."
|
|
1994
|
-
|
|
2003
|
+
raise DeserializationError(msg) from err
|
|
1995
2004
|
else:
|
|
1996
2005
|
return date_obj
|
|
@@ -26,7 +26,7 @@ JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object
|
|
|
26
26
|
class BlobDetails(_serialization.Model):
|
|
27
27
|
"""Blob details.
|
|
28
28
|
|
|
29
|
-
All required parameters must be populated in order to send to
|
|
29
|
+
All required parameters must be populated in order to send to server.
|
|
30
30
|
|
|
31
31
|
:ivar container_name: The container name. Required.
|
|
32
32
|
:vartype container_name: str
|
|
@@ -98,7 +98,7 @@ class CostEstimate(_serialization.Model):
|
|
|
98
98
|
class ErrorData(_serialization.Model):
|
|
99
99
|
"""An error response from Azure.
|
|
100
100
|
|
|
101
|
-
All required parameters must be populated in order to send to
|
|
101
|
+
All required parameters must be populated in order to send to server.
|
|
102
102
|
|
|
103
103
|
:ivar code: An identifier for the error. Codes are invariant and are intended to be consumed
|
|
104
104
|
programmatically. Required.
|
|
@@ -140,7 +140,7 @@ class ItemDetails(_serialization.Model):
|
|
|
140
140
|
|
|
141
141
|
Variables are only populated by the server, and will be ignored when sending a request.
|
|
142
142
|
|
|
143
|
-
All required parameters must be populated in order to send to
|
|
143
|
+
All required parameters must be populated in order to send to server.
|
|
144
144
|
|
|
145
145
|
:ivar id: The id of the item. Required.
|
|
146
146
|
:vartype id: str
|
|
@@ -235,7 +235,7 @@ class ItemDetails(_serialization.Model):
|
|
|
235
235
|
class ItemDetailsList(_serialization.Model):
|
|
236
236
|
"""List of item details.
|
|
237
237
|
|
|
238
|
-
All required parameters must be populated in order to send to
|
|
238
|
+
All required parameters must be populated in order to send to server.
|
|
239
239
|
|
|
240
240
|
:ivar value: Required.
|
|
241
241
|
:vartype value: list[~azure.quantum._client.models.ItemDetails]
|
|
@@ -269,7 +269,7 @@ class JobDetails(ItemDetails): # pylint: disable=too-many-instance-attributes
|
|
|
269
269
|
|
|
270
270
|
Variables are only populated by the server, and will be ignored when sending a request.
|
|
271
271
|
|
|
272
|
-
All required parameters must be populated in order to send to
|
|
272
|
+
All required parameters must be populated in order to send to server.
|
|
273
273
|
|
|
274
274
|
:ivar id: The id of the item. Required.
|
|
275
275
|
:vartype id: str
|
|
@@ -488,7 +488,7 @@ class JobDetailsList(_serialization.Model):
|
|
|
488
488
|
class JsonPatchDocument(_serialization.Model):
|
|
489
489
|
"""A JSONPatch document as defined by RFC 6902.
|
|
490
490
|
|
|
491
|
-
All required parameters must be populated in order to send to
|
|
491
|
+
All required parameters must be populated in order to send to server.
|
|
492
492
|
|
|
493
493
|
:ivar op: The operation to be performed. Required. Known values are: "add", "remove",
|
|
494
494
|
"replace", "move", "copy", and "test".
|
|
@@ -733,7 +733,7 @@ class QuotaList(_serialization.Model):
|
|
|
733
733
|
class RestError(_serialization.Model):
|
|
734
734
|
"""Error information returned by the API.
|
|
735
735
|
|
|
736
|
-
All required parameters must be populated in order to send to
|
|
736
|
+
All required parameters must be populated in order to send to server.
|
|
737
737
|
|
|
738
738
|
:ivar error: An error response from Azure. Required.
|
|
739
739
|
:vartype error: ~azure.quantum._client.models.ErrorData
|
|
@@ -781,7 +781,7 @@ class SessionDetails(ItemDetails): # pylint: disable=too-many-instance-attribut
|
|
|
781
781
|
|
|
782
782
|
Variables are only populated by the server, and will be ignored when sending a request.
|
|
783
783
|
|
|
784
|
-
All required parameters must be populated in order to send to
|
|
784
|
+
All required parameters must be populated in order to send to server.
|
|
785
785
|
|
|
786
786
|
:ivar id: The id of the item. Required.
|
|
787
787
|
:vartype id: str
|