Skip to content

Commit

Permalink
CodeGen from PR 31630 in Azure/azure-rest-api-specs
Browse files Browse the repository at this point in the history
Merge 955cc5cfeae3068e582c60bb2f67782296222dd2 into d51daf81ee853946b5ccddf01614423a618fc541
  • Loading branch information
SDKAuto committed Nov 21, 2024
1 parent 70f7149 commit 97c31cb
Show file tree
Hide file tree
Showing 17 changed files with 185 additions and 242 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"commit": "95e89f00932d2a8f04ff80e28f8ce10ee586ca7d",
"commit": "aa3121a138062bf74a48f251990a9b76ea09cde0",
"repository_url": "https://github.com/Azure/azure-rest-api-specs",
"typespec_src": "specification/devopsinfrastructure/Microsoft.DevOpsInfrastructure.Management",
"@azure-tools/typespec-python": "0.36.0"
"@azure-tools/typespec-python": "0.36.5"
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,21 @@
# Code generated by Microsoft (R) Python Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
# pylint: disable=wrong-import-position

from ._client import DevOpsInfrastructureMgmtClient
from typing import TYPE_CHECKING

if TYPE_CHECKING:
from ._patch import * # pylint: disable=unused-wildcard-import

from ._client import DevOpsInfrastructureMgmtClient # type: ignore
from ._version import VERSION

__version__ = VERSION

try:
from ._patch import __all__ as _patch_all
from ._patch import * # pylint: disable=unused-wildcard-import
from ._patch import *
except ImportError:
_patch_all = []
from ._patch import patch_sdk as _patch_sdk
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# --------------------------------------------------------------------------
# pylint: disable=protected-access, arguments-differ, signature-differs, broad-except, too-many-lines
# pylint: disable=protected-access, broad-except

import copy
import calendar
Expand Down Expand Up @@ -574,7 +574,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None:
def copy(self) -> "Model":
return Model(self.__dict__)

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

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

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

@classmethod
def _deserialize(cls, data, exist_discriminators):
if not hasattr(cls, "__mapping__"): # pylint: disable=no-member
if not hasattr(cls, "__mapping__"):
return cls(data)
discriminator = cls._get_discriminator(exist_discriminators)
if discriminator is None:
Expand All @@ -633,7 +633,7 @@ def _deserialize(cls, data, exist_discriminators):
discriminator_value = data.find(xml_name).text # pyright: ignore
else:
discriminator_value = data.get(discriminator._rest_name)
mapped_cls = cls.__mapping__.get(discriminator_value, cls) # pyright: ignore # pylint: disable=no-member
mapped_cls = cls.__mapping__.get(discriminator_value, cls) # pyright: ignore
return mapped_cls._deserialize(data, exist_discriminators)

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

try:
if module and _is_model(annotation):
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# pylint: disable=too-many-lines
# --------------------------------------------------------------------------
#
# Copyright (c) Microsoft Corporation. All rights reserved.
Expand Down Expand Up @@ -506,7 +507,6 @@ def _flatten_subtype(cls, key, objects):
def _classify(cls, response, objects):
"""Check the class _subtype_map for any child classes.
We want to ignore any inherited _subtype_maps.
Remove the polymorphic key from the initial data.
:param dict response: The initial data
:param dict objects: The class objects
Expand All @@ -518,7 +518,7 @@ def _classify(cls, response, objects):

if not isinstance(response, ET.Element):
rest_api_response_key = cls._get_rest_key_parts(subtype_key)[-1]
subtype_value = response.pop(rest_api_response_key, None) or response.pop(subtype_key, None)
subtype_value = response.get(rest_api_response_key, None) or response.get(subtype_key, None)
else:
subtype_value = xml_key_extractor(subtype_key, cls._attribute_map[subtype_key], response)
if subtype_value:
Expand Down Expand Up @@ -1683,17 +1683,21 @@ def _instantiate_model(self, response, attrs, additional_properties=None):
subtype = getattr(response, "_subtype_map", {})
try:
readonly = [
k for k, v in response._validation.items() if v.get("readonly") # pylint: disable=protected-access
k
for k, v in response._validation.items() # pylint: disable=protected-access # type: ignore
if v.get("readonly")
]
const = [
k for k, v in response._validation.items() if v.get("constant") # pylint: disable=protected-access
k
for k, v in response._validation.items() # pylint: disable=protected-access # type: ignore
if v.get("constant")
]
kwargs = {k: v for k, v in attrs.items() if k not in subtype and k not in readonly + const}
response_obj = response(**kwargs)
for attr in readonly:
setattr(response_obj, attr, attrs.get(attr))
if additional_properties:
response_obj.additional_properties = additional_properties
response_obj.additional_properties = additional_properties # type: ignore
return response_obj
except TypeError as err:
msg = "Unable to deserialize {} into model {}. ".format(kwargs, response) # type: ignore
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------

VERSION = "1.0.0"
VERSION = "1.0.0b1"
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,18 @@
# Code generated by Microsoft (R) Python Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
# pylint: disable=wrong-import-position

from ._client import DevOpsInfrastructureMgmtClient
from typing import TYPE_CHECKING

if TYPE_CHECKING:
from ._patch import * # pylint: disable=unused-wildcard-import

from ._client import DevOpsInfrastructureMgmtClient # type: ignore

try:
from ._patch import __all__ as _patch_all
from ._patch import * # pylint: disable=unused-wildcard-import
from ._patch import *
except ImportError:
_patch_all = []
from ._patch import patch_sdk as _patch_sdk
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,22 @@
# Code generated by Microsoft (R) Python Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
# pylint: disable=wrong-import-position

from ._operations import Operations
from ._operations import PoolsOperations
from ._operations import ResourceDetailsOperations
from ._operations import SkuOperations
from ._operations import SubscriptionUsagesOperations
from ._operations import ImageVersionsOperations
from typing import TYPE_CHECKING

if TYPE_CHECKING:
from ._patch import * # pylint: disable=unused-wildcard-import

from ._operations import Operations # type: ignore
from ._operations import PoolsOperations # type: ignore
from ._operations import ResourceDetailsOperations # type: ignore
from ._operations import SkuOperations # type: ignore
from ._operations import SubscriptionUsagesOperations # type: ignore
from ._operations import ImageVersionsOperations # type: ignore

from ._patch import __all__ as _patch_all
from ._patch import * # pylint: disable=unused-wildcard-import
from ._patch import *
from ._patch import patch_sdk as _patch_sdk

__all__ = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def __init__(self, *args, **kwargs) -> None:
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")

@distributed_trace
def list(self, **kwargs: Any) -> AsyncIterable["_models._models.Operation"]:
def _list(self, **kwargs: Any) -> AsyncIterable["_models._models.Operation"]:
"""List the operations for the provider.
:return: An iterator like instance of Operation
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,71 +5,82 @@
# Code generated by Microsoft (R) Python Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
# pylint: disable=wrong-import-position

from ._models import AgentProfile
from ._models import AutomaticResourcePredictionsProfile
from ._models import AzureDevOpsOrganizationProfile
from ._models import AzureDevOpsPermissionProfile
from ._models import DataDisk
from ._models import DevOpsAzureSku
from ._models import ErrorAdditionalInfo
from ._models import ErrorDetail
from ._models import ErrorResponse
from ._models import FabricProfile
from ._models import GitHubOrganization
from ._models import GitHubOrganizationProfile
from ._models import ImageVersion
from ._models import ImageVersionProperties
from ._models import ManagedServiceIdentity
from ._models import ManualResourcePredictionsProfile
from ._models import NetworkProfile
from ._models import Organization
from ._models import OrganizationProfile
from ._models import OsProfile
from ._models import Pool
from ._models import PoolImage
from ._models import PoolProperties
from ._models import PoolUpdate
from ._models import PoolUpdateProperties
from ._models import ProxyResource
from ._models import Quota
from ._models import QuotaName
from ._models import Resource
from ._models import ResourceDetailsObject
from ._models import ResourceDetailsObjectProperties
from ._models import ResourcePredictions
from ._models import ResourcePredictionsProfile
from ._models import ResourceSku
from ._models import ResourceSkuCapabilities
from ._models import ResourceSkuLocationInfo
from ._models import ResourceSkuProperties
from ._models import ResourceSkuRestrictionInfo
from ._models import ResourceSkuRestrictions
from ._models import ResourceSkuZoneDetails
from ._models import SecretsManagementSettings
from ._models import Stateful
from ._models import StatelessAgentProfile
from ._models import StorageProfile
from ._models import SystemData
from ._models import TrackedResource
from ._models import UserAssignedIdentity
from ._models import VmssFabricProfile
from typing import TYPE_CHECKING

from ._enums import AzureDevOpsPermissionType
from ._enums import CachingType
from ._enums import CreatedByType
from ._enums import LogonType
from ._enums import ManagedServiceIdentityType
from ._enums import OsDiskStorageAccountType
from ._enums import PredictionPreference
from ._enums import ProvisioningState
from ._enums import ResourcePredictionsProfileType
from ._enums import ResourceSkuRestrictionsReasonCode
from ._enums import ResourceSkuRestrictionsType
from ._enums import ResourceStatus
from ._enums import StorageAccountType
if TYPE_CHECKING:
from ._patch import * # pylint: disable=unused-wildcard-import


from ._models import ( # type: ignore
AgentProfile,
AutomaticResourcePredictionsProfile,
AzureDevOpsOrganizationProfile,
AzureDevOpsPermissionProfile,
DataDisk,
DevOpsAzureSku,
ErrorAdditionalInfo,
ErrorDetail,
ErrorResponse,
FabricProfile,
GitHubOrganization,
GitHubOrganizationProfile,
ImageVersion,
ImageVersionProperties,
ManagedServiceIdentity,
ManualResourcePredictionsProfile,
NetworkProfile,
Organization,
OrganizationProfile,
OsProfile,
Pool,
PoolImage,
PoolProperties,
PoolUpdate,
PoolUpdateProperties,
ProxyResource,
Quota,
QuotaName,
Resource,
ResourceDetailsObject,
ResourceDetailsObjectProperties,
ResourcePredictions,
ResourcePredictionsProfile,
ResourceSku,
ResourceSkuCapabilities,
ResourceSkuLocationInfo,
ResourceSkuProperties,
ResourceSkuRestrictionInfo,
ResourceSkuRestrictions,
ResourceSkuZoneDetails,
SecretsManagementSettings,
Stateful,
StatelessAgentProfile,
StorageProfile,
SystemData,
TrackedResource,
UserAssignedIdentity,
VmssFabricProfile,
)

from ._enums import ( # type: ignore
AzureDevOpsPermissionType,
CachingType,
CreatedByType,
LogonType,
ManagedServiceIdentityType,
OsDiskStorageAccountType,
PredictionPreference,
ProvisioningState,
ResourcePredictionsProfileType,
ResourceSkuRestrictionsReasonCode,
ResourceSkuRestrictionsType,
ResourceStatus,
StorageAccountType,
)
from ._patch import __all__ as _patch_all
from ._patch import * # pylint: disable=unused-wildcard-import
from ._patch import *
from ._patch import patch_sdk as _patch_sdk

__all__ = [
Expand Down
Loading

0 comments on commit 97c31cb

Please sign in to comment.