Skip to content

Commit a16a406

Browse files
author
SDKAuto
committed
CodeGen from PR 32241 in Azure/azure-rest-api-specs
Merge 751b954a7fcae2d49ffb39a552c7274c90467584 into 4744046cdc26b7e60ba4615bc79dc1fdfce4ea71
1 parent e55a695 commit a16a406

32 files changed

+895
-330
lines changed
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
2-
"commit": "95e89f00932d2a8f04ff80e28f8ce10ee586ca7d",
2+
"commit": "39b688d055419440f508f49d953299a13aa8d1eb",
33
"repository_url": "https://github.com/Azure/azure-rest-api-specs",
44
"typespec_src": "specification/devopsinfrastructure/Microsoft.DevOpsInfrastructure.Management",
5-
"@azure-tools/typespec-python": "0.36.0"
5+
"@azure-tools/typespec-python": "0.38.1"
66
}

sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/devopsinfrastructure/__init__.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,21 @@
55
# Code generated by Microsoft (R) Python Code Generator.
66
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
77
# --------------------------------------------------------------------------
8+
# pylint: disable=wrong-import-position
89

9-
from ._client import DevOpsInfrastructureMgmtClient
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 DevOpsInfrastructureMgmtClient # type: ignore
1016
from ._version import VERSION
1117

1218
__version__ = VERSION
1319

1420
try:
1521
from ._patch import __all__ as _patch_all
16-
from ._patch import * # pylint: disable=unused-wildcard-import
22+
from ._patch import *
1723
except ImportError:
1824
_patch_all = []
1925
from ._patch import patch_sdk as _patch_sdk

sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/devopsinfrastructure/_client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ class DevOpsInfrastructureMgmtClient:
5252
:type subscription_id: str
5353
:param base_url: Service host. Default value is "https://management.azure.com".
5454
:type base_url: str
55-
:keyword api_version: The API version to use for this operation. Default value is "2024-10-19".
55+
:keyword api_version: The API version to use for this operation. Default value is "2025-01-21".
5656
Note that overriding this default value may result in unsupported behavior.
5757
:paramtype api_version: str
5858
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no

sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/devopsinfrastructure/_configuration.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class DevOpsInfrastructureMgmtClientConfiguration: # pylint: disable=too-many-i
2929
:type subscription_id: str
3030
:param base_url: Service host. Default value is "https://management.azure.com".
3131
:type base_url: str
32-
:keyword api_version: The API version to use for this operation. Default value is "2024-10-19".
32+
:keyword api_version: The API version to use for this operation. Default value is "2025-01-21".
3333
Note that overriding this default value may result in unsupported behavior.
3434
:paramtype api_version: str
3535
"""
@@ -41,7 +41,7 @@ def __init__(
4141
base_url: str = "https://management.azure.com",
4242
**kwargs: Any
4343
) -> None:
44-
api_version: str = kwargs.pop("api_version", "2024-10-19")
44+
api_version: str = kwargs.pop("api_version", "2025-01-21")
4545

4646
if credential is None:
4747
raise ValueError("Parameter 'credential' must not be None.")

sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/devopsinfrastructure/_model_base.py

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# Licensed under the MIT License. See License.txt in the project root for
66
# license information.
77
# --------------------------------------------------------------------------
8-
# pylint: disable=protected-access, arguments-differ, signature-differs, broad-except, too-many-lines
8+
# pylint: disable=protected-access, broad-except
99

1010
import copy
1111
import calendar
@@ -574,7 +574,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None:
574574
def copy(self) -> "Model":
575575
return Model(self.__dict__)
576576

577-
def __new__(cls, *args: typing.Any, **kwargs: typing.Any) -> Self: # pylint: disable=unused-argument
577+
def __new__(cls, *args: typing.Any, **kwargs: typing.Any) -> Self:
578578
if f"{cls.__module__}.{cls.__qualname__}" not in cls._calculated:
579579
# we know the last nine classes in mro are going to be 'Model', '_MyMutableMapping', 'MutableMapping',
580580
# 'Mapping', 'Collection', 'Sized', 'Iterable', 'Container' and 'object'
@@ -585,8 +585,8 @@ def __new__(cls, *args: typing.Any, **kwargs: typing.Any) -> Self: # pylint: di
585585
annotations = {
586586
k: v
587587
for mro_class in mros
588-
if hasattr(mro_class, "__annotations__") # pylint: disable=no-member
589-
for k, v in mro_class.__annotations__.items() # pylint: disable=no-member
588+
if hasattr(mro_class, "__annotations__")
589+
for k, v in mro_class.__annotations__.items()
590590
}
591591
for attr, rf in attr_to_rest_field.items():
592592
rf._module = cls.__module__
@@ -601,8 +601,8 @@ def __new__(cls, *args: typing.Any, **kwargs: typing.Any) -> Self: # pylint: di
601601

602602
def __init_subclass__(cls, discriminator: typing.Optional[str] = None) -> None:
603603
for base in cls.__bases__:
604-
if hasattr(base, "__mapping__"): # pylint: disable=no-member
605-
base.__mapping__[discriminator or cls.__name__] = cls # type: ignore # pylint: disable=no-member
604+
if hasattr(base, "__mapping__"):
605+
base.__mapping__[discriminator or cls.__name__] = cls # type: ignore
606606

607607
@classmethod
608608
def _get_discriminator(cls, exist_discriminators) -> typing.Optional["_RestField"]:
@@ -613,7 +613,7 @@ def _get_discriminator(cls, exist_discriminators) -> typing.Optional["_RestField
613613

614614
@classmethod
615615
def _deserialize(cls, data, exist_discriminators):
616-
if not hasattr(cls, "__mapping__"): # pylint: disable=no-member
616+
if not hasattr(cls, "__mapping__"):
617617
return cls(data)
618618
discriminator = cls._get_discriminator(exist_discriminators)
619619
if discriminator is None:
@@ -633,7 +633,7 @@ def _deserialize(cls, data, exist_discriminators):
633633
discriminator_value = data.find(xml_name).text # pyright: ignore
634634
else:
635635
discriminator_value = data.get(discriminator._rest_name)
636-
mapped_cls = cls.__mapping__.get(discriminator_value, cls) # pyright: ignore # pylint: disable=no-member
636+
mapped_cls = cls.__mapping__.get(discriminator_value, cls) # pyright: ignore
637637
return mapped_cls._deserialize(data, exist_discriminators)
638638

639639
def as_dict(self, *, exclude_readonly: bool = False) -> typing.Dict[str, typing.Any]:
@@ -754,7 +754,7 @@ def _get_deserialize_callable_from_annotation( # pylint: disable=too-many-retur
754754
except AttributeError:
755755
model_name = annotation
756756
if module is not None:
757-
annotation = _get_model(module, model_name)
757+
annotation = _get_model(module, model_name) # type: ignore
758758

759759
try:
760760
if module and _is_model(annotation):
@@ -894,6 +894,22 @@ def _deserialize(
894894
return _deserialize_with_callable(deserializer, value)
895895

896896

897+
def _failsafe_deserialize(
898+
deserializer: typing.Any,
899+
value: typing.Any,
900+
module: typing.Optional[str] = None,
901+
rf: typing.Optional["_RestField"] = None,
902+
format: typing.Optional[str] = None,
903+
) -> typing.Any:
904+
try:
905+
return _deserialize(deserializer, value, module, rf, format)
906+
except DeserializationError:
907+
_LOGGER.warning(
908+
"Ran into a deserialization error. Ignoring since this is failsafe deserialization", exc_info=True
909+
)
910+
return None
911+
912+
897913
class _RestField:
898914
def __init__(
899915
self,

sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/devopsinfrastructure/_serialization.py

Lines changed: 14 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# pylint: disable=too-many-lines
12
# --------------------------------------------------------------------------
23
#
34
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -184,73 +185,7 @@ def deserialize_from_http_generics(cls, body_bytes: Optional[Union[AnyStr, IO]],
184185
except NameError:
185186
_long_type = int
186187

187-
188-
class UTC(datetime.tzinfo):
189-
"""Time Zone info for handling UTC"""
190-
191-
def utcoffset(self, dt):
192-
"""UTF offset for UTC is 0.
193-
194-
:param datetime.datetime dt: The datetime
195-
:returns: The offset
196-
:rtype: datetime.timedelta
197-
"""
198-
return datetime.timedelta(0)
199-
200-
def tzname(self, dt):
201-
"""Timestamp representation.
202-
203-
:param datetime.datetime dt: The datetime
204-
:returns: The timestamp representation
205-
:rtype: str
206-
"""
207-
return "Z"
208-
209-
def dst(self, dt):
210-
"""No daylight saving for UTC.
211-
212-
:param datetime.datetime dt: The datetime
213-
:returns: The daylight saving time
214-
:rtype: datetime.timedelta
215-
"""
216-
return datetime.timedelta(hours=1)
217-
218-
219-
try:
220-
from datetime import timezone as _FixedOffset # type: ignore
221-
except ImportError: # Python 2.7
222-
223-
class _FixedOffset(datetime.tzinfo): # type: ignore
224-
"""Fixed offset in minutes east from UTC.
225-
Copy/pasted from Python doc
226-
:param datetime.timedelta offset: offset in timedelta format
227-
"""
228-
229-
def __init__(self, offset) -> None:
230-
self.__offset = offset
231-
232-
def utcoffset(self, dt):
233-
return self.__offset
234-
235-
def tzname(self, dt):
236-
return str(self.__offset.total_seconds() / 3600)
237-
238-
def __repr__(self):
239-
return "<FixedOffset {}>".format(self.tzname(None))
240-
241-
def dst(self, dt):
242-
return datetime.timedelta(0)
243-
244-
def __getinitargs__(self):
245-
return (self.__offset,)
246-
247-
248-
try:
249-
from datetime import timezone
250-
251-
TZ_UTC = timezone.utc
252-
except ImportError:
253-
TZ_UTC = UTC() # type: ignore
188+
TZ_UTC = datetime.timezone.utc
254189

255190
_FLATTEN = re.compile(r"(?<!\\)\.")
256191

@@ -309,7 +244,7 @@ def _create_xml_node(tag, prefix=None, ns=None):
309244
return ET.Element(tag)
310245

311246

312-
class Model(object):
247+
class Model:
313248
"""Mixin for all client request body/response body models to support
314249
serialization and deserialization.
315250
"""
@@ -506,7 +441,6 @@ def _flatten_subtype(cls, key, objects):
506441
def _classify(cls, response, objects):
507442
"""Check the class _subtype_map for any child classes.
508443
We want to ignore any inherited _subtype_maps.
509-
Remove the polymorphic key from the initial data.
510444
511445
:param dict response: The initial data
512446
:param dict objects: The class objects
@@ -518,7 +452,7 @@ def _classify(cls, response, objects):
518452

