Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[AutoPR azure-mgmt-fabric] support sample gen for ts emitter #9465

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions sdk/fabric/azure-mgmt-fabric/_meta.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"commit": "9ce76c4f113368361dac4de5d0a71eb058602756",
"commit": "d4fe5dfc3368d89e26ba7ca111da2ba4f607dc79",
"repository_url": "https://github.com/Azure/azure-rest-api-specs",
"typespec_src": "specification/fabric/Microsoft.Fabric.Management",
"@azure-tools/typespec-python": "0.36.0"
"@azure-tools/typespec-python": "0.36.3"
}
10 changes: 8 additions & 2 deletions sdk/fabric/azure-mgmt-fabric/azure/mgmt/fabric/__init__.py
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 FabricMgmtClient
from typing import TYPE_CHECKING

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

from ._client import FabricMgmtClient # 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
16 changes: 8 additions & 8 deletions sdk/fabric/azure-mgmt-fabric/azure/mgmt/fabric/_model_base.py
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
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
2 changes: 1 addition & 1 deletion sdk/fabric/azure-mgmt-fabric/azure/mgmt/fabric/_version.py
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"
10 changes: 8 additions & 2 deletions sdk/fabric/azure-mgmt-fabric/azure/mgmt/fabric/aio/__init__.py
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 FabricMgmtClient
from typing import TYPE_CHECKING

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

from ._client import FabricMgmtClient # 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,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 ._operations import FabricCapacitiesOperations
from ._operations import Operations
from typing import TYPE_CHECKING

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

from ._operations import FabricCapacitiesOperations # type: ignore
from ._operations import Operations # 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
63 changes: 37 additions & 26 deletions sdk/fabric/azure-mgmt-fabric/azure/mgmt/fabric/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,35 +5,46 @@
# 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 CapacityAdministration
from ._models import CheckNameAvailabilityRequest
from ._models import CheckNameAvailabilityResponse
from ._models import ErrorAdditionalInfo
from ._models import ErrorDetail
from ._models import ErrorResponse
from ._models import FabricCapacity
from ._models import FabricCapacityProperties
from ._models import FabricCapacityUpdate
from ._models import FabricCapacityUpdateProperties
from ._models import Operation
from ._models import OperationDisplay
from ._models import Resource
from ._models import RpSku
from ._models import RpSkuDetailsForExistingResource
from ._models import RpSkuDetailsForNewResource
from ._models import SystemData
from ._models import TrackedResource
from typing import TYPE_CHECKING

from ._enums import ActionType
from ._enums import CheckNameAvailabilityReason
from ._enums import CreatedByType
from ._enums import Origin
from ._enums import ProvisioningState
from ._enums import ResourceState
from ._enums import RpSkuTier
if TYPE_CHECKING:
from ._patch import * # pylint: disable=unused-wildcard-import


from ._models import ( # type: ignore
CapacityAdministration,
CheckNameAvailabilityRequest,
CheckNameAvailabilityResponse,
ErrorAdditionalInfo,
ErrorDetail,
ErrorResponse,
FabricCapacity,
FabricCapacityProperties,
FabricCapacityUpdate,
FabricCapacityUpdateProperties,
Operation,
OperationDisplay,
Resource,
RpSku,
RpSkuDetailsForExistingResource,
RpSkuDetailsForNewResource,
SystemData,
TrackedResource,
)

from ._enums import ( # type: ignore
ActionType,
CheckNameAvailabilityReason,
CreatedByType,
Origin,
ProvisioningState,
ResourceState,
RpSkuTier,
)
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
29 changes: 15 additions & 14 deletions sdk/fabric/azure-mgmt-fabric/azure/mgmt/fabric/models/_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
# Code generated by Microsoft (R) Python Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
# pylint: disable=useless-super-delegation

import datetime
from typing import Any, Dict, List, Mapping, Optional, TYPE_CHECKING, Union, overload
Expand Down Expand Up @@ -41,7 +42,7 @@ def __init__(self, mapping: Mapping[str, Any]) -> None:
:type mapping: Mapping[str, Any]
"""

def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation
def __init__(self, *args: Any, **kwargs: Any) -> None:
super().__init__(*args, **kwargs)


Expand Down Expand Up @@ -74,7 +75,7 @@ def __init__(self, mapping: Mapping[str, Any]) -> None:
:type mapping: Mapping[str, Any]
"""