519453
if not isinstance(response, ET.Element):
520454
rest_api_response_key = cls._get_rest_key_parts(subtype_key)[-1]
521-
subtype_value = response.pop(rest_api_response_key, None) or response.pop(subtype_key, None)
455+
subtype_value = response.get(rest_api_response_key, None) or response.get(subtype_key, None)
522456
else:
523457
subtype_value = xml_key_extractor(subtype_key, cls._attribute_map[subtype_key], response)
524458
if subtype_value:
@@ -563,7 +497,7 @@ def _decode_attribute_map_key(key):
563497
return key.replace("\\.", ".")
564498

565499

566-
class Serializer(object): # pylint: disable=too-many-public-methods
500+
class Serializer: # pylint: disable=too-many-public-methods
567501
"""Request object model serializer."""
568502

569503
basic_types = {str: "str", int: "int", bool: "bool", float: "float"}
@@ -1441,7 +1375,7 @@ def xml_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument
14411375
return children[0]
14421376

14431377

1444-
class Deserializer(object):
1378+
class Deserializer:
14451379
"""Response object model deserializer.
14461380
14471381
:param dict classes: Class type dictionary for deserializing complex types.
@@ -1683,17 +1617,21 @@ def _instantiate_model(self, response, attrs, additional_properties=None):
16831617
subtype = getattr(response, "_subtype_map", {})
16841618
try:
16851619
readonly = [
1686-
k for k, v in response._validation.items() if v.get("readonly") # pylint: disable=protected-access
1620+
k
1621+
for k, v in response._validation.items() # pylint: disable=protected-access # type: ignore
1622+
if v.get("readonly")
16871623
]
16881624
const = [
1689-
k for k, v in response._validation.items() if v.get("constant") # pylint: disable=protected-access
1625+
k
1626+
for k, v in response._validation.items() # pylint: disable=protected-access # type: ignore
1627+
if v.get("constant")
16901628
]
16911629
kwargs = {k: v for k, v in attrs.items() if k not in subtype and k not in readonly + const}
16921630
response_obj = response(**kwargs)
16931631
for attr in readonly:
16941632
setattr(response_obj, attr, attrs.get(attr))
16951633
if additional_properties:
1696-
response_obj.additional_properties = additional_properties
1634+
response_obj.additional_properties = additional_properties # type: ignore
16971635
return response_obj
16981636
except TypeError as err:
16991637
msg = "Unable to deserialize {} into model {}. ".format(kwargs, response) # type: ignore
@@ -2047,7 +1985,7 @@ def deserialize_rfc(attr):
20471985
try:
20481986
parsed_date = email.utils.parsedate_tz(attr) # type: ignore
20491987
date_obj = datetime.datetime(
2050-
*parsed_date[:6], tzinfo=_FixedOffset(datetime.timedelta(minutes=(parsed_date[9] or 0) / 60))
1988+
*parsed_date[:6], tzinfo=datetime.timezone(datetime.timedelta(minutes=(parsed_date[9] or 0) / 60))
20511989
)
20521990
if not date_obj.tzinfo:
20531991
date_obj = date_obj.astimezone(tz=TZ_UTC)

sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/devopsinfrastructure/_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@
66
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
77
# --------------------------------------------------------------------------
88

9-
VERSION = "1.0.0"
9+
VERSION = "1.0.0b1"

sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/devopsinfrastructure/aio/__init__.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,18 @@
55
# Code generated by Microsoft (R) Python Code Generator.
66
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
77
# --------------------------------------------------------------------------
8+
# pylint: disable=wrong-import-position
89

9-
from ._client import DevOpsInfrastructureMgmtClient
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 DevOpsInfrastructureMgmtClient # type: ignore
1016

1117
try:
1218
from ._patch import __all__ as _patch_all
13-
from ._patch import * # pylint: disable=unused-wildcard-import
19+
from ._patch import *
1420
except ImportError:
1521
_patch_all = []
1622
from ._patch import patch_sdk as _patch_sdk

sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/devopsinfrastructure/aio/_client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ class DevOpsInfrastructureMgmtClient:
5353
:type subscription_id: str
5454
:param base_url: Service host. Default value is "https://management.azure.com".
5555
:type base_url: str
56-
:keyword api_version: The API version to use for this operation. Default value is "2024-10-19".
56+
:keyword api_version: The API version to use for this operation. Default value is "2025-01-21".
5757
Note that overriding this default value may result in unsupported behavior.
5858
:paramtype api_version: str
5959
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no

sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/azure/mgmt/devopsinfrastructure/aio/_configuration.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class DevOpsInfrastructureMgmtClientConfiguration: # pylint: disable=too-many-i
2929
:type subscription_id: str
3030
:param base_url: Service host. Default value is "https://management.azure.com".
3131
:type base_url: str
32-
:keyword api_version: The API version to use for this operation. Default value is "2024-10-19".
32+
:keyword api_version: The API version to use for this operation. Default value is "2025-01-21".
3333
Note that overriding this default value may result in unsupported behavior.
3434
:paramtype api_version: str
3535
"""
@@ -41,7 +41,7 @@ def __init__(
4141
base_url: str = "https://management.azure.com",
4242
**kwargs: Any
4343
) -> None:
44-
api_version: str = kwargs.pop("api_version", "2024-10-19")
44+
api_version: str = kwargs.pop("api_version", "2025-01-21")
4545

4646
if credential is None:
4747
raise ValueError("Parameter 'credential' must not be None.")

0 commit comments

Comments
 (0)