def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation
def __init__(self, *args: Any, **kwargs: Any) -> None:
super().__init__(*args, **kwargs)


Expand Down Expand Up @@ -114,7 +115,7 @@ def __init__(self, mapping: Mapping[str, Any]) -> None:
:type mapping: Mapping[str, Any]
"""

def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation
def __init__(self, *args: Any, **kwargs: Any) -> None:
super().__init__(*args, **kwargs)


Expand Down Expand Up @@ -191,7 +192,7 @@ def __init__(self, mapping: Mapping[str, Any]) -> None:
:type mapping: Mapping[str, Any]
"""

def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation
def __init__(self, *args: Any, **kwargs: Any) -> None:
super().__init__(*args, **kwargs)


Expand Down Expand Up @@ -269,7 +270,7 @@ def __init__(self, mapping: Mapping[str, Any]) -> None:
:type mapping: Mapping[str, Any]
"""

def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation
def __init__(self, *args: Any, **kwargs: Any) -> None:
super().__init__(*args, **kwargs)


Expand Down Expand Up @@ -322,7 +323,7 @@ def __init__(self, mapping: Mapping[str, Any]) -> None:
:type mapping: Mapping[str, Any]
"""

def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation
def __init__(self, *args: Any, **kwargs: Any) -> None:
super().__init__(*args, **kwargs)


Expand Down Expand Up @@ -373,7 +374,7 @@ def __init__(self, mapping: Mapping[str, Any]) -> None:
:type mapping: Mapping[str, Any]
"""

def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation
def __init__(self, *args: Any, **kwargs: Any) -> None:
super().__init__(*args, **kwargs)


Expand Down Expand Up @@ -411,7 +412,7 @@ def __init__(self, mapping: Mapping[str, Any]) -> None:
:type mapping: Mapping[str, Any]
"""

def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation
def __init__(self, *args: Any, **kwargs: Any) -> None:
super().__init__(*args, **kwargs)


Expand Down Expand Up @@ -439,7 +440,7 @@ def __init__(self, mapping: Mapping[str, Any]) -> None:
:type mapping: Mapping[str, Any]
"""

def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation
def __init__(self, *args: Any, **kwargs: Any) -> None:
super().__init__(*args, **kwargs)


Expand Down Expand Up @@ -496,7 +497,7 @@ def __init__(self, mapping: Mapping[str, Any]) -> None:
:type mapping: Mapping[str, Any]
"""

def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation
def __init__(self, *args: Any, **kwargs: Any) -> None:
super().__init__(*args, **kwargs)


Expand Down Expand Up @@ -563,7 +564,7 @@ def __init__(self, mapping: Mapping[str, Any]) -> None:
:type mapping: Mapping[str, Any]
"""

def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation
def __init__(self, *args: Any, **kwargs: Any) -> None:
super().__init__(*args, **kwargs)


Expand Down Expand Up @@ -597,7 +598,7 @@ def __init__(self, mapping: Mapping[str, Any]) -> None:
:type mapping: Mapping[str, Any]
"""

def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation
def __init__(self, *args: Any, **kwargs: Any) -> None:
super().__init__(*args, **kwargs)


Expand Down Expand Up @@ -636,7 +637,7 @@ def __init__(self, mapping: Mapping[str, Any]) -> None:
:type mapping: Mapping[str, Any]
"""

def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation
def __init__(self, *args: Any, **kwargs: Any) -> None:
super().__init__(*args, **kwargs)


Expand Down Expand Up @@ -693,5 +694,5 @@ def __init__(self, mapping: Mapping[str, Any]) -> None:
:type mapping: Mapping[str, Any]
"""

def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation
def __init__(self, *args: Any, **kwargs: Any) -> None:
super().__init__(*args, **kwargs)
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 ._operations import FabricCapacitiesOperations
from ._operations import Operations
from typing import TYPE_CHECKING

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

from ._operations import FabricCapacitiesOperations # type: ignore
from ._operations import Operations # 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
2 changes: 1 addition & 1 deletion sdk/fabric/azure-mgmt-fabric/tsp-location.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
directory: specification/fabric/Microsoft.Fabric.Management
commit: 9ce76c4f113368361dac4de5d0a71eb058602756
commit: d4fe5dfc3368d89e26ba7ca111da2ba4f607dc79
repo: Azure/azure-rest-api-specs
additionalDirectories: